diff --git a/api/@ohos.app.ability.kioskManager.d.ts b/api/@ohos.app.ability.kioskManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..143fbf4ad6813f5499c0647e10927989334dd910 --- /dev/null +++ b/api/@ohos.app.ability.kioskManager.d.ts @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit AbilityKit + */ + +import UIAbilityContext from './application/UIAbilityContext'; +import { KioskStatus as _KioskStatus } from './application/KioskStatus'; + +/** + * The class of kiosk manager. + * + * @namespace kioskManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ +declare namespace kioskManager { + /** + * Update Kiosk application list, only application on allow list can enter kiosk mode. + * + * @permission ohos.permission.MANAGE_EDM_POLICY + * @param { Array } appList - Indicates the application list that can enter kiosk mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + function updateKioskApplicationList(appList: Array): Promise; + + /** + * Enter kiosk mode. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000100 - Current application is not in kiosk app list, can not enter kiosk mode. + * @throws { BusinessError } 16000101 - System is already in kiosk mode, can not enter again. + * @throws { BusinessError } 16000103 - Current ability is not in foreground. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ + function enterKioskMode(context: UIAbilityContext): Promise; + + /** + * Exit kiosk mode. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000100 - Current application is not in kiosk app list, can not exit kiosk mode. + * @throws { BusinessError } 16000102 - Current application is not in kiosk mode, can not exit. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ + function exitKioskMode(context: UIAbilityContext): Promise; + + /** + * Get current kiosk status. + * + * @returns { Promise } Current kiosk status. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + function getKioskStatus(): Promise; + + /** + * The kiosk status data. + * + * @typedef { _KioskStatus } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ + export type KioskStatus = _KioskStatus; +} + +export default kioskManager; diff --git a/api/@ohos.commonEventManager.d.ts b/api/@ohos.commonEventManager.d.ts index 80c4fbba0ff5518211d6d81f0d2143cee1362bb5..8590edc3b90dc069ddb24538df0d2ec1ddeab156 100644 --- a/api/@ohos.commonEventManager.d.ts +++ b/api/@ohos.commonEventManager.d.ts @@ -2353,6 +2353,28 @@ declare namespace commonEventManager { * @since 20 */ COMMON_EVENT_SHORTCUT_CHANGED = 'usual.event.SHORTCUT_CHANGED', + + /** + * This common event means that kiosk mode is on. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_KIOSK_MODE_ON = 'usual.event.KIOSK_MODE_ON', + + /** + * This common event means that kiosk mode is off. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_KIOSK_MODE_OFF = 'usual.event.KIOSK_MODE_FF', } /** diff --git a/api/application/KioskStatus.d.ts b/api/application/KioskStatus.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6586d5eca39d0d408308fa31f31af441302b18b8 --- /dev/null +++ b/api/application/KioskStatus.d.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit AbilityKit + */ + +/** + * The Kiosk status data. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ +export interface KioskStatus { + /** + * Whether current system is kiosk mode. + * + * @type { boolean } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ + isKioskMode: boolean; + + /** + * The bundle name of kiosk app. + * + * @type { string } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ + kioskBundleName: string; + + /** + * The budle uid of kiosk app. + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.1&1.2 + */ + kioskBundleUid: number; +}