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