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