diff --git a/api/@ohos.settings.d.ts b/api/@ohos.settings.d.ts index cec3497319f860067c701c09b6b90f70ede8075b..ec2906692fd22b27dbede2854654f559315ff5cc 100644 --- a/api/@ohos.settings.d.ts +++ b/api/@ohos.settings.d.ts @@ -1143,8 +1143,8 @@ declare namespace settings { * @param { AsyncCallback } [callback] - The callback of getValue result. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @arkts 1.1 */ function getValue(context: Context, name: string, callback: AsyncCallback): void; @@ -1157,8 +1157,8 @@ declare namespace settings { * null} otherwise. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @arkts 1.1 */ function getValue(context: Context, name: string): Promise; @@ -1173,11 +1173,60 @@ declare namespace settings { * null} otherwise. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * @arkts 1.1 */ function getValue(context: Context, name: string, domainName: string): Promise; + /** + * Get value from settingsdata + * + * @param { Context } context - Indicates the Context or dataAbilityHelper used to access + * the database. + * @param { string } name - Indicates the name of the character string. + * @param { AsyncCallback } [callback] - The callback of getValue result. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function getValueWithCallback(context: Context, name: string, callback: AsyncCallback): void; + + /** + * Get value from settingsdata + * @param { Context } context - Indicates the Context or dataAbilityHelper used to access + * the database. + * @param { string } name - Indicates the name of the character string. + * @returns { Promise } Returns the value of the character string in the domain if any is found; returns {@code + * null} otherwise. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function getValueReturnPromise(context: Context, name: string): Promise; + + /** + * Get value from settingsdata + * [USER_SECURE] domain need ohos.permission.MANAGE_SECURE_SETTINGS permission. + * + * @param { Context } context - Indicates the Context used to access the database. + * @param { string } name - Indicates the name of the character string. + * @param { string } domainName - Indicates the name of the domain name to set. + * @returns { Promise } Returns the value of the character string in the domain if any is found; returns {@code + * null} otherwise. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function getValueWithDomainNameReturnPromise(context: Context, name: string, domainName: string): Promise; + + /** + * @arkts 1.2 + */ + overload getValue { getValueWithCallback, getValueReturnPromise, getValueWithDomainNameReturnPromise }; + /** * Saves a character string name and its value to the database. * @@ -1222,8 +1271,8 @@ declare namespace settings { * @param { AsyncCallback } [callback] - The callback of setValue result. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @arkts 1.1 */ function setValue(context: Context, name: string, value: string, callback: AsyncCallback): void; @@ -1237,8 +1286,8 @@ declare namespace settings { * @returns { Promise } Returns {@code true} if the operation is successful; returns {@code false} otherwise. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @arkts 1.1 */ function setValue(context: Context, name: string, value: string): Promise; @@ -1256,11 +1305,65 @@ declare namespace settings { * @throws { BusinessError } 201 - Permission denied. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * @arkts 1.1 */ function setValue(context: Context, name: string, value: string, domainName: string): Promise; + /** + * Set settingsdata value. + * + * @permission ohos.permission.MANAGE_SETTINGS + * @param { Context } context - Indicates Context or dataAbilityHelper instance. + * @param { string } name - Indicates the name of the character string. + * @param { string } value - Indicates the value of the character string. + * @param { AsyncCallback } [callback] - The callback of setValue result. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function setValueWithCallback(context: Context, name: string, value: string, callback: AsyncCallback): void; + + /** + * Set settingsdata value. + * + * @permission ohos.permission.MANAGE_SETTINGS + * @param { Context } context - Indicates Context or dataAbilityHelper instance. + * @param { string } name - Indicates the name of the character string. + * @param { string } value - Indicates the value of the character string. + * @returns { Promise } Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function setValueReturnPromise(context: Context, name: string, value: string): Promise; + + /** + * Set settingsdata value. + * [DEVICE_SHARED, USER_PROPERTY] domain need ohos.permission.MANAGE_SETTINGS permission. + * [USER_SECURE] domain need ohos.permission.MANAGE_SECURE_SETTINGS permission. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS or ohos.permission.MANAGE_SETTINGS + * @param { Context } context - Indicates Context instance. + * @param { string } name - Indicates the name of the character string. + * @param { string } value - Indicates the value of the character string. + * @param { string } domainName - Indicates the name of the domain name to set. + * @returns { Promise } Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function setValueWithDomainNameReturnPromise(context: Context, name: string, value: string, domainName: string): Promise; + + /** + * @arkts 1.2 + */ + overload setValue { setValueWithCallback, setValueReturnPromise, setValueWithDomainNameReturnPromise }; + /** * Enables or disables airplane mode. * @@ -1268,8 +1371,8 @@ declare namespace settings { * airplane mode, and {@code false} means to disable airplane mode. * @param { AsyncCallback } [callback] - The callback of enableAirplaneMode result. * @syscap SystemCapability.Applications.Settings.Core - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 + * @arkts 1.1 */ function enableAirplaneMode(enable: boolean, callback: AsyncCallback): void; @@ -1280,18 +1383,47 @@ declare namespace settings { * airplane mode, and {@code false} means to disable airplane mode. * @returns { Promise } - Return Promise. * @syscap SystemCapability.Applications.Settings.Core - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 + * @arkts 1.1 */ function enableAirplaneMode(enable: boolean): Promise; + /** + * Enables or disables airplane mode. + * + * @param { boolean } enable - Specifies whether to enable airplane mode. The value {@code true} means to enable + * airplane mode, and {@code false} means to disable airplane mode. + * @param { AsyncCallback } [callback] - The callback of enableAirplaneMode result. + * @syscap SystemCapability.Applications.Settings.Core + * @since 20 + * @arkts 1.2 + */ + function enableAirplaneModeWithCallback(enable: boolean, callback: AsyncCallback): void; + + /** + * Enables or disables airplane mode. + * + * @param { boolean } enable - Specifies whether to enable airplane mode. The value {@code true} means to enable + * airplane mode, and {@code false} means to disable airplane mode. + * @returns { Promise } - Return Promise. + * @syscap SystemCapability.Applications.Settings.Core + * @since 20 + * @arkts 1.2 + */ + function enableAirplaneModeReturnPromise(enable: boolean): Promise; + + /** + * @arkts 1.2 + */ + overload enableAirplaneMode { enableAirplaneModeWithCallback, enableAirplaneModeReturnPromise }; + /** * Checks whether a specified application can show as a floating window. * * @param { AsyncCallback } [callback] - The callback of canShowFloating result. * @syscap SystemCapability.Applications.Settings.Core - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 + * @arkts 1.1 */ function canShowFloating(callback: AsyncCallback): void; @@ -1301,11 +1433,37 @@ declare namespace settings { * @returns { Promise } Returns {@code true} if the application can draw over other applications; returns * {@code false} otherwise. * @syscap SystemCapability.Applications.Settings.Core - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 + * @arkts 1.1 */ function canShowFloating(): Promise; + /** + * Checks whether a specified application can show as a floating window. + * + * @param { AsyncCallback } [callback] - The callback of canShowFloating result. + * @syscap SystemCapability.Applications.Settings.Core + * @since 20 + * @arkts 1.2 + */ + function canShowFloatingWithCallback(callback: AsyncCallback): void; + + /** + * Checks whether a specified application can show as a floating window. + * + * @returns { Promise } Returns {@code true} if the application can draw over other applications; returns + * {@code false} otherwise. + * @syscap SystemCapability.Applications.Settings.Core + * @since 20 + * @arkts 1.2 + */ + function canShowFloatingReturnPromise(): Promise; + + /** + * @arkts 1.2 + */ + overload canShowFloating { canShowFloatingWithCallback, canShowFloatingReturnPromise }; + /** * Get settingsdata uri (synchronous method) * @@ -1341,8 +1499,8 @@ declare namespace settings { * @returns { string } Returns settingsdata value. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @arkts 1.1 */ function getValueSync(context: Context, name: string, defValue: string): string; @@ -1357,11 +1515,46 @@ declare namespace settings { * @returns { string } Returns settingsdata value. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * @arkts 1.1 */ function getValueSync(context: Context, name: string, defValue: string, domainName: string): string; + /** + * Get value from settingsdata(synchronous method) + * + * @param { Context } context - Indicates Context or dataAbilityHelper instance + * @param { string } name - Indicates the name of the character string. + * @param { string } defValue - Indicates the default value of the character string. + * @returns { string } Returns settingsdata value. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function getValueSyncWithContextNameDefValue(context: Context, name: string, defValue: string): string; + + /** + * Get value from settingsdata(synchronous method). + * [USER_SECURE] domain need ohos.permission.MANAGE_SECURE_SETTINGS permission. + * + * @param { Context } context - Indicates Context instance + * @param { string } name - Indicates the name of the character string. + * @param { string } defValue - Indicates the default value of the character string. + * @param { string } domainName - Indicates the name of the domain name to set. + * @returns { string } Returns settingsdata value. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function getValueSyncWithContextNameDefValueDomainName(context: Context, name: string, defValue: string, domainName: string): string; + + /** + * @arkts 1.2 + */ + overload getValueSync { getValueSyncWithContextNameDefValue, getValueSyncWithContextNameDefValueDomainName }; + /** * Set settingsdata value(synchronous method) * @@ -1388,8 +1581,8 @@ declare namespace settings { * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @arkts 1.1 */ function setValueSync(context: Context, name: string, value: string): boolean; @@ -1407,11 +1600,50 @@ declare namespace settings { * @throws { BusinessError } 201 - Permission denied. * @syscap SystemCapability.Applications.Settings.Core * @StageModelOnly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * @arkts 1.1 */ function setValueSync(context: Context, name: string, value: string, domainName: string): boolean; + /** + * Set settingsdata value(synchronous method) + * + * @permission ohos.permission.MANAGE_SETTINGS + * @param { Context } context - Indicates Context or dataAbilityHelper instance. + * @param { string } name - Indicates the name of the character string. + * @param { string } value - Indicates the value of the character string. + * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function setValueSyncWithContextNameValue(context: Context, name: string, value: string): boolean; + + /** + * Set settingsdata value(synchronous method). + * [DEVICE_SHARED, USER_PROPERTY] domain need ohos.permission.MANAGE_SETTINGS permission. + * [USER_SECURE] domain need ohos.permission.MANAGE_SECURE_SETTINGS permission. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS or ohos.permission.MANAGE_SETTINGS + * @param { Context } context - Indicates Context instance. + * @param { string } name - Indicates the name of the character string. + * @param { string } value - Indicates the value of the character string. + * @param { string } domainName - Indicates the name of the domain name to set. + * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Applications.Settings.Core + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function setValueSyncWithContextNameValueDomainName(context: Context, name: string, value: string, domainName: string): boolean; + + /** + * @arkts 1.2 + */ + overload setValueSync { setValueSyncWithContextNameValue, setValueSyncWithContextNameValueDomainName }; + /** * Monitor registration key(synchronous method) * [USER_SECURE] domain need ohos.permission.MANAGE_SECURE_SETTINGS permission.