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