• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback } from './basic';
17import Want from './@ohos.app.ability.Want';
18
19/**
20 * Used for application interception control
21 * @namespace appControl
22 * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
23 * @systemapi
24 * @since 9
25 */
26declare namespace appControl {
27  /**
28   * Set the disposed status of a specified bundle.
29   * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
30   * @param { string } appId - Indicates the app ID of the application.
31   * @param { Want } disposedWant - Indicates the disposed want.
32   * @param { AsyncCallback } callback - The callback of setting the disposed status result.
33   * @throws { BusinessError } 201 - Permission denied.
34   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
35   * @throws { BusinessError } 401 - The parameter check failed.
36   * @throws { BusinessError } 801 - Capability not supported.
37   * @throws { BusinessError } 17700005 - The specified app ID is empty string.
38   * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
39   * @systemapi
40   * @since 9
41   */
42  function setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback<void>): void;
43
44  /**
45   * Set the disposed status of a specified bundle.
46   * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
47   * @param { string } appId - Indicates the app ID of the application.
48   * @param { Want } disposedWant - Indicates the disposed want.
49   * @returns { Promise<void> } The result of setting the disposed status of a specified bundle.
50   * @throws { BusinessError } 201 - Permission denied.
51   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
52   * @throws { BusinessError } 401 - The parameter check failed.
53   * @throws { BusinessError } 801 - Capability not supported.
54   * @throws { BusinessError } 17700005 - The specified app ID is empty string.
55   * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
56   * @systemapi
57   * @since 9
58   */
59  function setDisposedStatus(appId: string, disposedWant: Want): Promise<void>;
60
61  /**
62   * Obtains the disposed status of a specified bundle.
63   * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
64   * @param { string } appId - Indicates the app ID of the application.
65   * @param { AsyncCallback<Want> } callback - The callback of getting the disposed status of a specified bundle result.
66   * @throws { BusinessError } 201 - Permission denied.
67   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
68   * @throws { BusinessError } 401 - The parameter check failed.
69   * @throws { BusinessError } 801 - Capability not supported.
70   * @throws { BusinessError } 17700005 - The specified app ID is empty string.
71   * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
72   * @systemapi
73   * @since 9
74   */
75  function getDisposedStatus(appId: string, callback: AsyncCallback<Want>): void;
76
77  /**
78   * Obtains the disposed status of a specified bundle.
79   * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
80   * @param { string } appId - Indicates the app ID of the application.
81   * @returns { Promise<Want> } Returns the disposed status of a specified bundle.
82   * @throws { BusinessError } 201 - Permission denied.
83   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
84   * @throws { BusinessError } 401 - The parameter check failed.
85   * @throws { BusinessError } 801 - Capability not supported.
86   * @throws { BusinessError } 17700005 - The specified app ID is empty string.
87   * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
88   * @systemapi
89   * @since 9
90   */
91  function getDisposedStatus(appId: string): Promise<Want>;
92
93  /**
94   * Delete the disposed status of a specified bundle.
95   * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
96   * @param { string } appId - Indicates the app ID of the application.
97   * @param { AsyncCallback<void> } callback - the callback of deleting the disposed status of a specified bundle result.
98   * @throws { BusinessError } 201 - Permission denied.
99   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
100   * @throws { BusinessError } 401 - The parameter check failed.
101   * @throws { BusinessError } 801 - Capability not supported.
102   * @throws { BusinessError } 17700005 - The specified app ID is empty string.
103   * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
104   * @systemapi
105   * @since 9
106   */
107  function deleteDisposedStatus(appId: string, callback: AsyncCallback<void>): void;
108
109  /**
110   * Delete the disposed status of a specified bundle.
111   * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
112   * @param { string } appId - Indicates the app ID of the application.
113   * @returns { Promise<void> } Returns the result of deleting the disposed status of a specified bundle.
114   * @throws { BusinessError } 201 - Permission denied.
115   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
116   * @throws { BusinessError } 401 - The parameter check failed.
117   * @throws { BusinessError } 801 - Capability not supported.
118   * @throws { BusinessError } 17700005 - The specified app ID is empty string.
119   * @syscap SystemCapability.BundleManager.BundleFramework.AppControl
120   * @systemapi
121   * @since 9
122   */
123  function deleteDisposedStatus(appId: string): Promise<void>;
124}
125
126export default appControl;
127