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