1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22import { DataAbilityHelper } from './ability/dataAbilityHelper'; 23import Context from './application/Context'; 24 25/** 26 * This module provides settings data access abilities. 27 * 28 * @namespace settings 29 * @syscap SystemCapability.Applications.Settings.Core 30 * @since 7 31 */ 32declare namespace settings { 33 34 /** 35 * Provide domain name for query. 36 * 37 * @namespace domainName 38 * @syscap SystemCapability.Applications.Settings.Core 39 * @since 11 40 */ 41 namespace domainName { 42 /** 43 * Provide the domain name for device shared Key. 44 * 45 * <p>This constants is a domain name for device level shared key. 46 * 47 * @constant 48 * @syscap SystemCapability.Applications.Settings.Core 49 * @since 11 50 */ 51 const DEVICE_SHARED: string; 52 53 /** 54 * Provide the domain name for user property. 55 * 56 * <p>This constants is a domain name for user level key. 57 * 58 * @constant 59 * @syscap SystemCapability.Applications.Settings.Core 60 * @since 11 61 */ 62 const USER_PROPERTY: string; 63 64 /** 65 * Provide the domain name for user security property. 66 * 67 * <p>This constants is a domain name for user security level key. 68 * 69 * @constant 70 * @syscap SystemCapability.Applications.Settings.Core 71 * @systemapi 72 * @since 11 73 */ 74 const USER_SECURITY: string; 75 } 76 77 /** 78 * Provides methods for setting time and date formats. 79 * 80 * @namespace date 81 * @syscap SystemCapability.Applications.Settings.Core 82 * @since 7 83 */ 84 namespace date { 85 86 /** 87 * Indicates the date format. 88 * 89 * <p>The formats {@code mm/dd/yyyy}, {@code dd/mm/yyyy}, and {@code yyyy/mm/dd} are available. 90 * 91 * @constant 92 * @syscap SystemCapability.Applications.Settings.Core 93 * @since 7 94 */ 95 const DATE_FORMAT: string 96 97 /** 98 * Specifies whether the time is displayed in 12-hour or 24-hour format. 99 * 100 * <p>If the value is {@code 12}, the 12-hour format is used. If the value is {@code 24}, the 24-hour format 101 * is used. 102 * 103 * @constant 104 * @syscap SystemCapability.Applications.Settings.Core 105 * @since 7 106 */ 107 const TIME_FORMAT: string 108 109 /** 110 * Specifies whether the date, time, and time zone are automatically obtained from the Network 111 * Identity and Time Zone (NITZ). 112 * 113 * <p>If the value is {@code true}, the information is automatically obtained from NITZ. 114 * If the value is {@code false}, the information is not obtained from NITZ. 115 * 116 * @constant 117 * @syscap SystemCapability.Applications.Settings.Core 118 * @since 7 119 */ 120 const AUTO_GAIN_TIME: string 121 122 /** 123 * Specifies whether the time zone is automatically obtained from NITZ. 124 * 125 * <p>If the value is {@code true}, the information is automatically obtained from NITZ. If the value 126 * is {@code false}, the information is not obtained from NITZ. 127 * 128 * @constant 129 * @syscap SystemCapability.Applications.Settings.Core 130 * @since 7 131 */ 132 const AUTO_GAIN_TIME_ZONE: string 133 } 134 135 /** 136 * Provides methods for setting the display effect, including the font size, screen brightness, screen rotation, 137 * animation factor, and display color. 138 * 139 * @namespace display 140 * @syscap SystemCapability.Applications.Settings.Core 141 * @since 7 142 */ 143 namespace display { 144 /** 145 * Indicates the scaling factor of fonts, which is a float number. 146 * 147 * @constant 148 * @syscap SystemCapability.Applications.Settings.Core 149 * @since 7 150 */ 151 const FONT_SCALE: string 152 153 /** 154 * Indicates the screen brightness. The value ranges from 0 to 255. 155 * 156 * @constant 157 * @syscap SystemCapability.Applications.Settings.Core 158 * @since 7 159 */ 160 const SCREEN_BRIGHTNESS_STATUS: string 161 162 /** 163 * Specifies whether automatic screen brightness adjustment is enabled. 164 * 165 * <p>If the value is {@code 1}, automatic adjustment is enabled. If the value is {@code 0}, automatic 166 * adjustment is disabled. 167 * 168 * @constant 169 * @syscap SystemCapability.Applications.Settings.Core 170 * @since 7 171 */ 172 const AUTO_SCREEN_BRIGHTNESS: string 173 174 /** 175 * Indicates the value of {@code AUTO_SCREEN_BRIGHTNESS} when automatic screen brightness adjustment is used. 176 * 177 * @constant 178 * @syscap SystemCapability.Applications.Settings.Core 179 * @since 7 180 */ 181 const AUTO_SCREEN_BRIGHTNESS_MODE: number 182 183 /** 184 * Indicates the value of {@code AUTO_SCREEN_BRIGHTNESS} when manual screen brightness adjustment is used. 185 * 186 * @constant 187 * @syscap SystemCapability.Applications.Settings.Core 188 * @since 7 189 */ 190 const MANUAL_SCREEN_BRIGHTNESS_MODE: number 191 192 /** 193 * Indicates the duration that the device waits before going to sleep after a period of inactivity, in 194 * milliseconds. 195 * 196 * @constant 197 * @syscap SystemCapability.Applications.Settings.Core 198 * @since 7 199 */ 200 const SCREEN_OFF_TIMEOUT: string 201 202 /** 203 * Indicates the screen rotation when no other policy is available. 204 * 205 * <p>This constant is invalid when auto-rotation is enabled. When auto-rotation is disabled, the following 206 * values are available: 207 * 208 * <ul> 209 * <li>{@code 0} - The screen rotates 0 degrees. 210 * <li>{@code 1} - The screen rotates 90 degrees. 211 * <li>{@code 2} - The screen rotates 180 degrees. 212 * <li>{@code 3} - The screen rotates 270 degrees. 213 * </ul> 214 * 215 * @constant 216 * @syscap SystemCapability.Applications.Settings.Core 217 * @since 7 218 */ 219 const DEFAULT_SCREEN_ROTATION: string 220 221 /** 222 * Indicates the scaling factor for the animation duration. 223 * 224 * <p>This affects the start delay and duration of all such animations. If the value is {@code 0}, 225 * the animation ends immediately. The default value is {@code 1}. 226 * 227 * @constant 228 * @syscap SystemCapability.Applications.Settings.Core 229 * @since 7 230 */ 231 const ANIMATOR_DURATION_SCALE: string 232 233 /** 234 * Indicates the scaling factor for transition animations. 235 * If the value is {@code 0}, transition animations are disabled. 236 * 237 * @constant 238 * @syscap SystemCapability.Applications.Settings.Core 239 * @since 7 240 */ 241 const TRANSITION_ANIMATION_SCALE: string 242 243 /** 244 * Indicates the scaling factor for normal window animations. 245 * If the value is {@code 0}, window animations are disabled. 246 * 247 * @constant 248 * @syscap SystemCapability.Applications.Settings.Core 249 * @since 7 250 */ 251 const WINDOW_ANIMATION_SCALE: string 252 253 /** 254 * Specifies whether display color inversion is enabled. 255 * 256 * <p>If the value is {@code 1}, display color inversion is enabled. If the value is {@code 0}, display color 257 * inversion is disabled. 258 * 259 * @constant 260 * @syscap SystemCapability.Applications.Settings.Core 261 * @since 7 262 */ 263 const DISPLAY_INVERSION_STATUS: string 264 } 265 266 /** 267 * Provides methods for setting general information about devices, including the device name, startup wizard, 268 * airplane mode, debugging information, accessibility feature switch, and touch exploration status. 269 * 270 * @namespace general 271 * @syscap SystemCapability.Applications.Settings.Core 272 * @since 7 273 */ 274 namespace general { 275 /** 276 * Specifies whether the startup wizard has been run. 277 * 278 * <p>If the value is {@code 0}, the startup wizard has not been run. If the value is not {@code 0}, the startup 279 * wizard has been run. 280 * 281 * @constant 282 * @syscap SystemCapability.Applications.Settings.Core 283 * @since 7 284 */ 285 const SETUP_WIZARD_FINISHED: string 286 287 /** 288 * Specifies what happens after the user presses the call end button if the user is not in a call. 289 * 290 * <ul> 291 * <li>{@code 0} - Nothing happens. 292 * <li>{@code 1} - The home screen is displayed. 293 * <li>{@code 2} - The device enters the sleep state and the screen is locked. 294 * <li>{@code 3} - The home screen is displayed. If the user is already on the home screen, the device enters 295 * the sleep state. 296 * </ul> 297 * 298 * @constant 299 * @syscap SystemCapability.Applications.Settings.Core 300 * @since 7 301 */ 302 const END_BUTTON_ACTION: string 303 304 /** 305 * Specifies whether the accelerometer is used to change screen orientation, that is, whether auto-rotation is 306 * enabled. 307 * 308 * <p>The value {@code 1} indicates that the accelerometer is enabled by default, and {@code 0} indicates that 309 * the accelerometer is disabled by default. 310 * 311 * @constant 312 * @syscap SystemCapability.Applications.Settings.Core 313 * @since 7 314 */ 315 const ACCELEROMETER_ROTATION_STATUS: string 316 317 /** 318 * Specifies whether airplane mode is enabled. 319 * 320 * <p>If the value is {@code 1}, airplane mode is enabled. If the value is {@code 0}, airplane mode is disabled. 321 * 322 * @constant 323 * @syscap SystemCapability.Applications.Settings.Core 324 * @since 7 325 */ 326 const AIRPLANE_MODE_STATUS: string 327 328 /** 329 * Specifies whether the device is provisioned. 330 * 331 * <p>On a multi-user device with a single system user, the screen may be locked when the value is {@code true}. 332 * In addition, other abilities cannot be started on the system user unless they are marked to display over 333 * the screen lock. 334 * @constant 335 * @syscap SystemCapability.Applications.Settings.Core 336 * @since 7 337 */ 338 const DEVICE_PROVISION_STATUS: string 339 340 /** 341 * Specifies whether the hard disk controller (HDC) on USB devices is enabled. 342 * 343 * <p>If the value is {@code true}, the HDC is enabled. If the value is {@code false}, the HDC is disabled. 344 * 345 * @constant 346 * @syscap SystemCapability.Applications.Settings.Core 347 * @since 7 348 */ 349 const HDC_STATUS: string 350 351 /** 352 * Indicates the number of boot operations after the device is powered on. 353 * 354 * @constant 355 * @syscap SystemCapability.Applications.Settings.Core 356 * @since 7 357 */ 358 const BOOT_COUNTING: string 359 360 /** 361 * Specifies whether contact metadata synchronization is enabled. 362 * 363 * <p>If the value is {@code true}, synchronization is enabled. If the value is {@code false}, 364 * synchronization is disabled. 365 * 366 * @constant 367 * @syscap SystemCapability.Applications.Settings.Core 368 * @since 7 369 */ 370 const CONTACT_METADATA_SYNC_STATUS: string 371 372 /** 373 * Specifies whether developer options are enabled. 374 * 375 * <p>If the value is {@code true}, developer options are enabled. 376 * If the value is {@code false}, developer options are disabled. 377 * 378 * @constant 379 * @syscap SystemCapability.Applications.Settings.Core 380 * @since 7 381 */ 382 const DEVELOPMENT_SETTINGS_STATUS: string 383 384 /** 385 * Indicates the device name. 386 * 387 * @constant 388 * @syscap SystemCapability.Applications.Settings.Core 389 * @since 7 390 */ 391 const DEVICE_NAME: string 392 393 /** 394 * Specifies whether USB mass storage is enabled. 395 * 396 * <p>If the value is {@code true}, USB mass storage is enabled. 397 * If the value is {@code false}, USB mass storage is disabled. 398 * 399 * @constant 400 * @syscap SystemCapability.Applications.Settings.Core 401 * @since 7 402 */ 403 const USB_STORAGE_STATUS: string 404 405 /** 406 * Specifies whether the device waits for the debugger when starting an application to debug. 407 * 408 * <p>If the value is {@code 1}, the device waits for the debugger. 409 * If the value is {@code 0}, the system does not wait for the debugger, and so the application runs normally. 410 * 411 * @constant 412 * @syscap SystemCapability.Applications.Settings.Core 413 * @since 7 414 */ 415 const DEBUGGER_WAITING: string 416 417 /** 418 * Indicates the bundle name of the application to debug. 419 * 420 * @constant 421 * @syscap SystemCapability.Applications.Settings.Core 422 * @since 7 423 */ 424 const DEBUG_APP_PACKAGE: string 425 426 /** 427 * Specifies whether any accessibility feature is enabled. 428 * 429 * <p>If the value is {@code 1}, the accessibility feature is enabled. If the value is {@code 0}, the 430 * accessibility feature is disabled. 431 * 432 * @constant 433 * @syscap SystemCapability.Applications.Settings.Core 434 * @since 7 435 */ 436 const ACCESSIBILITY_STATUS: string 437 438 /** 439 * Indicates the list of accessibility features that have been activated. 440 * 441 * @constant 442 * @syscap SystemCapability.Applications.Settings.Core 443 * @since 7 444 */ 445 const ACTIVATED_ACCESSIBILITY_SERVICES: string 446 447 /** 448 * Indicates the default geographical location that can be used by the browser. Multiple geographical locations 449 * are separated by spaces. 450 * 451 * @constant 452 * @syscap SystemCapability.Applications.Settings.Core 453 * @since 7 454 */ 455 const GEOLOCATION_ORIGINS_ALLOWED: string 456 457 /** 458 * Specifies whether an application should attempt to skip all introductory hints at the first startup. This is 459 * intended for temporary users or users who are familiar with the environment. 460 * 461 * <p>If the value is {@code 1}, the application attempts to skip all introductory hints at the first startup. 462 * If the value is {@code 0}, the application does not skip introductory hints at the first startup. 463 * 464 * @constant 465 * @syscap SystemCapability.Applications.Settings.Core 466 * @since 7 467 */ 468 const SKIP_USE_HINTS: string 469 470 /** 471 * Indicates whether touch exploration is enabled. 472 * 473 * <p>If the value is {@code 1}, touch exploration is enabled. If the value is {@code 0}, touch exploration is 474 * disabled. 475 * 476 * @constant 477 * @syscap SystemCapability.Applications.Settings.Core 478 * @since 7 479 */ 480 const TOUCH_EXPLORATION_STATUS: string 481 } 482 483 /** 484 * Provides methods for setting information about input methods, including automatic capitalization, automatic 485 * punctuation, autocorrect, password presentation, input method engine, and input method subtypes. 486 * 487 * @namespace input 488 * @syscap SystemCapability.Applications.Settings.Core 489 * @since 7 490 */ 491 namespace input { 492 /** 493 * Indicates the default input method and its ID. 494 * 495 * @constant 496 * @syscap SystemCapability.Applications.Settings.Core 497 * @since 7 498 */ 499 const DEFAULT_INPUT_METHOD: string 500 501 /** 502 * Indicates the default input method keyboard type and its ID. 503 * 504 * @constant 505 * @syscap SystemCapability.Applications.Settings.Core 506 * @since 7 507 */ 508 const ACTIVATED_INPUT_METHOD_SUB_MODE: string 509 510 /** 511 * Indicates the list of input methods that have been activated. 512 * 513 * <p>The list is a string that contains the IDs of activated input methods. The IDs are separated by colons 514 * (:), and keyboardTypes of an input method are separated by semicolons (;). An example format is 515 * {@code ima0:keyboardType0;keyboardType1;ima1:ima2:keyboardTypes0}. The type of <b>imaID</b> is ElementName, 516 * and the type of <b>keyboard</b> is int. 517 * 518 * @constant 519 * @syscap SystemCapability.Applications.Settings.Core 520 * @since 7 521 */ 522 const ACTIVATED_INPUT_METHODS: string 523 524 /** 525 * Specifies whether the input method selector is visible. 526 * 527 * <p>If the value is {@code 1}, the input method selector is visible. If the value is {@code 0}, the input 528 * method selector is invisible. 529 * 530 * @constant 531 * @syscap SystemCapability.Applications.Settings.Core 532 * @since 7 533 */ 534 const SELECTOR_VISIBILITY_FOR_INPUT_METHOD: string 535 536 /** 537 * Specifies whether automatic capitalization is enabled for the text editor. 538 * 539 * <p>If the value is {@code 0}, automatic capitalization is disabled. If the value {@code 1}, automatic 540 * capitalization is enabled. 541 * 542 * @constant 543 * @syscap SystemCapability.Applications.Settings.Core 544 * @since 7 545 */ 546 const AUTO_CAPS_TEXT_INPUT: string 547 548 /** 549 * Specifies whether automatic punctuation is enabled for the text editor. Automatic punctuation enables the 550 * text editor to convert two spaces into a period (.) and a space. 551 * 552 * <p>If the value is {@code 0}, automatic punctuation is disabled. If the value {@code 1}, automatic 553 * punctuation is enabled. 554 * 555 * @constant 556 * @syscap SystemCapability.Applications.Settings.Core 557 * @since 7 558 */ 559 const AUTO_PUNCTUATE_TEXT_INPUT: string 560 561 /** 562 * Specifies whether autocorrect is enabled for the text editor. Autocorrect enables the text editor to correct 563 * typos. 564 * 565 * <p>If the value is {@code 0}, autocorrect is disabled. If the value {@code 1}, autocorrect is enabled. 566 * 567 * @constant 568 * @syscap SystemCapability.Applications.Settings.Core 569 * @since 7 570 */ 571 const AUTO_REPLACE_TEXT_INPUT: string 572 573 /** 574 * Specifies whether password presentation is enabled in the text editor. Password presentation enables the 575 * text editor to show password characters when the user types them. 576 * 577 * <p>If the value is {@code 0}, password presentation is disabled. If the value {@code 1}, password 578 * presentation is enabled. 579 * 580 * @constant 581 * @syscap SystemCapability.Applications.Settings.Core 582 * @since 7 583 */ 584 const SHOW_PASSWORD_TEXT_INPUT: string 585 } 586 587 /** 588 * Provides methods for setting network information, including the data roaming status, HTTP proxy configurations, 589 * and preferred networks. 590 * 591 * @namespace network 592 * @syscap SystemCapability.Applications.Settings.Core 593 * @since 7 594 */ 595 namespace network { 596 /** 597 * Specifies whether data roaming is enabled. 598 * 599 * <p>If the value is {@code true}, data roaming is enabled. If the value is {@code false}, 600 * data roaming is disabled. 601 * 602 * @constant 603 * @syscap SystemCapability.Applications.Settings.Core 604 * @since 7 605 */ 606 const DATA_ROAMING_STATUS: string 607 608 /** 609 * Indicates the host name and port number of the global HTTP proxy. 610 * The host name and port number are separated by a colon (:). 611 * 612 * @constant 613 * @syscap SystemCapability.Applications.Settings.Core 614 * @since 7 615 */ 616 const HTTP_PROXY_CFG: string 617 618 /** 619 * Indicates the user preferences of the network to use. 620 * 621 * @constant 622 * @syscap SystemCapability.Applications.Settings.Core 623 * @since 7 624 */ 625 const NETWORK_PREFERENCE_USAGE: string 626 } 627 628 /** 629 * Provides methods for setting the answering mode of incoming and outgoing calls. 630 * 631 * @namespace phone 632 * @syscap SystemCapability.Applications.Settings.Core 633 * @since 7 634 */ 635 namespace phone { 636 /** 637 * Specifies whether real-time text (RTT) calling is enabled. If enabled, incoming and outgoing calls are 638 * answered as RTT calls when supported by the device and carrier. If the value is {@code 1}, RTT calling is 639 * enabled. If the value is {@code 0}, RTT calling is disabled. 640 * 641 * @constant 642 * @syscap SystemCapability.Applications.Settings.Core 643 * @since 7 644 */ 645 const RTT_CALLING_STATUS: string 646 } 647 648 /** 649 * Provides methods for setting the sound effect, including the ringtone, dial tone, alarm sound, notification tone, 650 * and haptic feedback. 651 * 652 * @namespace sound 653 * @syscap SystemCapability.Applications.Settings.Core 654 * @since 7 655 */ 656 namespace sound { 657 /** 658 * Indicates whether the device vibrates when it is ringing for an incoming call. 659 * 660 * <p>This constant will be used by Phone and Settings applications. The value is of the boolean type. 661 * This constant affects only the scenario where the device rings for an incoming call. It does not affect 662 * any other application or scenario. 663 * 664 * @constant 665 * @syscap SystemCapability.Applications.Settings.Core 666 * @since 7 667 */ 668 const VIBRATE_WHILE_RINGING: string 669 670 /** 671 * Indicates the storage area of the system default alarm. 672 * 673 * <p>You can obtain the URI of the system default alarm. 674 * 675 * @constant 676 * @syscap SystemCapability.Applications.Settings.Core 677 * @since 7 678 */ 679 const DEFAULT_ALARM_ALERT: string 680 681 /** 682 * Indicates the type of the dual-tone multifrequency (DTMF) tone played when dialing. 683 * 684 * <p>The value {@code 0} indicates the normal short sound effect, and {@code 1} indicates the long sound 685 * effect. 686 * 687 * @constant 688 * @syscap SystemCapability.Applications.Settings.Core 689 * @since 7 690 */ 691 const DTMF_TONE_TYPE_WHILE_DIALING: string 692 693 /** 694 * Specifies whether the DTMF tone is played when dialing. 695 * 696 * <p>If the value is {@code 1}, the DTMF tone is played. If the value is {@code 0}, the DTMF tone is not 697 * played. 698 * 699 * @constant 700 * @syscap SystemCapability.Applications.Settings.Core 701 * @since 7 702 */ 703 const DTMF_TONE_WHILE_DIALING: string 704 705 /** 706 * Specifies which audio streams are affected by changes on the ringing mode and Do Not Disturb (DND) mode. 707 * 708 * <p>If you want a specific audio stream to be affected by changes of the ringing mode and DDN mode, set the 709 * corresponding bit to {@code 1}. 710 * 711 * @constant 712 * @syscap SystemCapability.Applications.Settings.Core 713 * @since 7 714 */ 715 const AFFECTED_MODE_RINGER_STREAMS: string 716 717 /** 718 * Specifies which audio streams are affected by the mute mode. 719 * 720 * <p>If you want a specific audio stream to remain muted in mute mode, set the corresponding bit to {@code 1}. 721 * 722 * @constant 723 * @syscap SystemCapability.Applications.Settings.Core 724 * @since 7 725 */ 726 const AFFECTED_MUTE_STREAMS: string 727 728 /** 729 * Indicates the storage area of the system default notification tone. 730 * 731 * <p>You can obtain the URI of the system default notification tone. 732 * 733 * @constant 734 * @syscap SystemCapability.Applications.Settings.Core 735 * @since 7 736 */ 737 const DEFAULT_NOTIFICATION_SOUND: string 738 739 /** 740 * Indicates the storage area of the system default ringtone. 741 * 742 * <p>You can obtain the URI of the system default ringtone. 743 * 744 * @constant 745 * @syscap SystemCapability.Applications.Settings.Core 746 * @since 7 747 */ 748 const DEFAULT_RINGTONE: string 749 750 /** 751 * Specifies whether the sound effects are enabled. 752 * 753 * <p>If the value is {@code 0}, the sound effects are disabled. If the value is {@code 1}, the sound effects 754 * are enabled. 755 * 756 * @constant 757 * @syscap SystemCapability.Applications.Settings.Core 758 * @since 7 759 */ 760 const SOUND_EFFECTS_STATUS: string 761 762 /** 763 * Specifies whether the device vibrates for an event. This parameter is used inside the system. 764 * 765 * <p>If the value is {@code 1}, the device vibrates for an event. If the value is {@code 0}, the device does 766 * not vibrate for an event. 767 * 768 * @constant 769 * @syscap SystemCapability.Applications.Settings.Core 770 * @since 7 771 */ 772 const VIBRATE_STATUS: string 773 774 /** 775 * Indicates whether the device enables haptic feedback. 776 * 777 * <p>The value is of the boolean type. 778 * 779 * @constant 780 * @syscap SystemCapability.Applications.Settings.Core 781 * @since 7 782 */ 783 const HAPTIC_FEEDBACK_STATUS: string 784 } 785 786 /** 787 * Provides methods for setting information about text-to-speech (TTS) conversion, including the pitch, speech rate, 788 * engine, and plug-ins. 789 * 790 * @namespace TTS 791 * @syscap SystemCapability.Applications.Settings.Core 792 * @since 7 793 */ 794 namespace TTS { 795 /** 796 * Indicates the default pitch of the text-to-speech (TTS) engine. 797 * 798 * <p>100 = 1x. If the value is set to {@code 200}, the frequency is twice the normal sound frequency. 799 * 800 * @constant 801 * @syscap SystemCapability.Applications.Settings.Core 802 * @since 7 803 */ 804 const DEFAULT_TTS_PITCH: string 805 806 /** 807 * Indicates the default speech rate of the TTS engine. 100 = 1x. 808 * 809 * @constant 810 * @syscap SystemCapability.Applications.Settings.Core 811 * @since 7 812 */ 813 const DEFAULT_TTS_RATE: string 814 815 /** 816 * Indicates the default TTS engine. 817 * 818 * @constant 819 * @syscap SystemCapability.Applications.Settings.Core 820 * @since 7 821 */ 822 const DEFAULT_TTS_SYNTH: string 823 824 /** 825 * Indicates the list of activated plug-in packages used for TTS. Multiple plug-in packages are separated by 826 * spaces. 827 * 828 * @constant 829 * @syscap SystemCapability.Applications.Settings.Core 830 * @since 7 831 */ 832 const ENABLED_TTS_PLUGINS: string 833 } 834 835 /** 836 * Provides methods for setting radio network information, including information about Bluetooth, Wi-Fi, Near Field 837 * Communication (NFC), and the airplane mode. 838 * 839 * @namespace wireless 840 * @syscap SystemCapability.Applications.Settings.Core 841 * @since 7 842 */ 843 namespace wireless { 844 /** 845 * Specifies whether the device can be discovered or connected by other devices through Bluetooth. 846 * 847 * If the value is {@code 0}, the device cannot be connected or discovered. If the value is {@code 1}, the 848 * device can be connected but cannot be discovered. If the value is {@code 2}, the device can be connected 849 * and discovered. 850 * 851 * @constant 852 * @syscap SystemCapability.Applications.Settings.Core 853 * @since 7 854 */ 855 const BLUETOOTH_DISCOVER_ABILITY_STATUS: string 856 857 /** 858 * Indicates the duration (in seconds) that the device can be discovered through Bluetooth. 859 * 860 * <p>After the duration expires, the device cannot be discovered through Bluetooth. 861 * 862 * @constant 863 * @syscap SystemCapability.Applications.Settings.Core 864 * @since 7 865 */ 866 const BLUETOOTH_DISCOVER_TIMEOUT: string 867 868 /** 869 * Indicates the list of radio signals to be disabled when airplane mode is enabled. Multiple radio 870 * signals are separated by commas (,). 871 * 872 * <ul> 873 * <li>{@code BLUETOOTH_RADIO} - Bluetooth is disabled in airplane mode. 874 * <li>{@code CELL_RADIO} - Cellular radio is disabled in airplane mode. 875 * <li>{@code NFC_RADIO} - NFC is disabled in airplane mode. 876 * <li>{@code WIFI_RADIO} - Wi-Fi is disabled in airplane mode. 877 * </ul> 878 * 879 * @constant 880 * @syscap SystemCapability.Applications.Settings.Core 881 * @since 7 882 */ 883 const AIRPLANE_MODE_RADIOS: string 884 885 /** 886 * Specifies whether Bluetooth is enabled. 887 * 888 * <p>If the value is {@code true}, Bluetooth is enabled. If the value is {@code false}, Bluetooth is disabled. 889 * 890 * @constant 891 * @syscap SystemCapability.Applications.Settings.Core 892 * @since 7 893 */ 894 const BLUETOOTH_STATUS: string 895 896 /** 897 * A constant of {@code AIRPLANE_MODE_RADIOS} to indicate that Bluetooth is disabled in airplane mode. 898 * 899 * @constant 900 * @syscap SystemCapability.Applications.Settings.Core 901 * @since 7 902 */ 903 const BLUETOOTH_RADIO: string 904 905 /** 906 * A constant of {@code AIRPLANE_MODE_RADIOS} to indicate that cellular radio is disabled in airplane mode. 907 * 908 * @constant 909 * @syscap SystemCapability.Applications.Settings.Core 910 * @since 7 911 */ 912 const CELL_RADIO: string 913 914 /** 915 * A constant of {@code AIRPLANE_MODE_RADIOS} to indicate that NFC is disabled in airplane mode. 916 * 917 * @constant 918 * @syscap SystemCapability.Applications.Settings.Core 919 * @since 7 920 */ 921 const NFC_RADIO: string 922 923 /** 924 * A constant of {@code AIRPLANE_MODE_RADIOS} to indicate that Wi-Fi is disabled in airplane mode. 925 * 926 * @constant 927 * @syscap SystemCapability.Applications.Settings.Core 928 * @since 7 929 */ 930 const WIFI_RADIO: string 931 932 /** 933 * Specifies whether the Wi-Fi configuration created by the application of the device owner should be 934 * locked down. 935 * 936 * <p>If the value is {@code true}, the Wi-Fi configuration should be locked down. 937 * If the value is {@code false}, the Wi-Fi configuration should not be locked down. 938 * 939 * @constant 940 * @syscap SystemCapability.Applications.Settings.Core 941 * @since 7 942 */ 943 const OWNER_LOCKDOWN_WIFI_CFG: string 944 945 /** 946 * Indicates the maximum number of attempts to obtain an IP address from the DHCP server. 947 * 948 * @constant 949 * @syscap SystemCapability.Applications.Settings.Core 950 * @since 7 951 */ 952 const WIFI_DHCP_MAX_RETRY_COUNT: string 953 954 /** 955 * Indicates the maximum duration to hold a wake lock when waiting for the mobile data connection to 956 * establish after the Wi-Fi connection is disconnected. 957 * 958 * @constant 959 * @syscap SystemCapability.Applications.Settings.Core 960 * @since 7 961 */ 962 const WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT: string 963 964 /** 965 * Specifies whether Wi-Fi is enabled. 966 * 967 * <p>If the value is {@code true}, Wi-Fi is enabled. If the value is {@code false}, Wi-Fi is disabled. 968 * 969 * @constant 970 * @syscap SystemCapability.Applications.Settings.Core 971 * @since 7 972 */ 973 const WIFI_STATUS: string 974 975 /** 976 * Specifies whether Wi-Fi watchdog is enabled. 977 * 978 * <p>If the value is {@code true}, Wi-Fi watchdog is enabled. 979 * If the value is {@code false}, Wi-Fi watchdog is disabled. 980 * 981 * @constant 982 * @syscap SystemCapability.Applications.Settings.Core 983 * @since 7 984 */ 985 const WIFI_WATCHDOG_STATUS: string 986 } 987 988 /** 989 * Constructs a URI for a specific name-value pair for monitoring data of the ability that uses the Data 990 * template. 991 * 992 * @param { string } name - Indicates the name of the setting to set. 993 * @param { AsyncCallback<object> } [callback] - The callback of getURI result. 994 * @syscap SystemCapability.Applications.Settings.Core 995 * @since 7 996 * @deprecated since 9 997 */ 998 function getURI(name: string, callback: AsyncCallback<object>): void; 999 1000 /** 1001 * Constructs a URI for a specific name-value pair for monitoring data of the ability that uses the Data 1002 * template. 1003 * 1004 * @param { string } name - Indicates the name of the setting to set. 1005 * @returns { Promise<object> } Returns the corresponding URI; returns {@code null} if the URI does not exist. 1006 * @syscap SystemCapability.Applications.Settings.Core 1007 * @since 7 1008 * @deprecated since 9 1009 */ 1010 function getURI(name: string): Promise<object>; 1011 1012 /** 1013 * Obtains the value of a specified character string in the database. 1014 * 1015 * @param { DataAbilityHelper } dataAbilityHelper - Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used 1016 * to access the database. 1017 * @param { string } name - Indicates the name of the character string. 1018 * @param { AsyncCallback<object> } [callback] - The callback of getValue result. 1019 * @syscap SystemCapability.Applications.Settings.Core 1020 * @famodelonly 1021 * @since 7 1022 * @deprecated since 9 1023 * @useinstead ohos.settings#getValue 1024 */ 1025 function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback<object>): void; 1026 1027 /** 1028 * Obtains the value of a specified character string in the database. 1029 * 1030 * @param { DataAbilityHelper } dataAbilityHelper - Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used 1031 * to access the database. 1032 * @param { string } name - Indicates the name of the character string. 1033 * @returns { Promise<object> } Returns the value of the character string in the domain if any is found; returns {@code 1034 * null} otherwise. 1035 * @syscap SystemCapability.Applications.Settings.Core 1036 * @famodelonly 1037 * @since 7 1038 * @deprecated since 9 1039 * @useinstead ohos.settings#getValue 1040 */ 1041 function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise<object>; 1042 1043 /** 1044 * Get value from settingsdata 1045 * 1046 * @param { Context } context - Indicates the Context or dataAbilityHelper used to access 1047 * the database. 1048 * @param { string } name - Indicates the name of the character string. 1049 * @param { AsyncCallback<string> } [callback] - The callback of getValue result. 1050 * @syscap SystemCapability.Applications.Settings.Core 1051 * @StageModelOnly 1052 * @since 10 1053 */ 1054 function getValue(context: Context, name: string, callback: AsyncCallback<string>): void; 1055 1056 /** 1057 * Get value from settingsdata 1058 * @param { Context } context - Indicates the Context or dataAbilityHelper used to access 1059 * the database. 1060 * @param { string } name - Indicates the name of the character string. 1061 * @returns { Promise<string> } Returns the value of the character string in the domain if any is found; returns {@code 1062 * null} otherwise. 1063 * @syscap SystemCapability.Applications.Settings.Core 1064 * @StageModelOnly 1065 * @since 10 1066 */ 1067 function getValue(context: Context, name: string): Promise<string>; 1068 1069 /** 1070 * Get value from settingsdata 1071 * 1072 * @param { Context } context - Indicates the Context used to access the database. 1073 * @param { string } name - Indicates the name of the character string. 1074 * @param { string } domainName - Indicates the name of the domain name to set. 1075 * @returns { Promise<string> } Returns the value of the character string in the domain if any is found; returns {@code 1076 * null} otherwise. 1077 * @syscap SystemCapability.Applications.Settings.Core 1078 * @StageModelOnly 1079 * @since 11 1080 */ 1081 function getValue(context: Context, name: string, domainName: string): Promise<string>; 1082 1083 /** 1084 * Saves a character string name and its value to the database. 1085 * 1086 * @param { DataAbilityHelper } dataAbilityHelper - Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used 1087 * to access the database. 1088 * @param { string } name - Indicates the name of the character string. 1089 * @param { object } value - Indicates the value of the character string. 1090 * @param { AsyncCallback<boolean> } [callback] - The callback of setValue result. 1091 * @syscap SystemCapability.Applications.Settings.Core 1092 * @systemapi Hide this for inner system use. 1093 * @famodelonly 1094 * @since 7 1095 * @deprecated since 9 1096 * @useinstead ohos.settings#setValue 1097 */ 1098 function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback<boolean>): void; 1099 1100 /** 1101 * Saves a character string name and its value to the database. 1102 * 1103 * @param { DataAbilityHelper } dataAbilityHelper - Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used 1104 * to access the database. 1105 * @param { string } name - Indicates the name of the character string. 1106 * @param { object } value - Indicates the value of the character string. 1107 * @returns { Promise<boolean> } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1108 * @syscap SystemCapability.Applications.Settings.Core 1109 * @systemapi Hide this for inner system use. 1110 * @famodelonly 1111 * @since 7 1112 * @deprecated since 9 1113 * @useinstead ohos.settings#setValue 1114 */ 1115 function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise<boolean>; 1116 1117 /** 1118 * Set settingsdata value. 1119 * 1120 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 1121 * @param { Context } context - Indicates Context or dataAbilityHelper instance. 1122 * @param { string } name - Indicates the name of the character string. 1123 * @param { string } value - Indicates the value of the character string. 1124 * @param { AsyncCallback<boolean> } [callback] - The callback of setValue result. 1125 * @syscap SystemCapability.Applications.Settings.Core 1126 * @StageModelOnly 1127 * @since 10 1128 */ 1129 function setValue(context: Context, name: string, value: string, callback: AsyncCallback<boolean>): void; 1130 1131 /** 1132 * Set settingsdata value. 1133 * 1134 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 1135 * @param { Context } context - Indicates Context or dataAbilityHelper instance. 1136 * @param { string } name - Indicates the name of the character string. 1137 * @param { string } value - Indicates the value of the character string. 1138 * @returns { Promise<boolean> } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1139 * @syscap SystemCapability.Applications.Settings.Core 1140 * @StageModelOnly 1141 * @since 10 1142 */ 1143 function setValue(context: Context, name: string, value: string): Promise<boolean>; 1144 1145 /** 1146 * Set settingsdata value. 1147 * 1148 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 1149 * @param { Context } context - Indicates Context instance. 1150 * @param { string } name - Indicates the name of the character string. 1151 * @param { string } value - Indicates the value of the character string. 1152 * @param { string } domainName - Indicates the name of the domain name to set. 1153 * @returns { Promise<boolean> } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1154 * @throws { BusinessError } 201 - Permission denied. 1155 * @syscap SystemCapability.Applications.Settings.Core 1156 * @StageModelOnly 1157 * @since 11 1158 */ 1159 function setValue(context: Context, name: string, value: string, domainName: string): Promise<boolean>; 1160 1161 /** 1162 * Enables or disables airplane mode. 1163 * 1164 * @param { boolean } enable - Specifies whether to enable airplane mode. The value {@code true} means to enable 1165 * airplane mode, and {@code false} means to disable airplane mode. 1166 * @param { AsyncCallback<void> } [callback] - The callback of enableAirplaneMode result. 1167 * @syscap SystemCapability.Applications.Settings.Core 1168 * @since 7 1169 */ 1170 function enableAirplaneMode(enable: boolean, callback: AsyncCallback<void>): void; 1171 1172 /** 1173 * Enables or disables airplane mode. 1174 * 1175 * @param { boolean } enable - Specifies whether to enable airplane mode. The value {@code true} means to enable 1176 * airplane mode, and {@code false} means to disable airplane mode. 1177 * @returns { Promise<void> } - Return Promise. 1178 * @syscap SystemCapability.Applications.Settings.Core 1179 * @since 7 1180 */ 1181 function enableAirplaneMode(enable: boolean): Promise<void>; 1182 1183 /** 1184 * Checks whether a specified application can show as a floating window. 1185 * 1186 * @param { AsyncCallback<boolean> } [callback] - The callback of canShowFloating result. 1187 * @syscap SystemCapability.Applications.Settings.Core 1188 * @since 7 1189 */ 1190 function canShowFloating(callback: AsyncCallback<boolean>): void; 1191 1192 /** 1193 * Checks whether a specified application can show as a floating window. 1194 * 1195 * @returns { Promise<boolean> } Returns {@code true} if the application can draw over other applications; returns 1196 * {@code false} otherwise. 1197 * @syscap SystemCapability.Applications.Settings.Core 1198 * @since 7 1199 */ 1200 function canShowFloating(): Promise<boolean>; 1201 1202 /** 1203 * Get settingsdata uri (synchronous method) 1204 * 1205 * @param { string } name - Indicates the name of the setting to set. 1206 * @returns { string } Returns settingsdata uri. 1207 * @syscap SystemCapability.Applications.Settings.Core 1208 * @since 8 1209 */ 1210 function getUriSync(name: string): string; 1211 1212 /** 1213 * Get value from settingsdata(synchronous method) 1214 * 1215 * @param { DataAbilityHelper } dataAbilityHelper - Indicates dataAbilityHelper instance. 1216 * @param { string } name - Indicates the name of the character string. 1217 * @param { string } defValue - Indicates the default value of the character string. 1218 * @returns { string } Returns settingsdata value. 1219 * @syscap SystemCapability.Applications.Settings.Core 1220 * @famodelonly 1221 * @since 8 1222 * @deprecated since 9 1223 * @useinstead ohos.settings#getValueSync 1224 */ 1225 function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string; 1226 1227 /** 1228 * Get value from settingsdata(synchronous method) 1229 * 1230 * @param { Context } context - Indicates Context or dataAbilityHelper instance 1231 * @param { string } name - Indicates the name of the character string. 1232 * @param { string } defValue - Indicates the default value of the character string. 1233 * @returns { string } Returns settingsdata value. 1234 * @syscap SystemCapability.Applications.Settings.Core 1235 * @StageModelOnly 1236 * @since 10 1237 */ 1238 function getValueSync(context: Context, name: string, defValue: string): string; 1239 1240 /** 1241 * Get value from settingsdata(synchronous method) 1242 * 1243 * @param { Context } context - Indicates Context instance 1244 * @param { string } name - Indicates the name of the character string. 1245 * @param { string } defValue - Indicates the default value of the character string. 1246 * @param { string } domainName - Indicates the name of the domain name to set. 1247 * @returns { string } Returns settingsdata value. 1248 * @syscap SystemCapability.Applications.Settings.Core 1249 * @StageModelOnly 1250 * @since 11 1251 */ 1252 function getValueSync(context: Context, name: string, defValue: string, domainName: string): string; 1253 1254 /** 1255 * Set settingsdata value(synchronous method) 1256 * 1257 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 1258 * @param { DataAbilityHelper } dataAbilityHelper Indicates dataAbilityHelper instance. 1259 * @param { string } name Indicates the name of the character string. 1260 * @param { string } value Indicates the value of the character string. 1261 * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1262 * @syscap SystemCapability.Applications.Settings.Core 1263 * @famodelonly 1264 * @since 8 1265 * @deprecated since 9 1266 * @useinstead ohos.settings#setValueSync 1267 */ 1268 function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean; 1269 1270 /** 1271 * Set settingsdata value(synchronous method) 1272 * 1273 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 1274 * @param { Context } context - Indicates Context or dataAbilityHelper instance. 1275 * @param { string } name - Indicates the name of the character string. 1276 * @param { string } value - Indicates the value of the character string. 1277 * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1278 * @syscap SystemCapability.Applications.Settings.Core 1279 * @StageModelOnly 1280 * @since 10 1281 */ 1282 function setValueSync(context: Context, name: string, value: string): boolean; 1283 1284 /** 1285 * Set settingsdata value(synchronous method) 1286 * 1287 * @permission ohos.permission.MANAGE_SECURE_SETTINGS 1288 * @param { Context } context - Indicates Context instance. 1289 * @param { string } name - Indicates the name of the character string. 1290 * @param { string } value - Indicates the value of the character string. 1291 * @param { string } domainName - Indicates the name of the domain name to set. 1292 * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1293 * @throws { BusinessError } 201 - Permission denied. 1294 * @syscap SystemCapability.Applications.Settings.Core 1295 * @StageModelOnly 1296 * @since 11 1297 */ 1298 function setValueSync(context: Context, name: string, value: string, domainName: string): boolean; 1299 1300 /** 1301 * Monitor registration key(synchronous method) 1302 * 1303 * @param { Context } context - Indicates Context instance. 1304 * @param { string } name - Indicates the name of the character string. 1305 * @param { string } domainName - Indicates the name of the domain name to set. 1306 * @param { AsyncCallback<void> } observer - callback when monitored key value is changed. 1307 * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1308 * @syscap SystemCapability.Applications.Settings.Core 1309 * @StageModelOnly 1310 * @since 11 1311 */ 1312 function registerKeyObserver(context: Context, name: string, domainName: string, observer: AsyncCallback<void>): boolean; 1313 1314 /** 1315 * Monitor unregister key(synchronous method) 1316 * 1317 * @param { Context } context - Indicates Context instance. 1318 * @param { string } name - Indicates the name of the character string. 1319 * @param { string } domainName - Indicates the name of the domain name to set. 1320 * @returns { boolean } Returns {@code true} if the operation is successful; returns {@code false} otherwise. 1321 * @syscap SystemCapability.Applications.Settings.Core 1322 * @StageModelOnly 1323 * @since 11 1324 */ 1325 function unregisterKeyObserver(context: Context, name: string, domainName: string): boolean; 1326} 1327 1328export default settings;