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