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