zoukankan      html  css  js  c++  java
  • Delphi Android ActivityManager(提供了接口, 利用它可以方便的对Memory, Processes, Task, Service 等进行管)

    ActivityManager:   对Activity交互提供了接口, 利用它可以方便的对Memory, Processes, Task, Service 等进行管理,. 这里对Delphi接口进行了翻译,详细信息可以访问官方网站

    [delphi] view plain copy
     
    1.   android.app.ActivityManager imported by flcop(zylove619@hotmail.com) 
    2. }  
    3.   
    4. unit Androidapi.JNI.ActivityManager;  
    5.   
    6. interface  
    7.   
    8. uses  
    9.   System.SysUtils,  
    10.   FMX.Helpers.Android,  
    11.   Androidapi.JNI.JavaTypes,  
    12.   Androidapi.JNIBridge,  
    13.   Androidapi.JNI.GraphicsContentViewText,  
    14.   Androidapi.JNI.Os,  
    15.   Androidapi.JNI.App;  
    16.   
    17. type  
    18.   
    19. { Class forward declarations }  
    20.   JDebug_MemoryInfo = interface;  
    21.   JActivityManager_MemoryInfo = interface;  
    22.   JActivityManager_ProcessErrorStateInfo = interface;  
    23.   JActivityManager_RecentTaskInfo = interface;  
    24.   JActivityManager_RunningAppProcessInfo = interface;  
    25.   JActivityManager_RunningServiceInfo = interface;  
    26.   JActivityManager_RunningTaskInfo = interface;  
    27.   JActivityManager = interface;  
    28.   
    29. { http://developer.android.com/reference/android/os/Debug.MemoryInfo.html 
    30.   Added in API level 1 }  
    31.   JDebug_MemoryInfoClass = interface(JObjectClass)  
    32.   ['{E7545CF8-CFF5-40EE-9082-380FA48C4464}']  
    33.     { Property Methods }  
    34.     function _GetCREATOR: JParcelable_Creator;  
    35.     { Methods }  
    36.     function init: JDebug_MemoryInfo; cdecl;  
    37.     { Properties }  
    38.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    39.   end;  
    40.   
    41.   [JavaSignature('android/os/Debug$MemoryInfo')]  
    42.   JDebug_MemoryInfo = interface(JObject)  
    43.   ['{577F2E29-A53C-4A3C-8548-21F6D6001EF6}']  
    44.     { Property Methods }  
    45.     function _GetdalvikPrivateDirty: Integer;  
    46.     procedure _SetdalvikPrivateDirty(Value: Integer);  
    47.     function _GetdalvikPss: Integer;  
    48.     procedure _SetdalvikPss(Value: Integer);  
    49.     function _GetdalvikSharedDirty: Integer;  
    50.     procedure _SetdalvikSharedDirty(Value: Integer);  
    51.     function _GetnativePrivateDirty: Integer;  
    52.     procedure _SetnativePrivateDirty(Value: Integer);  
    53.     function _GetnativePss: Integer;  
    54.     procedure _SetnativePss(Value: Integer);  
    55.     function _GetnativeSharedDirty: Integer;  
    56.     procedure _SetnativeSharedDirty(Value: Integer);  
    57.     function _GetotherPrivateDirty: Integer;  
    58.     procedure _SetotherPrivateDirty(Value: Integer);  
    59.     function _GetotherPss: Integer;  
    60.     procedure _SetotherPss(Value: Integer);  
    61.     function _GetotherSharedDirty: Integer;  
    62.     procedure _SetotherSharedDirty(Value: Integer);  
    63.     { Methods }  
    64.     // Added in API level 5  
    65.     function describeContents: Integer; cdecl;  
    66.     // Added in API level 5  
    67.     function getTotalPrivateDirty: Integer; cdecl;  
    68.     // Added in API level 5  
    69.     function getTotalPss: Integer; cdecl;  
    70.     // Added in API level 5  
    71.     function getTotalSharedDirty: Integer; cdecl;  
    72.     // Added in API level 5  
    73.     procedure readFromParcel(source: JParcel); cdecl;  
    74.     // Added in API level 5  
    75.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    76.     { Properties }  
    77.     property dalvikPrivateDirty: Integer read _GetdalvikPrivateDirty write _SetdalvikPrivateDirty;  
    78.     property dalvikPss: Integer read _GetdalvikPss write _SetdalvikPss;  
    79.     property dalvikSharedDirty: Integer read _GetdalvikSharedDirty write _SetdalvikSharedDirty;  
    80.     property nativePrivateDirty: Integer read _GetnativePrivateDirty write _SetnativePrivateDirty;  
    81.     property nativePss: Integer read _GetnativePss write _SetnativePss;  
    82.     property nativeSharedDirty: Integer read _GetnativeSharedDirty write _SetnativeSharedDirty;  
    83.     property otherPrivateDirty: Integer read _GetotherPrivateDirty write _SetotherPrivateDirty;  
    84.     property otherPss: Integer read _GetotherPss write _SetotherPss;  
    85.     property otherSharedDirty: Integer read _GetotherSharedDirty write _SetotherSharedDirty;  
    86.   end;  
    87.   TJDebug_MemoryInfo = class(TJavaGenericImport<JDebug_MemoryInfoClass,  
    88.     JDebug_MemoryInfo>) end;  
    89.   
    90. { http://developer.android.com/reference/android/app/ActivityManager.MemoryInfo.html 
    91.   Added in API level 1 }  
    92.   JActivityManager_MemoryInfoClass = interface(JObjectClass)  
    93.   ['{093B391C-56F6-47F9-96A5-CF4F4101F614}']  
    94.     { Property Methods }  
    95.     function _GetCREATOR: JParcelable_Creator;  
    96.     { Methods }  
    97.     function init: JActivityManager_MemoryInfo; cdecl;  
    98.     { Properties }  
    99.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    100.   end;  
    101.   
    102.   [JavaSignature('android/app/ActivityManager$MemoryInfo')]  
    103.   JActivityManager_MemoryInfo = interface(JObject)  
    104.   ['{B6B801F7-3E6F-4BF9-9952-8356A7026725}']  
    105.     { Property Methods }  
    106.     function _GetavailMem: Int64;  
    107.     function _GetlowMemory: Boolean;  
    108.     function _Getthreshold: Int64;  
    109.     function _GettotalMem: Int64;  
    110.     { Methods }  
    111.     function describeContents: Integer; cdecl;  
    112.     procedure readFromParcel(source: JParcel); cdecl;  
    113.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    114.     { Properties }  
    115.     property availMem: Int64 read _GetavailMem;  
    116.     property lowMemory: Boolean read _GetlowMemory;  
    117.     property threshold: Int64 read _Getthreshold;  
    118.     // Added in API level 16  
    119.     property totalMem: Int64 read _GettotalMem;  
    120.   end;  
    121.   TJActivityManager_MemoryInfo = class(TJavaGenericImport<JActivityManager_MemoryInfoClass,  
    122.     JActivityManager_MemoryInfo>) end;  
    123.   
    124. { http://developer.android.com/reference/android/app/ActivityManager.ProcessErrorStateInfo.html 
    125.   Added in API level 1 }  
    126.   JActivityManager_ProcessErrorStateInfoClass = interface(JObjectClass)  
    127.   ['{B2DDD02D-B205-4412-89B7-418BC28DA58D}']  
    128.     { Property Methods }  
    129.     function _GetCREATOR: JParcelable_Creator;  
    130.     function _GetCRASHED: Integer;  
    131.     function _GetNOT_RESPONDING: Integer;  
    132.     function _GetNO_ERROR: Integer;  
    133.     { Methods }  
    134.     function init: JActivityManager_ProcessErrorStateInfo; cdecl;  
    135.     { Properties }  
    136.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    137.     property CRASHED: Integer read _GetCRASHED;  
    138.     property NOT_RESPONDING: Integer read _GetNOT_RESPONDING;  
    139.     property NO_ERROR: Integer read _GetNO_ERROR;  
    140.   end;  
    141.   
    142.   [JavaSignature('android/app/ActivityManager$ProcessErrorStateInfo')]  
    143.   JActivityManager_ProcessErrorStateInfo = interface(JObject)  
    144.   ['{7406BE27-6395-44F4-8CC7-633375617A2A}']  
    145.     { Property Methods }  
    146.     function _Getcondition: Integer;  
    147.     procedure _Setcondition(Value: Integer);  
    148.     function _GetcrashData: TJavaArray<Byte>;  
    149.     procedure _SetcrashData(Value: TJavaArray<Byte>);  
    150.     function _GetlongMsg: JString;  
    151.     procedure _SetlongMsg(Value: JString);  
    152.     function _Getpid: Integer;  
    153.     procedure _Setpid(Value: Integer);  
    154.     function _GetprocessName: JString;  
    155.     procedure _SetprocessName(Value: JString);  
    156.     function _GetshortMsg: JString;  
    157.     procedure _SetshortMsg(Value: JString);  
    158.     function _GetstackTrace: JString;  
    159.     procedure _SetstackTrace(Value: JString);  
    160.     function _Gettag: JString;  
    161.     procedure _Settag(Value: JString);  
    162.     function _Getuid: Integer;  
    163.     procedure _Setuid(Value: Integer);  
    164.     { Methods }  
    165.     function describeContents: Integer; cdecl;  
    166.     procedure readFromParcel(source: JParcel); cdecl;  
    167.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    168.     { Properties }  
    169.     property condition: Integer read _Getcondition write _Setcondition;  
    170.     property crashData: TJavaArray<Byte> read _GetcrashData write _SetcrashData;  
    171.     property longMsg: JString read _GetlongMsg write _SetlongMsg;  
    172.     property pid: Integer read _Getpid write _Setpid;  
    173.     property processName: JString read _GetprocessName write _SetprocessName;  
    174.     property shortMsg: JString read _GetshortMsg write _SetshortMsg;  
    175.     // Added in API level 8  
    176.     property stackTrace: JString read _GetstackTrace write _SetstackTrace;  
    177.     property tag: JString read _Gettag write _Settag;  
    178.     property uid: Integer read _Getuid write _Setuid;  
    179.   end;  
    180.   TJActivityManager_ProcessErrorStateInfo = class(TJavaGenericImport<JActivityManager_ProcessErrorStateInfoClass,  
    181.     JActivityManager_ProcessErrorStateInfo>) end;  
    182.   
    183. { http://developer.android.com/reference/android/app/ActivityManager.RecentTaskInfo.html 
    184.   Added in API level 1 }  
    185.   JActivityManager_RecentTaskInfoClass = interface(JObjectClass)  
    186.   ['{4AE6025B-0BEA-4D81-8E3F-4EC6F7BA8EEF}']  
    187.     { Property Methods }  
    188.     function _GetCREATOR: JParcelable_Creator;  
    189.     { Methods }  
    190.     function init: JActivityManager_RecentTaskInfo; cdecl;  
    191.     { Properties }  
    192.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    193.   end;  
    194.   
    195.   [JavaSignature('android/app/ActivityManager$RecentTaskInfo')]  
    196.   JActivityManager_RecentTaskInfo = interface(JObject)  
    197.   ['{02A5EDBF-B7CC-4C63-BACD-0F1A195C6969}']  
    198.     { Property Methods }  
    199.     function _GetbaseIntent: JIntent;  
    200.     procedure _SetbaseIntent(Value: JIntent);  
    201.     function _Getdescription: JCharSequence;  
    202.     procedure _Setdescription(Value: JCharSequence);  
    203.     function _Getid: Integer;  
    204.     procedure _Setid(Value: Integer);  
    205.     function _GetorigActivity: JComponentName;  
    206.     procedure _SetorigActivity(Value: JComponentName);  
    207.     function _GetpersistentId: Integer;  
    208.     procedure _SetpersistentId(Value: Integer);  
    209.     { Methods }  
    210.     function describeContents: Integer; cdecl;  
    211.     procedure readFromParcel(source: JParcel); cdecl;  
    212.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    213.     { Properties }  
    214.     property baseIntent: JIntent read _GetbaseIntent write _SetbaseIntent;  
    215.     // Added in API level 11  
    216.     property description: JCharSequence read _Getdescription write _Setdescription;  
    217.     property id: Integer read _Getid write _Setid;  
    218.     property origActivity: JComponentName read _GetorigActivity write _SetorigActivity;  
    219.     // Added in API level 12  
    220.     property persistentId: Integer read _GetpersistentId write _SetpersistentId;  
    221.   end;  
    222.   TJActivityManager_RecentTaskInfo = class(TJavaGenericImport<JActivityManager_RecentTaskInfoClass,  
    223.     JActivityManager_RecentTaskInfo>) end;  
    224.   
    225. { http://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html 
    226.   Added in API level 3 }  
    227.   JActivityManager_RunningAppProcessInfoClass = interface(JObjectClass)  
    228.   ['{F24C0121-C062-4A2B-9363-E97A50E2FC41}']  
    229.     { Property Methods }  
    230.     function _GetCREATOR: JParcelable_Creator;  
    231.     function _GetIMPORTANCE_BACKGROUND: Integer;  
    232.     function _GetIMPORTANCE_EMPTY: Integer;  
    233.     function _GetIMPORTANCE_FOREGROUND: Integer;  
    234.     function _GetIMPORTANCE_PERCEPTIBLE: Integer;  
    235.     function _GetIMPORTANCE_SERVICE: Integer;  
    236.     function _GetIMPORTANCE_VISIBLE: Integer;  
    237.     function _GetREASON_PROVIDER_IN_USE: Integer;  
    238.     function _GetREASON_SERVICE_IN_USE: Integer;  
    239.     function _GetREASON_UNKNOWN: Integer;  
    240.     { Methods }  
    241.     function init: JActivityManager_RunningAppProcessInfo; cdecl; overload;  
    242.     function init(pProcessName: JString; pPid: Integer; pArr: TJavaObjectArray<JString>):  
    243.       JActivityManager_RunningAppProcessInfo; cdecl; overload;  
    244.     { Properties }  
    245.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    246.     property IMPORTANCE_BACKGROUND: Integer read _GetIMPORTANCE_BACKGROUND;  
    247.     property IMPORTANCE_EMPTY: Integer read _GetIMPORTANCE_EMPTY;  
    248.     property IMPORTANCE_FOREGROUND: Integer read _GetIMPORTANCE_FOREGROUND;  
    249.     // Added in API level 9  
    250.     property IMPORTANCE_PERCEPTIBLE: Integer read _GetIMPORTANCE_PERCEPTIBLE;  
    251.     property IMPORTANCE_SERVICE: Integer read _GetIMPORTANCE_SERVICE;  
    252.     property IMPORTANCE_VISIBLE: Integer read _GetIMPORTANCE_VISIBLE;  
    253.     // Added in API level 5  
    254.     property REASON_PROVIDER_IN_USE: Integer read _GetREASON_PROVIDER_IN_USE;  
    255.     // Added in API level 5  
    256.     property REASON_SERVICE_IN_USE: Integer read _GetREASON_SERVICE_IN_USE;  
    257.     // Added in API level 5  
    258.     property REASON_UNKNOWN: Integer read _GetREASON_UNKNOWN;  
    259.   end;  
    260.   
    261.   [JavaSignature('android/app/ActivityManager$RunningAppProcessInfo')]  
    262.   JActivityManager_RunningAppProcessInfo = interface(JObject)  
    263.   ['{3E72F05C-6CF2-4971-B34B-5FE4C414913D}']  
    264.     { Property Methods }  
    265.     function _Getimportance: Integer;  
    266.     procedure _Setimportance(Value: Integer);  
    267.     function _GetimportanceReasonCode: Integer;  
    268.     procedure _SetimportanceReasonCode(Value: Integer);  
    269.     function _GetimportanceReasonComponent: JComponentName;  
    270.     procedure _SetimportanceReasonComponent(Value: JComponentName);  
    271.     function _GetimportanceReasonPid: Integer;  
    272.     procedure _SetimportanceReasonPid(Value: Integer);  
    273.     function _GetlastTrimLevel: Integer;  
    274.     procedure _SetlastTrimLevel(Value: Integer);  
    275.     function _Getlru: Integer;  
    276.     procedure _Setlru(Value: Integer);  
    277.     function _Getpid: Integer;  
    278.     procedure _Setpid(Value: Integer);  
    279.     function _GetpkgList: TJavaObjectArray<JString>;  
    280.     procedure _SetpkgList(Value: TJavaObjectArray<JString>);  
    281.     function _GetprocessName: JString;  
    282.     procedure _SetprocessName(Value: JString);  
    283.     function _Getuid: Integer;  
    284.     procedure _Setuid(Value: Integer);  
    285.     { Methods }  
    286.     function describeContents: Integer; cdecl;  
    287.     procedure readFromParcel(source: JParcel); cdecl;  
    288.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    289.     { Properties }  
    290.     property importance: Integer read _Getimportance write _Setimportance;  
    291.     // Added in API level 5  
    292.     property importanceReasonCode: Integer read _GetimportanceReasonCode write _SetimportanceReasonCode;  
    293.     // Added in API level 5  
    294.     property importanceReasonComponent: JComponentName read _GetimportanceReasonComponent write _SetimportanceReasonComponent;  
    295.     // Added in API level 5  
    296.     property importanceReasonPid: Integer read _GetimportanceReasonPid write _SetimportanceReasonPid;  
    297.     // Added in API level 16  
    298.     property lastTrimLevel: Integer read _GetlastTrimLevel write _SetlastTrimLevel;  
    299.     property lru: Integer read _Getlru write _Setlru;  
    300.     property pid: Integer read _Getpid write _Setpid;  
    301.     property pkgList: TJavaObjectArray<JString> read _GetpkgList write _SetpkgList;  
    302.     property processName: JString read _GetprocessName write _SetprocessName;  
    303.     // Added in API level 5  
    304.     property uid: Integer read _Getuid write _Setuid;  
    305.   end;  
    306.   TJActivityManager_RunningAppProcessInfo = class(TJavaGenericImport<JActivityManager_RunningAppProcessInfoClass,  
    307.     JActivityManager_RunningAppProcessInfo>) end;  
    308.   
    309. { http://developer.android.com/reference/android/app/ActivityManager.RunningServiceInfo.html 
    310.   Added in API level 1 }  
    311.   JActivityManager_RunningServiceInfoClass = interface(JObjectClass)  
    312.   ['{8A01CD6D-5177-4F74-A65E-20BAC0B76F0F}']  
    313.     { Property Methods }  
    314.     function _GetCREATOR: JParcelable_Creator;  
    315.     function _GetFLAG_FOREGROUND: Integer;  
    316.     function _GetFLAG_PERSISTENT_PROCESS: Integer;  
    317.     function _GetFLAG_STARTED: Integer;  
    318.     function _GetFLAG_SYSTEM_PROCESS: Integer;  
    319.     { Methods }  
    320.     function init: JActivityManager_RunningServiceInfo; cdecl;  
    321.     { Properties }  
    322.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    323.     // Added in API level 5  
    324.     property FLAG_FOREGROUND: Integer read _GetFLAG_FOREGROUND;  
    325.     // Added in API level 5  
    326.     property FLAG_PERSISTENT_PROCESS: Integer read _GetFLAG_PERSISTENT_PROCESS;  
    327.     // Added in API level 5  
    328.     property FLAG_STARTED: Integer read _GetFLAG_STARTED;  
    329.     // Added in API level 5  
    330.     property FLAG_SYSTEM_PROCESS: Integer read _GetFLAG_SYSTEM_PROCESS;  
    331.   end;  
    332.   
    333.   [JavaSignature('android/app/ActivityManager$RunningServiceInfo')]  
    334.   JActivityManager_RunningServiceInfo = interface(JObject)  
    335.   ['{CEECA783-977A-4E16-8907-C4F65F25D168}']  
    336.     { Property Methods }  
    337.     function _GetactiveSince: Int64;  
    338.     procedure _SetactiveSince(Value: Int64);  
    339.     function _GetclientCount: Integer;  
    340.     procedure _SetclientCount(Value: Integer);  
    341.     function _GetclientLabel: Integer;  
    342.     procedure _SetclientLabel(Value: Integer);  
    343.     function _GetclientPackage: JString;  
    344.     procedure _SetclientPackage(Value: JString);  
    345.     function _GetcrashCount: Integer;  
    346.     procedure _SetcrashCount(Value: Integer);  
    347.     function _Getflags: Integer;  
    348.     procedure _Setflags(Value: Integer);  
    349.     function _Getforeground: Boolean;  
    350.     procedure _Setforeground(Value: Boolean);  
    351.     function _GetlastActivityTime: Int64;  
    352.     procedure _SetlastActivityTime(Value: Int64);  
    353.     function _Getpid: Integer;  
    354.     procedure _Setpid(Value: Integer);  
    355.     function _Getprocess: JString;  
    356.     procedure _Setprocess(Value: JString);  
    357.     function _Getrestarting: Int64;  
    358.     procedure _Setrestarting(Value: Int64);  
    359.     function _Getservice: JComponentName;  
    360.     procedure _Setservice(Value: JComponentName);  
    361.     function _Getstarted: Boolean;  
    362.     procedure _Setstarted(Value: Boolean);  
    363.     function _Getuid: Integer;  
    364.     procedure _Setuid(Value: Integer);  
    365.     { Methods }  
    366.     function describeContents: Integer; cdecl;  
    367.     procedure readFromParcel(source: JParcel); cdecl;  
    368.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    369.     { Properties }  
    370.     property activeSince: Int64 read _GetactiveSince write _SetactiveSince;  
    371.     property clientCount: Integer read _GetclientCount write _SetclientCount;  
    372.     // API level 5  
    373.     property clientLabel: Integer read _GetclientLabel write _SetclientLabel;  
    374.     // API level 5  
    375.     property clientPackage: JString read _GetclientPackage write _SetclientPackage;  
    376.     property crashCount: Integer read _GetcrashCount write _SetcrashCount;  
    377.     // API level 5  
    378.     property flags: Integer read _Getflags write _Setflags;  
    379.     property foreground: Boolean read _Getforeground write _Setforeground;  
    380.     property lastActivityTime: Int64 read _GetlastActivityTime write _SetlastActivityTime;  
    381.     property pid: Integer read _Getpid write _Setpid;  
    382.     property process: JString read _Getprocess write _Setprocess;  
    383.     property restarting: Int64 read _Getrestarting write _Setrestarting;  
    384.     property service: JComponentName read _Getservice write _Setservice;  
    385.     property started: Boolean read _Getstarted write _Setstarted;  
    386.     // API level 5  
    387.     property uid: Integer read _Getuid write _Setuid;  
    388.   end;  
    389.   TJActivityManager_RunningServiceInfo = class(TJavaGenericImport<JActivityManager_RunningServiceInfoClass,  
    390.     JActivityManager_RunningServiceInfo>) end;  
    391.   
    392. { http://developer.android.com/reference/android/app/ActivityManager.RunningTaskInfo.html 
    393.   Added in API level 1 }  
    394.   JActivityManager_RunningTaskInfoClass = interface(JObjectClass)  
    395.   ['{CB509FD6-FB15-495C-AFE8-DF705BFDD1CB}']  
    396.     { Property Methods }  
    397.     function _GetCREATOR: JParcelable_Creator;  
    398.     { Methods }  
    399.     function init: JActivityManager_RunningTaskInfo; cdecl;  
    400.     { Properties }  
    401.     property CREATOR: JParcelable_Creator read _GetCREATOR;  
    402.   end;  
    403.   
    404.   [JavaSignature('android/app/ActivityManager$RunningTaskInfo')]  
    405.   JActivityManager_RunningTaskInfo = interface(JObject)  
    406.   ['{48B0FF17-C6E7-46A9-8C4E-55186F86CE58}']  
    407.     { Property Methods }  
    408.     function _GetbaseActivity: JComponentName;  
    409.     procedure _SetbaseActivity(Value: JComponentName);  
    410.     function _Getdescription: JCharSequence;  
    411.     procedure _Setdescription(Value: JCharSequence);  
    412.     function _Getid: Integer;  
    413.     procedure _Setid(Value: Integer);  
    414.     function _GetnumActivities: Integer;  
    415.     procedure _SetnumActivities(Value: Integer);  
    416.     function _GetnumRunning: Integer;  
    417.     procedure _SetnumRunning(Value: Integer);  
    418.     function _Getthumbnail: JBitmap;  
    419.     procedure _Setthumbnail(Value: JBitmap);  
    420.     function _GettopActivity: JComponentName;  
    421.     procedure _SettopActivity(Value: JComponentName);  
    422.     { Methods }  
    423.     function describeContents: Integer; cdecl;  
    424.     procedure readFromParcel(source: JParcel); cdecl;  
    425.     procedure writeToParcel(dest: JParcel; flags: Integer); cdecl;  
    426.     { Properties }  
    427.     property baseActivity: JComponentName read _GetbaseActivity write _SetbaseActivity;  
    428.     property description: JCharSequence read _Getdescription write _Setdescription;  
    429.     property id: Integer read _Getid write _Setid;  
    430.     property numActivities: Integer read _GetnumActivities write _SetnumActivities;  
    431.     property numRunning: Integer read _GetnumRunning write _SetnumRunning;  
    432.     property thumbnail: JBitmap read _Getthumbnail write _Setthumbnail;  
    433.     property topActivity: JComponentName read _GettopActivity write _SettopActivity;  
    434.   end;  
    435.   TJActivityManager_RunningTaskInfo = class(TJavaGenericImport<JActivityManager_RunningTaskInfoClass,  
    436.     JActivityManager_RunningTaskInfo>) end;  
    437.   
    438. { http://developer.android.com/reference/android/app/ActivityManager.html 
    439.   Added in API level 1 }  
    440.   JActivityManagerClass = interface(JObjectClass)  
    441.   ['{DE9F8D5B-3354-4E29-86BA-E47715ECD75B}']  
    442.     { Property Methods }  
    443.     function _GetMOVE_TASK_NO_USER_ACTION: Integer;  
    444.     function _GetMOVE_TASK_WITH_HOME: Integer;  
    445.     function _GetRECENT_IGNORE_UNAVAILABLE: Integer;  
    446.     function _GetRECENT_WITH_EXCLUDED: Integer;  
    447.     { Methods }  
    448.     function init: JActivityManager; cdecl;  
    449.     // Added in API level 16  
    450.     procedure getMyMemoryState(outState: JActivityManager_RunningAppProcessInfo); cdecl;  
    451.     // Added in API level 11  
    452.     function isRunningInTestHarness: Boolean; cdecl;  
    453.     // Added in API level 8  
    454.     function isUserAMonkey: Boolean; cdecl;  
    455.     { Properties }  
    456.     // Added in API level 12  
    457.     property MOVE_TASK_NO_USER_ACTION: Integer read _GetMOVE_TASK_NO_USER_ACTION;  
    458.     // Added in API level 11  
    459.     property MOVE_TASK_WITH_HOME: Integer read _GetMOVE_TASK_WITH_HOME;  
    460.     // Added in API level 11  
    461.     property RECENT_IGNORE_UNAVAILABLE: Integer read _GetRECENT_IGNORE_UNAVAILABLE;  
    462.     property RECENT_WITH_EXCLUDEDread: Integer read _GetRECENT_WITH_EXCLUDED;  
    463.   end;  
    464.   
    465.   [JavaSignature('android/app/ActivityManager')]  
    466.   JActivityManager = interface(JObject)  
    467.   ['{AC5C42D6-E307-41EC-890A-DC846F528B0D}']  
    468.     { Methods }  
    469.     // Added in API level 3  
    470.     function getDeviceConfigurationInfo: JConfigurationInfo; cdecl;  
    471.     // Added in API level 11  
    472.     function getLargeMemoryClass: Integer; cdecl;  
    473.     // Added in API level 11  
    474.     function getLauncherLargeIconDensity: Integer; cdecl;  
    475.     // Added in API level 11  
    476.     function getLauncherLargeIconSize: Integer; cdecl;  
    477.     // Added in API level 5  
    478.     function getMemoryClass: Integer; cdecl;  
    479.     procedure getMemoryInfo(outInfo: JActivityManager_MemoryInfo); cdecl;  
    480.     // Added in API level 5  
    481.     function getProcessMemoryInfo(pids: TJavaArray<Integer>): TJavaObjectArray<JDebug_MemoryInfo>; cdecl;  
    482.     function getProcessesInErrorState: JList{<JActivityManager_ProcessErrorStateInfo>}; cdecl;  
    483.     function getRecentTasks(maxNum: Integer; flags: Integer): JList{<JActivityManager_RecentTaskInfo>}; cdecl;  
    484.     // Added in API level 3  
    485.     function getRunningAppProcesses: JList{<JActivityManager_RunningAppProcessInfo>}; cdecl;  
    486.     // Added in API level 5  
    487.     function getRunningServiceControlPanel(service: JComponentName): JPendingIntent; cdecl;  
    488.     function getRunningServices(maxNum: Integer): JList{<JActivityManager_RunningServiceInfo>}; cdecl;  
    489.     function getRunningTasks(maxNum: Integer): JList{<JActivityManager_RunningTaskInfo>}; cdecl;  
    490.     // Added in API level 8  
    491.     procedure killBackgroundProcesses(packageName: JString); cdecl;  
    492.     // Added in API level 16  
    493.     procedure moveTaskToFront(taskId: Integer; flags: Integer; options: JBundle); cdecl; overload;  
    494.     // Added in API level 11  
    495.     procedure moveTaskToFront(taskId: Integer; flags: Integer) cdecl; overload;  
    496.     // Added in API level 3  
    497.     procedure restartPackage(packageName: JString); cdecl;  
    498.   end;  
    499.   TJActivityManager = class(TJavaGenericImport<JActivityManagerClass, JActivityManager>) end;  
    500.   
    501. function GetActivityManager: JActivityManager;  
    502.   
    503. implementation  
    504.   
    505. function GetActivityManager: JActivityManager;  
    506. var  
    507.   LJO: JObject;  
    508. begin  
    509.   LJO := SharedActivity.getSystemService(TJContext.JavaClass.ACTIVITY_SERVICE);  
    510.   if not Assigned(LJO) then   
    511.     raise Exception.Create('Can not Access Activity Service!')  
    512.   else  
    513.     Result := TJActivityManager.Wrap((LJO as ILocalObject).GetObjectID);  
    514. end;  
    515.   
    516. end.  

    一个列举正在运行的进程的例子:

    [delphi] view plain copy
     
    1. procedure ListProcesses;  
    2. var  
    3.   LJL: JList;  
    4.   LIterator: JIterator;  
    5.   LJAR: JActivityManager_RunningAppProcessInfo;  
    6. begin  
    7.   LJL := GetActivityManager.getRunningAppProcesses;  
    8.   if Assigned(LJL) then  
    9.   begin  
    10.     LIterator := LJL.iterator;  
    11.     while LIterator.hasNext do  
    12.     begin  
    13.       LJAR := TJActivityManager_RunningAppProcessInfo.Wrap(  
    14.         (LIterator.next as ILocalObject).GetObjectID);  
    15.       // ShowMessage(JStringToString(LJAR.processName));  
    16.     end;  
    17.   end;  
    18. end;  


     

    http://blog.csdn.net/flcop/article/details/17190009

  • 相关阅读:
    [LeetCode#68] Text Justification
    [LeetCode#227] Basic Calculator II
    [LeetCode#87] Scramble String
    [LeetCode#280] Wiggle Sort
    [LeetCode#272] Closest Binary Search Tree Value II
    [LeetCode#254] Factor Combinations
    [LeetCode#174] Dungeon Game
    python报错集合
    在线画图工具
    xml模块(了解)
  • 原文地址:https://www.cnblogs.com/findumars/p/7050407.html
Copyright © 2011-2022 走看看