On 22/05/2020 14:34, Mgr. Janusz Chmiel via fpc-other wrote:
> I Am wondering, how to construct The series of Pascal statements which will
> have The same effect like in Java.
> wakeLock.acquire ();
> 
> 
> The command
> wakeLock.newWakeLock (1, '"Migration');
> Work perfectly.
> But
>         wakeLock.acquire (
>                           );
> Causes error when compiling.
> I Am using AndroidR15
> APi headers for Pascal.

The AOPowerManager.WakeLock inner class declaration is indeed incomplete
in the Pascal translation: it's missing all of the method declarations.
It must be a bug in the javapp program (maybe because the constructor of
that class is private).

You should be able to work around it by placing this declaration in your
own program or unit source file. It should override the incomplete
declaration from the androidr15 unit.

type
  AOPowerManager = class external 'android.os' name 'PowerManager'
(JLObject)
  public
    type
      InnerWakeLock = class;
      Arr1InnerWakeLock = array of InnerWakeLock;
      Arr2InnerWakeLock = array of Arr1InnerWakeLock;
      Arr3InnerWakeLock = array of Arr2InnerWakeLock;
      InnerWakeLock = class external 'android.os' name 'WakeLock'
        procedure acquire; overload; virtual;
        procedure acquire(timeout: jlong); overload; virtual;
        function isHeld: boolean; overload; virtual;
        procedure release; overload; virtual;
        procedure release(flags: jint); overload; virtual;
        procedure setReferenceCounted(value: boolean); overload; virtual;
        procedure setWorkSource(ws: AOWorkSource); overload; virtual;
        function toString(): JLString; overload; virtual;
      end;

  public
    const
      PARTIAL_WAKE_LOCK = 1;
      FULL_WAKE_LOCK = 26;
      SCREEN_BRIGHT_WAKE_LOCK = 10;
      SCREEN_DIM_WAKE_LOCK = 6;
      ACQUIRE_CAUSES_WAKEUP = 268435456;
      ON_AFTER_RELEASE = 536870912;
  public
    function newWakeLock(para1: jint; para2: JLString):
AOPowerManager.InnerWakeLock; overload; virtual;
    procedure userActivity(para1: jlong; para2: jboolean); overload;
virtual;
    procedure goToSleep(para1: jlong); overload; virtual;
    function isScreenOn(): jboolean; overload; virtual;
    procedure reboot(para1: JLString); overload; virtual;
  end;


Jonas
_______________________________________________
fpc-other maillist  -  fpc-other@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other

Reply via email to