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