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