1# JS API Changes of the Ability Framework 2 3The table below lists the APIs changes of the ability framework in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS. 4 5## API Changes 6 7| Module| Class| Method/Attribute/Enumeration/Constant| Change Type| 8|---|---|---|---| 9| featureability | FeatureAbility | static getDeviceList(flag: number): Promise\<Result>; | Added| 10| customizeData | CustomizeData | extra: string; | Added| 11| applicationInfo | ApplicationInfo | readonly entityType: string; | Added| 12| applicationInfo | ApplicationInfo | readonly uid: number; | Added| 13| applicationInfo | ApplicationInfo | readonly accessTokenId: number; | Added| 14| applicationInfo | ApplicationInfo | readonly removable: boolean; | Added| 15| applicationInfo | ApplicationInfo | readonly metaData: Map\<string, Array\<CustomizeData>>; | Added| 16| applicationInfo | ApplicationInfo | readonly codePath: string; | Added| 17| applicationInfo | ApplicationInfo | readonly moduleInfos: Array\<ModuleInfo>; | Added| 18| shellCmdResult | ShellCmdResult | exitCode: number; | Added| 19| shellCmdResult | ShellCmdResult | stdResult: String; | Added| 20| ProcessRunningInfo | ProcessRunningInfo | bundleNames: Array\<string>; | Added| 21| ProcessRunningInfo | ProcessRunningInfo | processName: string; | Added| 22| ProcessRunningInfo | ProcessRunningInfo | uid: number; | Added| 23| ProcessRunningInfo | ProcessRunningInfo | pid: number; | Added| 24| BaseContext | BaseContext | stageMode: boolean; | Added| 25| abilityDelegatorArgs | AbilityDelegatorArgs | testRunnerClassName: string; | Added| 26| abilityDelegatorArgs | AbilityDelegatorArgs | testCaseNames: string; | Added| 27| abilityDelegatorArgs | AbilityDelegatorArgs | parameters: {[key: string]: string}; | Added| 28| abilityDelegatorArgs | AbilityDelegatorArgs | bundleName: string; | Added| 29| abilityDelegator | AbilityDelegator | executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void;<br>executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<ShellCmdResult>): void;<br>executeShellCommand(cmd: string, timeoutSecs?: number): Promise\<ShellCmdResult>; | Added| 30| abilityDelegator | AbilityDelegator | print(msg: string, callback: AsyncCallback\<void>): void;<br>print(msg: string): Promise\<void>; | Added| 31| context | Context | printDrawnCompleted(callback: AsyncCallback\<void>): void;<br>printDrawnCompleted(): Promise\<void>; | Added| 32| context | Context | isUpdatingConfigurations(callback: AsyncCallback\<boolean>): void;<br>isUpdatingConfigurations(): Promise\<boolean>; | Added| 33| context | Context | getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void<br>getAbilityInfo(): Promise\<AbilityInfo>; | Added| 34| context | Context | getApplicationContext(): Context; | Added| 35| context | Context | getAppVersionInfo(callback: AsyncCallback\<AppVersionInfo>): void<br>getAppVersionInfo(): Promise\<AppVersionInfo>; | Added| 36| context | Context | getHapModuleInfo(callback: AsyncCallback\<HapModuleInfo>): void<br>getHapModuleInfo(): Promise\<HapModuleInfo>; | Added| 37| context | Context | getAppType(callback: AsyncCallback\<string>): void<br>getAppType(): Promise\<string>; | Added| 38| context | Context | getOrCreateDistributedDir(): Promise\<string>;<br>getOrCreateDistributedDir(callback: AsyncCallback\<string>): void; | Added| 39| context | Context | getCacheDir(callback: AsyncCallback\<string>): void;<br>getCacheDir(): Promise\<string>; | Added| 40| context | Context | getFilesDir(callback: AsyncCallback\<string>): void;<br>getFilesDir(): Promise\<string>; | Added| 41| context | Context | setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\<void>): void<br>setWakeUpScreen(wakeUp: boolean): Promise\<void>; | Added| 42| context | Context | setShowOnLockScreen(show: boolean, callback: AsyncCallback\<void>): void<br>setShowOnLockScreen(show: boolean): Promise\<void>; | Added| 43| context | Context | setDisplayOrientation(orientation: DisplayOrientation, callback: AsyncCallback\<void>): void<br>setDisplayOrientation(orientation: DisplayOrientation): Promise\<void>; | Added| 44| context | Context | getDisplayOrientation(callback: AsyncCallback\<DisplayOrientation>): void<br>getDisplayOrientation(): Promise\<DisplayOrientation>; | Added| 45| appVersionInfo | AppVersionInfo | readonly versionName: string; | Added| 46| appVersionInfo | AppVersionInfo | readonly versionCode: number; | Added| 47| appVersionInfo | AppVersionInfo | readonly appName: string; | Added| 48| dataAbilityHelper | PacMap | [key: string]: number \| string \| boolean \| Array\<string \| number \| boolean> \| null; | Added| 49| dataAbilityHelper | DataAbilityHelper | executeBatch(uri: string, operations: Array\<DataAbilityOperation>, callback: AsyncCallback\<Array\<DataAbilityResult>>): void;<br>executeBatch(uri: string, operations: Array\<DataAbilityOperation>): Promise\<Array\<DataAbilityResult>>; | Added| 50| dataAbilityHelper | DataAbilityHelper | call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): void;<br>call(uri: string, method: string, arg: string, extras: PacMap): Promise\<PacMap>; | Added| 51| ohos.application.Want | Want | entities?: Array\<string>; | Added| 52| ohos.application.Want | Want | parameters?: {[key: string]: any}; | Added| 53| ohos.application.Want | Want | action?: string; | Added| 54| ohos.application.Want | Want | flags?: number; | Added| 55| ohos.application.Want | Want | type?: string; | Added| 56| ohos.application.Want | Want | uri?: string; | Added| 57| ohos.application.Want | Want | abilityName?: string; | Added| 58| ohos.application.Want | Want | bundleName?: string; | Added| 59| ohos.application.Want | Want | deviceId?: string; | Added| 60| ohos.application.testRunner | TestRunner | onRun(): void; | Added| 61| ohos.application.testRunner | TestRunner | onPrepare(): void; | Added| 62| ohos.application.formProvider | formProvider | updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<void>): void;<br>updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\<void>; | Added| 63| ohos.application.formProvider | formProvider | setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback\<void>): void;<br>setFormNextRefreshTime(formId: string, minute: number): Promise\<void>; | Added| 64| ohos.application.formInfo | FormParam | TEMPORARY_KEY = "ohos.extra.param.key.form_temporary" | Added| 65| ohos.application.formInfo | FormParam | HEIGHT_KEY = "ohos.extra.param.key.form_height" | Added| 66| ohos.application.formInfo | FormParam | WIDTH_KEY = "ohos.extra.param.key.form_width" | Added| 67| ohos.application.formInfo | FormParam | MODULE_NAME_KEY = "ohos.extra.param.key.module_name" | Added| 68| ohos.application.formInfo | FormParam | NAME_KEY = "ohos.extra.param.key.form_name" | Added| 69| ohos.application.formInfo | FormParam | DIMENSION_KEY = "ohos.extra.param.key.form_dimension" | Added| 70| ohos.application.formInfo | FormState | READY = 1 | Added| 71| ohos.application.formInfo | FormState | DEFAULT = 0 | Added| 72| ohos.application.formInfo | FormState | UNKNOWN = -1 | Added| 73| ohos.application.formInfo | FormStateInfo | want: Want; | Added| 74| ohos.application.formInfo | FormStateInfo | formState: FormState; | Added| 75| ohos.application.formInfo | ColorMode | MODE_LIGHT = 1 | Added| 76| ohos.application.formInfo | ColorMode | MODE_DARK = 0 | Added| 77| ohos.application.formInfo | ColorMode | MODE_AUTO = -1 | Added| 78| ohos.application.formInfo | FormType | JS = 1 | Added| 79| ohos.application.formInfo | FormInfo | customizeData: {[key: string]: [value: string]}; | Added| 80| ohos.application.formInfo | FormInfo | supportDimensions: Array\<number>; | Added| 81| ohos.application.formInfo | FormInfo | defaultDimension: number; | Added| 82| ohos.application.formInfo | FormInfo | updateDuration: number; | Added| 83| ohos.application.formInfo | FormInfo | formConfigAbility: string; | Added| 84| ohos.application.formInfo | FormInfo | scheduledUpdateTime: string; | Added| 85| ohos.application.formInfo | FormInfo | relatedBundleName: string; | Added| 86| ohos.application.formInfo | FormInfo | formVisibleNotify: boolean; | Added| 87| ohos.application.formInfo | FormInfo | updateEnabled: boolean; | Added| 88| ohos.application.formInfo | FormInfo | isDefault: boolean; | Added| 89| ohos.application.formInfo | FormInfo | colorMode: ColorMode; | Added| 90| ohos.application.formInfo | FormInfo | jsComponentName: string; | Added| 91| ohos.application.formInfo | FormInfo | type: FormType; | Added| 92| ohos.application.formInfo | FormInfo | description: string; | Added| 93| ohos.application.formInfo | FormInfo | name: string; | Added| 94| ohos.application.formInfo | FormInfo | abilityName: string; | Added| 95| ohos.application.formInfo | FormInfo | moduleName: string; | Added| 96| ohos.application.formInfo | FormInfo | bundleName: string; | Added| 97| ohos.application.formError | FormError | ERR_IN_RECOVERY = 36 | Added| 98| ohos.application.formError | FormError | ERR_FORM_DUPLICATE_ADDED = 31 | Added| 99| ohos.application.formError | FormError | ERR_SYSTEM_RESPONSES_FAILED = 30 | Added| 100| ohos.application.formError | FormError | ERR_FORM_FA_NOT_INSTALLED = 20 | Added| 101| ohos.application.formError | FormError | ERR_FORM_NO_SUCH_DIMENSION = 19 | Added| 102| ohos.application.formError | FormError | ERR_FORM_NO_SUCH_ABILITY = 18 | Added| 103| ohos.application.formError | FormError | ERR_FORM_NO_SUCH_MODULE = 17 | Added| 104| ohos.application.formError | FormError | ERR_MAX_SYSTEM_TEMP_FORMS = 16 | Added| 105| ohos.application.formError | FormError | ERR_MAX_FORMS_PER_CLIENT = 15 | Added| 106| ohos.application.formError | FormError | ERR_PROVIDER_DEL_FAIL = 14 | Added| 107| ohos.application.formError | FormError | ERR_OPERATION_FORM_NOT_SELF = 13 | Added| 108| ohos.application.formError | FormError | ERR_MAX_INSTANCES_PER_FORM = 12 | Added| 109| ohos.application.formError | FormError | ERR_MAX_SYSTEM_FORMS = 11 | Added| 110| ohos.application.formError | FormError | ERR_BIND_PROVIDER_FAILED = 10 | Added| 111| ohos.application.formError | FormError | ERR_NOT_EXIST_ID = 9 | Added| 112| ohos.application.formError | FormError | ERR_CFG_NOT_MATCH_ID = 8 | Added| 113| ohos.application.formError | FormError | ERR_ADD_INVALID_PARAM = 7 | Added| 114| ohos.application.formError | FormError | ERR_GET_LAYOUT_FAILED = 6 | Added| 115| ohos.application.formError | FormError | ERR_GET_BUNDLE_FAILED = 5 | Added| 116| ohos.application.formError | FormError | ERR_GET_INFO_FAILED = 4 | Added| 117| ohos.application.formError | FormError | ERR_PERMISSION_DENY = 2 | Added| 118| ohos.application.formError | FormError | ERR_COMMON = 1 | Added| 119| ohos.application.formBindingData | FormBindingData | data: Object | Added| 120| ohos.application.formBindingData | formBindingData | createFormBindingData(obj?: Object \| string): FormBindingData; | Added| 121| ohos.application.ConfigurationConstant | ColorMode | COLOR_MODE_LIGHT = 1 | Added| 122| ohos.application.ConfigurationConstant | ColorMode | COLOR_MODE_DARK = 0 | Added| 123| ohos.application.ConfigurationConstant | ColorMode | COLOR_MODE_NOT_SET = -1 | Added| 124| ohos.application.Configuration | Configuration | colorMode: ConfigurationConstant.ColorMode; | Added| 125| ohos.application.Configuration | Configuration | language: string; | Added| 126| ohos.application.appManager | appManager | getAppMemorySize(): Promise\<number>;<br>getAppMemorySize(callback: AsyncCallback\<number>): void; | Added| 127| ohos.application.appManager | appManager | isRamConstrainedDevice(): Promise\<boolean>;<br>isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void; | Added| 128| ohos.application.appManager | appManager | getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;<br>getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): void; | Added| 129| ohos.application.appManager | appManager | isRunningInStabilityTest(callback: AsyncCallback\<boolean>): void;<br>isRunningInStabilityTest(): Promise\<boolean>; | Added| 130| ohos.application.abilityDelegatorRegistry | AbilityLifecycleState | DESTROY | Added| 131| ohos.application.abilityDelegatorRegistry | AbilityLifecycleState | BACKGROUND | Added| 132| ohos.application.abilityDelegatorRegistry | AbilityLifecycleState | FOREGROUND | Added| 133| ohos.application.abilityDelegatorRegistry | AbilityLifecycleState | CREATE | Added| 134| ohos.application.abilityDelegatorRegistry | AbilityLifecycleState | UNINITIALIZED | Added| 135| ohos.application.abilityDelegatorRegistry | abilityDelegatorRegistry | getArguments(): AbilityDelegatorArgs; | Added| 136| ohos.application.abilityDelegatorRegistry | abilityDelegatorRegistry | getAbilityDelegator(): AbilityDelegator; | Added| 137| ohos.abilityAccessCtrl | GrantStatus | PERMISSION_GRANTED = 0 | Added| 138| ohos.abilityAccessCtrl | GrantStatus | PERMISSION_DENIED = -1 | Added| 139| ohos.abilityAccessCtrl | AtManager | verifyAccessToken(tokenID: number, permissionName: string): Promise\<GrantStatus>; | Added| 140| ohos.abilityAccessCtrl | abilityAccessCtrl | createAtManager(): AtManager; | Added| 141| ohos.ability.wantConstant | Action | ACTION_APP_ACCOUNT_OAUTH = "ohos.account.appAccount.action.oauth" | Added| 142| ohos.ability.wantConstant | Action | ACTION_VIDEO_CAPTURE = "ohos.want.action.videoCapture" | Added| 143| ohos.ability.wantConstant | Action | ACTION_IMAGE_CAPTURE = "ohos.want.action.imageCapture" | Added| 144| ohos.ability.particleAbility | ErrorCode | INVALID_PARAMETER = -1 | Added| 145| ohos.ability.particleAbility | particleAbility | disconnectAbility(connection: number, callback:AsyncCallback\<void>): void;<br>disconnectAbility(connection: number): Promise\<void>; | Added| 146| ohos.ability.particleAbility | particleAbility | connectAbility(request: Want, options:ConnectOptions): number; | Added| 147| ohos.ability.particleAbility | particleAbility | cancelBackgroundRunning(callback: AsyncCallback\<void>): void;<br>cancelBackgroundRunning(): Promise\<void>; | Added| 148| ohos.ability.particleAbility | particleAbility | startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback\<void>): void;<br>startBackgroundRunning(id: number, request: NotificationRequest): Promise\<void>; | Added| 149| ohos.ability.featureAbility | featureAbility | getWindow(callback: AsyncCallback\<window.Window>): void;<br>getWindow(): Promise\<window.Window>; | Added| 150| ohos.ability.errorCode | ErrorCode | NO_ERROR = 0 | Added| 151| ohos.ability.errorCode | ErrorCode | INVALID_PARAMETER = -1 | Added| 152| ohos.ability.errorCode | ErrorCode | ABILITY_NOT_FOUND = -2 | Added| 153| ohos.ability.errorCode | ErrorCode | PERMISSION_DENY = -3 | Added| 154| lifecycle | LifecycleData | call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): void; | Added| 155| lifecycle | LifecycleData | executeBatch?(ops: Array\<DataAbilityOperation>, callback: AsyncCallback\<Array\<DataAbilityResult>>): void; | Added| 156| lifecycle | LifecycleService | onReconnect?(want: Want): void; | Added| 157| lifecycle | LifecycleApp | onMemoryLevel?(level: number): void; | Added| 158| lifecycle | LifecycleApp | onNewWant?(want: Want): void; | Added| 159| lifecycle | LifecycleApp | onActive?(): void; | Added| 160| lifecycle | LifecycleApp | onInactive?(): void; | Added| 161| lifecycle | LifecycleApp | onRestoreAbilityState?(inState: PacMap): void; | Added| 162| lifecycle | LifecycleApp | onSaveAbilityState?(outState: PacMap): void; | Added| 163| lifecycle | LifecycleForm | onAcquireFormState?(want: Want): formInfo.FormState; | Added| 164| lifecycle | LifecycleForm | onDestroy?(formId: string): void; | Added| 165| lifecycle | LifecycleForm | onEvent?(formId: string, message: string): void; | Added| 166| lifecycle | LifecycleForm | onVisibilityChange?(newStatus: { [key: string]: number }): void; | Added| 167| lifecycle | LifecycleForm | onUpdate?(formId: string): void; | Added| 168| lifecycle | LifecycleForm | onCastToNormal?(formId: string): void; | Added| 169| lifecycle | LifecycleForm | onCreate?(want: Want): formBindingData.FormBindingData; | Added| 170