openharmony 鸿蒙 js-apis-appControl-sys

2025-06-12 浏览 (1)

@ohos.bundle.appControl (appControl) (System API)

The appControl module provides APIs for setting, obtaining, and deleting the disposed status of an application. An application in the disposed status is forbidden to run. When a user clicks the application icon on the home screen, the corresponding page is displayed based on the disposal intent.

NOTE

The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.

The APIs provided by this module are system APIs.

Modules to Import

import appControl from '@ohos.bundle.appControl';

appControl.setDisposedStatus

setDisposedStatus(appId: string, disposedWant: Want): Promise<void>

Sets the disposed status for an application. This API uses a promise to return the result. If the operation is successful, null is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
disposedWantWantYesDisposal intent of the application.

Return value

TypeDescription
Promise<void>Promise that returns no value.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import appControl from '@ohos.bundle.appControl';

let appId = "com.example.myapplication_xxxxx";
let want:Want = {bundleName: 'com.example.myapplication'};

try {
    appControl.setDisposedStatus(appId, want)
        .then(() => {
            console.info('setDisposedStatus success');
        }).catch((error: BusinessError) => {
            let message = (error as BusinessError).message;
            console.error('setDisposedStatus failed ' + message);
        });
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('setDisposedStatus failed ' + message);
}

appControl.setDisposedStatus

setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback<void>): void;

Sets the disposed status for an application. This API uses an asynchronous callback to return the result. If the operation is successful, null is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
disposedWantWantYesDisposal intent of the application.
callbackAsyncCallback<void>YesCallback used to return the result. If the operation is successful, err is null; otherwise, err is an error object.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';

let appId = "com.example.myapplication_xxxxx";
let want: Want = {bundleName: 'com.example.myapplication'};

try {
  appControl.setDisposedStatus(appId, want, (error: BusinessError, data) => {
    if (error) {
      let message = (error as BusinessError).message;
      console.error('setDisposedStatus failed ' + message);
      return;
    }
    console.info('setDisposedStatus success');
  });
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('setDisposedStatus failed ' + message);
}

appControl.setDisposedStatusSync10+

setDisposedStatusSync(appId: string, disposedWant: Want): void;

Sets the disposed status for an application. This API returns the result synchronously. If the operation is successful, null is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
disposedWantWantYesDisposal intent of the application.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';

let appId: string = "com.example.myapplication_xxxxx";
let want: Want = {bundleName: 'com.example.myapplication'};

try {
  appControl.setDisposedStatusSync(appId, want);
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('setDisposedStatusSync failed ' + message);
}

appControl.getDisposedStatus

getDisposedStatus(appId: string): Promise<Want>;

Obtains the disposed status of an application. This API uses a promise to return the result. If the operation is successful, the disposed status of the application is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.

Return value

TypeDescription
Promise<Want>Promise used to return the disposed status.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appId = "com.example.myapplication_xxxxx";

try {
  appControl.getDisposedStatus(appId)
    .then((data) => {
      console.info('getDisposedStatus success. DisposedStatus: ' + JSON.stringify(data));
    }).catch((error: BusinessError) => {
    let message = (error as BusinessError).message;
    console.error('getDisposedStatus failed ' + message);
  });
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('getDisposedStatus failed ' + message);
}

appControl.getDisposedStatus

getDisposedStatus(appId: string, callback: AsyncCallback<Want>): void;

Obtains the disposed status of an application. This API uses an asynchronous callback to return the result. If the operation is successful, the disposed status of the application is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
callbackAsyncCallback<Want>YesCallback used to return the result. If the operation is successful, err is null and data is the disposed status obtained; otherwise, err is an error object.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appId = "com.example.myapplication_xxxxx";

try {
  appControl.getDisposedStatus(appId, (error, data) => {
    if (error) {
      let message = (error as BusinessError).message;
      console.error('getDisposedStatus failed ' + message);
      return;
    }
    console.info('getDisposedStatus success. DisposedStatus: ' + JSON.stringify(data));
  });
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('getDisposedStatus failed ' + message);
}

appControl.getDisposedStatusSync10+

getDisposedStatusSync(appId: string): Want;

Obtains the disposed status of an application. This API returns the result synchronously. If the operation is successful, the disposed status of the application is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.

Return value

TypeDescription
WantDisposed status.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';

let appId: string = "com.example.myapplication_xxxxx";
let want: Want;

try {
    want = appControl.getDisposedStatusSync(appId);
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('getDisposedStatusSync failed ' + message);
}

appControl.deleteDisposedStatus

deleteDisposedStatus(appId: string): Promise<void>

Deletes the disposed status for an application. This API uses a promise to return the result. If the operation is successful, null is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.

Return value

TypeDescription
Promise<void>Promise that returns no value.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appId = "com.example.myapplication_xxxxx";

try {
  appControl.deleteDisposedStatus(appId)
    .then(() => {
      console.info('deleteDisposedStatus success');
    }).catch((error: BusinessError) => {
      let message = (error as BusinessError).message;
      console.error('deleteDisposedStatus failed ' + message);
  });
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('deleteDisposedStatus failed ' + message);
}

appControl.deleteDisposedStatus

deleteDisposedStatus(appId: string, callback: AsyncCallback<void>) : void

Deletes the disposed status for an application. This API uses an asynchronous callback to return the result. If the operation is successful, null is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
callbackAsyncCallback<void>YesCallback used to return the result. If the operation is successful, err is null; otherwise, err is an error object.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appId = "com.example.myapplication_xxxxx";
try {
  appControl.deleteDisposedStatus(appId, (error: BusinessError, data) => {
    if (error) {
      console.error('deleteDisposedStatus failed ' + error.message);
      return;
    }
    console.info('deleteDisposedStatus success');
  });
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('deleteDisposedStatus failed ' + message);
}

appControl.deleteDisposedStatusSync10+

deleteDisposedStatusSync(appId: string, appIndex:? number) : void

Deletes the disposed status for an application or an application clone. This API returns the result synchronously. If the operation is successful, null is returned. If the operation fails, an error message is returned.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
appIndex12+numberNoIndex of the application clone. The default value is 0.
The value 0 means to delete the disposed status of the main application. A value greater than 0 means to delete the disposed status of the application clone.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.
17700061AppIndex is not in the valid range.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appId: string = "com.example.myapplication_xxxxx";

try {
    appControl.deleteDisposedStatusSync(appId, 1);
} catch (error) {
    let message = (error as BusinessError).message;
    console.error('deleteDisposedStatusSync failed ' + message);
}

Obtaining appId of an Application

appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. It can be obtained by calling getBundleInfo.

Example

import bundleManager from '@ohos.bundle.bundleManager';
import { BusinessError } from '@ohos.base';

let bundleName = 'com.example.myapplication';
let appId: string;
try {
  bundleManager.getBundleInfo(bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO)
    .then((data) => {
      appId = data.signatureInfo.appId;
      console.info("appId is " + appId);
    }).catch((error: BusinessError) => {
      let message = (error as BusinessError).message;
      console.error("getBundleInfo failed " + message);
  });
} catch (error) {
    let message = (error as BusinessError).message;
    console.error("getBundleInfo failed " + message);
}

appControl.getDisposedRule11+

getDisposedRule(appId: string, appIndex:? number): DisposedRule

Obtains the disposed rule of an application or an application clone.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
appIndex12+numberNoIndex of the application clone. The default value is 0.
The value 0 means to obtain the disposed rule of the main application. A value greater than 0 means to obtain the disposed rule of the application clone.

Return value

TypeDescription
DisposedRuleDisposed rule of the application.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.
17700061AppIndex is not in the valid range.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';

let appId = "com.example.myapplication_xxxxx";

try {
  let data = appControl.getDisposedRule(appId, 1);
  console.info('getDisposedRule successfully. Data: ' + JSON.stringify(data));
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('getDisposedRule failed ' + message);
}

appControl.setDisposedRule11+

setDisposedRule(appId: string, rule: DisposedRule, appIndex:? number): void

Sets the disposed rule for an application or an application clone.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdstringYesID of the target application.
appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
ruleDisposedRuleYesDisposed rule to set.
appIndex12+numberNoIndex of the application clone. The default value is 0.
The value 0 means to set the disposed rule for the main application. A value greater than 0 means to set the disposed rule for the application clone.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied, non-system app called system api.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700005The specified app ID is an empty string.
17700061AppIndex is not in the valid range.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
import bundleManager from '@ohos.bundle.bundleManager';

let appId = "com.example.myapplication_xxxxx";
let want: Want = {
  bundleName: "com.example.myapplication",
  moduleName: "entry",
  abilityName: "EntryAbility"
};
let elementName: bundleManager.ElementName = {
  bundleName: "com.example.myapplication",
  moduleName: "entry",
  abilityName: "EntryAbility"
};
let rule: appControl.DisposedRule = {
  want: want,
  componentType: appControl.ComponentType.UI_ABILITY,
  disposedType: appControl.DisposedType.BLOCK_APPLICATION,
  controlType: appControl.ControlType.ALLOWED_LIST,
  elementList: [
    elementName
  ],
  priority: 100
};

try {
  appControl.setDisposedRule(appId, rule, 1);
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('setDisposedRule failed ' + message);
}

appControl.setUninstallDisposedRule15+

setUninstallDisposedRule(appIdentifier: string, rule: UninstallDisposedRule, appIndex:? number): void

Sets an uninstallation disposed rule for an application or an application clone.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdentifierstringYesappIdentifier of the target application.
If the application does not have an appIdentifier, use its appId instead. appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
ruleUninstallDisposedRuleYesUninstallation disposed rule.
appIndexnumberNoIndex of the application clone. The default value is 0.
The value 0 means to set the uninstallation disposed rule for the main application. A value greater than 0 means to set the uninstallation disposed rule for the application clone.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied. A non-system application is not allowed to call a system API.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700061AppIndex is not in the valid range.
17700074The specified appIdentifier is invalid.
17700075The specified bundleName of want is not the same with caller.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';

let appIdentifier = "com.example.myapplication_xxxxx";
let want: Want = {
  bundleName: "com.example.myapplication",
  moduleName: "entry",
  abilityName: "EntryAbility"
};
let rule: appControl.UninstallDisposedRule = {
  want: want,
  uninstallComponentType: appControl.UninstallComponentType.EXTENSION,
  priority: 100
};

try {
  appControl.setUninstallDisposedRule(appIdentifier, rule, 1);
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('setUninstallDisposedRule failed ' + message);
}

appControl.getUninstallDisposedRule15+

getUninstallDisposedRule(appIdentifier: string, appIndex:? number): UninstallDisposedRule

Obtains the uninstallation disposed rule of an application or an application clone.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS or ohos.permission.GET_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdentifierstringYesappIdentifier of the target application.
If the application does not have an appIdentifier, use its appId instead. appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
appIndexnumberNoIndex of the application clone. The default value is 0.
The value 0 means to obtain the uninstallation disposed rule of the main application. A value greater than 0 means to obtain the uninstallation disposed rule of the application clone.

Return value

TypeDescription
UninstallDisposedRuleUninstallation disposed rule.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied. A non-system application is not allowed to call a system API.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700061AppIndex is not in the valid range.
17700074The specified appIdentifier is invalid.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appIdentifier = "com.example.myapplication_xxxxx";

try {
  let data = appControl.getUninstallDisposedRule(appIdentifier, 1);
  console.info('getUninstallDisposedRule successfully. Data: ' + JSON.stringify(data));
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('getUninstallDisposedRule failed ' + message);
}

appControl.deleteUninstallDisposedRule15+

deleteUninstallDisposedRule(appIdentifier: string, appIndex:? number): void

Deletes an uninstallation disposed rule for an application or an application clone.

System API: This is a system API.

Required permissions: ohos.permission.MANAGE_DISPOSED_APP_STATUS

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

Parameters

NameTypeMandatoryDescription
appIdentifierstringYesappIdentifier of the target application.
If the application does not have an appIdentifier, use its appId instead. appId is the unique identifier of an application and is determined by the bundle name and signature information of the application. For details about how to obtain appId, see Obtaining appId of an Application.
appIndexnumberNoIndex of the application clone. The default value is 0.
The value 0 means to delete the uninstallation disposed rule of the main application. A value greater than 0 means to delete the uninstallation disposed rule of the application clone.

Error codes

For details about the error codes, see Universal Error Codes and Bundle Error Codes.

IDError Message
201Permission denied.
202Permission denied. A non-system application is not allowed to call a system API.
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
801Capability not supported.
17700061AppIndex is not in the valid range.
17700074The specified appIdentifier is invalid.

Example

import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';

let appIdentifier = "com.example.myapplication_xxxxx";

try {
  appControl.deleteUninstallDisposedRule(appIdentifier, 1);
} catch (error) {
  let message = (error as BusinessError).message;
  console.error('deleteUninstallDisposedRule failed ' + message);
}

DisposedRule11+

Defines a disposed rule.

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

System API: This is a system API.

NameTypeReadableWritableDescription
wantWantYesYesPage displayed when the application is disposed of.
componentTypeComponentTypeYesYesType of application component that functions as the displayed page.
disposedTypeDisposedTypeYesYesType of application disposal.
controlTypeControlTypeYesYesControl type of application disposal.
elementListArray<ElementName>YesYesList of application components to be disposed of or exempted.
prioritynumberYesYesPriority of the disposed rule.

ComponentType11+

Enumerates the types of application components that function as the displayed page.

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

System API: This is a system API.

NameValueDescription
UI_ABILITY1UIAbility component.
UI_EXTENSION2UIExtensionAbility component.

DisposedType11+

Enumerates the types of application disposals.

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

System API: This is a system API.

NameValueDescription
BLOCK_APPLICATION1All abilities of the application are blocked. That is, the entire application is blocked.
BLOCK_ABILITY2A specific ability of the application is blocked.
NON_BLOCK3The application is not blocked.

ControlType11+

Enumerates the control type of application disposal.

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

System API: This is a system API.

NameValueDescription
ALLOWED_LIST1A trustlist is used, which means that the application components in the list are allowed to run.
DISALLOWED_LIST2A blocklist is used, which means that the application components in the list are forbidden to run.

UninstallDisposedRule15+

Describes an uninstallation disposed rule.

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

System API: This is a system API.

NameTypeReadableWritableDescription
wantWantYesYesPage displayed when the application is disposed of.
UninstallComponentTypeUninstallComponentTypeYesYesType of the ability to start during interception.
prioritynumberYesYesPriority of the disposed rule.

UninstallComponentType15+

Enumerates the types of abilities during uninstallation.

System capability: SystemCapability.BundleManager.BundleFramework.AppControl

System API: This is a system API.

NameValueDescription
EXTENSION1Extension ability.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Ability Kit

harmony 鸿蒙AbilityAccessControl

harmony 鸿蒙AbilityBase

harmony 鸿蒙AbilityBase_Element

harmony 鸿蒙AbilityRuntime

harmony 鸿蒙bundle

harmony 鸿蒙OH_NativeBundle_ApplicationInfo

harmony 鸿蒙OH_NativeBundle_ElementName

harmony 鸿蒙ability_access_control.h

harmony 鸿蒙ability_base_common.h

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/8Z28qt