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