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