diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 8a89bbc773dd031738df5eb734d28273a913024c..91f91459d5f4bd9fbe698ee53be119f5f3dfd313 100755 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -302,4 +302,16 @@ export default class Ability { * @StageModelOnly */ dump(params: Array): Array; + + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param level Indicates the memory trim level, which shows the current memory usage status. + * @return - + * @StageModelOnly + */ + onMemoryLevel(level: number): void; } diff --git a/api/@ohos.application.Extension.d.ts b/api/@ohos.application.Extension.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..37ff6fb7b76d6359c44790b2cbb3311117d62b0e --- /dev/null +++ b/api/@ohos.application.Extension.d.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 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 { Configuration } from './@ohos.application.Configuration'; + +/** + * class of extension. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ +export default class Extension { + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param config Indicates the updated configuration. + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; + + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param level Indicates the memory trim level, which shows the current memory usage status. + * @return - + * @StageModelOnly + */ + onMemoryLevel(level: number): void; +} diff --git a/api/@ohos.application.appManager.d.ts b/api/@ohos.application.appManager.d.ts index a116e01990c216652bfb601333d4d062b628654b..2cfcc660c34d5a97ed6fb9aab6371d99beb63133 100644 --- a/api/@ohos.application.appManager.d.ts +++ b/api/@ohos.application.appManager.d.ts @@ -17,6 +17,7 @@ import { AsyncCallback } from './basic'; import ApplicationStateObserver from './application/ApplicationStateObserver'; import AppStateData from './application/AppStateData'; import { ProcessRunningInfo } from './application/ProcessRunningInfo'; +import ConnectionStateObserver from './application/ConnectionStateObserver'; /** * This module provides the function of app manager service. @@ -139,6 +140,32 @@ declare namespace appManager { */ function getAppMemorySize(): Promise; function getAppMemorySize(callback: AsyncCallback): void; + + /** + * Register application state observer. + * + * @default - + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observer The connection state observer. + * @systemapi hide this for inner system use + * @return Returns the number code of the observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + */ + function registerConnectionStateObserver(observer: ConnectionStateObserver): number; + + /** + * Unregister connection state observer. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observerId Indicates the number code of the observer. + * @systemapi hide this for inner system use + * @return - + * @permission ohos.permission.RUNNING_STATE_OBSERVER + */ + function unregisterConnectionStateObserver(observerId: number, callback: AsyncCallback): void; + function unregisterConnectionStateObserver(observerId: number): Promise; } export default appManager; diff --git a/api/application/ConnectStateData.d.ts b/api/application/ConnectStateData.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a63bd67c78a99c4969ae4bb6c389d0faf5d081d --- /dev/null +++ b/api/application/ConnectStateData.d.ts @@ -0,0 +1,88 @@ +/* + * 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 extension connection state data. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @permission N/A + */ +export default class ConnectStateData { + /** + * @default Indicates the callee extension. + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + */ + extension: ElementName; + + /** + * The extension pid. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + extensionPid: number; + + /** + * The extension uid. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + extensionUid: number; + + /** + * @default Enumerates types of the extension. + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + */ + extensionType: bundle.ExtensionAbilityType; + + /** + * The caller pid. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + callerPid: number; + + /** + * The caller uid. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + callerUid: number; + + /** + * The caller bundleName. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + callerBundleName: string; +} \ No newline at end of file diff --git a/api/application/ConnectionStateObserver.d.ts b/api/application/ConnectionStateObserver.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b887bc3b279ba694828fb24172f3ea6f84976e4 --- /dev/null +++ b/api/application/ConnectionStateObserver.d.ts @@ -0,0 +1,71 @@ +/* + * 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 ConnectStateData from "./ConnectStateData"; +import DlpStateData from "./DlpStateData"; + +/** + * The application state observer. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @permission N/A + */ +export default class ConnectionStateObserver { + /** + * Will be called when extension is connected. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param connectData State changed connection info. + * @systemapi hide for inner use. + * @return - + */ + onExtensionConnected(connectData: ConnectStateData): void; + + /** + * Will be called when extension is disconnected. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param connectData State changed connection info. + * @systemapi hide for inner use. + * @return - + */ + onExtensionDisConnected(connectData: ConnectStateData): void; + + /** + * Will be called when dlp open an ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param dlpStateData State changed dlp state info. + * @systemapi hide for inner use. + * @return - + */ + onDlpAbilityOpened(dlpStateData: DlpStateData): void; + + /** + * Will be called when ability that opened by dlp is closed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param dlpStateData State changed dlp state info. + * @systemapi hide for inner use. + * @return - + */ + onDlpAbilityClosed(abilityStateData: DlpStateData): void; +} \ No newline at end of file diff --git a/api/application/DlpStateData.d.ts b/api/application/DlpStateData.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a27e6cd68e5a8e66486c8b764225b402d4b4ecb --- /dev/null +++ b/api/application/DlpStateData.d.ts @@ -0,0 +1,78 @@ +/* + * 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'; + +/** + * The extension connection state data. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @permission N/A + */ +export default class DlpStateData { + /** + * @default Indicates the target ability started by dlp. + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + */ + targetAbility: ElementName; + + /** + * The target pid started by dlp. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + targetPid: number; + + /** + * The target uid started by dlp. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + targetUid: number; + + /** + * The dlp pid. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + dlpPid: number; + + /** + * The dlp uid. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + dlpUid: number; + + /** + * @default dlp application bundle name. + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + */ + dlpBundleName: string; +} \ No newline at end of file diff --git a/api/application/MissionListener.d.ts b/api/application/MissionListener.d.ts index 07c409538aaf7d0e4c81180ffb657839cbafbd78..56064834a9fb431e30da6bce7635098e087a3928 100644 --- a/api/application/MissionListener.d.ts +++ b/api/application/MissionListener.d.ts @@ -1,78 +1,88 @@ -/* - * Copyright (c) 2021-2022 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 image from "../@ohos.multimedia.image"; - -/** - * MissionListener registered by app. - * - * @name MissionListener - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @permission N/A - * @systemapi hide for inner use. - */ - export interface MissionListener { - /** - * Called by system when mission created. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param mission Indicates the id of created mission. - * @return - - */ - onMissionCreated(mission: number): void; - - /** - * Called by system when mission destroyed. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param mission Indicates the id of destroyed mission. - * @return - - */ - onMissionDestroyed(mission: number): void; - - /** - * Called by system when mission shapshot changed. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param mission Indicates the id of the mission which the snapshot changes - * @return - - */ - onMissionSnapshotChanged(mission: number): void; - - /** - * Called by system when mission moved to fornt. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param mission Indicates the id of the mission being moved to the foreground. - * @return - - */ - onMissionMovedToFront(mission: number): void; - - /** - * Called by system when mission icon has changed. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param mission Indicates the id of the mission whose icon has changed. - * @param icon Indicates the icon of the mission whose icon has changed. - * @return - - */ - onMissionIconUpdated(mission: number, icon: image.PixelMap): void; +/* + * Copyright (c) 2021-2022 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 image from "../@ohos.multimedia.image"; + +/** + * MissionListener registered by app. + * + * @name MissionListener + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @permission N/A + * @systemapi hide for inner use. + */ + export interface MissionListener { + /** + * Called by system when mission created. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param mission Indicates the id of created mission. + * @return - + */ + onMissionCreated(mission: number): void; + + /** + * Called by system when mission destroyed. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param mission Indicates the id of destroyed mission. + * @return - + */ + onMissionDestroyed(mission: number): void; + + /** + * Called by system when mission shapshot changed. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param mission Indicates the id of the mission which the snapshot changes + * @return - + */ + onMissionSnapshotChanged(mission: number): void; + + /** + * Called by system when mission moved to fornt. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param mission Indicates the id of the mission being moved to the foreground. + * @return - + */ + onMissionMovedToFront(mission: number): void; + + /** + * Called by system when mission icon has changed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param mission Indicates the id of the mission whose icon has changed. + * @param icon Indicates the icon of the mission whose icon has changed. + * @return - + */ + onMissionIconUpdated(mission: number, icon: image.PixelMap): void; + + /** + * Called by system when target mission is closed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param mission Indicates the id of the mission whose icon has changed. + * @return - + */ + onMissionClosed(mission: number): void; } \ No newline at end of file diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index ee956cba6d1ba2249a270a3d942be694188814e3..7e1c8f983a8f507a740457149e2d43f6a3be113c 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -19,6 +19,7 @@ import ExtensionContext from "./ExtensionContext"; import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; import { ExtensionAbilityInfo } from "../bundle/extensionAbilityInfo"; +import Caller from '../@ohos.application.Ability'; /** * The context of service extension. It allows access to @@ -89,7 +90,7 @@ export default class ServiceExtensionContext extends ExtensionContext { */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - + /** * Stops a service within the same application. * @@ -178,4 +179,15 @@ export default class ServiceExtensionContext extends ExtensionContext { */ disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; + + /** + * Get the caller object of the startup capability + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @return Returns to the Caller interface on success Returns empty or undefined on failure + * @StageModelOnly + */ + startAbilityByCall(want: Want): Promise; } \ No newline at end of file