提交 4208cc8a 编写于 作者: Y yuyaozhi

Fix docs error of ability

Signed-off-by: Nyuyaozhi <yuyaozhi@huawei.com>
上级 c138e09b
...@@ -707,7 +707,7 @@ let connectId = featureAbility.connectAbility( ...@@ -707,7 +707,7 @@ let connectId = featureAbility.connectAbility(
); );
featureAbility.disconnectAbility(connectId).then((data) => { featureAbility.disconnectAbility(connectId).then((data) => {
console.log('data: ${data)}'; console.log('data: ${data)}')
}).catch((error)=>{ }).catch((error)=>{
console.error('featureAbilityTest result errCode : ${error.code}'); console.error('featureAbilityTest result errCode : ${error.code}');
}); });
......
...@@ -66,6 +66,12 @@ Ability上次退出原因,该类型为枚举,可配合[Ability](js-apis-app- ...@@ -66,6 +66,12 @@ Ability上次退出原因,该类型为枚举,可配合[Ability](js-apis-app-
| UNKNOWN | 0 | 未知原因。 | | UNKNOWN | 0 | 未知原因。 |
| ABILITY_NOT_RESPONDING | 1 | ability未响应。 | | ABILITY_NOT_RESPONDING | 1 | ability未响应。 |
| NORMAL | 2 | 正常退出。 | | NORMAL | 2 | 正常退出。 |
| CPP_CRASH | 3 | 由于本机异常信号,应用程序退出。 |
| JS_ERROR | 4 | js错误导致应用程序退出。 |
| APP_FREEZE | 5 | 由于appFreeze错误,应用程序退出。 |
| PERFORMANCE_CONTROL | 6 | 由于系统性能问题(如设备内存不足)导致应用程序退出。 |
| RESOURCE_CONTROL | 7 | 应用程序因资源使用违规而退出,例如超过cpu/io/内存使用量。 |
| UPGRADE | 8 | 升级应用程序因升级而退出。 |
**示例:** **示例:**
......
...@@ -298,7 +298,7 @@ appManager.getRunningProcessInformation((err, data) => { ...@@ -298,7 +298,7 @@ appManager.getRunningProcessInformation((err, data) => {
}); });
``` ```
## appManager.isSharedBundleRunning ## appManager.isSharedBundleRunning<sup>10+</sup>
isSharedBundleRunning(bundleName: string, versionCode: number): Promise\<boolean>; isSharedBundleRunning(bundleName: string, versionCode: number): Promise\<boolean>;
...@@ -323,11 +323,21 @@ isSharedBundleRunning(bundleName: string, versionCode: number): Promise\<boolean ...@@ -323,11 +323,21 @@ isSharedBundleRunning(bundleName: string, versionCode: number): Promise\<boolean
| -------- | -------- | | -------- | -------- |
| Promise\<boolean> | Promise对象。返回true表示共享库正在使用,返回false表示共享库不在使用。 | | Promise\<boolean> | Promise对象。返回true表示共享库正在使用,返回false表示共享库不在使用。 |
**错误码**
| 错误码ID | 错误信息 |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16000050 | Internal error. |
**示例:** **示例:**
```ts ```ts
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
const bundleName = "this is a bundleName";
const versionCode = 1;
appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => { appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => {
console.log('The shared bundle running is: ${JSON.stringify(data)}'); console.log('The shared bundle running is: ${JSON.stringify(data)}');
}).catch((error) => { }).catch((error) => {
...@@ -335,7 +345,7 @@ appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => { ...@@ -335,7 +345,7 @@ appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => {
}); });
``` ```
## appManager.isSharedBundleRunning ## appManager.isSharedBundleRunning<sup>10+</sup>
isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCallback\<boolean>): void; isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCallback\<boolean>): void;
...@@ -353,18 +363,23 @@ isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCa ...@@ -353,18 +363,23 @@ isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCa
| --------- | ---------------------------------------- | ---- | -------------- | | --------- | ---------------------------------------- | ---- | -------------- |
| bundleName | string | 是 | 表示要查询的共享库包名。 | | bundleName | string | 是 | 表示要查询的共享库包名。 |
| versionCode | number | 是 | 表示要查询的共享库版本号。 | | versionCode | number | 是 | 表示要查询的共享库版本号。 |
|AsyncCallback\<boolean>> | 回调函数。返回true表示共享库正在使用,返回false表示共享库不在使用。 |
**参数:** **错误码**
| 类型 | 说明 | | 错误码ID | 错误信息 |
| -------- | -------- | | 201 | Permissions denied. |
|AsyncCallback\<boolean>> | 回调函数。返回true表示共享库正在使用,返回false表示共享库不在使用。 | | 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16000050 | Internal error. |
**示例:** **示例:**
```ts ```ts
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
const bundleName = "this is a bundleName";
const versionCode = 1;
appManager.isSharedBundleRunning(bundleName, versionCode, (err, data) => { appManager.isSharedBundleRunning(bundleName, versionCode, (err, data) => {
if (err) { if (err) {
console.error('err: ${JSON.stringify(err)}'); console.error('err: ${JSON.stringify(err)}');
...@@ -749,7 +764,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\> ...@@ -749,7 +764,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
> >
> 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。 > 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。
**需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSESohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSES, ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
...@@ -799,7 +814,7 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal ...@@ -799,7 +814,7 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
> >
> 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。 > 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。
**需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSESohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSES, ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
......
...@@ -173,6 +173,8 @@ saveAppState(context?: UIAbilityContext): boolean; ...@@ -173,6 +173,8 @@ saveAppState(context?: UIAbilityContext): boolean;
```ts ```ts
import appRecovery from '@ohos.app.ability.appRecovery'; import appRecovery from '@ohos.app.ability.appRecovery';
import errorManager from '@ohos.app.ability.errorManager';
let observer = { let observer = {
onUnhandledException(errorMsg) { onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg); console.log('onUnhandledException, errorMsg: ', errorMsg);
......
...@@ -298,7 +298,7 @@ getRequestCallback(want: Want): RequestCallback ...@@ -298,7 +298,7 @@ getRequestCallback(want: Want): RequestCallback
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
| 参数名 | 值 | 说明 | | 名称 | 值 | 说明 |
| ------------ | ------------------ | ---------------------- | | ------------ | ------------------ | ---------------------- |
| RESULT_OK | 0 | 表示成功。 | | RESULT_OK | 0 | 表示成功。 |
| RESULT_CANCEL | 1 | 表示失败。 | | RESULT_CANCEL | 1 | 表示失败。 |
...@@ -324,7 +324,7 @@ setRequestResult(result: RequestResult): void; ...@@ -324,7 +324,7 @@ setRequestResult(result: RequestResult): void;
设置请求结果 设置请求结果
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
**参数:** **参数:**
......
...@@ -7,4 +7,10 @@ ExtensionAbility是特定场景扩展能力的基类,继承自[Ability](js-api ...@@ -7,4 +7,10 @@ ExtensionAbility是特定场景扩展能力的基类,继承自[Ability](js-api
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。 > 本模块接口仅可在Stage模型下使用。
## 导入模块
```ts
import ExtensionAbility from '@ohos.app.ability.ExtensionAbility';
```
**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore **系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
\ No newline at end of file
...@@ -946,7 +946,7 @@ clearAllMissions(): Promise&lt;void&gt;; ...@@ -946,7 +946,7 @@ clearAllMissions(): Promise&lt;void&gt;;
import missionManager from '@ohos.app.ability.missionManager'; import missionManager from '@ohos.app.ability.missionManager';
try { try {
missionManager.clearAllMissions(bundleName).then((data) => { missionManager.clearAllMissions().then((data) => {
console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}'); console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}');
}).catch(err => { }).catch(err => {
console.error('clearAllMissions failed: ${err.message}'); console.error('clearAllMissions failed: ${err.message}');
......
...@@ -257,7 +257,7 @@ revokeQuickFix(bundleName: string, callback: AsyncCallback\<void>): void; ...@@ -257,7 +257,7 @@ revokeQuickFix(bundleName: string, callback: AsyncCallback\<void>): void;
撤销快速修复的接口,使用callback方式返回结果。 撤销快速修复的接口,使用callback方式返回结果。
**需要权限**:ohos.permission.INSTALL_BUNDLE ohos.permission.GET_BUNDLE_INFO_PRIVILEGED **需要权限**:ohos.permission.INSTALL_BUNDLE, ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
...@@ -302,7 +302,7 @@ revokeQuickFix(bundleName: string): Promise\<void>; ...@@ -302,7 +302,7 @@ revokeQuickFix(bundleName: string): Promise\<void>;
撤销快速修复的接口,使用Promise方式返回结果。 撤销快速修复的接口,使用Promise方式返回结果。
**需要权限**:ohos.permission.INSTALL_BUNDLE ohos.permission.GET_BUNDLE_INFO_PRIVILEGED **需要权限**:ohos.permission.INSTALL_BUNDLE, ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
......
...@@ -19,7 +19,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; ...@@ -19,7 +19,7 @@ import StartOptions from '@ohos.app.ability.StartOptions';
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | 否 | 窗口模式。 | | [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | 否 | 窗口模式。<br>**系统API**:该接口为系统接口,三方应用不支持调用。 |
| displayId | number | 否 | 屏幕ID。默认是0,表示当前屏幕。 | | displayId | number | 否 | 屏幕ID。默认是0,表示当前屏幕。 |
**示例:** **示例:**
......
...@@ -623,11 +623,12 @@ onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; ...@@ -623,11 +623,12 @@ onRemoteStateChange(callback: OnRemoteStateChangeCallback): void;
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window';
let caller; let caller;
let dstDeviceId: string; let dstDeviceId: string;
export default class MainAbility extends UIAbility { export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage: Window.WindowStage) { onWindowStageCreate(windowStage: window.WindowStage) {
this.context.startAbilityByCall({ this.context.startAbilityByCall({
bundleName: 'com.example.myservice', bundleName: 'com.example.myservice',
abilityName: 'MainUIAbility', abilityName: 'MainUIAbility',
...@@ -643,7 +644,7 @@ onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; ...@@ -643,7 +644,7 @@ onRemoteStateChange(callback: OnRemoteStateChangeCallback): void;
} }
}).catch((err) => { }).catch((err) => {
console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}');
}) })
} }
} }
``` ```
......
...@@ -176,13 +176,14 @@ import Want from '@ohos.app.ability.Want'; ...@@ -176,13 +176,14 @@ import Want from '@ohos.app.ability.Want';
bundleName: 'com.example.myapplication1', bundleName: 'com.example.myapplication1',
abilityName: 'ServiceExtensionAbility', abilityName: 'ServiceExtensionAbility',
}; };
context.startAbility(want, (err) => { context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
}); });
```
```ts
// (2) 该ServiceExtension去启动另一个UIAbility2,并在启动的时候携带参数ability.params.backToOtherMissionStack为true // (2) 该ServiceExtension去启动另一个UIAbility2,并在启动的时候携带参数ability.params.backToOtherMissionStack为true
let context = ...; // ServiceExtensionContext let context ; // ServiceExtensionContext
let want = { let want = {
bundleName: 'com.example.myapplication2', bundleName: 'com.example.myapplication2',
abilityName: 'MainAbility', abilityName: 'MainAbility',
......
...@@ -25,7 +25,7 @@ want的Params操作的常量。 ...@@ -25,7 +25,7 @@ want的Params操作的常量。
| DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | 指示DLP模块名称的参数的操作。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 | | DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | 指示DLP模块名称的参数的操作。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 |
| DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | 指示DLP能力名称的参数的操作。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 | | DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | 指示DLP能力名称的参数的操作。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 |
| DLP_PARAMS_INDEX | ohos.dlp.params.index | 指示DLP索引参数的操作。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 | | DLP_PARAMS_INDEX | ohos.dlp.params.index | 指示DLP索引参数的操作。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 |
| ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | 表示是否支持跨任务链返回。 <br>**系统API**:该接口为系统接口,三方应用不支持调用。 | | ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | 表示是否支持跨任务链返回。 |
| ABILITY_RECOVERY_RESTART<sup>10+</sup> | ohos.ability.params.abilityRecoveryRestart | 指示当前Ability是否发生了故障恢复重启。 | | ABILITY_RECOVERY_RESTART<sup>10+</sup> | ohos.ability.params.abilityRecoveryRestart | 指示当前Ability是否发生了故障恢复重启。 |
| CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | 指示原子化服务支持分享标题的参数的操作。 | | CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | 指示原子化服务支持分享标题的参数的操作。 |
| SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | 指示原子化服务支持分享内容的参数的操作。 | | SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | 指示原子化服务支持分享内容的参数的操作。 |
......
...@@ -2144,6 +2144,8 @@ acquireFormData(formId: string, callback: AsyncCallback<{[key: string]: Object}> ...@@ -2144,6 +2144,8 @@ acquireFormData(formId: string, callback: AsyncCallback<{[key: string]: Object}>
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
...@@ -2194,6 +2196,8 @@ acquireFormData(formId: string): Promise<{[key: string]: Object}>; ...@@ -2194,6 +2196,8 @@ acquireFormData(formId: string): Promise<{[key: string]: Object}>;
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
...@@ -2244,9 +2248,14 @@ getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Pr ...@@ -2244,9 +2248,14 @@ getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Pr
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
...@@ -2269,7 +2278,7 @@ try { ...@@ -2269,7 +2278,7 @@ try {
## getRunningFormInfosByFilter<sup>10+</sup> ## getRunningFormInfosByFilter<sup>10+</sup>
getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt;): void
根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。 根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。
...@@ -2281,7 +2290,7 @@ getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, cal ...@@ -2281,7 +2290,7 @@ getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, cal
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------- | ---- | -------------------------------- | | ----------- | --------------- | ---- | -------------------------------- |
| formProviderFilter | formInfo.FormProviderFilter [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | 是 | 卡片提供方应用信息。 | | formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | 是 | 卡片提供方应用信息。 |
| callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 | | callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 |
**错误码:** **错误码:**
...@@ -2290,9 +2299,14 @@ getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, cal ...@@ -2290,9 +2299,14 @@ getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, cal
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
...@@ -2317,7 +2331,8 @@ try { ...@@ -2317,7 +2331,8 @@ try {
## getRunningFormInfoById<sup>10+</sup> ## getRunningFormInfoById<sup>10+</sup>
getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt; function getRunningFormInfoById(formId: string): Promise&lt;formInfo.RunningFormInfo&gt;
根据formId查询卡片已有的使用方列表信息。使用Promise异步回调。 根据formId查询卡片已有的使用方列表信息。使用Promise异步回调。
...@@ -2335,7 +2350,7 @@ getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningForm ...@@ -2335,7 +2350,7 @@ getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningForm
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ------------------------- | | ------------------- | ------------------------- |
| Promise&lt;Array&lt;formInfo.RunningFormInfo[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Promise对象,返回查询到的使用方列表信息。 | | Promise&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt; | Promise对象,返回查询到的使用方列表信息。 |
**错误码:** **错误码:**
...@@ -2343,9 +2358,14 @@ getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningForm ...@@ -2343,9 +2358,14 @@ getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningForm
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288'; let formId = '12400633174999288';
...@@ -2362,7 +2382,7 @@ try { ...@@ -2362,7 +2382,7 @@ try {
## getRunningFormInfoById<sup>10+</sup> ## getRunningFormInfoById<sup>10+</sup>
getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;formInfo.RunningFormInfo&gt;): void
根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。 根据提供方信息查询卡片已有的使用方列表信息。使用callback异步回调。
...@@ -2375,7 +2395,7 @@ getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formI ...@@ -2375,7 +2395,7 @@ getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formI
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------- | ---- | -------------------------------- | | ----------- | --------------- | ---- | -------------------------------- |
| formId | string | 是 | 卡片标识。 | | formId | string | 是 | 卡片标识。 |
| callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 | | callback | AsyncCallback&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt; | 是 | 回调函数。返回查询到的使用方列表信息,error为undefined,data为查询到的使用方列表信息;否则为错误对象。 |
**错误码:** **错误码:**
...@@ -2383,7 +2403,11 @@ getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formI ...@@ -2383,7 +2403,11 @@ getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formI
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
......
...@@ -18,8 +18,6 @@ import formInfo from '@ohos.app.form.formInfo'; ...@@ -18,8 +18,6 @@ import formInfo from '@ohos.app.form.formInfo';
**系统能力**:SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form
**系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | | ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | 是 | 否 | 卡片所属包的Bundle名称。 | | bundleName | string | 是 | 否 | 卡片所属包的Bundle名称。 |
...@@ -102,7 +100,7 @@ import formInfo from '@ohos.app.form.formInfo'; ...@@ -102,7 +100,7 @@ import formInfo from '@ohos.app.form.formInfo';
| HEIGHT_KEY | 'ohos.extra.param.key.form_height' | 卡片高度。 | | HEIGHT_KEY | 'ohos.extra.param.key.form_height' | 卡片高度。 |
| TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | 临时卡片。 | | TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | 临时卡片。 |
| ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | ability名称。 | | ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | ability名称。 |
| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' <br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | 设备标识。 | | DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' | 设备标识。 <br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | 指示指定要获取的捆绑Bundle名称的键。 | | BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | 指示指定要获取的捆绑Bundle名称的键。 |
| LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | 卡片创建原因。 | | LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | 卡片创建原因。 |
| PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | 自定义数据。 | | PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | 自定义数据。 |
...@@ -128,9 +126,9 @@ import formInfo from '@ohos.app.form.formInfo'; ...@@ -128,9 +126,9 @@ import formInfo from '@ohos.app.form.formInfo';
**系统能力**:SystemCapability.Ability.Form **系统能力**:SystemCapability.Ability.Form
| 名称 | 类型 | 说明 | | 名称 | 类型 | 必填 |说明 |
| ----------- | ---- | ------------ | | ----------- | ---- | ------------ |------------ |
| moduleName | string | 选填。仅保留moduleName与提供值相符的卡片信息。<br>未填写时则不通过moduleName进行过滤。 | | moduleName | string |否 | 选填。仅保留moduleName与提供值相符的卡片信息。<br>未填写时则不通过moduleName进行过滤。 |
## VisibilityType ## VisibilityType
...@@ -140,7 +138,7 @@ import formInfo from '@ohos.app.form.formInfo'; ...@@ -140,7 +138,7 @@ import formInfo from '@ohos.app.form.formInfo';
| 名称 | 值 | 说明 | | 名称 | 值 | 说明 |
| ----------- | ---- | ------------ | | ----------- | ---- | ------------ |
| UNKNOWN | 0 | 表示卡片为未知。 | | UNKNOWN<sup>10+</sup> | 0 | 表示卡片为未知。 |
| FORM_VISIBLE | 1 | 表示卡片为可见。 | | FORM_VISIBLE | 1 | 表示卡片为可见。 |
| FORM_INVISIBLE | 2 | 表示卡片为不可见。 | | FORM_INVISIBLE | 2 | 表示卡片为不可见。 |
......
...@@ -539,7 +539,7 @@ isRequestPublishFormSupported(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -539,7 +539,7 @@ isRequestPublishFormSupported(callback: AsyncCallback&lt;boolean&gt;): void
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | If the application is not a system application. |
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
...@@ -602,7 +602,7 @@ isRequestPublishFormSupported(): Promise&lt;boolean&gt; ...@@ -602,7 +602,7 @@ isRequestPublishFormSupported(): Promise&lt;boolean&gt;
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | If the application is not a system application. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
......
...@@ -9,6 +9,12 @@ StaticSubscriberExtensionContext模块提供StaticSubscriberExtensionAbility具 ...@@ -9,6 +9,12 @@ StaticSubscriberExtensionContext模块提供StaticSubscriberExtensionAbility具
> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。 > 本模块接口仅可在Stage模型下使用。
## 导入模块
```ts
import StaticSubscriberExtensionContext from '@ohos.application.StaticSubscriberExtensionContext'
```
## 使用说明 ## 使用说明
在使用StaticSubscriberExtensionContext的功能前,需要通过StaticSubscriberExtensionAbility获取。 在使用StaticSubscriberExtensionContext的功能前,需要通过StaticSubscriberExtensionAbility获取。
......
...@@ -404,7 +404,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\> ...@@ -404,7 +404,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
> >
> 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。 > 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。
**需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSESohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSES, ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
...@@ -446,7 +446,7 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal ...@@ -446,7 +446,7 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
**需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSESohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **需要权限**:ohos.permission.CLEAN_BACKGROUND_PROCESSES, ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**参数:** **参数:**
......
...@@ -15,11 +15,13 @@ import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriber ...@@ -15,11 +15,13 @@ import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriber
## 属性 ## 属性
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.AbilityCore **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
**系统API**:该接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | ------------------------------------------------------------ | ---- | ---- | -------- | | ------- | ------------------------------------------------------------ | ---- | ---- | -------- |
| context | [StaticSubscriberExtensionContext](js-apis-application-StaticSubscriberExtensionContext.md) | 是 | 否 | 上下文。 | | context<sup>10+</sup> | [StaticSubscriberExtensionContext](js-apis-application-StaticSubscriberExtensionContext.md) | 是 | 否 | 上下文。 |
## StaticSubscriberExtensionAbility.onReceiveEvent ## StaticSubscriberExtensionAbility.onReceiveEvent
......
...@@ -14,11 +14,13 @@ Mission迁移完成后调用,返回迁移结果。 ...@@ -14,11 +14,13 @@ Mission迁移完成后调用,返回迁移结果。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission **系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**:该接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| result | number | | 迁移任务的结果。 | | result | number | | 迁移任务的结果。 |
**示例:** **示例:**
......
...@@ -23,7 +23,7 @@ import common from '@ohos.app.ability.common'; ...@@ -23,7 +23,7 @@ import common from '@ohos.app.ability.common';
import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.app.form.formBindingData'; import formBindingData from '@ohos.app.form.formBindingData';
class MyFormExtensionAbility extends FormExtensionAbility { export default class MyFormExtensionAbility extends FormExtensionAbility {
onAddForm(want) { onAddForm(want) {
let formContext = this.context; // 获取FormExtensionContext let formContext = this.context; // 获取FormExtensionContext
// ... // ...
......
...@@ -1617,8 +1617,8 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise&lt;Caller& ...@@ -1617,8 +1617,8 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise&lt;Caller&
let want = { let want = {
bundleName: 'com.acts.actscalleeabilityrely', bundleName: 'com.acts.actscalleeabilityrely',
moduleName: 'entry', moduleName: 'entry',
abilityName: 'EntryAbility' abilityName: 'EntryAbility',
deviceId: '' deviceId: '',
parameters: { parameters: {
// 'ohos.aafwk.param.callAbilityToForeground' 值设置为true时为前台启动, 设置false或不设置为后台启动 // 'ohos.aafwk.param.callAbilityToForeground' 值设置为true时为前台启动, 设置false或不设置为后台启动
'ohos.aafwk.param.callAbilityToForeground': true 'ohos.aafwk.param.callAbilityToForeground': true
......
...@@ -1228,7 +1228,7 @@ terminateSelf(): Promise&lt;void&gt;; ...@@ -1228,7 +1228,7 @@ terminateSelf(): Promise&lt;void&gt;;
// 处理业务逻辑错误 // 处理业务逻辑错误
console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`); console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`);
}); });
} catch (error) { } catch (err) {
// 捕获同步的参数错误 // 捕获同步的参数错误
console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`); console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`);
} }
...@@ -2577,8 +2577,8 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise&lt;Caller& ...@@ -2577,8 +2577,8 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise&lt;Caller&
let want = { let want = {
bundleName: 'com.acts.actscalleeabilityrely', bundleName: 'com.acts.actscalleeabilityrely',
moduleName: 'entry', moduleName: 'entry',
abilityName: 'EntryAbility' abilityName: 'EntryAbility',
deviceId: '' deviceId: '',
parameters: { parameters: {
// 'ohos.aafwk.param.callAbilityToForeground' 值设置为true时为前台启动, 设置false或不设置为后台启动 // 'ohos.aafwk.param.callAbilityToForeground' 值设置为true时为前台启动, 设置false或不设置为后台启动
'ohos.aafwk.param.callAbilityToForeground': true 'ohos.aafwk.param.callAbilityToForeground': true
......
...@@ -17,12 +17,16 @@ import uriPermissionManager from '@ohos.application.uriPermissionManager'; ...@@ -17,12 +17,16 @@ import uriPermissionManager from '@ohos.application.uriPermissionManager';
## uriPermissionManager.grantUriPermission ## uriPermissionManager.grantUriPermission
grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback&lt;number&gt;): void grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string, callback: AsyncCallback&lt;number&gt;): void;
授权URI给指定应用,通过callback返回结果。 授权URI给指定应用,通过callback返回结果。
**系统API**:该接口为系统接口,三方应用不支持调用。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**需要权限:** ohos.permission.PROXY_AUTHORIZATION_URI
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -32,6 +36,18 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, ...@@ -32,6 +36,18 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number,
| targetBundleName | string | 是 | 被授权URI的应用包名 | | targetBundleName | string | 是 | 被授权URI的应用包名 |
| callback | AsyncCallback&lt;number&gt; | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 | | callback | AsyncCallback&lt;number&gt; | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | -------- |
| 201 | Permissions denied. |
| 202 | Not System App. Interface caller is not a system app. |
| 401 | The parameter check failed. |
| 16500050 | Internal error. |
| 16500058 | Invalid URI flag. |
| 16500059 | Invalid URI type. |
| 16500060 | Sandbox application can not grant URI permission. |
**示例:** **示例:**
```js ```js
...@@ -46,12 +62,16 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, ...@@ -46,12 +62,16 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number,
## uriPermissionManager.grantUriPermission ## uriPermissionManager.grantUriPermission
grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt; grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string): Promise&lt;number&gt;
授权URI给指定应用,通过返回值返回结果。 授权URI给指定应用,通过返回值返回结果。
**系统API**:该接口为系统接口,三方应用不支持调用。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**需要权限:** ohos.permission.PROXY_AUTHORIZATION_URI
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -66,13 +86,25 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number) ...@@ -66,13 +86,25 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number)
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | 返回0表示有权限,返回-1表示无权限。 | | Promise&lt;number&gt; | 返回0表示有权限,返回-1表示无权限。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | -------- |
| 201 | Permissions denied. |
| 202 | Not System App. Interface caller is not a system app. |
| 401 | The parameter check failed. |
| 16500050 | Internal error. |
| 16500058 | Invalid URI flag. |
| 16500059 | Invalid URI type. |
| 16500060 | Sandbox application can not grant URI permission. |
**示例:** **示例:**
```js ```js
import WantConstant from '@ohos.ability.wantConstant'; import WantConstant from '@ohos.ability.wantConstant';
let targetBundleName = 'com.example.test_case1' let targetBundleName = 'com.example.test_case1'
let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
uriPermissionManager.grantUriPermission(uri, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName) uriPermissionManager.grantUriPermission(uri, WantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName)
.then((data) => { .then((data) => {
console.log('Verification succeeded.' + data) console.log('Verification succeeded.' + data)
}).catch((error) => { }).catch((error) => {
...@@ -81,12 +113,16 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number) ...@@ -81,12 +113,16 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number)
``` ```
## uriPermissionManager.revokeUriPermission ## uriPermissionManager.revokeUriPermission
revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback&lt;number&gt;): void revokeUriPermission(uri: string, targetBundleName: string, callback: AsyncCallback&lt;number&gt;): void;
撤销授权指定应用的URI,通过callback返回结果。 撤销授权指定应用的URI,通过callback返回结果。
**系统API**:该接口为系统接口,三方应用不支持调用。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**需要权限:** ohos.permission.PROXY_AUTHORIZATION_URI
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -95,13 +131,22 @@ revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback& ...@@ -95,13 +131,22 @@ revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback&
| targetBundleName | string | 是 | 被撤销授权uri的应用包名 | | targetBundleName | string | 是 | 被撤销授权uri的应用包名 |
| callback | AsyncCallback&lt;number&gt; | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 | | callback | AsyncCallback&lt;number&gt; | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | -------- |
| 201 | Permissions denied. |
| 202 | Not System App. Interface caller is not a system app. |
| 401 | The parameter check failed. |
| 16500059 | Invalid URI type. |
**示例:** **示例:**
```js ```js
import WantConstant from '@ohos.ability.wantConstant'; import WantConstant from '@ohos.ability.wantConstant';
let targetBundleName = 'com.example.test_case1' let targetBundleName = 'com.example.test_case1'
let URI = "fileshare:///com.samples.filesharetest.FileShare/person/10" let URI = "fileshare:///com.samples.filesharetest.FileShare/person/10"
uriPermissionManager.revokeUriPermission(uri, targetBundleName, (result) => { uriPermissionManager.revokeUriPermission(URI, targetBundleName, (result) => {
console.log("result.code = " + result.code) console.log("result.code = " + result.code)
}) })
``` ```
...@@ -109,12 +154,17 @@ revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback& ...@@ -109,12 +154,17 @@ revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback&
## uriPermissionManager.revokeUriPermission ## uriPermissionManager.revokeUriPermission
revokeUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt; revokeUriPermission(uri: string, targetBundleName: string): Promise&lt;number&gt;
撤销授权指定应用的URI,通过返回值返回结果。 撤销授权指定应用的URI,通过返回值返回结果。
**系统API**:该接口为系统接口,三方应用不支持调用。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**需要权限:** ohos.permission.PROXY_AUTHORIZATION_URI
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -128,6 +178,15 @@ revokeUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number ...@@ -128,6 +178,15 @@ revokeUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | 返回0表示有权限,返回-1表示无权限。 | | Promise&lt;number&gt; | 返回0表示有权限,返回-1表示无权限。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | -------- |
| 201 | Permissions denied. |
| 202 | Not System App. Interface caller is not a system app. |
| 401 | The parameter check failed. |
| 16500059 | Invalid URI type. |
**示例:** **示例:**
```js ```js
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册