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