Settings.java revision 014de02dd2e050c36f7e0d4f57690bd5d023b4f2
1/* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.provider; 18 19import android.annotation.SdkConstant; 20import android.annotation.SdkConstant.SdkConstantType; 21import android.annotation.SystemApi; 22import android.app.SearchManager; 23import android.app.WallpaperManager; 24import android.content.ComponentName; 25import android.content.ContentResolver; 26import android.content.ContentValues; 27import android.content.Context; 28import android.content.IContentProvider; 29import android.content.Intent; 30import android.content.pm.ActivityInfo; 31import android.content.pm.PackageManager; 32import android.content.pm.ResolveInfo; 33import android.content.res.Configuration; 34import android.content.res.Resources; 35import android.database.Cursor; 36import android.database.SQLException; 37import android.location.LocationManager; 38import android.net.ConnectivityManager; 39import android.net.Uri; 40import android.net.wifi.WifiManager; 41import android.os.BatteryManager; 42import android.os.Bundle; 43import android.os.DropBoxManager; 44import android.os.IBinder; 45import android.os.Process; 46import android.os.RemoteException; 47import android.os.ServiceManager; 48import android.os.SystemProperties; 49import android.os.UserHandle; 50import android.os.Build.VERSION_CODES; 51import android.speech.tts.TextToSpeech; 52import android.text.TextUtils; 53import android.util.AndroidException; 54import android.util.ArrayMap; 55import android.util.ArraySet; 56import android.util.Log; 57 58import com.android.internal.util.ArrayUtils; 59import com.android.internal.widget.ILockSettings; 60 61import java.net.URISyntaxException; 62import java.text.SimpleDateFormat; 63import java.util.HashMap; 64import java.util.HashSet; 65import java.util.Locale; 66import java.util.Map; 67import java.util.Set; 68 69/** 70 * The Settings provider contains global system-level device preferences. 71 */ 72public final class Settings { 73 74 // Intent actions for Settings 75 76 /** 77 * Activity Action: Show system settings. 78 * <p> 79 * Input: Nothing. 80 * <p> 81 * Output: Nothing. 82 */ 83 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 84 public static final String ACTION_SETTINGS = "android.settings.SETTINGS"; 85 86 /** 87 * Activity Action: Show settings to allow configuration of APNs. 88 * <p> 89 * Input: Nothing. 90 * <p> 91 * Output: Nothing. 92 */ 93 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 94 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS"; 95 96 /** 97 * Activity Action: Show settings to allow configuration of current location 98 * sources. 99 * <p> 100 * In some cases, a matching Activity may not exist, so ensure you 101 * safeguard against this. 102 * <p> 103 * Input: Nothing. 104 * <p> 105 * Output: Nothing. 106 */ 107 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 108 public static final String ACTION_LOCATION_SOURCE_SETTINGS = 109 "android.settings.LOCATION_SOURCE_SETTINGS"; 110 111 /** 112 * Activity Action: Show settings to allow configuration of wireless controls 113 * such as Wi-Fi, Bluetooth and Mobile networks. 114 * <p> 115 * In some cases, a matching Activity may not exist, so ensure you 116 * safeguard against this. 117 * <p> 118 * Input: Nothing. 119 * <p> 120 * Output: Nothing. 121 */ 122 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 123 public static final String ACTION_WIRELESS_SETTINGS = 124 "android.settings.WIRELESS_SETTINGS"; 125 126 /** 127 * Activity Action: Show settings to allow entering/exiting airplane mode. 128 * <p> 129 * In some cases, a matching Activity may not exist, so ensure you 130 * safeguard against this. 131 * <p> 132 * Input: Nothing. 133 * <p> 134 * Output: Nothing. 135 */ 136 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 137 public static final String ACTION_AIRPLANE_MODE_SETTINGS = 138 "android.settings.AIRPLANE_MODE_SETTINGS"; 139 140 /** 141 * Activity Action: Modify Airplane mode settings using a voice command. 142 * <p> 143 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 144 * <p> 145 * This intent MUST be started using 146 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 147 * startVoiceActivity}. 148 * <p> 149 * Note: The activity implementing this intent MUST verify that 150 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before 151 * modifying the setting. 152 * <p> 153 * Input: To tell which state airplane mode should be set to, add the 154 * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified. 155 * If the extra is not included, no changes will be made. 156 * <p> 157 * Output: Nothing. 158 */ 159 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 160 public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE = 161 "android.settings.VOICE_CONTROL_AIRPLANE_MODE"; 162 163 /** 164 * Activity Action: Show settings for accessibility modules. 165 * <p> 166 * In some cases, a matching Activity may not exist, so ensure you 167 * safeguard against this. 168 * <p> 169 * Input: Nothing. 170 * <p> 171 * Output: Nothing. 172 */ 173 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 174 public static final String ACTION_ACCESSIBILITY_SETTINGS = 175 "android.settings.ACCESSIBILITY_SETTINGS"; 176 177 /** 178 * Activity Action: Show settings to control access to usage information. 179 * <p> 180 * In some cases, a matching Activity may not exist, so ensure you 181 * safeguard against this. 182 * <p> 183 * Input: Nothing. 184 * <p> 185 * Output: Nothing. 186 */ 187 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 188 public static final String ACTION_USAGE_ACCESS_SETTINGS = 189 "android.settings.USAGE_ACCESS_SETTINGS"; 190 191 /** 192 * Activity Action: Show settings to allow configuration of security and 193 * location privacy. 194 * <p> 195 * In some cases, a matching Activity may not exist, so ensure you 196 * safeguard against this. 197 * <p> 198 * Input: Nothing. 199 * <p> 200 * Output: Nothing. 201 */ 202 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 203 public static final String ACTION_SECURITY_SETTINGS = 204 "android.settings.SECURITY_SETTINGS"; 205 206 /** 207 * Activity Action: Show trusted credentials settings, opening to the user tab, 208 * to allow management of installed credentials. 209 * <p> 210 * In some cases, a matching Activity may not exist, so ensure you 211 * safeguard against this. 212 * <p> 213 * Input: Nothing. 214 * <p> 215 * Output: Nothing. 216 * @hide 217 */ 218 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 219 public static final String ACTION_TRUSTED_CREDENTIALS_USER = 220 "com.android.settings.TRUSTED_CREDENTIALS_USER"; 221 222 /** 223 * Activity Action: Show dialog explaining that an installed CA cert may enable 224 * monitoring of encrypted network traffic. 225 * <p> 226 * In some cases, a matching Activity may not exist, so ensure you 227 * safeguard against this. 228 * <p> 229 * Input: Nothing. 230 * <p> 231 * Output: Nothing. 232 * @hide 233 */ 234 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 235 public static final String ACTION_MONITORING_CERT_INFO = 236 "com.android.settings.MONITORING_CERT_INFO"; 237 238 /** 239 * Activity Action: Show settings to allow configuration of privacy options. 240 * <p> 241 * In some cases, a matching Activity may not exist, so ensure you 242 * safeguard against this. 243 * <p> 244 * Input: Nothing. 245 * <p> 246 * Output: Nothing. 247 */ 248 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 249 public static final String ACTION_PRIVACY_SETTINGS = 250 "android.settings.PRIVACY_SETTINGS"; 251 252 /** 253 * Activity Action: Show settings to allow configuration of Wi-Fi. 254 * <p> 255 * In some cases, a matching Activity may not exist, so ensure you 256 * safeguard against this. 257 * <p> 258 * Input: Nothing. 259 * <p> 260 * Output: Nothing. 261 262 */ 263 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 264 public static final String ACTION_WIFI_SETTINGS = 265 "android.settings.WIFI_SETTINGS"; 266 267 /** 268 * Activity Action: Show settings to allow configuration of a static IP 269 * address for Wi-Fi. 270 * <p> 271 * In some cases, a matching Activity may not exist, so ensure you safeguard 272 * against this. 273 * <p> 274 * Input: Nothing. 275 * <p> 276 * Output: Nothing. 277 */ 278 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 279 public static final String ACTION_WIFI_IP_SETTINGS = 280 "android.settings.WIFI_IP_SETTINGS"; 281 282 /** 283 * Activity Action: Show settings to allow configuration of Bluetooth. 284 * <p> 285 * In some cases, a matching Activity may not exist, so ensure you 286 * safeguard against this. 287 * <p> 288 * Input: Nothing. 289 * <p> 290 * Output: Nothing. 291 */ 292 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 293 public static final String ACTION_BLUETOOTH_SETTINGS = 294 "android.settings.BLUETOOTH_SETTINGS"; 295 296 /** 297 * Activity Action: Show settings to allow configuration of Wifi Displays. 298 * <p> 299 * In some cases, a matching Activity may not exist, so ensure you 300 * safeguard against this. 301 * <p> 302 * Input: Nothing. 303 * <p> 304 * Output: Nothing. 305 * @hide 306 */ 307 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 308 public static final String ACTION_WIFI_DISPLAY_SETTINGS = 309 "android.settings.WIFI_DISPLAY_SETTINGS"; 310 311 /** 312 * Activity Action: Show settings to allow configuration of 313 * {@link android.media.routing.MediaRouteService media route providers}. 314 * <p> 315 * In some cases, a matching Activity may not exist, so ensure you 316 * safeguard against this. 317 * <p> 318 * Input: Nothing. 319 * <p> 320 * Output: Nothing. 321 */ 322 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 323 public static final String ACTION_CAST_SETTINGS = 324 "android.settings.CAST_SETTINGS"; 325 326 /** 327 * Activity Action: Show settings to allow configuration of date and time. 328 * <p> 329 * In some cases, a matching Activity may not exist, so ensure you 330 * safeguard against this. 331 * <p> 332 * Input: Nothing. 333 * <p> 334 * Output: Nothing. 335 */ 336 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 337 public static final String ACTION_DATE_SETTINGS = 338 "android.settings.DATE_SETTINGS"; 339 340 /** 341 * Activity Action: Show settings to allow configuration of sound and volume. 342 * <p> 343 * In some cases, a matching Activity may not exist, so ensure you 344 * safeguard against this. 345 * <p> 346 * Input: Nothing. 347 * <p> 348 * Output: Nothing. 349 */ 350 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 351 public static final String ACTION_SOUND_SETTINGS = 352 "android.settings.SOUND_SETTINGS"; 353 354 /** 355 * Activity Action: Show settings to allow configuration of display. 356 * <p> 357 * In some cases, a matching Activity may not exist, so ensure you 358 * safeguard against this. 359 * <p> 360 * Input: Nothing. 361 * <p> 362 * Output: Nothing. 363 */ 364 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 365 public static final String ACTION_DISPLAY_SETTINGS = 366 "android.settings.DISPLAY_SETTINGS"; 367 368 /** 369 * Activity Action: Show settings to allow configuration of locale. 370 * <p> 371 * In some cases, a matching Activity may not exist, so ensure you 372 * safeguard against this. 373 * <p> 374 * Input: Nothing. 375 * <p> 376 * Output: Nothing. 377 */ 378 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 379 public static final String ACTION_LOCALE_SETTINGS = 380 "android.settings.LOCALE_SETTINGS"; 381 382 /** 383 * Activity Action: Show settings to configure input methods, in particular 384 * allowing the user to enable input methods. 385 * <p> 386 * In some cases, a matching Activity may not exist, so ensure you 387 * safeguard against this. 388 * <p> 389 * Input: Nothing. 390 * <p> 391 * Output: Nothing. 392 */ 393 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 394 public static final String ACTION_VOICE_INPUT_SETTINGS = 395 "android.settings.VOICE_INPUT_SETTINGS"; 396 397 /** 398 * Activity Action: Show settings to configure input methods, in particular 399 * allowing the user to enable input methods. 400 * <p> 401 * In some cases, a matching Activity may not exist, so ensure you 402 * safeguard against this. 403 * <p> 404 * Input: Nothing. 405 * <p> 406 * Output: Nothing. 407 */ 408 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 409 public static final String ACTION_INPUT_METHOD_SETTINGS = 410 "android.settings.INPUT_METHOD_SETTINGS"; 411 412 /** 413 * Activity Action: Show settings to enable/disable input method subtypes. 414 * <p> 415 * In some cases, a matching Activity may not exist, so ensure you 416 * safeguard against this. 417 * <p> 418 * To tell which input method's subtypes are displayed in the settings, add 419 * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id. 420 * If there is no extra in this Intent, subtypes from all installed input methods 421 * will be displayed in the settings. 422 * 423 * @see android.view.inputmethod.InputMethodInfo#getId 424 * <p> 425 * Input: Nothing. 426 * <p> 427 * Output: Nothing. 428 */ 429 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 430 public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = 431 "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"; 432 433 /** 434 * Activity Action: Show a dialog to select input method. 435 * <p> 436 * In some cases, a matching Activity may not exist, so ensure you 437 * safeguard against this. 438 * <p> 439 * Input: Nothing. 440 * <p> 441 * Output: Nothing. 442 * @hide 443 */ 444 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 445 public static final String ACTION_SHOW_INPUT_METHOD_PICKER = 446 "android.settings.SHOW_INPUT_METHOD_PICKER"; 447 448 /** 449 * Activity Action: Show settings to manage the user input dictionary. 450 * <p> 451 * Starting with {@link android.os.Build.VERSION_CODES#KITKAT}, 452 * it is guaranteed there will always be an appropriate implementation for this Intent action. 453 * In prior releases of the platform this was optional, so ensure you safeguard against it. 454 * <p> 455 * Input: Nothing. 456 * <p> 457 * Output: Nothing. 458 */ 459 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 460 public static final String ACTION_USER_DICTIONARY_SETTINGS = 461 "android.settings.USER_DICTIONARY_SETTINGS"; 462 463 /** 464 * Activity Action: Adds a word to the user dictionary. 465 * <p> 466 * In some cases, a matching Activity may not exist, so ensure you 467 * safeguard against this. 468 * <p> 469 * Input: An extra with key <code>word</code> that contains the word 470 * that should be added to the dictionary. 471 * <p> 472 * Output: Nothing. 473 * 474 * @hide 475 */ 476 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 477 public static final String ACTION_USER_DICTIONARY_INSERT = 478 "com.android.settings.USER_DICTIONARY_INSERT"; 479 480 /** 481 * Activity Action: Show settings to allow configuration of application-related settings. 482 * <p> 483 * In some cases, a matching Activity may not exist, so ensure you 484 * safeguard against this. 485 * <p> 486 * Input: Nothing. 487 * <p> 488 * Output: Nothing. 489 */ 490 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 491 public static final String ACTION_APPLICATION_SETTINGS = 492 "android.settings.APPLICATION_SETTINGS"; 493 494 /** 495 * Activity Action: Show settings to allow configuration of application 496 * development-related settings. As of 497 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is 498 * a required part of the platform. 499 * <p> 500 * Input: Nothing. 501 * <p> 502 * Output: Nothing. 503 */ 504 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 505 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = 506 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"; 507 508 /** 509 * Activity Action: Show settings to allow configuration of quick launch shortcuts. 510 * <p> 511 * In some cases, a matching Activity may not exist, so ensure you 512 * safeguard against this. 513 * <p> 514 * Input: Nothing. 515 * <p> 516 * Output: Nothing. 517 */ 518 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 519 public static final String ACTION_QUICK_LAUNCH_SETTINGS = 520 "android.settings.QUICK_LAUNCH_SETTINGS"; 521 522 /** 523 * Activity Action: Show settings to manage installed applications. 524 * <p> 525 * In some cases, a matching Activity may not exist, so ensure you 526 * safeguard against this. 527 * <p> 528 * Input: Nothing. 529 * <p> 530 * Output: Nothing. 531 */ 532 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 533 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = 534 "android.settings.MANAGE_APPLICATIONS_SETTINGS"; 535 536 /** 537 * Activity Action: Show settings to manage all applications. 538 * <p> 539 * In some cases, a matching Activity may not exist, so ensure you 540 * safeguard against this. 541 * <p> 542 * Input: Nothing. 543 * <p> 544 * Output: Nothing. 545 */ 546 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 547 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = 548 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"; 549 550 /** 551 * Activity Action: Show screen of details about a particular application. 552 * <p> 553 * In some cases, a matching Activity may not exist, so ensure you 554 * safeguard against this. 555 * <p> 556 * Input: The Intent's data URI specifies the application package name 557 * to be shown, with the "package" scheme. That is "package:com.my.app". 558 * <p> 559 * Output: Nothing. 560 */ 561 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 562 public static final String ACTION_APPLICATION_DETAILS_SETTINGS = 563 "android.settings.APPLICATION_DETAILS_SETTINGS"; 564 565 /** 566 * @hide 567 * Activity Action: Show the "app ops" settings screen. 568 * <p> 569 * Input: Nothing. 570 * <p> 571 * Output: Nothing. 572 */ 573 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 574 public static final String ACTION_APP_OPS_SETTINGS = 575 "android.settings.APP_OPS_SETTINGS"; 576 577 /** 578 * Activity Action: Show settings for system update functionality. 579 * <p> 580 * In some cases, a matching Activity may not exist, so ensure you 581 * safeguard against this. 582 * <p> 583 * Input: Nothing. 584 * <p> 585 * Output: Nothing. 586 * 587 * @hide 588 */ 589 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 590 public static final String ACTION_SYSTEM_UPDATE_SETTINGS = 591 "android.settings.SYSTEM_UPDATE_SETTINGS"; 592 593 /** 594 * Activity Action: Show settings to allow configuration of sync settings. 595 * <p> 596 * In some cases, a matching Activity may not exist, so ensure you 597 * safeguard against this. 598 * <p> 599 * The account types available to add via the add account button may be restricted by adding an 600 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's 601 * authorities. Only account types which can sync with that content provider will be offered to 602 * the user. 603 * <p> 604 * Input: Nothing. 605 * <p> 606 * Output: Nothing. 607 */ 608 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 609 public static final String ACTION_SYNC_SETTINGS = 610 "android.settings.SYNC_SETTINGS"; 611 612 /** 613 * Activity Action: Show add account screen for creating a new account. 614 * <p> 615 * In some cases, a matching Activity may not exist, so ensure you 616 * safeguard against this. 617 * <p> 618 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES} 619 * extra to the Intent with one or more syncable content provider's authorities. Only account 620 * types which can sync with that content provider will be offered to the user. 621 * <p> 622 * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the 623 * Intent with one or more account types. 624 * <p> 625 * Input: Nothing. 626 * <p> 627 * Output: Nothing. 628 */ 629 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 630 public static final String ACTION_ADD_ACCOUNT = 631 "android.settings.ADD_ACCOUNT_SETTINGS"; 632 633 /** 634 * Activity Action: Show settings for selecting the network operator. 635 * <p> 636 * In some cases, a matching Activity may not exist, so ensure you 637 * safeguard against this. 638 * <p> 639 * Input: Nothing. 640 * <p> 641 * Output: Nothing. 642 */ 643 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 644 public static final String ACTION_NETWORK_OPERATOR_SETTINGS = 645 "android.settings.NETWORK_OPERATOR_SETTINGS"; 646 647 /** 648 * Activity Action: Show settings for selection of 2G/3G. 649 * <p> 650 * In some cases, a matching Activity may not exist, so ensure you 651 * safeguard against this. 652 * <p> 653 * Input: Nothing. 654 * <p> 655 * Output: Nothing. 656 */ 657 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 658 public static final String ACTION_DATA_ROAMING_SETTINGS = 659 "android.settings.DATA_ROAMING_SETTINGS"; 660 661 /** 662 * Activity Action: Show settings for internal storage. 663 * <p> 664 * In some cases, a matching Activity may not exist, so ensure you 665 * safeguard against this. 666 * <p> 667 * Input: Nothing. 668 * <p> 669 * Output: Nothing. 670 */ 671 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 672 public static final String ACTION_INTERNAL_STORAGE_SETTINGS = 673 "android.settings.INTERNAL_STORAGE_SETTINGS"; 674 /** 675 * Activity Action: Show settings for memory card storage. 676 * <p> 677 * In some cases, a matching Activity may not exist, so ensure you 678 * safeguard against this. 679 * <p> 680 * Input: Nothing. 681 * <p> 682 * Output: Nothing. 683 */ 684 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 685 public static final String ACTION_MEMORY_CARD_SETTINGS = 686 "android.settings.MEMORY_CARD_SETTINGS"; 687 688 /** 689 * Activity Action: Show settings for global search. 690 * <p> 691 * In some cases, a matching Activity may not exist, so ensure you 692 * safeguard against this. 693 * <p> 694 * Input: Nothing. 695 * <p> 696 * Output: Nothing 697 */ 698 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 699 public static final String ACTION_SEARCH_SETTINGS = 700 "android.search.action.SEARCH_SETTINGS"; 701 702 /** 703 * Activity Action: Show general device information settings (serial 704 * number, software version, phone number, etc.). 705 * <p> 706 * In some cases, a matching Activity may not exist, so ensure you 707 * safeguard against this. 708 * <p> 709 * Input: Nothing. 710 * <p> 711 * Output: Nothing 712 */ 713 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 714 public static final String ACTION_DEVICE_INFO_SETTINGS = 715 "android.settings.DEVICE_INFO_SETTINGS"; 716 717 /** 718 * Activity Action: Show NFC settings. 719 * <p> 720 * This shows UI that allows NFC to be turned on or off. 721 * <p> 722 * In some cases, a matching Activity may not exist, so ensure you 723 * safeguard against this. 724 * <p> 725 * Input: Nothing. 726 * <p> 727 * Output: Nothing 728 * @see android.nfc.NfcAdapter#isEnabled() 729 */ 730 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 731 public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS"; 732 733 /** 734 * Activity Action: Show NFC Sharing settings. 735 * <p> 736 * This shows UI that allows NDEF Push (Android Beam) to be turned on or 737 * off. 738 * <p> 739 * In some cases, a matching Activity may not exist, so ensure you 740 * safeguard against this. 741 * <p> 742 * Input: Nothing. 743 * <p> 744 * Output: Nothing 745 * @see android.nfc.NfcAdapter#isNdefPushEnabled() 746 */ 747 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 748 public static final String ACTION_NFCSHARING_SETTINGS = 749 "android.settings.NFCSHARING_SETTINGS"; 750 751 /** 752 * Activity Action: Show NFC Tap & Pay settings 753 * <p> 754 * This shows UI that allows the user to configure Tap&Pay 755 * settings. 756 * <p> 757 * In some cases, a matching Activity may not exist, so ensure you 758 * safeguard against this. 759 * <p> 760 * Input: Nothing. 761 * <p> 762 * Output: Nothing 763 */ 764 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 765 public static final String ACTION_NFC_PAYMENT_SETTINGS = 766 "android.settings.NFC_PAYMENT_SETTINGS"; 767 768 /** 769 * Activity Action: Show Daydream settings. 770 * <p> 771 * In some cases, a matching Activity may not exist, so ensure you 772 * safeguard against this. 773 * <p> 774 * Input: Nothing. 775 * <p> 776 * Output: Nothing. 777 * @see android.service.dreams.DreamService 778 */ 779 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 780 public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS"; 781 782 /** 783 * Activity Action: Show Notification listener settings. 784 * <p> 785 * In some cases, a matching Activity may not exist, so ensure you 786 * safeguard against this. 787 * <p> 788 * Input: Nothing. 789 * <p> 790 * Output: Nothing. 791 * @see android.service.notification.NotificationListenerService 792 */ 793 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 794 public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS 795 = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"; 796 797 /** 798 * @hide 799 */ 800 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 801 public static final String ACTION_CONDITION_PROVIDER_SETTINGS 802 = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS"; 803 804 /** 805 * Activity Action: Show settings for video captioning. 806 * <p> 807 * In some cases, a matching Activity may not exist, so ensure you safeguard 808 * against this. 809 * <p> 810 * Input: Nothing. 811 * <p> 812 * Output: Nothing. 813 */ 814 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 815 public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS"; 816 817 /** 818 * Activity Action: Show the top level print settings. 819 * <p> 820 * In some cases, a matching Activity may not exist, so ensure you 821 * safeguard against this. 822 * <p> 823 * Input: Nothing. 824 * <p> 825 * Output: Nothing. 826 */ 827 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 828 public static final String ACTION_PRINT_SETTINGS = 829 "android.settings.ACTION_PRINT_SETTINGS"; 830 831 /** 832 * Activity Action: Show Zen Mode configuration settings. 833 * 834 * @hide 835 */ 836 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 837 public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; 838 839 /** 840 * Activity Action: Show Zen Mode priority configuration settings. 841 * 842 * @hide 843 */ 844 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 845 public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS 846 = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"; 847 848 /** 849 * Activity Action: Show Zen Mode automation configuration settings. 850 * 851 * @hide 852 */ 853 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 854 public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS 855 = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS"; 856 857 /** 858 * Activity Action: Modify do not disturb mode settings. 859 * <p> 860 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 861 * <p> 862 * This intent MUST be started using 863 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 864 * startVoiceActivity}. 865 * <p> 866 * Note: The Activity implementing this intent MUST verify that 867 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}. 868 * returns true before modifying the setting. 869 * <p> 870 * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate 871 * how long the user wishes to avoid interruptions for. The optional 872 * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is 873 * enabling or disabling do not disturb mode. If either extra is not included, the 874 * user maybe asked to provide the value. 875 * <p> 876 * Output: Nothing. 877 */ 878 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 879 public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE = 880 "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE"; 881 882 /** 883 * Activity Action: Show Zen Mode schedule rule configuration settings. 884 * 885 * @hide 886 */ 887 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 888 public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS 889 = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS"; 890 891 /** 892 * Activity Action: Show Zen Mode external rule configuration settings. 893 * 894 * @hide 895 */ 896 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 897 public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS 898 = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS"; 899 900 /** 901 * Activity Action: Show the regulatory information screen for the device. 902 * <p> 903 * In some cases, a matching Activity may not exist, so ensure you safeguard 904 * against this. 905 * <p> 906 * Input: Nothing. 907 * <p> 908 * Output: Nothing. 909 */ 910 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 911 public static final String 912 ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO"; 913 914 /** 915 * Activity Action: Show Device Name Settings. 916 * <p> 917 * In some cases, a matching Activity may not exist, so ensure you safeguard 918 * against this. 919 * 920 * @hide 921 */ 922 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 923 public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME"; 924 925 /** 926 * Activity Action: Show pairing settings. 927 * <p> 928 * In some cases, a matching Activity may not exist, so ensure you safeguard 929 * against this. 930 * 931 * @hide 932 */ 933 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 934 public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS"; 935 936 /** 937 * Activity Action: Show battery saver settings. 938 * <p> 939 * In some cases, a matching Activity may not exist, so ensure you safeguard 940 * against this. 941 */ 942 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 943 public static final String ACTION_BATTERY_SAVER_SETTINGS 944 = "android.settings.BATTERY_SAVER_SETTINGS"; 945 946 /** 947 * Activity Action: Modify Battery Saver mode setting using a voice command. 948 * <p> 949 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 950 * <p> 951 * This intent MUST be started using 952 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 953 * startVoiceActivity}. 954 * <p> 955 * Note: The activity implementing this intent MUST verify that 956 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before 957 * modifying the setting. 958 * <p> 959 * Input: To tell which state batter saver mode should be set to, add the 960 * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified. 961 * If the extra is not included, no changes will be made. 962 * <p> 963 * Output: Nothing. 964 */ 965 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 966 public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE = 967 "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE"; 968 969 /** 970 * Activity Action: Show Home selection settings. If there are multiple activities 971 * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you 972 * to pick your preferred activity. 973 */ 974 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 975 public static final String ACTION_HOME_SETTINGS 976 = "android.settings.HOME_SETTINGS"; 977 978 /** 979 * Activity Action: Show notification settings. 980 * 981 * @hide 982 */ 983 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 984 public static final String ACTION_NOTIFICATION_SETTINGS 985 = "android.settings.NOTIFICATION_SETTINGS"; 986 987 /** 988 * Activity Action: Show notification settings for a single app. 989 * 990 * @hide 991 */ 992 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 993 public static final String ACTION_APP_NOTIFICATION_SETTINGS 994 = "android.settings.APP_NOTIFICATION_SETTINGS"; 995 996 /** 997 * Activity Action: Show notification redaction settings. 998 * 999 * @hide 1000 */ 1001 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1002 public static final String ACTION_APP_NOTIFICATION_REDACTION 1003 = "android.settings.ACTION_APP_NOTIFICATION_REDACTION"; 1004 1005 /** @hide */ public static final String EXTRA_APP_UID = "app_uid"; 1006 /** @hide */ public static final String EXTRA_APP_PACKAGE = "app_package"; 1007 1008 // End of Intent actions for Settings 1009 1010 /** 1011 * @hide - Private call() method on SettingsProvider to read from 'system' table. 1012 */ 1013 public static final String CALL_METHOD_GET_SYSTEM = "GET_system"; 1014 1015 /** 1016 * @hide - Private call() method on SettingsProvider to read from 'secure' table. 1017 */ 1018 public static final String CALL_METHOD_GET_SECURE = "GET_secure"; 1019 1020 /** 1021 * @hide - Private call() method on SettingsProvider to read from 'global' table. 1022 */ 1023 public static final String CALL_METHOD_GET_GLOBAL = "GET_global"; 1024 1025 /** 1026 * @hide - User handle argument extra to the fast-path call()-based requests 1027 */ 1028 public static final String CALL_METHOD_USER_KEY = "_user"; 1029 1030 /** @hide - Private call() method to write to 'system' table */ 1031 public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system"; 1032 1033 /** @hide - Private call() method to write to 'secure' table */ 1034 public static final String CALL_METHOD_PUT_SECURE = "PUT_secure"; 1035 1036 /** @hide - Private call() method to write to 'global' table */ 1037 public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global"; 1038 1039 /** 1040 * Activity Extra: Limit available options in launched activity based on the given authority. 1041 * <p> 1042 * This can be passed as an extra field in an Activity Intent with one or more syncable content 1043 * provider's authorities as a String[]. This field is used by some intents to alter the 1044 * behavior of the called activity. 1045 * <p> 1046 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based 1047 * on the authority given. 1048 */ 1049 public static final String EXTRA_AUTHORITIES = "authorities"; 1050 1051 /** 1052 * Activity Extra: Limit available options in launched activity based on the given account 1053 * types. 1054 * <p> 1055 * This can be passed as an extra field in an Activity Intent with one or more account types 1056 * as a String[]. This field is used by some intents to alter the behavior of the called 1057 * activity. 1058 * <p> 1059 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified 1060 * list. 1061 */ 1062 public static final String EXTRA_ACCOUNT_TYPES = "account_types"; 1063 1064 public static final String EXTRA_INPUT_METHOD_ID = "input_method_id"; 1065 1066 /** 1067 * Activity Extra: The device identifier to act upon. 1068 * <p> 1069 * This can be passed as an extra field in an Activity Intent with a single 1070 * InputDeviceIdentifier. This field is used by some activities to jump straight into the 1071 * settings for the given device. 1072 * <p> 1073 * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout 1074 * dialog for the given device. 1075 * @hide 1076 */ 1077 public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier"; 1078 1079 /** 1080 * Activity Extra: Enable or disable Airplane Mode. 1081 * <p> 1082 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE} 1083 * intent as a boolean to indicate if it should be enabled. 1084 */ 1085 public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled"; 1086 1087 /** 1088 * Activity Extra: Enable or disable Battery saver mode. 1089 * <p> 1090 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE} 1091 * intent as a boolean to indicate if it should be enabled. 1092 */ 1093 public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED = 1094 "android.settings.extra.battery_saver_mode_enabled"; 1095 1096 /** 1097 * Activity Extra: Enable or disable Do Not Disturb mode. 1098 * <p> 1099 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE} 1100 * intent as a boolean to indicate if it should be enabled. 1101 */ 1102 public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = 1103 "android.settings.extra.do_not_disturb_mode_enabled"; 1104 1105 /** 1106 * Activity Extra: How many minutes to enable do not disturb mode for. 1107 * <p> 1108 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE} 1109 * intent to indicate how long do not disturb mode should be enabled for. 1110 */ 1111 public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = 1112 "android.settings.extra.do_not_disturb_mode_minutes"; 1113 1114 private static final String JID_RESOURCE_PREFIX = "android"; 1115 1116 public static final String AUTHORITY = "settings"; 1117 1118 private static final String TAG = "Settings"; 1119 private static final boolean LOCAL_LOGV = false; 1120 1121 // Lock ensures that when enabling/disabling the master location switch, we don't end up 1122 // with a partial enable/disable state in multi-threaded situations. 1123 private static final Object mLocationSettingsLock = new Object(); 1124 1125 public static class SettingNotFoundException extends AndroidException { 1126 public SettingNotFoundException(String msg) { 1127 super(msg); 1128 } 1129 } 1130 1131 /** 1132 * Common base for tables of name/value settings. 1133 */ 1134 public static class NameValueTable implements BaseColumns { 1135 public static final String NAME = "name"; 1136 public static final String VALUE = "value"; 1137 1138 protected static boolean putString(ContentResolver resolver, Uri uri, 1139 String name, String value) { 1140 // The database will take care of replacing duplicates. 1141 try { 1142 ContentValues values = new ContentValues(); 1143 values.put(NAME, name); 1144 values.put(VALUE, value); 1145 resolver.insert(uri, values); 1146 return true; 1147 } catch (SQLException e) { 1148 Log.w(TAG, "Can't set key " + name + " in " + uri, e); 1149 return false; 1150 } 1151 } 1152 1153 public static Uri getUriFor(Uri uri, String name) { 1154 return Uri.withAppendedPath(uri, name); 1155 } 1156 } 1157 1158 // Thread-safe. 1159 private static class NameValueCache { 1160 private final String mVersionSystemProperty; 1161 private final Uri mUri; 1162 1163 private static final String[] SELECT_VALUE = 1164 new String[] { Settings.NameValueTable.VALUE }; 1165 private static final String NAME_EQ_PLACEHOLDER = "name=?"; 1166 1167 // Must synchronize on 'this' to access mValues and mValuesVersion. 1168 private final HashMap<String, String> mValues = new HashMap<String, String>(); 1169 private long mValuesVersion = 0; 1170 1171 // Initially null; set lazily and held forever. Synchronized on 'this'. 1172 private IContentProvider mContentProvider = null; 1173 1174 // The method we'll call (or null, to not use) on the provider 1175 // for the fast path of retrieving settings. 1176 private final String mCallGetCommand; 1177 private final String mCallSetCommand; 1178 1179 public NameValueCache(String versionSystemProperty, Uri uri, 1180 String getCommand, String setCommand) { 1181 mVersionSystemProperty = versionSystemProperty; 1182 mUri = uri; 1183 mCallGetCommand = getCommand; 1184 mCallSetCommand = setCommand; 1185 } 1186 1187 private IContentProvider lazyGetProvider(ContentResolver cr) { 1188 IContentProvider cp = null; 1189 synchronized (this) { 1190 cp = mContentProvider; 1191 if (cp == null) { 1192 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority()); 1193 } 1194 } 1195 return cp; 1196 } 1197 1198 public boolean putStringForUser(ContentResolver cr, String name, String value, 1199 final int userHandle) { 1200 try { 1201 Bundle arg = new Bundle(); 1202 arg.putString(Settings.NameValueTable.VALUE, value); 1203 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 1204 IContentProvider cp = lazyGetProvider(cr); 1205 cp.call(cr.getPackageName(), mCallSetCommand, name, arg); 1206 } catch (RemoteException e) { 1207 Log.w(TAG, "Can't set key " + name + " in " + mUri, e); 1208 return false; 1209 } 1210 return true; 1211 } 1212 1213 public String getStringForUser(ContentResolver cr, String name, final int userHandle) { 1214 final boolean isSelf = (userHandle == UserHandle.myUserId()); 1215 if (isSelf) { 1216 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0); 1217 1218 // Our own user's settings data uses a client-side cache 1219 synchronized (this) { 1220 if (mValuesVersion != newValuesVersion) { 1221 if (LOCAL_LOGV || false) { 1222 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " 1223 + newValuesVersion + " != cached " + mValuesVersion); 1224 } 1225 1226 mValues.clear(); 1227 mValuesVersion = newValuesVersion; 1228 } 1229 1230 if (mValues.containsKey(name)) { 1231 return mValues.get(name); // Could be null, that's OK -- negative caching 1232 } 1233 } 1234 } else { 1235 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle 1236 + " by user " + UserHandle.myUserId() + " so skipping cache"); 1237 } 1238 1239 IContentProvider cp = lazyGetProvider(cr); 1240 1241 // Try the fast path first, not using query(). If this 1242 // fails (alternate Settings provider that doesn't support 1243 // this interface?) then we fall back to the query/table 1244 // interface. 1245 if (mCallGetCommand != null) { 1246 try { 1247 Bundle args = null; 1248 if (!isSelf) { 1249 args = new Bundle(); 1250 args.putInt(CALL_METHOD_USER_KEY, userHandle); 1251 } 1252 Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args); 1253 if (b != null) { 1254 String value = b.getPairValue(); 1255 // Don't update our cache for reads of other users' data 1256 if (isSelf) { 1257 synchronized (this) { 1258 mValues.put(name, value); 1259 } 1260 } else { 1261 if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle 1262 + " by " + UserHandle.myUserId() 1263 + " so not updating cache"); 1264 } 1265 return value; 1266 } 1267 // If the response Bundle is null, we fall through 1268 // to the query interface below. 1269 } catch (RemoteException e) { 1270 // Not supported by the remote side? Fall through 1271 // to query(). 1272 } 1273 } 1274 1275 Cursor c = null; 1276 try { 1277 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER, 1278 new String[]{name}, null, null); 1279 if (c == null) { 1280 Log.w(TAG, "Can't get key " + name + " from " + mUri); 1281 return null; 1282 } 1283 1284 String value = c.moveToNext() ? c.getString(0) : null; 1285 synchronized (this) { 1286 mValues.put(name, value); 1287 } 1288 if (LOCAL_LOGV) { 1289 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " + 1290 name + " = " + (value == null ? "(null)" : value)); 1291 } 1292 return value; 1293 } catch (RemoteException e) { 1294 Log.w(TAG, "Can't get key " + name + " from " + mUri, e); 1295 return null; // Return null, but don't cache it. 1296 } finally { 1297 if (c != null) c.close(); 1298 } 1299 } 1300 } 1301 1302 /** 1303 * System settings, containing miscellaneous system preferences. This 1304 * table holds simple name/value pairs. There are convenience 1305 * functions for accessing individual settings entries. 1306 */ 1307 public static final class System extends NameValueTable { 1308 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; 1309 1310 /** @hide */ 1311 public static interface Validator { 1312 public boolean validate(String value); 1313 } 1314 1315 /** 1316 * The content:// style URL for this table 1317 */ 1318 public static final Uri CONTENT_URI = 1319 Uri.parse("content://" + AUTHORITY + "/system"); 1320 1321 private static final NameValueCache sNameValueCache = new NameValueCache( 1322 SYS_PROP_SETTING_VERSION, 1323 CONTENT_URI, 1324 CALL_METHOD_GET_SYSTEM, 1325 CALL_METHOD_PUT_SYSTEM); 1326 1327 private static final HashSet<String> MOVED_TO_SECURE; 1328 static { 1329 MOVED_TO_SECURE = new HashSet<String>(30); 1330 MOVED_TO_SECURE.add(Secure.ANDROID_ID); 1331 MOVED_TO_SECURE.add(Secure.HTTP_PROXY); 1332 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED); 1333 MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS); 1334 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED); 1335 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE); 1336 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 1337 MOVED_TO_SECURE.add(Secure.LOGGING_ID); 1338 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED); 1339 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE); 1340 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL); 1341 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME); 1342 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL); 1343 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 1344 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 1345 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT); 1346 MOVED_TO_SECURE.add(Secure.WIFI_ON); 1347 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE); 1348 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT); 1349 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS); 1350 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED); 1351 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS); 1352 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT); 1353 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS); 1354 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON); 1355 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT); 1356 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS); 1357 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); 1358 1359 // At one time in System, then Global, but now back in Secure 1360 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); 1361 } 1362 1363 private static final HashSet<String> MOVED_TO_GLOBAL; 1364 private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL; 1365 static { 1366 MOVED_TO_GLOBAL = new HashSet<String>(); 1367 MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>(); 1368 1369 // these were originally in system but migrated to secure in the past, 1370 // so are duplicated in the Secure.* namespace 1371 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED); 1372 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); 1373 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); 1374 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); 1375 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); 1376 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); 1377 1378 // these are moving directly from system to global 1379 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON); 1380 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS); 1381 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); 1382 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME); 1383 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE); 1384 MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND); 1385 MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND); 1386 MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND); 1387 MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND); 1388 MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED); 1389 MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND); 1390 MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND); 1391 MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND); 1392 MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED); 1393 MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN); 1394 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY); 1395 MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER); 1396 MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE); 1397 MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE); 1398 MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE); 1399 MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS); 1400 MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE); 1401 MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE); 1402 MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY); 1403 MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP); 1404 MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER); 1405 MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES); 1406 MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES); 1407 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL); 1408 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL); 1409 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL); 1410 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL); 1411 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL); 1412 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL); 1413 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL); 1414 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL); 1415 } 1416 1417 private static final Validator sBooleanValidator = 1418 new DiscreteValueValidator(new String[] {"0", "1"}); 1419 1420 private static final Validator sNonNegativeIntegerValidator = new Validator() { 1421 @Override 1422 public boolean validate(String value) { 1423 try { 1424 return Integer.parseInt(value) >= 0; 1425 } catch (NumberFormatException e) { 1426 return false; 1427 } 1428 } 1429 }; 1430 1431 private static final Validator sUriValidator = new Validator() { 1432 @Override 1433 public boolean validate(String value) { 1434 try { 1435 Uri.decode(value); 1436 return true; 1437 } catch (IllegalArgumentException e) { 1438 return false; 1439 } 1440 } 1441 }; 1442 1443 private static final Validator sLenientIpAddressValidator = new Validator() { 1444 private static final int MAX_IPV6_LENGTH = 45; 1445 1446 @Override 1447 public boolean validate(String value) { 1448 return value.length() <= MAX_IPV6_LENGTH; 1449 } 1450 }; 1451 1452 /** @hide */ 1453 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 1454 outKeySet.addAll(MOVED_TO_GLOBAL); 1455 outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL); 1456 } 1457 1458 /** @hide */ 1459 public static void getMovedToSecureSettings(Set<String> outKeySet) { 1460 outKeySet.addAll(MOVED_TO_SECURE); 1461 } 1462 1463 /** @hide */ 1464 public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) { 1465 outKeySet.addAll(MOVED_TO_GLOBAL); 1466 } 1467 1468 /** 1469 * Look up a name in the database. 1470 * @param resolver to access the database with 1471 * @param name to look up in the table 1472 * @return the corresponding value, or null if not present 1473 */ 1474 public static String getString(ContentResolver resolver, String name) { 1475 return getStringForUser(resolver, name, UserHandle.myUserId()); 1476 } 1477 1478 /** @hide */ 1479 public static String getStringForUser(ContentResolver resolver, String name, 1480 int userHandle) { 1481 if (MOVED_TO_SECURE.contains(name)) { 1482 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1483 + " to android.provider.Settings.Secure, returning read-only value."); 1484 return Secure.getStringForUser(resolver, name, userHandle); 1485 } 1486 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1487 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1488 + " to android.provider.Settings.Global, returning read-only value."); 1489 return Global.getStringForUser(resolver, name, userHandle); 1490 } 1491 return sNameValueCache.getStringForUser(resolver, name, userHandle); 1492 } 1493 1494 /** 1495 * Store a name/value pair into the database. 1496 * @param resolver to access the database with 1497 * @param name to store 1498 * @param value to associate with the name 1499 * @return true if the value was set, false on database errors 1500 */ 1501 public static boolean putString(ContentResolver resolver, String name, String value) { 1502 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 1503 } 1504 1505 /** @hide */ 1506 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 1507 int userHandle) { 1508 if (MOVED_TO_SECURE.contains(name)) { 1509 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1510 + " to android.provider.Settings.Secure, value is unchanged."); 1511 return false; 1512 } 1513 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1514 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1515 + " to android.provider.Settings.Global, value is unchanged."); 1516 return false; 1517 } 1518 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 1519 } 1520 1521 /** 1522 * Construct the content URI for a particular name/value pair, 1523 * useful for monitoring changes with a ContentObserver. 1524 * @param name to look up in the table 1525 * @return the corresponding content URI, or null if not present 1526 */ 1527 public static Uri getUriFor(String name) { 1528 if (MOVED_TO_SECURE.contains(name)) { 1529 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1530 + " to android.provider.Settings.Secure, returning Secure URI."); 1531 return Secure.getUriFor(Secure.CONTENT_URI, name); 1532 } 1533 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1534 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1535 + " to android.provider.Settings.Global, returning read-only global URI."); 1536 return Global.getUriFor(Global.CONTENT_URI, name); 1537 } 1538 return getUriFor(CONTENT_URI, name); 1539 } 1540 1541 /** 1542 * Convenience function for retrieving a single system settings value 1543 * as an integer. Note that internally setting values are always 1544 * stored as strings; this function converts the string to an integer 1545 * for you. The default value will be returned if the setting is 1546 * not defined or not an integer. 1547 * 1548 * @param cr The ContentResolver to access. 1549 * @param name The name of the setting to retrieve. 1550 * @param def Value to return if the setting is not defined. 1551 * 1552 * @return The setting's current value, or 'def' if it is not defined 1553 * or not a valid integer. 1554 */ 1555 public static int getInt(ContentResolver cr, String name, int def) { 1556 return getIntForUser(cr, name, def, UserHandle.myUserId()); 1557 } 1558 1559 /** @hide */ 1560 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 1561 String v = getStringForUser(cr, name, userHandle); 1562 try { 1563 return v != null ? Integer.parseInt(v) : def; 1564 } catch (NumberFormatException e) { 1565 return def; 1566 } 1567 } 1568 1569 /** 1570 * Convenience function for retrieving a single system settings value 1571 * as an integer. Note that internally setting values are always 1572 * stored as strings; this function converts the string to an integer 1573 * for you. 1574 * <p> 1575 * This version does not take a default value. If the setting has not 1576 * been set, or the string value is not a number, 1577 * it throws {@link SettingNotFoundException}. 1578 * 1579 * @param cr The ContentResolver to access. 1580 * @param name The name of the setting to retrieve. 1581 * 1582 * @throws SettingNotFoundException Thrown if a setting by the given 1583 * name can't be found or the setting value is not an integer. 1584 * 1585 * @return The setting's current value. 1586 */ 1587 public static int getInt(ContentResolver cr, String name) 1588 throws SettingNotFoundException { 1589 return getIntForUser(cr, name, UserHandle.myUserId()); 1590 } 1591 1592 /** @hide */ 1593 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 1594 throws SettingNotFoundException { 1595 String v = getStringForUser(cr, name, userHandle); 1596 try { 1597 return Integer.parseInt(v); 1598 } catch (NumberFormatException e) { 1599 throw new SettingNotFoundException(name); 1600 } 1601 } 1602 1603 /** 1604 * Convenience function for updating a single settings value as an 1605 * integer. This will either create a new entry in the table if the 1606 * given name does not exist, or modify the value of the existing row 1607 * with that name. Note that internally setting values are always 1608 * stored as strings, so this function converts the given value to a 1609 * string before storing it. 1610 * 1611 * @param cr The ContentResolver to access. 1612 * @param name The name of the setting to modify. 1613 * @param value The new value for the setting. 1614 * @return true if the value was set, false on database errors 1615 */ 1616 public static boolean putInt(ContentResolver cr, String name, int value) { 1617 return putIntForUser(cr, name, value, UserHandle.myUserId()); 1618 } 1619 1620 /** @hide */ 1621 public static boolean putIntForUser(ContentResolver cr, String name, int value, 1622 int userHandle) { 1623 return putStringForUser(cr, name, Integer.toString(value), userHandle); 1624 } 1625 1626 /** 1627 * Convenience function for retrieving a single system settings value 1628 * as a {@code long}. Note that internally setting values are always 1629 * stored as strings; this function converts the string to a {@code long} 1630 * for you. The default value will be returned if the setting is 1631 * not defined or not a {@code long}. 1632 * 1633 * @param cr The ContentResolver to access. 1634 * @param name The name of the setting to retrieve. 1635 * @param def Value to return if the setting is not defined. 1636 * 1637 * @return The setting's current value, or 'def' if it is not defined 1638 * or not a valid {@code long}. 1639 */ 1640 public static long getLong(ContentResolver cr, String name, long def) { 1641 return getLongForUser(cr, name, def, UserHandle.myUserId()); 1642 } 1643 1644 /** @hide */ 1645 public static long getLongForUser(ContentResolver cr, String name, long def, 1646 int userHandle) { 1647 String valString = getStringForUser(cr, name, userHandle); 1648 long value; 1649 try { 1650 value = valString != null ? Long.parseLong(valString) : def; 1651 } catch (NumberFormatException e) { 1652 value = def; 1653 } 1654 return value; 1655 } 1656 1657 /** 1658 * Convenience function for retrieving a single system settings value 1659 * as a {@code long}. Note that internally setting values are always 1660 * stored as strings; this function converts the string to a {@code long} 1661 * for you. 1662 * <p> 1663 * This version does not take a default value. If the setting has not 1664 * been set, or the string value is not a number, 1665 * it throws {@link SettingNotFoundException}. 1666 * 1667 * @param cr The ContentResolver to access. 1668 * @param name The name of the setting to retrieve. 1669 * 1670 * @return The setting's current value. 1671 * @throws SettingNotFoundException Thrown if a setting by the given 1672 * name can't be found or the setting value is not an integer. 1673 */ 1674 public static long getLong(ContentResolver cr, String name) 1675 throws SettingNotFoundException { 1676 return getLongForUser(cr, name, UserHandle.myUserId()); 1677 } 1678 1679 /** @hide */ 1680 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 1681 throws SettingNotFoundException { 1682 String valString = getStringForUser(cr, name, userHandle); 1683 try { 1684 return Long.parseLong(valString); 1685 } catch (NumberFormatException e) { 1686 throw new SettingNotFoundException(name); 1687 } 1688 } 1689 1690 /** 1691 * Convenience function for updating a single settings value as a long 1692 * integer. This will either create a new entry in the table if the 1693 * given name does not exist, or modify the value of the existing row 1694 * with that name. Note that internally setting values are always 1695 * stored as strings, so this function converts the given value to a 1696 * string before storing it. 1697 * 1698 * @param cr The ContentResolver to access. 1699 * @param name The name of the setting to modify. 1700 * @param value The new value for the setting. 1701 * @return true if the value was set, false on database errors 1702 */ 1703 public static boolean putLong(ContentResolver cr, String name, long value) { 1704 return putLongForUser(cr, name, value, UserHandle.myUserId()); 1705 } 1706 1707 /** @hide */ 1708 public static boolean putLongForUser(ContentResolver cr, String name, long value, 1709 int userHandle) { 1710 return putStringForUser(cr, name, Long.toString(value), userHandle); 1711 } 1712 1713 /** 1714 * Convenience function for retrieving a single system settings value 1715 * as a floating point number. Note that internally setting values are 1716 * always stored as strings; this function converts the string to an 1717 * float for you. The default value will be returned if the setting 1718 * is not defined or not a valid float. 1719 * 1720 * @param cr The ContentResolver to access. 1721 * @param name The name of the setting to retrieve. 1722 * @param def Value to return if the setting is not defined. 1723 * 1724 * @return The setting's current value, or 'def' if it is not defined 1725 * or not a valid float. 1726 */ 1727 public static float getFloat(ContentResolver cr, String name, float def) { 1728 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 1729 } 1730 1731 /** @hide */ 1732 public static float getFloatForUser(ContentResolver cr, String name, float def, 1733 int userHandle) { 1734 String v = getStringForUser(cr, name, userHandle); 1735 try { 1736 return v != null ? Float.parseFloat(v) : def; 1737 } catch (NumberFormatException e) { 1738 return def; 1739 } 1740 } 1741 1742 /** 1743 * Convenience function for retrieving a single system settings value 1744 * as a float. Note that internally setting values are always 1745 * stored as strings; this function converts the string to a float 1746 * for you. 1747 * <p> 1748 * This version does not take a default value. If the setting has not 1749 * been set, or the string value is not a number, 1750 * it throws {@link SettingNotFoundException}. 1751 * 1752 * @param cr The ContentResolver to access. 1753 * @param name The name of the setting to retrieve. 1754 * 1755 * @throws SettingNotFoundException Thrown if a setting by the given 1756 * name can't be found or the setting value is not a float. 1757 * 1758 * @return The setting's current value. 1759 */ 1760 public static float getFloat(ContentResolver cr, String name) 1761 throws SettingNotFoundException { 1762 return getFloatForUser(cr, name, UserHandle.myUserId()); 1763 } 1764 1765 /** @hide */ 1766 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 1767 throws SettingNotFoundException { 1768 String v = getStringForUser(cr, name, userHandle); 1769 if (v == null) { 1770 throw new SettingNotFoundException(name); 1771 } 1772 try { 1773 return Float.parseFloat(v); 1774 } catch (NumberFormatException e) { 1775 throw new SettingNotFoundException(name); 1776 } 1777 } 1778 1779 /** 1780 * Convenience function for updating a single settings value as a 1781 * floating point number. This will either create a new entry in the 1782 * table if the given name does not exist, or modify the value of the 1783 * existing row with that name. Note that internally setting values 1784 * are always stored as strings, so this function converts the given 1785 * value to a string before storing it. 1786 * 1787 * @param cr The ContentResolver to access. 1788 * @param name The name of the setting to modify. 1789 * @param value The new value for the setting. 1790 * @return true if the value was set, false on database errors 1791 */ 1792 public static boolean putFloat(ContentResolver cr, String name, float value) { 1793 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 1794 } 1795 1796 /** @hide */ 1797 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 1798 int userHandle) { 1799 return putStringForUser(cr, name, Float.toString(value), userHandle); 1800 } 1801 1802 /** 1803 * Convenience function to read all of the current 1804 * configuration-related settings into a 1805 * {@link Configuration} object. 1806 * 1807 * @param cr The ContentResolver to access. 1808 * @param outConfig Where to place the configuration settings. 1809 */ 1810 public static void getConfiguration(ContentResolver cr, Configuration outConfig) { 1811 getConfigurationForUser(cr, outConfig, UserHandle.myUserId()); 1812 } 1813 1814 /** @hide */ 1815 public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig, 1816 int userHandle) { 1817 outConfig.fontScale = Settings.System.getFloatForUser( 1818 cr, FONT_SCALE, outConfig.fontScale, userHandle); 1819 if (outConfig.fontScale < 0) { 1820 outConfig.fontScale = 1; 1821 } 1822 } 1823 1824 /** 1825 * @hide Erase the fields in the Configuration that should be applied 1826 * by the settings. 1827 */ 1828 public static void clearConfiguration(Configuration inoutConfig) { 1829 inoutConfig.fontScale = 0; 1830 } 1831 1832 /** 1833 * Convenience function to write a batch of configuration-related 1834 * settings from a {@link Configuration} object. 1835 * 1836 * @param cr The ContentResolver to access. 1837 * @param config The settings to write. 1838 * @return true if the values were set, false on database errors 1839 */ 1840 public static boolean putConfiguration(ContentResolver cr, Configuration config) { 1841 return putConfigurationForUser(cr, config, UserHandle.myUserId()); 1842 } 1843 1844 /** @hide */ 1845 public static boolean putConfigurationForUser(ContentResolver cr, Configuration config, 1846 int userHandle) { 1847 return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle); 1848 } 1849 1850 /** @hide */ 1851 public static boolean hasInterestingConfigurationChanges(int changes) { 1852 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0; 1853 } 1854 1855 /** @deprecated - Do not use */ 1856 @Deprecated 1857 public static boolean getShowGTalkServiceStatus(ContentResolver cr) { 1858 return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId()); 1859 } 1860 1861 /** 1862 * @hide 1863 * @deprecated - Do not use 1864 */ 1865 public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr, 1866 int userHandle) { 1867 return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0; 1868 } 1869 1870 /** @deprecated - Do not use */ 1871 @Deprecated 1872 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { 1873 setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId()); 1874 } 1875 1876 /** 1877 * @hide 1878 * @deprecated - Do not use 1879 */ 1880 @Deprecated 1881 public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag, 1882 int userHandle) { 1883 putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle); 1884 } 1885 1886 private static final class DiscreteValueValidator implements Validator { 1887 private final String[] mValues; 1888 1889 public DiscreteValueValidator(String[] values) { 1890 mValues = values; 1891 } 1892 1893 @Override 1894 public boolean validate(String value) { 1895 return ArrayUtils.contains(mValues, value); 1896 } 1897 } 1898 1899 private static final class InclusiveIntegerRangeValidator implements Validator { 1900 private final int mMin; 1901 private final int mMax; 1902 1903 public InclusiveIntegerRangeValidator(int min, int max) { 1904 mMin = min; 1905 mMax = max; 1906 } 1907 1908 @Override 1909 public boolean validate(String value) { 1910 try { 1911 final int intValue = Integer.parseInt(value); 1912 return intValue >= mMin && intValue <= mMax; 1913 } catch (NumberFormatException e) { 1914 return false; 1915 } 1916 } 1917 } 1918 1919 private static final class InclusiveFloatRangeValidator implements Validator { 1920 private final float mMin; 1921 private final float mMax; 1922 1923 public InclusiveFloatRangeValidator(float min, float max) { 1924 mMin = min; 1925 mMax = max; 1926 } 1927 1928 @Override 1929 public boolean validate(String value) { 1930 try { 1931 final float floatValue = Float.parseFloat(value); 1932 return floatValue >= mMin && floatValue <= mMax; 1933 } catch (NumberFormatException e) { 1934 return false; 1935 } 1936 } 1937 } 1938 1939 /** 1940 * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead 1941 */ 1942 @Deprecated 1943 public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN; 1944 1945 /** 1946 * What happens when the user presses the end call button if they're not 1947 * on a call.<br/> 1948 * <b>Values:</b><br/> 1949 * 0 - The end button does nothing.<br/> 1950 * 1 - The end button goes to the home screen.<br/> 1951 * 2 - The end button puts the device to sleep and locks the keyguard.<br/> 1952 * 3 - The end button goes to the home screen. If the user is already on the 1953 * home screen, it puts the device to sleep. 1954 */ 1955 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior"; 1956 1957 private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR = 1958 new InclusiveIntegerRangeValidator(0, 3); 1959 1960 /** 1961 * END_BUTTON_BEHAVIOR value for "go home". 1962 * @hide 1963 */ 1964 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1; 1965 1966 /** 1967 * END_BUTTON_BEHAVIOR value for "go to sleep". 1968 * @hide 1969 */ 1970 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2; 1971 1972 /** 1973 * END_BUTTON_BEHAVIOR default value. 1974 * @hide 1975 */ 1976 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP; 1977 1978 /** 1979 * Is advanced settings mode turned on. 0 == no, 1 == yes 1980 * @hide 1981 */ 1982 public static final String ADVANCED_SETTINGS = "advanced_settings"; 1983 1984 private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator; 1985 1986 /** 1987 * ADVANCED_SETTINGS default value. 1988 * @hide 1989 */ 1990 public static final int ADVANCED_SETTINGS_DEFAULT = 0; 1991 1992 /** 1993 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead 1994 */ 1995 @Deprecated 1996 public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON; 1997 1998 /** 1999 * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead 2000 */ 2001 @Deprecated 2002 public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH; 2003 2004 /** 2005 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead 2006 */ 2007 @Deprecated 2008 public static final String RADIO_WIFI = Global.RADIO_WIFI; 2009 2010 /** 2011 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead 2012 * {@hide} 2013 */ 2014 @Deprecated 2015 public static final String RADIO_WIMAX = Global.RADIO_WIMAX; 2016 2017 /** 2018 * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead 2019 */ 2020 @Deprecated 2021 public static final String RADIO_CELL = Global.RADIO_CELL; 2022 2023 /** 2024 * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead 2025 */ 2026 @Deprecated 2027 public static final String RADIO_NFC = Global.RADIO_NFC; 2028 2029 /** 2030 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead 2031 */ 2032 @Deprecated 2033 public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS; 2034 2035 /** 2036 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead 2037 * 2038 * {@hide} 2039 */ 2040 @Deprecated 2041 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = 2042 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS; 2043 2044 /** 2045 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead 2046 */ 2047 @Deprecated 2048 public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY; 2049 2050 /** 2051 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead 2052 */ 2053 @Deprecated 2054 public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT; 2055 2056 /** 2057 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead 2058 */ 2059 @Deprecated 2060 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 2061 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED; 2062 2063 /** 2064 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead 2065 */ 2066 @Deprecated 2067 public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER; 2068 2069 /** 2070 * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead 2071 */ 2072 @Deprecated 2073 public static final String MODE_RINGER = Global.MODE_RINGER; 2074 2075 /** 2076 * Whether to use static IP and other static network attributes. 2077 * <p> 2078 * Set to 1 for true and 0 for false. 2079 * 2080 * @deprecated Use {@link WifiManager} instead 2081 */ 2082 @Deprecated 2083 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; 2084 2085 private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator; 2086 2087 /** 2088 * The static IP address. 2089 * <p> 2090 * Example: "192.168.1.51" 2091 * 2092 * @deprecated Use {@link WifiManager} instead 2093 */ 2094 @Deprecated 2095 public static final String WIFI_STATIC_IP = "wifi_static_ip"; 2096 2097 private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator; 2098 2099 /** 2100 * If using static IP, the gateway's IP address. 2101 * <p> 2102 * Example: "192.168.1.1" 2103 * 2104 * @deprecated Use {@link WifiManager} instead 2105 */ 2106 @Deprecated 2107 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; 2108 2109 private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator; 2110 2111 /** 2112 * If using static IP, the net mask. 2113 * <p> 2114 * Example: "255.255.255.0" 2115 * 2116 * @deprecated Use {@link WifiManager} instead 2117 */ 2118 @Deprecated 2119 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; 2120 2121 private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator; 2122 2123 /** 2124 * If using static IP, the primary DNS's IP address. 2125 * <p> 2126 * Example: "192.168.1.1" 2127 * 2128 * @deprecated Use {@link WifiManager} instead 2129 */ 2130 @Deprecated 2131 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; 2132 2133 private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator; 2134 2135 /** 2136 * If using static IP, the secondary DNS's IP address. 2137 * <p> 2138 * Example: "192.168.1.2" 2139 * 2140 * @deprecated Use {@link WifiManager} instead 2141 */ 2142 @Deprecated 2143 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; 2144 2145 private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator; 2146 2147 /** 2148 * Determines whether remote devices may discover and/or connect to 2149 * this device. 2150 * <P>Type: INT</P> 2151 * 2 -- discoverable and connectable 2152 * 1 -- connectable but not discoverable 2153 * 0 -- neither connectable nor discoverable 2154 */ 2155 public static final String BLUETOOTH_DISCOVERABILITY = 2156 "bluetooth_discoverability"; 2157 2158 private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR = 2159 new InclusiveIntegerRangeValidator(0, 2); 2160 2161 /** 2162 * Bluetooth discoverability timeout. If this value is nonzero, then 2163 * Bluetooth becomes discoverable for a certain number of seconds, 2164 * after which is becomes simply connectable. The value is in seconds. 2165 */ 2166 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = 2167 "bluetooth_discoverability_timeout"; 2168 2169 private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR = 2170 sNonNegativeIntegerValidator; 2171 2172 /** 2173 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED} 2174 * instead 2175 */ 2176 @Deprecated 2177 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED; 2178 2179 /** 2180 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE} 2181 * instead 2182 */ 2183 @Deprecated 2184 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 2185 2186 /** 2187 * @deprecated Use 2188 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED} 2189 * instead 2190 */ 2191 @Deprecated 2192 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = 2193 "lock_pattern_tactile_feedback_enabled"; 2194 2195 /** 2196 * A formatted string of the next alarm that is set, or the empty string 2197 * if there is no alarm set. 2198 * 2199 * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}. 2200 */ 2201 @Deprecated 2202 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; 2203 2204 private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() { 2205 private static final int MAX_LENGTH = 1000; 2206 2207 @Override 2208 public boolean validate(String value) { 2209 // TODO: No idea what the correct format is. 2210 return value == null || value.length() < MAX_LENGTH; 2211 } 2212 }; 2213 2214 /** 2215 * Scaling factor for fonts, float. 2216 */ 2217 public static final String FONT_SCALE = "font_scale"; 2218 2219 private static final Validator FONT_SCALE_VALIDATOR = new Validator() { 2220 @Override 2221 public boolean validate(String value) { 2222 try { 2223 return Float.parseFloat(value) >= 0; 2224 } catch (NumberFormatException e) { 2225 return false; 2226 } 2227 } 2228 }; 2229 2230 /** 2231 * Name of an application package to be debugged. 2232 * 2233 * @deprecated Use {@link Global#DEBUG_APP} instead 2234 */ 2235 @Deprecated 2236 public static final String DEBUG_APP = Global.DEBUG_APP; 2237 2238 /** 2239 * If 1, when launching DEBUG_APP it will wait for the debugger before 2240 * starting user code. If 0, it will run normally. 2241 * 2242 * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead 2243 */ 2244 @Deprecated 2245 public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER; 2246 2247 /** 2248 * Whether or not to dim the screen. 0=no 1=yes 2249 * @deprecated This setting is no longer used. 2250 */ 2251 @Deprecated 2252 public static final String DIM_SCREEN = "dim_screen"; 2253 2254 private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator; 2255 2256 /** 2257 * The amount of time in milliseconds before the device goes to sleep or begins 2258 * to dream after a period of inactivity. This value is also known as the 2259 * user activity timeout period since the screen isn't necessarily turned off 2260 * when it expires. 2261 */ 2262 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; 2263 2264 private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator; 2265 2266 /** 2267 * The screen backlight brightness between 0 and 255. 2268 */ 2269 public static final String SCREEN_BRIGHTNESS = "screen_brightness"; 2270 2271 private static final Validator SCREEN_BRIGHTNESS_VALIDATOR = 2272 new InclusiveIntegerRangeValidator(0, 255); 2273 2274 /** 2275 * Control whether to enable automatic brightness mode. 2276 */ 2277 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; 2278 2279 private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator; 2280 2281 /** 2282 * Adjustment to auto-brightness to make it generally more (>0.0 <1.0) 2283 * or less (<0.0 >-1.0) bright. 2284 * @hide 2285 */ 2286 public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj"; 2287 2288 private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR = 2289 new InclusiveFloatRangeValidator(-1, 1); 2290 2291 /** 2292 * SCREEN_BRIGHTNESS_MODE value for manual mode. 2293 */ 2294 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0; 2295 2296 /** 2297 * SCREEN_BRIGHTNESS_MODE value for automatic mode. 2298 */ 2299 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; 2300 2301 /** 2302 * Control whether the process CPU usage meter should be shown. 2303 * 2304 * @deprecated Use {@link Global#SHOW_PROCESSES} instead 2305 */ 2306 @Deprecated 2307 public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES; 2308 2309 /** 2310 * If 1, the activity manager will aggressively finish activities and 2311 * processes as soon as they are no longer needed. If 0, the normal 2312 * extended lifetime is used. 2313 * 2314 * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead 2315 */ 2316 @Deprecated 2317 public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES; 2318 2319 /** 2320 * Determines which streams are affected by ringer mode changes. The 2321 * stream type's bit should be set to 1 if it should be muted when going 2322 * into an inaudible ringer mode. 2323 */ 2324 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; 2325 2326 private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR = 2327 sNonNegativeIntegerValidator; 2328 2329 /** 2330 * Determines which streams are affected by mute. The 2331 * stream type's bit should be set to 1 if it should be muted when a mute request 2332 * is received. 2333 */ 2334 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; 2335 2336 private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR = 2337 sNonNegativeIntegerValidator; 2338 2339 /** 2340 * Whether vibrate is on for different events. This is used internally, 2341 * changing this value will not change the vibrate. See AudioManager. 2342 */ 2343 public static final String VIBRATE_ON = "vibrate_on"; 2344 2345 private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator; 2346 2347 /** 2348 * If 1, redirects the system vibrator to all currently attached input devices 2349 * that support vibration. If there are no such input devices, then the system 2350 * vibrator is used instead. 2351 * If 0, does not register the system vibrator. 2352 * 2353 * This setting is mainly intended to provide a compatibility mechanism for 2354 * applications that only know about the system vibrator and do not use the 2355 * input device vibrator API. 2356 * 2357 * @hide 2358 */ 2359 public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices"; 2360 2361 private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator; 2362 2363 /** 2364 * Ringer volume. This is used internally, changing this value will not 2365 * change the volume. See AudioManager. 2366 * 2367 * @removed Not used by anything since API 2. 2368 */ 2369 public static final String VOLUME_RING = "volume_ring"; 2370 2371 /** 2372 * System/notifications volume. This is used internally, changing this 2373 * value will not change the volume. See AudioManager. 2374 * 2375 * @removed Not used by anything since API 2. 2376 */ 2377 public static final String VOLUME_SYSTEM = "volume_system"; 2378 2379 /** 2380 * Voice call volume. This is used internally, changing this value will 2381 * not change the volume. See AudioManager. 2382 * 2383 * @removed Not used by anything since API 2. 2384 */ 2385 public static final String VOLUME_VOICE = "volume_voice"; 2386 2387 /** 2388 * Music/media/gaming volume. This is used internally, changing this 2389 * value will not change the volume. See AudioManager. 2390 * 2391 * @removed Not used by anything since API 2. 2392 */ 2393 public static final String VOLUME_MUSIC = "volume_music"; 2394 2395 /** 2396 * Alarm volume. This is used internally, changing this 2397 * value will not change the volume. See AudioManager. 2398 * 2399 * @removed Not used by anything since API 2. 2400 */ 2401 public static final String VOLUME_ALARM = "volume_alarm"; 2402 2403 /** 2404 * Notification volume. This is used internally, changing this 2405 * value will not change the volume. See AudioManager. 2406 * 2407 * @removed Not used by anything since API 2. 2408 */ 2409 public static final String VOLUME_NOTIFICATION = "volume_notification"; 2410 2411 /** 2412 * Bluetooth Headset volume. This is used internally, changing this value will 2413 * not change the volume. See AudioManager. 2414 * 2415 * @removed Not used by anything since API 2. 2416 */ 2417 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; 2418 2419 /** 2420 * Master volume (float in the range 0.0f to 1.0f). 2421 * 2422 * @hide 2423 */ 2424 public static final String VOLUME_MASTER = "volume_master"; 2425 2426 /** 2427 * Master volume mute (int 1 = mute, 0 = not muted). 2428 * 2429 * @hide 2430 */ 2431 public static final String VOLUME_MASTER_MUTE = "volume_master_mute"; 2432 2433 private static final Validator VOLUME_MASTER_MUTE_VALIDATOR = sBooleanValidator; 2434 2435 /** 2436 * Microphone mute (int 1 = mute, 0 = not muted). 2437 * 2438 * @hide 2439 */ 2440 public static final String MICROPHONE_MUTE = "microphone_mute"; 2441 2442 private static final Validator MICROPHONE_MUTE_VALIDATOR = sBooleanValidator; 2443 2444 /** 2445 * Whether the notifications should use the ring volume (value of 1) or 2446 * a separate notification volume (value of 0). In most cases, users 2447 * will have this enabled so the notification and ringer volumes will be 2448 * the same. However, power users can disable this and use the separate 2449 * notification volume control. 2450 * <p> 2451 * Note: This is a one-off setting that will be removed in the future 2452 * when there is profile support. For this reason, it is kept hidden 2453 * from the public APIs. 2454 * 2455 * @hide 2456 * @deprecated 2457 */ 2458 @Deprecated 2459 public static final String NOTIFICATIONS_USE_RING_VOLUME = 2460 "notifications_use_ring_volume"; 2461 2462 private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator; 2463 2464 /** 2465 * Whether silent mode should allow vibration feedback. This is used 2466 * internally in AudioService and the Sound settings activity to 2467 * coordinate decoupling of vibrate and silent modes. This setting 2468 * will likely be removed in a future release with support for 2469 * audio/vibe feedback profiles. 2470 * 2471 * Not used anymore. On devices with vibrator, the user explicitly selects 2472 * silent or vibrate mode. 2473 * Kept for use by legacy database upgrade code in DatabaseHelper. 2474 * @hide 2475 */ 2476 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent"; 2477 2478 private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator; 2479 2480 /** 2481 * The mapping of stream type (integer) to its setting. 2482 * 2483 * @removed Not used by anything since API 2. 2484 */ 2485 public static final String[] VOLUME_SETTINGS = { 2486 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, 2487 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO 2488 }; 2489 2490 /** 2491 * Appended to various volume related settings to record the previous 2492 * values before they the settings were affected by a silent/vibrate 2493 * ringer mode change. 2494 * 2495 * @removed Not used by anything since API 2. 2496 */ 2497 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible"; 2498 2499 /** 2500 * Persistent store for the system-wide default ringtone URI. 2501 * <p> 2502 * If you need to play the default ringtone at any given time, it is recommended 2503 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve 2504 * to the set default ringtone at the time of playing. 2505 * 2506 * @see #DEFAULT_RINGTONE_URI 2507 */ 2508 public static final String RINGTONE = "ringtone"; 2509 2510 private static final Validator RINGTONE_VALIDATOR = sUriValidator; 2511 2512 /** 2513 * A {@link Uri} that will point to the current default ringtone at any 2514 * given time. 2515 * <p> 2516 * If the current default ringtone is in the DRM provider and the caller 2517 * does not have permission, the exception will be a 2518 * FileNotFoundException. 2519 */ 2520 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE); 2521 2522 /** 2523 * Persistent store for the system-wide default notification sound. 2524 * 2525 * @see #RINGTONE 2526 * @see #DEFAULT_NOTIFICATION_URI 2527 */ 2528 public static final String NOTIFICATION_SOUND = "notification_sound"; 2529 2530 private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator; 2531 2532 /** 2533 * A {@link Uri} that will point to the current default notification 2534 * sound at any given time. 2535 * 2536 * @see #DEFAULT_RINGTONE_URI 2537 */ 2538 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND); 2539 2540 /** 2541 * Persistent store for the system-wide default alarm alert. 2542 * 2543 * @see #RINGTONE 2544 * @see #DEFAULT_ALARM_ALERT_URI 2545 */ 2546 public static final String ALARM_ALERT = "alarm_alert"; 2547 2548 private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator; 2549 2550 /** 2551 * A {@link Uri} that will point to the current default alarm alert at 2552 * any given time. 2553 * 2554 * @see #DEFAULT_ALARM_ALERT_URI 2555 */ 2556 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT); 2557 2558 /** 2559 * Persistent store for the system default media button event receiver. 2560 * 2561 * @hide 2562 */ 2563 public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver"; 2564 2565 private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() { 2566 @Override 2567 public boolean validate(String value) { 2568 try { 2569 ComponentName.unflattenFromString(value); 2570 return true; 2571 } catch (NullPointerException e) { 2572 return false; 2573 } 2574 } 2575 }; 2576 2577 /** 2578 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off 2579 */ 2580 public static final String TEXT_AUTO_REPLACE = "auto_replace"; 2581 2582 private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator; 2583 2584 /** 2585 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off 2586 */ 2587 public static final String TEXT_AUTO_CAPS = "auto_caps"; 2588 2589 private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator; 2590 2591 /** 2592 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This 2593 * feature converts two spaces to a "." and space. 2594 */ 2595 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; 2596 2597 private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator; 2598 2599 /** 2600 * Setting to showing password characters in text editors. 1 = On, 0 = Off 2601 */ 2602 public static final String TEXT_SHOW_PASSWORD = "show_password"; 2603 2604 private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator; 2605 2606 public static final String SHOW_GTALK_SERVICE_STATUS = 2607 "SHOW_GTALK_SERVICE_STATUS"; 2608 2609 private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator; 2610 2611 /** 2612 * Name of activity to use for wallpaper on the home screen. 2613 * 2614 * @deprecated Use {@link WallpaperManager} instead. 2615 */ 2616 @Deprecated 2617 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; 2618 2619 private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() { 2620 private static final int MAX_LENGTH = 1000; 2621 2622 @Override 2623 public boolean validate(String value) { 2624 if (value != null && value.length() > MAX_LENGTH) { 2625 return false; 2626 } 2627 return ComponentName.unflattenFromString(value) != null; 2628 } 2629 }; 2630 2631 /** 2632 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME} 2633 * instead 2634 */ 2635 @Deprecated 2636 public static final String AUTO_TIME = Global.AUTO_TIME; 2637 2638 /** 2639 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE} 2640 * instead 2641 */ 2642 @Deprecated 2643 public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; 2644 2645 /** 2646 * Display times as 12 or 24 hours 2647 * 12 2648 * 24 2649 */ 2650 public static final String TIME_12_24 = "time_12_24"; 2651 2652 /** @hide */ 2653 public static final Validator TIME_12_24_VALIDATOR = 2654 new DiscreteValueValidator(new String[] {"12", "24"}); 2655 2656 /** 2657 * Date format string 2658 * mm/dd/yyyy 2659 * dd/mm/yyyy 2660 * yyyy/mm/dd 2661 */ 2662 public static final String DATE_FORMAT = "date_format"; 2663 2664 /** @hide */ 2665 public static final Validator DATE_FORMAT_VALIDATOR = new Validator() { 2666 @Override 2667 public boolean validate(String value) { 2668 try { 2669 new SimpleDateFormat(value); 2670 return true; 2671 } catch (IllegalArgumentException e) { 2672 return false; 2673 } 2674 } 2675 }; 2676 2677 /** 2678 * Whether the setup wizard has been run before (on first boot), or if 2679 * it still needs to be run. 2680 * 2681 * nonzero = it has been run in the past 2682 * 0 = it has not been run in the past 2683 */ 2684 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; 2685 2686 /** @hide */ 2687 public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator; 2688 2689 /** 2690 * Scaling factor for normal window animations. Setting to 0 will disable window 2691 * animations. 2692 * 2693 * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead 2694 */ 2695 @Deprecated 2696 public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE; 2697 2698 /** 2699 * Scaling factor for activity transition animations. Setting to 0 will disable window 2700 * animations. 2701 * 2702 * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead 2703 */ 2704 @Deprecated 2705 public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE; 2706 2707 /** 2708 * Scaling factor for Animator-based animations. This affects both the start delay and 2709 * duration of all such animations. Setting to 0 will cause animations to end immediately. 2710 * The default value is 1. 2711 * 2712 * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead 2713 */ 2714 @Deprecated 2715 public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE; 2716 2717 /** 2718 * Control whether the accelerometer will be used to change screen 2719 * orientation. If 0, it will not be used unless explicitly requested 2720 * by the application; if 1, it will be used by default unless explicitly 2721 * disabled by the application. 2722 */ 2723 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; 2724 2725 /** @hide */ 2726 public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator; 2727 2728 /** 2729 * Default screen rotation when no other policy applies. 2730 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a 2731 * preference, this rotation value will be used. Must be one of the 2732 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}. 2733 * 2734 * @see android.view.Display#getRotation 2735 */ 2736 public static final String USER_ROTATION = "user_rotation"; 2737 2738 /** @hide */ 2739 public static final Validator USER_ROTATION_VALIDATOR = 2740 new InclusiveIntegerRangeValidator(0, 3); 2741 2742 /** 2743 * Control whether the rotation lock toggle in the System UI should be hidden. 2744 * Typically this is done for accessibility purposes to make it harder for 2745 * the user to accidentally toggle the rotation lock while the display rotation 2746 * has been locked for accessibility. 2747 * 2748 * If 0, then rotation lock toggle is not hidden for accessibility (although it may be 2749 * unavailable for other reasons). If 1, then the rotation lock toggle is hidden. 2750 * 2751 * @hide 2752 */ 2753 public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY = 2754 "hide_rotation_lock_toggle_for_accessibility"; 2755 2756 /** @hide */ 2757 public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR = 2758 sBooleanValidator; 2759 2760 /** 2761 * Whether the phone vibrates when it is ringing due to an incoming call. This will 2762 * be used by Phone and Setting apps; it shouldn't affect other apps. 2763 * The value is boolean (1 or 0). 2764 * 2765 * Note: this is not same as "vibrate on ring", which had been available until ICS. 2766 * It was about AudioManager's setting and thus affected all the applications which 2767 * relied on the setting, while this is purely about the vibration setting for incoming 2768 * calls. 2769 */ 2770 public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing"; 2771 2772 /** @hide */ 2773 public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator; 2774 2775 /** 2776 * Whether the audible DTMF tones are played by the dialer when dialing. The value is 2777 * boolean (1 or 0). 2778 */ 2779 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; 2780 2781 /** @hide */ 2782 public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator; 2783 2784 /** 2785 * CDMA only settings 2786 * DTMF tone type played by the dialer when dialing. 2787 * 0 = Normal 2788 * 1 = Long 2789 */ 2790 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type"; 2791 2792 /** @hide */ 2793 public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator; 2794 2795 /** 2796 * Whether the hearing aid is enabled. The value is 2797 * boolean (1 or 0). 2798 * @hide 2799 */ 2800 public static final String HEARING_AID = "hearing_aid"; 2801 2802 /** @hide */ 2803 public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator; 2804 2805 /** 2806 * CDMA only settings 2807 * TTY Mode 2808 * 0 = OFF 2809 * 1 = FULL 2810 * 2 = VCO 2811 * 3 = HCO 2812 * @hide 2813 */ 2814 public static final String TTY_MODE = "tty_mode"; 2815 2816 /** @hide */ 2817 public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3); 2818 2819 /** 2820 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is 2821 * boolean (1 or 0). 2822 */ 2823 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; 2824 2825 /** @hide */ 2826 public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator; 2827 2828 /** 2829 * Whether the haptic feedback (long presses, ...) are enabled. The value is 2830 * boolean (1 or 0). 2831 */ 2832 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; 2833 2834 /** @hide */ 2835 public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator; 2836 2837 /** 2838 * @deprecated Each application that shows web suggestions should have its own 2839 * setting for this. 2840 */ 2841 @Deprecated 2842 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; 2843 2844 /** @hide */ 2845 public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator; 2846 2847 /** 2848 * Whether the notification LED should repeatedly flash when a notification is 2849 * pending. The value is boolean (1 or 0). 2850 * @hide 2851 */ 2852 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; 2853 2854 /** @hide */ 2855 public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator; 2856 2857 /** 2858 * Show pointer location on screen? 2859 * 0 = no 2860 * 1 = yes 2861 * @hide 2862 */ 2863 public static final String POINTER_LOCATION = "pointer_location"; 2864 2865 /** @hide */ 2866 public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator; 2867 2868 /** 2869 * Show touch positions on screen? 2870 * 0 = no 2871 * 1 = yes 2872 * @hide 2873 */ 2874 public static final String SHOW_TOUCHES = "show_touches"; 2875 2876 /** @hide */ 2877 public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator; 2878 2879 /** 2880 * Log raw orientation data from 2881 * {@link com.android.server.policy.WindowOrientationListener} for use with the 2882 * orientationplot.py tool. 2883 * 0 = no 2884 * 1 = yes 2885 * @hide 2886 */ 2887 public static final String WINDOW_ORIENTATION_LISTENER_LOG = 2888 "window_orientation_listener_log"; 2889 2890 /** @hide */ 2891 public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator; 2892 2893 /** 2894 * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED} 2895 * instead 2896 * @hide 2897 */ 2898 @Deprecated 2899 public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED; 2900 2901 /** 2902 * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED} 2903 * instead 2904 * @hide 2905 */ 2906 @Deprecated 2907 public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED; 2908 2909 /** 2910 * Whether to play sounds when the keyguard is shown and dismissed. 2911 * @hide 2912 */ 2913 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; 2914 2915 /** @hide */ 2916 public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator; 2917 2918 /** 2919 * Whether the lockscreen should be completely disabled. 2920 * @hide 2921 */ 2922 public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; 2923 2924 /** @hide */ 2925 public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator; 2926 2927 /** 2928 * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} 2929 * instead 2930 * @hide 2931 */ 2932 @Deprecated 2933 public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND; 2934 2935 /** 2936 * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND} 2937 * instead 2938 * @hide 2939 */ 2940 @Deprecated 2941 public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND; 2942 2943 /** 2944 * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} 2945 * instead 2946 * @hide 2947 */ 2948 @Deprecated 2949 public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; 2950 2951 /** 2952 * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} 2953 * instead 2954 * @hide 2955 */ 2956 @Deprecated 2957 public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; 2958 2959 /** 2960 * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} 2961 * instead 2962 * @hide 2963 */ 2964 @Deprecated 2965 public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; 2966 2967 /** 2968 * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} 2969 * instead 2970 * @hide 2971 */ 2972 @Deprecated 2973 public static final String LOCK_SOUND = Global.LOCK_SOUND; 2974 2975 /** 2976 * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} 2977 * instead 2978 * @hide 2979 */ 2980 @Deprecated 2981 public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; 2982 2983 /** 2984 * Receive incoming SIP calls? 2985 * 0 = no 2986 * 1 = yes 2987 * @hide 2988 */ 2989 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; 2990 2991 /** @hide */ 2992 public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator; 2993 2994 /** 2995 * Call Preference String. 2996 * "SIP_ALWAYS" : Always use SIP with network access 2997 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address 2998 * @hide 2999 */ 3000 public static final String SIP_CALL_OPTIONS = "sip_call_options"; 3001 3002 /** @hide */ 3003 public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator( 3004 new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"}); 3005 3006 /** 3007 * One of the sip call options: Always use SIP with network access. 3008 * @hide 3009 */ 3010 public static final String SIP_ALWAYS = "SIP_ALWAYS"; 3011 3012 /** @hide */ 3013 public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator; 3014 3015 /** 3016 * One of the sip call options: Only if destination is a SIP address. 3017 * @hide 3018 */ 3019 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; 3020 3021 /** @hide */ 3022 public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator; 3023 3024 /** 3025 * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that 3026 * the user should be prompted each time a call is made whether it should be placed using 3027 * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with 3028 * SIP_ADDRESS_ONLY. 3029 * @hide 3030 */ 3031 @Deprecated 3032 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; 3033 3034 /** @hide */ 3035 public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator; 3036 3037 /** 3038 * Pointer speed setting. 3039 * This is an integer value in a range between -7 and +7, so there are 15 possible values. 3040 * -7 = slowest 3041 * 0 = default speed 3042 * +7 = fastest 3043 * @hide 3044 */ 3045 public static final String POINTER_SPEED = "pointer_speed"; 3046 3047 /** @hide */ 3048 public static final Validator POINTER_SPEED_VALIDATOR = 3049 new InclusiveFloatRangeValidator(-7, 7); 3050 3051 /** 3052 * Whether lock-to-app will be triggered by long-press on recents. 3053 * @hide 3054 */ 3055 public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled"; 3056 3057 /** @hide */ 3058 public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator; 3059 3060 /** 3061 * I am the lolrus. 3062 * <p> 3063 * Nonzero values indicate that the user has a bukkit. 3064 * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>. 3065 * @hide 3066 */ 3067 public static final String EGG_MODE = "egg_mode"; 3068 3069 /** @hide */ 3070 public static final Validator EGG_MODE_VALIDATOR = sBooleanValidator; 3071 3072 /** 3073 * IMPORTANT: If you add a new public settings you also have to add it to 3074 * PUBLIC_SETTINGS below. If the new setting is hidden you have to add 3075 * it to PRIVATE_SETTINGS below. Also add a validator that can validate 3076 * the setting value. See an example above. 3077 */ 3078 3079 /** 3080 * Settings to backup. This is here so that it's in the same place as the settings 3081 * keys and easy to update. 3082 * 3083 * NOTE: Settings are backed up and restored in the order they appear 3084 * in this array. If you have one setting depending on another, 3085 * make sure that they are ordered appropriately. 3086 * 3087 * @hide 3088 */ 3089 public static final String[] SETTINGS_TO_BACKUP = { 3090 STAY_ON_WHILE_PLUGGED_IN, // moved to global 3091 WIFI_USE_STATIC_IP, 3092 WIFI_STATIC_IP, 3093 WIFI_STATIC_GATEWAY, 3094 WIFI_STATIC_NETMASK, 3095 WIFI_STATIC_DNS1, 3096 WIFI_STATIC_DNS2, 3097 BLUETOOTH_DISCOVERABILITY, 3098 BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3099 DIM_SCREEN, 3100 SCREEN_OFF_TIMEOUT, 3101 SCREEN_BRIGHTNESS, 3102 SCREEN_BRIGHTNESS_MODE, 3103 SCREEN_AUTO_BRIGHTNESS_ADJ, 3104 VIBRATE_INPUT_DEVICES, 3105 MODE_RINGER_STREAMS_AFFECTED, 3106 TEXT_AUTO_REPLACE, 3107 TEXT_AUTO_CAPS, 3108 TEXT_AUTO_PUNCTUATE, 3109 TEXT_SHOW_PASSWORD, 3110 AUTO_TIME, // moved to global 3111 AUTO_TIME_ZONE, // moved to global 3112 TIME_12_24, 3113 DATE_FORMAT, 3114 DTMF_TONE_WHEN_DIALING, 3115 DTMF_TONE_TYPE_WHEN_DIALING, 3116 HEARING_AID, 3117 TTY_MODE, 3118 SOUND_EFFECTS_ENABLED, 3119 HAPTIC_FEEDBACK_ENABLED, 3120 POWER_SOUNDS_ENABLED, // moved to global 3121 DOCK_SOUNDS_ENABLED, // moved to global 3122 LOCKSCREEN_SOUNDS_ENABLED, 3123 SHOW_WEB_SUGGESTIONS, 3124 NOTIFICATION_LIGHT_PULSE, 3125 SIP_CALL_OPTIONS, 3126 SIP_RECEIVE_CALLS, 3127 POINTER_SPEED, 3128 VIBRATE_WHEN_RINGING, 3129 RINGTONE, 3130 LOCK_TO_APP_ENABLED, 3131 NOTIFICATION_SOUND 3132 }; 3133 3134 /** 3135 * These are all public system settings 3136 * 3137 * @hide 3138 */ 3139 public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>(); 3140 static { 3141 PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR); 3142 PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP); 3143 PUBLIC_SETTINGS.add(WIFI_STATIC_IP); 3144 PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY); 3145 PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK); 3146 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1); 3147 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2); 3148 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY); 3149 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT); 3150 PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED); 3151 PUBLIC_SETTINGS.add(FONT_SCALE); 3152 PUBLIC_SETTINGS.add(DIM_SCREEN); 3153 PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT); 3154 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS); 3155 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE); 3156 PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED); 3157 PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED); 3158 PUBLIC_SETTINGS.add(VIBRATE_ON); 3159 PUBLIC_SETTINGS.add(VOLUME_RING); 3160 PUBLIC_SETTINGS.add(VOLUME_SYSTEM); 3161 PUBLIC_SETTINGS.add(VOLUME_VOICE); 3162 PUBLIC_SETTINGS.add(VOLUME_MUSIC); 3163 PUBLIC_SETTINGS.add(VOLUME_ALARM); 3164 PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION); 3165 PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO); 3166 PUBLIC_SETTINGS.add(RINGTONE); 3167 PUBLIC_SETTINGS.add(NOTIFICATION_SOUND); 3168 PUBLIC_SETTINGS.add(ALARM_ALERT); 3169 PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE); 3170 PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS); 3171 PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE); 3172 PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD); 3173 PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS); 3174 PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY); 3175 PUBLIC_SETTINGS.add(TIME_12_24); 3176 PUBLIC_SETTINGS.add(DATE_FORMAT); 3177 PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN); 3178 PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION); 3179 PUBLIC_SETTINGS.add(USER_ROTATION); 3180 PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING); 3181 PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED); 3182 PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); 3183 PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS); 3184 } 3185 3186 /** 3187 * These are all hidden system settings. 3188 * 3189 * @hide 3190 */ 3191 public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>(); 3192 static { 3193 PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP); 3194 PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR); 3195 PRIVATE_SETTINGS.add(ADVANCED_SETTINGS); 3196 PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ); 3197 PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES); 3198 PRIVATE_SETTINGS.add(VOLUME_MASTER); 3199 PRIVATE_SETTINGS.add(VOLUME_MASTER_MUTE); 3200 PRIVATE_SETTINGS.add(MICROPHONE_MUTE); 3201 PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME); 3202 PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT); 3203 PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER); 3204 PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY); 3205 PRIVATE_SETTINGS.add(VIBRATE_WHEN_RINGING); 3206 PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING); 3207 PRIVATE_SETTINGS.add(HEARING_AID); 3208 PRIVATE_SETTINGS.add(TTY_MODE); 3209 PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE); 3210 PRIVATE_SETTINGS.add(POINTER_LOCATION); 3211 PRIVATE_SETTINGS.add(SHOW_TOUCHES); 3212 PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG); 3213 PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED); 3214 PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED); 3215 PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED); 3216 PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED); 3217 PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND); 3218 PRIVATE_SETTINGS.add(DESK_DOCK_SOUND); 3219 PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND); 3220 PRIVATE_SETTINGS.add(CAR_DOCK_SOUND); 3221 PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND); 3222 PRIVATE_SETTINGS.add(LOCK_SOUND); 3223 PRIVATE_SETTINGS.add(UNLOCK_SOUND); 3224 PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS); 3225 PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS); 3226 PRIVATE_SETTINGS.add(SIP_ALWAYS); 3227 PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY); 3228 PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME); 3229 PRIVATE_SETTINGS.add(POINTER_SPEED); 3230 PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED); 3231 PRIVATE_SETTINGS.add(EGG_MODE); 3232 } 3233 3234 /** 3235 * These are all public system settings 3236 * 3237 * @hide 3238 */ 3239 public static final Map<String, Validator> VALIDATORS = new ArrayMap<>(); 3240 static { 3241 VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR); 3242 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 3243 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR); 3244 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3245 BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR); 3246 VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR); 3247 VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR); 3248 VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR); 3249 VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR); 3250 VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR); 3251 VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR); 3252 VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR); 3253 VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR); 3254 VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR); 3255 VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR); 3256 VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR); 3257 VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR); 3258 VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR); 3259 VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR); 3260 VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR); 3261 VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR); 3262 VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR); 3263 VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR); 3264 VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR); 3265 VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR); 3266 VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR); 3267 VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR); 3268 VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR); 3269 VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR); 3270 VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR); 3271 VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR); 3272 VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR); 3273 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 3274 VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR); 3275 VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR); 3276 VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR); 3277 VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR); 3278 VALIDATORS.put(VOLUME_MASTER_MUTE, VOLUME_MASTER_MUTE_VALIDATOR); 3279 VALIDATORS.put(MICROPHONE_MUTE, MICROPHONE_MUTE_VALIDATOR); 3280 VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR); 3281 VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR); 3282 VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR); 3283 VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 3284 HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR); 3285 VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR); 3286 VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR); 3287 VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR); 3288 VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR); 3289 VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR); 3290 VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR); 3291 VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR); 3292 VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG, 3293 WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR); 3294 VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR); 3295 VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR); 3296 VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR); 3297 VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR); 3298 VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR); 3299 VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR); 3300 VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR); 3301 VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR); 3302 VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR); 3303 VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR); 3304 VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR); 3305 VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR); 3306 VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); 3307 VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); 3308 VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); 3309 } 3310 3311 /** 3312 * These entries are considered common between the personal and the managed profile, 3313 * since the managed profile doesn't get to change them. 3314 */ 3315 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 3316 static { 3317 CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT); 3318 CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED); 3319 CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED); 3320 CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD); 3321 CLONE_TO_MANAGED_PROFILE.add(TIME_12_24); 3322 } 3323 3324 /** @hide */ 3325 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 3326 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 3327 } 3328 3329 /** 3330 * When to use Wi-Fi calling 3331 * 3332 * @see android.telephony.TelephonyManager.WifiCallingChoices 3333 * @hide 3334 */ 3335 public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls"; 3336 3337 // Settings moved to Settings.Secure 3338 3339 /** 3340 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} 3341 * instead 3342 */ 3343 @Deprecated 3344 public static final String ADB_ENABLED = Global.ADB_ENABLED; 3345 3346 /** 3347 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead 3348 */ 3349 @Deprecated 3350 public static final String ANDROID_ID = Secure.ANDROID_ID; 3351 3352 /** 3353 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 3354 */ 3355 @Deprecated 3356 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 3357 3358 /** 3359 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 3360 */ 3361 @Deprecated 3362 public static final String DATA_ROAMING = Global.DATA_ROAMING; 3363 3364 /** 3365 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 3366 */ 3367 @Deprecated 3368 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 3369 3370 /** 3371 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead 3372 */ 3373 @Deprecated 3374 public static final String HTTP_PROXY = Global.HTTP_PROXY; 3375 3376 /** 3377 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 3378 */ 3379 @Deprecated 3380 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 3381 3382 /** 3383 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} 3384 * instead 3385 */ 3386 @Deprecated 3387 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; 3388 3389 /** 3390 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead 3391 */ 3392 @Deprecated 3393 public static final String LOGGING_ID = Secure.LOGGING_ID; 3394 3395 /** 3396 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 3397 */ 3398 @Deprecated 3399 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 3400 3401 /** 3402 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} 3403 * instead 3404 */ 3405 @Deprecated 3406 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; 3407 3408 /** 3409 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} 3410 * instead 3411 */ 3412 @Deprecated 3413 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; 3414 3415 /** 3416 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} 3417 * instead 3418 */ 3419 @Deprecated 3420 public static final String PARENTAL_CONTROL_REDIRECT_URL = 3421 Secure.PARENTAL_CONTROL_REDIRECT_URL; 3422 3423 /** 3424 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead 3425 */ 3426 @Deprecated 3427 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; 3428 3429 /** 3430 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 3431 */ 3432 @Deprecated 3433 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 3434 3435 /** 3436 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 3437 */ 3438 @Deprecated 3439 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 3440 3441 /** 3442 * @deprecated Use 3443 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 3444 */ 3445 @Deprecated 3446 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 3447 3448 /** 3449 * @deprecated Use 3450 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 3451 */ 3452 @Deprecated 3453 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 3454 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 3455 3456 /** 3457 * @deprecated Use 3458 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead 3459 */ 3460 @Deprecated 3461 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 3462 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 3463 3464 /** 3465 * @deprecated Use 3466 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead 3467 */ 3468 @Deprecated 3469 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 3470 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 3471 3472 /** 3473 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 3474 * instead 3475 */ 3476 @Deprecated 3477 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 3478 3479 /** 3480 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead 3481 */ 3482 @Deprecated 3483 public static final String WIFI_ON = Global.WIFI_ON; 3484 3485 /** 3486 * @deprecated Use 3487 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} 3488 * instead 3489 */ 3490 @Deprecated 3491 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 3492 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; 3493 3494 /** 3495 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead 3496 */ 3497 @Deprecated 3498 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; 3499 3500 /** 3501 * @deprecated Use 3502 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead 3503 */ 3504 @Deprecated 3505 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 3506 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; 3507 3508 /** 3509 * @deprecated Use 3510 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead 3511 */ 3512 @Deprecated 3513 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 3514 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; 3515 3516 /** 3517 * @deprecated Use 3518 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} 3519 * instead 3520 */ 3521 @Deprecated 3522 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 3523 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; 3524 3525 /** 3526 * @deprecated Use 3527 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead 3528 */ 3529 @Deprecated 3530 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 3531 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; 3532 3533 /** 3534 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} 3535 * instead 3536 */ 3537 @Deprecated 3538 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; 3539 3540 /** 3541 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 3542 */ 3543 @Deprecated 3544 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON; 3545 3546 /** 3547 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead 3548 */ 3549 @Deprecated 3550 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; 3551 3552 /** 3553 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} 3554 * instead 3555 */ 3556 @Deprecated 3557 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; 3558 3559 /** 3560 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} 3561 * instead 3562 */ 3563 @Deprecated 3564 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = 3565 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; 3566 } 3567 3568 /** 3569 * Secure system settings, containing system preferences that applications 3570 * can read but are not allowed to write. These are for preferences that 3571 * the user must explicitly modify through the system UI or specialized 3572 * APIs for those values, not modified directly by applications. 3573 */ 3574 public static final class Secure extends NameValueTable { 3575 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; 3576 3577 /** 3578 * The content:// style URL for this table 3579 */ 3580 public static final Uri CONTENT_URI = 3581 Uri.parse("content://" + AUTHORITY + "/secure"); 3582 3583 // Populated lazily, guarded by class object: 3584 private static final NameValueCache sNameValueCache = new NameValueCache( 3585 SYS_PROP_SETTING_VERSION, 3586 CONTENT_URI, 3587 CALL_METHOD_GET_SECURE, 3588 CALL_METHOD_PUT_SECURE); 3589 3590 private static ILockSettings sLockSettings = null; 3591 3592 private static boolean sIsSystemProcess; 3593 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; 3594 private static final HashSet<String> MOVED_TO_GLOBAL; 3595 static { 3596 MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3); 3597 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); 3598 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); 3599 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 3600 3601 MOVED_TO_GLOBAL = new HashSet<String>(); 3602 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED); 3603 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED); 3604 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON); 3605 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU); 3606 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS); 3607 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE); 3608 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE); 3609 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE); 3610 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI); 3611 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING); 3612 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED); 3613 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED); 3614 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED); 3615 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); 3616 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); 3617 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); 3618 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); 3619 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); 3620 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); 3621 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES); 3622 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE); 3623 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED); 3624 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES); 3625 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL); 3626 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED); 3627 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE); 3628 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION); 3629 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE); 3630 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES); 3631 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE); 3632 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION); 3633 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE); 3634 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES); 3635 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE); 3636 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE); 3637 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF); 3638 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING); 3639 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER); 3640 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT); 3641 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT); 3642 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS); 3643 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT); 3644 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS); 3645 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT); 3646 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS); 3647 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL); 3648 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST); 3649 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL); 3650 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN); 3651 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED); 3652 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED); 3653 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED); 3654 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); 3655 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); 3656 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); 3657 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); 3658 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); 3659 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); 3660 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); 3661 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 3662 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 3663 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); 3664 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); 3665 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); 3666 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); 3667 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); 3668 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); 3669 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN); 3670 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI); 3671 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); 3672 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); 3673 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); 3674 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); 3675 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); 3676 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); 3677 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); 3678 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); 3679 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); 3680 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); 3681 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); 3682 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); 3683 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); 3684 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); 3685 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); 3686 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); 3687 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); 3688 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); 3689 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); 3690 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); 3691 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); 3692 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); 3693 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); 3694 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); 3695 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); 3696 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); 3697 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); 3698 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); 3699 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); 3700 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); 3701 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); 3702 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); 3703 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); 3704 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); 3705 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); 3706 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); 3707 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); 3708 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); 3709 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); 3710 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); 3711 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); 3712 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); 3713 MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY); 3714 } 3715 3716 /** @hide */ 3717 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 3718 outKeySet.addAll(MOVED_TO_GLOBAL); 3719 } 3720 3721 /** 3722 * Look up a name in the database. 3723 * @param resolver to access the database with 3724 * @param name to look up in the table 3725 * @return the corresponding value, or null if not present 3726 */ 3727 public static String getString(ContentResolver resolver, String name) { 3728 return getStringForUser(resolver, name, UserHandle.myUserId()); 3729 } 3730 3731 /** @hide */ 3732 public static String getStringForUser(ContentResolver resolver, String name, 3733 int userHandle) { 3734 if (MOVED_TO_GLOBAL.contains(name)) { 3735 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 3736 + " to android.provider.Settings.Global."); 3737 return Global.getStringForUser(resolver, name, userHandle); 3738 } 3739 3740 if (MOVED_TO_LOCK_SETTINGS.contains(name)) { 3741 synchronized (Secure.class) { 3742 if (sLockSettings == null) { 3743 sLockSettings = ILockSettings.Stub.asInterface( 3744 (IBinder) ServiceManager.getService("lock_settings")); 3745 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; 3746 } 3747 } 3748 if (sLockSettings != null && !sIsSystemProcess) { 3749 try { 3750 return sLockSettings.getString(name, "0", userHandle); 3751 } catch (RemoteException re) { 3752 // Fall through 3753 } 3754 } 3755 } 3756 3757 return sNameValueCache.getStringForUser(resolver, name, userHandle); 3758 } 3759 3760 /** 3761 * Store a name/value pair into the database. 3762 * @param resolver to access the database with 3763 * @param name to store 3764 * @param value to associate with the name 3765 * @return true if the value was set, false on database errors 3766 */ 3767 public static boolean putString(ContentResolver resolver, String name, String value) { 3768 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 3769 } 3770 3771 /** @hide */ 3772 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 3773 int userHandle) { 3774 if (LOCATION_MODE.equals(name)) { 3775 // HACK ALERT: temporary hack to work around b/10491283. 3776 // TODO: once b/10491283 fixed, remove this hack 3777 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle); 3778 } 3779 if (MOVED_TO_GLOBAL.contains(name)) { 3780 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 3781 + " to android.provider.Settings.Global"); 3782 return Global.putStringForUser(resolver, name, value, userHandle); 3783 } 3784 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 3785 } 3786 3787 /** 3788 * Construct the content URI for a particular name/value pair, 3789 * useful for monitoring changes with a ContentObserver. 3790 * @param name to look up in the table 3791 * @return the corresponding content URI, or null if not present 3792 */ 3793 public static Uri getUriFor(String name) { 3794 if (MOVED_TO_GLOBAL.contains(name)) { 3795 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 3796 + " to android.provider.Settings.Global, returning global URI."); 3797 return Global.getUriFor(Global.CONTENT_URI, name); 3798 } 3799 return getUriFor(CONTENT_URI, name); 3800 } 3801 3802 /** 3803 * Convenience function for retrieving a single secure settings value 3804 * as an integer. Note that internally setting values are always 3805 * stored as strings; this function converts the string to an integer 3806 * for you. The default value will be returned if the setting is 3807 * not defined or not an integer. 3808 * 3809 * @param cr The ContentResolver to access. 3810 * @param name The name of the setting to retrieve. 3811 * @param def Value to return if the setting is not defined. 3812 * 3813 * @return The setting's current value, or 'def' if it is not defined 3814 * or not a valid integer. 3815 */ 3816 public static int getInt(ContentResolver cr, String name, int def) { 3817 return getIntForUser(cr, name, def, UserHandle.myUserId()); 3818 } 3819 3820 /** @hide */ 3821 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 3822 if (LOCATION_MODE.equals(name)) { 3823 // HACK ALERT: temporary hack to work around b/10491283. 3824 // TODO: once b/10491283 fixed, remove this hack 3825 return getLocationModeForUser(cr, userHandle); 3826 } 3827 String v = getStringForUser(cr, name, userHandle); 3828 try { 3829 return v != null ? Integer.parseInt(v) : def; 3830 } catch (NumberFormatException e) { 3831 return def; 3832 } 3833 } 3834 3835 /** 3836 * Convenience function for retrieving a single secure settings value 3837 * as an integer. Note that internally setting values are always 3838 * stored as strings; this function converts the string to an integer 3839 * for you. 3840 * <p> 3841 * This version does not take a default value. If the setting has not 3842 * been set, or the string value is not a number, 3843 * it throws {@link SettingNotFoundException}. 3844 * 3845 * @param cr The ContentResolver to access. 3846 * @param name The name of the setting to retrieve. 3847 * 3848 * @throws SettingNotFoundException Thrown if a setting by the given 3849 * name can't be found or the setting value is not an integer. 3850 * 3851 * @return The setting's current value. 3852 */ 3853 public static int getInt(ContentResolver cr, String name) 3854 throws SettingNotFoundException { 3855 return getIntForUser(cr, name, UserHandle.myUserId()); 3856 } 3857 3858 /** @hide */ 3859 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 3860 throws SettingNotFoundException { 3861 if (LOCATION_MODE.equals(name)) { 3862 // HACK ALERT: temporary hack to work around b/10491283. 3863 // TODO: once b/10491283 fixed, remove this hack 3864 return getLocationModeForUser(cr, userHandle); 3865 } 3866 String v = getStringForUser(cr, name, userHandle); 3867 try { 3868 return Integer.parseInt(v); 3869 } catch (NumberFormatException e) { 3870 throw new SettingNotFoundException(name); 3871 } 3872 } 3873 3874 /** 3875 * Convenience function for updating a single settings value as an 3876 * integer. This will either create a new entry in the table if the 3877 * given name does not exist, or modify the value of the existing row 3878 * with that name. Note that internally setting values are always 3879 * stored as strings, so this function converts the given value to a 3880 * string before storing it. 3881 * 3882 * @param cr The ContentResolver to access. 3883 * @param name The name of the setting to modify. 3884 * @param value The new value for the setting. 3885 * @return true if the value was set, false on database errors 3886 */ 3887 public static boolean putInt(ContentResolver cr, String name, int value) { 3888 return putIntForUser(cr, name, value, UserHandle.myUserId()); 3889 } 3890 3891 /** @hide */ 3892 public static boolean putIntForUser(ContentResolver cr, String name, int value, 3893 int userHandle) { 3894 return putStringForUser(cr, name, Integer.toString(value), userHandle); 3895 } 3896 3897 /** 3898 * Convenience function for retrieving a single secure settings value 3899 * as a {@code long}. Note that internally setting values are always 3900 * stored as strings; this function converts the string to a {@code long} 3901 * for you. The default value will be returned if the setting is 3902 * not defined or not a {@code long}. 3903 * 3904 * @param cr The ContentResolver to access. 3905 * @param name The name of the setting to retrieve. 3906 * @param def Value to return if the setting is not defined. 3907 * 3908 * @return The setting's current value, or 'def' if it is not defined 3909 * or not a valid {@code long}. 3910 */ 3911 public static long getLong(ContentResolver cr, String name, long def) { 3912 return getLongForUser(cr, name, def, UserHandle.myUserId()); 3913 } 3914 3915 /** @hide */ 3916 public static long getLongForUser(ContentResolver cr, String name, long def, 3917 int userHandle) { 3918 String valString = getStringForUser(cr, name, userHandle); 3919 long value; 3920 try { 3921 value = valString != null ? Long.parseLong(valString) : def; 3922 } catch (NumberFormatException e) { 3923 value = def; 3924 } 3925 return value; 3926 } 3927 3928 /** 3929 * Convenience function for retrieving a single secure settings value 3930 * as a {@code long}. Note that internally setting values are always 3931 * stored as strings; this function converts the string to a {@code long} 3932 * for you. 3933 * <p> 3934 * This version does not take a default value. If the setting has not 3935 * been set, or the string value is not a number, 3936 * it throws {@link SettingNotFoundException}. 3937 * 3938 * @param cr The ContentResolver to access. 3939 * @param name The name of the setting to retrieve. 3940 * 3941 * @return The setting's current value. 3942 * @throws SettingNotFoundException Thrown if a setting by the given 3943 * name can't be found or the setting value is not an integer. 3944 */ 3945 public static long getLong(ContentResolver cr, String name) 3946 throws SettingNotFoundException { 3947 return getLongForUser(cr, name, UserHandle.myUserId()); 3948 } 3949 3950 /** @hide */ 3951 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 3952 throws SettingNotFoundException { 3953 String valString = getStringForUser(cr, name, userHandle); 3954 try { 3955 return Long.parseLong(valString); 3956 } catch (NumberFormatException e) { 3957 throw new SettingNotFoundException(name); 3958 } 3959 } 3960 3961 /** 3962 * Convenience function for updating a secure settings value as a long 3963 * integer. This will either create a new entry in the table if the 3964 * given name does not exist, or modify the value of the existing row 3965 * with that name. Note that internally setting values are always 3966 * stored as strings, so this function converts the given value to a 3967 * string before storing it. 3968 * 3969 * @param cr The ContentResolver to access. 3970 * @param name The name of the setting to modify. 3971 * @param value The new value for the setting. 3972 * @return true if the value was set, false on database errors 3973 */ 3974 public static boolean putLong(ContentResolver cr, String name, long value) { 3975 return putLongForUser(cr, name, value, UserHandle.myUserId()); 3976 } 3977 3978 /** @hide */ 3979 public static boolean putLongForUser(ContentResolver cr, String name, long value, 3980 int userHandle) { 3981 return putStringForUser(cr, name, Long.toString(value), userHandle); 3982 } 3983 3984 /** 3985 * Convenience function for retrieving a single secure settings value 3986 * as a floating point number. Note that internally setting values are 3987 * always stored as strings; this function converts the string to an 3988 * float for you. The default value will be returned if the setting 3989 * is not defined or not a valid float. 3990 * 3991 * @param cr The ContentResolver to access. 3992 * @param name The name of the setting to retrieve. 3993 * @param def Value to return if the setting is not defined. 3994 * 3995 * @return The setting's current value, or 'def' if it is not defined 3996 * or not a valid float. 3997 */ 3998 public static float getFloat(ContentResolver cr, String name, float def) { 3999 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 4000 } 4001 4002 /** @hide */ 4003 public static float getFloatForUser(ContentResolver cr, String name, float def, 4004 int userHandle) { 4005 String v = getStringForUser(cr, name, userHandle); 4006 try { 4007 return v != null ? Float.parseFloat(v) : def; 4008 } catch (NumberFormatException e) { 4009 return def; 4010 } 4011 } 4012 4013 /** 4014 * Convenience function for retrieving a single secure settings value 4015 * as a float. Note that internally setting values are always 4016 * stored as strings; this function converts the string to a float 4017 * for you. 4018 * <p> 4019 * This version does not take a default value. If the setting has not 4020 * been set, or the string value is not a number, 4021 * it throws {@link SettingNotFoundException}. 4022 * 4023 * @param cr The ContentResolver to access. 4024 * @param name The name of the setting to retrieve. 4025 * 4026 * @throws SettingNotFoundException Thrown if a setting by the given 4027 * name can't be found or the setting value is not a float. 4028 * 4029 * @return The setting's current value. 4030 */ 4031 public static float getFloat(ContentResolver cr, String name) 4032 throws SettingNotFoundException { 4033 return getFloatForUser(cr, name, UserHandle.myUserId()); 4034 } 4035 4036 /** @hide */ 4037 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 4038 throws SettingNotFoundException { 4039 String v = getStringForUser(cr, name, userHandle); 4040 if (v == null) { 4041 throw new SettingNotFoundException(name); 4042 } 4043 try { 4044 return Float.parseFloat(v); 4045 } catch (NumberFormatException e) { 4046 throw new SettingNotFoundException(name); 4047 } 4048 } 4049 4050 /** 4051 * Convenience function for updating a single settings value as a 4052 * floating point number. This will either create a new entry in the 4053 * table if the given name does not exist, or modify the value of the 4054 * existing row with that name. Note that internally setting values 4055 * are always stored as strings, so this function converts the given 4056 * value to a string before storing it. 4057 * 4058 * @param cr The ContentResolver to access. 4059 * @param name The name of the setting to modify. 4060 * @param value The new value for the setting. 4061 * @return true if the value was set, false on database errors 4062 */ 4063 public static boolean putFloat(ContentResolver cr, String name, float value) { 4064 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 4065 } 4066 4067 /** @hide */ 4068 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 4069 int userHandle) { 4070 return putStringForUser(cr, name, Float.toString(value), userHandle); 4071 } 4072 4073 /** 4074 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} 4075 * instead 4076 */ 4077 @Deprecated 4078 public static final String DEVELOPMENT_SETTINGS_ENABLED = 4079 Global.DEVELOPMENT_SETTINGS_ENABLED; 4080 4081 /** 4082 * When the user has enable the option to have a "bug report" command 4083 * in the power menu. 4084 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead 4085 * @hide 4086 */ 4087 @Deprecated 4088 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 4089 4090 /** 4091 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead 4092 */ 4093 @Deprecated 4094 public static final String ADB_ENABLED = Global.ADB_ENABLED; 4095 4096 /** 4097 * Setting to allow mock locations and location provider status to be injected into the 4098 * LocationManager service for testing purposes during application development. These 4099 * locations and status values override actual location and status information generated 4100 * by network, gps, or other location providers. 4101 */ 4102 public static final String ALLOW_MOCK_LOCATION = "mock_location"; 4103 4104 /** 4105 * A 64-bit number (as a hex string) that is randomly 4106 * generated when the user first sets up the device and should remain 4107 * constant for the lifetime of the user's device. The value may 4108 * change if a factory reset is performed on the device. 4109 * <p class="note"><strong>Note:</strong> When a device has <a 4110 * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a> 4111 * (available on certain devices running Android 4.2 or higher), each user appears as a 4112 * completely separate device, so the {@code ANDROID_ID} value is unique to each 4113 * user.</p> 4114 */ 4115 public static final String ANDROID_ID = "android_id"; 4116 4117 /** 4118 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 4119 */ 4120 @Deprecated 4121 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 4122 4123 /** 4124 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 4125 */ 4126 @Deprecated 4127 public static final String DATA_ROAMING = Global.DATA_ROAMING; 4128 4129 /** 4130 * Setting to record the input method used by default, holding the ID 4131 * of the desired method. 4132 */ 4133 public static final String DEFAULT_INPUT_METHOD = "default_input_method"; 4134 4135 /** 4136 * Setting to record the input method subtype used by default, holding the ID 4137 * of the desired method. 4138 */ 4139 public static final String SELECTED_INPUT_METHOD_SUBTYPE = 4140 "selected_input_method_subtype"; 4141 4142 /** 4143 * Setting to record the history of input method subtype, holding the pair of ID of IME 4144 * and its last used subtype. 4145 * @hide 4146 */ 4147 public static final String INPUT_METHODS_SUBTYPE_HISTORY = 4148 "input_methods_subtype_history"; 4149 4150 /** 4151 * Setting to record the visibility of input method selector 4152 */ 4153 public static final String INPUT_METHOD_SELECTOR_VISIBILITY = 4154 "input_method_selector_visibility"; 4155 4156 /** 4157 * The currently selected voice interaction service flattened ComponentName. 4158 * @hide 4159 */ 4160 public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; 4161 4162 /** 4163 * bluetooth HCI snoop log configuration 4164 * @hide 4165 */ 4166 public static final String BLUETOOTH_HCI_LOG = 4167 "bluetooth_hci_log"; 4168 4169 /** 4170 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 4171 */ 4172 @Deprecated 4173 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 4174 4175 /** 4176 * Whether the current user has been set up via setup wizard (0 = false, 1 = true) 4177 * @hide 4178 */ 4179 public static final String USER_SETUP_COMPLETE = "user_setup_complete"; 4180 4181 /** 4182 * List of input methods that are currently enabled. This is a string 4183 * containing the IDs of all enabled input methods, each ID separated 4184 * by ':'. 4185 */ 4186 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; 4187 4188 /** 4189 * List of system input methods that are currently disabled. This is a string 4190 * containing the IDs of all disabled input methods, each ID separated 4191 * by ':'. 4192 * @hide 4193 */ 4194 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; 4195 4196 /** 4197 * Whether to show the IME when a hard keyboard is connected. This is a boolean that 4198 * determines if the IME should be shown when a hard keyboard is attached. 4199 * @hide 4200 */ 4201 public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; 4202 4203 /** 4204 * Host name and port for global http proxy. Uses ':' seperator for 4205 * between host and port. 4206 * 4207 * @deprecated Use {@link Global#HTTP_PROXY} 4208 */ 4209 @Deprecated 4210 public static final String HTTP_PROXY = Global.HTTP_PROXY; 4211 4212 /** 4213 * Whether applications can be installed for this user via the system's 4214 * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism. 4215 * 4216 * <p>1 = permit app installation via the system package installer intent 4217 * <p>0 = do not allow use of the package installer 4218 */ 4219 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 4220 4221 /** 4222 * Comma-separated list of location providers that activities may access. Do not rely on 4223 * this value being present in settings.db or on ContentObserver notifications on the 4224 * corresponding Uri. 4225 * 4226 * @deprecated use {@link #LOCATION_MODE} and 4227 * {@link LocationManager#MODE_CHANGED_ACTION} (or 4228 * {@link LocationManager#PROVIDERS_CHANGED_ACTION}) 4229 */ 4230 @Deprecated 4231 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; 4232 4233 /** 4234 * The degree of location access enabled by the user. 4235 * <p> 4236 * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link 4237 * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link 4238 * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link 4239 * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location 4240 * modes that might be added in the future. 4241 * <p> 4242 * Note: do not rely on this value being present in settings.db or on ContentObserver 4243 * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} 4244 * to receive changes in this value. 4245 */ 4246 public static final String LOCATION_MODE = "location_mode"; 4247 4248 /** 4249 * Location access disabled. 4250 */ 4251 public static final int LOCATION_MODE_OFF = 0; 4252 /** 4253 * Network Location Provider disabled, but GPS and other sensors enabled. 4254 */ 4255 public static final int LOCATION_MODE_SENSORS_ONLY = 1; 4256 /** 4257 * Reduced power usage, such as limiting the number of GPS updates per hour. Requests 4258 * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to 4259 * {@link android.location.Criteria#POWER_MEDIUM}. 4260 */ 4261 public static final int LOCATION_MODE_BATTERY_SAVING = 2; 4262 /** 4263 * Best-effort location computation allowed. 4264 */ 4265 public static final int LOCATION_MODE_HIGH_ACCURACY = 3; 4266 4267 /** 4268 * A flag containing settings used for biometric weak 4269 * @hide 4270 */ 4271 @Deprecated 4272 public static final String LOCK_BIOMETRIC_WEAK_FLAGS = 4273 "lock_biometric_weak_flags"; 4274 4275 /** 4276 * Whether lock-to-app will lock the keyguard when exiting. 4277 * @hide 4278 */ 4279 public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked"; 4280 4281 /** 4282 * Whether autolock is enabled (0 = false, 1 = true) 4283 * 4284 * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security 4285 * level of the keyguard. 4286 */ 4287 @Deprecated 4288 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; 4289 4290 /** 4291 * Whether lock pattern is visible as user enters (0 = false, 1 = true) 4292 */ 4293 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 4294 4295 /** 4296 * Whether lock pattern will vibrate as user enters (0 = false, 1 = 4297 * true) 4298 * 4299 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the 4300 * lockscreen uses 4301 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. 4302 */ 4303 @Deprecated 4304 public static final String 4305 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; 4306 4307 /** 4308 * This preference allows the device to be locked given time after screen goes off, 4309 * subject to current DeviceAdmin policy limits. 4310 * @hide 4311 */ 4312 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; 4313 4314 4315 /** 4316 * This preference contains the string that shows for owner info on LockScreen. 4317 * @hide 4318 * @deprecated 4319 */ 4320 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; 4321 4322 /** 4323 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). 4324 * @hide 4325 */ 4326 @Deprecated 4327 public static final String LOCK_SCREEN_APPWIDGET_IDS = 4328 "lock_screen_appwidget_ids"; 4329 4330 /** 4331 * List of enrolled fingerprint identifiers (comma-delimited). 4332 * @hide 4333 */ 4334 public static final String USER_FINGERPRINT_IDS = "user_fingerprint_ids"; 4335 4336 /** 4337 * Id of the appwidget shown on the lock screen when appwidgets are disabled. 4338 * @hide 4339 */ 4340 @Deprecated 4341 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = 4342 "lock_screen_fallback_appwidget_id"; 4343 4344 /** 4345 * Index of the lockscreen appwidget to restore, -1 if none. 4346 * @hide 4347 */ 4348 @Deprecated 4349 public static final String LOCK_SCREEN_STICKY_APPWIDGET = 4350 "lock_screen_sticky_appwidget"; 4351 4352 /** 4353 * This preference enables showing the owner info on LockScreen. 4354 * @hide 4355 * @deprecated 4356 */ 4357 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = 4358 "lock_screen_owner_info_enabled"; 4359 4360 /** 4361 * When set by a user, allows notifications to be shown atop a securely locked screen 4362 * in their full "private" form (same as when the device is unlocked). 4363 * @hide 4364 */ 4365 public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = 4366 "lock_screen_allow_private_notifications"; 4367 4368 /** 4369 * Set by the system to track if the user needs to see the call to action for 4370 * the lockscreen notification policy. 4371 * @hide 4372 */ 4373 public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING = 4374 "show_note_about_notification_hiding"; 4375 4376 /** 4377 * Set to 1 by the system after trust agents have been initialized. 4378 * @hide 4379 */ 4380 public static final String TRUST_AGENTS_INITIALIZED = 4381 "trust_agents_initialized"; 4382 4383 /** 4384 * The Logging ID (a unique 64-bit value) as a hex string. 4385 * Used as a pseudonymous identifier for logging. 4386 * @deprecated This identifier is poorly initialized and has 4387 * many collisions. It should not be used. 4388 */ 4389 @Deprecated 4390 public static final String LOGGING_ID = "logging_id"; 4391 4392 /** 4393 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 4394 */ 4395 @Deprecated 4396 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 4397 4398 /** 4399 * No longer supported. 4400 */ 4401 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 4402 4403 /** 4404 * No longer supported. 4405 */ 4406 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 4407 4408 /** 4409 * No longer supported. 4410 */ 4411 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 4412 4413 /** 4414 * Settings classname to launch when Settings is clicked from All 4415 * Applications. Needed because of user testing between the old 4416 * and new Settings apps. 4417 */ 4418 // TODO: 881807 4419 public static final String SETTINGS_CLASSNAME = "settings_classname"; 4420 4421 /** 4422 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 4423 */ 4424 @Deprecated 4425 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 4426 4427 /** 4428 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 4429 */ 4430 @Deprecated 4431 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 4432 4433 /** 4434 * If accessibility is enabled. 4435 */ 4436 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; 4437 4438 /** 4439 * If touch exploration is enabled. 4440 */ 4441 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; 4442 4443 /** 4444 * List of the enabled accessibility providers. 4445 */ 4446 public static final String ENABLED_ACCESSIBILITY_SERVICES = 4447 "enabled_accessibility_services"; 4448 4449 /** 4450 * List of the accessibility services to which the user has granted 4451 * permission to put the device into touch exploration mode. 4452 * 4453 * @hide 4454 */ 4455 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = 4456 "touch_exploration_granted_accessibility_services"; 4457 4458 /** 4459 * Whether to speak passwords while in accessibility mode. 4460 */ 4461 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; 4462 4463 /** 4464 * Whether to draw text with high contrast while in accessibility mode. 4465 * 4466 * @hide 4467 */ 4468 public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED = 4469 "high_text_contrast_enabled"; 4470 4471 /** 4472 * If injection of accessibility enhancing JavaScript screen-reader 4473 * is enabled. 4474 * <p> 4475 * Note: The JavaScript based screen-reader is served by the 4476 * Google infrastructure and enable users with disabilities to 4477 * efficiently navigate in and explore web content. 4478 * </p> 4479 * <p> 4480 * This property represents a boolean value. 4481 * </p> 4482 * @hide 4483 */ 4484 public static final String ACCESSIBILITY_SCRIPT_INJECTION = 4485 "accessibility_script_injection"; 4486 4487 /** 4488 * The URL for the injected JavaScript based screen-reader used 4489 * for providing accessibility of content in WebView. 4490 * <p> 4491 * Note: The JavaScript based screen-reader is served by the 4492 * Google infrastructure and enable users with disabilities to 4493 * efficiently navigate in and explore web content. 4494 * </p> 4495 * <p> 4496 * This property represents a string value. 4497 * </p> 4498 * @hide 4499 */ 4500 public static final String ACCESSIBILITY_SCREEN_READER_URL = 4501 "accessibility_script_injection_url"; 4502 4503 /** 4504 * Key bindings for navigation in built-in accessibility support for web content. 4505 * <p> 4506 * Note: These key bindings are for the built-in accessibility navigation for 4507 * web content which is used as a fall back solution if JavaScript in a WebView 4508 * is not enabled or the user has not opted-in script injection from Google. 4509 * </p> 4510 * <p> 4511 * The bindings are separated by semi-colon. A binding is a mapping from 4512 * a key to a sequence of actions (for more details look at 4513 * android.webkit.AccessibilityInjector). A key is represented as the hexademical 4514 * string representation of an integer obtained from a meta state (optional) shifted 4515 * sixteen times left and bitwise ored with a key code. An action is represented 4516 * as a hexademical string representation of an integer where the first two digits 4517 * are navigation action index, the second, the third, and the fourth digit pairs 4518 * represent the action arguments. The separate actions in a binding are colon 4519 * separated. The key and the action sequence it maps to are separated by equals. 4520 * </p> 4521 * <p> 4522 * For example, the binding below maps the DPAD right button to traverse the 4523 * current navigation axis once without firing an accessibility event and to 4524 * perform the same traversal again but to fire an event: 4525 * <code> 4526 * 0x16=0x01000100:0x01000101; 4527 * </code> 4528 * </p> 4529 * <p> 4530 * The goal of this binding is to enable dynamic rebinding of keys to 4531 * navigation actions for web content without requiring a framework change. 4532 * </p> 4533 * <p> 4534 * This property represents a string value. 4535 * </p> 4536 * @hide 4537 */ 4538 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = 4539 "accessibility_web_content_key_bindings"; 4540 4541 /** 4542 * Setting that specifies whether the display magnification is enabled. 4543 * Display magnifications allows the user to zoom in the display content 4544 * and is targeted to low vision users. The current magnification scale 4545 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. 4546 * 4547 * @hide 4548 */ 4549 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = 4550 "accessibility_display_magnification_enabled"; 4551 4552 /** 4553 * Setting that specifies what the display magnification scale is. 4554 * Display magnifications allows the user to zoom in the display 4555 * content and is targeted to low vision users. Whether a display 4556 * magnification is performed is controlled by 4557 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 4558 * 4559 * @hide 4560 */ 4561 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = 4562 "accessibility_display_magnification_scale"; 4563 4564 /** 4565 * Setting that specifies whether the display magnification should be 4566 * automatically updated. If this fearture is enabled the system will 4567 * exit magnification mode or pan the viewport when a context change 4568 * occurs. For example, on staring a new activity or rotating the screen, 4569 * the system may zoom out so the user can see the new context he is in. 4570 * Another example is on showing a window that is not visible in the 4571 * magnified viewport the system may pan the viewport to make the window 4572 * the has popped up so the user knows that the context has changed. 4573 * Whether a screen magnification is performed is controlled by 4574 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 4575 * 4576 * @hide 4577 */ 4578 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = 4579 "accessibility_display_magnification_auto_update"; 4580 4581 /** 4582 * Setting that specifies whether timed text (captions) should be 4583 * displayed in video content. Text display properties are controlled by 4584 * the following settings: 4585 * <ul> 4586 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE} 4587 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR} 4588 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR} 4589 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR} 4590 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE} 4591 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE} 4592 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE} 4593 * </ul> 4594 * 4595 * @hide 4596 */ 4597 public static final String ACCESSIBILITY_CAPTIONING_ENABLED = 4598 "accessibility_captioning_enabled"; 4599 4600 /** 4601 * Setting that specifies the language for captions as a locale string, 4602 * e.g. en_US. 4603 * 4604 * @see java.util.Locale#toString 4605 * @hide 4606 */ 4607 public static final String ACCESSIBILITY_CAPTIONING_LOCALE = 4608 "accessibility_captioning_locale"; 4609 4610 /** 4611 * Integer property that specifies the preset style for captions, one 4612 * of: 4613 * <ul> 4614 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM} 4615 * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS} 4616 * </ul> 4617 * 4618 * @see java.util.Locale#toString 4619 * @hide 4620 */ 4621 public static final String ACCESSIBILITY_CAPTIONING_PRESET = 4622 "accessibility_captioning_preset"; 4623 4624 /** 4625 * Integer property that specifes the background color for captions as a 4626 * packed 32-bit color. 4627 * 4628 * @see android.graphics.Color#argb 4629 * @hide 4630 */ 4631 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR = 4632 "accessibility_captioning_background_color"; 4633 4634 /** 4635 * Integer property that specifes the foreground color for captions as a 4636 * packed 32-bit color. 4637 * 4638 * @see android.graphics.Color#argb 4639 * @hide 4640 */ 4641 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR = 4642 "accessibility_captioning_foreground_color"; 4643 4644 /** 4645 * Integer property that specifes the edge type for captions, one of: 4646 * <ul> 4647 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE} 4648 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE} 4649 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW} 4650 * </ul> 4651 * 4652 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR 4653 * @hide 4654 */ 4655 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE = 4656 "accessibility_captioning_edge_type"; 4657 4658 /** 4659 * Integer property that specifes the edge color for captions as a 4660 * packed 32-bit color. 4661 * 4662 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE 4663 * @see android.graphics.Color#argb 4664 * @hide 4665 */ 4666 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR = 4667 "accessibility_captioning_edge_color"; 4668 4669 /** 4670 * Integer property that specifes the window color for captions as a 4671 * packed 32-bit color. 4672 * 4673 * @see android.graphics.Color#argb 4674 * @hide 4675 */ 4676 public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR = 4677 "accessibility_captioning_window_color"; 4678 4679 /** 4680 * String property that specifies the typeface for captions, one of: 4681 * <ul> 4682 * <li>DEFAULT 4683 * <li>MONOSPACE 4684 * <li>SANS_SERIF 4685 * <li>SERIF 4686 * </ul> 4687 * 4688 * @see android.graphics.Typeface 4689 * @hide 4690 */ 4691 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE = 4692 "accessibility_captioning_typeface"; 4693 4694 /** 4695 * Floating point property that specifies font scaling for captions. 4696 * 4697 * @hide 4698 */ 4699 public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE = 4700 "accessibility_captioning_font_scale"; 4701 4702 /** 4703 * Setting that specifies whether display color inversion is enabled. 4704 */ 4705 public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = 4706 "accessibility_display_inversion_enabled"; 4707 4708 /** 4709 * Setting that specifies whether display color space adjustment is 4710 * enabled. 4711 * 4712 * @hide 4713 */ 4714 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED = 4715 "accessibility_display_daltonizer_enabled"; 4716 4717 /** 4718 * Integer property that specifies the type of color space adjustment to 4719 * perform. Valid values are defined in AccessibilityManager. 4720 * 4721 * @hide 4722 */ 4723 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER = 4724 "accessibility_display_daltonizer"; 4725 4726 /** 4727 * The timout for considering a press to be a long press in milliseconds. 4728 * @hide 4729 */ 4730 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; 4731 4732 /** 4733 * List of the enabled print services. 4734 * @hide 4735 */ 4736 public static final String ENABLED_PRINT_SERVICES = 4737 "enabled_print_services"; 4738 4739 /** 4740 * List of the system print services we enabled on first boot. On 4741 * first boot we enable all system, i.e. bundled print services, 4742 * once, so they work out-of-the-box. 4743 * @hide 4744 */ 4745 public static final String ENABLED_ON_FIRST_BOOT_SYSTEM_PRINT_SERVICES = 4746 "enabled_on_first_boot_system_print_services"; 4747 4748 /** 4749 * Setting to always use the default text-to-speech settings regardless 4750 * of the application settings. 4751 * 1 = override application settings, 4752 * 0 = use application settings (if specified). 4753 * 4754 * @deprecated The value of this setting is no longer respected by 4755 * the framework text to speech APIs as of the Ice Cream Sandwich release. 4756 */ 4757 @Deprecated 4758 public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; 4759 4760 /** 4761 * Default text-to-speech engine speech rate. 100 = 1x 4762 */ 4763 public static final String TTS_DEFAULT_RATE = "tts_default_rate"; 4764 4765 /** 4766 * Default text-to-speech engine pitch. 100 = 1x 4767 */ 4768 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; 4769 4770 /** 4771 * Default text-to-speech engine. 4772 */ 4773 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; 4774 4775 /** 4776 * Default text-to-speech language. 4777 * 4778 * @deprecated this setting is no longer in use, as of the Ice Cream 4779 * Sandwich release. Apps should never need to read this setting directly, 4780 * instead can query the TextToSpeech framework classes for the default 4781 * locale. {@link TextToSpeech#getLanguage()}. 4782 */ 4783 @Deprecated 4784 public static final String TTS_DEFAULT_LANG = "tts_default_lang"; 4785 4786 /** 4787 * Default text-to-speech country. 4788 * 4789 * @deprecated this setting is no longer in use, as of the Ice Cream 4790 * Sandwich release. Apps should never need to read this setting directly, 4791 * instead can query the TextToSpeech framework classes for the default 4792 * locale. {@link TextToSpeech#getLanguage()}. 4793 */ 4794 @Deprecated 4795 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; 4796 4797 /** 4798 * Default text-to-speech locale variant. 4799 * 4800 * @deprecated this setting is no longer in use, as of the Ice Cream 4801 * Sandwich release. Apps should never need to read this setting directly, 4802 * instead can query the TextToSpeech framework classes for the 4803 * locale that is in use {@link TextToSpeech#getLanguage()}. 4804 */ 4805 @Deprecated 4806 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; 4807 4808 /** 4809 * Stores the default tts locales on a per engine basis. Stored as 4810 * a comma seperated list of values, each value being of the form 4811 * {@code engine_name:locale} for example, 4812 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This 4813 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and 4814 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this 4815 * setting directly, and can query the TextToSpeech framework classes 4816 * for the locale that is in use. 4817 * 4818 * @hide 4819 */ 4820 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; 4821 4822 /** 4823 * Space delimited list of plugin packages that are enabled. 4824 */ 4825 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; 4826 4827 /** 4828 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} 4829 * instead. 4830 */ 4831 @Deprecated 4832 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4833 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 4834 4835 /** 4836 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} 4837 * instead. 4838 */ 4839 @Deprecated 4840 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 4841 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 4842 4843 /** 4844 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 4845 * instead. 4846 */ 4847 @Deprecated 4848 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = 4849 Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 4850 4851 /** 4852 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} 4853 * instead. 4854 */ 4855 @Deprecated 4856 public static final String WIFI_ON = Global.WIFI_ON; 4857 4858 /** 4859 * The acceptable packet loss percentage (range 0 - 100) before trying 4860 * another AP on the same network. 4861 * @deprecated This setting is not used. 4862 */ 4863 @Deprecated 4864 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 4865 "wifi_watchdog_acceptable_packet_loss_percentage"; 4866 4867 /** 4868 * The number of access points required for a network in order for the 4869 * watchdog to monitor it. 4870 * @deprecated This setting is not used. 4871 */ 4872 @Deprecated 4873 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; 4874 4875 /** 4876 * The delay between background checks. 4877 * @deprecated This setting is not used. 4878 */ 4879 @Deprecated 4880 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 4881 "wifi_watchdog_background_check_delay_ms"; 4882 4883 /** 4884 * Whether the Wi-Fi watchdog is enabled for background checking even 4885 * after it thinks the user has connected to a good access point. 4886 * @deprecated This setting is not used. 4887 */ 4888 @Deprecated 4889 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 4890 "wifi_watchdog_background_check_enabled"; 4891 4892 /** 4893 * The timeout for a background ping 4894 * @deprecated This setting is not used. 4895 */ 4896 @Deprecated 4897 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 4898 "wifi_watchdog_background_check_timeout_ms"; 4899 4900 /** 4901 * The number of initial pings to perform that *may* be ignored if they 4902 * fail. Again, if these fail, they will *not* be used in packet loss 4903 * calculation. For example, one network always seemed to time out for 4904 * the first couple pings, so this is set to 3 by default. 4905 * @deprecated This setting is not used. 4906 */ 4907 @Deprecated 4908 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 4909 "wifi_watchdog_initial_ignored_ping_count"; 4910 4911 /** 4912 * The maximum number of access points (per network) to attempt to test. 4913 * If this number is reached, the watchdog will no longer monitor the 4914 * initial connection state for the network. This is a safeguard for 4915 * networks containing multiple APs whose DNS does not respond to pings. 4916 * @deprecated This setting is not used. 4917 */ 4918 @Deprecated 4919 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; 4920 4921 /** 4922 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 4923 */ 4924 @Deprecated 4925 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 4926 4927 /** 4928 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. 4929 * @deprecated This setting is not used. 4930 */ 4931 @Deprecated 4932 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; 4933 4934 /** 4935 * The number of pings to test if an access point is a good connection. 4936 * @deprecated This setting is not used. 4937 */ 4938 @Deprecated 4939 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; 4940 4941 /** 4942 * The delay between pings. 4943 * @deprecated This setting is not used. 4944 */ 4945 @Deprecated 4946 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; 4947 4948 /** 4949 * The timeout per ping. 4950 * @deprecated This setting is not used. 4951 */ 4952 @Deprecated 4953 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; 4954 4955 /** 4956 * @deprecated Use 4957 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 4958 */ 4959 @Deprecated 4960 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 4961 4962 /** 4963 * @deprecated Use 4964 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 4965 */ 4966 @Deprecated 4967 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 4968 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 4969 4970 /** 4971 * The number of milliseconds to hold on to a PendingIntent based request. This delay gives 4972 * the receivers of the PendingIntent an opportunity to make a new network request before 4973 * the Network satisfying the request is potentially removed. 4974 * 4975 * @hide 4976 */ 4977 public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS = 4978 "connectivity_release_pending_intent_delay_ms"; 4979 4980 /** 4981 * Whether background data usage is allowed. 4982 * 4983 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, 4984 * availability of background data depends on several 4985 * combined factors. When background data is unavailable, 4986 * {@link ConnectivityManager#getActiveNetworkInfo()} will 4987 * now appear disconnected. 4988 */ 4989 @Deprecated 4990 public static final String BACKGROUND_DATA = "background_data"; 4991 4992 /** 4993 * Origins for which browsers should allow geolocation by default. 4994 * The value is a space-separated list of origins. 4995 */ 4996 public static final String ALLOWED_GEOLOCATION_ORIGINS 4997 = "allowed_geolocation_origins"; 4998 4999 /** 5000 * The preferred TTY mode 0 = TTy Off, CDMA default 5001 * 1 = TTY Full 5002 * 2 = TTY HCO 5003 * 3 = TTY VCO 5004 * @hide 5005 */ 5006 public static final String PREFERRED_TTY_MODE = 5007 "preferred_tty_mode"; 5008 5009 /** 5010 * Whether the enhanced voice privacy mode is enabled. 5011 * 0 = normal voice privacy 5012 * 1 = enhanced voice privacy 5013 * @hide 5014 */ 5015 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; 5016 5017 /** 5018 * Whether the TTY mode mode is enabled. 5019 * 0 = disabled 5020 * 1 = enabled 5021 * @hide 5022 */ 5023 public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; 5024 5025 /** 5026 * Controls whether settings backup is enabled. 5027 * Type: int ( 0 = disabled, 1 = enabled ) 5028 * @hide 5029 */ 5030 public static final String BACKUP_ENABLED = "backup_enabled"; 5031 5032 /** 5033 * Controls whether application data is automatically restored from backup 5034 * at install time. 5035 * Type: int ( 0 = disabled, 1 = enabled ) 5036 * @hide 5037 */ 5038 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; 5039 5040 /** 5041 * Indicates whether settings backup has been fully provisioned. 5042 * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) 5043 * @hide 5044 */ 5045 public static final String BACKUP_PROVISIONED = "backup_provisioned"; 5046 5047 /** 5048 * Component of the transport to use for backup/restore. 5049 * @hide 5050 */ 5051 public static final String BACKUP_TRANSPORT = "backup_transport"; 5052 5053 /** 5054 * Version for which the setup wizard was last shown. Bumped for 5055 * each release when there is new setup information to show. 5056 * @hide 5057 */ 5058 public static final String LAST_SETUP_SHOWN = "last_setup_shown"; 5059 5060 /** 5061 * The interval in milliseconds after which Wi-Fi is considered idle. 5062 * When idle, it is possible for the device to be switched from Wi-Fi to 5063 * the mobile data network. 5064 * @hide 5065 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} 5066 * instead. 5067 */ 5068 @Deprecated 5069 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; 5070 5071 /** 5072 * The global search provider chosen by the user (if multiple global 5073 * search providers are installed). This will be the provider returned 5074 * by {@link SearchManager#getGlobalSearchActivity()} if it's still 5075 * installed. This setting is stored as a flattened component name as 5076 * per {@link ComponentName#flattenToString()}. 5077 * 5078 * @hide 5079 */ 5080 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY = 5081 "search_global_search_activity"; 5082 5083 /** 5084 * The number of promoted sources in GlobalSearch. 5085 * @hide 5086 */ 5087 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources"; 5088 /** 5089 * The maximum number of suggestions returned by GlobalSearch. 5090 * @hide 5091 */ 5092 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display"; 5093 /** 5094 * The number of suggestions GlobalSearch will ask each non-web search source for. 5095 * @hide 5096 */ 5097 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source"; 5098 /** 5099 * The number of suggestions the GlobalSearch will ask the web search source for. 5100 * @hide 5101 */ 5102 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT = 5103 "search_web_results_override_limit"; 5104 /** 5105 * The number of milliseconds that GlobalSearch will wait for suggestions from 5106 * promoted sources before continuing with all other sources. 5107 * @hide 5108 */ 5109 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS = 5110 "search_promoted_source_deadline_millis"; 5111 /** 5112 * The number of milliseconds before GlobalSearch aborts search suggesiton queries. 5113 * @hide 5114 */ 5115 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis"; 5116 /** 5117 * The maximum number of milliseconds that GlobalSearch shows the previous results 5118 * after receiving a new query. 5119 * @hide 5120 */ 5121 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis"; 5122 /** 5123 * The maximum age of log data used for shortcuts in GlobalSearch. 5124 * @hide 5125 */ 5126 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis"; 5127 /** 5128 * The maximum age of log data used for source ranking in GlobalSearch. 5129 * @hide 5130 */ 5131 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS = 5132 "search_max_source_event_age_millis"; 5133 /** 5134 * The minimum number of impressions needed to rank a source in GlobalSearch. 5135 * @hide 5136 */ 5137 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING = 5138 "search_min_impressions_for_source_ranking"; 5139 /** 5140 * The minimum number of clicks needed to rank a source in GlobalSearch. 5141 * @hide 5142 */ 5143 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING = 5144 "search_min_clicks_for_source_ranking"; 5145 /** 5146 * The maximum number of shortcuts shown by GlobalSearch. 5147 * @hide 5148 */ 5149 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned"; 5150 /** 5151 * The size of the core thread pool for suggestion queries in GlobalSearch. 5152 * @hide 5153 */ 5154 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE = 5155 "search_query_thread_core_pool_size"; 5156 /** 5157 * The maximum size of the thread pool for suggestion queries in GlobalSearch. 5158 * @hide 5159 */ 5160 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE = 5161 "search_query_thread_max_pool_size"; 5162 /** 5163 * The size of the core thread pool for shortcut refreshing in GlobalSearch. 5164 * @hide 5165 */ 5166 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE = 5167 "search_shortcut_refresh_core_pool_size"; 5168 /** 5169 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch. 5170 * @hide 5171 */ 5172 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE = 5173 "search_shortcut_refresh_max_pool_size"; 5174 /** 5175 * The maximun time that excess threads in the GlobalSeach thread pools will 5176 * wait before terminating. 5177 * @hide 5178 */ 5179 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS = 5180 "search_thread_keepalive_seconds"; 5181 /** 5182 * The maximum number of concurrent suggestion queries to each source. 5183 * @hide 5184 */ 5185 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = 5186 "search_per_source_concurrent_query_limit"; 5187 5188 /** 5189 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true) 5190 * @hide 5191 */ 5192 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; 5193 5194 /** 5195 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true) 5196 * @hide 5197 */ 5198 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart"; 5199 5200 /** 5201 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true) 5202 * @hide 5203 */ 5204 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt"; 5205 5206 /** 5207 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true) 5208 * @hide 5209 */ 5210 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled"; 5211 5212 /** 5213 * If nonzero, ANRs in invisible background processes bring up a dialog. 5214 * Otherwise, the process will be silently killed. 5215 * @hide 5216 */ 5217 public static final String ANR_SHOW_BACKGROUND = "anr_show_background"; 5218 5219 /** 5220 * The {@link ComponentName} string of the service to be used as the voice recognition 5221 * service. 5222 * 5223 * @hide 5224 */ 5225 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service"; 5226 5227 /** 5228 * Stores whether an user has consented to have apps verified through PAM. 5229 * The value is boolean (1 or 0). 5230 * 5231 * @hide 5232 */ 5233 public static final String PACKAGE_VERIFIER_USER_CONSENT = 5234 "package_verifier_user_consent"; 5235 5236 /** 5237 * The {@link ComponentName} string of the selected spell checker service which is 5238 * one of the services managed by the text service manager. 5239 * 5240 * @hide 5241 */ 5242 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker"; 5243 5244 /** 5245 * The {@link ComponentName} string of the selected subtype of the selected spell checker 5246 * service which is one of the services managed by the text service manager. 5247 * 5248 * @hide 5249 */ 5250 public static final String SELECTED_SPELL_CHECKER_SUBTYPE = 5251 "selected_spell_checker_subtype"; 5252 5253 /** 5254 * The {@link ComponentName} string whether spell checker is enabled or not. 5255 * 5256 * @hide 5257 */ 5258 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled"; 5259 5260 /** 5261 * What happens when the user presses the Power button while in-call 5262 * and the screen is on.<br/> 5263 * <b>Values:</b><br/> 5264 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/> 5265 * 2 - The Power button hangs up the current call.<br/> 5266 * 5267 * @hide 5268 */ 5269 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; 5270 5271 /** 5272 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". 5273 * @hide 5274 */ 5275 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1; 5276 5277 /** 5278 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up". 5279 * @hide 5280 */ 5281 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2; 5282 5283 /** 5284 * INCALL_POWER_BUTTON_BEHAVIOR default value. 5285 * @hide 5286 */ 5287 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT = 5288 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF; 5289 5290 /** 5291 * Whether the device should wake when the wake gesture sensor detects motion. 5292 * @hide 5293 */ 5294 public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled"; 5295 5296 /** 5297 * Whether the device should doze if configured. 5298 * @hide 5299 */ 5300 public static final String DOZE_ENABLED = "doze_enabled"; 5301 5302 /** 5303 * The current night mode that has been selected by the user. Owned 5304 * and controlled by UiModeManagerService. Constants are as per 5305 * UiModeManager. 5306 * @hide 5307 */ 5308 public static final String UI_NIGHT_MODE = "ui_night_mode"; 5309 5310 /** 5311 * Whether screensavers are enabled. 5312 * @hide 5313 */ 5314 public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; 5315 5316 /** 5317 * The user's chosen screensaver components. 5318 * 5319 * These will be launched by the PhoneWindowManager after a timeout when not on 5320 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). 5321 * @hide 5322 */ 5323 public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; 5324 5325 /** 5326 * If screensavers are enabled, whether the screensaver should be automatically launched 5327 * when the device is inserted into a (desk) dock. 5328 * @hide 5329 */ 5330 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; 5331 5332 /** 5333 * If screensavers are enabled, whether the screensaver should be automatically launched 5334 * when the screen times out when not on battery. 5335 * @hide 5336 */ 5337 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; 5338 5339 /** 5340 * If screensavers are enabled, the default screensaver component. 5341 * @hide 5342 */ 5343 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; 5344 5345 /** 5346 * The default NFC payment component 5347 * @hide 5348 */ 5349 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component"; 5350 5351 /** 5352 * Whether NFC payment is handled by the foreground application or a default. 5353 * @hide 5354 */ 5355 public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground"; 5356 5357 /** 5358 * Specifies the package name currently configured to be the primary sms application 5359 * @hide 5360 */ 5361 public static final String SMS_DEFAULT_APPLICATION = "sms_default_application"; 5362 5363 /** 5364 * Specifies the package name currently configured to be the default dialer application 5365 * @hide 5366 */ 5367 public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application"; 5368 5369 /** 5370 * Specifies the package name currently configured to be the emergency assistance application 5371 * 5372 * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE 5373 * 5374 * @hide 5375 */ 5376 public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application"; 5377 5378 /** 5379 * Names of the packages that the current user has explicitly allowed to 5380 * see all of the user's notifications, separated by ':'. 5381 * 5382 * @hide 5383 */ 5384 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners"; 5385 5386 /** 5387 * @hide 5388 */ 5389 public static final String ENABLED_CONDITION_PROVIDERS = "enabled_condition_providers"; 5390 5391 /** @hide */ 5392 public static final String BAR_SERVICE_COMPONENT = "bar_service_component"; 5393 5394 /** @hide */ 5395 public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT 5396 = "volume_controller_service_component"; 5397 5398 /** @hide */ 5399 public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations"; 5400 5401 /** 5402 * This is the query URI for finding a print service to install. 5403 * 5404 * @hide 5405 */ 5406 public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri"; 5407 5408 /** 5409 * This is the query URI for finding a NFC payment service to install. 5410 * 5411 * @hide 5412 */ 5413 public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri"; 5414 5415 /** 5416 * If enabled, apps should try to skip any introductory hints on first launch. This might 5417 * apply to users that are already familiar with the environment or temporary users. 5418 * <p> 5419 * Type : int (0 to show hints, 1 to skip showing hints) 5420 */ 5421 public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints"; 5422 5423 /** 5424 * Persisted playback time after a user confirmation of an unsafe volume level. 5425 * 5426 * @hide 5427 */ 5428 public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms"; 5429 5430 /** 5431 * This preference enables notification display on the lockscreen. 5432 * @hide 5433 */ 5434 public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = 5435 "lock_screen_show_notifications"; 5436 5437 /** 5438 * List of TV inputs that are currently hidden. This is a string 5439 * containing the IDs of all hidden TV inputs. Each ID is encoded by 5440 * {@link android.net.Uri#encode(String)} and separated by ':'. 5441 * @hide 5442 */ 5443 public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs"; 5444 5445 /** 5446 * List of custom TV input labels. This is a string containing <TV input id, custom name> 5447 * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)} 5448 * and separated by ','. Each pair is separated by ':'. 5449 * @hide 5450 */ 5451 public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels"; 5452 5453 /** 5454 * Whether automatic routing of system audio to USB audio peripheral is disabled. 5455 * The value is boolean (1 or 0), where 1 means automatic routing is disabled, 5456 * and 0 means automatic routing is enabled. 5457 * 5458 * @hide 5459 */ 5460 public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED = 5461 "usb_audio_automatic_routing_disabled"; 5462 5463 /** 5464 * The timeout in milliseconds before the device fully goes to sleep after 5465 * a period of inactivity. This value sets an upper bound on how long the device 5466 * will stay awake or dreaming without user activity. It should generally 5467 * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device 5468 * will sleep before it ever has a chance to dream. 5469 * <p> 5470 * Use -1 to disable this timeout. 5471 * </p> 5472 * 5473 * @hide 5474 */ 5475 public static final String SLEEP_TIMEOUT = "sleep_timeout"; 5476 5477 /** 5478 * Duration in milliseconds that an app should be inactive before it is considered idle. 5479 * <p/>Type: Long 5480 * @hide 5481 */ 5482 public static final String APP_IDLE_DURATION = "app_idle_duration"; 5483 5484 /** 5485 * This are the settings to be backed up. 5486 * 5487 * NOTE: Settings are backed up and restored in the order they appear 5488 * in this array. If you have one setting depending on another, 5489 * make sure that they are ordered appropriately. 5490 * 5491 * @hide 5492 */ 5493 public static final String[] SETTINGS_TO_BACKUP = { 5494 BUGREPORT_IN_POWER_MENU, // moved to global 5495 ALLOW_MOCK_LOCATION, 5496 PARENTAL_CONTROL_ENABLED, 5497 PARENTAL_CONTROL_REDIRECT_URL, 5498 USB_MASS_STORAGE_ENABLED, // moved to global 5499 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 5500 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 5501 ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, 5502 ACCESSIBILITY_SCRIPT_INJECTION, 5503 BACKUP_AUTO_RESTORE, 5504 ENABLED_ACCESSIBILITY_SERVICES, 5505 ENABLED_NOTIFICATION_LISTENERS, 5506 ENABLED_INPUT_METHODS, 5507 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, 5508 TOUCH_EXPLORATION_ENABLED, 5509 ACCESSIBILITY_ENABLED, 5510 ACCESSIBILITY_SPEAK_PASSWORD, 5511 ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, 5512 ACCESSIBILITY_CAPTIONING_ENABLED, 5513 ACCESSIBILITY_CAPTIONING_LOCALE, 5514 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, 5515 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, 5516 ACCESSIBILITY_CAPTIONING_EDGE_TYPE, 5517 ACCESSIBILITY_CAPTIONING_EDGE_COLOR, 5518 ACCESSIBILITY_CAPTIONING_TYPEFACE, 5519 ACCESSIBILITY_CAPTIONING_FONT_SCALE, 5520 TTS_USE_DEFAULTS, 5521 TTS_DEFAULT_RATE, 5522 TTS_DEFAULT_PITCH, 5523 TTS_DEFAULT_SYNTH, 5524 TTS_DEFAULT_LANG, 5525 TTS_DEFAULT_COUNTRY, 5526 TTS_ENABLED_PLUGINS, 5527 TTS_DEFAULT_LOCALE, 5528 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global 5529 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global 5530 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global 5531 SELECTED_SPELL_CHECKER, 5532 SELECTED_SPELL_CHECKER_SUBTYPE, 5533 SPELL_CHECKER_ENABLED, 5534 MOUNT_PLAY_NOTIFICATION_SND, 5535 MOUNT_UMS_AUTOSTART, 5536 MOUNT_UMS_PROMPT, 5537 MOUNT_UMS_NOTIFY_ENABLED, 5538 UI_NIGHT_MODE, 5539 SLEEP_TIMEOUT 5540 }; 5541 5542 /** 5543 * These entries are considered common between the personal and the managed profile, 5544 * since the managed profile doesn't get to change them. 5545 */ 5546 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 5547 5548 static { 5549 CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED); 5550 CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION); 5551 CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS); 5552 CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD); 5553 CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES); 5554 CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS); 5555 CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); 5556 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED); 5557 CLONE_TO_MANAGED_PROFILE.add(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS); 5558 CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE); 5559 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER); 5560 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE); 5561 } 5562 5563 /** @hide */ 5564 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 5565 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 5566 } 5567 5568 /** 5569 * Helper method for determining if a location provider is enabled. 5570 * 5571 * @param cr the content resolver to use 5572 * @param provider the location provider to query 5573 * @return true if the provider is enabled 5574 * 5575 * @deprecated use {@link #LOCATION_MODE} or 5576 * {@link LocationManager#isProviderEnabled(String)} 5577 */ 5578 @Deprecated 5579 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { 5580 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); 5581 } 5582 5583 /** 5584 * Helper method for determining if a location provider is enabled. 5585 * @param cr the content resolver to use 5586 * @param provider the location provider to query 5587 * @param userId the userId to query 5588 * @return true if the provider is enabled 5589 * @deprecated use {@link #LOCATION_MODE} or 5590 * {@link LocationManager#isProviderEnabled(String)} 5591 * @hide 5592 */ 5593 @Deprecated 5594 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { 5595 String allowedProviders = Settings.Secure.getStringForUser(cr, 5596 LOCATION_PROVIDERS_ALLOWED, userId); 5597 return TextUtils.delimitedStringContains(allowedProviders, ',', provider); 5598 } 5599 5600 /** 5601 * Thread-safe method for enabling or disabling a single location provider. 5602 * @param cr the content resolver to use 5603 * @param provider the location provider to enable or disable 5604 * @param enabled true if the provider should be enabled 5605 * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE} 5606 */ 5607 @Deprecated 5608 public static final void setLocationProviderEnabled(ContentResolver cr, 5609 String provider, boolean enabled) { 5610 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); 5611 } 5612 5613 /** 5614 * Thread-safe method for enabling or disabling a single location provider. 5615 * 5616 * @param cr the content resolver to use 5617 * @param provider the location provider to enable or disable 5618 * @param enabled true if the provider should be enabled 5619 * @param userId the userId for which to enable/disable providers 5620 * @return true if the value was set, false on database errors 5621 * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and 5622 * {@link #LOCATION_MODE} 5623 * @hide 5624 */ 5625 @Deprecated 5626 public static final boolean setLocationProviderEnabledForUser(ContentResolver cr, 5627 String provider, boolean enabled, int userId) { 5628 synchronized (mLocationSettingsLock) { 5629 // to ensure thread safety, we write the provider name with a '+' or '-' 5630 // and let the SettingsProvider handle it rather than reading and modifying 5631 // the list of enabled providers. 5632 if (enabled) { 5633 provider = "+" + provider; 5634 } else { 5635 provider = "-" + provider; 5636 } 5637 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, 5638 userId); 5639 } 5640 } 5641 5642 /** 5643 * Thread-safe method for setting the location mode to one of 5644 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 5645 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. 5646 * 5647 * @param cr the content resolver to use 5648 * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} 5649 * @param userId the userId for which to change mode 5650 * @return true if the value was set, false on database errors 5651 * 5652 * @throws IllegalArgumentException if mode is not one of the supported values 5653 */ 5654 private static final boolean setLocationModeForUser(ContentResolver cr, int mode, 5655 int userId) { 5656 synchronized (mLocationSettingsLock) { 5657 boolean gps = false; 5658 boolean network = false; 5659 switch (mode) { 5660 case LOCATION_MODE_OFF: 5661 break; 5662 case LOCATION_MODE_SENSORS_ONLY: 5663 gps = true; 5664 break; 5665 case LOCATION_MODE_BATTERY_SAVING: 5666 network = true; 5667 break; 5668 case LOCATION_MODE_HIGH_ACCURACY: 5669 gps = true; 5670 network = true; 5671 break; 5672 default: 5673 throw new IllegalArgumentException("Invalid location mode: " + mode); 5674 } 5675 // Note it's important that we set the NLP mode first. The Google implementation 5676 // of NLP clears its NLP consent setting any time it receives a 5677 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also, 5678 // it shows an NLP consent dialog any time it receives the broadcast, NLP is 5679 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first, 5680 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting, 5681 // and 3) the receiver happened to complete before we enabled NLP, then the Google 5682 // NLP would detect the attempt to enable NLP and show a redundant NLP consent 5683 // dialog. Then the people who wrote the setup wizard would be sad. 5684 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser( 5685 cr, LocationManager.NETWORK_PROVIDER, network, userId); 5686 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser( 5687 cr, LocationManager.GPS_PROVIDER, gps, userId); 5688 return gpsSuccess && nlpSuccess; 5689 } 5690 } 5691 5692 /** 5693 * Thread-safe method for reading the location mode, returns one of 5694 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 5695 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. 5696 * 5697 * @param cr the content resolver to use 5698 * @param userId the userId for which to read the mode 5699 * @return the location mode 5700 */ 5701 private static final int getLocationModeForUser(ContentResolver cr, int userId) { 5702 synchronized (mLocationSettingsLock) { 5703 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( 5704 cr, LocationManager.GPS_PROVIDER, userId); 5705 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( 5706 cr, LocationManager.NETWORK_PROVIDER, userId); 5707 if (gpsEnabled && networkEnabled) { 5708 return LOCATION_MODE_HIGH_ACCURACY; 5709 } else if (gpsEnabled) { 5710 return LOCATION_MODE_SENSORS_ONLY; 5711 } else if (networkEnabled) { 5712 return LOCATION_MODE_BATTERY_SAVING; 5713 } else { 5714 return LOCATION_MODE_OFF; 5715 } 5716 } 5717 } 5718 } 5719 5720 /** 5721 * Global system settings, containing preferences that always apply identically 5722 * to all defined users. Applications can read these but are not allowed to write; 5723 * like the "Secure" settings, these are for preferences that the user must 5724 * explicitly modify through the system UI or specialized APIs for those values. 5725 */ 5726 public static final class Global extends NameValueTable { 5727 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; 5728 5729 /** 5730 * The content:// style URL for global secure settings items. Not public. 5731 */ 5732 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); 5733 5734 /** 5735 * Whether users are allowed to add more users or guest from lockscreen. 5736 * <p> 5737 * Type: int 5738 * @hide 5739 */ 5740 public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked"; 5741 5742 /** 5743 * Setting whether the global gesture for enabling accessibility is enabled. 5744 * If this gesture is enabled the user will be able to perfrom it to enable 5745 * the accessibility state without visiting the settings app. 5746 * @hide 5747 */ 5748 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = 5749 "enable_accessibility_global_gesture_enabled"; 5750 5751 /** 5752 * Whether Airplane Mode is on. 5753 */ 5754 public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; 5755 5756 /** 5757 * Whether Theater Mode is on. 5758 * {@hide} 5759 */ 5760 @SystemApi 5761 public static final String THEATER_MODE_ON = "theater_mode_on"; 5762 5763 /** 5764 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. 5765 */ 5766 public static final String RADIO_BLUETOOTH = "bluetooth"; 5767 5768 /** 5769 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. 5770 */ 5771 public static final String RADIO_WIFI = "wifi"; 5772 5773 /** 5774 * {@hide} 5775 */ 5776 public static final String RADIO_WIMAX = "wimax"; 5777 /** 5778 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. 5779 */ 5780 public static final String RADIO_CELL = "cell"; 5781 5782 /** 5783 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. 5784 */ 5785 public static final String RADIO_NFC = "nfc"; 5786 5787 /** 5788 * A comma separated list of radios that need to be disabled when airplane mode 5789 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are 5790 * included in the comma separated list. 5791 */ 5792 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; 5793 5794 /** 5795 * A comma separated list of radios that should to be disabled when airplane mode 5796 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is 5797 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi 5798 * will be turned off when entering airplane mode, but the user will be able to reenable 5799 * Wifi in the Settings app. 5800 * 5801 * {@hide} 5802 */ 5803 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; 5804 5805 /** 5806 * The policy for deciding when Wi-Fi should go to sleep (which will in 5807 * turn switch to using the mobile data as an Internet connection). 5808 * <p> 5809 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, 5810 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or 5811 * {@link #WIFI_SLEEP_POLICY_NEVER}. 5812 */ 5813 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; 5814 5815 /** 5816 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep 5817 * policy, which is to sleep shortly after the turning off 5818 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. 5819 */ 5820 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; 5821 5822 /** 5823 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when 5824 * the device is on battery, and never go to sleep when the device is 5825 * plugged in. 5826 */ 5827 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; 5828 5829 /** 5830 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. 5831 */ 5832 public static final int WIFI_SLEEP_POLICY_NEVER = 2; 5833 5834 /** 5835 * Value to specify if the user prefers the date, time and time zone 5836 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 5837 */ 5838 public static final String AUTO_TIME = "auto_time"; 5839 5840 /** 5841 * Value to specify if the user prefers the time zone 5842 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 5843 */ 5844 public static final String AUTO_TIME_ZONE = "auto_time_zone"; 5845 5846 /** 5847 * URI for the car dock "in" event sound. 5848 * @hide 5849 */ 5850 public static final String CAR_DOCK_SOUND = "car_dock_sound"; 5851 5852 /** 5853 * URI for the car dock "out" event sound. 5854 * @hide 5855 */ 5856 public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; 5857 5858 /** 5859 * URI for the desk dock "in" event sound. 5860 * @hide 5861 */ 5862 public static final String DESK_DOCK_SOUND = "desk_dock_sound"; 5863 5864 /** 5865 * URI for the desk dock "out" event sound. 5866 * @hide 5867 */ 5868 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; 5869 5870 /** 5871 * Whether to play a sound for dock events. 5872 * @hide 5873 */ 5874 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; 5875 5876 /** 5877 * URI for the "device locked" (keyguard shown) sound. 5878 * @hide 5879 */ 5880 public static final String LOCK_SOUND = "lock_sound"; 5881 5882 /** 5883 * URI for the "device unlocked" sound. 5884 * @hide 5885 */ 5886 public static final String UNLOCK_SOUND = "unlock_sound"; 5887 5888 /** 5889 * URI for the "device is trusted" sound, which is played when the device enters the trusted 5890 * state without unlocking. 5891 * @hide 5892 */ 5893 public static final String TRUSTED_SOUND = "trusted_sound"; 5894 5895 /** 5896 * URI for the low battery sound file. 5897 * @hide 5898 */ 5899 public static final String LOW_BATTERY_SOUND = "low_battery_sound"; 5900 5901 /** 5902 * Whether to play a sound for low-battery alerts. 5903 * @hide 5904 */ 5905 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; 5906 5907 /** 5908 * URI for the "wireless charging started" sound. 5909 * @hide 5910 */ 5911 public static final String WIRELESS_CHARGING_STARTED_SOUND = 5912 "wireless_charging_started_sound"; 5913 5914 /** 5915 * Whether we keep the device on while the device is plugged in. 5916 * Supported values are: 5917 * <ul> 5918 * <li>{@code 0} to never stay on while plugged in</li> 5919 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li> 5920 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li> 5921 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li> 5922 * </ul> 5923 * These values can be OR-ed together. 5924 */ 5925 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; 5926 5927 /** 5928 * When the user has enable the option to have a "bug report" command 5929 * in the power menu. 5930 * @hide 5931 */ 5932 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 5933 5934 /** 5935 * Whether ADB is enabled. 5936 */ 5937 public static final String ADB_ENABLED = "adb_enabled"; 5938 5939 /** 5940 * Whether Views are allowed to save their attribute data. 5941 * @hide 5942 */ 5943 public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes"; 5944 5945 /** 5946 * Whether assisted GPS should be enabled or not. 5947 * @hide 5948 */ 5949 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; 5950 5951 /** 5952 * Whether bluetooth is enabled/disabled 5953 * 0=disabled. 1=enabled. 5954 */ 5955 public static final String BLUETOOTH_ON = "bluetooth_on"; 5956 5957 /** 5958 * CDMA Cell Broadcast SMS 5959 * 0 = CDMA Cell Broadcast SMS disabled 5960 * 1 = CDMA Cell Broadcast SMS enabled 5961 * @hide 5962 */ 5963 public static final String CDMA_CELL_BROADCAST_SMS = 5964 "cdma_cell_broadcast_sms"; 5965 5966 /** 5967 * The CDMA roaming mode 0 = Home Networks, CDMA default 5968 * 1 = Roaming on Affiliated networks 5969 * 2 = Roaming on any networks 5970 * @hide 5971 */ 5972 public static final String CDMA_ROAMING_MODE = "roaming_settings"; 5973 5974 /** 5975 * The CDMA subscription mode 0 = RUIM/SIM (default) 5976 * 1 = NV 5977 * @hide 5978 */ 5979 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; 5980 5981 /** Inactivity timeout to track mobile data activity. 5982 * 5983 * If set to a positive integer, it indicates the inactivity timeout value in seconds to 5984 * infer the data activity of mobile network. After a period of no activity on mobile 5985 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} 5986 * intent is fired to indicate a transition of network status from "active" to "idle". Any 5987 * subsequent activity on mobile networks triggers the firing of {@code 5988 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". 5989 * 5990 * Network activity refers to transmitting or receiving data on the network interfaces. 5991 * 5992 * Tracking is disabled if set to zero or negative value. 5993 * 5994 * @hide 5995 */ 5996 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; 5997 5998 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} 5999 * but for Wifi network. 6000 * @hide 6001 */ 6002 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; 6003 6004 /** 6005 * Whether or not data roaming is enabled. (0 = false, 1 = true) 6006 */ 6007 public static final String DATA_ROAMING = "data_roaming"; 6008 6009 /** 6010 * The value passed to a Mobile DataConnection via bringUp which defines the 6011 * number of retries to preform when setting up the initial connection. The default 6012 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1. 6013 * @hide 6014 */ 6015 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry"; 6016 6017 /** 6018 * Whether user has enabled development settings. 6019 */ 6020 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; 6021 6022 /** 6023 * Whether the device has been provisioned (0 = false, 1 = true) 6024 */ 6025 public static final String DEVICE_PROVISIONED = "device_provisioned"; 6026 6027 /** 6028 * The saved value for WindowManagerService.setForcedDisplayDensity(). 6029 * One integer in dpi. If unset, then use the real display density. 6030 * @hide 6031 */ 6032 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; 6033 6034 /** 6035 * The saved value for WindowManagerService.setForcedDisplaySize(). 6036 * Two integers separated by a comma. If unset, then use the real display size. 6037 * @hide 6038 */ 6039 public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; 6040 6041 /** 6042 * The saved value for WindowManagerService.setForcedDisplayScalingMode(). 6043 * 0 or unset if scaling is automatic, 1 if scaling is disabled. 6044 * @hide 6045 */ 6046 public static final String DISPLAY_SCALING_FORCE = "display_scaling_force"; 6047 6048 /** 6049 * The maximum size, in bytes, of a download that the download manager will transfer over 6050 * a non-wifi connection. 6051 * @hide 6052 */ 6053 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = 6054 "download_manager_max_bytes_over_mobile"; 6055 6056 /** 6057 * The recommended maximum size, in bytes, of a download that the download manager should 6058 * transfer over a non-wifi connection. Over this size, the use will be warned, but will 6059 * have the option to start the download over the mobile connection anyway. 6060 * @hide 6061 */ 6062 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = 6063 "download_manager_recommended_max_bytes_over_mobile"; 6064 6065 /** 6066 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 6067 */ 6068 @Deprecated 6069 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 6070 6071 /** 6072 * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be 6073 * sent or processed. (0 = false, 1 = true) 6074 * @hide 6075 */ 6076 public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled"; 6077 6078 /** 6079 * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted, 6080 * and the output is redirected to AV Receiver connected via 6081 * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}. 6082 * @hide 6083 */ 6084 public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled"; 6085 6086 /** 6087 * Whether TV will automatically turn on upon reception of the CEC command 6088 * <Text View On> or <Image View On>. (0 = false, 1 = true) 6089 * @hide 6090 */ 6091 public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED = 6092 "hdmi_control_auto_wakeup_enabled"; 6093 6094 /** 6095 * Whether TV will also turn off other CEC devices when it goes to standby mode. 6096 * (0 = false, 1 = true) 6097 * @hide 6098 */ 6099 public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED = 6100 "hdmi_control_auto_device_off_enabled"; 6101 6102 /** 6103 * Whether to use the DHCP client from Lollipop and earlier instead of the newer Android DHCP 6104 * client. 6105 * (0 = false, 1 = true) 6106 * @hide 6107 */ 6108 public static final String LEGACY_DHCP_CLIENT = "legacy_dhcp_client"; 6109 6110 /** 6111 * Whether TV will switch to MHL port when a mobile device is plugged in. 6112 * (0 = false, 1 = true) 6113 * @hide 6114 */ 6115 public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled"; 6116 6117 /** 6118 * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true) 6119 * @hide 6120 */ 6121 public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled"; 6122 6123 /** 6124 * Whether mobile data connections are allowed by the user. See 6125 * ConnectivityManager for more info. 6126 * @hide 6127 */ 6128 public static final String MOBILE_DATA = "mobile_data"; 6129 6130 /** {@hide} */ 6131 public static final String NETSTATS_ENABLED = "netstats_enabled"; 6132 /** {@hide} */ 6133 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; 6134 /** {@hide} */ 6135 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; 6136 /** {@hide} */ 6137 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; 6138 /** {@hide} */ 6139 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; 6140 6141 /** {@hide} */ 6142 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; 6143 /** {@hide} */ 6144 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; 6145 /** {@hide} */ 6146 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; 6147 /** {@hide} */ 6148 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; 6149 6150 /** {@hide} */ 6151 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; 6152 /** {@hide} */ 6153 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; 6154 /** {@hide} */ 6155 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; 6156 /** {@hide} */ 6157 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; 6158 6159 /** {@hide} */ 6160 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; 6161 /** {@hide} */ 6162 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; 6163 /** {@hide} */ 6164 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; 6165 /** {@hide} */ 6166 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; 6167 6168 /** 6169 * User preference for which network(s) should be used. Only the 6170 * connectivity service should touch this. 6171 */ 6172 public static final String NETWORK_PREFERENCE = "network_preference"; 6173 6174 /** 6175 * Which package name to use for network scoring. If null, or if the package is not a valid 6176 * scorer app, external network scores will neither be requested nor accepted. 6177 * @hide 6178 */ 6179 public static final String NETWORK_SCORER_APP = "network_scorer_app"; 6180 6181 /** 6182 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment 6183 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been 6184 * exceeded. 6185 * @hide 6186 */ 6187 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; 6188 6189 /** 6190 * The length of time in milli-seconds that automatic small adjustments to 6191 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. 6192 * @hide 6193 */ 6194 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; 6195 6196 /** Preferred NTP server. {@hide} */ 6197 public static final String NTP_SERVER = "ntp_server"; 6198 /** Timeout in milliseconds to wait for NTP server. {@hide} */ 6199 public static final String NTP_TIMEOUT = "ntp_timeout"; 6200 6201 /** 6202 * Whether the package manager should send package verification broadcasts for verifiers to 6203 * review apps prior to installation. 6204 * 1 = request apps to be verified prior to installation, if a verifier exists. 6205 * 0 = do not verify apps before installation 6206 * @hide 6207 */ 6208 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; 6209 6210 /** Timeout for package verification. 6211 * @hide */ 6212 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; 6213 6214 /** Default response code for package verification. 6215 * @hide */ 6216 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; 6217 6218 /** 6219 * Show package verification setting in the Settings app. 6220 * 1 = show (default) 6221 * 0 = hide 6222 * @hide 6223 */ 6224 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; 6225 6226 /** 6227 * Run package verification on apps installed through ADB/ADT/USB 6228 * 1 = perform package verification on ADB installs (default) 6229 * 0 = bypass package verification on ADB installs 6230 * @hide 6231 */ 6232 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; 6233 6234 /** 6235 * Time since last fstrim (milliseconds) after which we force one to happen 6236 * during device startup. If unset, the default is 3 days. 6237 * @hide 6238 */ 6239 public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval"; 6240 6241 /** 6242 * The interval in milliseconds at which to check packet counts on the 6243 * mobile data interface when screen is on, to detect possible data 6244 * connection problems. 6245 * @hide 6246 */ 6247 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = 6248 "pdp_watchdog_poll_interval_ms"; 6249 6250 /** 6251 * The interval in milliseconds at which to check packet counts on the 6252 * mobile data interface when screen is off, to detect possible data 6253 * connection problems. 6254 * @hide 6255 */ 6256 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = 6257 "pdp_watchdog_long_poll_interval_ms"; 6258 6259 /** 6260 * The interval in milliseconds at which to check packet counts on the 6261 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} 6262 * outgoing packets has been reached without incoming packets. 6263 * @hide 6264 */ 6265 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = 6266 "pdp_watchdog_error_poll_interval_ms"; 6267 6268 /** 6269 * The number of outgoing packets sent without seeing an incoming packet 6270 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} 6271 * device is logged to the event log 6272 * @hide 6273 */ 6274 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = 6275 "pdp_watchdog_trigger_packet_count"; 6276 6277 /** 6278 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) 6279 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before 6280 * attempting data connection recovery. 6281 * @hide 6282 */ 6283 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = 6284 "pdp_watchdog_error_poll_count"; 6285 6286 /** 6287 * The number of failed PDP reset attempts before moving to something more 6288 * drastic: re-registering to the network. 6289 * @hide 6290 */ 6291 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = 6292 "pdp_watchdog_max_pdp_reset_fail_count"; 6293 6294 /** 6295 * A positive value indicates how often the SamplingProfiler 6296 * should take snapshots. Zero value means SamplingProfiler 6297 * is disabled. 6298 * 6299 * @hide 6300 */ 6301 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; 6302 6303 /** 6304 * URL to open browser on to allow user to manage a prepay account 6305 * @hide 6306 */ 6307 public static final String SETUP_PREPAID_DATA_SERVICE_URL = 6308 "setup_prepaid_data_service_url"; 6309 6310 /** 6311 * URL to attempt a GET on to see if this is a prepay device 6312 * @hide 6313 */ 6314 public static final String SETUP_PREPAID_DETECTION_TARGET_URL = 6315 "setup_prepaid_detection_target_url"; 6316 6317 /** 6318 * Host to check for a redirect to after an attempt to GET 6319 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, 6320 * this is a prepaid device with zero balance.) 6321 * @hide 6322 */ 6323 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = 6324 "setup_prepaid_detection_redir_host"; 6325 6326 /** 6327 * The interval in milliseconds at which to check the number of SMS sent out without asking 6328 * for use permit, to limit the un-authorized SMS usage. 6329 * 6330 * @hide 6331 */ 6332 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = 6333 "sms_outgoing_check_interval_ms"; 6334 6335 /** 6336 * The number of outgoing SMS sent without asking for user permit (of {@link 6337 * #SMS_OUTGOING_CHECK_INTERVAL_MS} 6338 * 6339 * @hide 6340 */ 6341 public static final String SMS_OUTGOING_CHECK_MAX_COUNT = 6342 "sms_outgoing_check_max_count"; 6343 6344 /** 6345 * Used to disable SMS short code confirmation - defaults to true. 6346 * True indcates we will do the check, etc. Set to false to disable. 6347 * @see com.android.internal.telephony.SmsUsageMonitor 6348 * @hide 6349 */ 6350 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; 6351 6352 /** 6353 * Used to select which country we use to determine premium sms codes. 6354 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, 6355 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, 6356 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. 6357 * @hide 6358 */ 6359 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; 6360 6361 /** 6362 * Used to select TCP's default initial receiver window size in segments - defaults to a build config value 6363 * @hide 6364 */ 6365 public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd"; 6366 6367 /** 6368 * Used to disable Tethering on a device - defaults to true 6369 * @hide 6370 */ 6371 public static final String TETHER_SUPPORTED = "tether_supported"; 6372 6373 /** 6374 * Used to require DUN APN on the device or not - defaults to a build config value 6375 * which defaults to false 6376 * @hide 6377 */ 6378 public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; 6379 6380 /** 6381 * Used to hold a gservices-provisioned apn value for DUN. If set, or the 6382 * corresponding build config values are set it will override the APN DB 6383 * values. 6384 * Consists of a comma seperated list of strings: 6385 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" 6386 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" 6387 * @hide 6388 */ 6389 public static final String TETHER_DUN_APN = "tether_dun_apn"; 6390 6391 /** 6392 * USB Mass Storage Enabled 6393 */ 6394 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; 6395 6396 /** 6397 * If this setting is set (to anything), then all references 6398 * to Gmail on the device must change to Google Mail. 6399 */ 6400 public static final String USE_GOOGLE_MAIL = "use_google_mail"; 6401 6402 /** 6403 * Webview Data reduction proxy key. 6404 * @hide 6405 */ 6406 public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = 6407 "webview_data_reduction_proxy_key"; 6408 6409 /** 6410 * Whether Wifi display is enabled/disabled 6411 * 0=disabled. 1=enabled. 6412 * @hide 6413 */ 6414 public static final String WIFI_DISPLAY_ON = "wifi_display_on"; 6415 6416 /** 6417 * Whether Wifi display certification mode is enabled/disabled 6418 * 0=disabled. 1=enabled. 6419 * @hide 6420 */ 6421 public static final String WIFI_DISPLAY_CERTIFICATION_ON = 6422 "wifi_display_certification_on"; 6423 6424 /** 6425 * WPS Configuration method used by Wifi display, this setting only 6426 * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled). 6427 * 6428 * Possible values are: 6429 * 6430 * WpsInfo.INVALID: use default WPS method chosen by framework 6431 * WpsInfo.PBC : use Push button 6432 * WpsInfo.KEYPAD : use Keypad 6433 * WpsInfo.DISPLAY: use Display 6434 * @hide 6435 */ 6436 public static final String WIFI_DISPLAY_WPS_CONFIG = 6437 "wifi_display_wps_config"; 6438 6439 /** 6440 * Whether to notify the user of open networks. 6441 * <p> 6442 * If not connected and the scan results have an open network, we will 6443 * put this notification up. If we attempt to connect to a network or 6444 * the open network(s) disappear, we remove the notification. When we 6445 * show the notification, we will not show it again for 6446 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. 6447 */ 6448 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 6449 "wifi_networks_available_notification_on"; 6450 /** 6451 * {@hide} 6452 */ 6453 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = 6454 "wimax_networks_available_notification_on"; 6455 6456 /** 6457 * Delay (in seconds) before repeating the Wi-Fi networks available notification. 6458 * Connecting to a network will reset the timer. 6459 */ 6460 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 6461 "wifi_networks_available_repeat_delay"; 6462 6463 /** 6464 * 802.11 country code in ISO 3166 format 6465 * @hide 6466 */ 6467 public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; 6468 6469 /** 6470 * The interval in milliseconds to issue wake up scans when wifi needs 6471 * to connect. This is necessary to connect to an access point when 6472 * device is on the move and the screen is off. 6473 * @hide 6474 */ 6475 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = 6476 "wifi_framework_scan_interval_ms"; 6477 6478 /** 6479 * The interval in milliseconds after which Wi-Fi is considered idle. 6480 * When idle, it is possible for the device to be switched from Wi-Fi to 6481 * the mobile data network. 6482 * @hide 6483 */ 6484 public static final String WIFI_IDLE_MS = "wifi_idle_ms"; 6485 6486 /** 6487 * When the number of open networks exceeds this number, the 6488 * least-recently-used excess networks will be removed. 6489 */ 6490 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; 6491 6492 /** 6493 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. 6494 */ 6495 public static final String WIFI_ON = "wifi_on"; 6496 6497 /** 6498 * Setting to allow scans to be enabled even wifi is turned off for connectivity. 6499 * @hide 6500 */ 6501 public static final String WIFI_SCAN_ALWAYS_AVAILABLE = 6502 "wifi_scan_always_enabled"; 6503 6504 /** 6505 * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for 6506 * connectivity. 6507 * @hide 6508 */ 6509 public static final String BLE_SCAN_ALWAYS_AVAILABLE = 6510 "ble_scan_always_enabled"; 6511 6512 /** 6513 * Used to save the Wifi_ON state prior to tethering. 6514 * This state will be checked to restore Wifi after 6515 * the user turns off tethering. 6516 * 6517 * @hide 6518 */ 6519 public static final String WIFI_SAVED_STATE = "wifi_saved_state"; 6520 6521 /** 6522 * The interval in milliseconds to scan as used by the wifi supplicant 6523 * @hide 6524 */ 6525 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = 6526 "wifi_supplicant_scan_interval_ms"; 6527 6528 /** 6529 * whether frameworks handles wifi auto-join 6530 * @hide 6531 */ 6532 public static final String WIFI_ENHANCED_AUTO_JOIN = 6533 "wifi_enhanced_auto_join"; 6534 6535 /** 6536 * whether settings show RSSI 6537 * @hide 6538 */ 6539 public static final String WIFI_NETWORK_SHOW_RSSI = 6540 "wifi_network_show_rssi"; 6541 6542 /** 6543 * The interval in milliseconds to scan at supplicant when p2p is connected 6544 * @hide 6545 */ 6546 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = 6547 "wifi_scan_interval_p2p_connected_ms"; 6548 6549 /** 6550 * Whether the Wi-Fi watchdog is enabled. 6551 */ 6552 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 6553 6554 /** 6555 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and 6556 * the setting needs to be set to 0 to disable it. 6557 * @hide 6558 */ 6559 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = 6560 "wifi_watchdog_poor_network_test_enabled"; 6561 6562 /** 6563 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and 6564 * needs to be set to 0 to disable it. 6565 * @hide 6566 */ 6567 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = 6568 "wifi_suspend_optimizations_enabled"; 6569 6570 /** 6571 * The maximum number of times we will retry a connection to an access 6572 * point for which we have failed in acquiring an IP address from DHCP. 6573 * A value of N means that we will make N+1 connection attempts in all. 6574 */ 6575 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; 6576 6577 /** 6578 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile 6579 * data connectivity to be established after a disconnect from Wi-Fi. 6580 */ 6581 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 6582 "wifi_mobile_data_transition_wakelock_timeout_ms"; 6583 6584 /** 6585 * The operational wifi frequency band 6586 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, 6587 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or 6588 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} 6589 * 6590 * @hide 6591 */ 6592 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; 6593 6594 /** 6595 * The Wi-Fi peer-to-peer device name 6596 * @hide 6597 */ 6598 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; 6599 6600 /** 6601 * The min time between wifi disable and wifi enable 6602 * @hide 6603 */ 6604 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay"; 6605 6606 /** 6607 * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect 6608 * from an ephemeral network if there is no BSSID for that network with a non-null score that 6609 * has been seen in this time period. 6610 * 6611 * If this is less than or equal to zero, we use a more conservative behavior and only check 6612 * for a non-null score from the currently connected or target BSSID. 6613 * @hide 6614 */ 6615 public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS = 6616 "wifi_ephemeral_out_of_range_timeout_ms"; 6617 6618 /** 6619 * The number of milliseconds to delay when checking for data stalls during 6620 * non-aggressive detection. (screen is turned off.) 6621 * @hide 6622 */ 6623 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = 6624 "data_stall_alarm_non_aggressive_delay_in_ms"; 6625 6626 /** 6627 * The number of milliseconds to delay when checking for data stalls during 6628 * aggressive detection. (screen on or suspected data stall) 6629 * @hide 6630 */ 6631 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = 6632 "data_stall_alarm_aggressive_delay_in_ms"; 6633 6634 /** 6635 * The number of milliseconds to allow the provisioning apn to remain active 6636 * @hide 6637 */ 6638 public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS = 6639 "provisioning_apn_alarm_delay_in_ms"; 6640 6641 /** 6642 * The interval in milliseconds at which to check gprs registration 6643 * after the first registration mismatch of gprs and voice service, 6644 * to detect possible data network registration problems. 6645 * 6646 * @hide 6647 */ 6648 public static final String GPRS_REGISTER_CHECK_PERIOD_MS = 6649 "gprs_register_check_period_ms"; 6650 6651 /** 6652 * Nonzero causes Log.wtf() to crash. 6653 * @hide 6654 */ 6655 public static final String WTF_IS_FATAL = "wtf_is_fatal"; 6656 6657 /** 6658 * Ringer mode. This is used internally, changing this value will not 6659 * change the ringer mode. See AudioManager. 6660 */ 6661 public static final String MODE_RINGER = "mode_ringer"; 6662 6663 /** 6664 * Overlay display devices setting. 6665 * The associated value is a specially formatted string that describes the 6666 * size and density of simulated secondary display devices. 6667 * <p> 6668 * Format: {width}x{height}/{dpi};... 6669 * </p><p> 6670 * Example: 6671 * <ul> 6672 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li> 6673 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first 6674 * at 1080p and the second at 720p.</li> 6675 * <li>If the value is empty, then no overlay display devices are created.</li> 6676 * </ul></p> 6677 * 6678 * @hide 6679 */ 6680 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; 6681 6682 /** 6683 * Threshold values for the duration and level of a discharge cycle, 6684 * under which we log discharge cycle info. 6685 * 6686 * @hide 6687 */ 6688 public static final String 6689 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; 6690 6691 /** @hide */ 6692 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; 6693 6694 /** 6695 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR 6696 * intents on application crashes and ANRs. If this is disabled, the 6697 * crash/ANR dialog will never display the "Report" button. 6698 * <p> 6699 * Type: int (0 = disallow, 1 = allow) 6700 * 6701 * @hide 6702 */ 6703 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; 6704 6705 /** 6706 * Maximum age of entries kept by {@link DropBoxManager}. 6707 * 6708 * @hide 6709 */ 6710 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; 6711 6712 /** 6713 * Maximum number of entry files which {@link DropBoxManager} will keep 6714 * around. 6715 * 6716 * @hide 6717 */ 6718 public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; 6719 6720 /** 6721 * Maximum amount of disk space used by {@link DropBoxManager} no matter 6722 * what. 6723 * 6724 * @hide 6725 */ 6726 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; 6727 6728 /** 6729 * Percent of free disk (excluding reserve) which {@link DropBoxManager} 6730 * will use. 6731 * 6732 * @hide 6733 */ 6734 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; 6735 6736 /** 6737 * Percent of total disk which {@link DropBoxManager} will never dip 6738 * into. 6739 * 6740 * @hide 6741 */ 6742 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; 6743 6744 /** 6745 * Prefix for per-tag dropbox disable/enable settings. 6746 * 6747 * @hide 6748 */ 6749 public static final String DROPBOX_TAG_PREFIX = "dropbox:"; 6750 6751 /** 6752 * Lines of logcat to include with system crash/ANR/etc. reports, as a 6753 * prefix of the dropbox tag of the report type. For example, 6754 * "logcat_for_system_server_anr" controls the lines of logcat captured 6755 * with system server ANR reports. 0 to disable. 6756 * 6757 * @hide 6758 */ 6759 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; 6760 6761 /** 6762 * The interval in minutes after which the amount of free storage left 6763 * on the device is logged to the event log 6764 * 6765 * @hide 6766 */ 6767 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; 6768 6769 /** 6770 * Threshold for the amount of change in disk free space required to 6771 * report the amount of free space. Used to prevent spamming the logs 6772 * when the disk free space isn't changing frequently. 6773 * 6774 * @hide 6775 */ 6776 public static final String 6777 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; 6778 6779 /** 6780 * Minimum percentage of free storage on the device that is used to 6781 * determine if the device is running low on storage. The default is 10. 6782 * <p> 6783 * Say this value is set to 10, the device is considered running low on 6784 * storage if 90% or more of the device storage is filled up. 6785 * 6786 * @hide 6787 */ 6788 public static final String 6789 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; 6790 6791 /** 6792 * Maximum byte size of the low storage threshold. This is to ensure 6793 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an 6794 * overly large threshold for large storage devices. Currently this must 6795 * be less than 2GB. This default is 500MB. 6796 * 6797 * @hide 6798 */ 6799 public static final String 6800 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; 6801 6802 /** 6803 * Minimum bytes of free storage on the device before the data partition 6804 * is considered full. By default, 1 MB is reserved to avoid system-wide 6805 * SQLite disk full exceptions. 6806 * 6807 * @hide 6808 */ 6809 public static final String 6810 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; 6811 6812 /** 6813 * The maximum reconnect delay for short network outages or when the 6814 * network is suspended due to phone use. 6815 * 6816 * @hide 6817 */ 6818 public static final String 6819 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; 6820 6821 /** 6822 * The number of milliseconds to delay before sending out 6823 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored. 6824 * 6825 * @hide 6826 */ 6827 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; 6828 6829 6830 /** 6831 * Network sampling interval, in seconds. We'll generate link information 6832 * about bytes/packets sent and error rates based on data sampled in this interval 6833 * 6834 * @hide 6835 */ 6836 6837 public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS = 6838 "connectivity_sampling_interval_in_seconds"; 6839 6840 /** 6841 * The series of successively longer delays used in retrying to download PAC file. 6842 * Last delay is used between successful PAC downloads. 6843 * 6844 * @hide 6845 */ 6846 public static final String PAC_CHANGE_DELAY = "pac_change_delay"; 6847 6848 /** 6849 * Setting to turn off captive portal detection. Feature is enabled by 6850 * default and the setting needs to be set to 0 to disable it. 6851 * 6852 * @hide 6853 */ 6854 public static final String 6855 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; 6856 6857 /** 6858 * The server used for captive portal detection upon a new conection. A 6859 * 204 response code from the server is used for validation. 6860 * 6861 * @hide 6862 */ 6863 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; 6864 6865 /** 6866 * Whether network service discovery is enabled. 6867 * 6868 * @hide 6869 */ 6870 public static final String NSD_ON = "nsd_on"; 6871 6872 /** 6873 * Let user pick default install location. 6874 * 6875 * @hide 6876 */ 6877 public static final String SET_INSTALL_LOCATION = "set_install_location"; 6878 6879 /** 6880 * Default install location value. 6881 * 0 = auto, let system decide 6882 * 1 = internal 6883 * 2 = sdcard 6884 * @hide 6885 */ 6886 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; 6887 6888 /** 6889 * ms during which to consume extra events related to Inet connection 6890 * condition after a transtion to fully-connected 6891 * 6892 * @hide 6893 */ 6894 public static final String 6895 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; 6896 6897 /** 6898 * ms during which to consume extra events related to Inet connection 6899 * condtion after a transtion to partly-connected 6900 * 6901 * @hide 6902 */ 6903 public static final String 6904 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; 6905 6906 /** {@hide} */ 6907 public static final String 6908 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; 6909 6910 /** 6911 * Host name and port for global http proxy. Uses ':' seperator for 6912 * between host and port. 6913 */ 6914 public static final String HTTP_PROXY = "http_proxy"; 6915 6916 /** 6917 * Host name for global http proxy. Set via ConnectivityManager. 6918 * 6919 * @hide 6920 */ 6921 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; 6922 6923 /** 6924 * Integer host port for global http proxy. Set via ConnectivityManager. 6925 * 6926 * @hide 6927 */ 6928 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; 6929 6930 /** 6931 * Exclusion list for global proxy. This string contains a list of 6932 * comma-separated domains where the global proxy does not apply. 6933 * Domains should be listed in a comma- separated list. Example of 6934 * acceptable formats: ".domain1.com,my.domain2.com" Use 6935 * ConnectivityManager to set/get. 6936 * 6937 * @hide 6938 */ 6939 public static final String 6940 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; 6941 6942 /** 6943 * The location PAC File for the proxy. 6944 * @hide 6945 */ 6946 public static final String 6947 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url"; 6948 6949 /** 6950 * Enables the UI setting to allow the user to specify the global HTTP 6951 * proxy and associated exclusion list. 6952 * 6953 * @hide 6954 */ 6955 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; 6956 6957 /** 6958 * Setting for default DNS in case nobody suggests one 6959 * 6960 * @hide 6961 */ 6962 public static final String DEFAULT_DNS_SERVER = "default_dns_server"; 6963 6964 /** {@hide} */ 6965 public static final String 6966 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; 6967 /** {@hide} */ 6968 public static final String 6969 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; 6970 /** {@hide} */ 6971 public static final String 6972 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; 6973 /** {@hide} */ 6974 public static final String 6975 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_"; 6976 /** {@hide} */ 6977 public static final String 6978 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_"; 6979 6980 /** 6981 * Get the key that retrieves a bluetooth headset's priority. 6982 * @hide 6983 */ 6984 public static final String getBluetoothHeadsetPriorityKey(String address) { 6985 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 6986 } 6987 6988 /** 6989 * Get the key that retrieves a bluetooth a2dp sink's priority. 6990 * @hide 6991 */ 6992 public static final String getBluetoothA2dpSinkPriorityKey(String address) { 6993 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 6994 } 6995 6996 /** 6997 * Get the key that retrieves a bluetooth Input Device's priority. 6998 * @hide 6999 */ 7000 public static final String getBluetoothInputDevicePriorityKey(String address) { 7001 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7002 } 7003 7004 /** 7005 * Get the key that retrieves a bluetooth map priority. 7006 * @hide 7007 */ 7008 public static final String getBluetoothMapPriorityKey(String address) { 7009 return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7010 } 7011 7012 /** 7013 * Get the key that retrieves a bluetooth map priority. 7014 * @hide 7015 */ 7016 public static final String getBluetoothSapPriorityKey(String address) { 7017 return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7018 } 7019 7020 /** 7021 * Scaling factor for normal window animations. Setting to 0 will 7022 * disable window animations. 7023 */ 7024 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; 7025 7026 /** 7027 * Scaling factor for activity transition animations. Setting to 0 will 7028 * disable window animations. 7029 */ 7030 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; 7031 7032 /** 7033 * Scaling factor for Animator-based animations. This affects both the 7034 * start delay and duration of all such animations. Setting to 0 will 7035 * cause animations to end immediately. The default value is 1. 7036 */ 7037 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; 7038 7039 /** 7040 * Scaling factor for normal window animations. Setting to 0 will 7041 * disable window animations. 7042 * 7043 * @hide 7044 */ 7045 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; 7046 7047 /** 7048 * If 0, the compatibility mode is off for all applications. 7049 * If 1, older applications run under compatibility mode. 7050 * TODO: remove this settings before code freeze (bug/1907571) 7051 * @hide 7052 */ 7053 public static final String COMPATIBILITY_MODE = "compatibility_mode"; 7054 7055 /** 7056 * CDMA only settings 7057 * Emergency Tone 0 = Off 7058 * 1 = Alert 7059 * 2 = Vibrate 7060 * @hide 7061 */ 7062 public static final String EMERGENCY_TONE = "emergency_tone"; 7063 7064 /** 7065 * CDMA only settings 7066 * Whether the auto retry is enabled. The value is 7067 * boolean (1 or 0). 7068 * @hide 7069 */ 7070 public static final String CALL_AUTO_RETRY = "call_auto_retry"; 7071 7072 /** 7073 * See RIL_PreferredNetworkType in ril.h 7074 * @hide 7075 */ 7076 public static final String PREFERRED_NETWORK_MODE = 7077 "preferred_network_mode"; 7078 7079 /** 7080 * Setting to 1 will hide carrier network settings. 7081 * Default is 0. 7082 */ 7083 public static final String HIDE_CARRIER_NETWORK_SETTINGS = 7084 "hide_carrier_network_settings"; 7085 7086 /** 7087 * Name of an application package to be debugged. 7088 */ 7089 public static final String DEBUG_APP = "debug_app"; 7090 7091 /** 7092 * If 1, when launching DEBUG_APP it will wait for the debugger before 7093 * starting user code. If 0, it will run normally. 7094 */ 7095 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; 7096 7097 /** 7098 * Control whether the process CPU usage meter should be shown. 7099 */ 7100 public static final String SHOW_PROCESSES = "show_processes"; 7101 7102 /** 7103 * If 1 low power mode is enabled. 7104 * @hide 7105 */ 7106 public static final String LOW_POWER_MODE = "low_power"; 7107 7108 /** 7109 * Battery level [1-99] at which low power mode automatically turns on. 7110 * If 0, it will not automatically turn on. 7111 * @hide 7112 */ 7113 public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level"; 7114 7115 /** 7116 * If 1, the activity manager will aggressively finish activities and 7117 * processes as soon as they are no longer needed. If 0, the normal 7118 * extended lifetime is used. 7119 */ 7120 public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; 7121 7122 /** 7123 * Use Dock audio output for media: 7124 * 0 = disabled 7125 * 1 = enabled 7126 * @hide 7127 */ 7128 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; 7129 7130 /** 7131 * Persisted safe headphone volume management state by AudioService 7132 * @hide 7133 */ 7134 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; 7135 7136 /** 7137 * URL for tzinfo (time zone) updates 7138 * @hide 7139 */ 7140 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url"; 7141 7142 /** 7143 * URL for tzinfo (time zone) update metadata 7144 * @hide 7145 */ 7146 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url"; 7147 7148 /** 7149 * URL for selinux (mandatory access control) updates 7150 * @hide 7151 */ 7152 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url"; 7153 7154 /** 7155 * URL for selinux (mandatory access control) update metadata 7156 * @hide 7157 */ 7158 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url"; 7159 7160 /** 7161 * URL for sms short code updates 7162 * @hide 7163 */ 7164 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL = 7165 "sms_short_codes_content_url"; 7166 7167 /** 7168 * URL for sms short code update metadata 7169 * @hide 7170 */ 7171 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL = 7172 "sms_short_codes_metadata_url"; 7173 7174 /** 7175 * URL for cert pinlist updates 7176 * @hide 7177 */ 7178 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url"; 7179 7180 /** 7181 * URL for cert pinlist updates 7182 * @hide 7183 */ 7184 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url"; 7185 7186 /** 7187 * URL for intent firewall updates 7188 * @hide 7189 */ 7190 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL = 7191 "intent_firewall_content_url"; 7192 7193 /** 7194 * URL for intent firewall update metadata 7195 * @hide 7196 */ 7197 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL = 7198 "intent_firewall_metadata_url"; 7199 7200 /** 7201 * SELinux enforcement status. If 0, permissive; if 1, enforcing. 7202 * @hide 7203 */ 7204 public static final String SELINUX_STATUS = "selinux_status"; 7205 7206 /** 7207 * Developer setting to force RTL layout. 7208 * @hide 7209 */ 7210 public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl"; 7211 7212 /** 7213 * Milliseconds after screen-off after which low battery sounds will be silenced. 7214 * 7215 * If zero, battery sounds will always play. 7216 * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider. 7217 * 7218 * @hide 7219 */ 7220 public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout"; 7221 7222 /** 7223 * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after 7224 * the caller is done with this, they should call {@link ContentResolver#delete} to 7225 * clean up any value that they may have written. 7226 * 7227 * @hide 7228 */ 7229 public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms"; 7230 7231 /** 7232 * Defines global runtime overrides to window policy. 7233 * 7234 * See {@link com.android.server.policy.PolicyControl} for value format. 7235 * 7236 * @hide 7237 */ 7238 public static final String POLICY_CONTROL = "policy_control"; 7239 7240 /** 7241 * Defines global zen mode. ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS, 7242 * or ZEN_MODE_NO_INTERRUPTIONS. 7243 * 7244 * @hide 7245 */ 7246 public static final String ZEN_MODE = "zen_mode"; 7247 7248 /** @hide */ public static final int ZEN_MODE_OFF = 0; 7249 /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1; 7250 /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2; 7251 /** @hide */ public static final int ZEN_MODE_ALARMS = 3; 7252 7253 /** @hide */ public static String zenModeToString(int mode) { 7254 if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS"; 7255 if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS"; 7256 if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS"; 7257 return "ZEN_MODE_OFF"; 7258 } 7259 7260 /** @hide */ public static boolean isValidZenMode(int value) { 7261 switch (value) { 7262 case Global.ZEN_MODE_OFF: 7263 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: 7264 case Global.ZEN_MODE_ALARMS: 7265 case Global.ZEN_MODE_NO_INTERRUPTIONS: 7266 return true; 7267 default: 7268 return false; 7269 } 7270 } 7271 7272 /** 7273 * Opaque value, changes when persisted zen mode configuration changes. 7274 * 7275 * @hide 7276 */ 7277 public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; 7278 7279 /** 7280 * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. 7281 * 7282 * @hide 7283 */ 7284 public static final String HEADS_UP_NOTIFICATIONS_ENABLED = 7285 "heads_up_notifications_enabled"; 7286 7287 /** @hide */ public static final int HEADS_UP_OFF = 0; 7288 /** @hide */ public static final int HEADS_UP_ON = 1; 7289 7290 /** 7291 * The name of the device 7292 * 7293 * @hide 7294 */ 7295 public static final String DEVICE_NAME = "device_name"; 7296 7297 /** 7298 * Whether it should be possible to create a guest user on the device. 7299 * <p> 7300 * Type: int (0 for disabled, 1 for enabled) 7301 * @hide 7302 */ 7303 public static final String GUEST_USER_ENABLED = "guest_user_enabled"; 7304 7305 /** 7306 * Whether the NetworkScoringService has been first initialized. 7307 * <p> 7308 * Type: int (0 for false, 1 for true) 7309 * @hide 7310 */ 7311 public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned"; 7312 7313 /** 7314 * Whether the user wants to be prompted for password to decrypt the device on boot. 7315 * This only matters if the storage is encrypted. 7316 * <p> 7317 * Type: int (0 for false, 1 for true) 7318 * @hide 7319 */ 7320 public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt"; 7321 7322 /** 7323 * Whether the Volte/VT is enabled 7324 * <p> 7325 * Type: int (0 for false, 1 for true) 7326 * @hide 7327 */ 7328 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; 7329 7330 /** 7331 * Whether WFC is enabled 7332 * <p> 7333 * Type: int (0 for false, 1 for true) 7334 * 7335 * @hide 7336 */ 7337 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled"; 7338 7339 /** 7340 * WFC Mode. 7341 * <p> 7342 * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only 7343 * 7344 * @hide 7345 */ 7346 public static final String WFC_IMS_MODE = "wfc_ims_mode"; 7347 7348 /** 7349 * Whether WFC roaming is enabled 7350 * <p> 7351 * Type: int (0 for false, 1 for true) 7352 * 7353 * @hide 7354 */ 7355 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled"; 7356 7357 /** 7358 * Global override to disable VoLTE (independent of user setting) 7359 * <p> 7360 * Type: int (1 for disable VoLTE, 0 to use user configuration) 7361 * @hide 7362 */ 7363 public static final String VOLTE_FEATURE_DISABLED = "volte_feature_disabled"; 7364 7365 /** 7366 * Whether user can enable/disable LTE as a preferred network. A carrier might control 7367 * this via gservices, OMA-DM, carrier app, etc. 7368 * <p> 7369 * Type: int (0 for false, 1 for true) 7370 * @hide 7371 */ 7372 public static final String LTE_SERVICE_FORCED = "lte_service_forced"; 7373 7374 /** 7375 * Settings to backup. This is here so that it's in the same place as the settings 7376 * keys and easy to update. 7377 * 7378 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System 7379 * and Secure as well. This is because those tables drive both backup and 7380 * restore, and restore needs to properly whitelist keys that used to live 7381 * in those namespaces. The keys will only actually be backed up / restored 7382 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). 7383 * 7384 * NOTE: Settings are backed up and restored in the order they appear 7385 * in this array. If you have one setting depending on another, 7386 * make sure that they are ordered appropriately. 7387 * 7388 * @hide 7389 */ 7390 public static final String[] SETTINGS_TO_BACKUP = { 7391 BUGREPORT_IN_POWER_MENU, 7392 STAY_ON_WHILE_PLUGGED_IN, 7393 AUTO_TIME, 7394 AUTO_TIME_ZONE, 7395 POWER_SOUNDS_ENABLED, 7396 DOCK_SOUNDS_ENABLED, 7397 USB_MASS_STORAGE_ENABLED, 7398 ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 7399 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 7400 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 7401 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 7402 WIFI_NUM_OPEN_NETWORKS_KEPT, 7403 EMERGENCY_TONE, 7404 CALL_AUTO_RETRY, 7405 DOCK_AUDIO_MEDIA_ENABLED, 7406 LOW_POWER_MODE_TRIGGER_LEVEL 7407 }; 7408 7409 // Populated lazily, guarded by class object: 7410 private static NameValueCache sNameValueCache = new NameValueCache( 7411 SYS_PROP_SETTING_VERSION, 7412 CONTENT_URI, 7413 CALL_METHOD_GET_GLOBAL, 7414 CALL_METHOD_PUT_GLOBAL); 7415 7416 // Certain settings have been moved from global to the per-user secure namespace 7417 private static final HashSet<String> MOVED_TO_SECURE; 7418 static { 7419 MOVED_TO_SECURE = new HashSet<String>(1); 7420 MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); 7421 } 7422 7423 /** @hide */ 7424 public static void getMovedToSecureSettings(Set<String> outKeySet) { 7425 outKeySet.addAll(MOVED_TO_SECURE); 7426 } 7427 7428 /** 7429 * Look up a name in the database. 7430 * @param resolver to access the database with 7431 * @param name to look up in the table 7432 * @return the corresponding value, or null if not present 7433 */ 7434 public static String getString(ContentResolver resolver, String name) { 7435 return getStringForUser(resolver, name, UserHandle.myUserId()); 7436 } 7437 7438 /** @hide */ 7439 public static String getStringForUser(ContentResolver resolver, String name, 7440 int userHandle) { 7441 if (MOVED_TO_SECURE.contains(name)) { 7442 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 7443 + " to android.provider.Settings.Secure, returning read-only value."); 7444 return Secure.getStringForUser(resolver, name, userHandle); 7445 } 7446 return sNameValueCache.getStringForUser(resolver, name, userHandle); 7447 } 7448 7449 /** 7450 * Store a name/value pair into the database. 7451 * @param resolver to access the database with 7452 * @param name to store 7453 * @param value to associate with the name 7454 * @return true if the value was set, false on database errors 7455 */ 7456 public static boolean putString(ContentResolver resolver, 7457 String name, String value) { 7458 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 7459 } 7460 7461 /** @hide */ 7462 public static boolean putStringForUser(ContentResolver resolver, 7463 String name, String value, int userHandle) { 7464 if (LOCAL_LOGV) { 7465 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value 7466 + " for " + userHandle); 7467 } 7468 // Global and Secure have the same access policy so we can forward writes 7469 if (MOVED_TO_SECURE.contains(name)) { 7470 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 7471 + " to android.provider.Settings.Secure, value is unchanged."); 7472 return Secure.putStringForUser(resolver, name, value, userHandle); 7473 } 7474 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 7475 } 7476 7477 /** 7478 * Construct the content URI for a particular name/value pair, 7479 * useful for monitoring changes with a ContentObserver. 7480 * @param name to look up in the table 7481 * @return the corresponding content URI, or null if not present 7482 */ 7483 public static Uri getUriFor(String name) { 7484 return getUriFor(CONTENT_URI, name); 7485 } 7486 7487 /** 7488 * Convenience function for retrieving a single secure settings value 7489 * as an integer. Note that internally setting values are always 7490 * stored as strings; this function converts the string to an integer 7491 * for you. The default value will be returned if the setting is 7492 * not defined or not an integer. 7493 * 7494 * @param cr The ContentResolver to access. 7495 * @param name The name of the setting to retrieve. 7496 * @param def Value to return if the setting is not defined. 7497 * 7498 * @return The setting's current value, or 'def' if it is not defined 7499 * or not a valid integer. 7500 */ 7501 public static int getInt(ContentResolver cr, String name, int def) { 7502 String v = getString(cr, name); 7503 try { 7504 return v != null ? Integer.parseInt(v) : def; 7505 } catch (NumberFormatException e) { 7506 return def; 7507 } 7508 } 7509 7510 /** 7511 * Convenience function for retrieving a single secure settings value 7512 * as an integer. Note that internally setting values are always 7513 * stored as strings; this function converts the string to an integer 7514 * for you. 7515 * <p> 7516 * This version does not take a default value. If the setting has not 7517 * been set, or the string value is not a number, 7518 * it throws {@link SettingNotFoundException}. 7519 * 7520 * @param cr The ContentResolver to access. 7521 * @param name The name of the setting to retrieve. 7522 * 7523 * @throws SettingNotFoundException Thrown if a setting by the given 7524 * name can't be found or the setting value is not an integer. 7525 * 7526 * @return The setting's current value. 7527 */ 7528 public static int getInt(ContentResolver cr, String name) 7529 throws SettingNotFoundException { 7530 String v = getString(cr, name); 7531 try { 7532 return Integer.parseInt(v); 7533 } catch (NumberFormatException e) { 7534 throw new SettingNotFoundException(name); 7535 } 7536 } 7537 7538 /** 7539 * Convenience function for updating a single settings value as an 7540 * integer. This will either create a new entry in the table if the 7541 * given name does not exist, or modify the value of the existing row 7542 * with that name. Note that internally setting values are always 7543 * stored as strings, so this function converts the given value to a 7544 * string before storing it. 7545 * 7546 * @param cr The ContentResolver to access. 7547 * @param name The name of the setting to modify. 7548 * @param value The new value for the setting. 7549 * @return true if the value was set, false on database errors 7550 */ 7551 public static boolean putInt(ContentResolver cr, String name, int value) { 7552 return putString(cr, name, Integer.toString(value)); 7553 } 7554 7555 /** 7556 * Convenience function for retrieving a single secure settings value 7557 * as a {@code long}. Note that internally setting values are always 7558 * stored as strings; this function converts the string to a {@code long} 7559 * for you. The default value will be returned if the setting is 7560 * not defined or not a {@code long}. 7561 * 7562 * @param cr The ContentResolver to access. 7563 * @param name The name of the setting to retrieve. 7564 * @param def Value to return if the setting is not defined. 7565 * 7566 * @return The setting's current value, or 'def' if it is not defined 7567 * or not a valid {@code long}. 7568 */ 7569 public static long getLong(ContentResolver cr, String name, long def) { 7570 String valString = getString(cr, name); 7571 long value; 7572 try { 7573 value = valString != null ? Long.parseLong(valString) : def; 7574 } catch (NumberFormatException e) { 7575 value = def; 7576 } 7577 return value; 7578 } 7579 7580 /** 7581 * Convenience function for retrieving a single secure settings value 7582 * as a {@code long}. Note that internally setting values are always 7583 * stored as strings; this function converts the string to a {@code long} 7584 * for you. 7585 * <p> 7586 * This version does not take a default value. If the setting has not 7587 * been set, or the string value is not a number, 7588 * it throws {@link SettingNotFoundException}. 7589 * 7590 * @param cr The ContentResolver to access. 7591 * @param name The name of the setting to retrieve. 7592 * 7593 * @return The setting's current value. 7594 * @throws SettingNotFoundException Thrown if a setting by the given 7595 * name can't be found or the setting value is not an integer. 7596 */ 7597 public static long getLong(ContentResolver cr, String name) 7598 throws SettingNotFoundException { 7599 String valString = getString(cr, name); 7600 try { 7601 return Long.parseLong(valString); 7602 } catch (NumberFormatException e) { 7603 throw new SettingNotFoundException(name); 7604 } 7605 } 7606 7607 /** 7608 * Convenience function for updating a secure settings value as a long 7609 * integer. This will either create a new entry in the table if the 7610 * given name does not exist, or modify the value of the existing row 7611 * with that name. Note that internally setting values are always 7612 * stored as strings, so this function converts the given value to a 7613 * string before storing it. 7614 * 7615 * @param cr The ContentResolver to access. 7616 * @param name The name of the setting to modify. 7617 * @param value The new value for the setting. 7618 * @return true if the value was set, false on database errors 7619 */ 7620 public static boolean putLong(ContentResolver cr, String name, long value) { 7621 return putString(cr, name, Long.toString(value)); 7622 } 7623 7624 /** 7625 * Convenience function for retrieving a single secure settings value 7626 * as a floating point number. Note that internally setting values are 7627 * always stored as strings; this function converts the string to an 7628 * float for you. The default value will be returned if the setting 7629 * is not defined or not a valid float. 7630 * 7631 * @param cr The ContentResolver to access. 7632 * @param name The name of the setting to retrieve. 7633 * @param def Value to return if the setting is not defined. 7634 * 7635 * @return The setting's current value, or 'def' if it is not defined 7636 * or not a valid float. 7637 */ 7638 public static float getFloat(ContentResolver cr, String name, float def) { 7639 String v = getString(cr, name); 7640 try { 7641 return v != null ? Float.parseFloat(v) : def; 7642 } catch (NumberFormatException e) { 7643 return def; 7644 } 7645 } 7646 7647 /** 7648 * Convenience function for retrieving a single secure settings value 7649 * as a float. Note that internally setting values are always 7650 * stored as strings; this function converts the string to a float 7651 * for you. 7652 * <p> 7653 * This version does not take a default value. If the setting has not 7654 * been set, or the string value is not a number, 7655 * it throws {@link SettingNotFoundException}. 7656 * 7657 * @param cr The ContentResolver to access. 7658 * @param name The name of the setting to retrieve. 7659 * 7660 * @throws SettingNotFoundException Thrown if a setting by the given 7661 * name can't be found or the setting value is not a float. 7662 * 7663 * @return The setting's current value. 7664 */ 7665 public static float getFloat(ContentResolver cr, String name) 7666 throws SettingNotFoundException { 7667 String v = getString(cr, name); 7668 if (v == null) { 7669 throw new SettingNotFoundException(name); 7670 } 7671 try { 7672 return Float.parseFloat(v); 7673 } catch (NumberFormatException e) { 7674 throw new SettingNotFoundException(name); 7675 } 7676 } 7677 7678 /** 7679 * Convenience function for updating a single settings value as a 7680 * floating point number. This will either create a new entry in the 7681 * table if the given name does not exist, or modify the value of the 7682 * existing row with that name. Note that internally setting values 7683 * are always stored as strings, so this function converts the given 7684 * value to a string before storing it. 7685 * 7686 * @param cr The ContentResolver to access. 7687 * @param name The name of the setting to modify. 7688 * @param value The new value for the setting. 7689 * @return true if the value was set, false on database errors 7690 */ 7691 public static boolean putFloat(ContentResolver cr, String name, float value) { 7692 return putString(cr, name, Float.toString(value)); 7693 } 7694 7695 7696 /** 7697 * Subscription to be used for voice call on a multi sim device. The supported values 7698 * are 0 = SUB1, 1 = SUB2 and etc. 7699 * @hide 7700 */ 7701 public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; 7702 7703 /** 7704 * Used to provide option to user to select subscription during dial. 7705 * The supported values are 0 = disable or 1 = enable prompt. 7706 * @hide 7707 */ 7708 public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt"; 7709 7710 /** 7711 * Subscription to be used for data call on a multi sim device. The supported values 7712 * are 0 = SUB1, 1 = SUB2 and etc. 7713 * @hide 7714 */ 7715 public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; 7716 7717 /** 7718 * Subscription to be used for SMS on a multi sim device. The supported values 7719 * are 0 = SUB1, 1 = SUB2 and etc. 7720 * @hide 7721 */ 7722 public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms"; 7723 7724 /** 7725 * Used to provide option to user to select subscription during send SMS. 7726 * The value 1 - enable, 0 - disable 7727 * @hide 7728 */ 7729 public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt"; 7730 7731 7732 7733 /** User preferred subscriptions setting. 7734 * This holds the details of the user selected subscription from the card and 7735 * the activation status. Each settings string have the coma separated values 7736 * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index 7737 * @hide 7738 */ 7739 public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1", 7740 "user_preferred_sub2","user_preferred_sub3"}; 7741 7742 /** 7743 * Whether to enable new contacts aggregator or not. 7744 * The value 1 - enable, 0 - disable 7745 * @hide 7746 */ 7747 public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator"; 7748 7749 /** 7750 * Whether to enable contacts metadata syncing or not 7751 * The value 1 - enable, 0 - disable 7752 * @hide 7753 */ 7754 public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync"; 7755 } 7756 7757 /** 7758 * User-defined bookmarks and shortcuts. The target of each bookmark is an 7759 * Intent URL, allowing it to be either a web page or a particular 7760 * application activity. 7761 * 7762 * @hide 7763 */ 7764 public static final class Bookmarks implements BaseColumns 7765 { 7766 private static final String TAG = "Bookmarks"; 7767 7768 /** 7769 * The content:// style URL for this table 7770 */ 7771 public static final Uri CONTENT_URI = 7772 Uri.parse("content://" + AUTHORITY + "/bookmarks"); 7773 7774 /** 7775 * The row ID. 7776 * <p>Type: INTEGER</p> 7777 */ 7778 public static final String ID = "_id"; 7779 7780 /** 7781 * Descriptive name of the bookmark that can be displayed to the user. 7782 * If this is empty, the title should be resolved at display time (use 7783 * {@link #getTitle(Context, Cursor)} any time you want to display the 7784 * title of a bookmark.) 7785 * <P> 7786 * Type: TEXT 7787 * </P> 7788 */ 7789 public static final String TITLE = "title"; 7790 7791 /** 7792 * Arbitrary string (displayed to the user) that allows bookmarks to be 7793 * organized into categories. There are some special names for 7794 * standard folders, which all start with '@'. The label displayed for 7795 * the folder changes with the locale (via {@link #getLabelForFolder}) but 7796 * the folder name does not change so you can consistently query for 7797 * the folder regardless of the current locale. 7798 * 7799 * <P>Type: TEXT</P> 7800 * 7801 */ 7802 public static final String FOLDER = "folder"; 7803 7804 /** 7805 * The Intent URL of the bookmark, describing what it points to. This 7806 * value is given to {@link android.content.Intent#getIntent} to create 7807 * an Intent that can be launched. 7808 * <P>Type: TEXT</P> 7809 */ 7810 public static final String INTENT = "intent"; 7811 7812 /** 7813 * Optional shortcut character associated with this bookmark. 7814 * <P>Type: INTEGER</P> 7815 */ 7816 public static final String SHORTCUT = "shortcut"; 7817 7818 /** 7819 * The order in which the bookmark should be displayed 7820 * <P>Type: INTEGER</P> 7821 */ 7822 public static final String ORDERING = "ordering"; 7823 7824 private static final String[] sIntentProjection = { INTENT }; 7825 private static final String[] sShortcutProjection = { ID, SHORTCUT }; 7826 private static final String sShortcutSelection = SHORTCUT + "=?"; 7827 7828 /** 7829 * Convenience function to retrieve the bookmarked Intent for a 7830 * particular shortcut key. 7831 * 7832 * @param cr The ContentResolver to query. 7833 * @param shortcut The shortcut key. 7834 * 7835 * @return Intent The bookmarked URL, or null if there is no bookmark 7836 * matching the given shortcut. 7837 */ 7838 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut) 7839 { 7840 Intent intent = null; 7841 7842 Cursor c = cr.query(CONTENT_URI, 7843 sIntentProjection, sShortcutSelection, 7844 new String[] { String.valueOf((int) shortcut) }, ORDERING); 7845 // Keep trying until we find a valid shortcut 7846 try { 7847 while (intent == null && c.moveToNext()) { 7848 try { 7849 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT)); 7850 intent = Intent.parseUri(intentURI, 0); 7851 } catch (java.net.URISyntaxException e) { 7852 // The stored URL is bad... ignore it. 7853 } catch (IllegalArgumentException e) { 7854 // Column not found 7855 Log.w(TAG, "Intent column not found", e); 7856 } 7857 } 7858 } finally { 7859 if (c != null) c.close(); 7860 } 7861 7862 return intent; 7863 } 7864 7865 /** 7866 * Add a new bookmark to the system. 7867 * 7868 * @param cr The ContentResolver to query. 7869 * @param intent The desired target of the bookmark. 7870 * @param title Bookmark title that is shown to the user; null if none 7871 * or it should be resolved to the intent's title. 7872 * @param folder Folder in which to place the bookmark; null if none. 7873 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If 7874 * this is non-zero and there is an existing bookmark entry 7875 * with this same shortcut, then that existing shortcut is 7876 * cleared (the bookmark is not removed). 7877 * @return The unique content URL for the new bookmark entry. 7878 */ 7879 public static Uri add(ContentResolver cr, 7880 Intent intent, 7881 String title, 7882 String folder, 7883 char shortcut, 7884 int ordering) 7885 { 7886 // If a shortcut is supplied, and it is already defined for 7887 // another bookmark, then remove the old definition. 7888 if (shortcut != 0) { 7889 cr.delete(CONTENT_URI, sShortcutSelection, 7890 new String[] { String.valueOf((int) shortcut) }); 7891 } 7892 7893 ContentValues values = new ContentValues(); 7894 if (title != null) values.put(TITLE, title); 7895 if (folder != null) values.put(FOLDER, folder); 7896 values.put(INTENT, intent.toUri(0)); 7897 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut); 7898 values.put(ORDERING, ordering); 7899 return cr.insert(CONTENT_URI, values); 7900 } 7901 7902 /** 7903 * Return the folder name as it should be displayed to the user. This 7904 * takes care of localizing special folders. 7905 * 7906 * @param r Resources object for current locale; only need access to 7907 * system resources. 7908 * @param folder The value found in the {@link #FOLDER} column. 7909 * 7910 * @return CharSequence The label for this folder that should be shown 7911 * to the user. 7912 */ 7913 public static CharSequence getLabelForFolder(Resources r, String folder) { 7914 return folder; 7915 } 7916 7917 /** 7918 * Return the title as it should be displayed to the user. This takes 7919 * care of localizing bookmarks that point to activities. 7920 * 7921 * @param context A context. 7922 * @param cursor A cursor pointing to the row whose title should be 7923 * returned. The cursor must contain at least the {@link #TITLE} 7924 * and {@link #INTENT} columns. 7925 * @return A title that is localized and can be displayed to the user, 7926 * or the empty string if one could not be found. 7927 */ 7928 public static CharSequence getTitle(Context context, Cursor cursor) { 7929 int titleColumn = cursor.getColumnIndex(TITLE); 7930 int intentColumn = cursor.getColumnIndex(INTENT); 7931 if (titleColumn == -1 || intentColumn == -1) { 7932 throw new IllegalArgumentException( 7933 "The cursor must contain the TITLE and INTENT columns."); 7934 } 7935 7936 String title = cursor.getString(titleColumn); 7937 if (!TextUtils.isEmpty(title)) { 7938 return title; 7939 } 7940 7941 String intentUri = cursor.getString(intentColumn); 7942 if (TextUtils.isEmpty(intentUri)) { 7943 return ""; 7944 } 7945 7946 Intent intent; 7947 try { 7948 intent = Intent.parseUri(intentUri, 0); 7949 } catch (URISyntaxException e) { 7950 return ""; 7951 } 7952 7953 PackageManager packageManager = context.getPackageManager(); 7954 ResolveInfo info = packageManager.resolveActivity(intent, 0); 7955 return info != null ? info.loadLabel(packageManager) : ""; 7956 } 7957 } 7958 7959 /** 7960 * Returns the device ID that we should use when connecting to the mobile gtalk server. 7961 * This is a string like "android-0x1242", where the hex string is the Android ID obtained 7962 * from the GoogleLoginService. 7963 * 7964 * @param androidId The Android ID for this device. 7965 * @return The device ID that should be used when connecting to the mobile gtalk server. 7966 * @hide 7967 */ 7968 public static String getGTalkDeviceId(long androidId) { 7969 return "android-" + Long.toHexString(androidId); 7970 } 7971} 7972