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