diff --git a/api/@ohos.application.abilityManager.d.ts b/api/@ohos.application.abilityManager.d.ts index 5ced77d93ed97c548af8f67b02a1a760a72c33eb..5f996d83664c5823d9867f1dadc36785a61a7346 100644 --- a/api/@ohos.application.abilityManager.d.ts +++ b/api/@ohos.application.abilityManager.d.ts @@ -14,7 +14,9 @@ */ import { AsyncCallback } from './basic'; -import Configuration from './@ohos.application.Configuration'; +import { Configuration } from './@ohos.application.Configuration'; +import { AbilityRunningInfo } from './application/AbilityRunningInfo'; +import { ExtensionRunningInfo } from './application/ExtensionRunningInfo'; /** * The class of an ability manager. @@ -25,6 +27,22 @@ import Configuration from './@ohos.application.Configuration'; * @permission N/A */ declare namespace abilityManager { + + /** + * @name AbilityState + * @since 8 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ + export enum AbilityState { + INITIAL = 0, + FOREGROUND = 9, + BACKGROUND = 10, + FOREGROUNDING = 11, + BACKGROUNDING = 12 + } + /** * Updates the configuration by modifying the configuration. * @@ -37,4 +55,32 @@ declare namespace abilityManager { */ function updateConfiguration(config: Configuration, callback: AsyncCallback): void; function updateConfiguration(config: Configuration): Promise; -} \ No newline at end of file + + /** + * Get information about running abilitys + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap AAFwk + * @param config Indicates the new configuration. + * @systemapi Hide this for inner system use. + * @return - + */ + function getAbilityRunningInfos(): Promise>; + function getAbilityRunningInfos(callback: AsyncCallback>): void; + + /** + * Get information about running extensions + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap AAFwk + * @param config Indicates the new configuration. + * @systemapi Hide this for inner system use. + * @return - + */ + function getExtensionRunningInfos(upperLimit: number): Promise>; + function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback>): void; +} + +export default abilityManager; \ No newline at end of file diff --git a/api/@ohos.application.appManager.d.ts b/api/@ohos.application.appManager.d.ts index 77b341b2cccd92cf7559dcd78be263f09fdc54e5..6a1d24787a72b61b802927c550f02e1dd1bc5cf6 100644 --- a/api/@ohos.application.appManager.d.ts +++ b/api/@ohos.application.appManager.d.ts @@ -16,6 +16,7 @@ import { AsyncCallback } from './basic'; import ApplicationStateObserver from './application/ApplicationStateObserver'; import AppStateData from './application/AppStateData'; +import { ProcessRunningInfo } from './application/ProcessRunningInfo'; /** * This module provides the function of app manager service. @@ -86,6 +87,18 @@ declare namespace appManager { */ function isRunningInStabilityTest(callback: AsyncCallback): void; function isRunningInStabilityTest(): Promise; + + /** + * Get information about running processes + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap appexecfwk + * @systemapi Hide this for inner system use. + * @return - + */ + function getProcessRunningInfos(): Promise>; + function getProcessRunningInfos(callback: AsyncCallback>): void; } export default appManager; diff --git a/api/application/AbilityRunningInfo.d.ts b/api/application/AbilityRunningInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9aa19f8563ef5f0c1d4c3a344e9fdddd8999a1f --- /dev/null +++ b/api/application/AbilityRunningInfo.d.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ElementName } from '../bundle/elementName'; +import abilityManager from '../@ohos.application.abilityManager'; + +/** + * The class of an ability running information. + * + * @since 8 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ +export interface AbilityRunningInfo { + /** + * @default ability element name + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + ability: ElementName; + + /** + * @default process id + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + pid: number; + + /** + * @default user id + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + uid: number; + + /** + * @default the name of the process + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + processName: string; + + /** + * @default ability start time + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + startTime: number; + + /** + * @default Enumerates state of the ability state info + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + abilityState: abilityManager.AbilityState; +} \ No newline at end of file diff --git a/api/application/ExtensionRunningInfo.d.ts b/api/application/ExtensionRunningInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5cf48045503aa9547e3090cc42851871b4eded8c --- /dev/null +++ b/api/application/ExtensionRunningInfo.d.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ElementName } from '../bundle/elementName'; +import bundle from '../@ohos.bundle'; + +/** + * The class of an extension running information. + * + * @since 8 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ +export interface ExtensionRunningInfo { + /** + * @default Indicates the extension of the extension info + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + extension: ElementName; + + /** + * @default process id + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + pid: number; + + /** + * @default user id + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + uid: number; + + /** + * @default the name of the process + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + processName: string; + + /** + * @default ability start time + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + startTime: number; + + /** + * @default All package names under the current process + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + clientPackage: Array; + + /** + * @default Enumerates types of the entension info + * @since 9 + * @SysCap SystemCapability.Appexecfwk + * @StageModelOnly + */ + type: bundle.ExtensionAbilityType; +} \ No newline at end of file diff --git a/api/application/ProcessRunningInfo.d.ts b/api/application/ProcessRunningInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db9414888a43a7cb039cbc637932b5df6251d3bc --- /dev/null +++ b/api/application/ProcessRunningInfo.d.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * The class of an process running information. + * + * @since 8 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ +export interface ProcessRunningInfo { + /** + * @default process id + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + pid: number; + + /** + * @default user id + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + uid: number; + + /** + * @default the name of the process + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + processName: string; + + /** + * @default an array of the bundleNames running in the process + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + bundleNames: Array; +} \ No newline at end of file