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