Settings.java revision ead9389fd2e3e325cbe5bf9bdd896dd7c9113540
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.USB_MASS_STORAGE_ENABLED); 2675 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); 2676 MOVED_TO_GLOBAL.add(Settings.Global.WEB_AUTOFILL_QUERY_URL); 2677 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); 2678 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); 2679 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); 2680 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); 2681 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); 2682 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); 2683 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 2684 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 2685 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); 2686 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); 2687 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); 2688 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); 2689 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); 2690 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); 2691 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); 2692 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); 2693 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); 2694 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); 2695 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); 2696 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); 2697 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); 2698 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); 2699 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); 2700 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); 2701 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); 2702 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); 2703 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); 2704 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); 2705 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); 2706 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); 2707 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); 2708 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); 2709 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); 2710 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); 2711 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); 2712 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); 2713 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); 2714 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); 2715 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); 2716 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); 2717 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); 2718 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); 2719 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); 2720 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); 2721 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); 2722 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); 2723 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); 2724 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); 2725 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); 2726 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); 2727 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); 2728 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); 2729 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); 2730 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); 2731 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); 2732 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); 2733 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_CDMA_SUBSCRIPTION); 2734 } 2735 2736 /** @hide */ 2737 public static void getMovedKeys(HashSet<String> outKeySet) { 2738 outKeySet.addAll(MOVED_TO_GLOBAL); 2739 } 2740 2741 /** 2742 * Look up a name in the database. 2743 * @param resolver to access the database with 2744 * @param name to look up in the table 2745 * @return the corresponding value, or null if not present 2746 */ 2747 public static String getString(ContentResolver resolver, String name) { 2748 return getStringForUser(resolver, name, UserHandle.myUserId()); 2749 } 2750 2751 /** @hide */ 2752 public static String getStringForUser(ContentResolver resolver, String name, 2753 int userHandle) { 2754 if (MOVED_TO_GLOBAL.contains(name)) { 2755 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 2756 + " to android.provider.Settings.Global."); 2757 return Global.getStringForUser(resolver, name, userHandle); 2758 } 2759 2760 if (MOVED_TO_LOCK_SETTINGS.contains(name)) { 2761 synchronized (Secure.class) { 2762 if (sLockSettings == null) { 2763 sLockSettings = ILockSettings.Stub.asInterface( 2764 (IBinder) ServiceManager.getService("lock_settings")); 2765 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; 2766 } 2767 } 2768 if (sLockSettings != null && !sIsSystemProcess) { 2769 try { 2770 return sLockSettings.getString(name, "0", userHandle); 2771 } catch (RemoteException re) { 2772 // Fall through 2773 } 2774 } 2775 } 2776 2777 return sNameValueCache.getStringForUser(resolver, name, userHandle); 2778 } 2779 2780 /** 2781 * Store a name/value pair into the database. 2782 * @param resolver to access the database with 2783 * @param name to store 2784 * @param value to associate with the name 2785 * @return true if the value was set, false on database errors 2786 */ 2787 public static boolean putString(ContentResolver resolver, String name, String value) { 2788 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 2789 } 2790 2791 /** @hide */ 2792 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 2793 int userHandle) { 2794 if (MOVED_TO_GLOBAL.contains(name)) { 2795 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2796 + " to android.provider.Settings.Global"); 2797 return Global.putStringForUser(resolver, name, value, userHandle); 2798 } 2799 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 2800 } 2801 2802 /** 2803 * Construct the content URI for a particular name/value pair, 2804 * useful for monitoring changes with a ContentObserver. 2805 * @param name to look up in the table 2806 * @return the corresponding content URI, or null if not present 2807 */ 2808 public static Uri getUriFor(String name) { 2809 if (MOVED_TO_GLOBAL.contains(name)) { 2810 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 2811 + " to android.provider.Settings.Global, returning global URI."); 2812 return Global.getUriFor(Global.CONTENT_URI, name); 2813 } 2814 return getUriFor(CONTENT_URI, name); 2815 } 2816 2817 /** 2818 * Convenience function for retrieving a single secure settings value 2819 * as an integer. Note that internally setting values are always 2820 * stored as strings; this function converts the string to an integer 2821 * for you. The default value will be returned if the setting is 2822 * not defined or not an integer. 2823 * 2824 * @param cr The ContentResolver to access. 2825 * @param name The name of the setting to retrieve. 2826 * @param def Value to return if the setting is not defined. 2827 * 2828 * @return The setting's current value, or 'def' if it is not defined 2829 * or not a valid integer. 2830 */ 2831 public static int getInt(ContentResolver cr, String name, int def) { 2832 return getIntForUser(cr, name, def, UserHandle.myUserId()); 2833 } 2834 2835 /** @hide */ 2836 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 2837 String v = getStringForUser(cr, name, userHandle); 2838 try { 2839 return v != null ? Integer.parseInt(v) : def; 2840 } catch (NumberFormatException e) { 2841 return def; 2842 } 2843 } 2844 2845 /** 2846 * Convenience function for retrieving a single secure settings value 2847 * as an integer. Note that internally setting values are always 2848 * stored as strings; this function converts the string to an integer 2849 * for you. 2850 * <p> 2851 * This version does not take a default value. If the setting has not 2852 * been set, or the string value is not a number, 2853 * it throws {@link SettingNotFoundException}. 2854 * 2855 * @param cr The ContentResolver to access. 2856 * @param name The name of the setting to retrieve. 2857 * 2858 * @throws SettingNotFoundException Thrown if a setting by the given 2859 * name can't be found or the setting value is not an integer. 2860 * 2861 * @return The setting's current value. 2862 */ 2863 public static int getInt(ContentResolver cr, String name) 2864 throws SettingNotFoundException { 2865 return getIntForUser(cr, name, UserHandle.myUserId()); 2866 } 2867 2868 /** @hide */ 2869 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 2870 throws SettingNotFoundException { 2871 String v = getStringForUser(cr, name, userHandle); 2872 try { 2873 return Integer.parseInt(v); 2874 } catch (NumberFormatException e) { 2875 throw new SettingNotFoundException(name); 2876 } 2877 } 2878 2879 /** 2880 * Convenience function for updating a single settings value as an 2881 * integer. This will either create a new entry in the table if the 2882 * given name does not exist, or modify the value of the existing row 2883 * with that name. Note that internally setting values are always 2884 * stored as strings, so this function converts the given value to a 2885 * string before storing it. 2886 * 2887 * @param cr The ContentResolver to access. 2888 * @param name The name of the setting to modify. 2889 * @param value The new value for the setting. 2890 * @return true if the value was set, false on database errors 2891 */ 2892 public static boolean putInt(ContentResolver cr, String name, int value) { 2893 return putIntForUser(cr, name, value, UserHandle.myUserId()); 2894 } 2895 2896 /** @hide */ 2897 public static boolean putIntForUser(ContentResolver cr, String name, int value, 2898 int userHandle) { 2899 return putStringForUser(cr, name, Integer.toString(value), userHandle); 2900 } 2901 2902 /** 2903 * Convenience function for retrieving a single secure settings value 2904 * as a {@code long}. Note that internally setting values are always 2905 * stored as strings; this function converts the string to a {@code long} 2906 * for you. The default value will be returned if the setting is 2907 * not defined or not a {@code long}. 2908 * 2909 * @param cr The ContentResolver to access. 2910 * @param name The name of the setting to retrieve. 2911 * @param def Value to return if the setting is not defined. 2912 * 2913 * @return The setting's current value, or 'def' if it is not defined 2914 * or not a valid {@code long}. 2915 */ 2916 public static long getLong(ContentResolver cr, String name, long def) { 2917 return getLongForUser(cr, name, def, UserHandle.myUserId()); 2918 } 2919 2920 /** @hide */ 2921 public static long getLongForUser(ContentResolver cr, String name, long def, 2922 int userHandle) { 2923 String valString = getStringForUser(cr, name, userHandle); 2924 long value; 2925 try { 2926 value = valString != null ? Long.parseLong(valString) : def; 2927 } catch (NumberFormatException e) { 2928 value = def; 2929 } 2930 return value; 2931 } 2932 2933 /** 2934 * Convenience function for retrieving a single secure settings value 2935 * as a {@code long}. Note that internally setting values are always 2936 * stored as strings; this function converts the string to a {@code long} 2937 * for you. 2938 * <p> 2939 * This version does not take a default value. If the setting has not 2940 * been set, or the string value is not a number, 2941 * it throws {@link SettingNotFoundException}. 2942 * 2943 * @param cr The ContentResolver to access. 2944 * @param name The name of the setting to retrieve. 2945 * 2946 * @return The setting's current value. 2947 * @throws SettingNotFoundException Thrown if a setting by the given 2948 * name can't be found or the setting value is not an integer. 2949 */ 2950 public static long getLong(ContentResolver cr, String name) 2951 throws SettingNotFoundException { 2952 return getLongForUser(cr, name, UserHandle.myUserId()); 2953 } 2954 2955 /** @hide */ 2956 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 2957 throws SettingNotFoundException { 2958 String valString = getStringForUser(cr, name, userHandle); 2959 try { 2960 return Long.parseLong(valString); 2961 } catch (NumberFormatException e) { 2962 throw new SettingNotFoundException(name); 2963 } 2964 } 2965 2966 /** 2967 * Convenience function for updating a secure settings value as a long 2968 * integer. This will either create a new entry in the table if the 2969 * given name does not exist, or modify the value of the existing row 2970 * with that name. Note that internally setting values are always 2971 * stored as strings, so this function converts the given value to a 2972 * string before storing it. 2973 * 2974 * @param cr The ContentResolver to access. 2975 * @param name The name of the setting to modify. 2976 * @param value The new value for the setting. 2977 * @return true if the value was set, false on database errors 2978 */ 2979 public static boolean putLong(ContentResolver cr, String name, long value) { 2980 return putLongForUser(cr, name, value, UserHandle.myUserId()); 2981 } 2982 2983 /** @hide */ 2984 public static boolean putLongForUser(ContentResolver cr, String name, long value, 2985 int userHandle) { 2986 return putStringForUser(cr, name, Long.toString(value), userHandle); 2987 } 2988 2989 /** 2990 * Convenience function for retrieving a single secure settings value 2991 * as a floating point number. Note that internally setting values are 2992 * always stored as strings; this function converts the string to an 2993 * float for you. The default value will be returned if the setting 2994 * is not defined or not a valid float. 2995 * 2996 * @param cr The ContentResolver to access. 2997 * @param name The name of the setting to retrieve. 2998 * @param def Value to return if the setting is not defined. 2999 * 3000 * @return The setting's current value, or 'def' if it is not defined 3001 * or not a valid float. 3002 */ 3003 public static float getFloat(ContentResolver cr, String name, float def) { 3004 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 3005 } 3006 3007 /** @hide */ 3008 public static float getFloatForUser(ContentResolver cr, String name, float def, 3009 int userHandle) { 3010 String v = getStringForUser(cr, name, userHandle); 3011 try { 3012 return v != null ? Float.parseFloat(v) : def; 3013 } catch (NumberFormatException e) { 3014 return def; 3015 } 3016 } 3017 3018 /** 3019 * Convenience function for retrieving a single secure settings value 3020 * as a float. Note that internally setting values are always 3021 * stored as strings; this function converts the string to a float 3022 * for you. 3023 * <p> 3024 * This version does not take a default value. If the setting has not 3025 * been set, or the string value is not a number, 3026 * it throws {@link SettingNotFoundException}. 3027 * 3028 * @param cr The ContentResolver to access. 3029 * @param name The name of the setting to retrieve. 3030 * 3031 * @throws SettingNotFoundException Thrown if a setting by the given 3032 * name can't be found or the setting value is not a float. 3033 * 3034 * @return The setting's current value. 3035 */ 3036 public static float getFloat(ContentResolver cr, String name) 3037 throws SettingNotFoundException { 3038 return getFloatForUser(cr, name, UserHandle.myUserId()); 3039 } 3040 3041 /** @hide */ 3042 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 3043 throws SettingNotFoundException { 3044 String v = getStringForUser(cr, name, userHandle); 3045 if (v == null) { 3046 throw new SettingNotFoundException(name); 3047 } 3048 try { 3049 return Float.parseFloat(v); 3050 } catch (NumberFormatException e) { 3051 throw new SettingNotFoundException(name); 3052 } 3053 } 3054 3055 /** 3056 * Convenience function for updating a single settings value as a 3057 * floating point number. This will either create a new entry in the 3058 * table if the given name does not exist, or modify the value of the 3059 * existing row with that name. Note that internally setting values 3060 * are always stored as strings, so this function converts the given 3061 * value to a string before storing it. 3062 * 3063 * @param cr The ContentResolver to access. 3064 * @param name The name of the setting to modify. 3065 * @param value The new value for the setting. 3066 * @return true if the value was set, false on database errors 3067 */ 3068 public static boolean putFloat(ContentResolver cr, String name, float value) { 3069 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 3070 } 3071 3072 /** @hide */ 3073 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 3074 int userHandle) { 3075 return putStringForUser(cr, name, Float.toString(value), userHandle); 3076 } 3077 3078 /** 3079 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} 3080 * instead 3081 */ 3082 @Deprecated 3083 public static final String DEVELOPMENT_SETTINGS_ENABLED = 3084 Global.DEVELOPMENT_SETTINGS_ENABLED; 3085 3086 /** 3087 * When the user has enable the option to have a "bug report" command 3088 * in the power menu. 3089 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead 3090 * @hide 3091 */ 3092 @Deprecated 3093 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 3094 3095 /** 3096 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead 3097 */ 3098 @Deprecated 3099 public static final String ADB_ENABLED = Global.ADB_ENABLED; 3100 3101 /** 3102 * Setting to allow mock locations and location provider status to be injected into the 3103 * LocationManager service for testing purposes during application development. These 3104 * locations and status values override actual location and status information generated 3105 * by network, gps, or other location providers. 3106 */ 3107 public static final String ALLOW_MOCK_LOCATION = "mock_location"; 3108 3109 /** 3110 * A 64-bit number (as a hex string) that is randomly 3111 * generated on the device's first boot and should remain 3112 * constant for the lifetime of the device. (The value may 3113 * change if a factory reset is performed on the device.) 3114 */ 3115 public static final String ANDROID_ID = "android_id"; 3116 3117 /** 3118 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 3119 */ 3120 @Deprecated 3121 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 3122 3123 /** 3124 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 3125 */ 3126 @Deprecated 3127 public static final String DATA_ROAMING = Global.DATA_ROAMING; 3128 3129 /** 3130 * Setting to record the input method used by default, holding the ID 3131 * of the desired method. 3132 */ 3133 public static final String DEFAULT_INPUT_METHOD = "default_input_method"; 3134 3135 /** 3136 * Setting to record the input method subtype used by default, holding the ID 3137 * of the desired method. 3138 */ 3139 public static final String SELECTED_INPUT_METHOD_SUBTYPE = 3140 "selected_input_method_subtype"; 3141 3142 /** 3143 * Setting to record the history of input method subtype, holding the pair of ID of IME 3144 * and its last used subtype. 3145 * @hide 3146 */ 3147 public static final String INPUT_METHODS_SUBTYPE_HISTORY = 3148 "input_methods_subtype_history"; 3149 3150 /** 3151 * Setting to record the visibility of input method selector 3152 */ 3153 public static final String INPUT_METHOD_SELECTOR_VISIBILITY = 3154 "input_method_selector_visibility"; 3155 3156 /** 3157 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 3158 */ 3159 @Deprecated 3160 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 3161 3162 /** 3163 * Whether the current user has been set up via setup wizard (0 = false, 1 = true) 3164 * @hide 3165 */ 3166 public static final String USER_SETUP_COMPLETE = "user_setup_complete"; 3167 3168 /** 3169 * List of input methods that are currently enabled. This is a string 3170 * containing the IDs of all enabled input methods, each ID separated 3171 * by ':'. 3172 */ 3173 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; 3174 3175 /** 3176 * List of system input methods that are currently disabled. This is a string 3177 * containing the IDs of all disabled input methods, each ID separated 3178 * by ':'. 3179 * @hide 3180 */ 3181 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; 3182 3183 /** 3184 * Host name and port for global http proxy. Uses ':' seperator for 3185 * between host and port. 3186 * 3187 * @deprecated Use {@link Global#HTTP_PROXY} 3188 */ 3189 @Deprecated 3190 public static final String HTTP_PROXY = Global.HTTP_PROXY; 3191 3192 /** 3193 * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead 3194 */ 3195 @Deprecated 3196 public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; 3197 3198 /** 3199 * Comma-separated list of location providers that activities may access. 3200 */ 3201 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; 3202 3203 /** 3204 * A flag containing settings used for biometric weak 3205 * @hide 3206 */ 3207 public static final String LOCK_BIOMETRIC_WEAK_FLAGS = 3208 "lock_biometric_weak_flags"; 3209 3210 /** 3211 * Whether autolock is enabled (0 = false, 1 = true) 3212 */ 3213 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; 3214 3215 /** 3216 * Whether lock pattern is visible as user enters (0 = false, 1 = true) 3217 */ 3218 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 3219 3220 /** 3221 * Whether lock pattern will vibrate as user enters (0 = false, 1 = 3222 * true) 3223 * 3224 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the 3225 * lockscreen uses 3226 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. 3227 */ 3228 @Deprecated 3229 public static final String 3230 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; 3231 3232 /** 3233 * This preference allows the device to be locked given time after screen goes off, 3234 * subject to current DeviceAdmin policy limits. 3235 * @hide 3236 */ 3237 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; 3238 3239 3240 /** 3241 * This preference contains the string that shows for owner info on LockScreen. 3242 * @hide 3243 */ 3244 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; 3245 3246 /** 3247 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). 3248 * @hide 3249 */ 3250 public static final String LOCK_SCREEN_APPWIDGET_IDS = 3251 "lock_screen_appwidget_ids"; 3252 3253 /** 3254 * Id of the appwidget shown on the lock screen when appwidgets are disabled. 3255 * @hide 3256 */ 3257 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = 3258 "lock_screen_fallback_appwidget_id"; 3259 3260 /** 3261 * Index of the lockscreen appwidget to restore, -1 if none. 3262 * @hide 3263 */ 3264 public static final String LOCK_SCREEN_STICKY_APPWIDGET = 3265 "lock_screen_sticky_appwidget"; 3266 3267 /** 3268 * This preference enables showing the owner info on LockScreen. 3269 * @hide 3270 */ 3271 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = 3272 "lock_screen_owner_info_enabled"; 3273 3274 /** 3275 * The Logging ID (a unique 64-bit value) as a hex string. 3276 * Used as a pseudonymous identifier for logging. 3277 * @deprecated This identifier is poorly initialized and has 3278 * many collisions. It should not be used. 3279 */ 3280 @Deprecated 3281 public static final String LOGGING_ID = "logging_id"; 3282 3283 /** 3284 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 3285 */ 3286 @Deprecated 3287 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 3288 3289 /** 3290 * No longer supported. 3291 */ 3292 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 3293 3294 /** 3295 * No longer supported. 3296 */ 3297 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 3298 3299 /** 3300 * No longer supported. 3301 */ 3302 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 3303 3304 /** 3305 * Settings classname to launch when Settings is clicked from All 3306 * Applications. Needed because of user testing between the old 3307 * and new Settings apps. 3308 */ 3309 // TODO: 881807 3310 public static final String SETTINGS_CLASSNAME = "settings_classname"; 3311 3312 /** 3313 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 3314 */ 3315 @Deprecated 3316 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 3317 3318 /** 3319 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 3320 */ 3321 @Deprecated 3322 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 3323 3324 /** 3325 * If accessibility is enabled. 3326 */ 3327 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; 3328 3329 /** 3330 * If touch exploration is enabled. 3331 */ 3332 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; 3333 3334 /** 3335 * List of the enabled accessibility providers. 3336 */ 3337 public static final String ENABLED_ACCESSIBILITY_SERVICES = 3338 "enabled_accessibility_services"; 3339 3340 /** 3341 * List of the accessibility services to which the user has granted 3342 * permission to put the device into touch exploration mode. 3343 * 3344 * @hide 3345 */ 3346 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = 3347 "touch_exploration_granted_accessibility_services"; 3348 3349 /** 3350 * Whether to speak passwords while in accessibility mode. 3351 */ 3352 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; 3353 3354 /** 3355 * If injection of accessibility enhancing JavaScript screen-reader 3356 * is enabled. 3357 * <p> 3358 * Note: The JavaScript based screen-reader is served by the 3359 * Google infrastructure and enable users with disabilities to 3360 * efficiently navigate in and explore web content. 3361 * </p> 3362 * <p> 3363 * This property represents a boolean value. 3364 * </p> 3365 * @hide 3366 */ 3367 public static final String ACCESSIBILITY_SCRIPT_INJECTION = 3368 "accessibility_script_injection"; 3369 3370 /** 3371 * The URL for the injected JavaScript based screen-reader used 3372 * for providing accessibility of content in WebView. 3373 * <p> 3374 * Note: The JavaScript based screen-reader is served by the 3375 * Google infrastructure and enable users with disabilities to 3376 * efficiently navigate in and explore web content. 3377 * </p> 3378 * <p> 3379 * This property represents a string value. 3380 * </p> 3381 * @hide 3382 */ 3383 public static final String ACCESSIBILITY_SCREEN_READER_URL = 3384 "accessibility_script_injection_url"; 3385 3386 /** 3387 * Key bindings for navigation in built-in accessibility support for web content. 3388 * <p> 3389 * Note: These key bindings are for the built-in accessibility navigation for 3390 * web content which is used as a fall back solution if JavaScript in a WebView 3391 * is not enabled or the user has not opted-in script injection from Google. 3392 * </p> 3393 * <p> 3394 * The bindings are separated by semi-colon. A binding is a mapping from 3395 * a key to a sequence of actions (for more details look at 3396 * android.webkit.AccessibilityInjector). A key is represented as the hexademical 3397 * string representation of an integer obtained from a meta state (optional) shifted 3398 * sixteen times left and bitwise ored with a key code. An action is represented 3399 * as a hexademical string representation of an integer where the first two digits 3400 * are navigation action index, the second, the third, and the fourth digit pairs 3401 * represent the action arguments. The separate actions in a binding are colon 3402 * separated. The key and the action sequence it maps to are separated by equals. 3403 * </p> 3404 * <p> 3405 * For example, the binding below maps the DPAD right button to traverse the 3406 * current navigation axis once without firing an accessibility event and to 3407 * perform the same traversal again but to fire an event: 3408 * <code> 3409 * 0x16=0x01000100:0x01000101; 3410 * </code> 3411 * </p> 3412 * <p> 3413 * The goal of this binding is to enable dynamic rebinding of keys to 3414 * navigation actions for web content without requiring a framework change. 3415 * </p> 3416 * <p> 3417 * This property represents a string value. 3418 * </p> 3419 * @hide 3420 */ 3421 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = 3422 "accessibility_web_content_key_bindings"; 3423 3424 /** 3425 * Setting that specifies whether the display magnification is enabled. 3426 * Display magnifications allows the user to zoom in the display content 3427 * and is targeted to low vision users. The current magnification scale 3428 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. 3429 * 3430 * @hide 3431 */ 3432 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = 3433 "accessibility_display_magnification_enabled"; 3434 3435 /** 3436 * Setting that specifies what the display magnification scale is. 3437 * Display magnifications allows the user to zoom in the display 3438 * content and is targeted to low vision users. Whether a display 3439 * magnification is performed is controlled by 3440 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 3441 * 3442 * @hide 3443 */ 3444 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = 3445 "accessibility_display_magnification_scale"; 3446 3447 /** 3448 * Setting that specifies whether the display magnification should be 3449 * automatically updated. If this fearture is enabled the system will 3450 * exit magnification mode or pan the viewport when a context change 3451 * occurs. For example, on staring a new activity or rotating the screen, 3452 * the system may zoom out so the user can see the new context he is in. 3453 * Another example is on showing a window that is not visible in the 3454 * magnified viewport the system may pan the viewport to make the window 3455 * the has popped up so the user knows that the context has changed. 3456 * Whether a screen magnification is performed is controlled by 3457 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 3458 * 3459 * @hide 3460 */ 3461 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = 3462 "accessibility_display_magnification_auto_update"; 3463 3464 /** 3465 * The timout for considering a press to be a long press in milliseconds. 3466 * @hide 3467 */ 3468 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; 3469 3470 /** 3471 * Setting to always use the default text-to-speech settings regardless 3472 * of the application settings. 3473 * 1 = override application settings, 3474 * 0 = use application settings (if specified). 3475 * 3476 * @deprecated The value of this setting is no longer respected by 3477 * the framework text to speech APIs as of the Ice Cream Sandwich release. 3478 */ 3479 @Deprecated 3480 public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; 3481 3482 /** 3483 * Default text-to-speech engine speech rate. 100 = 1x 3484 */ 3485 public static final String TTS_DEFAULT_RATE = "tts_default_rate"; 3486 3487 /** 3488 * Default text-to-speech engine pitch. 100 = 1x 3489 */ 3490 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; 3491 3492 /** 3493 * Default text-to-speech engine. 3494 */ 3495 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; 3496 3497 /** 3498 * Default text-to-speech language. 3499 * 3500 * @deprecated this setting is no longer in use, as of the Ice Cream 3501 * Sandwich release. Apps should never need to read this setting directly, 3502 * instead can query the TextToSpeech framework classes for the default 3503 * locale. {@link TextToSpeech#getLanguage()}. 3504 */ 3505 @Deprecated 3506 public static final String TTS_DEFAULT_LANG = "tts_default_lang"; 3507 3508 /** 3509 * Default text-to-speech country. 3510 * 3511 * @deprecated this setting is no longer in use, as of the Ice Cream 3512 * Sandwich release. Apps should never need to read this setting directly, 3513 * instead can query the TextToSpeech framework classes for the default 3514 * locale. {@link TextToSpeech#getLanguage()}. 3515 */ 3516 @Deprecated 3517 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; 3518 3519 /** 3520 * Default text-to-speech locale variant. 3521 * 3522 * @deprecated this setting is no longer in use, as of the Ice Cream 3523 * Sandwich release. Apps should never need to read this setting directly, 3524 * instead can query the TextToSpeech framework classes for the 3525 * locale that is in use {@link TextToSpeech#getLanguage()}. 3526 */ 3527 @Deprecated 3528 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; 3529 3530 /** 3531 * Stores the default tts locales on a per engine basis. Stored as 3532 * a comma seperated list of values, each value being of the form 3533 * {@code engine_name:locale} for example, 3534 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This 3535 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and 3536 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this 3537 * setting directly, and can query the TextToSpeech framework classes 3538 * for the locale that is in use. 3539 * 3540 * @hide 3541 */ 3542 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; 3543 3544 /** 3545 * Space delimited list of plugin packages that are enabled. 3546 */ 3547 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; 3548 3549 /** 3550 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} 3551 * instead. 3552 */ 3553 @Deprecated 3554 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 3555 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 3556 3557 /** 3558 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} 3559 * instead. 3560 */ 3561 @Deprecated 3562 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 3563 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 3564 3565 /** 3566 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 3567 * instead. 3568 */ 3569 @Deprecated 3570 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = 3571 Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 3572 3573 /** 3574 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} 3575 * instead. 3576 */ 3577 @Deprecated 3578 public static final String WIFI_ON = Global.WIFI_ON; 3579 3580 /** 3581 * The acceptable packet loss percentage (range 0 - 100) before trying 3582 * another AP on the same network. 3583 * @deprecated This setting is not used. 3584 */ 3585 @Deprecated 3586 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 3587 "wifi_watchdog_acceptable_packet_loss_percentage"; 3588 3589 /** 3590 * The number of access points required for a network in order for the 3591 * watchdog to monitor it. 3592 * @deprecated This setting is not used. 3593 */ 3594 @Deprecated 3595 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; 3596 3597 /** 3598 * The delay between background checks. 3599 * @deprecated This setting is not used. 3600 */ 3601 @Deprecated 3602 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 3603 "wifi_watchdog_background_check_delay_ms"; 3604 3605 /** 3606 * Whether the Wi-Fi watchdog is enabled for background checking even 3607 * after it thinks the user has connected to a good access point. 3608 * @deprecated This setting is not used. 3609 */ 3610 @Deprecated 3611 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 3612 "wifi_watchdog_background_check_enabled"; 3613 3614 /** 3615 * The timeout for a background ping 3616 * @deprecated This setting is not used. 3617 */ 3618 @Deprecated 3619 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 3620 "wifi_watchdog_background_check_timeout_ms"; 3621 3622 /** 3623 * The number of initial pings to perform that *may* be ignored if they 3624 * fail. Again, if these fail, they will *not* be used in packet loss 3625 * calculation. For example, one network always seemed to time out for 3626 * the first couple pings, so this is set to 3 by default. 3627 * @deprecated This setting is not used. 3628 */ 3629 @Deprecated 3630 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 3631 "wifi_watchdog_initial_ignored_ping_count"; 3632 3633 /** 3634 * The maximum number of access points (per network) to attempt to test. 3635 * If this number is reached, the watchdog will no longer monitor the 3636 * initial connection state for the network. This is a safeguard for 3637 * networks containing multiple APs whose DNS does not respond to pings. 3638 * @deprecated This setting is not used. 3639 */ 3640 @Deprecated 3641 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; 3642 3643 /** 3644 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 3645 */ 3646 @Deprecated 3647 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 3648 3649 /** 3650 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. 3651 * @deprecated This setting is not used. 3652 */ 3653 @Deprecated 3654 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; 3655 3656 /** 3657 * The number of pings to test if an access point is a good connection. 3658 * @deprecated This setting is not used. 3659 */ 3660 @Deprecated 3661 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; 3662 3663 /** 3664 * The delay between pings. 3665 * @deprecated This setting is not used. 3666 */ 3667 @Deprecated 3668 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; 3669 3670 /** 3671 * The timeout per ping. 3672 * @deprecated This setting is not used. 3673 */ 3674 @Deprecated 3675 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; 3676 3677 /** 3678 * @deprecated Use 3679 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 3680 */ 3681 @Deprecated 3682 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 3683 3684 /** 3685 * @deprecated Use 3686 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 3687 */ 3688 @Deprecated 3689 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 3690 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 3691 3692 /** 3693 * Whether background data usage is allowed. 3694 * 3695 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, 3696 * availability of background data depends on several 3697 * combined factors. When background data is unavailable, 3698 * {@link ConnectivityManager#getActiveNetworkInfo()} will 3699 * now appear disconnected. 3700 */ 3701 @Deprecated 3702 public static final String BACKGROUND_DATA = "background_data"; 3703 3704 /** 3705 * Origins for which browsers should allow geolocation by default. 3706 * The value is a space-separated list of origins. 3707 */ 3708 public static final String ALLOWED_GEOLOCATION_ORIGINS 3709 = "allowed_geolocation_origins"; 3710 3711 /** 3712 * The preferred TTY mode 0 = TTy Off, CDMA default 3713 * 1 = TTY Full 3714 * 2 = TTY HCO 3715 * 3 = TTY VCO 3716 * @hide 3717 */ 3718 public static final String PREFERRED_TTY_MODE = 3719 "preferred_tty_mode"; 3720 3721 /** 3722 * Whether the enhanced voice privacy mode is enabled. 3723 * 0 = normal voice privacy 3724 * 1 = enhanced voice privacy 3725 * @hide 3726 */ 3727 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; 3728 3729 /** 3730 * Whether the TTY mode mode is enabled. 3731 * 0 = disabled 3732 * 1 = enabled 3733 * @hide 3734 */ 3735 public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; 3736 3737 /** 3738 * Controls whether settings backup is enabled. 3739 * Type: int ( 0 = disabled, 1 = enabled ) 3740 * @hide 3741 */ 3742 public static final String BACKUP_ENABLED = "backup_enabled"; 3743 3744 /** 3745 * Controls whether application data is automatically restored from backup 3746 * at install time. 3747 * Type: int ( 0 = disabled, 1 = enabled ) 3748 * @hide 3749 */ 3750 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; 3751 3752 /** 3753 * Indicates whether settings backup has been fully provisioned. 3754 * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) 3755 * @hide 3756 */ 3757 public static final String BACKUP_PROVISIONED = "backup_provisioned"; 3758 3759 /** 3760 * Component of the transport to use for backup/restore. 3761 * @hide 3762 */ 3763 public static final String BACKUP_TRANSPORT = "backup_transport"; 3764 3765 /** 3766 * Version for which the setup wizard was last shown. Bumped for 3767 * each release when there is new setup information to show. 3768 * @hide 3769 */ 3770 public static final String LAST_SETUP_SHOWN = "last_setup_shown"; 3771 3772 /** 3773 * The interval in milliseconds after which Wi-Fi is considered idle. 3774 * When idle, it is possible for the device to be switched from Wi-Fi to 3775 * the mobile data network. 3776 * @hide 3777 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} 3778 * instead. 3779 */ 3780 @Deprecated 3781 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; 3782 3783 /** 3784 * The global search provider chosen by the user (if multiple global 3785 * search providers are installed). This will be the provider returned 3786 * by {@link SearchManager#getGlobalSearchActivity()} if it's still 3787 * installed. This setting is stored as a flattened component name as 3788 * per {@link ComponentName#flattenToString()}. 3789 * 3790 * @hide 3791 */ 3792 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY = 3793 "search_global_search_activity"; 3794 3795 /** 3796 * The number of promoted sources in GlobalSearch. 3797 * @hide 3798 */ 3799 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources"; 3800 /** 3801 * The maximum number of suggestions returned by GlobalSearch. 3802 * @hide 3803 */ 3804 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display"; 3805 /** 3806 * The number of suggestions GlobalSearch will ask each non-web search source for. 3807 * @hide 3808 */ 3809 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source"; 3810 /** 3811 * The number of suggestions the GlobalSearch will ask the web search source for. 3812 * @hide 3813 */ 3814 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT = 3815 "search_web_results_override_limit"; 3816 /** 3817 * The number of milliseconds that GlobalSearch will wait for suggestions from 3818 * promoted sources before continuing with all other sources. 3819 * @hide 3820 */ 3821 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS = 3822 "search_promoted_source_deadline_millis"; 3823 /** 3824 * The number of milliseconds before GlobalSearch aborts search suggesiton queries. 3825 * @hide 3826 */ 3827 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis"; 3828 /** 3829 * The maximum number of milliseconds that GlobalSearch shows the previous results 3830 * after receiving a new query. 3831 * @hide 3832 */ 3833 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis"; 3834 /** 3835 * The maximum age of log data used for shortcuts in GlobalSearch. 3836 * @hide 3837 */ 3838 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis"; 3839 /** 3840 * The maximum age of log data used for source ranking in GlobalSearch. 3841 * @hide 3842 */ 3843 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS = 3844 "search_max_source_event_age_millis"; 3845 /** 3846 * The minimum number of impressions needed to rank a source in GlobalSearch. 3847 * @hide 3848 */ 3849 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING = 3850 "search_min_impressions_for_source_ranking"; 3851 /** 3852 * The minimum number of clicks needed to rank a source in GlobalSearch. 3853 * @hide 3854 */ 3855 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING = 3856 "search_min_clicks_for_source_ranking"; 3857 /** 3858 * The maximum number of shortcuts shown by GlobalSearch. 3859 * @hide 3860 */ 3861 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned"; 3862 /** 3863 * The size of the core thread pool for suggestion queries in GlobalSearch. 3864 * @hide 3865 */ 3866 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE = 3867 "search_query_thread_core_pool_size"; 3868 /** 3869 * The maximum size of the thread pool for suggestion queries in GlobalSearch. 3870 * @hide 3871 */ 3872 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE = 3873 "search_query_thread_max_pool_size"; 3874 /** 3875 * The size of the core thread pool for shortcut refreshing in GlobalSearch. 3876 * @hide 3877 */ 3878 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE = 3879 "search_shortcut_refresh_core_pool_size"; 3880 /** 3881 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch. 3882 * @hide 3883 */ 3884 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE = 3885 "search_shortcut_refresh_max_pool_size"; 3886 /** 3887 * The maximun time that excess threads in the GlobalSeach thread pools will 3888 * wait before terminating. 3889 * @hide 3890 */ 3891 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS = 3892 "search_thread_keepalive_seconds"; 3893 /** 3894 * The maximum number of concurrent suggestion queries to each source. 3895 * @hide 3896 */ 3897 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = 3898 "search_per_source_concurrent_query_limit"; 3899 3900 /** 3901 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true) 3902 * @hide 3903 */ 3904 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; 3905 3906 /** 3907 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true) 3908 * @hide 3909 */ 3910 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart"; 3911 3912 /** 3913 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true) 3914 * @hide 3915 */ 3916 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt"; 3917 3918 /** 3919 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true) 3920 * @hide 3921 */ 3922 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled"; 3923 3924 /** 3925 * If nonzero, ANRs in invisible background processes bring up a dialog. 3926 * Otherwise, the process will be silently killed. 3927 * @hide 3928 */ 3929 public static final String ANR_SHOW_BACKGROUND = "anr_show_background"; 3930 3931 /** 3932 * The {@link ComponentName} string of the service to be used as the voice recognition 3933 * service. 3934 * 3935 * @hide 3936 */ 3937 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service"; 3938 3939 3940 /** 3941 * The {@link ComponentName} string of the selected spell checker service which is 3942 * one of the services managed by the text service manager. 3943 * 3944 * @hide 3945 */ 3946 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker"; 3947 3948 /** 3949 * The {@link ComponentName} string of the selected subtype of the selected spell checker 3950 * service which is one of the services managed by the text service manager. 3951 * 3952 * @hide 3953 */ 3954 public static final String SELECTED_SPELL_CHECKER_SUBTYPE = 3955 "selected_spell_checker_subtype"; 3956 3957 /** 3958 * The {@link ComponentName} string whether spell checker is enabled or not. 3959 * 3960 * @hide 3961 */ 3962 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled"; 3963 3964 /** 3965 * What happens when the user presses the Power button while in-call 3966 * and the screen is on.<br/> 3967 * <b>Values:</b><br/> 3968 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/> 3969 * 2 - The Power button hangs up the current call.<br/> 3970 * 3971 * @hide 3972 */ 3973 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; 3974 3975 /** 3976 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". 3977 * @hide 3978 */ 3979 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1; 3980 3981 /** 3982 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up". 3983 * @hide 3984 */ 3985 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2; 3986 3987 /** 3988 * INCALL_POWER_BUTTON_BEHAVIOR default value. 3989 * @hide 3990 */ 3991 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT = 3992 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF; 3993 3994 /** 3995 * The current night mode that has been selected by the user. Owned 3996 * and controlled by UiModeManagerService. Constants are as per 3997 * UiModeManager. 3998 * @hide 3999 */ 4000 public static final String UI_NIGHT_MODE = "ui_night_mode"; 4001 4002 /** 4003 * Whether screensavers are enabled. 4004 * @hide 4005 */ 4006 public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; 4007 4008 /** 4009 * The user's chosen screensaver components. 4010 * 4011 * These will be launched by the PhoneWindowManager after a timeout when not on 4012 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). 4013 * @hide 4014 */ 4015 public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; 4016 4017 /** 4018 * If screensavers are enabled, whether the screensaver should be automatically launched 4019 * when the device is inserted into a (desk) dock. 4020 * @hide 4021 */ 4022 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; 4023 4024 /** 4025 * If screensavers are enabled, whether the screensaver should be automatically launched 4026 * when the screen times out when not on battery. 4027 * @hide 4028 */ 4029 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; 4030 4031 /** 4032 * If screensavers are enabled, the default screensaver component. 4033 * @hide 4034 */ 4035 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; 4036 4037 /** 4038 * This are the settings to be backed up. 4039 * 4040 * NOTE: Settings are backed up and restored in the order they appear 4041 * in this array. If you have one setting depending on another, 4042 * make sure that they are ordered appropriately. 4043 * 4044 * @hide 4045 */ 4046 public static final String[] SETTINGS_TO_BACKUP = { 4047 BUGREPORT_IN_POWER_MENU, // moved to global 4048 ALLOW_MOCK_LOCATION, 4049 PARENTAL_CONTROL_ENABLED, 4050 PARENTAL_CONTROL_REDIRECT_URL, 4051 USB_MASS_STORAGE_ENABLED, // moved to global 4052 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 4053 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 4054 ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, 4055 ACCESSIBILITY_SCRIPT_INJECTION, 4056 BACKUP_AUTO_RESTORE, 4057 ENABLED_ACCESSIBILITY_SERVICES, 4058 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, 4059 TOUCH_EXPLORATION_ENABLED, 4060 ACCESSIBILITY_ENABLED, 4061 ACCESSIBILITY_SPEAK_PASSWORD, 4062 TTS_USE_DEFAULTS, 4063 TTS_DEFAULT_RATE, 4064 TTS_DEFAULT_PITCH, 4065 TTS_DEFAULT_SYNTH, 4066 TTS_DEFAULT_LANG, 4067 TTS_DEFAULT_COUNTRY, 4068 TTS_ENABLED_PLUGINS, 4069 TTS_DEFAULT_LOCALE, 4070 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global 4071 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global 4072 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global 4073 MOUNT_PLAY_NOTIFICATION_SND, 4074 MOUNT_UMS_AUTOSTART, 4075 MOUNT_UMS_PROMPT, 4076 MOUNT_UMS_NOTIFY_ENABLED, 4077 UI_NIGHT_MODE, 4078 LOCK_SCREEN_OWNER_INFO, 4079 LOCK_SCREEN_OWNER_INFO_ENABLED 4080 }; 4081 4082 /** 4083 * Helper method for determining if a location provider is enabled. 4084 * @param cr the content resolver to use 4085 * @param provider the location provider to query 4086 * @return true if the provider is enabled 4087 */ 4088 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { 4089 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); 4090 } 4091 4092 /** 4093 * Helper method for determining if a location provider is enabled. 4094 * @param cr the content resolver to use 4095 * @param provider the location provider to query 4096 * @param userId the userId to query 4097 * @return true if the provider is enabled 4098 * @hide 4099 */ 4100 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { 4101 String allowedProviders = Settings.Secure.getStringForUser(cr, 4102 LOCATION_PROVIDERS_ALLOWED, userId); 4103 return TextUtils.delimitedStringContains(allowedProviders, ',', provider); 4104 } 4105 4106 /** 4107 * Thread-safe method for enabling or disabling a single location provider. 4108 * @param cr the content resolver to use 4109 * @param provider the location provider to enable or disable 4110 * @param enabled true if the provider should be enabled 4111 */ 4112 public static final void setLocationProviderEnabled(ContentResolver cr, 4113 String provider, boolean enabled) { 4114 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); 4115 } 4116 4117 /** 4118 * Thread-safe method for enabling or disabling a single location provider. 4119 * @param cr the content resolver to use 4120 * @param provider the location provider to enable or disable 4121 * @param enabled true if the provider should be enabled 4122 * @param userId the userId for which to enable/disable providers 4123 * @hide 4124 */ 4125 public static final void setLocationProviderEnabledForUser(ContentResolver cr, 4126 String provider, boolean enabled, int userId) { 4127 // to ensure thread safety, we write the provider name with a '+' or '-' 4128 // and let the SettingsProvider handle it rather than reading and modifying 4129 // the list of enabled providers. 4130 if (enabled) { 4131 provider = "+" + provider; 4132 } else { 4133 provider = "-" + provider; 4134 } 4135 putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, 4136 userId); 4137 } 4138 } 4139 4140 /** 4141 * Global system settings, containing preferences that always apply identically 4142 * to all defined users. Applications can read these but are not allowed to write; 4143 * like the "Secure" settings, these are for preferences that the user must 4144 * explicitly modify through the system UI or specialized APIs for those values. 4145 */ 4146 public static final class Global extends NameValueTable { 4147 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; 4148 4149 /** 4150 * The content:// style URL for global secure settings items. Not public. 4151 */ 4152 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); 4153 4154 /** 4155 * Setting whether the global gesture for enabling accessibility is enabled. 4156 * If this gesture is enabled the user will be able to perfrom it to enable 4157 * the accessibility state without visiting the settings app. 4158 * @hide 4159 */ 4160 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = 4161 "enable_accessibility_global_gesture_enabled"; 4162 4163 /** 4164 * Whether Airplane Mode is on. 4165 */ 4166 public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; 4167 4168 /** 4169 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. 4170 */ 4171 public static final String RADIO_BLUETOOTH = "bluetooth"; 4172 4173 /** 4174 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. 4175 */ 4176 public static final String RADIO_WIFI = "wifi"; 4177 4178 /** 4179 * {@hide} 4180 */ 4181 public static final String RADIO_WIMAX = "wimax"; 4182 /** 4183 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. 4184 */ 4185 public static final String RADIO_CELL = "cell"; 4186 4187 /** 4188 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. 4189 */ 4190 public static final String RADIO_NFC = "nfc"; 4191 4192 /** 4193 * A comma separated list of radios that need to be disabled when airplane mode 4194 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are 4195 * included in the comma separated list. 4196 */ 4197 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; 4198 4199 /** 4200 * A comma separated list of radios that should to be disabled when airplane mode 4201 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is 4202 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi 4203 * will be turned off when entering airplane mode, but the user will be able to reenable 4204 * Wifi in the Settings app. 4205 * 4206 * {@hide} 4207 */ 4208 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; 4209 4210 /** 4211 * The policy for deciding when Wi-Fi should go to sleep (which will in 4212 * turn switch to using the mobile data as an Internet connection). 4213 * <p> 4214 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, 4215 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or 4216 * {@link #WIFI_SLEEP_POLICY_NEVER}. 4217 */ 4218 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; 4219 4220 /** 4221 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep 4222 * policy, which is to sleep shortly after the turning off 4223 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. 4224 */ 4225 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; 4226 4227 /** 4228 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when 4229 * the device is on battery, and never go to sleep when the device is 4230 * plugged in. 4231 */ 4232 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; 4233 4234 /** 4235 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. 4236 */ 4237 public static final int WIFI_SLEEP_POLICY_NEVER = 2; 4238 4239 /** 4240 * Value to specify if the user prefers the date, time and time zone 4241 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 4242 */ 4243 public static final String AUTO_TIME = "auto_time"; 4244 4245 /** 4246 * Value to specify if the user prefers the time zone 4247 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 4248 */ 4249 public static final String AUTO_TIME_ZONE = "auto_time_zone"; 4250 4251 /** 4252 * URI for the car dock "in" event sound. 4253 * @hide 4254 */ 4255 public static final String CAR_DOCK_SOUND = "car_dock_sound"; 4256 4257 /** 4258 * URI for the car dock "out" event sound. 4259 * @hide 4260 */ 4261 public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; 4262 4263 /** 4264 * URI for the desk dock "in" event sound. 4265 * @hide 4266 */ 4267 public static final String DESK_DOCK_SOUND = "desk_dock_sound"; 4268 4269 /** 4270 * URI for the desk dock "out" event sound. 4271 * @hide 4272 */ 4273 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; 4274 4275 /** 4276 * Whether to play a sound for dock events. 4277 * @hide 4278 */ 4279 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; 4280 4281 /** 4282 * URI for the "device locked" (keyguard shown) sound. 4283 * @hide 4284 */ 4285 public static final String LOCK_SOUND = "lock_sound"; 4286 4287 /** 4288 * URI for the "device unlocked" sound. 4289 * @hide 4290 */ 4291 public static final String UNLOCK_SOUND = "unlock_sound"; 4292 4293 /** 4294 * URI for the low battery sound file. 4295 * @hide 4296 */ 4297 public static final String LOW_BATTERY_SOUND = "low_battery_sound"; 4298 4299 /** 4300 * Whether to play a sound for low-battery alerts. 4301 * @hide 4302 */ 4303 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; 4304 4305 /** 4306 * URI for the "wireless charging started" sound. 4307 * @hide 4308 */ 4309 public static final String WIRELESS_CHARGING_STARTED_SOUND = 4310 "wireless_charging_started_sound"; 4311 4312 /** 4313 * Whether we keep the device on while the device is plugged in. 4314 * Supported values are: 4315 * <ul> 4316 * <li>{@code 0} to never stay on while plugged in</li> 4317 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li> 4318 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li> 4319 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li> 4320 * </ul> 4321 * These values can be OR-ed together. 4322 */ 4323 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; 4324 4325 /** 4326 * When the user has enable the option to have a "bug report" command 4327 * in the power menu. 4328 * @hide 4329 */ 4330 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 4331 4332 /** 4333 * Whether ADB is enabled. 4334 */ 4335 public static final String ADB_ENABLED = "adb_enabled"; 4336 4337 /** 4338 * Whether assisted GPS should be enabled or not. 4339 * @hide 4340 */ 4341 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; 4342 4343 /** 4344 * Whether bluetooth is enabled/disabled 4345 * 0=disabled. 1=enabled. 4346 */ 4347 public static final String BLUETOOTH_ON = "bluetooth_on"; 4348 4349 /** 4350 * CDMA Cell Broadcast SMS 4351 * 0 = CDMA Cell Broadcast SMS disabled 4352 * 1 = CDMA Cell Broadcast SMS enabled 4353 * @hide 4354 */ 4355 public static final String CDMA_CELL_BROADCAST_SMS = 4356 "cdma_cell_broadcast_sms"; 4357 4358 /** 4359 * The CDMA roaming mode 0 = Home Networks, CDMA default 4360 * 1 = Roaming on Affiliated networks 4361 * 2 = Roaming on any networks 4362 * @hide 4363 */ 4364 public static final String CDMA_ROAMING_MODE = "roaming_settings"; 4365 4366 /** 4367 * The CDMA subscription mode 0 = RUIM/SIM (default) 4368 * 1 = NV 4369 * @hide 4370 */ 4371 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; 4372 4373 /** Inactivity timeout to track mobile data activity. 4374 * 4375 * If set to a positive integer, it indicates the inactivity timeout value in seconds to 4376 * infer the data activity of mobile network. After a period of no activity on mobile 4377 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} 4378 * intent is fired to indicate a transition of network status from "active" to "idle". Any 4379 * subsequent activity on mobile networks triggers the firing of {@code 4380 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". 4381 * 4382 * Network activity refers to transmitting or receiving data on the network interfaces. 4383 * 4384 * Tracking is disabled if set to zero or negative value. 4385 * 4386 * @hide 4387 */ 4388 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; 4389 4390 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} 4391 * but for Wifi network. 4392 * @hide 4393 */ 4394 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; 4395 4396 /** 4397 * Whether or not data roaming is enabled. (0 = false, 1 = true) 4398 */ 4399 public static final String DATA_ROAMING = "data_roaming"; 4400 4401 /** 4402 * Whether user has enabled development settings. 4403 */ 4404 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; 4405 4406 /** 4407 * Whether the device has been provisioned (0 = false, 1 = true) 4408 */ 4409 public static final String DEVICE_PROVISIONED = "device_provisioned"; 4410 4411 /** 4412 * The saved value for WindowManagerService.setForcedDisplayDensity(). 4413 * One integer in dpi. If unset, then use the real display density. 4414 * @hide 4415 */ 4416 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; 4417 4418 /** 4419 * The saved value for WindowManagerService.setForcedDisplaySize(). 4420 * Two integers separated by a comma. If unset, then use the real display size. 4421 * @hide 4422 */ 4423 public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; 4424 4425 /** 4426 * The maximum size, in bytes, of a download that the download manager will transfer over 4427 * a non-wifi connection. 4428 * @hide 4429 */ 4430 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = 4431 "download_manager_max_bytes_over_mobile"; 4432 4433 /** 4434 * The recommended maximum size, in bytes, of a download that the download manager should 4435 * transfer over a non-wifi connection. Over this size, the use will be warned, but will 4436 * have the option to start the download over the mobile connection anyway. 4437 * @hide 4438 */ 4439 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = 4440 "download_manager_recommended_max_bytes_over_mobile"; 4441 4442 /** 4443 * Whether the package installer should allow installation of apps downloaded from 4444 * sources other than Google Play. 4445 * 4446 * 1 = allow installing from other sources 4447 * 0 = only allow installing from Google Play 4448 */ 4449 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 4450 4451 /** 4452 * Whether mobile data connections are allowed by the user. See 4453 * ConnectivityManager for more info. 4454 * @hide 4455 */ 4456 public static final String MOBILE_DATA = "mobile_data"; 4457 4458 /** {@hide} */ 4459 public static final String NETSTATS_ENABLED = "netstats_enabled"; 4460 /** {@hide} */ 4461 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; 4462 /** {@hide} */ 4463 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; 4464 /** {@hide} */ 4465 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; 4466 /** {@hide} */ 4467 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; 4468 /** {@hide} */ 4469 public static final String NETSTATS_REPORT_XT_OVER_DEV = "netstats_report_xt_over_dev"; 4470 4471 /** {@hide} */ 4472 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; 4473 /** {@hide} */ 4474 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; 4475 /** {@hide} */ 4476 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; 4477 /** {@hide} */ 4478 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; 4479 4480 /** {@hide} */ 4481 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; 4482 /** {@hide} */ 4483 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; 4484 /** {@hide} */ 4485 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; 4486 /** {@hide} */ 4487 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; 4488 4489 /** {@hide} */ 4490 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; 4491 /** {@hide} */ 4492 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; 4493 /** {@hide} */ 4494 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; 4495 /** {@hide} */ 4496 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; 4497 4498 /** 4499 * User preference for which network(s) should be used. Only the 4500 * connectivity service should touch this. 4501 */ 4502 public static final String NETWORK_PREFERENCE = "network_preference"; 4503 4504 /** 4505 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment 4506 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been 4507 * exceeded. 4508 * @hide 4509 */ 4510 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; 4511 4512 /** 4513 * The length of time in milli-seconds that automatic small adjustments to 4514 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. 4515 * @hide 4516 */ 4517 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; 4518 4519 /** Preferred NTP server. {@hide} */ 4520 public static final String NTP_SERVER = "ntp_server"; 4521 /** Timeout in milliseconds to wait for NTP server. {@hide} */ 4522 public static final String NTP_TIMEOUT = "ntp_timeout"; 4523 4524 /** 4525 * Whether the package manager should send package verification broadcasts for verifiers to 4526 * review apps prior to installation. 4527 * 1 = request apps to be verified prior to installation, if a verifier exists. 4528 * 0 = do not verify apps before installation 4529 * @hide 4530 */ 4531 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; 4532 4533 /** Timeout for package verification. 4534 * @hide */ 4535 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; 4536 4537 /** Default response code for package verification. 4538 * @hide */ 4539 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; 4540 4541 /** 4542 * Show package verification setting in the Settings app. 4543 * 1 = show (default) 4544 * 0 = hide 4545 * @hide 4546 */ 4547 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; 4548 4549 /** 4550 * Run package verificaiton on apps installed through ADB/ADT/USB 4551 * 1 = perform package verification on ADB installs (default) 4552 * 0 = bypass package verification on ADB installs 4553 * @hide 4554 */ 4555 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; 4556 4557 /** 4558 * The interval in milliseconds at which to check packet counts on the 4559 * mobile data interface when screen is on, to detect possible data 4560 * connection problems. 4561 * @hide 4562 */ 4563 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = 4564 "pdp_watchdog_poll_interval_ms"; 4565 4566 /** 4567 * The interval in milliseconds at which to check packet counts on the 4568 * mobile data interface when screen is off, to detect possible data 4569 * connection problems. 4570 * @hide 4571 */ 4572 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = 4573 "pdp_watchdog_long_poll_interval_ms"; 4574 4575 /** 4576 * The interval in milliseconds at which to check packet counts on the 4577 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} 4578 * outgoing packets has been reached without incoming packets. 4579 * @hide 4580 */ 4581 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = 4582 "pdp_watchdog_error_poll_interval_ms"; 4583 4584 /** 4585 * The number of outgoing packets sent without seeing an incoming packet 4586 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} 4587 * device is logged to the event log 4588 * @hide 4589 */ 4590 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = 4591 "pdp_watchdog_trigger_packet_count"; 4592 4593 /** 4594 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) 4595 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before 4596 * attempting data connection recovery. 4597 * @hide 4598 */ 4599 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = 4600 "pdp_watchdog_error_poll_count"; 4601 4602 /** 4603 * The number of failed PDP reset attempts before moving to something more 4604 * drastic: re-registering to the network. 4605 * @hide 4606 */ 4607 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = 4608 "pdp_watchdog_max_pdp_reset_fail_count"; 4609 4610 /** 4611 * A positive value indicates how often the SamplingProfiler 4612 * should take snapshots. Zero value means SamplingProfiler 4613 * is disabled. 4614 * 4615 * @hide 4616 */ 4617 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; 4618 4619 /** 4620 * URL to open browser on to allow user to manage a prepay account 4621 * @hide 4622 */ 4623 public static final String SETUP_PREPAID_DATA_SERVICE_URL = 4624 "setup_prepaid_data_service_url"; 4625 4626 /** 4627 * URL to attempt a GET on to see if this is a prepay device 4628 * @hide 4629 */ 4630 public static final String SETUP_PREPAID_DETECTION_TARGET_URL = 4631 "setup_prepaid_detection_target_url"; 4632 4633 /** 4634 * Host to check for a redirect to after an attempt to GET 4635 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, 4636 * this is a prepaid device with zero balance.) 4637 * @hide 4638 */ 4639 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = 4640 "setup_prepaid_detection_redir_host"; 4641 4642 /** 4643 * The interval in milliseconds at which to check the number of SMS sent out without asking 4644 * for use permit, to limit the un-authorized SMS usage. 4645 * 4646 * @hide 4647 */ 4648 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = 4649 "sms_outgoing_check_interval_ms"; 4650 4651 /** 4652 * The number of outgoing SMS sent without asking for user permit (of {@link 4653 * #SMS_OUTGOING_CHECK_INTERVAL_MS} 4654 * 4655 * @hide 4656 */ 4657 public static final String SMS_OUTGOING_CHECK_MAX_COUNT = 4658 "sms_outgoing_check_max_count"; 4659 4660 /** 4661 * Used to disable SMS short code confirmation - defaults to true. 4662 * True indcates we will do the check, etc. Set to false to disable. 4663 * @see com.android.internal.telephony.SmsUsageMonitor 4664 * @hide 4665 */ 4666 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; 4667 4668 /** 4669 * Used to select which country we use to determine premium sms codes. 4670 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, 4671 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, 4672 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. 4673 * @hide 4674 */ 4675 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; 4676 4677 /** 4678 * Used to disable Tethering on a device - defaults to true 4679 * @hide 4680 */ 4681 public static final String TETHER_SUPPORTED = "tether_supported"; 4682 4683 /** 4684 * Used to require DUN APN on the device or not - defaults to a build config value 4685 * which defaults to false 4686 * @hide 4687 */ 4688 public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; 4689 4690 /** 4691 * Used to hold a gservices-provisioned apn value for DUN. If set, or the 4692 * corresponding build config values are set it will override the APN DB 4693 * values. 4694 * Consists of a comma seperated list of strings: 4695 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" 4696 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" 4697 * @hide 4698 */ 4699 public static final String TETHER_DUN_APN = "tether_dun_apn"; 4700 4701 /** 4702 * USB Mass Storage Enabled 4703 */ 4704 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; 4705 4706 /** 4707 * If this setting is set (to anything), then all references 4708 * to Gmail on the device must change to Google Mail. 4709 */ 4710 public static final String USE_GOOGLE_MAIL = "use_google_mail"; 4711 4712 /** Autofill server address (Used in WebView/browser). 4713 * {@hide} */ 4714 public static final String WEB_AUTOFILL_QUERY_URL = 4715 "web_autofill_query_url"; 4716 4717 /** 4718 * Whether Wifi display is enabled/disabled 4719 * 0=disabled. 1=enabled. 4720 * @hide 4721 */ 4722 public static final String WIFI_DISPLAY_ON = "wifi_display_on"; 4723 4724 /** 4725 * Whether to notify the user of open networks. 4726 * <p> 4727 * If not connected and the scan results have an open network, we will 4728 * put this notification up. If we attempt to connect to a network or 4729 * the open network(s) disappear, we remove the notification. When we 4730 * show the notification, we will not show it again for 4731 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. 4732 */ 4733 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4734 "wifi_networks_available_notification_on"; 4735 /** 4736 * {@hide} 4737 */ 4738 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4739 "wimax_networks_available_notification_on"; 4740 4741 /** 4742 * Delay (in seconds) before repeating the Wi-Fi networks available notification. 4743 * Connecting to a network will reset the timer. 4744 */ 4745 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 4746 "wifi_networks_available_repeat_delay"; 4747 4748 /** 4749 * 802.11 country code in ISO 3166 format 4750 * @hide 4751 */ 4752 public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; 4753 4754 /** 4755 * The interval in milliseconds to issue wake up scans when wifi needs 4756 * to connect. This is necessary to connect to an access point when 4757 * device is on the move and the screen is off. 4758 * @hide 4759 */ 4760 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = 4761 "wifi_framework_scan_interval_ms"; 4762 4763 /** 4764 * The interval in milliseconds after which Wi-Fi is considered idle. 4765 * When idle, it is possible for the device to be switched from Wi-Fi to 4766 * the mobile data network. 4767 * @hide 4768 */ 4769 public static final String WIFI_IDLE_MS = "wifi_idle_ms"; 4770 4771 /** 4772 * When the number of open networks exceeds this number, the 4773 * least-recently-used excess networks will be removed. 4774 */ 4775 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; 4776 4777 /** 4778 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. 4779 */ 4780 public static final String WIFI_ON = "wifi_on"; 4781 4782 /** 4783 * Used to save the Wifi_ON state prior to tethering. 4784 * This state will be checked to restore Wifi after 4785 * the user turns off tethering. 4786 * 4787 * @hide 4788 */ 4789 public static final String WIFI_SAVED_STATE = "wifi_saved_state"; 4790 4791 /** 4792 * The interval in milliseconds to scan as used by the wifi supplicant 4793 * @hide 4794 */ 4795 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = 4796 "wifi_supplicant_scan_interval_ms"; 4797 4798 /** 4799 * The interval in milliseconds to scan at supplicant when p2p is connected 4800 * @hide 4801 */ 4802 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = 4803 "wifi_scan_interval_p2p_connected_ms"; 4804 4805 /** 4806 * Whether the Wi-Fi watchdog is enabled. 4807 */ 4808 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 4809 4810 /** 4811 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and 4812 * the setting needs to be set to 0 to disable it. 4813 * @hide 4814 */ 4815 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = 4816 "wifi_watchdog_poor_network_test_enabled"; 4817 4818 /** 4819 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and 4820 * needs to be set to 0 to disable it. 4821 * @hide 4822 */ 4823 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = 4824 "wifi_suspend_optimizations_enabled"; 4825 4826 /** 4827 * The maximum number of times we will retry a connection to an access 4828 * point for which we have failed in acquiring an IP address from DHCP. 4829 * A value of N means that we will make N+1 connection attempts in all. 4830 */ 4831 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; 4832 4833 /** 4834 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile 4835 * data connectivity to be established after a disconnect from Wi-Fi. 4836 */ 4837 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 4838 "wifi_mobile_data_transition_wakelock_timeout_ms"; 4839 4840 /** 4841 * The operational wifi frequency band 4842 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, 4843 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or 4844 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} 4845 * 4846 * @hide 4847 */ 4848 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; 4849 4850 /** 4851 * The Wi-Fi peer-to-peer device name 4852 * @hide 4853 */ 4854 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; 4855 4856 /** 4857 * The number of milliseconds to delay when checking for data stalls during 4858 * non-aggressive detection. (screen is turned off.) 4859 * @hide 4860 */ 4861 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = 4862 "data_stall_alarm_non_aggressive_delay_in_ms"; 4863 4864 /** 4865 * The number of milliseconds to delay when checking for data stalls during 4866 * aggressive detection. (screen on or suspected data stall) 4867 * @hide 4868 */ 4869 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = 4870 "data_stall_alarm_aggressive_delay_in_ms"; 4871 4872 /** 4873 * The interval in milliseconds at which to check gprs registration 4874 * after the first registration mismatch of gprs and voice service, 4875 * to detect possible data network registration problems. 4876 * 4877 * @hide 4878 */ 4879 public static final String GPRS_REGISTER_CHECK_PERIOD_MS = 4880 "gprs_register_check_period_ms"; 4881 4882 /** 4883 * Nonzero causes Log.wtf() to crash. 4884 * @hide 4885 */ 4886 public static final String WTF_IS_FATAL = "wtf_is_fatal"; 4887 4888 /** 4889 * Ringer mode. This is used internally, changing this value will not 4890 * change the ringer mode. See AudioManager. 4891 */ 4892 public static final String MODE_RINGER = "mode_ringer"; 4893 4894 /** 4895 * Overlay display devices setting. 4896 * The associated value is a specially formatted string that describes the 4897 * size and density of simulated secondary display devices. 4898 * <p> 4899 * Format: {width}x{height}/{dpi};... 4900 * </p><p> 4901 * Example: 4902 * <ul> 4903 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li> 4904 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first 4905 * at 1080p and the second at 720p.</li> 4906 * <li>If the value is empty, then no overlay display devices are created.</li> 4907 * </ul></p> 4908 * 4909 * @hide 4910 */ 4911 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; 4912 4913 /** 4914 * Threshold values for the duration and level of a discharge cycle, 4915 * under which we log discharge cycle info. 4916 * 4917 * @hide 4918 */ 4919 public static final String 4920 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; 4921 4922 /** @hide */ 4923 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; 4924 4925 /** 4926 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR 4927 * intents on application crashes and ANRs. If this is disabled, the 4928 * crash/ANR dialog will never display the "Report" button. 4929 * <p> 4930 * Type: int (0 = disallow, 1 = allow) 4931 * 4932 * @hide 4933 */ 4934 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; 4935 4936 /** 4937 * Maximum age of entries kept by {@link DropBoxManager}. 4938 * 4939 * @hide 4940 */ 4941 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; 4942 4943 /** 4944 * Maximum number of entry files which {@link DropBoxManager} will keep 4945 * around. 4946 * 4947 * @hide 4948 */ 4949 public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; 4950 4951 /** 4952 * Maximum amount of disk space used by {@link DropBoxManager} no matter 4953 * what. 4954 * 4955 * @hide 4956 */ 4957 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; 4958 4959 /** 4960 * Percent of free disk (excluding reserve) which {@link DropBoxManager} 4961 * will use. 4962 * 4963 * @hide 4964 */ 4965 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; 4966 4967 /** 4968 * Percent of total disk which {@link DropBoxManager} will never dip 4969 * into. 4970 * 4971 * @hide 4972 */ 4973 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; 4974 4975 /** 4976 * Prefix for per-tag dropbox disable/enable settings. 4977 * 4978 * @hide 4979 */ 4980 public static final String DROPBOX_TAG_PREFIX = "dropbox:"; 4981 4982 /** 4983 * Lines of logcat to include with system crash/ANR/etc. reports, as a 4984 * prefix of the dropbox tag of the report type. For example, 4985 * "logcat_for_system_server_anr" controls the lines of logcat captured 4986 * with system server ANR reports. 0 to disable. 4987 * 4988 * @hide 4989 */ 4990 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; 4991 4992 /** 4993 * The interval in minutes after which the amount of free storage left 4994 * on the device is logged to the event log 4995 * 4996 * @hide 4997 */ 4998 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; 4999 5000 /** 5001 * Threshold for the amount of change in disk free space required to 5002 * report the amount of free space. Used to prevent spamming the logs 5003 * when the disk free space isn't changing frequently. 5004 * 5005 * @hide 5006 */ 5007 public static final String 5008 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; 5009 5010 /** 5011 * Minimum percentage of free storage on the device that is used to 5012 * determine if the device is running low on storage. The default is 10. 5013 * <p> 5014 * Say this value is set to 10, the device is considered running low on 5015 * storage if 90% or more of the device storage is filled up. 5016 * 5017 * @hide 5018 */ 5019 public static final String 5020 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; 5021 5022 /** 5023 * Maximum byte size of the low storage threshold. This is to ensure 5024 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an 5025 * overly large threshold for large storage devices. Currently this must 5026 * be less than 2GB. This default is 500MB. 5027 * 5028 * @hide 5029 */ 5030 public static final String 5031 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; 5032 5033 /** 5034 * Minimum bytes of free storage on the device before the data partition 5035 * is considered full. By default, 1 MB is reserved to avoid system-wide 5036 * SQLite disk full exceptions. 5037 * 5038 * @hide 5039 */ 5040 public static final String 5041 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; 5042 5043 /** 5044 * The maximum reconnect delay for short network outages or when the 5045 * network is suspended due to phone use. 5046 * 5047 * @hide 5048 */ 5049 public static final String 5050 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; 5051 5052 /** 5053 * The number of milliseconds to delay before sending out 5054 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. 5055 * 5056 * @hide 5057 */ 5058 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; 5059 5060 /** 5061 * Setting to turn off captive portal detection. Feature is enabled by 5062 * default and the setting needs to be set to 0 to disable it. 5063 * 5064 * @hide 5065 */ 5066 public static final String 5067 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; 5068 5069 /** 5070 * The server used for captive portal detection upon a new conection. A 5071 * 204 response code from the server is used for validation. 5072 * 5073 * @hide 5074 */ 5075 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; 5076 5077 /** 5078 * Whether network service discovery is enabled. 5079 * 5080 * @hide 5081 */ 5082 public static final String NSD_ON = "nsd_on"; 5083 5084 /** 5085 * Let user pick default install location. 5086 * 5087 * @hide 5088 */ 5089 public static final String SET_INSTALL_LOCATION = "set_install_location"; 5090 5091 /** 5092 * Default install location value. 5093 * 0 = auto, let system decide 5094 * 1 = internal 5095 * 2 = sdcard 5096 * @hide 5097 */ 5098 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; 5099 5100 /** 5101 * ms during which to consume extra events related to Inet connection 5102 * condition after a transtion to fully-connected 5103 * 5104 * @hide 5105 */ 5106 public static final String 5107 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; 5108 5109 /** 5110 * ms during which to consume extra events related to Inet connection 5111 * condtion after a transtion to partly-connected 5112 * 5113 * @hide 5114 */ 5115 public static final String 5116 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; 5117 5118 /** {@hide} */ 5119 public static final String 5120 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; 5121 5122 /** 5123 * Host name and port for global http proxy. Uses ':' seperator for 5124 * between host and port. 5125 */ 5126 public static final String HTTP_PROXY = "http_proxy"; 5127 5128 /** 5129 * Host name for global http proxy. Set via ConnectivityManager. 5130 * 5131 * @hide 5132 */ 5133 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; 5134 5135 /** 5136 * Integer host port for global http proxy. Set via ConnectivityManager. 5137 * 5138 * @hide 5139 */ 5140 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; 5141 5142 /** 5143 * Exclusion list for global proxy. This string contains a list of 5144 * comma-separated domains where the global proxy does not apply. 5145 * Domains should be listed in a comma- separated list. Example of 5146 * acceptable formats: ".domain1.com,my.domain2.com" Use 5147 * ConnectivityManager to set/get. 5148 * 5149 * @hide 5150 */ 5151 public static final String 5152 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; 5153 5154 /** 5155 * Enables the UI setting to allow the user to specify the global HTTP 5156 * proxy and associated exclusion list. 5157 * 5158 * @hide 5159 */ 5160 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; 5161 5162 /** 5163 * Setting for default DNS in case nobody suggests one 5164 * 5165 * @hide 5166 */ 5167 public static final String DEFAULT_DNS_SERVER = "default_dns_server"; 5168 5169 /** {@hide} */ 5170 public static final String 5171 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; 5172 /** {@hide} */ 5173 public static final String 5174 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; 5175 /** {@hide} */ 5176 public static final String 5177 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; 5178 5179 /** 5180 * Get the key that retrieves a bluetooth headset's priority. 5181 * @hide 5182 */ 5183 public static final String getBluetoothHeadsetPriorityKey(String address) { 5184 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(); 5185 } 5186 5187 /** 5188 * Get the key that retrieves a bluetooth a2dp sink's priority. 5189 * @hide 5190 */ 5191 public static final String getBluetoothA2dpSinkPriorityKey(String address) { 5192 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(); 5193 } 5194 5195 /** 5196 * Get the key that retrieves a bluetooth Input Device's priority. 5197 * @hide 5198 */ 5199 public static final String getBluetoothInputDevicePriorityKey(String address) { 5200 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(); 5201 } 5202 5203 /** 5204 * Scaling factor for normal window animations. Setting to 0 will 5205 * disable window animations. 5206 */ 5207 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; 5208 5209 /** 5210 * Scaling factor for activity transition animations. Setting to 0 will 5211 * disable window animations. 5212 */ 5213 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; 5214 5215 /** 5216 * Scaling factor for Animator-based animations. This affects both the 5217 * start delay and duration of all such animations. Setting to 0 will 5218 * cause animations to end immediately. The default value is 1. 5219 */ 5220 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; 5221 5222 /** 5223 * Scaling factor for normal window animations. Setting to 0 will 5224 * disable window animations. 5225 * 5226 * @hide 5227 */ 5228 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; 5229 5230 /** 5231 * If 0, the compatibility mode is off for all applications. 5232 * If 1, older applications run under compatibility mode. 5233 * TODO: remove this settings before code freeze (bug/1907571) 5234 * @hide 5235 */ 5236 public static final String COMPATIBILITY_MODE = "compatibility_mode"; 5237 5238 /** 5239 * CDMA only settings 5240 * Emergency Tone 0 = Off 5241 * 1 = Alert 5242 * 2 = Vibrate 5243 * @hide 5244 */ 5245 public static final String EMERGENCY_TONE = "emergency_tone"; 5246 5247 /** 5248 * CDMA only settings 5249 * Whether the auto retry is enabled. The value is 5250 * boolean (1 or 0). 5251 * @hide 5252 */ 5253 public static final String CALL_AUTO_RETRY = "call_auto_retry"; 5254 5255 /** 5256 * The preferred network mode 7 = Global 5257 * 6 = EvDo only 5258 * 5 = CDMA w/o EvDo 5259 * 4 = CDMA / EvDo auto 5260 * 3 = GSM / WCDMA auto 5261 * 2 = WCDMA only 5262 * 1 = GSM only 5263 * 0 = GSM / WCDMA preferred 5264 * @hide 5265 */ 5266 public static final String PREFERRED_NETWORK_MODE = 5267 "preferred_network_mode"; 5268 5269 /** 5270 * The cdma subscription 0 = Subscription from RUIM, when available 5271 * 1 = Subscription from NV 5272 * @hide 5273 */ 5274 public static final String PREFERRED_CDMA_SUBSCRIPTION = 5275 "preferred_cdma_subscription"; 5276 5277 /** 5278 * Name of an application package to be debugged. 5279 */ 5280 public static final String DEBUG_APP = "debug_app"; 5281 5282 /** 5283 * If 1, when launching DEBUG_APP it will wait for the debugger before 5284 * starting user code. If 0, it will run normally. 5285 */ 5286 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; 5287 5288 /** 5289 * Control whether the process CPU usage meter should be shown. 5290 */ 5291 public static final String SHOW_PROCESSES = "show_processes"; 5292 5293 /** 5294 * If 1, the activity manager will aggressively finish activities and 5295 * processes as soon as they are no longer needed. If 0, the normal 5296 * extended lifetime is used. 5297 */ 5298 public static final String ALWAYS_FINISH_ACTIVITIES = 5299 "always_finish_activities"; 5300 5301 /** 5302 * Use Dock audio output for media: 5303 * 0 = disabled 5304 * 1 = enabled 5305 * @hide 5306 */ 5307 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; 5308 5309 /** 5310 * Persisted safe headphone volume management state by AudioService 5311 * @hide 5312 */ 5313 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; 5314 5315 /** 5316 * Settings to backup. This is here so that it's in the same place as the settings 5317 * keys and easy to update. 5318 * 5319 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System 5320 * and Secure as well. This is because those tables drive both backup and 5321 * restore, and restore needs to properly whitelist keys that used to live 5322 * in those namespaces. The keys will only actually be backed up / restored 5323 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). 5324 * 5325 * NOTE: Settings are backed up and restored in the order they appear 5326 * in this array. If you have one setting depending on another, 5327 * make sure that they are ordered appropriately. 5328 * 5329 * @hide 5330 */ 5331 public static final String[] SETTINGS_TO_BACKUP = { 5332 BUGREPORT_IN_POWER_MENU, 5333 STAY_ON_WHILE_PLUGGED_IN, 5334 MODE_RINGER, 5335 AUTO_TIME, 5336 AUTO_TIME_ZONE, 5337 POWER_SOUNDS_ENABLED, 5338 DOCK_SOUNDS_ENABLED, 5339 USB_MASS_STORAGE_ENABLED, 5340 ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 5341 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 5342 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 5343 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 5344 WIFI_NUM_OPEN_NETWORKS_KEPT, 5345 EMERGENCY_TONE, 5346 CALL_AUTO_RETRY, 5347 DOCK_AUDIO_MEDIA_ENABLED 5348 }; 5349 5350 // Populated lazily, guarded by class object: 5351 private static NameValueCache sNameValueCache = new NameValueCache( 5352 SYS_PROP_SETTING_VERSION, 5353 CONTENT_URI, 5354 CALL_METHOD_GET_GLOBAL, 5355 CALL_METHOD_PUT_GLOBAL); 5356 5357 /** 5358 * Look up a name in the database. 5359 * @param resolver to access the database with 5360 * @param name to look up in the table 5361 * @return the corresponding value, or null if not present 5362 */ 5363 public static String getString(ContentResolver resolver, String name) { 5364 return getStringForUser(resolver, name, UserHandle.myUserId()); 5365 } 5366 5367 /** @hide */ 5368 public static String getStringForUser(ContentResolver resolver, String name, 5369 int userHandle) { 5370 return sNameValueCache.getStringForUser(resolver, name, userHandle); 5371 } 5372 5373 /** 5374 * Store a name/value pair into the database. 5375 * @param resolver to access the database with 5376 * @param name to store 5377 * @param value to associate with the name 5378 * @return true if the value was set, false on database errors 5379 */ 5380 public static boolean putString(ContentResolver resolver, 5381 String name, String value) { 5382 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 5383 } 5384 5385 /** @hide */ 5386 public static boolean putStringForUser(ContentResolver resolver, 5387 String name, String value, int userHandle) { 5388 if (LOCAL_LOGV) { 5389 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value 5390 + " for " + userHandle); 5391 } 5392 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 5393 } 5394 5395 /** 5396 * Construct the content URI for a particular name/value pair, 5397 * useful for monitoring changes with a ContentObserver. 5398 * @param name to look up in the table 5399 * @return the corresponding content URI, or null if not present 5400 */ 5401 public static Uri getUriFor(String name) { 5402 return getUriFor(CONTENT_URI, name); 5403 } 5404 5405 /** 5406 * Convenience function for retrieving a single secure settings value 5407 * as an integer. Note that internally setting values are always 5408 * stored as strings; this function converts the string to an integer 5409 * for you. The default value will be returned if the setting is 5410 * not defined or not an integer. 5411 * 5412 * @param cr The ContentResolver to access. 5413 * @param name The name of the setting to retrieve. 5414 * @param def Value to return if the setting is not defined. 5415 * 5416 * @return The setting's current value, or 'def' if it is not defined 5417 * or not a valid integer. 5418 */ 5419 public static int getInt(ContentResolver cr, String name, int def) { 5420 String v = getString(cr, name); 5421 try { 5422 return v != null ? Integer.parseInt(v) : def; 5423 } catch (NumberFormatException e) { 5424 return def; 5425 } 5426 } 5427 5428 /** 5429 * Convenience function for retrieving a single secure settings value 5430 * as an integer. Note that internally setting values are always 5431 * stored as strings; this function converts the string to an integer 5432 * for you. 5433 * <p> 5434 * This version does not take a default value. If the setting has not 5435 * been set, or the string value is not a number, 5436 * it throws {@link SettingNotFoundException}. 5437 * 5438 * @param cr The ContentResolver to access. 5439 * @param name The name of the setting to retrieve. 5440 * 5441 * @throws SettingNotFoundException Thrown if a setting by the given 5442 * name can't be found or the setting value is not an integer. 5443 * 5444 * @return The setting's current value. 5445 */ 5446 public static int getInt(ContentResolver cr, String name) 5447 throws SettingNotFoundException { 5448 String v = getString(cr, name); 5449 try { 5450 return Integer.parseInt(v); 5451 } catch (NumberFormatException e) { 5452 throw new SettingNotFoundException(name); 5453 } 5454 } 5455 5456 /** 5457 * Convenience function for updating a single settings value as an 5458 * integer. This will either create a new entry in the table if the 5459 * given name does not exist, or modify the value of the existing row 5460 * with that name. Note that internally setting values are always 5461 * stored as strings, so this function converts the given value to a 5462 * string before storing it. 5463 * 5464 * @param cr The ContentResolver to access. 5465 * @param name The name of the setting to modify. 5466 * @param value The new value for the setting. 5467 * @return true if the value was set, false on database errors 5468 */ 5469 public static boolean putInt(ContentResolver cr, String name, int value) { 5470 return putString(cr, name, Integer.toString(value)); 5471 } 5472 5473 /** 5474 * Convenience function for retrieving a single secure settings value 5475 * as a {@code long}. Note that internally setting values are always 5476 * stored as strings; this function converts the string to a {@code long} 5477 * for you. The default value will be returned if the setting is 5478 * not defined or not a {@code long}. 5479 * 5480 * @param cr The ContentResolver to access. 5481 * @param name The name of the setting to retrieve. 5482 * @param def Value to return if the setting is not defined. 5483 * 5484 * @return The setting's current value, or 'def' if it is not defined 5485 * or not a valid {@code long}. 5486 */ 5487 public static long getLong(ContentResolver cr, String name, long def) { 5488 String valString = getString(cr, name); 5489 long value; 5490 try { 5491 value = valString != null ? Long.parseLong(valString) : def; 5492 } catch (NumberFormatException e) { 5493 value = def; 5494 } 5495 return value; 5496 } 5497 5498 /** 5499 * Convenience function for retrieving a single secure settings value 5500 * as a {@code long}. Note that internally setting values are always 5501 * stored as strings; this function converts the string to a {@code long} 5502 * for you. 5503 * <p> 5504 * This version does not take a default value. If the setting has not 5505 * been set, or the string value is not a number, 5506 * it throws {@link SettingNotFoundException}. 5507 * 5508 * @param cr The ContentResolver to access. 5509 * @param name The name of the setting to retrieve. 5510 * 5511 * @return The setting's current value. 5512 * @throws SettingNotFoundException Thrown if a setting by the given 5513 * name can't be found or the setting value is not an integer. 5514 */ 5515 public static long getLong(ContentResolver cr, String name) 5516 throws SettingNotFoundException { 5517 String valString = getString(cr, name); 5518 try { 5519 return Long.parseLong(valString); 5520 } catch (NumberFormatException e) { 5521 throw new SettingNotFoundException(name); 5522 } 5523 } 5524 5525 /** 5526 * Convenience function for updating a secure settings value as a long 5527 * integer. This will either create a new entry in the table if the 5528 * given name does not exist, or modify the value of the existing row 5529 * with that name. Note that internally setting values are always 5530 * stored as strings, so this function converts the given value to a 5531 * string before storing it. 5532 * 5533 * @param cr The ContentResolver to access. 5534 * @param name The name of the setting to modify. 5535 * @param value The new value for the setting. 5536 * @return true if the value was set, false on database errors 5537 */ 5538 public static boolean putLong(ContentResolver cr, String name, long value) { 5539 return putString(cr, name, Long.toString(value)); 5540 } 5541 5542 /** 5543 * Convenience function for retrieving a single secure settings value 5544 * as a floating point number. Note that internally setting values are 5545 * always stored as strings; this function converts the string to an 5546 * float for you. The default value will be returned if the setting 5547 * is not defined or not a valid float. 5548 * 5549 * @param cr The ContentResolver to access. 5550 * @param name The name of the setting to retrieve. 5551 * @param def Value to return if the setting is not defined. 5552 * 5553 * @return The setting's current value, or 'def' if it is not defined 5554 * or not a valid float. 5555 */ 5556 public static float getFloat(ContentResolver cr, String name, float def) { 5557 String v = getString(cr, name); 5558 try { 5559 return v != null ? Float.parseFloat(v) : def; 5560 } catch (NumberFormatException e) { 5561 return def; 5562 } 5563 } 5564 5565 /** 5566 * Convenience function for retrieving a single secure settings value 5567 * as a float. Note that internally setting values are always 5568 * stored as strings; this function converts the string to a float 5569 * for you. 5570 * <p> 5571 * This version does not take a default value. If the setting has not 5572 * been set, or the string value is not a number, 5573 * it throws {@link SettingNotFoundException}. 5574 * 5575 * @param cr The ContentResolver to access. 5576 * @param name The name of the setting to retrieve. 5577 * 5578 * @throws SettingNotFoundException Thrown if a setting by the given 5579 * name can't be found or the setting value is not a float. 5580 * 5581 * @return The setting's current value. 5582 */ 5583 public static float getFloat(ContentResolver cr, String name) 5584 throws SettingNotFoundException { 5585 String v = getString(cr, name); 5586 if (v == null) { 5587 throw new SettingNotFoundException(name); 5588 } 5589 try { 5590 return Float.parseFloat(v); 5591 } catch (NumberFormatException e) { 5592 throw new SettingNotFoundException(name); 5593 } 5594 } 5595 5596 /** 5597 * Convenience function for updating a single settings value as a 5598 * floating point number. This will either create a new entry in the 5599 * table if the given name does not exist, or modify the value of the 5600 * existing row with that name. Note that internally setting values 5601 * are always stored as strings, so this function converts the given 5602 * value to a string before storing it. 5603 * 5604 * @param cr The ContentResolver to access. 5605 * @param name The name of the setting to modify. 5606 * @param value The new value for the setting. 5607 * @return true if the value was set, false on database errors 5608 */ 5609 public static boolean putFloat(ContentResolver cr, String name, float value) { 5610 return putString(cr, name, Float.toString(value)); 5611 } 5612 } 5613 5614 /** 5615 * User-defined bookmarks and shortcuts. The target of each bookmark is an 5616 * Intent URL, allowing it to be either a web page or a particular 5617 * application activity. 5618 * 5619 * @hide 5620 */ 5621 public static final class Bookmarks implements BaseColumns 5622 { 5623 private static final String TAG = "Bookmarks"; 5624 5625 /** 5626 * The content:// style URL for this table 5627 */ 5628 public static final Uri CONTENT_URI = 5629 Uri.parse("content://" + AUTHORITY + "/bookmarks"); 5630 5631 /** 5632 * The row ID. 5633 * <p>Type: INTEGER</p> 5634 */ 5635 public static final String ID = "_id"; 5636 5637 /** 5638 * Descriptive name of the bookmark that can be displayed to the user. 5639 * If this is empty, the title should be resolved at display time (use 5640 * {@link #getTitle(Context, Cursor)} any time you want to display the 5641 * title of a bookmark.) 5642 * <P> 5643 * Type: TEXT 5644 * </P> 5645 */ 5646 public static final String TITLE = "title"; 5647 5648 /** 5649 * Arbitrary string (displayed to the user) that allows bookmarks to be 5650 * organized into categories. There are some special names for 5651 * standard folders, which all start with '@'. The label displayed for 5652 * the folder changes with the locale (via {@link #getLabelForFolder}) but 5653 * the folder name does not change so you can consistently query for 5654 * the folder regardless of the current locale. 5655 * 5656 * <P>Type: TEXT</P> 5657 * 5658 */ 5659 public static final String FOLDER = "folder"; 5660 5661 /** 5662 * The Intent URL of the bookmark, describing what it points to. This 5663 * value is given to {@link android.content.Intent#getIntent} to create 5664 * an Intent that can be launched. 5665 * <P>Type: TEXT</P> 5666 */ 5667 public static final String INTENT = "intent"; 5668 5669 /** 5670 * Optional shortcut character associated with this bookmark. 5671 * <P>Type: INTEGER</P> 5672 */ 5673 public static final String SHORTCUT = "shortcut"; 5674 5675 /** 5676 * The order in which the bookmark should be displayed 5677 * <P>Type: INTEGER</P> 5678 */ 5679 public static final String ORDERING = "ordering"; 5680 5681 private static final String[] sIntentProjection = { INTENT }; 5682 private static final String[] sShortcutProjection = { ID, SHORTCUT }; 5683 private static final String sShortcutSelection = SHORTCUT + "=?"; 5684 5685 /** 5686 * Convenience function to retrieve the bookmarked Intent for a 5687 * particular shortcut key. 5688 * 5689 * @param cr The ContentResolver to query. 5690 * @param shortcut The shortcut key. 5691 * 5692 * @return Intent The bookmarked URL, or null if there is no bookmark 5693 * matching the given shortcut. 5694 */ 5695 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut) 5696 { 5697 Intent intent = null; 5698 5699 Cursor c = cr.query(CONTENT_URI, 5700 sIntentProjection, sShortcutSelection, 5701 new String[] { String.valueOf((int) shortcut) }, ORDERING); 5702 // Keep trying until we find a valid shortcut 5703 try { 5704 while (intent == null && c.moveToNext()) { 5705 try { 5706 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT)); 5707 intent = Intent.parseUri(intentURI, 0); 5708 } catch (java.net.URISyntaxException e) { 5709 // The stored URL is bad... ignore it. 5710 } catch (IllegalArgumentException e) { 5711 // Column not found 5712 Log.w(TAG, "Intent column not found", e); 5713 } 5714 } 5715 } finally { 5716 if (c != null) c.close(); 5717 } 5718 5719 return intent; 5720 } 5721 5722 /** 5723 * Add a new bookmark to the system. 5724 * 5725 * @param cr The ContentResolver to query. 5726 * @param intent The desired target of the bookmark. 5727 * @param title Bookmark title that is shown to the user; null if none 5728 * or it should be resolved to the intent's title. 5729 * @param folder Folder in which to place the bookmark; null if none. 5730 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If 5731 * this is non-zero and there is an existing bookmark entry 5732 * with this same shortcut, then that existing shortcut is 5733 * cleared (the bookmark is not removed). 5734 * @return The unique content URL for the new bookmark entry. 5735 */ 5736 public static Uri add(ContentResolver cr, 5737 Intent intent, 5738 String title, 5739 String folder, 5740 char shortcut, 5741 int ordering) 5742 { 5743 // If a shortcut is supplied, and it is already defined for 5744 // another bookmark, then remove the old definition. 5745 if (shortcut != 0) { 5746 cr.delete(CONTENT_URI, sShortcutSelection, 5747 new String[] { String.valueOf((int) shortcut) }); 5748 } 5749 5750 ContentValues values = new ContentValues(); 5751 if (title != null) values.put(TITLE, title); 5752 if (folder != null) values.put(FOLDER, folder); 5753 values.put(INTENT, intent.toUri(0)); 5754 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut); 5755 values.put(ORDERING, ordering); 5756 return cr.insert(CONTENT_URI, values); 5757 } 5758 5759 /** 5760 * Return the folder name as it should be displayed to the user. This 5761 * takes care of localizing special folders. 5762 * 5763 * @param r Resources object for current locale; only need access to 5764 * system resources. 5765 * @param folder The value found in the {@link #FOLDER} column. 5766 * 5767 * @return CharSequence The label for this folder that should be shown 5768 * to the user. 5769 */ 5770 public static CharSequence getLabelForFolder(Resources r, String folder) { 5771 return folder; 5772 } 5773 5774 /** 5775 * Return the title as it should be displayed to the user. This takes 5776 * care of localizing bookmarks that point to activities. 5777 * 5778 * @param context A context. 5779 * @param cursor A cursor pointing to the row whose title should be 5780 * returned. The cursor must contain at least the {@link #TITLE} 5781 * and {@link #INTENT} columns. 5782 * @return A title that is localized and can be displayed to the user, 5783 * or the empty string if one could not be found. 5784 */ 5785 public static CharSequence getTitle(Context context, Cursor cursor) { 5786 int titleColumn = cursor.getColumnIndex(TITLE); 5787 int intentColumn = cursor.getColumnIndex(INTENT); 5788 if (titleColumn == -1 || intentColumn == -1) { 5789 throw new IllegalArgumentException( 5790 "The cursor must contain the TITLE and INTENT columns."); 5791 } 5792 5793 String title = cursor.getString(titleColumn); 5794 if (!TextUtils.isEmpty(title)) { 5795 return title; 5796 } 5797 5798 String intentUri = cursor.getString(intentColumn); 5799 if (TextUtils.isEmpty(intentUri)) { 5800 return ""; 5801 } 5802 5803 Intent intent; 5804 try { 5805 intent = Intent.parseUri(intentUri, 0); 5806 } catch (URISyntaxException e) { 5807 return ""; 5808 } 5809 5810 PackageManager packageManager = context.getPackageManager(); 5811 ResolveInfo info = packageManager.resolveActivity(intent, 0); 5812 return info != null ? info.loadLabel(packageManager) : ""; 5813 } 5814 } 5815 5816 /** 5817 * Returns the device ID that we should use when connecting to the mobile gtalk server. 5818 * This is a string like "android-0x1242", where the hex string is the Android ID obtained 5819 * from the GoogleLoginService. 5820 * 5821 * @param androidId The Android ID for this device. 5822 * @return The device ID that should be used when connecting to the mobile gtalk server. 5823 * @hide 5824 */ 5825 public static String getGTalkDeviceId(long androidId) { 5826 return "android-" + Long.toHexString(androidId); 5827 } 5828} 5829