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