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