From 1dccb4ba1e8ed1331ab2321961c705d457b57dd7 Mon Sep 17 00:00:00 2001 From: ImCaO Date: Thu, 24 Aug 2023 18:46:45 +0800 Subject: [PATCH] Revert "fixed 7cfaf6c from https://gitee.com/ImCaO/docs/pulls/22747" This reverts commit ffb72ddb1869b9a67aa78daa14b60dcbcd1e441e. Signed-off-by: ImCaO --- .../reference/apis/js-apis-bundleManager.md | 212 +----------------- 1 file changed, 1 insertion(+), 211 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index 61a90486c2..990dd73240 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -1736,48 +1736,6 @@ try { } ``` -### bundleManager.setApplicationEnabledSync10+ - -setApplicationEnabledSync(bundleName: string, isEnabled: boolean): void; - -以同步方法设置指定应用的禁用或使能状态。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:** ohos.permission.CHANGE_ABILITY_ENABLED_STATE - -**系统能力:** SystemCapability.BundleManager.BundleFramework.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ------- | ---- | ------------------------------------- | -| bundleName | string | 是 | 指定应用的bundleName。 | -| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | - -**错误码:** - -以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found. | - -**示例:** - -```ts -import bundleManager from '@ohos.bundle.bundleManager'; -import hilog from '@ohos.hilog'; -let bundleName = "com.ohos.myapplication"; - -try { - bundleManager.setApplicationEnabledSync(bundleName, false); - hilog.info(0x0000, 'testTag', 'setApplicationEnabledSync successfully.'); -} catch (err) { - hilog.error(0x0000, 'testTag', 'setApplicationEnabledSync failed: %{public}s', err.message); -} -``` - ### bundleManager.setAbilityEnabled setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isEnabled: boolean, callback: AsyncCallback\): void; @@ -1829,7 +1787,7 @@ try { if (err) { hilog.error(0x0000, 'testTag', 'setAbilityEnabled failed: %{public}s', err.message); } else { - hilog.info(0x0000, "testTag", "setAbilityEnabled successfully."); + hilog.info(0x0001, "testTag", "setAbilityEnabled successfully."); } }); }).catch(err => { @@ -1905,66 +1863,6 @@ try { } ``` -### bundleManager.setAbilityEnabledSync10+ - -setAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isEnabled: boolean): void; - -以同步方法设置指定组件的禁用或使能状态。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:** ohos.permission.CHANGE_ABILITY_ENABLED_STATE - -**系统能力:** SystemCapability.BundleManager.BundleFramework.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------- | ---- | ------------------------------------- | -| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 需要被设置的组件。 | -| isEnabled| boolean | 是 | 值为true表示使能,值为false表示禁用。 | - -**错误码:** - -以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------| -| 17700001 | The specified bundleName is not found. | -| 17700003 | The specified abilityInfo is not found. | - -**示例:** - -```ts -import bundleManager from '@ohos.bundle.bundleManager'; -import hilog from '@ohos.hilog'; -let abilityFlags = bundleManager.AbilityFlag.GET_ABILITY_INFO_DEFAULT; -let userId = 100; -let want = { - bundleName : "com.example.myapplication", - abilityName : "EntryAbility" -}; -let info; - -try { - bundleManager.queryAbilityInfo(want, abilityFlags, userId).then((abilitiesInfo) => { - hilog.info(0x0000, 'testTag', 'queryAbilityInfo successfully. Data: %{public}s', JSON.stringify(abilitiesInfo)); - info = abilitiesInfo[0]; - - try { - bundleManager.setAbilityEnabledSync(info, false); - hilog.info(0x0000, "testTag", "setAbilityEnabledSync successfully."); - } catch (err) { - hilog.error(0x0000, 'testTag', 'setAbilityEnabledSync failed: %{public}s', err.message); - } - }).catch(err => { - hilog.error(0x0000, 'testTag', 'queryAbilityInfo failed. Cause: %{public}s', err.message); - }); -} catch (err) { - hilog.error(0x0000, 'testTag', 'queryAbilityInfo failed. Cause: %{public}s', err.message); -} -``` - ### bundleManager.isApplicationEnabled isApplicationEnabled(bundleName: string, callback: AsyncCallback\): void; @@ -2058,51 +1956,6 @@ try { } ``` -### bundleManager.isApplicationEnabledSync10+ - -isApplicationEnabledSync(bundleName: string): boolean; - -以同步方法获取指定应用的禁用或使能状态。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.BundleManager.BundleFramework.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ------ | ---- | -------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName。 | - -**返回值:** - -| 类型 | 说明 | -| ------- | ------------------------------------------------------------ | -| boolean | 返回true表示当前应用为使能状态,返回false表示当前应用为禁用状态。 | - -**错误码:** - -以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found. | - -**示例:** - -```ts -import bundleManager from '@ohos.bundle.bundleManager'; -import hilog from '@ohos.hilog'; -let bundleName = 'com.example.myapplication'; - -try { - let data = bundleManager.isApplicationEnabledSync(bundleName); - hilog.info(0x0000, 'testTag', 'isApplicationEnabledSync successfully: %{public}s', JSON.stringify(data)); -} catch (err) { - hilog.error(0x0000, 'testTag', 'isApplicationEnabledSync failed: %{public}s', err.message); -} -``` - ### bundleManager.isAbilityEnabled isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), callback: AsyncCallback\): void; @@ -2224,69 +2077,6 @@ try { } ``` -### bundleManager.isAbilityEnabledSync10+ - -isAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)): boolean; - -以同步方法获取指定组件的禁用或使能状态。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.BundleManager.BundleFramework.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ---- | ----------- | ---- | --------------------------- | -| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 表示关于检查ability的信息。 | - -**返回值:** - -| 类型 | 说明 | -| ------- | ------------------------------------------------------------------- | -| boolean | 返回true表示当前应用组件为使能状态,返回false表示当前应用组件为禁用状态。 | - -**错误码:** - -以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 - -| 错误码ID | 错误信息 | -| -------- | --------------------------------------- | -| 17700001 | The specified bundleName is not found. | -| 17700003 | The specified abilityName is not found. | - -**示例:** - -```ts -import bundleManager from '@ohos.bundle.bundleManager'; -import hilog from '@ohos.hilog'; -let abilityFlags = bundleManager.AbilityFlag.GET_ABILITY_INFO_DEFAULT; -let userId = 100; -let want = { - bundleName : "com.example.myapplication", - abilityName : "EntryAbility" -}; -let info; - -try { - bundleManager.queryAbilityInfo(want, abilityFlags, userId).then((abilitiesInfo) => { - hilog.info(0x0000, 'testTag', 'queryAbilityInfo successfully. Data: %{public}s', JSON.stringify(abilitiesInfo)); - info = abilitiesInfo[0]; - - try { - let data = bundleManager.isAbilityEnabledSync(info); - hilog.info(0x0000, 'testTag', 'isAbilityEnabledSync successfully: %{public}s', JSON.stringify(data)); - } catch (err) { - hilog.error(0x0000, 'testTag', 'isAbilityEnabledSync failed: %{public}s', err.message); - } - }).catch(err => { - hilog.error(0x0000, 'testTag', 'queryAbilityInfo failed. Cause: %{public}s', err.message); - }); -} catch (err) { - hilog.error(0x0000, 'testTag', 'queryAbilityInfo failed. Cause: %{public}s', err.message); -} -``` - ### bundleManager.getLaunchWantForBundle getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallback\): void; -- GitLab