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