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