Settings.java revision 12803955396591cb4d348599e49d55dedcccf40e
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 19import android.annotation.SdkConstant; 20import android.annotation.SdkConstant.SdkConstantType; 21import android.app.SearchManager; 22import android.app.WallpaperManager; 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.ConnectivityManager; 37import android.net.Uri; 38import android.net.wifi.WifiManager; 39import android.os.BatteryManager; 40import android.os.Bundle; 41import android.os.DropBoxManager; 42import android.os.IBinder; 43import android.os.Process; 44import android.os.RemoteException; 45import android.os.ServiceManager; 46import android.os.SystemProperties; 47import android.os.UserHandle; 48import android.os.Build.VERSION_CODES; 49import android.speech.tts.TextToSpeech; 50import android.text.TextUtils; 51import android.util.AndroidException; 52import android.util.Log; 53 54import com.android.internal.widget.ILockSettings; 55 56import java.net.URISyntaxException; 57import java.util.HashMap; 58import java.util.HashSet; 59import java.util.Locale; 60 61/** 62 * The Settings provider contains global system-level device preferences. 63 */ 64public final class Settings { 65 66 // Intent actions for Settings 67 68 /** 69 * Activity Action: Show system settings. 70 * <p> 71 * Input: Nothing. 72 * <p> 73 * Output: Nothing. 74 */ 75 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 76 public static final String ACTION_SETTINGS = "android.settings.SETTINGS"; 77 78 /** 79 * Activity Action: Show settings to allow configuration of APNs. 80 * <p> 81 * Input: Nothing. 82 * <p> 83 * Output: Nothing. 84 */ 85 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 86 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS"; 87 88 /** 89 * Activity Action: Show settings to allow configuration of current location 90 * sources. 91 * <p> 92 * In some cases, a matching Activity may not exist, so ensure you 93 * safeguard against this. 94 * <p> 95 * Input: Nothing. 96 * <p> 97 * Output: Nothing. 98 */ 99 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 100 public static final String ACTION_LOCATION_SOURCE_SETTINGS = 101 "android.settings.LOCATION_SOURCE_SETTINGS"; 102 103 /** 104 * Activity Action: Show settings to allow configuration of wireless controls 105 * such as Wi-Fi, Bluetooth and Mobile networks. 106 * <p> 107 * In some cases, a matching Activity may not exist, so ensure you 108 * safeguard against this. 109 * <p> 110 * Input: Nothing. 111 * <p> 112 * Output: Nothing. 113 */ 114 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 115 public static final String ACTION_WIRELESS_SETTINGS = 116 "android.settings.WIRELESS_SETTINGS"; 117 118 /** 119 * Activity Action: Show settings to allow entering/exiting airplane mode. 120 * <p> 121 * In some cases, a matching Activity may not exist, so ensure you 122 * safeguard against this. 123 * <p> 124 * Input: Nothing. 125 * <p> 126 * Output: Nothing. 127 */ 128 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 129 public static final String ACTION_AIRPLANE_MODE_SETTINGS = 130 "android.settings.AIRPLANE_MODE_SETTINGS"; 131 132 /** 133 * Activity Action: Show settings for accessibility modules. 134 * <p> 135 * In some cases, a matching Activity may not exist, so ensure you 136 * safeguard against this. 137 * <p> 138 * Input: Nothing. 139 * <p> 140 * Output: Nothing. 141 */ 142 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 143 public static final String ACTION_ACCESSIBILITY_SETTINGS = 144 "android.settings.ACCESSIBILITY_SETTINGS"; 145 146 /** 147 * Activity Action: Show settings to allow configuration of security and 148 * location privacy. 149 * <p> 150 * In some cases, a matching Activity may not exist, so ensure you 151 * safeguard against this. 152 * <p> 153 * Input: Nothing. 154 * <p> 155 * Output: Nothing. 156 */ 157 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 158 public static final String ACTION_SECURITY_SETTINGS = 159 "android.settings.SECURITY_SETTINGS"; 160 161 /** 162 * Activity Action: Show settings to allow configuration of privacy options. 163 * <p> 164 * In some cases, a matching Activity may not exist, so ensure you 165 * safeguard against this. 166 * <p> 167 * Input: Nothing. 168 * <p> 169 * Output: Nothing. 170 */ 171 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 172 public static final String ACTION_PRIVACY_SETTINGS = 173 "android.settings.PRIVACY_SETTINGS"; 174 175 /** 176 * Activity Action: Show settings to allow configuration of Wi-Fi. 177 178 * <p> 179 * In some cases, a matching Activity may not exist, so ensure you 180 * safeguard against this. 181 * <p> 182 * Input: Nothing. 183 * <p> 184 * Output: Nothing. 185 186 */ 187 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 188 public static final String ACTION_WIFI_SETTINGS = 189 "android.settings.WIFI_SETTINGS"; 190 191 /** 192 * Activity Action: Show settings to allow configuration of a static IP 193 * address for Wi-Fi. 194 * <p> 195 * In some cases, a matching Activity may not exist, so ensure you safeguard 196 * against this. 197 * <p> 198 * Input: Nothing. 199 * <p> 200 * Output: Nothing. 201 */ 202 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 203 public static final String ACTION_WIFI_IP_SETTINGS = 204 "android.settings.WIFI_IP_SETTINGS"; 205 206 /** 207 * Activity Action: Show settings to allow configuration of Bluetooth. 208 * <p> 209 * In some cases, a matching Activity may not exist, so ensure you 210 * safeguard against this. 211 * <p> 212 * Input: Nothing. 213 * <p> 214 * Output: Nothing. 215 */ 216 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 217 public static final String ACTION_BLUETOOTH_SETTINGS = 218 "android.settings.BLUETOOTH_SETTINGS"; 219 220 /** 221 * Activity Action: Show settings to allow configuration of Wifi Displays. 222 * <p> 223 * In some cases, a matching Activity may not exist, so ensure you 224 * safeguard against this. 225 * <p> 226 * Input: Nothing. 227 * <p> 228 * Output: Nothing. 229 * @hide 230 */ 231 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 232 public static final String ACTION_WIFI_DISPLAY_SETTINGS = 233 "android.settings.WIFI_DISPLAY_SETTINGS"; 234 235 /** 236 * Activity Action: Show settings to allow configuration of date and time. 237 * <p> 238 * In some cases, a matching Activity may not exist, so ensure you 239 * safeguard against this. 240 * <p> 241 * Input: Nothing. 242 * <p> 243 * Output: Nothing. 244 */ 245 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 246 public static final String ACTION_DATE_SETTINGS = 247 "android.settings.DATE_SETTINGS"; 248 249 /** 250 * Activity Action: Show settings to allow configuration of sound and volume. 251 * <p> 252 * In some cases, a matching Activity may not exist, so ensure you 253 * safeguard against this. 254 * <p> 255 * Input: Nothing. 256 * <p> 257 * Output: Nothing. 258 */ 259 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 260 public static final String ACTION_SOUND_SETTINGS = 261 "android.settings.SOUND_SETTINGS"; 262 263 /** 264 * Activity Action: Show settings to allow configuration of display. 265 * <p> 266 * In some cases, a matching Activity may not exist, so ensure you 267 * safeguard against this. 268 * <p> 269 * Input: Nothing. 270 * <p> 271 * Output: Nothing. 272 */ 273 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 274 public static final String ACTION_DISPLAY_SETTINGS = 275 "android.settings.DISPLAY_SETTINGS"; 276 277 /** 278 * Activity Action: Show settings to allow configuration of locale. 279 * <p> 280 * In some cases, a matching Activity may not exist, so ensure you 281 * safeguard against this. 282 * <p> 283 * Input: Nothing. 284 * <p> 285 * Output: Nothing. 286 */ 287 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 288 public static final String ACTION_LOCALE_SETTINGS = 289 "android.settings.LOCALE_SETTINGS"; 290 291 /** 292 * Activity Action: Show settings to configure input methods, in particular 293 * allowing the user to enable input methods. 294 * <p> 295 * In some cases, a matching Activity may not exist, so ensure you 296 * safeguard against this. 297 * <p> 298 * Input: Nothing. 299 * <p> 300 * Output: Nothing. 301 */ 302 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 303 public static final String ACTION_INPUT_METHOD_SETTINGS = 304 "android.settings.INPUT_METHOD_SETTINGS"; 305 306 /** 307 * Activity Action: Show settings to enable/disable input method subtypes. 308 * <p> 309 * In some cases, a matching Activity may not exist, so ensure you 310 * safeguard against this. 311 * <p> 312 * To tell which input method's subtypes are displayed in the settings, add 313 * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id. 314 * If there is no extra in this Intent, subtypes from all installed input methods 315 * will be displayed in the settings. 316 * 317 * @see android.view.inputmethod.InputMethodInfo#getId 318 * <p> 319 * Input: Nothing. 320 * <p> 321 * Output: Nothing. 322 */ 323 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 324 public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = 325 "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"; 326 327 /** 328 * Activity Action: Show a dialog to select input method. 329 * <p> 330 * In some cases, a matching Activity may not exist, so ensure you 331 * safeguard against this. 332 * <p> 333 * Input: Nothing. 334 * <p> 335 * Output: Nothing. 336 * @hide 337 */ 338 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 339 public static final String ACTION_SHOW_INPUT_METHOD_PICKER = 340 "android.settings.SHOW_INPUT_METHOD_PICKER"; 341 342 /** 343 * Activity Action: Show settings to manage the user input dictionary. 344 * <p> 345 * Starting with {@link android.os.Build.VERSION_CODES#KEY_LIME_PIE}, 346 * it is guaranteed there will always be an appropriate implementation for this Intent action. 347 * In prior releases of the platform this was optional, so ensure you safeguard against it. 348 * <p> 349 * Input: Nothing. 350 * <p> 351 * Output: Nothing. 352 */ 353 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 354 public static final String ACTION_USER_DICTIONARY_SETTINGS = 355 "android.settings.USER_DICTIONARY_SETTINGS"; 356 357 /** 358 * Activity Action: Adds a word to the user dictionary. 359 * <p> 360 * In some cases, a matching Activity may not exist, so ensure you 361 * safeguard against this. 362 * <p> 363 * Input: An extra with key <code>word</code> that contains the word 364 * that should be added to the dictionary. 365 * <p> 366 * Output: Nothing. 367 * 368 * @hide 369 */ 370 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 371 public static final String ACTION_USER_DICTIONARY_INSERT = 372 "com.android.settings.USER_DICTIONARY_INSERT"; 373 374 /** 375 * Activity Action: Show settings to allow configuration of application-related settings. 376 * <p> 377 * In some cases, a matching Activity may not exist, so ensure you 378 * safeguard against this. 379 * <p> 380 * Input: Nothing. 381 * <p> 382 * Output: Nothing. 383 */ 384 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 385 public static final String ACTION_APPLICATION_SETTINGS = 386 "android.settings.APPLICATION_SETTINGS"; 387 388 /** 389 * Activity Action: Show settings to allow configuration of application 390 * development-related settings. As of 391 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is 392 * a required part of the platform. 393 * <p> 394 * Input: Nothing. 395 * <p> 396 * Output: Nothing. 397 */ 398 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 399 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = 400 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"; 401 402 /** 403 * Activity Action: Show settings to allow configuration of quick launch shortcuts. 404 * <p> 405 * In some cases, a matching Activity may not exist, so ensure you 406 * safeguard against this. 407 * <p> 408 * Input: Nothing. 409 * <p> 410 * Output: Nothing. 411 */ 412 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 413 public static final String ACTION_QUICK_LAUNCH_SETTINGS = 414 "android.settings.QUICK_LAUNCH_SETTINGS"; 415 416 /** 417 * Activity Action: Show settings to manage installed applications. 418 * <p> 419 * In some cases, a matching Activity may not exist, so ensure you 420 * safeguard against this. 421 * <p> 422 * Input: Nothing. 423 * <p> 424 * Output: Nothing. 425 */ 426 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 427 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = 428 "android.settings.MANAGE_APPLICATIONS_SETTINGS"; 429 430 /** 431 * Activity Action: Show settings to manage all applications. 432 * <p> 433 * In some cases, a matching Activity may not exist, so ensure you 434 * safeguard against this. 435 * <p> 436 * Input: Nothing. 437 * <p> 438 * Output: Nothing. 439 */ 440 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 441 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = 442 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"; 443 444 /** 445 * Activity Action: Show screen of details about a particular application. 446 * <p> 447 * In some cases, a matching Activity may not exist, so ensure you 448 * safeguard against this. 449 * <p> 450 * Input: The Intent's data URI specifies the application package name 451 * to be shown, with the "package" scheme. That is "package:com.my.app". 452 * <p> 453 * Output: Nothing. 454 */ 455 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 456 public static final String ACTION_APPLICATION_DETAILS_SETTINGS = 457 "android.settings.APPLICATION_DETAILS_SETTINGS"; 458 459 /** 460 * @hide 461 * Activity Action: Show the "app ops" settings screen. 462 * <p> 463 * Input: Nothing. 464 * <p> 465 * Output: Nothing. 466 */ 467 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 468 public static final String ACTION_APP_OPS_SETTINGS = 469 "android.settings.APP_OPS_SETTINGS"; 470 471 /** 472 * Activity Action: Show settings for system update functionality. 473 * <p> 474 * In some cases, a matching Activity may not exist, so ensure you 475 * safeguard against this. 476 * <p> 477 * Input: Nothing. 478 * <p> 479 * Output: Nothing. 480 * 481 * @hide 482 */ 483 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 484 public static final String ACTION_SYSTEM_UPDATE_SETTINGS = 485 "android.settings.SYSTEM_UPDATE_SETTINGS"; 486 487 /** 488 * Activity Action: Show settings to allow configuration of sync settings. 489 * <p> 490 * In some cases, a matching Activity may not exist, so ensure you 491 * safeguard against this. 492 * <p> 493 * The account types available to add via the add account button may be restricted by adding an 494 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's 495 * authorities. Only account types which can sync with that content provider will be offered to 496 * the user. 497 * <p> 498 * Input: Nothing. 499 * <p> 500 * Output: Nothing. 501 */ 502 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 503 public static final String ACTION_SYNC_SETTINGS = 504 "android.settings.SYNC_SETTINGS"; 505 506 /** 507 * Activity Action: Show add account screen for creating a new account. 508 * <p> 509 * In some cases, a matching Activity may not exist, so ensure you 510 * safeguard against this. 511 * <p> 512 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES} 513 * extra to the Intent with one or more syncable content provider's authorities. Only account 514 * types which can sync with that content provider will be offered to the user. 515 * <p> 516 * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the 517 * Intent with one or more account types. 518 * <p> 519 * Input: Nothing. 520 * <p> 521 * Output: Nothing. 522 */ 523 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 524 public static final String ACTION_ADD_ACCOUNT = 525 "android.settings.ADD_ACCOUNT_SETTINGS"; 526 527 /** 528 * Activity Action: Show settings for selecting the network operator. 529 * <p> 530 * In some cases, a matching Activity may not exist, so ensure you 531 * safeguard against this. 532 * <p> 533 * Input: Nothing. 534 * <p> 535 * Output: Nothing. 536 */ 537 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 538 public static final String ACTION_NETWORK_OPERATOR_SETTINGS = 539 "android.settings.NETWORK_OPERATOR_SETTINGS"; 540 541 /** 542 * Activity Action: Show settings for selection of 2G/3G. 543 * <p> 544 * In some cases, a matching Activity may not exist, so ensure you 545 * safeguard against this. 546 * <p> 547 * Input: Nothing. 548 * <p> 549 * Output: Nothing. 550 */ 551 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 552 public static final String ACTION_DATA_ROAMING_SETTINGS = 553 "android.settings.DATA_ROAMING_SETTINGS"; 554 555 /** 556 * Activity Action: Show settings for internal storage. 557 * <p> 558 * In some cases, a matching Activity may not exist, so ensure you 559 * safeguard against this. 560 * <p> 561 * Input: Nothing. 562 * <p> 563 * Output: Nothing. 564 */ 565 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 566 public static final String ACTION_INTERNAL_STORAGE_SETTINGS = 567 "android.settings.INTERNAL_STORAGE_SETTINGS"; 568 /** 569 * Activity Action: Show settings for memory card storage. 570 * <p> 571 * In some cases, a matching Activity may not exist, so ensure you 572 * safeguard against this. 573 * <p> 574 * Input: Nothing. 575 * <p> 576 * Output: Nothing. 577 */ 578 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 579 public static final String ACTION_MEMORY_CARD_SETTINGS = 580 "android.settings.MEMORY_CARD_SETTINGS"; 581 582 /** 583 * Activity Action: Show settings for global search. 584 * <p> 585 * In some cases, a matching Activity may not exist, so ensure you 586 * safeguard against this. 587 * <p> 588 * Input: Nothing. 589 * <p> 590 * Output: Nothing 591 */ 592 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 593 public static final String ACTION_SEARCH_SETTINGS = 594 "android.search.action.SEARCH_SETTINGS"; 595 596 /** 597 * Activity Action: Show general device information settings (serial 598 * number, software version, phone number, etc.). 599 * <p> 600 * In some cases, a matching Activity may not exist, so ensure you 601 * safeguard against this. 602 * <p> 603 * Input: Nothing. 604 * <p> 605 * Output: Nothing 606 */ 607 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 608 public static final String ACTION_DEVICE_INFO_SETTINGS = 609 "android.settings.DEVICE_INFO_SETTINGS"; 610 611 /** 612 * Activity Action: Show NFC settings. 613 * <p> 614 * This shows UI that allows NFC to be turned on or off. 615 * <p> 616 * In some cases, a matching Activity may not exist, so ensure you 617 * safeguard against this. 618 * <p> 619 * Input: Nothing. 620 * <p> 621 * Output: Nothing 622 * @see android.nfc.NfcAdapter#isEnabled() 623 */ 624 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 625 public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS"; 626 627 /** 628 * Activity Action: Show NFC Sharing settings. 629 * <p> 630 * This shows UI that allows NDEF Push (Android Beam) to be turned on or 631 * off. 632 * <p> 633 * In some cases, a matching Activity may not exist, so ensure you 634 * safeguard against this. 635 * <p> 636 * Input: Nothing. 637 * <p> 638 * Output: Nothing 639 * @see android.nfc.NfcAdapter#isNdefPushEnabled() 640 */ 641 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 642 public static final String ACTION_NFCSHARING_SETTINGS = 643 "android.settings.NFCSHARING_SETTINGS"; 644 645 /** 646 * Activity Action: Show Daydream settings. 647 * <p> 648 * In some cases, a matching Activity may not exist, so ensure you 649 * safeguard against this. 650 * <p> 651 * Input: Nothing. 652 * <p> 653 * Output: Nothing. 654 * @see android.service.dreams.DreamService 655 */ 656 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 657 public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS"; 658 659 /** 660 * Activity Action: Show Notification listener settings. 661 * <p> 662 * In some cases, a matching Activity may not exist, so ensure you 663 * safeguard against this. 664 * <p> 665 * Input: Nothing. 666 * <p> 667 * Output: Nothing. 668 * @see android.service.notification.NotificationListenerService 669 * @hide 670 */ 671 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 672 public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS 673 = "android.settings.NOTIFICATION_LISTENER_SETTINGS"; 674 675 // End of Intent actions for Settings 676 677 /** 678 * @hide - Private call() method on SettingsProvider to read from 'system' table. 679 */ 680 public static final String CALL_METHOD_GET_SYSTEM = "GET_system"; 681 682 /** 683 * @hide - Private call() method on SettingsProvider to read from 'secure' table. 684 */ 685 public static final String CALL_METHOD_GET_SECURE = "GET_secure"; 686 687 /** 688 * @hide - Private call() method on SettingsProvider to read from 'global' table. 689 */ 690 public static final String CALL_METHOD_GET_GLOBAL = "GET_global"; 691 692 /** 693 * @hide - User handle argument extra to the fast-path call()-based requests 694 */ 695 public static final String CALL_METHOD_USER_KEY = "_user"; 696 697 /** @hide - Private call() method to write to 'system' table */ 698 public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system"; 699 700 /** @hide - Private call() method to write to 'secure' table */ 701 public static final String CALL_METHOD_PUT_SECURE = "PUT_secure"; 702 703 /** @hide - Private call() method to write to 'global' table */ 704 public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global"; 705 706 /** 707 * Activity Extra: Limit available options in launched activity based on the given authority. 708 * <p> 709 * This can be passed as an extra field in an Activity Intent with one or more syncable content 710 * provider's authorities as a String[]. This field is used by some intents to alter the 711 * behavior of the called activity. 712 * <p> 713 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based 714 * on the authority given. 715 */ 716 public static final String EXTRA_AUTHORITIES = "authorities"; 717 718 /** 719 * Activity Extra: Limit available options in launched activity based on the given account 720 * types. 721 * <p> 722 * This can be passed as an extra field in an Activity Intent with one or more account types 723 * as a String[]. This field is used by some intents to alter the behavior of the called 724 * activity. 725 * <p> 726 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified 727 * list. 728 */ 729 public static final String EXTRA_ACCOUNT_TYPES = "account_types"; 730 731 public static final String EXTRA_INPUT_METHOD_ID = "input_method_id"; 732 733 private static final String JID_RESOURCE_PREFIX = "android"; 734 735 public static final String AUTHORITY = "settings"; 736 737 private static final String TAG = "Settings"; 738 private static final boolean LOCAL_LOGV = false; 739 740 public static class SettingNotFoundException extends AndroidException { 741 public SettingNotFoundException(String msg) { 742 super(msg); 743 } 744 } 745 746 /** 747 * Common base for tables of name/value settings. 748 */ 749 public static class NameValueTable implements BaseColumns { 750 public static final String NAME = "name"; 751 public static final String VALUE = "value"; 752 753 protected static boolean putString(ContentResolver resolver, Uri uri, 754 String name, String value) { 755 // The database will take care of replacing duplicates. 756 try { 757 ContentValues values = new ContentValues(); 758 values.put(NAME, name); 759 values.put(VALUE, value); 760 resolver.insert(uri, values); 761 return true; 762 } catch (SQLException e) { 763 Log.w(TAG, "Can't set key " + name + " in " + uri, e); 764 return false; 765 } 766 } 767 768 public static Uri getUriFor(Uri uri, String name) { 769 return Uri.withAppendedPath(uri, name); 770 } 771 } 772 773 // Thread-safe. 774 private static class NameValueCache { 775 private final String mVersionSystemProperty; 776 private final Uri mUri; 777 778 private static final String[] SELECT_VALUE = 779 new String[] { Settings.NameValueTable.VALUE }; 780 private static final String NAME_EQ_PLACEHOLDER = "name=?"; 781 782 // Must synchronize on 'this' to access mValues and mValuesVersion. 783 private final HashMap<String, String> mValues = new HashMap<String, String>(); 784 private long mValuesVersion = 0; 785 786 // Initially null; set lazily and held forever. Synchronized on 'this'. 787 private IContentProvider mContentProvider = null; 788 789 // The method we'll call (or null, to not use) on the provider 790 // for the fast path of retrieving settings. 791 private final String mCallGetCommand; 792 private final String mCallSetCommand; 793 794 public NameValueCache(String versionSystemProperty, Uri uri, 795 String getCommand, String setCommand) { 796 mVersionSystemProperty = versionSystemProperty; 797 mUri = uri; 798 mCallGetCommand = getCommand; 799 mCallSetCommand = setCommand; 800 } 801 802 private IContentProvider lazyGetProvider(ContentResolver cr) { 803 IContentProvider cp = null; 804 synchronized (this) { 805 cp = mContentProvider; 806 if (cp == null) { 807 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority()); 808 } 809 } 810 return cp; 811 } 812 813 public boolean putStringForUser(ContentResolver cr, String name, String value, 814 final int userHandle) { 815 try { 816 Bundle arg = new Bundle(); 817 arg.putString(Settings.NameValueTable.VALUE, value); 818 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 819 IContentProvider cp = lazyGetProvider(cr); 820 cp.call(cr.getPackageName(), mCallSetCommand, name, arg); 821 } catch (RemoteException e) { 822 Log.w(TAG, "Can't set key " + name + " in " + mUri, e); 823 return false; 824 } 825 return true; 826 } 827 828 public String getStringForUser(ContentResolver cr, String name, final int userHandle) { 829 final boolean isSelf = (userHandle == UserHandle.myUserId()); 830 if (isSelf) { 831 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0); 832 833 // Our own user's settings data uses a client-side cache 834 synchronized (this) { 835 if (mValuesVersion != newValuesVersion) { 836 if (LOCAL_LOGV || false) { 837 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " 838 + newValuesVersion + " != cached " + mValuesVersion); 839 } 840 841 mValues.clear(); 842 mValuesVersion = newValuesVersion; 843 } 844 845 if (mValues.containsKey(name)) { 846 return mValues.get(name); // Could be null, that's OK -- negative caching 847 } 848 } 849 } else { 850 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle 851 + " by user " + UserHandle.myUserId() + " so skipping cache"); 852 } 853 854 IContentProvider cp = lazyGetProvider(cr); 855 856 // Try the fast path first, not using query(). If this 857 // fails (alternate Settings provider that doesn't support 858 // this interface?) then we fall back to the query/table 859 // interface. 860 if (mCallGetCommand != null) { 861 try { 862 Bundle args = null; 863 if (!isSelf) { 864 args = new Bundle(); 865 args.putInt(CALL_METHOD_USER_KEY, userHandle); 866 } 867 Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args); 868 if (b != null) { 869 String value = b.getPairValue(); 870 // Don't update our cache for reads of other users' data 871 if (isSelf) { 872 synchronized (this) { 873 mValues.put(name, value); 874 } 875 } else { 876 if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle 877 + " by " + UserHandle.myUserId() 878 + " so not updating cache"); 879 } 880 return value; 881 } 882 // If the response Bundle is null, we fall through 883 // to the query interface below. 884 } catch (RemoteException e) { 885 // Not supported by the remote side? Fall through 886 // to query(). 887 } 888 } 889 890 Cursor c = null; 891 try { 892 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER, 893 new String[]{name}, null, null); 894 if (c == null) { 895 Log.w(TAG, "Can't get key " + name + " from " + mUri); 896 return null; 897 } 898 899 String value = c.moveToNext() ? c.getString(0) : null; 900 synchronized (this) { 901 mValues.put(name, value); 902 } 903 if (LOCAL_LOGV) { 904 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " + 905 name + " = " + (value == null ? "(null)" : value)); 906 } 907 return value; 908 } catch (RemoteException e) { 909 Log.w(TAG, "Can't get key " + name + " from " + mUri, e); 910 return null; // Return null, but don't cache it. 911 } finally { 912 if (c != null) c.close(); 913 } 914 } 915 } 916 917 /** 918 * System settings, containing miscellaneous system preferences. This 919 * table holds simple name/value pairs. There are convenience 920 * functions for accessing individual settings entries. 921 */ 922 public static final class System extends NameValueTable { 923 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; 924 925 /** 926 * The content:// style URL for this table 927 */ 928 public static final Uri CONTENT_URI = 929 Uri.parse("content://" + AUTHORITY + "/system"); 930 931 private static final NameValueCache sNameValueCache = new NameValueCache( 932 SYS_PROP_SETTING_VERSION, 933 CONTENT_URI, 934 CALL_METHOD_GET_SYSTEM, 935 CALL_METHOD_PUT_SYSTEM); 936 937 private static final HashSet<String> MOVED_TO_SECURE; 938 static { 939 MOVED_TO_SECURE = new HashSet<String>(30); 940 MOVED_TO_SECURE.add(Secure.ANDROID_ID); 941 MOVED_TO_SECURE.add(Secure.HTTP_PROXY); 942 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED); 943 MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS); 944 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED); 945 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE); 946 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 947 MOVED_TO_SECURE.add(Secure.LOGGING_ID); 948 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED); 949 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE); 950 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL); 951 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME); 952 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL); 953 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 954 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 955 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT); 956 MOVED_TO_SECURE.add(Secure.WIFI_ON); 957 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE); 958 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT); 959 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS); 960 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED); 961 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS); 962 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT); 963 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS); 964 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON); 965 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT); 966 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS); 967 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); 968 } 969 970 private static final HashSet<String> MOVED_TO_GLOBAL; 971 private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL; 972 static { 973 MOVED_TO_GLOBAL = new HashSet<String>(); 974 MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>(); 975 976 // these were originally in system but migrated to secure in the past, 977 // so are duplicated in the Secure.* namespace 978 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED); 979 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); 980 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); 981 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); 982 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.INSTALL_NON_MARKET_APPS); 983 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); 984 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); 985 986 // these are moving directly from system to global 987 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON); 988 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS); 989 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); 990 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME); 991 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE); 992 MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND); 993 MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND); 994 MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND); 995 MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND); 996 MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED); 997 MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND); 998 MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND); 999 MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND); 1000 MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED); 1001 MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN); 1002 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY); 1003 MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER); 1004 MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE); 1005 MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE); 1006 MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE); 1007 MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS); 1008 MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE); 1009 MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE); 1010 MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY); 1011 MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP); 1012 MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER); 1013 MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES); 1014 MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES); 1015 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL); 1016 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL); 1017 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL); 1018 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL); 1019 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL); 1020 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL); 1021 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL); 1022 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL); 1023 } 1024 1025 /** @hide */ 1026 public static void getMovedKeys(HashSet<String> outKeySet) { 1027 outKeySet.addAll(MOVED_TO_GLOBAL); 1028 outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL); 1029 } 1030 1031 /** @hide */ 1032 public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) { 1033 outKeySet.addAll(MOVED_TO_GLOBAL); 1034 } 1035 1036 /** 1037 * Look up a name in the database. 1038 * @param resolver to access the database with 1039 * @param name to look up in the table 1040 * @return the corresponding value, or null if not present 1041 */ 1042 public static String getString(ContentResolver resolver, String name) { 1043 return getStringForUser(resolver, name, UserHandle.myUserId()); 1044 } 1045 1046 /** @hide */ 1047 public static String getStringForUser(ContentResolver resolver, String name, 1048 int userHandle) { 1049 if (MOVED_TO_SECURE.contains(name)) { 1050 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1051 + " to android.provider.Settings.Secure, returning read-only value."); 1052 return Secure.getStringForUser(resolver, name, userHandle); 1053 } 1054 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1055 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1056 + " to android.provider.Settings.Global, returning read-only value."); 1057 return Global.getStringForUser(resolver, name, userHandle); 1058 } 1059 return sNameValueCache.getStringForUser(resolver, name, userHandle); 1060 } 1061 1062 /** 1063 * Store a name/value pair into the database. 1064 * @param resolver to access the database with 1065 * @param name to store 1066 * @param value to associate with the name 1067 * @return true if the value was set, false on database errors 1068 */ 1069 public static boolean putString(ContentResolver resolver, String name, String value) { 1070 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 1071 } 1072 1073 /** @hide */ 1074 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 1075 int userHandle) { 1076 if (MOVED_TO_SECURE.contains(name)) { 1077 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1078 + " to android.provider.Settings.Secure, value is unchanged."); 1079 return false; 1080 } 1081 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1082 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1083 + " to android.provider.Settings.Global, value is unchanged."); 1084 return false; 1085 } 1086 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 1087 } 1088 1089 /** 1090 * Construct the content URI for a particular name/value pair, 1091 * useful for monitoring changes with a ContentObserver. 1092 * @param name to look up in the table 1093 * @return the corresponding content URI, or null if not present 1094 */ 1095 public static Uri getUriFor(String name) { 1096 if (MOVED_TO_SECURE.contains(name)) { 1097 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1098 + " to android.provider.Settings.Secure, returning Secure URI."); 1099 return Secure.getUriFor(Secure.CONTENT_URI, name); 1100 } 1101 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1102 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1103 + " to android.provider.Settings.Global, returning read-only global URI."); 1104 return Global.getUriFor(Global.CONTENT_URI, name); 1105 } 1106 return getUriFor(CONTENT_URI, name); 1107 } 1108 1109 /** 1110 * Convenience function for retrieving a single system settings value 1111 * as an integer. Note that internally setting values are always 1112 * stored as strings; this function converts the string to an integer 1113 * for you. The default value will be returned if the setting is 1114 * not defined or not an integer. 1115 * 1116 * @param cr The ContentResolver to access. 1117 * @param name The name of the setting to retrieve. 1118 * @param def Value to return if the setting is not defined. 1119 * 1120 * @return The setting's current value, or 'def' if it is not defined 1121 * or not a valid integer. 1122 */ 1123 public static int getInt(ContentResolver cr, String name, int def) { 1124 return getIntForUser(cr, name, def, UserHandle.myUserId()); 1125 } 1126 1127 /** @hide */ 1128 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 1129 String v = getStringForUser(cr, name, userHandle); 1130 try { 1131 return v != null ? Integer.parseInt(v) : def; 1132 } catch (NumberFormatException e) { 1133 return def; 1134 } 1135 } 1136 1137 /** 1138 * Convenience function for retrieving a single system settings value 1139 * as an integer. Note that internally setting values are always 1140 * stored as strings; this function converts the string to an integer 1141 * for you. 1142 * <p> 1143 * This version does not take a default value. If the setting has not 1144 * been set, or the string value is not a number, 1145 * it throws {@link SettingNotFoundException}. 1146 * 1147 * @param cr The ContentResolver to access. 1148 * @param name The name of the setting to retrieve. 1149 * 1150 * @throws SettingNotFoundException Thrown if a setting by the given 1151 * name can't be found or the setting value is not an integer. 1152 * 1153 * @return The setting's current value. 1154 */ 1155 public static int getInt(ContentResolver cr, String name) 1156 throws SettingNotFoundException { 1157 return getIntForUser(cr, name, UserHandle.myUserId()); 1158 } 1159 1160 /** @hide */ 1161 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 1162 throws SettingNotFoundException { 1163 String v = getStringForUser(cr, name, userHandle); 1164 try { 1165 return Integer.parseInt(v); 1166 } catch (NumberFormatException e) { 1167 throw new SettingNotFoundException(name); 1168 } 1169 } 1170 1171 /** 1172 * Convenience function for updating a single settings value as an 1173 * integer. This will either create a new entry in the table if the 1174 * given name does not exist, or modify the value of the existing row 1175 * with that name. Note that internally setting values are always 1176 * stored as strings, so this function converts the given value to a 1177 * string before storing it. 1178 * 1179 * @param cr The ContentResolver to access. 1180 * @param name The name of the setting to modify. 1181 * @param value The new value for the setting. 1182 * @return true if the value was set, false on database errors 1183 */ 1184 public static boolean putInt(ContentResolver cr, String name, int value) { 1185 return putIntForUser(cr, name, value, UserHandle.myUserId()); 1186 } 1187 1188 /** @hide */ 1189 public static boolean putIntForUser(ContentResolver cr, String name, int value, 1190 int userHandle) { 1191 return putStringForUser(cr, name, Integer.toString(value), userHandle); 1192 } 1193 1194 /** 1195 * Convenience function for retrieving a single system settings value 1196 * as a {@code long}. Note that internally setting values are always 1197 * stored as strings; this function converts the string to a {@code long} 1198 * for you. The default value will be returned if the setting is 1199 * not defined or not a {@code long}. 1200 * 1201 * @param cr The ContentResolver to access. 1202 * @param name The name of the setting to retrieve. 1203 * @param def Value to return if the setting is not defined. 1204 * 1205 * @return The setting's current value, or 'def' if it is not defined 1206 * or not a valid {@code long}. 1207 */ 1208 public static long getLong(ContentResolver cr, String name, long def) { 1209 return getLongForUser(cr, name, def, UserHandle.myUserId()); 1210 } 1211 1212 /** @hide */ 1213 public static long getLongForUser(ContentResolver cr, String name, long def, 1214 int userHandle) { 1215 String valString = getStringForUser(cr, name, userHandle); 1216 long value; 1217 try { 1218 value = valString != null ? Long.parseLong(valString) : def; 1219 } catch (NumberFormatException e) { 1220 value = def; 1221 } 1222 return value; 1223 } 1224 1225 /** 1226 * Convenience function for retrieving a single system settings value 1227 * as a {@code long}. Note that internally setting values are always 1228 * stored as strings; this function converts the string to a {@code long} 1229 * for you. 1230 * <p> 1231 * This version does not take a default value. If the setting has not 1232 * been set, or the string value is not a number, 1233 * it throws {@link SettingNotFoundException}. 1234 * 1235 * @param cr The ContentResolver to access. 1236 * @param name The name of the setting to retrieve. 1237 * 1238 * @return The setting's current value. 1239 * @throws SettingNotFoundException Thrown if a setting by the given 1240 * name can't be found or the setting value is not an integer. 1241 */ 1242 public static long getLong(ContentResolver cr, String name) 1243 throws SettingNotFoundException { 1244 return getLongForUser(cr, name, UserHandle.myUserId()); 1245 } 1246 1247 /** @hide */ 1248 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 1249 throws SettingNotFoundException { 1250 String valString = getStringForUser(cr, name, userHandle); 1251 try { 1252 return Long.parseLong(valString); 1253 } catch (NumberFormatException e) { 1254 throw new SettingNotFoundException(name); 1255 } 1256 } 1257 1258 /** 1259 * Convenience function for updating a single settings value as a long 1260 * integer. This will either create a new entry in the table if the 1261 * given name does not exist, or modify the value of the existing row 1262 * with that name. Note that internally setting values are always 1263 * stored as strings, so this function converts the given value to a 1264 * string before storing it. 1265 * 1266 * @param cr The ContentResolver to access. 1267 * @param name The name of the setting to modify. 1268 * @param value The new value for the setting. 1269 * @return true if the value was set, false on database errors 1270 */ 1271 public static boolean putLong(ContentResolver cr, String name, long value) { 1272 return putLongForUser(cr, name, value, UserHandle.myUserId()); 1273 } 1274 1275 /** @hide */ 1276 public static boolean putLongForUser(ContentResolver cr, String name, long value, 1277 int userHandle) { 1278 return putStringForUser(cr, name, Long.toString(value), userHandle); 1279 } 1280 1281 /** 1282 * Convenience function for retrieving a single system settings value 1283 * as a floating point number. Note that internally setting values are 1284 * always stored as strings; this function converts the string to an 1285 * float for you. The default value will be returned if the setting 1286 * is not defined or not a valid float. 1287 * 1288 * @param cr The ContentResolver to access. 1289 * @param name The name of the setting to retrieve. 1290 * @param def Value to return if the setting is not defined. 1291 * 1292 * @return The setting's current value, or 'def' if it is not defined 1293 * or not a valid float. 1294 */ 1295 public static float getFloat(ContentResolver cr, String name, float def) { 1296 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 1297 } 1298 1299 /** @hide */ 1300 public static float getFloatForUser(ContentResolver cr, String name, float def, 1301 int userHandle) { 1302 String v = getStringForUser(cr, name, userHandle); 1303 try { 1304 return v != null ? Float.parseFloat(v) : def; 1305 } catch (NumberFormatException e) { 1306 return def; 1307 } 1308 } 1309 1310 /** 1311 * Convenience function for retrieving a single system settings value 1312 * as a float. Note that internally setting values are always 1313 * stored as strings; this function converts the string to a float 1314 * for you. 1315 * <p> 1316 * This version does not take a default value. If the setting has not 1317 * been set, or the string value is not a number, 1318 * it throws {@link SettingNotFoundException}. 1319 * 1320 * @param cr The ContentResolver to access. 1321 * @param name The name of the setting to retrieve. 1322 * 1323 * @throws SettingNotFoundException Thrown if a setting by the given 1324 * name can't be found or the setting value is not a float. 1325 * 1326 * @return The setting's current value. 1327 */ 1328 public static float getFloat(ContentResolver cr, String name) 1329 throws SettingNotFoundException { 1330 return getFloatForUser(cr, name, UserHandle.myUserId()); 1331 } 1332 1333 /** @hide */ 1334 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 1335 throws SettingNotFoundException { 1336 String v = getStringForUser(cr, name, userHandle); 1337 if (v == null) { 1338 throw new SettingNotFoundException(name); 1339 } 1340 try { 1341 return Float.parseFloat(v); 1342 } catch (NumberFormatException e) { 1343 throw new SettingNotFoundException(name); 1344 } 1345 } 1346 1347 /** 1348 * Convenience function for updating a single settings value as a 1349 * floating point number. This will either create a new entry in the 1350 * table if the given name does not exist, or modify the value of the 1351 * existing row with that name. Note that internally setting values 1352 * are always stored as strings, so this function converts the given 1353 * value to a string before storing it. 1354 * 1355 * @param cr The ContentResolver to access. 1356 * @param name The name of the setting to modify. 1357 * @param value The new value for the setting. 1358 * @return true if the value was set, false on database errors 1359 */ 1360 public static boolean putFloat(ContentResolver cr, String name, float value) { 1361 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 1362 } 1363 1364 /** @hide */ 1365 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 1366 int userHandle) { 1367 return putStringForUser(cr, name, Float.toString(value), userHandle); 1368 } 1369 1370 /** 1371 * Convenience function to read all of the current 1372 * configuration-related settings into a 1373 * {@link Configuration} object. 1374 * 1375 * @param cr The ContentResolver to access. 1376 * @param outConfig Where to place the configuration settings. 1377 */ 1378 public static void getConfiguration(ContentResolver cr, Configuration outConfig) { 1379 getConfigurationForUser(cr, outConfig, UserHandle.myUserId()); 1380 } 1381 1382 /** @hide */ 1383 public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig, 1384 int userHandle) { 1385 outConfig.fontScale = Settings.System.getFloatForUser( 1386 cr, FONT_SCALE, outConfig.fontScale, userHandle); 1387 if (outConfig.fontScale < 0) { 1388 outConfig.fontScale = 1; 1389 } 1390 } 1391 1392 /** 1393 * @hide Erase the fields in the Configuration that should be applied 1394 * by the settings. 1395 */ 1396 public static void clearConfiguration(Configuration inoutConfig) { 1397 inoutConfig.fontScale = 0; 1398 } 1399 1400 /** 1401 * Convenience function to write a batch of configuration-related 1402 * settings from a {@link Configuration} object. 1403 * 1404 * @param cr The ContentResolver to access. 1405 * @param config The settings to write. 1406 * @return true if the values were set, false on database errors 1407 */ 1408 public static boolean putConfiguration(ContentResolver cr, Configuration config) { 1409 return putConfigurationForUser(cr, config, UserHandle.myUserId()); 1410 } 1411 1412 /** @hide */ 1413 public static boolean putConfigurationForUser(ContentResolver cr, Configuration config, 1414 int userHandle) { 1415 return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle); 1416 } 1417 1418 /** @hide */ 1419 public static boolean hasInterestingConfigurationChanges(int changes) { 1420 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0; 1421 } 1422 1423 /** @deprecated - Do not use */ 1424 @Deprecated 1425 public static boolean getShowGTalkServiceStatus(ContentResolver cr) { 1426 return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId()); 1427 } 1428 1429 /** 1430 * @hide 1431 * @deprecated - Do not use 1432 */ 1433 public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr, 1434 int userHandle) { 1435 return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0; 1436 } 1437 1438 /** @deprecated - Do not use */ 1439 @Deprecated 1440 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { 1441 setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId()); 1442 } 1443 1444 /** 1445 * @hide 1446 * @deprecated - Do not use 1447 */ 1448 @Deprecated 1449 public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag, 1450 int userHandle) { 1451 putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle); 1452 } 1453 1454 /** 1455 * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead 1456 */ 1457 @Deprecated 1458 public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN; 1459 1460 /** 1461 * What happens when the user presses the end call button if they're not 1462 * on a call.<br/> 1463 * <b>Values:</b><br/> 1464 * 0 - The end button does nothing.<br/> 1465 * 1 - The end button goes to the home screen.<br/> 1466 * 2 - The end button puts the device to sleep and locks the keyguard.<br/> 1467 * 3 - The end button goes to the home screen. If the user is already on the 1468 * home screen, it puts the device to sleep. 1469 */ 1470 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior"; 1471 1472 /** 1473 * END_BUTTON_BEHAVIOR value for "go home". 1474 * @hide 1475 */ 1476 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1; 1477 1478 /** 1479 * END_BUTTON_BEHAVIOR value for "go to sleep". 1480 * @hide 1481 */ 1482 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2; 1483 1484 /** 1485 * END_BUTTON_BEHAVIOR default value. 1486 * @hide 1487 */ 1488 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP; 1489 1490 /** 1491 * Is advanced settings mode turned on. 0 == no, 1 == yes 1492 * @hide 1493 */ 1494 public static final String ADVANCED_SETTINGS = "advanced_settings"; 1495 1496 /** 1497 * ADVANCED_SETTINGS default value. 1498 * @hide 1499 */ 1500 public static final int ADVANCED_SETTINGS_DEFAULT = 0; 1501 1502 /** 1503 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead 1504 */ 1505 @Deprecated 1506 public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON; 1507 1508 /** 1509 * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead 1510 */ 1511 @Deprecated 1512 public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH; 1513 1514 /** 1515 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead 1516 */ 1517 @Deprecated 1518 public static final String RADIO_WIFI = Global.RADIO_WIFI; 1519 1520 /** 1521 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead 1522 * {@hide} 1523 */ 1524 @Deprecated 1525 public static final String RADIO_WIMAX = Global.RADIO_WIMAX; 1526 1527 /** 1528 * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead 1529 */ 1530 @Deprecated 1531 public static final String RADIO_CELL = Global.RADIO_CELL; 1532 1533 /** 1534 * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead 1535 */ 1536 @Deprecated 1537 public static final String RADIO_NFC = Global.RADIO_NFC; 1538 1539 /** 1540 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead 1541 */ 1542 @Deprecated 1543 public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS; 1544 1545 /** 1546 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead 1547 * 1548 * {@hide} 1549 */ 1550 @Deprecated 1551 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = 1552 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS; 1553 1554 /** 1555 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead 1556 */ 1557 @Deprecated 1558 public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY; 1559 1560 /** 1561 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead 1562 */ 1563 @Deprecated 1564 public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT; 1565 1566 /** 1567 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead 1568 */ 1569 @Deprecated 1570 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1571 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED; 1572 1573 /** 1574 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead 1575 */ 1576 @Deprecated 1577 public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER; 1578 1579 /** 1580 * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead 1581 */ 1582 @Deprecated 1583 public static final String MODE_RINGER = Global.MODE_RINGER; 1584 1585 /** 1586 * Whether to use static IP and other static network attributes. 1587 * <p> 1588 * Set to 1 for true and 0 for false. 1589 * 1590 * @deprecated Use {@link WifiManager} instead 1591 */ 1592 @Deprecated 1593 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; 1594 1595 /** 1596 * The static IP address. 1597 * <p> 1598 * Example: "192.168.1.51" 1599 * 1600 * @deprecated Use {@link WifiManager} instead 1601 */ 1602 @Deprecated 1603 public static final String WIFI_STATIC_IP = "wifi_static_ip"; 1604 1605 /** 1606 * If using static IP, the gateway's IP address. 1607 * <p> 1608 * Example: "192.168.1.1" 1609 * 1610 * @deprecated Use {@link WifiManager} instead 1611 */ 1612 @Deprecated 1613 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; 1614 1615 /** 1616 * If using static IP, the net mask. 1617 * <p> 1618 * Example: "255.255.255.0" 1619 * 1620 * @deprecated Use {@link WifiManager} instead 1621 */ 1622 @Deprecated 1623 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; 1624 1625 /** 1626 * If using static IP, the primary DNS's IP address. 1627 * <p> 1628 * Example: "192.168.1.1" 1629 * 1630 * @deprecated Use {@link WifiManager} instead 1631 */ 1632 @Deprecated 1633 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; 1634 1635 /** 1636 * If using static IP, the secondary DNS's IP address. 1637 * <p> 1638 * Example: "192.168.1.2" 1639 * 1640 * @deprecated Use {@link WifiManager} instead 1641 */ 1642 @Deprecated 1643 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; 1644 1645 1646 /** 1647 * Determines whether remote devices may discover and/or connect to 1648 * this device. 1649 * <P>Type: INT</P> 1650 * 2 -- discoverable and connectable 1651 * 1 -- connectable but not discoverable 1652 * 0 -- neither connectable nor discoverable 1653 */ 1654 public static final String BLUETOOTH_DISCOVERABILITY = 1655 "bluetooth_discoverability"; 1656 1657 /** 1658 * Bluetooth discoverability timeout. If this value is nonzero, then 1659 * Bluetooth becomes discoverable for a certain number of seconds, 1660 * after which is becomes simply connectable. The value is in seconds. 1661 */ 1662 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = 1663 "bluetooth_discoverability_timeout"; 1664 1665 /** 1666 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED} 1667 * instead 1668 */ 1669 @Deprecated 1670 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED; 1671 1672 /** 1673 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE} 1674 * instead 1675 */ 1676 @Deprecated 1677 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 1678 1679 /** 1680 * @deprecated Use 1681 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED} 1682 * instead 1683 */ 1684 @Deprecated 1685 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = 1686 "lock_pattern_tactile_feedback_enabled"; 1687 1688 1689 /** 1690 * A formatted string of the next alarm that is set, or the empty string 1691 * if there is no alarm set. 1692 */ 1693 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; 1694 1695 /** 1696 * Scaling factor for fonts, float. 1697 */ 1698 public static final String FONT_SCALE = "font_scale"; 1699 1700 /** 1701 * Name of an application package to be debugged. 1702 * 1703 * @deprecated Use {@link Global#DEBUG_APP} instead 1704 */ 1705 @Deprecated 1706 public static final String DEBUG_APP = Global.DEBUG_APP; 1707 1708 /** 1709 * If 1, when launching DEBUG_APP it will wait for the debugger before 1710 * starting user code. If 0, it will run normally. 1711 * 1712 * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead 1713 */ 1714 @Deprecated 1715 public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER; 1716 1717 /** 1718 * Whether or not to dim the screen. 0=no 1=yes 1719 * @deprecated This setting is no longer used. 1720 */ 1721 @Deprecated 1722 public static final String DIM_SCREEN = "dim_screen"; 1723 1724 /** 1725 * The timeout before the screen turns off. 1726 */ 1727 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; 1728 1729 /** 1730 * The screen backlight brightness between 0 and 255. 1731 */ 1732 public static final String SCREEN_BRIGHTNESS = "screen_brightness"; 1733 1734 /** 1735 * Control whether to enable automatic brightness mode. 1736 */ 1737 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; 1738 1739 /** 1740 * Adjustment to auto-brightness to make it generally more (>0.0 <1.0) 1741 * or less (<0.0 >-1.0) bright. 1742 * @hide 1743 */ 1744 public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj"; 1745 1746 /** 1747 * SCREEN_BRIGHTNESS_MODE value for manual mode. 1748 */ 1749 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0; 1750 1751 /** 1752 * SCREEN_BRIGHTNESS_MODE value for automatic mode. 1753 */ 1754 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; 1755 1756 /** 1757 * Control whether the process CPU usage meter should be shown. 1758 * 1759 * @deprecated Use {@link Global#SHOW_PROCESSES} instead 1760 */ 1761 @Deprecated 1762 public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES; 1763 1764 /** 1765 * If 1, the activity manager will aggressively finish activities and 1766 * processes as soon as they are no longer needed. If 0, the normal 1767 * extended lifetime is used. 1768 * 1769 * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead 1770 */ 1771 @Deprecated 1772 public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES; 1773 1774 /** 1775 * Determines which streams are affected by ringer mode changes. The 1776 * stream type's bit should be set to 1 if it should be muted when going 1777 * into an inaudible ringer mode. 1778 */ 1779 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; 1780 1781 /** 1782 * Determines which streams are affected by mute. The 1783 * stream type's bit should be set to 1 if it should be muted when a mute request 1784 * is received. 1785 */ 1786 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; 1787 1788 /** 1789 * Whether vibrate is on for different events. This is used internally, 1790 * changing this value will not change the vibrate. See AudioManager. 1791 */ 1792 public static final String VIBRATE_ON = "vibrate_on"; 1793 1794 /** 1795 * If 1, redirects the system vibrator to all currently attached input devices 1796 * that support vibration. If there are no such input devices, then the system 1797 * vibrator is used instead. 1798 * If 0, does not register the system vibrator. 1799 * 1800 * This setting is mainly intended to provide a compatibility mechanism for 1801 * applications that only know about the system vibrator and do not use the 1802 * input device vibrator API. 1803 * 1804 * @hide 1805 */ 1806 public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices"; 1807 1808 /** 1809 * Ringer volume. This is used internally, changing this value will not 1810 * change the volume. See AudioManager. 1811 */ 1812 public static final String VOLUME_RING = "volume_ring"; 1813 1814 /** 1815 * System/notifications volume. This is used internally, changing this 1816 * value will not change the volume. See AudioManager. 1817 */ 1818 public static final String VOLUME_SYSTEM = "volume_system"; 1819 1820 /** 1821 * Voice call volume. This is used internally, changing this value will 1822 * not change the volume. See AudioManager. 1823 */ 1824 public static final String VOLUME_VOICE = "volume_voice"; 1825 1826 /** 1827 * Music/media/gaming volume. This is used internally, changing this 1828 * value will not change the volume. See AudioManager. 1829 */ 1830 public static final String VOLUME_MUSIC = "volume_music"; 1831 1832 /** 1833 * Alarm volume. This is used internally, changing this 1834 * value will not change the volume. See AudioManager. 1835 */ 1836 public static final String VOLUME_ALARM = "volume_alarm"; 1837 1838 /** 1839 * Notification volume. This is used internally, changing this 1840 * value will not change the volume. See AudioManager. 1841 */ 1842 public static final String VOLUME_NOTIFICATION = "volume_notification"; 1843 1844 /** 1845 * Bluetooth Headset volume. This is used internally, changing this value will 1846 * not change the volume. See AudioManager. 1847 */ 1848 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; 1849 1850 /** 1851 * Master volume (float in the range 0.0f to 1.0f). 1852 * @hide 1853 */ 1854 public static final String VOLUME_MASTER = "volume_master"; 1855 1856 /** 1857 * Master volume mute (int 1 = mute, 0 = not muted). 1858 * 1859 * @hide 1860 */ 1861 public static final String VOLUME_MASTER_MUTE = "volume_master_mute"; 1862 1863 /** 1864 * Whether the notifications should use the ring volume (value of 1) or 1865 * a separate notification volume (value of 0). In most cases, users 1866 * will have this enabled so the notification and ringer volumes will be 1867 * the same. However, power users can disable this and use the separate 1868 * notification volume control. 1869 * <p> 1870 * Note: This is a one-off setting that will be removed in the future 1871 * when there is profile support. For this reason, it is kept hidden 1872 * from the public APIs. 1873 * 1874 * @hide 1875 * @deprecated 1876 */ 1877 @Deprecated 1878 public static final String NOTIFICATIONS_USE_RING_VOLUME = 1879 "notifications_use_ring_volume"; 1880 1881 /** 1882 * Whether silent mode should allow vibration feedback. This is used 1883 * internally in AudioService and the Sound settings activity to 1884 * coordinate decoupling of vibrate and silent modes. This setting 1885 * will likely be removed in a future release with support for 1886 * audio/vibe feedback profiles. 1887 * 1888 * Not used anymore. On devices with vibrator, the user explicitly selects 1889 * silent or vibrate mode. 1890 * Kept for use by legacy database upgrade code in DatabaseHelper. 1891 * @hide 1892 */ 1893 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent"; 1894 1895 /** 1896 * The mapping of stream type (integer) to its setting. 1897 */ 1898 public static final String[] VOLUME_SETTINGS = { 1899 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, 1900 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO 1901 }; 1902 1903 /** 1904 * Appended to various volume related settings to record the previous 1905 * values before they the settings were affected by a silent/vibrate 1906 * ringer mode change. 1907 */ 1908 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible"; 1909 1910 /** 1911 * Persistent store for the system-wide default ringtone URI. 1912 * <p> 1913 * If you need to play the default ringtone at any given time, it is recommended 1914 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve 1915 * to the set default ringtone at the time of playing. 1916 * 1917 * @see #DEFAULT_RINGTONE_URI 1918 */ 1919 public static final String RINGTONE = "ringtone"; 1920 1921 /** 1922 * A {@link Uri} that will point to the current default ringtone at any 1923 * given time. 1924 * <p> 1925 * If the current default ringtone is in the DRM provider and the caller 1926 * does not have permission, the exception will be a 1927 * FileNotFoundException. 1928 */ 1929 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE); 1930 1931 /** 1932 * Persistent store for the system-wide default notification sound. 1933 * 1934 * @see #RINGTONE 1935 * @see #DEFAULT_NOTIFICATION_URI 1936 */ 1937 public static final String NOTIFICATION_SOUND = "notification_sound"; 1938 1939 /** 1940 * A {@link Uri} that will point to the current default notification 1941 * sound at any given time. 1942 * 1943 * @see #DEFAULT_RINGTONE_URI 1944 */ 1945 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND); 1946 1947 /** 1948 * Persistent store for the system-wide default alarm alert. 1949 * 1950 * @see #RINGTONE 1951 * @see #DEFAULT_ALARM_ALERT_URI 1952 */ 1953 public static final String ALARM_ALERT = "alarm_alert"; 1954 1955 /** 1956 * A {@link Uri} that will point to the current default alarm alert at 1957 * any given time. 1958 * 1959 * @see #DEFAULT_ALARM_ALERT_URI 1960 */ 1961 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT); 1962 1963 /** 1964 * Persistent store for the system default media button event receiver. 1965 * 1966 * @hide 1967 */ 1968 public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver"; 1969 1970 /** 1971 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off 1972 */ 1973 public static final String TEXT_AUTO_REPLACE = "auto_replace"; 1974 1975 /** 1976 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off 1977 */ 1978 public static final String TEXT_AUTO_CAPS = "auto_caps"; 1979 1980 /** 1981 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This 1982 * feature converts two spaces to a "." and space. 1983 */ 1984 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; 1985 1986 /** 1987 * Setting to showing password characters in text editors. 1 = On, 0 = Off 1988 */ 1989 public static final String TEXT_SHOW_PASSWORD = "show_password"; 1990 1991 public static final String SHOW_GTALK_SERVICE_STATUS = 1992 "SHOW_GTALK_SERVICE_STATUS"; 1993 1994 /** 1995 * Name of activity to use for wallpaper on the home screen. 1996 * 1997 * @deprecated Use {@link WallpaperManager} instead. 1998 */ 1999 @Deprecated 2000 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; 2001 2002 /** 2003 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME} 2004 * instead 2005 */ 2006 @Deprecated 2007 public static final String AUTO_TIME = Global.AUTO_TIME; 2008 2009 /** 2010 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE} 2011 * instead 2012 */ 2013 @Deprecated 2014 public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; 2015 2016 /** 2017 * Display times as 12 or 24 hours 2018 * 12 2019 * 24 2020 */ 2021 public static final String TIME_12_24 = "time_12_24"; 2022 2023 /** 2024 * Date format string 2025 * mm/dd/yyyy 2026 * dd/mm/yyyy 2027 * yyyy/mm/dd 2028 */ 2029 public static final String DATE_FORMAT = "date_format"; 2030 2031 /** 2032 * Whether the setup wizard has been run before (on first boot), or if 2033 * it still needs to be run. 2034 * 2035 * nonzero = it has been run in the past 2036 * 0 = it has not been run in the past 2037 */ 2038 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; 2039 2040 /** 2041 * Scaling factor for normal window animations. Setting to 0 will disable window 2042 * animations. 2043 * 2044 * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead 2045 */ 2046 @Deprecated 2047 public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE; 2048 2049 /** 2050 * Scaling factor for activity transition animations. Setting to 0 will disable window 2051 * animations. 2052 * 2053 * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead 2054 */ 2055 @Deprecated 2056 public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE; 2057 2058 /** 2059 * Scaling factor for Animator-based animations. This affects both the start delay and 2060 * duration of all such animations. Setting to 0 will cause animations to end immediately. 2061 * The default value is 1. 2062 * 2063 * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead 2064 */ 2065 @Deprecated 2066 public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE; 2067 2068 /** 2069 * Control whether the accelerometer will be used to change screen 2070 * orientation. If 0, it will not be used unless explicitly requested 2071 * by the application; if 1, it will be used by default unless explicitly 2072 * disabled by the application. 2073 */ 2074 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; 2075 2076 /** 2077 * Default screen rotation when no other policy applies. 2078 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a 2079 * preference, this rotation value will be used. Must be one of the 2080 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}. 2081 * 2082 * @see Display#getRotation 2083 */ 2084 public static final String USER_ROTATION = "user_rotation"; 2085 2086 /** 2087 * Control whether the rotation lock toggle in the System UI should be hidden. 2088 * Typically this is done for accessibility purposes to make it harder for 2089 * the user to accidentally toggle the rotation lock while the display rotation 2090 * has been locked for accessibility. 2091 * 2092 * If 0, then rotation lock toggle is not hidden for accessibility (although it may be 2093 * unavailable for other reasons). If 1, then the rotation lock toggle is hidden. 2094 * 2095 * @hide 2096 */ 2097 public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY = 2098 "hide_rotation_lock_toggle_for_accessibility"; 2099 2100 /** 2101 * Whether the phone vibrates when it is ringing due to an incoming call. This will 2102 * be used by Phone and Setting apps; it shouldn't affect other apps. 2103 * The value is boolean (1 or 0). 2104 * 2105 * Note: this is not same as "vibrate on ring", which had been available until ICS. 2106 * It was about AudioManager's setting and thus affected all the applications which 2107 * relied on the setting, while this is purely about the vibration setting for incoming 2108 * calls. 2109 * 2110 * @hide 2111 */ 2112 public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing"; 2113 2114 /** 2115 * Whether the audible DTMF tones are played by the dialer when dialing. The value is 2116 * boolean (1 or 0). 2117 */ 2118 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; 2119 2120 /** 2121 * CDMA only settings 2122 * DTMF tone type played by the dialer when dialing. 2123 * 0 = Normal 2124 * 1 = Long 2125 * @hide 2126 */ 2127 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type"; 2128 2129 /** 2130 * Whether the hearing aid is enabled. The value is 2131 * boolean (1 or 0). 2132 * @hide 2133 */ 2134 public static final String HEARING_AID = "hearing_aid"; 2135 2136 /** 2137 * CDMA only settings 2138 * TTY Mode 2139 * 0 = OFF 2140 * 1 = FULL 2141 * 2 = VCO 2142 * 3 = HCO 2143 * @hide 2144 */ 2145 public static final String TTY_MODE = "tty_mode"; 2146 2147 /** 2148 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is 2149 * boolean (1 or 0). 2150 */ 2151 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; 2152 2153 /** 2154 * Whether the haptic feedback (long presses, ...) are enabled. The value is 2155 * boolean (1 or 0). 2156 */ 2157 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; 2158 2159 /** 2160 * @deprecated Each application that shows web suggestions should have its own 2161 * setting for this. 2162 */ 2163 @Deprecated 2164 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; 2165 2166 /** 2167 * Whether the notification LED should repeatedly flash when a notification is 2168 * pending. The value is boolean (1 or 0). 2169 * @hide 2170 */ 2171 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; 2172 2173 /** 2174 * Show pointer location on screen? 2175 * 0 = no 2176 * 1 = yes 2177 * @hide 2178 */ 2179 public static final String POINTER_LOCATION = "pointer_location"; 2180 2181 /** 2182 * Show touch positions on screen? 2183 * 0 = no 2184 * 1 = yes 2185 * @hide 2186 */ 2187 public static final String SHOW_TOUCHES = "show_touches"; 2188 2189 /** 2190 * Log raw orientation data from {@link WindowOrientationListener} for use with the 2191 * orientationplot.py tool. 2192 * 0 = no 2193 * 1 = yes 2194 * @hide 2195 */ 2196 public static final String WINDOW_ORIENTATION_LISTENER_LOG = 2197 "window_orientation_listener_log"; 2198 2199 /** 2200 * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED} 2201 * instead 2202 * @hide 2203 */ 2204 @Deprecated 2205 public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED; 2206 2207 /** 2208 * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED} 2209 * instead 2210 * @hide 2211 */ 2212 @Deprecated 2213 public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED; 2214 2215 /** 2216 * Whether to play sounds when the keyguard is shown and dismissed. 2217 * @hide 2218 */ 2219 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; 2220 2221 /** 2222 * Whether the lockscreen should be completely disabled. 2223 * @hide 2224 */ 2225 public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; 2226 2227 /** 2228 * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} 2229 * instead 2230 * @hide 2231 */ 2232 @Deprecated 2233 public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND; 2234 2235 /** 2236 * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND} 2237 * instead 2238 * @hide 2239 */ 2240 @Deprecated 2241 public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND; 2242 2243 /** 2244 * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} 2245 * instead 2246 * @hide 2247 */ 2248 @Deprecated 2249 public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; 2250 2251 /** 2252 * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} 2253 * instead 2254 * @hide 2255 */ 2256 @Deprecated 2257 public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; 2258 2259 /** 2260 * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} 2261 * instead 2262 * @hide 2263 */ 2264 @Deprecated 2265 public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; 2266 2267 /** 2268 * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} 2269 * instead 2270 * @hide 2271 */ 2272 @Deprecated 2273 public static final String LOCK_SOUND = Global.LOCK_SOUND; 2274 2275 /** 2276 * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} 2277 * instead 2278 * @hide 2279 */ 2280 @Deprecated 2281 public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; 2282 2283 /** 2284 * Receive incoming SIP calls? 2285 * 0 = no 2286 * 1 = yes 2287 * @hide 2288 */ 2289 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; 2290 2291 /** 2292 * Call Preference String. 2293 * "SIP_ALWAYS" : Always use SIP with network access 2294 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address 2295 * "SIP_ASK_ME_EACH_TIME" : Always ask me each time 2296 * @hide 2297 */ 2298 public static final String SIP_CALL_OPTIONS = "sip_call_options"; 2299 2300 /** 2301 * One of the sip call options: Always use SIP with network access. 2302 * @hide 2303 */ 2304 public static final String SIP_ALWAYS = "SIP_ALWAYS"; 2305 2306 /** 2307 * One of the sip call options: Only if destination is a SIP address. 2308 * @hide 2309 */ 2310 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; 2311 2312 /** 2313 * One of the sip call options: Always ask me each time. 2314 * @hide 2315 */ 2316 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; 2317 2318 /** 2319 * Pointer speed setting. 2320 * This is an integer value in a range between -7 and +7, so there are 15 possible values. 2321 * -7 = slowest 2322 * 0 = default speed 2323 * +7 = fastest 2324 * @hide 2325 */ 2326 public static final String POINTER_SPEED = "pointer_speed"; 2327 2328 /** 2329 * Settings to backup. This is here so that it's in the same place as the settings 2330 * keys and easy to update. 2331 * 2332 * NOTE: Settings are backed up and restored in the order they appear 2333 * in this array. If you have one setting depending on another, 2334 * make sure that they are ordered appropriately. 2335 * 2336 * @hide 2337 */ 2338 public static final String[] SETTINGS_TO_BACKUP = { 2339 STAY_ON_WHILE_PLUGGED_IN, // moved to global 2340 WIFI_USE_STATIC_IP, 2341 WIFI_STATIC_IP, 2342 WIFI_STATIC_GATEWAY, 2343 WIFI_STATIC_NETMASK, 2344 WIFI_STATIC_DNS1, 2345 WIFI_STATIC_DNS2, 2346 BLUETOOTH_DISCOVERABILITY, 2347 BLUETOOTH_DISCOVERABILITY_TIMEOUT, 2348 DIM_SCREEN, 2349 SCREEN_OFF_TIMEOUT, 2350 SCREEN_BRIGHTNESS, 2351 SCREEN_BRIGHTNESS_MODE, 2352 SCREEN_AUTO_BRIGHTNESS_ADJ, 2353 VIBRATE_INPUT_DEVICES, 2354 MODE_RINGER, // moved to global 2355 MODE_RINGER_STREAMS_AFFECTED, 2356 MUTE_STREAMS_AFFECTED, 2357 VOLUME_VOICE, 2358 VOLUME_SYSTEM, 2359 VOLUME_RING, 2360 VOLUME_MUSIC, 2361 VOLUME_ALARM, 2362 VOLUME_NOTIFICATION, 2363 VOLUME_BLUETOOTH_SCO, 2364 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE, 2365 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE, 2366 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE, 2367 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE, 2368 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE, 2369 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE, 2370 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE, 2371 TEXT_AUTO_REPLACE, 2372 TEXT_AUTO_CAPS, 2373 TEXT_AUTO_PUNCTUATE, 2374 TEXT_SHOW_PASSWORD, 2375 AUTO_TIME, // moved to global 2376 AUTO_TIME_ZONE, // moved to global 2377 TIME_12_24, 2378 DATE_FORMAT, 2379 DTMF_TONE_WHEN_DIALING, 2380 DTMF_TONE_TYPE_WHEN_DIALING, 2381 HEARING_AID, 2382 TTY_MODE, 2383 SOUND_EFFECTS_ENABLED, 2384 HAPTIC_FEEDBACK_ENABLED, 2385 POWER_SOUNDS_ENABLED, // moved to global 2386 DOCK_SOUNDS_ENABLED, // moved to global 2387 LOCKSCREEN_SOUNDS_ENABLED, 2388 SHOW_WEB_SUGGESTIONS, 2389 NOTIFICATION_LIGHT_PULSE, 2390 SIP_CALL_OPTIONS, 2391 SIP_RECEIVE_CALLS, 2392 POINTER_SPEED, 2393 VIBRATE_WHEN_RINGING 2394 }; 2395 2396 // Settings moved to Settings.Secure 2397 2398 /** 2399 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} 2400 * instead 2401 */ 2402 @Deprecated 2403 public static final String ADB_ENABLED = Global.ADB_ENABLED; 2404 2405 /** 2406 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead 2407 */ 2408 @Deprecated 2409 public static final String ANDROID_ID = Secure.ANDROID_ID; 2410 2411 /** 2412 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 2413 */ 2414 @Deprecated 2415 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 2416 2417 /** 2418 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 2419 */ 2420 @Deprecated 2421 public static final String DATA_ROAMING = Global.DATA_ROAMING; 2422 2423 /** 2424 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 2425 */ 2426 @Deprecated 2427 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 2428 2429 /** 2430 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead 2431 */ 2432 @Deprecated 2433 public static final String HTTP_PROXY = Global.HTTP_PROXY; 2434 2435 /** 2436 * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead 2437 */ 2438 @Deprecated 2439 public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; 2440 2441 /** 2442 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} 2443 * instead 2444 */ 2445 @Deprecated 2446 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; 2447 2448 /** 2449 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead 2450 */ 2451 @Deprecated 2452 public static final String LOGGING_ID = Secure.LOGGING_ID; 2453 2454 /** 2455 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 2456 */ 2457 @Deprecated 2458 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 2459 2460 /** 2461 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} 2462 * instead 2463 */ 2464 @Deprecated 2465 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; 2466 2467 /** 2468 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} 2469 * instead 2470 */ 2471 @Deprecated 2472 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; 2473 2474 /** 2475 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} 2476 * instead 2477 */ 2478 @Deprecated 2479 public static final String PARENTAL_CONTROL_REDIRECT_URL = 2480 Secure.PARENTAL_CONTROL_REDIRECT_URL; 2481 2482 /** 2483 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead 2484 */ 2485 @Deprecated 2486 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; 2487 2488 /** 2489 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 2490 */ 2491 @Deprecated 2492 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 2493 2494 /** 2495 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 2496 */ 2497 @Deprecated 2498 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 2499 2500 /** 2501 * @deprecated Use 2502 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 2503 */ 2504 @Deprecated 2505 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 2506 2507 /** 2508 * @deprecated Use 2509 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 2510 */ 2511 @Deprecated 2512 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 2513 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 2514 2515 /** 2516 * @deprecated Use 2517 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead 2518 */ 2519 @Deprecated 2520 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 2521 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 2522 2523 /** 2524 * @deprecated Use 2525 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead 2526 */ 2527 @Deprecated 2528 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 2529 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 2530 2531 /** 2532 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 2533 * instead 2534 */ 2535 @Deprecated 2536 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 2537 2538 /** 2539 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead 2540 */ 2541 @Deprecated 2542 public static final String WIFI_ON = Global.WIFI_ON; 2543 2544 /** 2545 * @deprecated Use 2546 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} 2547 * instead 2548 */ 2549 @Deprecated 2550 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 2551 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; 2552 2553 /** 2554 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead 2555 */ 2556 @Deprecated 2557 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; 2558 2559 /** 2560 * @deprecated Use 2561 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead 2562 */ 2563 @Deprecated 2564 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 2565 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; 2566 2567 /** 2568 * @deprecated Use 2569 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead 2570 */ 2571 @Deprecated 2572 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 2573 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; 2574 2575 /** 2576 * @deprecated Use 2577 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} 2578 * instead 2579 */ 2580 @Deprecated 2581 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 2582 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; 2583 2584 /** 2585 * @deprecated Use 2586 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead 2587 */ 2588 @Deprecated 2589 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 2590 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; 2591 2592 /** 2593 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} 2594 * instead 2595 */ 2596 @Deprecated 2597 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; 2598 2599 /** 2600 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 2601 */ 2602 @Deprecated 2603 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON; 2604 2605 /** 2606 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead 2607 */ 2608 @Deprecated 2609 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; 2610 2611 /** 2612 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} 2613 * instead 2614 */ 2615 @Deprecated 2616 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; 2617 2618 /** 2619 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} 2620 * instead 2621 */ 2622 @Deprecated 2623 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = 2624 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; 2625 } 2626 2627 /** 2628 * Secure system settings, containing system preferences that applications 2629 * can read but are not allowed to write. These are for preferences that 2630 * the user must explicitly modify through the system UI or specialized 2631 * APIs for those values, not modified directly by applications. 2632 */ 2633 public static final class Secure extends NameValueTable { 2634 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; 2635 2636 /** 2637 * The content:// style URL for this table 2638 */ 2639 public static final Uri CONTENT_URI = 2640 Uri.parse("content://" + AUTHORITY + "/secure"); 2641 2642 // Populated lazily, guarded by class object: 2643 private static final NameValueCache sNameValueCache = new NameValueCache( 2644 SYS_PROP_SETTING_VERSION, 2645 CONTENT_URI, 2646 CALL_METHOD_GET_SECURE, 2647 CALL_METHOD_PUT_SECURE); 2648 2649 private static ILockSettings sLockSettings = null; 2650 2651 private static boolean sIsSystemProcess; 2652 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; 2653 private static final HashSet<String> MOVED_TO_GLOBAL; 2654 static { 2655 MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3); 2656 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); 2657 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); 2658 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 2659 2660 MOVED_TO_GLOBAL = new HashSet<String>(); 2661 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED); 2662 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED); 2663 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON); 2664 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU); 2665 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS); 2666 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE); 2667 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE); 2668 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE); 2669 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI); 2670 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING); 2671 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED); 2672 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED); 2673 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED); 2674 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); 2675 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); 2676 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); 2677 MOVED_TO_GLOBAL.add(Settings.Global.INSTALL_NON_MARKET_APPS); 2678 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); 2679 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); 2680 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); 2681 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES); 2682 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE); 2683 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED); 2684 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES); 2685 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL); 2686 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_REPORT_XT_OVER_DEV); 2687 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED); 2688 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE); 2689 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION); 2690 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE); 2691 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES); 2692 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE); 2693 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION); 2694 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE); 2695 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES); 2696 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE); 2697 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE); 2698 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF); 2699 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING); 2700 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER); 2701 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT); 2702 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT); 2703 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS); 2704 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT); 2705 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS); 2706 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT); 2707 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS); 2708 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL); 2709 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST); 2710 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL); 2711 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN); 2712 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED); 2713 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED); 2714 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED); 2715 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); 2716 MOVED_TO_GLOBAL.add(Settings.Global.WEB_AUTOFILL_QUERY_URL); 2717 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); 2718 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); 2719 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); 2720 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); 2721 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); 2722 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); 2723 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 2724 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 2725 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); 2726 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); 2727 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); 2728 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); 2729 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); 2730 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); 2731 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); 2732 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); 2733 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); 2734 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); 2735 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); 2736 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); 2737 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); 2738 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); 2739 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); 2740 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); 2741 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); 2742 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); 2743 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); 2744 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); 2745 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); 2746 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); 2747 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); 2748 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); 2749 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); 2750 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); 2751 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); 2752 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); 2753 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); 2754 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); 2755 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); 2756 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); 2757 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); 2758 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); 2759 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); 2760 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); 2761 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); 2762 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); 2763 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); 2764 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); 2765 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); 2766 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); 2767 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); 2768 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); 2769 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); 2770 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); 2771 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); 2772 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); 2773 } 2774 2775 /** @hide */ 2776 public static void getMovedKeys(HashSet<String> outKeySet) { 2777 outKeySet.addAll(MOVED_TO_GLOBAL); 2778 } 2779 2780 /** 2781 * Look up a name in the database. 2782 * @param resolver to access the database with 2783 * @param name to look up in the table 2784 * @return the corresponding value, or null if not present 2785 */ 2786 public static String getString(ContentResolver resolver, String name) { 2787 return getStringForUser(resolver, name, UserHandle.myUserId()); 2788 } 2789 2790 /** @hide */ 2791 public static String getStringForUser(ContentResolver resolver, String name, 2792 int userHandle) { 2793 if (MOVED_TO_GLOBAL.contains(name)) { 2794 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 2795 + " to android.provider.Settings.Global."); 2796 return Global.getStringForUser(resolver, name, userHandle); 2797 } 2798 2799 if (MOVED_TO_LOCK_SETTINGS.contains(name)) { 2800 synchronized (Secure.class) { 2801 if (sLockSettings == null) { 2802 sLockSettings = ILockSettings.Stub.asInterface( 2803 (IBinder) ServiceManager.getService("lock_settings")); 2804 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; 2805 } 2806 } 2807 if (sLockSettings != null && !sIsSystemProcess) { 2808 try { 2809 return sLockSettings.getString(name, "0", userHandle); 2810 } catch (RemoteException re) { 2811 // Fall through 2812 } 2813 } 2814 } 2815 2816 return sNameValueCache.getStringForUser(resolver, name, userHandle); 2817 } 2818 2819 /** 2820 * Store a name/value pair into the database. 2821 * @param resolver to access the database with 2822 * @param name to store 2823 * @param value to associate with the name 2824 * @return true if the value was set, false on database errors 2825 */ 2826 public static boolean putString(ContentResolver resolver, String name, String value) { 2827 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 2828 } 2829 2830 /** @hide */ 2831 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 2832 int userHandle) { 2833 if (MOVED_TO_GLOBAL.contains(name)) { 2834 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2835 + " to android.provider.Settings.Global"); 2836 return Global.putStringForUser(resolver, name, value, userHandle); 2837 } 2838 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 2839 } 2840 2841 /** 2842 * Construct the content URI for a particular name/value pair, 2843 * useful for monitoring changes with a ContentObserver. 2844 * @param name to look up in the table 2845 * @return the corresponding content URI, or null if not present 2846 */ 2847 public static Uri getUriFor(String name) { 2848 if (MOVED_TO_GLOBAL.contains(name)) { 2849 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 2850 + " to android.provider.Settings.Global, returning global URI."); 2851 return Global.getUriFor(Global.CONTENT_URI, name); 2852 } 2853 return getUriFor(CONTENT_URI, name); 2854 } 2855 2856 /** 2857 * Convenience function for retrieving a single secure settings value 2858 * as an integer. Note that internally setting values are always 2859 * stored as strings; this function converts the string to an integer 2860 * for you. The default value will be returned if the setting is 2861 * not defined or not an integer. 2862 * 2863 * @param cr The ContentResolver to access. 2864 * @param name The name of the setting to retrieve. 2865 * @param def Value to return if the setting is not defined. 2866 * 2867 * @return The setting's current value, or 'def' if it is not defined 2868 * or not a valid integer. 2869 */ 2870 public static int getInt(ContentResolver cr, String name, int def) { 2871 return getIntForUser(cr, name, def, UserHandle.myUserId()); 2872 } 2873 2874 /** @hide */ 2875 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 2876 String v = getStringForUser(cr, name, userHandle); 2877 try { 2878 return v != null ? Integer.parseInt(v) : def; 2879 } catch (NumberFormatException e) { 2880 return def; 2881 } 2882 } 2883 2884 /** 2885 * Convenience function for retrieving a single secure settings value 2886 * as an integer. Note that internally setting values are always 2887 * stored as strings; this function converts the string to an integer 2888 * for you. 2889 * <p> 2890 * This version does not take a default value. If the setting has not 2891 * been set, or the string value is not a number, 2892 * it throws {@link SettingNotFoundException}. 2893 * 2894 * @param cr The ContentResolver to access. 2895 * @param name The name of the setting to retrieve. 2896 * 2897 * @throws SettingNotFoundException Thrown if a setting by the given 2898 * name can't be found or the setting value is not an integer. 2899 * 2900 * @return The setting's current value. 2901 */ 2902 public static int getInt(ContentResolver cr, String name) 2903 throws SettingNotFoundException { 2904 return getIntForUser(cr, name, UserHandle.myUserId()); 2905 } 2906 2907 /** @hide */ 2908 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 2909 throws SettingNotFoundException { 2910 String v = getStringForUser(cr, name, userHandle); 2911 try { 2912 return Integer.parseInt(v); 2913 } catch (NumberFormatException e) { 2914 throw new SettingNotFoundException(name); 2915 } 2916 } 2917 2918 /** 2919 * Convenience function for updating a single settings value as an 2920 * integer. This will either create a new entry in the table if the 2921 * given name does not exist, or modify the value of the existing row 2922 * with that name. Note that internally setting values are always 2923 * stored as strings, so this function converts the given value to a 2924 * string before storing it. 2925 * 2926 * @param cr The ContentResolver to access. 2927 * @param name The name of the setting to modify. 2928 * @param value The new value for the setting. 2929 * @return true if the value was set, false on database errors 2930 */ 2931 public static boolean putInt(ContentResolver cr, String name, int value) { 2932 return putIntForUser(cr, name, value, UserHandle.myUserId()); 2933 } 2934 2935 /** @hide */ 2936 public static boolean putIntForUser(ContentResolver cr, String name, int value, 2937 int userHandle) { 2938 return putStringForUser(cr, name, Integer.toString(value), userHandle); 2939 } 2940 2941 /** 2942 * Convenience function for retrieving a single secure settings value 2943 * as a {@code long}. Note that internally setting values are always 2944 * stored as strings; this function converts the string to a {@code long} 2945 * for you. The default value will be returned if the setting is 2946 * not defined or not a {@code long}. 2947 * 2948 * @param cr The ContentResolver to access. 2949 * @param name The name of the setting to retrieve. 2950 * @param def Value to return if the setting is not defined. 2951 * 2952 * @return The setting's current value, or 'def' if it is not defined 2953 * or not a valid {@code long}. 2954 */ 2955 public static long getLong(ContentResolver cr, String name, long def) { 2956 return getLongForUser(cr, name, def, UserHandle.myUserId()); 2957 } 2958 2959 /** @hide */ 2960 public static long getLongForUser(ContentResolver cr, String name, long def, 2961 int userHandle) { 2962 String valString = getStringForUser(cr, name, userHandle); 2963 long value; 2964 try { 2965 value = valString != null ? Long.parseLong(valString) : def; 2966 } catch (NumberFormatException e) { 2967 value = def; 2968 } 2969 return value; 2970 } 2971 2972 /** 2973 * Convenience function for retrieving a single secure settings value 2974 * as a {@code long}. Note that internally setting values are always 2975 * stored as strings; this function converts the string to a {@code long} 2976 * for you. 2977 * <p> 2978 * This version does not take a default value. If the setting has not 2979 * been set, or the string value is not a number, 2980 * it throws {@link SettingNotFoundException}. 2981 * 2982 * @param cr The ContentResolver to access. 2983 * @param name The name of the setting to retrieve. 2984 * 2985 * @return The setting's current value. 2986 * @throws SettingNotFoundException Thrown if a setting by the given 2987 * name can't be found or the setting value is not an integer. 2988 */ 2989 public static long getLong(ContentResolver cr, String name) 2990 throws SettingNotFoundException { 2991 return getLongForUser(cr, name, UserHandle.myUserId()); 2992 } 2993 2994 /** @hide */ 2995 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 2996 throws SettingNotFoundException { 2997 String valString = getStringForUser(cr, name, userHandle); 2998 try { 2999 return Long.parseLong(valString); 3000 } catch (NumberFormatException e) { 3001 throw new SettingNotFoundException(name); 3002 } 3003 } 3004 3005 /** 3006 * Convenience function for updating a secure settings value as a long 3007 * integer. This will either create a new entry in the table if the 3008 * given name does not exist, or modify the value of the existing row 3009 * with that name. Note that internally setting values are always 3010 * stored as strings, so this function converts the given value to a 3011 * string before storing it. 3012 * 3013 * @param cr The ContentResolver to access. 3014 * @param name The name of the setting to modify. 3015 * @param value The new value for the setting. 3016 * @return true if the value was set, false on database errors 3017 */ 3018 public static boolean putLong(ContentResolver cr, String name, long value) { 3019 return putLongForUser(cr, name, value, UserHandle.myUserId()); 3020 } 3021 3022 /** @hide */ 3023 public static boolean putLongForUser(ContentResolver cr, String name, long value, 3024 int userHandle) { 3025 return putStringForUser(cr, name, Long.toString(value), userHandle); 3026 } 3027 3028 /** 3029 * Convenience function for retrieving a single secure settings value 3030 * as a floating point number. Note that internally setting values are 3031 * always stored as strings; this function converts the string to an 3032 * float for you. The default value will be returned if the setting 3033 * is not defined or not a valid float. 3034 * 3035 * @param cr The ContentResolver to access. 3036 * @param name The name of the setting to retrieve. 3037 * @param def Value to return if the setting is not defined. 3038 * 3039 * @return The setting's current value, or 'def' if it is not defined 3040 * or not a valid float. 3041 */ 3042 public static float getFloat(ContentResolver cr, String name, float def) { 3043 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 3044 } 3045 3046 /** @hide */ 3047 public static float getFloatForUser(ContentResolver cr, String name, float def, 3048 int userHandle) { 3049 String v = getStringForUser(cr, name, userHandle); 3050 try { 3051 return v != null ? Float.parseFloat(v) : def; 3052 } catch (NumberFormatException e) { 3053 return def; 3054 } 3055 } 3056 3057 /** 3058 * Convenience function for retrieving a single secure settings value 3059 * as a float. Note that internally setting values are always 3060 * stored as strings; this function converts the string to a float 3061 * for you. 3062 * <p> 3063 * This version does not take a default value. If the setting has not 3064 * been set, or the string value is not a number, 3065 * it throws {@link SettingNotFoundException}. 3066 * 3067 * @param cr The ContentResolver to access. 3068 * @param name The name of the setting to retrieve. 3069 * 3070 * @throws SettingNotFoundException Thrown if a setting by the given 3071 * name can't be found or the setting value is not a float. 3072 * 3073 * @return The setting's current value. 3074 */ 3075 public static float getFloat(ContentResolver cr, String name) 3076 throws SettingNotFoundException { 3077 return getFloatForUser(cr, name, UserHandle.myUserId()); 3078 } 3079 3080 /** @hide */ 3081 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 3082 throws SettingNotFoundException { 3083 String v = getStringForUser(cr, name, userHandle); 3084 if (v == null) { 3085 throw new SettingNotFoundException(name); 3086 } 3087 try { 3088 return Float.parseFloat(v); 3089 } catch (NumberFormatException e) { 3090 throw new SettingNotFoundException(name); 3091 } 3092 } 3093 3094 /** 3095 * Convenience function for updating a single settings value as a 3096 * floating point number. This will either create a new entry in the 3097 * table if the given name does not exist, or modify the value of the 3098 * existing row with that name. Note that internally setting values 3099 * are always stored as strings, so this function converts the given 3100 * value to a string before storing it. 3101 * 3102 * @param cr The ContentResolver to access. 3103 * @param name The name of the setting to modify. 3104 * @param value The new value for the setting. 3105 * @return true if the value was set, false on database errors 3106 */ 3107 public static boolean putFloat(ContentResolver cr, String name, float value) { 3108 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 3109 } 3110 3111 /** @hide */ 3112 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 3113 int userHandle) { 3114 return putStringForUser(cr, name, Float.toString(value), userHandle); 3115 } 3116 3117 /** 3118 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} 3119 * instead 3120 */ 3121 @Deprecated 3122 public static final String DEVELOPMENT_SETTINGS_ENABLED = 3123 Global.DEVELOPMENT_SETTINGS_ENABLED; 3124 3125 /** 3126 * When the user has enable the option to have a "bug report" command 3127 * in the power menu. 3128 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead 3129 * @hide 3130 */ 3131 @Deprecated 3132 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 3133 3134 /** 3135 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead 3136 */ 3137 @Deprecated 3138 public static final String ADB_ENABLED = Global.ADB_ENABLED; 3139 3140 /** 3141 * Setting to allow mock locations and location provider status to be injected into the 3142 * LocationManager service for testing purposes during application development. These 3143 * locations and status values override actual location and status information generated 3144 * by network, gps, or other location providers. 3145 */ 3146 public static final String ALLOW_MOCK_LOCATION = "mock_location"; 3147 3148 /** 3149 * A 64-bit number (as a hex string) that is randomly 3150 * generated on the device's first boot and should remain 3151 * constant for the lifetime of the device. (The value may 3152 * change if a factory reset is performed on the device.) 3153 */ 3154 public static final String ANDROID_ID = "android_id"; 3155 3156 /** 3157 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 3158 */ 3159 @Deprecated 3160 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 3161 3162 /** 3163 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 3164 */ 3165 @Deprecated 3166 public static final String DATA_ROAMING = Global.DATA_ROAMING; 3167 3168 /** 3169 * Setting to record the input method used by default, holding the ID 3170 * of the desired method. 3171 */ 3172 public static final String DEFAULT_INPUT_METHOD = "default_input_method"; 3173 3174 /** 3175 * Setting to record the input method subtype used by default, holding the ID 3176 * of the desired method. 3177 */ 3178 public static final String SELECTED_INPUT_METHOD_SUBTYPE = 3179 "selected_input_method_subtype"; 3180 3181 /** 3182 * Setting to record the history of input method subtype, holding the pair of ID of IME 3183 * and its last used subtype. 3184 * @hide 3185 */ 3186 public static final String INPUT_METHODS_SUBTYPE_HISTORY = 3187 "input_methods_subtype_history"; 3188 3189 /** 3190 * Setting to record the visibility of input method selector 3191 */ 3192 public static final String INPUT_METHOD_SELECTOR_VISIBILITY = 3193 "input_method_selector_visibility"; 3194 3195 /** 3196 * bluetooth HCI snoop log configuration 3197 * @hide 3198 */ 3199 public static final String BLUETOOTH_HCI_LOG = 3200 "bluetooth_hci_log"; 3201 3202 /** 3203 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 3204 */ 3205 @Deprecated 3206 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 3207 3208 /** 3209 * Whether the current user has been set up via setup wizard (0 = false, 1 = true) 3210 * @hide 3211 */ 3212 public static final String USER_SETUP_COMPLETE = "user_setup_complete"; 3213 3214 /** 3215 * List of input methods that are currently enabled. This is a string 3216 * containing the IDs of all enabled input methods, each ID separated 3217 * by ':'. 3218 */ 3219 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; 3220 3221 /** 3222 * List of system input methods that are currently disabled. This is a string 3223 * containing the IDs of all disabled input methods, each ID separated 3224 * by ':'. 3225 * @hide 3226 */ 3227 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; 3228 3229 /** 3230 * Host name and port for global http proxy. Uses ':' seperator for 3231 * between host and port. 3232 * 3233 * @deprecated Use {@link Global#HTTP_PROXY} 3234 */ 3235 @Deprecated 3236 public static final String HTTP_PROXY = Global.HTTP_PROXY; 3237 3238 /** 3239 * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead 3240 */ 3241 @Deprecated 3242 public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; 3243 3244 /** 3245 * Comma-separated list of location providers that activities may access. 3246 */ 3247 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; 3248 3249 /** 3250 * A flag containing settings used for biometric weak 3251 * @hide 3252 */ 3253 public static final String LOCK_BIOMETRIC_WEAK_FLAGS = 3254 "lock_biometric_weak_flags"; 3255 3256 /** 3257 * Whether autolock is enabled (0 = false, 1 = true) 3258 */ 3259 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; 3260 3261 /** 3262 * Whether lock pattern is visible as user enters (0 = false, 1 = true) 3263 */ 3264 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 3265 3266 /** 3267 * Whether lock pattern will vibrate as user enters (0 = false, 1 = 3268 * true) 3269 * 3270 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the 3271 * lockscreen uses 3272 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. 3273 */ 3274 @Deprecated 3275 public static final String 3276 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; 3277 3278 /** 3279 * This preference allows the device to be locked given time after screen goes off, 3280 * subject to current DeviceAdmin policy limits. 3281 * @hide 3282 */ 3283 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; 3284 3285 3286 /** 3287 * This preference contains the string that shows for owner info on LockScreen. 3288 * @hide 3289 * @deprecated 3290 */ 3291 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; 3292 3293 /** 3294 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). 3295 * @hide 3296 */ 3297 public static final String LOCK_SCREEN_APPWIDGET_IDS = 3298 "lock_screen_appwidget_ids"; 3299 3300 /** 3301 * Id of the appwidget shown on the lock screen when appwidgets are disabled. 3302 * @hide 3303 */ 3304 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = 3305 "lock_screen_fallback_appwidget_id"; 3306 3307 /** 3308 * Index of the lockscreen appwidget to restore, -1 if none. 3309 * @hide 3310 */ 3311 public static final String LOCK_SCREEN_STICKY_APPWIDGET = 3312 "lock_screen_sticky_appwidget"; 3313 3314 /** 3315 * This preference enables showing the owner info on LockScreen. 3316 * @hide 3317 * @deprecated 3318 */ 3319 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = 3320 "lock_screen_owner_info_enabled"; 3321 3322 /** 3323 * The Logging ID (a unique 64-bit value) as a hex string. 3324 * Used as a pseudonymous identifier for logging. 3325 * @deprecated This identifier is poorly initialized and has 3326 * many collisions. It should not be used. 3327 */ 3328 @Deprecated 3329 public static final String LOGGING_ID = "logging_id"; 3330 3331 /** 3332 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 3333 */ 3334 @Deprecated 3335 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 3336 3337 /** 3338 * No longer supported. 3339 */ 3340 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 3341 3342 /** 3343 * No longer supported. 3344 */ 3345 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 3346 3347 /** 3348 * No longer supported. 3349 */ 3350 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 3351 3352 /** 3353 * Settings classname to launch when Settings is clicked from All 3354 * Applications. Needed because of user testing between the old 3355 * and new Settings apps. 3356 */ 3357 // TODO: 881807 3358 public static final String SETTINGS_CLASSNAME = "settings_classname"; 3359 3360 /** 3361 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 3362 */ 3363 @Deprecated 3364 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 3365 3366 /** 3367 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 3368 */ 3369 @Deprecated 3370 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 3371 3372 /** 3373 * If accessibility is enabled. 3374 */ 3375 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; 3376 3377 /** 3378 * If touch exploration is enabled. 3379 */ 3380 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; 3381 3382 /** 3383 * List of the enabled accessibility providers. 3384 */ 3385 public static final String ENABLED_ACCESSIBILITY_SERVICES = 3386 "enabled_accessibility_services"; 3387 3388 /** 3389 * List of the accessibility services to which the user has granted 3390 * permission to put the device into touch exploration mode. 3391 * 3392 * @hide 3393 */ 3394 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = 3395 "touch_exploration_granted_accessibility_services"; 3396 3397 /** 3398 * Whether to speak passwords while in accessibility mode. 3399 */ 3400 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; 3401 3402 /** 3403 * If injection of accessibility enhancing JavaScript screen-reader 3404 * is enabled. 3405 * <p> 3406 * Note: The JavaScript based screen-reader is served by the 3407 * Google infrastructure and enable users with disabilities to 3408 * efficiently navigate in and explore web content. 3409 * </p> 3410 * <p> 3411 * This property represents a boolean value. 3412 * </p> 3413 * @hide 3414 */ 3415 public static final String ACCESSIBILITY_SCRIPT_INJECTION = 3416 "accessibility_script_injection"; 3417 3418 /** 3419 * The URL for the injected JavaScript based screen-reader used 3420 * for providing accessibility of content in WebView. 3421 * <p> 3422 * Note: The JavaScript based screen-reader is served by the 3423 * Google infrastructure and enable users with disabilities to 3424 * efficiently navigate in and explore web content. 3425 * </p> 3426 * <p> 3427 * This property represents a string value. 3428 * </p> 3429 * @hide 3430 */ 3431 public static final String ACCESSIBILITY_SCREEN_READER_URL = 3432 "accessibility_script_injection_url"; 3433 3434 /** 3435 * Key bindings for navigation in built-in accessibility support for web content. 3436 * <p> 3437 * Note: These key bindings are for the built-in accessibility navigation for 3438 * web content which is used as a fall back solution if JavaScript in a WebView 3439 * is not enabled or the user has not opted-in script injection from Google. 3440 * </p> 3441 * <p> 3442 * The bindings are separated by semi-colon. A binding is a mapping from 3443 * a key to a sequence of actions (for more details look at 3444 * android.webkit.AccessibilityInjector). A key is represented as the hexademical 3445 * string representation of an integer obtained from a meta state (optional) shifted 3446 * sixteen times left and bitwise ored with a key code. An action is represented 3447 * as a hexademical string representation of an integer where the first two digits 3448 * are navigation action index, the second, the third, and the fourth digit pairs 3449 * represent the action arguments. The separate actions in a binding are colon 3450 * separated. The key and the action sequence it maps to are separated by equals. 3451 * </p> 3452 * <p> 3453 * For example, the binding below maps the DPAD right button to traverse the 3454 * current navigation axis once without firing an accessibility event and to 3455 * perform the same traversal again but to fire an event: 3456 * <code> 3457 * 0x16=0x01000100:0x01000101; 3458 * </code> 3459 * </p> 3460 * <p> 3461 * The goal of this binding is to enable dynamic rebinding of keys to 3462 * navigation actions for web content without requiring a framework change. 3463 * </p> 3464 * <p> 3465 * This property represents a string value. 3466 * </p> 3467 * @hide 3468 */ 3469 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = 3470 "accessibility_web_content_key_bindings"; 3471 3472 /** 3473 * Setting that specifies whether the display magnification is enabled. 3474 * Display magnifications allows the user to zoom in the display content 3475 * and is targeted to low vision users. The current magnification scale 3476 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. 3477 * 3478 * @hide 3479 */ 3480 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = 3481 "accessibility_display_magnification_enabled"; 3482 3483 /** 3484 * Setting that specifies what the display magnification scale is. 3485 * Display magnifications allows the user to zoom in the display 3486 * content and is targeted to low vision users. Whether a display 3487 * magnification is performed is controlled by 3488 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 3489 * 3490 * @hide 3491 */ 3492 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = 3493 "accessibility_display_magnification_scale"; 3494 3495 /** 3496 * Setting that specifies whether the display magnification should be 3497 * automatically updated. If this fearture is enabled the system will 3498 * exit magnification mode or pan the viewport when a context change 3499 * occurs. For example, on staring a new activity or rotating the screen, 3500 * the system may zoom out so the user can see the new context he is in. 3501 * Another example is on showing a window that is not visible in the 3502 * magnified viewport the system may pan the viewport to make the window 3503 * the has popped up so the user knows that the context has changed. 3504 * Whether a screen magnification is performed is controlled by 3505 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 3506 * 3507 * @hide 3508 */ 3509 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = 3510 "accessibility_display_magnification_auto_update"; 3511 3512 /** 3513 * Setting that specifies whether timed text (captions) should be 3514 * displayed in video content. Text display properties are controlled by 3515 * the following settings: 3516 * <ul> 3517 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE} 3518 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR} 3519 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR} 3520 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR} 3521 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE} 3522 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE} 3523 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SIZE} 3524 * </ul> 3525 * 3526 * @hide 3527 */ 3528 public static final String ACCESSIBILITY_CAPTIONING_ENABLED = 3529 "accessibility_captioning_enabled"; 3530 3531 /** 3532 * Setting that specifies the language for captions as a locale string, 3533 * e.g. en_US. 3534 * 3535 * @see java.util.Locale#toString 3536 * @hide 3537 */ 3538 public static final String ACCESSIBILITY_CAPTIONING_LOCALE = 3539 "accessibility_captioning_locale"; 3540 3541 /** 3542 * Integer property that specifies the preset style for captions, one 3543 * of: 3544 * <ul> 3545 * <li>{@link android.view.accessibility.CaptioningManager#PRESET_WHITE_ON_BLACK} 3546 * <li>{@link android.view.accessibility.CaptioningManager#PRESET_BLACK_ON_WHITE} 3547 * <li>{@link android.view.accessibility.CaptioningManager#PRESET_CUSTOM} 3548 * </ul> 3549 * 3550 * @see java.util.Locale#toString 3551 * @hide 3552 */ 3553 public static final String ACCESSIBILITY_CAPTIONING_PRESET = 3554 "accessibility_captioning_preset"; 3555 3556 /** 3557 * Integer property that specifes the background color for captions as a 3558 * packed 32-bit color. 3559 * 3560 * @see android.graphics.Color#argb 3561 * @hide 3562 */ 3563 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR = 3564 "accessibility_captioning_background_color"; 3565 3566 /** 3567 * Integer property that specifes the foreground color for captions as a 3568 * packed 32-bit color. 3569 * 3570 * @see android.graphics.Color#argb 3571 * @hide 3572 */ 3573 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR = 3574 "accessibility_captioning_foreground_color"; 3575 3576 /** 3577 * Integer property that specifes the edge type for captions, one of: 3578 * <ul> 3579 * <li>{@link android.view.accessibility.CaptioningManager#EDGE_TYPE_NONE} 3580 * <li>{@link android.view.accessibility.CaptioningManager#EDGE_TYPE_OUTLINE} 3581 * <li>{@link android.view.accessibility.CaptioningManager#EDGE_TYPE_DROP_SHADOWED} 3582 * </ul> 3583 * 3584 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR 3585 * @hide 3586 */ 3587 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE = 3588 "accessibility_captioning_edge_type"; 3589 3590 /** 3591 * Integer property that specifes the edge color for captions as a 3592 * packed 32-bit color. 3593 * 3594 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE 3595 * @see android.graphics.Color#argb 3596 * @hide 3597 */ 3598 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR = 3599 "accessibility_captioning_edge_color"; 3600 3601 /** 3602 * String property that specifies the typeface for captions, one of: 3603 * <ul> 3604 * <li>DEFAULT 3605 * <li>MONOSPACE 3606 * <li>SANS_SERIF 3607 * <li>SERIF 3608 * </ul> 3609 * 3610 * @see android.graphics.Typeface 3611 * @hide 3612 */ 3613 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE = 3614 "accessibility_captioning_typeface"; 3615 3616 /** 3617 * Integer point property that specifies font size for captions in 3618 * scaled pixels (sp). 3619 * 3620 * @hide 3621 */ 3622 public static final String ACCESSIBILITY_CAPTIONING_FONT_SIZE = 3623 "accessibility_captioning_font_size"; 3624 3625 /** 3626 * The timout for considering a press to be a long press in milliseconds. 3627 * @hide 3628 */ 3629 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; 3630 3631 /** 3632 * List of the enabled print providers. 3633 * @hide 3634 */ 3635 public static final String ENABLED_PRINT_SERVICES = 3636 "enabled_print_services"; 3637 3638 /** 3639 * Setting to always use the default text-to-speech settings regardless 3640 * of the application settings. 3641 * 1 = override application settings, 3642 * 0 = use application settings (if specified). 3643 * 3644 * @deprecated The value of this setting is no longer respected by 3645 * the framework text to speech APIs as of the Ice Cream Sandwich release. 3646 */ 3647 @Deprecated 3648 public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; 3649 3650 /** 3651 * Default text-to-speech engine speech rate. 100 = 1x 3652 */ 3653 public static final String TTS_DEFAULT_RATE = "tts_default_rate"; 3654 3655 /** 3656 * Default text-to-speech engine pitch. 100 = 1x 3657 */ 3658 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; 3659 3660 /** 3661 * Default text-to-speech engine. 3662 */ 3663 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; 3664 3665 /** 3666 * Default text-to-speech language. 3667 * 3668 * @deprecated this setting is no longer in use, as of the Ice Cream 3669 * Sandwich release. Apps should never need to read this setting directly, 3670 * instead can query the TextToSpeech framework classes for the default 3671 * locale. {@link TextToSpeech#getLanguage()}. 3672 */ 3673 @Deprecated 3674 public static final String TTS_DEFAULT_LANG = "tts_default_lang"; 3675 3676 /** 3677 * Default text-to-speech country. 3678 * 3679 * @deprecated this setting is no longer in use, as of the Ice Cream 3680 * Sandwich release. Apps should never need to read this setting directly, 3681 * instead can query the TextToSpeech framework classes for the default 3682 * locale. {@link TextToSpeech#getLanguage()}. 3683 */ 3684 @Deprecated 3685 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; 3686 3687 /** 3688 * Default text-to-speech locale variant. 3689 * 3690 * @deprecated this setting is no longer in use, as of the Ice Cream 3691 * Sandwich release. Apps should never need to read this setting directly, 3692 * instead can query the TextToSpeech framework classes for the 3693 * locale that is in use {@link TextToSpeech#getLanguage()}. 3694 */ 3695 @Deprecated 3696 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; 3697 3698 /** 3699 * Stores the default tts locales on a per engine basis. Stored as 3700 * a comma seperated list of values, each value being of the form 3701 * {@code engine_name:locale} for example, 3702 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This 3703 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and 3704 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this 3705 * setting directly, and can query the TextToSpeech framework classes 3706 * for the locale that is in use. 3707 * 3708 * @hide 3709 */ 3710 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; 3711 3712 /** 3713 * Space delimited list of plugin packages that are enabled. 3714 */ 3715 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; 3716 3717 /** 3718 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} 3719 * instead. 3720 */ 3721 @Deprecated 3722 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 3723 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 3724 3725 /** 3726 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} 3727 * instead. 3728 */ 3729 @Deprecated 3730 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 3731 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 3732 3733 /** 3734 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 3735 * instead. 3736 */ 3737 @Deprecated 3738 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = 3739 Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 3740 3741 /** 3742 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} 3743 * instead. 3744 */ 3745 @Deprecated 3746 public static final String WIFI_ON = Global.WIFI_ON; 3747 3748 /** 3749 * The acceptable packet loss percentage (range 0 - 100) before trying 3750 * another AP on the same network. 3751 * @deprecated This setting is not used. 3752 */ 3753 @Deprecated 3754 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 3755 "wifi_watchdog_acceptable_packet_loss_percentage"; 3756 3757 /** 3758 * The number of access points required for a network in order for the 3759 * watchdog to monitor it. 3760 * @deprecated This setting is not used. 3761 */ 3762 @Deprecated 3763 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; 3764 3765 /** 3766 * The delay between background checks. 3767 * @deprecated This setting is not used. 3768 */ 3769 @Deprecated 3770 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 3771 "wifi_watchdog_background_check_delay_ms"; 3772 3773 /** 3774 * Whether the Wi-Fi watchdog is enabled for background checking even 3775 * after it thinks the user has connected to a good access point. 3776 * @deprecated This setting is not used. 3777 */ 3778 @Deprecated 3779 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 3780 "wifi_watchdog_background_check_enabled"; 3781 3782 /** 3783 * The timeout for a background ping 3784 * @deprecated This setting is not used. 3785 */ 3786 @Deprecated 3787 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 3788 "wifi_watchdog_background_check_timeout_ms"; 3789 3790 /** 3791 * The number of initial pings to perform that *may* be ignored if they 3792 * fail. Again, if these fail, they will *not* be used in packet loss 3793 * calculation. For example, one network always seemed to time out for 3794 * the first couple pings, so this is set to 3 by default. 3795 * @deprecated This setting is not used. 3796 */ 3797 @Deprecated 3798 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 3799 "wifi_watchdog_initial_ignored_ping_count"; 3800 3801 /** 3802 * The maximum number of access points (per network) to attempt to test. 3803 * If this number is reached, the watchdog will no longer monitor the 3804 * initial connection state for the network. This is a safeguard for 3805 * networks containing multiple APs whose DNS does not respond to pings. 3806 * @deprecated This setting is not used. 3807 */ 3808 @Deprecated 3809 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; 3810 3811 /** 3812 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 3813 */ 3814 @Deprecated 3815 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 3816 3817 /** 3818 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. 3819 * @deprecated This setting is not used. 3820 */ 3821 @Deprecated 3822 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; 3823 3824 /** 3825 * The number of pings to test if an access point is a good connection. 3826 * @deprecated This setting is not used. 3827 */ 3828 @Deprecated 3829 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; 3830 3831 /** 3832 * The delay between pings. 3833 * @deprecated This setting is not used. 3834 */ 3835 @Deprecated 3836 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; 3837 3838 /** 3839 * The timeout per ping. 3840 * @deprecated This setting is not used. 3841 */ 3842 @Deprecated 3843 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; 3844 3845 /** 3846 * @deprecated Use 3847 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 3848 */ 3849 @Deprecated 3850 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 3851 3852 /** 3853 * @deprecated Use 3854 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 3855 */ 3856 @Deprecated 3857 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 3858 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 3859 3860 /** 3861 * Whether background data usage is allowed. 3862 * 3863 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, 3864 * availability of background data depends on several 3865 * combined factors. When background data is unavailable, 3866 * {@link ConnectivityManager#getActiveNetworkInfo()} will 3867 * now appear disconnected. 3868 */ 3869 @Deprecated 3870 public static final String BACKGROUND_DATA = "background_data"; 3871 3872 /** 3873 * Origins for which browsers should allow geolocation by default. 3874 * The value is a space-separated list of origins. 3875 */ 3876 public static final String ALLOWED_GEOLOCATION_ORIGINS 3877 = "allowed_geolocation_origins"; 3878 3879 /** 3880 * The preferred TTY mode 0 = TTy Off, CDMA default 3881 * 1 = TTY Full 3882 * 2 = TTY HCO 3883 * 3 = TTY VCO 3884 * @hide 3885 */ 3886 public static final String PREFERRED_TTY_MODE = 3887 "preferred_tty_mode"; 3888 3889 /** 3890 * Whether the enhanced voice privacy mode is enabled. 3891 * 0 = normal voice privacy 3892 * 1 = enhanced voice privacy 3893 * @hide 3894 */ 3895 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; 3896 3897 /** 3898 * Whether the TTY mode mode is enabled. 3899 * 0 = disabled 3900 * 1 = enabled 3901 * @hide 3902 */ 3903 public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; 3904 3905 /** 3906 * Controls whether settings backup is enabled. 3907 * Type: int ( 0 = disabled, 1 = enabled ) 3908 * @hide 3909 */ 3910 public static final String BACKUP_ENABLED = "backup_enabled"; 3911 3912 /** 3913 * Controls whether application data is automatically restored from backup 3914 * at install time. 3915 * Type: int ( 0 = disabled, 1 = enabled ) 3916 * @hide 3917 */ 3918 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; 3919 3920 /** 3921 * Indicates whether settings backup has been fully provisioned. 3922 * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) 3923 * @hide 3924 */ 3925 public static final String BACKUP_PROVISIONED = "backup_provisioned"; 3926 3927 /** 3928 * Component of the transport to use for backup/restore. 3929 * @hide 3930 */ 3931 public static final String BACKUP_TRANSPORT = "backup_transport"; 3932 3933 /** 3934 * Version for which the setup wizard was last shown. Bumped for 3935 * each release when there is new setup information to show. 3936 * @hide 3937 */ 3938 public static final String LAST_SETUP_SHOWN = "last_setup_shown"; 3939 3940 /** 3941 * The interval in milliseconds after which Wi-Fi is considered idle. 3942 * When idle, it is possible for the device to be switched from Wi-Fi to 3943 * the mobile data network. 3944 * @hide 3945 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} 3946 * instead. 3947 */ 3948 @Deprecated 3949 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; 3950 3951 /** 3952 * The global search provider chosen by the user (if multiple global 3953 * search providers are installed). This will be the provider returned 3954 * by {@link SearchManager#getGlobalSearchActivity()} if it's still 3955 * installed. This setting is stored as a flattened component name as 3956 * per {@link ComponentName#flattenToString()}. 3957 * 3958 * @hide 3959 */ 3960 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY = 3961 "search_global_search_activity"; 3962 3963 /** 3964 * The number of promoted sources in GlobalSearch. 3965 * @hide 3966 */ 3967 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources"; 3968 /** 3969 * The maximum number of suggestions returned by GlobalSearch. 3970 * @hide 3971 */ 3972 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display"; 3973 /** 3974 * The number of suggestions GlobalSearch will ask each non-web search source for. 3975 * @hide 3976 */ 3977 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source"; 3978 /** 3979 * The number of suggestions the GlobalSearch will ask the web search source for. 3980 * @hide 3981 */ 3982 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT = 3983 "search_web_results_override_limit"; 3984 /** 3985 * The number of milliseconds that GlobalSearch will wait for suggestions from 3986 * promoted sources before continuing with all other sources. 3987 * @hide 3988 */ 3989 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS = 3990 "search_promoted_source_deadline_millis"; 3991 /** 3992 * The number of milliseconds before GlobalSearch aborts search suggesiton queries. 3993 * @hide 3994 */ 3995 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis"; 3996 /** 3997 * The maximum number of milliseconds that GlobalSearch shows the previous results 3998 * after receiving a new query. 3999 * @hide 4000 */ 4001 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis"; 4002 /** 4003 * The maximum age of log data used for shortcuts in GlobalSearch. 4004 * @hide 4005 */ 4006 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis"; 4007 /** 4008 * The maximum age of log data used for source ranking in GlobalSearch. 4009 * @hide 4010 */ 4011 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS = 4012 "search_max_source_event_age_millis"; 4013 /** 4014 * The minimum number of impressions needed to rank a source in GlobalSearch. 4015 * @hide 4016 */ 4017 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING = 4018 "search_min_impressions_for_source_ranking"; 4019 /** 4020 * The minimum number of clicks needed to rank a source in GlobalSearch. 4021 * @hide 4022 */ 4023 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING = 4024 "search_min_clicks_for_source_ranking"; 4025 /** 4026 * The maximum number of shortcuts shown by GlobalSearch. 4027 * @hide 4028 */ 4029 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned"; 4030 /** 4031 * The size of the core thread pool for suggestion queries in GlobalSearch. 4032 * @hide 4033 */ 4034 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE = 4035 "search_query_thread_core_pool_size"; 4036 /** 4037 * The maximum size of the thread pool for suggestion queries in GlobalSearch. 4038 * @hide 4039 */ 4040 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE = 4041 "search_query_thread_max_pool_size"; 4042 /** 4043 * The size of the core thread pool for shortcut refreshing in GlobalSearch. 4044 * @hide 4045 */ 4046 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE = 4047 "search_shortcut_refresh_core_pool_size"; 4048 /** 4049 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch. 4050 * @hide 4051 */ 4052 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE = 4053 "search_shortcut_refresh_max_pool_size"; 4054 /** 4055 * The maximun time that excess threads in the GlobalSeach thread pools will 4056 * wait before terminating. 4057 * @hide 4058 */ 4059 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS = 4060 "search_thread_keepalive_seconds"; 4061 /** 4062 * The maximum number of concurrent suggestion queries to each source. 4063 * @hide 4064 */ 4065 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = 4066 "search_per_source_concurrent_query_limit"; 4067 4068 /** 4069 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true) 4070 * @hide 4071 */ 4072 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; 4073 4074 /** 4075 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true) 4076 * @hide 4077 */ 4078 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart"; 4079 4080 /** 4081 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true) 4082 * @hide 4083 */ 4084 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt"; 4085 4086 /** 4087 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true) 4088 * @hide 4089 */ 4090 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled"; 4091 4092 /** 4093 * If nonzero, ANRs in invisible background processes bring up a dialog. 4094 * Otherwise, the process will be silently killed. 4095 * @hide 4096 */ 4097 public static final String ANR_SHOW_BACKGROUND = "anr_show_background"; 4098 4099 /** 4100 * The {@link ComponentName} string of the service to be used as the voice recognition 4101 * service. 4102 * 4103 * @hide 4104 */ 4105 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service"; 4106 4107 /** 4108 * Stores whether an user has consented to have apps verified through PAM. 4109 * The value is boolean (1 or 0). 4110 * 4111 * @hide 4112 */ 4113 public static final String PACKAGE_VERIFIER_USER_CONSENT = 4114 "package_verifier_user_consent"; 4115 4116 /** 4117 * The {@link ComponentName} string of the selected spell checker service which is 4118 * one of the services managed by the text service manager. 4119 * 4120 * @hide 4121 */ 4122 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker"; 4123 4124 /** 4125 * The {@link ComponentName} string of the selected subtype of the selected spell checker 4126 * service which is one of the services managed by the text service manager. 4127 * 4128 * @hide 4129 */ 4130 public static final String SELECTED_SPELL_CHECKER_SUBTYPE = 4131 "selected_spell_checker_subtype"; 4132 4133 /** 4134 * The {@link ComponentName} string whether spell checker is enabled or not. 4135 * 4136 * @hide 4137 */ 4138 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled"; 4139 4140 /** 4141 * What happens when the user presses the Power button while in-call 4142 * and the screen is on.<br/> 4143 * <b>Values:</b><br/> 4144 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/> 4145 * 2 - The Power button hangs up the current call.<br/> 4146 * 4147 * @hide 4148 */ 4149 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; 4150 4151 /** 4152 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". 4153 * @hide 4154 */ 4155 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1; 4156 4157 /** 4158 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up". 4159 * @hide 4160 */ 4161 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2; 4162 4163 /** 4164 * INCALL_POWER_BUTTON_BEHAVIOR default value. 4165 * @hide 4166 */ 4167 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT = 4168 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF; 4169 4170 /** 4171 * The current night mode that has been selected by the user. Owned 4172 * and controlled by UiModeManagerService. Constants are as per 4173 * UiModeManager. 4174 * @hide 4175 */ 4176 public static final String UI_NIGHT_MODE = "ui_night_mode"; 4177 4178 /** 4179 * Whether screensavers are enabled. 4180 * @hide 4181 */ 4182 public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; 4183 4184 /** 4185 * The user's chosen screensaver components. 4186 * 4187 * These will be launched by the PhoneWindowManager after a timeout when not on 4188 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). 4189 * @hide 4190 */ 4191 public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; 4192 4193 /** 4194 * If screensavers are enabled, whether the screensaver should be automatically launched 4195 * when the device is inserted into a (desk) dock. 4196 * @hide 4197 */ 4198 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; 4199 4200 /** 4201 * If screensavers are enabled, whether the screensaver should be automatically launched 4202 * when the screen times out when not on battery. 4203 * @hide 4204 */ 4205 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; 4206 4207 /** 4208 * If screensavers are enabled, the default screensaver component. 4209 * @hide 4210 */ 4211 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; 4212 4213 /** 4214 * The default NFC payment component 4215 * @hide 4216 */ 4217 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component"; 4218 4219 /** 4220 * Whether to automatically invoke NFC payment app or manually select on tap. 4221 * @hide 4222 */ 4223 public static final String NFC_PAYMENT_MODE = "nfc_payment_mode"; 4224 4225 /** 4226 * Name of a package that the current user has explicitly allowed to see all of that 4227 * user's notifications. 4228 * 4229 * @hide 4230 */ 4231 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners"; 4232 4233 /** 4234 * Whether or not to enable the dial pad autocomplete functionality. 4235 * 4236 * @hide 4237 */ 4238 public static final String DIALPAD_AUTOCOMPLETE = "dialpad_autocomplete"; 4239 4240 /** @hide */ 4241 public static final String BAR_SERVICE_COMPONENT = "bar_service_component"; 4242 4243 /** 4244 * This are the settings to be backed up. 4245 * 4246 * NOTE: Settings are backed up and restored in the order they appear 4247 * in this array. If you have one setting depending on another, 4248 * make sure that they are ordered appropriately. 4249 * 4250 * @hide 4251 */ 4252 public static final String[] SETTINGS_TO_BACKUP = { 4253 BUGREPORT_IN_POWER_MENU, // moved to global 4254 ALLOW_MOCK_LOCATION, 4255 PARENTAL_CONTROL_ENABLED, 4256 PARENTAL_CONTROL_REDIRECT_URL, 4257 USB_MASS_STORAGE_ENABLED, // moved to global 4258 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 4259 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 4260 ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, 4261 ACCESSIBILITY_SCRIPT_INJECTION, 4262 BACKUP_AUTO_RESTORE, 4263 ENABLED_ACCESSIBILITY_SERVICES, 4264 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, 4265 TOUCH_EXPLORATION_ENABLED, 4266 ACCESSIBILITY_ENABLED, 4267 ACCESSIBILITY_SPEAK_PASSWORD, 4268 ACCESSIBILITY_CAPTIONING_ENABLED, 4269 ACCESSIBILITY_CAPTIONING_LOCALE, 4270 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, 4271 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, 4272 ACCESSIBILITY_CAPTIONING_EDGE_TYPE, 4273 ACCESSIBILITY_CAPTIONING_EDGE_COLOR, 4274 ACCESSIBILITY_CAPTIONING_TYPEFACE, 4275 ACCESSIBILITY_CAPTIONING_FONT_SIZE, 4276 TTS_USE_DEFAULTS, 4277 TTS_DEFAULT_RATE, 4278 TTS_DEFAULT_PITCH, 4279 TTS_DEFAULT_SYNTH, 4280 TTS_DEFAULT_LANG, 4281 TTS_DEFAULT_COUNTRY, 4282 TTS_ENABLED_PLUGINS, 4283 TTS_DEFAULT_LOCALE, 4284 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global 4285 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global 4286 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global 4287 MOUNT_PLAY_NOTIFICATION_SND, 4288 MOUNT_UMS_AUTOSTART, 4289 MOUNT_UMS_PROMPT, 4290 MOUNT_UMS_NOTIFY_ENABLED, 4291 UI_NIGHT_MODE, 4292 DIALPAD_AUTOCOMPLETE 4293 }; 4294 4295 /** 4296 * Helper method for determining if a location provider is enabled. 4297 * @param cr the content resolver to use 4298 * @param provider the location provider to query 4299 * @return true if the provider is enabled 4300 */ 4301 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { 4302 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); 4303 } 4304 4305 /** 4306 * Helper method for determining if a location provider is enabled. 4307 * @param cr the content resolver to use 4308 * @param provider the location provider to query 4309 * @param userId the userId to query 4310 * @return true if the provider is enabled 4311 * @hide 4312 */ 4313 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { 4314 String allowedProviders = Settings.Secure.getStringForUser(cr, 4315 LOCATION_PROVIDERS_ALLOWED, userId); 4316 return TextUtils.delimitedStringContains(allowedProviders, ',', provider); 4317 } 4318 4319 /** 4320 * Thread-safe method for enabling or disabling a single location provider. 4321 * @param cr the content resolver to use 4322 * @param provider the location provider to enable or disable 4323 * @param enabled true if the provider should be enabled 4324 */ 4325 public static final void setLocationProviderEnabled(ContentResolver cr, 4326 String provider, boolean enabled) { 4327 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); 4328 } 4329 4330 /** 4331 * Thread-safe method for enabling or disabling a single location provider. 4332 * @param cr the content resolver to use 4333 * @param provider the location provider to enable or disable 4334 * @param enabled true if the provider should be enabled 4335 * @param userId the userId for which to enable/disable providers 4336 * @hide 4337 */ 4338 public static final void setLocationProviderEnabledForUser(ContentResolver cr, 4339 String provider, boolean enabled, int userId) { 4340 // to ensure thread safety, we write the provider name with a '+' or '-' 4341 // and let the SettingsProvider handle it rather than reading and modifying 4342 // the list of enabled providers. 4343 if (enabled) { 4344 provider = "+" + provider; 4345 } else { 4346 provider = "-" + provider; 4347 } 4348 putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, 4349 userId); 4350 } 4351 } 4352 4353 /** 4354 * Global system settings, containing preferences that always apply identically 4355 * to all defined users. Applications can read these but are not allowed to write; 4356 * like the "Secure" settings, these are for preferences that the user must 4357 * explicitly modify through the system UI or specialized APIs for those values. 4358 */ 4359 public static final class Global extends NameValueTable { 4360 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; 4361 4362 /** 4363 * The content:// style URL for global secure settings items. Not public. 4364 */ 4365 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); 4366 4367 /** 4368 * Setting whether the global gesture for enabling accessibility is enabled. 4369 * If this gesture is enabled the user will be able to perfrom it to enable 4370 * the accessibility state without visiting the settings app. 4371 * @hide 4372 */ 4373 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = 4374 "enable_accessibility_global_gesture_enabled"; 4375 4376 /** 4377 * Whether Airplane Mode is on. 4378 */ 4379 public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; 4380 4381 /** 4382 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. 4383 */ 4384 public static final String RADIO_BLUETOOTH = "bluetooth"; 4385 4386 /** 4387 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. 4388 */ 4389 public static final String RADIO_WIFI = "wifi"; 4390 4391 /** 4392 * {@hide} 4393 */ 4394 public static final String RADIO_WIMAX = "wimax"; 4395 /** 4396 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. 4397 */ 4398 public static final String RADIO_CELL = "cell"; 4399 4400 /** 4401 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. 4402 */ 4403 public static final String RADIO_NFC = "nfc"; 4404 4405 /** 4406 * A comma separated list of radios that need to be disabled when airplane mode 4407 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are 4408 * included in the comma separated list. 4409 */ 4410 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; 4411 4412 /** 4413 * A comma separated list of radios that should to be disabled when airplane mode 4414 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is 4415 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi 4416 * will be turned off when entering airplane mode, but the user will be able to reenable 4417 * Wifi in the Settings app. 4418 * 4419 * {@hide} 4420 */ 4421 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; 4422 4423 /** 4424 * The policy for deciding when Wi-Fi should go to sleep (which will in 4425 * turn switch to using the mobile data as an Internet connection). 4426 * <p> 4427 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, 4428 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or 4429 * {@link #WIFI_SLEEP_POLICY_NEVER}. 4430 */ 4431 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; 4432 4433 /** 4434 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep 4435 * policy, which is to sleep shortly after the turning off 4436 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. 4437 */ 4438 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; 4439 4440 /** 4441 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when 4442 * the device is on battery, and never go to sleep when the device is 4443 * plugged in. 4444 */ 4445 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; 4446 4447 /** 4448 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. 4449 */ 4450 public static final int WIFI_SLEEP_POLICY_NEVER = 2; 4451 4452 /** 4453 * Value to specify if the user prefers the date, time and time zone 4454 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 4455 */ 4456 public static final String AUTO_TIME = "auto_time"; 4457 4458 /** 4459 * Value to specify if the user prefers the time zone 4460 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 4461 */ 4462 public static final String AUTO_TIME_ZONE = "auto_time_zone"; 4463 4464 /** 4465 * URI for the car dock "in" event sound. 4466 * @hide 4467 */ 4468 public static final String CAR_DOCK_SOUND = "car_dock_sound"; 4469 4470 /** 4471 * URI for the car dock "out" event sound. 4472 * @hide 4473 */ 4474 public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; 4475 4476 /** 4477 * URI for the desk dock "in" event sound. 4478 * @hide 4479 */ 4480 public static final String DESK_DOCK_SOUND = "desk_dock_sound"; 4481 4482 /** 4483 * URI for the desk dock "out" event sound. 4484 * @hide 4485 */ 4486 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; 4487 4488 /** 4489 * Whether to play a sound for dock events. 4490 * @hide 4491 */ 4492 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; 4493 4494 /** 4495 * URI for the "device locked" (keyguard shown) sound. 4496 * @hide 4497 */ 4498 public static final String LOCK_SOUND = "lock_sound"; 4499 4500 /** 4501 * URI for the "device unlocked" sound. 4502 * @hide 4503 */ 4504 public static final String UNLOCK_SOUND = "unlock_sound"; 4505 4506 /** 4507 * URI for the low battery sound file. 4508 * @hide 4509 */ 4510 public static final String LOW_BATTERY_SOUND = "low_battery_sound"; 4511 4512 /** 4513 * Whether to play a sound for low-battery alerts. 4514 * @hide 4515 */ 4516 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; 4517 4518 /** 4519 * URI for the "wireless charging started" sound. 4520 * @hide 4521 */ 4522 public static final String WIRELESS_CHARGING_STARTED_SOUND = 4523 "wireless_charging_started_sound"; 4524 4525 /** 4526 * Whether we keep the device on while the device is plugged in. 4527 * Supported values are: 4528 * <ul> 4529 * <li>{@code 0} to never stay on while plugged in</li> 4530 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li> 4531 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li> 4532 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li> 4533 * </ul> 4534 * These values can be OR-ed together. 4535 */ 4536 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; 4537 4538 /** 4539 * When the user has enable the option to have a "bug report" command 4540 * in the power menu. 4541 * @hide 4542 */ 4543 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 4544 4545 /** 4546 * Whether ADB is enabled. 4547 */ 4548 public static final String ADB_ENABLED = "adb_enabled"; 4549 4550 /** 4551 * Whether assisted GPS should be enabled or not. 4552 * @hide 4553 */ 4554 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; 4555 4556 /** 4557 * Whether bluetooth is enabled/disabled 4558 * 0=disabled. 1=enabled. 4559 */ 4560 public static final String BLUETOOTH_ON = "bluetooth_on"; 4561 4562 /** 4563 * CDMA Cell Broadcast SMS 4564 * 0 = CDMA Cell Broadcast SMS disabled 4565 * 1 = CDMA Cell Broadcast SMS enabled 4566 * @hide 4567 */ 4568 public static final String CDMA_CELL_BROADCAST_SMS = 4569 "cdma_cell_broadcast_sms"; 4570 4571 /** 4572 * The CDMA roaming mode 0 = Home Networks, CDMA default 4573 * 1 = Roaming on Affiliated networks 4574 * 2 = Roaming on any networks 4575 * @hide 4576 */ 4577 public static final String CDMA_ROAMING_MODE = "roaming_settings"; 4578 4579 /** 4580 * The CDMA subscription mode 0 = RUIM/SIM (default) 4581 * 1 = NV 4582 * @hide 4583 */ 4584 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; 4585 4586 /** Inactivity timeout to track mobile data activity. 4587 * 4588 * If set to a positive integer, it indicates the inactivity timeout value in seconds to 4589 * infer the data activity of mobile network. After a period of no activity on mobile 4590 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} 4591 * intent is fired to indicate a transition of network status from "active" to "idle". Any 4592 * subsequent activity on mobile networks triggers the firing of {@code 4593 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". 4594 * 4595 * Network activity refers to transmitting or receiving data on the network interfaces. 4596 * 4597 * Tracking is disabled if set to zero or negative value. 4598 * 4599 * @hide 4600 */ 4601 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; 4602 4603 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} 4604 * but for Wifi network. 4605 * @hide 4606 */ 4607 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; 4608 4609 /** 4610 * Whether or not data roaming is enabled. (0 = false, 1 = true) 4611 */ 4612 public static final String DATA_ROAMING = "data_roaming"; 4613 4614 /** 4615 * The value passed to a Mobile DataConnection via bringUp which defines the 4616 * number of retries to preform when setting up the initial connection. The default 4617 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1. 4618 * @hide 4619 */ 4620 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry"; 4621 4622 /** 4623 * Whether user has enabled development settings. 4624 */ 4625 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; 4626 4627 /** 4628 * Whether the device has been provisioned (0 = false, 1 = true) 4629 */ 4630 public static final String DEVICE_PROVISIONED = "device_provisioned"; 4631 4632 /** 4633 * The saved value for WindowManagerService.setForcedDisplayDensity(). 4634 * One integer in dpi. If unset, then use the real display density. 4635 * @hide 4636 */ 4637 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; 4638 4639 /** 4640 * The saved value for WindowManagerService.setForcedDisplaySize(). 4641 * Two integers separated by a comma. If unset, then use the real display size. 4642 * @hide 4643 */ 4644 public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; 4645 4646 /** 4647 * The maximum size, in bytes, of a download that the download manager will transfer over 4648 * a non-wifi connection. 4649 * @hide 4650 */ 4651 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = 4652 "download_manager_max_bytes_over_mobile"; 4653 4654 /** 4655 * The recommended maximum size, in bytes, of a download that the download manager should 4656 * transfer over a non-wifi connection. Over this size, the use will be warned, but will 4657 * have the option to start the download over the mobile connection anyway. 4658 * @hide 4659 */ 4660 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = 4661 "download_manager_recommended_max_bytes_over_mobile"; 4662 4663 /** 4664 * Whether the package installer should allow installation of apps downloaded from 4665 * sources other than Google Play. 4666 * 4667 * 1 = allow installing from other sources 4668 * 0 = only allow installing from Google Play 4669 */ 4670 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 4671 4672 /** 4673 * Whether mobile data connections are allowed by the user. See 4674 * ConnectivityManager for more info. 4675 * @hide 4676 */ 4677 public static final String MOBILE_DATA = "mobile_data"; 4678 4679 /** {@hide} */ 4680 public static final String NETSTATS_ENABLED = "netstats_enabled"; 4681 /** {@hide} */ 4682 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; 4683 /** {@hide} */ 4684 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; 4685 /** {@hide} */ 4686 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; 4687 /** {@hide} */ 4688 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; 4689 /** {@hide} */ 4690 public static final String NETSTATS_REPORT_XT_OVER_DEV = "netstats_report_xt_over_dev"; 4691 4692 /** {@hide} */ 4693 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; 4694 /** {@hide} */ 4695 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; 4696 /** {@hide} */ 4697 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; 4698 /** {@hide} */ 4699 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; 4700 4701 /** {@hide} */ 4702 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; 4703 /** {@hide} */ 4704 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; 4705 /** {@hide} */ 4706 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; 4707 /** {@hide} */ 4708 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; 4709 4710 /** {@hide} */ 4711 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; 4712 /** {@hide} */ 4713 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; 4714 /** {@hide} */ 4715 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; 4716 /** {@hide} */ 4717 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; 4718 4719 /** 4720 * User preference for which network(s) should be used. Only the 4721 * connectivity service should touch this. 4722 */ 4723 public static final String NETWORK_PREFERENCE = "network_preference"; 4724 4725 /** 4726 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment 4727 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been 4728 * exceeded. 4729 * @hide 4730 */ 4731 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; 4732 4733 /** 4734 * The length of time in milli-seconds that automatic small adjustments to 4735 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. 4736 * @hide 4737 */ 4738 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; 4739 4740 /** Preferred NTP server. {@hide} */ 4741 public static final String NTP_SERVER = "ntp_server"; 4742 /** Timeout in milliseconds to wait for NTP server. {@hide} */ 4743 public static final String NTP_TIMEOUT = "ntp_timeout"; 4744 4745 /** 4746 * Whether the package manager should send package verification broadcasts for verifiers to 4747 * review apps prior to installation. 4748 * 1 = request apps to be verified prior to installation, if a verifier exists. 4749 * 0 = do not verify apps before installation 4750 * @hide 4751 */ 4752 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; 4753 4754 /** Timeout for package verification. 4755 * @hide */ 4756 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; 4757 4758 /** Default response code for package verification. 4759 * @hide */ 4760 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; 4761 4762 /** 4763 * Show package verification setting in the Settings app. 4764 * 1 = show (default) 4765 * 0 = hide 4766 * @hide 4767 */ 4768 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; 4769 4770 /** 4771 * Run package verificaiton on apps installed through ADB/ADT/USB 4772 * 1 = perform package verification on ADB installs (default) 4773 * 0 = bypass package verification on ADB installs 4774 * @hide 4775 */ 4776 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; 4777 4778 /** 4779 * The interval in milliseconds at which to check packet counts on the 4780 * mobile data interface when screen is on, to detect possible data 4781 * connection problems. 4782 * @hide 4783 */ 4784 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = 4785 "pdp_watchdog_poll_interval_ms"; 4786 4787 /** 4788 * The interval in milliseconds at which to check packet counts on the 4789 * mobile data interface when screen is off, to detect possible data 4790 * connection problems. 4791 * @hide 4792 */ 4793 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = 4794 "pdp_watchdog_long_poll_interval_ms"; 4795 4796 /** 4797 * The interval in milliseconds at which to check packet counts on the 4798 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} 4799 * outgoing packets has been reached without incoming packets. 4800 * @hide 4801 */ 4802 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = 4803 "pdp_watchdog_error_poll_interval_ms"; 4804 4805 /** 4806 * The number of outgoing packets sent without seeing an incoming packet 4807 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} 4808 * device is logged to the event log 4809 * @hide 4810 */ 4811 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = 4812 "pdp_watchdog_trigger_packet_count"; 4813 4814 /** 4815 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) 4816 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before 4817 * attempting data connection recovery. 4818 * @hide 4819 */ 4820 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = 4821 "pdp_watchdog_error_poll_count"; 4822 4823 /** 4824 * The number of failed PDP reset attempts before moving to something more 4825 * drastic: re-registering to the network. 4826 * @hide 4827 */ 4828 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = 4829 "pdp_watchdog_max_pdp_reset_fail_count"; 4830 4831 /** 4832 * A positive value indicates how often the SamplingProfiler 4833 * should take snapshots. Zero value means SamplingProfiler 4834 * is disabled. 4835 * 4836 * @hide 4837 */ 4838 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; 4839 4840 /** 4841 * URL to open browser on to allow user to manage a prepay account 4842 * @hide 4843 */ 4844 public static final String SETUP_PREPAID_DATA_SERVICE_URL = 4845 "setup_prepaid_data_service_url"; 4846 4847 /** 4848 * URL to attempt a GET on to see if this is a prepay device 4849 * @hide 4850 */ 4851 public static final String SETUP_PREPAID_DETECTION_TARGET_URL = 4852 "setup_prepaid_detection_target_url"; 4853 4854 /** 4855 * Host to check for a redirect to after an attempt to GET 4856 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, 4857 * this is a prepaid device with zero balance.) 4858 * @hide 4859 */ 4860 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = 4861 "setup_prepaid_detection_redir_host"; 4862 4863 /** 4864 * The interval in milliseconds at which to check the number of SMS sent out without asking 4865 * for use permit, to limit the un-authorized SMS usage. 4866 * 4867 * @hide 4868 */ 4869 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = 4870 "sms_outgoing_check_interval_ms"; 4871 4872 /** 4873 * The number of outgoing SMS sent without asking for user permit (of {@link 4874 * #SMS_OUTGOING_CHECK_INTERVAL_MS} 4875 * 4876 * @hide 4877 */ 4878 public static final String SMS_OUTGOING_CHECK_MAX_COUNT = 4879 "sms_outgoing_check_max_count"; 4880 4881 /** 4882 * Used to disable SMS short code confirmation - defaults to true. 4883 * True indcates we will do the check, etc. Set to false to disable. 4884 * @see com.android.internal.telephony.SmsUsageMonitor 4885 * @hide 4886 */ 4887 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; 4888 4889 /** 4890 * Used to select which country we use to determine premium sms codes. 4891 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, 4892 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, 4893 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. 4894 * @hide 4895 */ 4896 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; 4897 4898 /** 4899 * Used to disable Tethering on a device - defaults to true 4900 * @hide 4901 */ 4902 public static final String TETHER_SUPPORTED = "tether_supported"; 4903 4904 /** 4905 * Used to require DUN APN on the device or not - defaults to a build config value 4906 * which defaults to false 4907 * @hide 4908 */ 4909 public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; 4910 4911 /** 4912 * Used to hold a gservices-provisioned apn value for DUN. If set, or the 4913 * corresponding build config values are set it will override the APN DB 4914 * values. 4915 * Consists of a comma seperated list of strings: 4916 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" 4917 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" 4918 * @hide 4919 */ 4920 public static final String TETHER_DUN_APN = "tether_dun_apn"; 4921 4922 /** 4923 * USB Mass Storage Enabled 4924 */ 4925 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; 4926 4927 /** 4928 * If this setting is set (to anything), then all references 4929 * to Gmail on the device must change to Google Mail. 4930 */ 4931 public static final String USE_GOOGLE_MAIL = "use_google_mail"; 4932 4933 /** Autofill server address (Used in WebView/browser). 4934 * {@hide} */ 4935 public static final String WEB_AUTOFILL_QUERY_URL = 4936 "web_autofill_query_url"; 4937 4938 /** 4939 * Whether Wifi display is enabled/disabled 4940 * 0=disabled. 1=enabled. 4941 * @hide 4942 */ 4943 public static final String WIFI_DISPLAY_ON = "wifi_display_on"; 4944 4945 /** 4946 * Whether to notify the user of open networks. 4947 * <p> 4948 * If not connected and the scan results have an open network, we will 4949 * put this notification up. If we attempt to connect to a network or 4950 * the open network(s) disappear, we remove the notification. When we 4951 * show the notification, we will not show it again for 4952 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. 4953 */ 4954 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4955 "wifi_networks_available_notification_on"; 4956 /** 4957 * {@hide} 4958 */ 4959 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4960 "wimax_networks_available_notification_on"; 4961 4962 /** 4963 * Delay (in seconds) before repeating the Wi-Fi networks available notification. 4964 * Connecting to a network will reset the timer. 4965 */ 4966 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 4967 "wifi_networks_available_repeat_delay"; 4968 4969 /** 4970 * 802.11 country code in ISO 3166 format 4971 * @hide 4972 */ 4973 public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; 4974 4975 /** 4976 * The interval in milliseconds to issue wake up scans when wifi needs 4977 * to connect. This is necessary to connect to an access point when 4978 * device is on the move and the screen is off. 4979 * @hide 4980 */ 4981 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = 4982 "wifi_framework_scan_interval_ms"; 4983 4984 /** 4985 * The interval in milliseconds after which Wi-Fi is considered idle. 4986 * When idle, it is possible for the device to be switched from Wi-Fi to 4987 * the mobile data network. 4988 * @hide 4989 */ 4990 public static final String WIFI_IDLE_MS = "wifi_idle_ms"; 4991 4992 /** 4993 * When the number of open networks exceeds this number, the 4994 * least-recently-used excess networks will be removed. 4995 */ 4996 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; 4997 4998 /** 4999 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. 5000 */ 5001 public static final String WIFI_ON = "wifi_on"; 5002 5003 /** 5004 * Setting to allow scans to be enabled even wifi is turned off for connectivity. 5005 * @hide 5006 */ 5007 public static final String WIFI_SCAN_ALWAYS_AVAILABLE = 5008 "wifi_scan_always_enabled"; 5009 5010 /** 5011 * Used to save the Wifi_ON state prior to tethering. 5012 * This state will be checked to restore Wifi after 5013 * the user turns off tethering. 5014 * 5015 * @hide 5016 */ 5017 public static final String WIFI_SAVED_STATE = "wifi_saved_state"; 5018 5019 /** 5020 * The interval in milliseconds to scan as used by the wifi supplicant 5021 * @hide 5022 */ 5023 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = 5024 "wifi_supplicant_scan_interval_ms"; 5025 5026 /** 5027 * The interval in milliseconds to scan at supplicant when p2p is connected 5028 * @hide 5029 */ 5030 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = 5031 "wifi_scan_interval_p2p_connected_ms"; 5032 5033 /** 5034 * Whether the Wi-Fi watchdog is enabled. 5035 */ 5036 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 5037 5038 /** 5039 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and 5040 * the setting needs to be set to 0 to disable it. 5041 * @hide 5042 */ 5043 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = 5044 "wifi_watchdog_poor_network_test_enabled"; 5045 5046 /** 5047 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and 5048 * needs to be set to 0 to disable it. 5049 * @hide 5050 */ 5051 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = 5052 "wifi_suspend_optimizations_enabled"; 5053 5054 /** 5055 * The maximum number of times we will retry a connection to an access 5056 * point for which we have failed in acquiring an IP address from DHCP. 5057 * A value of N means that we will make N+1 connection attempts in all. 5058 */ 5059 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; 5060 5061 /** 5062 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile 5063 * data connectivity to be established after a disconnect from Wi-Fi. 5064 */ 5065 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 5066 "wifi_mobile_data_transition_wakelock_timeout_ms"; 5067 5068 /** 5069 * The operational wifi frequency band 5070 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, 5071 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or 5072 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} 5073 * 5074 * @hide 5075 */ 5076 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; 5077 5078 /** 5079 * The Wi-Fi peer-to-peer device name 5080 * @hide 5081 */ 5082 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; 5083 5084 /** 5085 * The min time between wifi disable and wifi enable 5086 * @hide 5087 */ 5088 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay"; 5089 5090 /** 5091 * The number of milliseconds to delay when checking for data stalls during 5092 * non-aggressive detection. (screen is turned off.) 5093 * @hide 5094 */ 5095 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = 5096 "data_stall_alarm_non_aggressive_delay_in_ms"; 5097 5098 /** 5099 * The number of milliseconds to delay when checking for data stalls during 5100 * aggressive detection. (screen on or suspected data stall) 5101 * @hide 5102 */ 5103 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = 5104 "data_stall_alarm_aggressive_delay_in_ms"; 5105 5106 /** 5107 * The interval in milliseconds at which to check gprs registration 5108 * after the first registration mismatch of gprs and voice service, 5109 * to detect possible data network registration problems. 5110 * 5111 * @hide 5112 */ 5113 public static final String GPRS_REGISTER_CHECK_PERIOD_MS = 5114 "gprs_register_check_period_ms"; 5115 5116 /** 5117 * Nonzero causes Log.wtf() to crash. 5118 * @hide 5119 */ 5120 public static final String WTF_IS_FATAL = "wtf_is_fatal"; 5121 5122 /** 5123 * Ringer mode. This is used internally, changing this value will not 5124 * change the ringer mode. See AudioManager. 5125 */ 5126 public static final String MODE_RINGER = "mode_ringer"; 5127 5128 /** 5129 * Overlay display devices setting. 5130 * The associated value is a specially formatted string that describes the 5131 * size and density of simulated secondary display devices. 5132 * <p> 5133 * Format: {width}x{height}/{dpi};... 5134 * </p><p> 5135 * Example: 5136 * <ul> 5137 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li> 5138 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first 5139 * at 1080p and the second at 720p.</li> 5140 * <li>If the value is empty, then no overlay display devices are created.</li> 5141 * </ul></p> 5142 * 5143 * @hide 5144 */ 5145 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; 5146 5147 /** 5148 * Threshold values for the duration and level of a discharge cycle, 5149 * under which we log discharge cycle info. 5150 * 5151 * @hide 5152 */ 5153 public static final String 5154 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; 5155 5156 /** @hide */ 5157 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; 5158 5159 /** 5160 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR 5161 * intents on application crashes and ANRs. If this is disabled, the 5162 * crash/ANR dialog will never display the "Report" button. 5163 * <p> 5164 * Type: int (0 = disallow, 1 = allow) 5165 * 5166 * @hide 5167 */ 5168 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; 5169 5170 /** 5171 * Maximum age of entries kept by {@link DropBoxManager}. 5172 * 5173 * @hide 5174 */ 5175 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; 5176 5177 /** 5178 * Maximum number of entry files which {@link DropBoxManager} will keep 5179 * around. 5180 * 5181 * @hide 5182 */ 5183 public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; 5184 5185 /** 5186 * Maximum amount of disk space used by {@link DropBoxManager} no matter 5187 * what. 5188 * 5189 * @hide 5190 */ 5191 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; 5192 5193 /** 5194 * Percent of free disk (excluding reserve) which {@link DropBoxManager} 5195 * will use. 5196 * 5197 * @hide 5198 */ 5199 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; 5200 5201 /** 5202 * Percent of total disk which {@link DropBoxManager} will never dip 5203 * into. 5204 * 5205 * @hide 5206 */ 5207 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; 5208 5209 /** 5210 * Prefix for per-tag dropbox disable/enable settings. 5211 * 5212 * @hide 5213 */ 5214 public static final String DROPBOX_TAG_PREFIX = "dropbox:"; 5215 5216 /** 5217 * Lines of logcat to include with system crash/ANR/etc. reports, as a 5218 * prefix of the dropbox tag of the report type. For example, 5219 * "logcat_for_system_server_anr" controls the lines of logcat captured 5220 * with system server ANR reports. 0 to disable. 5221 * 5222 * @hide 5223 */ 5224 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; 5225 5226 /** 5227 * The interval in minutes after which the amount of free storage left 5228 * on the device is logged to the event log 5229 * 5230 * @hide 5231 */ 5232 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; 5233 5234 /** 5235 * Threshold for the amount of change in disk free space required to 5236 * report the amount of free space. Used to prevent spamming the logs 5237 * when the disk free space isn't changing frequently. 5238 * 5239 * @hide 5240 */ 5241 public static final String 5242 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; 5243 5244 /** 5245 * Minimum percentage of free storage on the device that is used to 5246 * determine if the device is running low on storage. The default is 10. 5247 * <p> 5248 * Say this value is set to 10, the device is considered running low on 5249 * storage if 90% or more of the device storage is filled up. 5250 * 5251 * @hide 5252 */ 5253 public static final String 5254 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; 5255 5256 /** 5257 * Maximum byte size of the low storage threshold. This is to ensure 5258 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an 5259 * overly large threshold for large storage devices. Currently this must 5260 * be less than 2GB. This default is 500MB. 5261 * 5262 * @hide 5263 */ 5264 public static final String 5265 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; 5266 5267 /** 5268 * Minimum bytes of free storage on the device before the data partition 5269 * is considered full. By default, 1 MB is reserved to avoid system-wide 5270 * SQLite disk full exceptions. 5271 * 5272 * @hide 5273 */ 5274 public static final String 5275 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; 5276 5277 /** 5278 * The maximum reconnect delay for short network outages or when the 5279 * network is suspended due to phone use. 5280 * 5281 * @hide 5282 */ 5283 public static final String 5284 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; 5285 5286 /** 5287 * The number of milliseconds to delay before sending out 5288 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. 5289 * 5290 * @hide 5291 */ 5292 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; 5293 5294 /** 5295 * Setting to turn off captive portal detection. Feature is enabled by 5296 * default and the setting needs to be set to 0 to disable it. 5297 * 5298 * @hide 5299 */ 5300 public static final String 5301 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; 5302 5303 /** 5304 * The server used for captive portal detection upon a new conection. A 5305 * 204 response code from the server is used for validation. 5306 * 5307 * @hide 5308 */ 5309 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; 5310 5311 /** 5312 * Whether network service discovery is enabled. 5313 * 5314 * @hide 5315 */ 5316 public static final String NSD_ON = "nsd_on"; 5317 5318 /** 5319 * Let user pick default install location. 5320 * 5321 * @hide 5322 */ 5323 public static final String SET_INSTALL_LOCATION = "set_install_location"; 5324 5325 /** 5326 * Default install location value. 5327 * 0 = auto, let system decide 5328 * 1 = internal 5329 * 2 = sdcard 5330 * @hide 5331 */ 5332 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; 5333 5334 /** 5335 * ms during which to consume extra events related to Inet connection 5336 * condition after a transtion to fully-connected 5337 * 5338 * @hide 5339 */ 5340 public static final String 5341 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; 5342 5343 /** 5344 * ms during which to consume extra events related to Inet connection 5345 * condtion after a transtion to partly-connected 5346 * 5347 * @hide 5348 */ 5349 public static final String 5350 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; 5351 5352 /** {@hide} */ 5353 public static final String 5354 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; 5355 5356 /** 5357 * Host name and port for global http proxy. Uses ':' seperator for 5358 * between host and port. 5359 */ 5360 public static final String HTTP_PROXY = "http_proxy"; 5361 5362 /** 5363 * Host name for global http proxy. Set via ConnectivityManager. 5364 * 5365 * @hide 5366 */ 5367 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; 5368 5369 /** 5370 * Integer host port for global http proxy. Set via ConnectivityManager. 5371 * 5372 * @hide 5373 */ 5374 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; 5375 5376 /** 5377 * Exclusion list for global proxy. This string contains a list of 5378 * comma-separated domains where the global proxy does not apply. 5379 * Domains should be listed in a comma- separated list. Example of 5380 * acceptable formats: ".domain1.com,my.domain2.com" Use 5381 * ConnectivityManager to set/get. 5382 * 5383 * @hide 5384 */ 5385 public static final String 5386 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; 5387 5388 /** 5389 * Enables the UI setting to allow the user to specify the global HTTP 5390 * proxy and associated exclusion list. 5391 * 5392 * @hide 5393 */ 5394 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; 5395 5396 /** 5397 * Setting for default DNS in case nobody suggests one 5398 * 5399 * @hide 5400 */ 5401 public static final String DEFAULT_DNS_SERVER = "default_dns_server"; 5402 5403 /** {@hide} */ 5404 public static final String 5405 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; 5406 /** {@hide} */ 5407 public static final String 5408 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; 5409 /** {@hide} */ 5410 public static final String 5411 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; 5412 5413 /** 5414 * Get the key that retrieves a bluetooth headset's priority. 5415 * @hide 5416 */ 5417 public static final String getBluetoothHeadsetPriorityKey(String address) { 5418 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 5419 } 5420 5421 /** 5422 * Get the key that retrieves a bluetooth a2dp sink's priority. 5423 * @hide 5424 */ 5425 public static final String getBluetoothA2dpSinkPriorityKey(String address) { 5426 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 5427 } 5428 5429 /** 5430 * Get the key that retrieves a bluetooth Input Device's priority. 5431 * @hide 5432 */ 5433 public static final String getBluetoothInputDevicePriorityKey(String address) { 5434 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 5435 } 5436 5437 /** 5438 * Scaling factor for normal window animations. Setting to 0 will 5439 * disable window animations. 5440 */ 5441 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; 5442 5443 /** 5444 * Scaling factor for activity transition animations. Setting to 0 will 5445 * disable window animations. 5446 */ 5447 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; 5448 5449 /** 5450 * Scaling factor for Animator-based animations. This affects both the 5451 * start delay and duration of all such animations. Setting to 0 will 5452 * cause animations to end immediately. The default value is 1. 5453 */ 5454 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; 5455 5456 /** 5457 * Scaling factor for normal window animations. Setting to 0 will 5458 * disable window animations. 5459 * 5460 * @hide 5461 */ 5462 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; 5463 5464 /** 5465 * If 0, the compatibility mode is off for all applications. 5466 * If 1, older applications run under compatibility mode. 5467 * TODO: remove this settings before code freeze (bug/1907571) 5468 * @hide 5469 */ 5470 public static final String COMPATIBILITY_MODE = "compatibility_mode"; 5471 5472 /** 5473 * CDMA only settings 5474 * Emergency Tone 0 = Off 5475 * 1 = Alert 5476 * 2 = Vibrate 5477 * @hide 5478 */ 5479 public static final String EMERGENCY_TONE = "emergency_tone"; 5480 5481 /** 5482 * CDMA only settings 5483 * Whether the auto retry is enabled. The value is 5484 * boolean (1 or 0). 5485 * @hide 5486 */ 5487 public static final String CALL_AUTO_RETRY = "call_auto_retry"; 5488 5489 /** 5490 * The preferred network mode 7 = Global 5491 * 6 = EvDo only 5492 * 5 = CDMA w/o EvDo 5493 * 4 = CDMA / EvDo auto 5494 * 3 = GSM / WCDMA auto 5495 * 2 = WCDMA only 5496 * 1 = GSM only 5497 * 0 = GSM / WCDMA preferred 5498 * @hide 5499 */ 5500 public static final String PREFERRED_NETWORK_MODE = 5501 "preferred_network_mode"; 5502 5503 /** 5504 * Name of an application package to be debugged. 5505 */ 5506 public static final String DEBUG_APP = "debug_app"; 5507 5508 /** 5509 * If 1, when launching DEBUG_APP it will wait for the debugger before 5510 * starting user code. If 0, it will run normally. 5511 */ 5512 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; 5513 5514 /** 5515 * Control whether the process CPU usage meter should be shown. 5516 */ 5517 public static final String SHOW_PROCESSES = "show_processes"; 5518 5519 /** 5520 * If 1, the activity manager will aggressively finish activities and 5521 * processes as soon as they are no longer needed. If 0, the normal 5522 * extended lifetime is used. 5523 */ 5524 public static final String ALWAYS_FINISH_ACTIVITIES = 5525 "always_finish_activities"; 5526 5527 /** 5528 * Use Dock audio output for media: 5529 * 0 = disabled 5530 * 1 = enabled 5531 * @hide 5532 */ 5533 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; 5534 5535 /** 5536 * Persisted safe headphone volume management state by AudioService 5537 * @hide 5538 */ 5539 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; 5540 5541 /** 5542 * URL for tzinfo (time zone) updates 5543 * @hide 5544 */ 5545 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url"; 5546 5547 /** 5548 * URL for tzinfo (time zone) update metadata 5549 * @hide 5550 */ 5551 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url"; 5552 5553 /** 5554 * URL for selinux (mandatory access control) updates 5555 * @hide 5556 */ 5557 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url"; 5558 5559 /** 5560 * URL for selinux (mandatory access control) update metadata 5561 * @hide 5562 */ 5563 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url"; 5564 5565 /** 5566 * URL for sms short code updates 5567 * @hide 5568 */ 5569 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL = 5570 "sms_short_codes_content_url"; 5571 5572 /** 5573 * URL for sms short code update metadata 5574 * @hide 5575 */ 5576 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL = 5577 "sms_short_codes_metadata_url"; 5578 5579 /** 5580 * URL for cert pinlist updates 5581 * @hide 5582 */ 5583 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url"; 5584 5585 /** 5586 * URL for cert pinlist updates 5587 * @hide 5588 */ 5589 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url"; 5590 5591 /** 5592 * URL for intent firewall updates 5593 * @hide 5594 */ 5595 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL = 5596 "intent_firewall_content_url"; 5597 5598 /** 5599 * URL for intent firewall update metadata 5600 * @hide 5601 */ 5602 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL = 5603 "intent_firewall_metadata_url"; 5604 5605 /** 5606 * SELinux enforcement status. If 0, permissive; if 1, enforcing. 5607 * @hide 5608 */ 5609 public static final String SELINUX_STATUS = "selinux_status"; 5610 5611 /** 5612 * Settings to backup. This is here so that it's in the same place as the settings 5613 * keys and easy to update. 5614 * 5615 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System 5616 * and Secure as well. This is because those tables drive both backup and 5617 * restore, and restore needs to properly whitelist keys that used to live 5618 * in those namespaces. The keys will only actually be backed up / restored 5619 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). 5620 * 5621 * NOTE: Settings are backed up and restored in the order they appear 5622 * in this array. If you have one setting depending on another, 5623 * make sure that they are ordered appropriately. 5624 * 5625 * @hide 5626 */ 5627 public static final String[] SETTINGS_TO_BACKUP = { 5628 BUGREPORT_IN_POWER_MENU, 5629 STAY_ON_WHILE_PLUGGED_IN, 5630 MODE_RINGER, 5631 AUTO_TIME, 5632 AUTO_TIME_ZONE, 5633 POWER_SOUNDS_ENABLED, 5634 DOCK_SOUNDS_ENABLED, 5635 USB_MASS_STORAGE_ENABLED, 5636 ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 5637 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 5638 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 5639 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 5640 WIFI_NUM_OPEN_NETWORKS_KEPT, 5641 EMERGENCY_TONE, 5642 CALL_AUTO_RETRY, 5643 DOCK_AUDIO_MEDIA_ENABLED 5644 }; 5645 5646 // Populated lazily, guarded by class object: 5647 private static NameValueCache sNameValueCache = new NameValueCache( 5648 SYS_PROP_SETTING_VERSION, 5649 CONTENT_URI, 5650 CALL_METHOD_GET_GLOBAL, 5651 CALL_METHOD_PUT_GLOBAL); 5652 5653 /** 5654 * Look up a name in the database. 5655 * @param resolver to access the database with 5656 * @param name to look up in the table 5657 * @return the corresponding value, or null if not present 5658 */ 5659 public static String getString(ContentResolver resolver, String name) { 5660 return getStringForUser(resolver, name, UserHandle.myUserId()); 5661 } 5662 5663 /** @hide */ 5664 public static String getStringForUser(ContentResolver resolver, String name, 5665 int userHandle) { 5666 return sNameValueCache.getStringForUser(resolver, name, userHandle); 5667 } 5668 5669 /** 5670 * Store a name/value pair into the database. 5671 * @param resolver to access the database with 5672 * @param name to store 5673 * @param value to associate with the name 5674 * @return true if the value was set, false on database errors 5675 */ 5676 public static boolean putString(ContentResolver resolver, 5677 String name, String value) { 5678 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 5679 } 5680 5681 /** @hide */ 5682 public static boolean putStringForUser(ContentResolver resolver, 5683 String name, String value, int userHandle) { 5684 if (LOCAL_LOGV) { 5685 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value 5686 + " for " + userHandle); 5687 } 5688 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 5689 } 5690 5691 /** 5692 * Construct the content URI for a particular name/value pair, 5693 * useful for monitoring changes with a ContentObserver. 5694 * @param name to look up in the table 5695 * @return the corresponding content URI, or null if not present 5696 */ 5697 public static Uri getUriFor(String name) { 5698 return getUriFor(CONTENT_URI, name); 5699 } 5700 5701 /** 5702 * Convenience function for retrieving a single secure settings value 5703 * as an integer. Note that internally setting values are always 5704 * stored as strings; this function converts the string to an integer 5705 * for you. The default value will be returned if the setting is 5706 * not defined or not an integer. 5707 * 5708 * @param cr The ContentResolver to access. 5709 * @param name The name of the setting to retrieve. 5710 * @param def Value to return if the setting is not defined. 5711 * 5712 * @return The setting's current value, or 'def' if it is not defined 5713 * or not a valid integer. 5714 */ 5715 public static int getInt(ContentResolver cr, String name, int def) { 5716 String v = getString(cr, name); 5717 try { 5718 return v != null ? Integer.parseInt(v) : def; 5719 } catch (NumberFormatException e) { 5720 return def; 5721 } 5722 } 5723 5724 /** 5725 * Convenience function for retrieving a single secure settings value 5726 * as an integer. Note that internally setting values are always 5727 * stored as strings; this function converts the string to an integer 5728 * for you. 5729 * <p> 5730 * This version does not take a default value. If the setting has not 5731 * been set, or the string value is not a number, 5732 * it throws {@link SettingNotFoundException}. 5733 * 5734 * @param cr The ContentResolver to access. 5735 * @param name The name of the setting to retrieve. 5736 * 5737 * @throws SettingNotFoundException Thrown if a setting by the given 5738 * name can't be found or the setting value is not an integer. 5739 * 5740 * @return The setting's current value. 5741 */ 5742 public static int getInt(ContentResolver cr, String name) 5743 throws SettingNotFoundException { 5744 String v = getString(cr, name); 5745 try { 5746 return Integer.parseInt(v); 5747 } catch (NumberFormatException e) { 5748 throw new SettingNotFoundException(name); 5749 } 5750 } 5751 5752 /** 5753 * Convenience function for updating a single settings value as an 5754 * integer. This will either create a new entry in the table if the 5755 * given name does not exist, or modify the value of the existing row 5756 * with that name. Note that internally setting values are always 5757 * stored as strings, so this function converts the given value to a 5758 * string before storing it. 5759 * 5760 * @param cr The ContentResolver to access. 5761 * @param name The name of the setting to modify. 5762 * @param value The new value for the setting. 5763 * @return true if the value was set, false on database errors 5764 */ 5765 public static boolean putInt(ContentResolver cr, String name, int value) { 5766 return putString(cr, name, Integer.toString(value)); 5767 } 5768 5769 /** 5770 * Convenience function for retrieving a single secure settings value 5771 * as a {@code long}. Note that internally setting values are always 5772 * stored as strings; this function converts the string to a {@code long} 5773 * for you. The default value will be returned if the setting is 5774 * not defined or not a {@code long}. 5775 * 5776 * @param cr The ContentResolver to access. 5777 * @param name The name of the setting to retrieve. 5778 * @param def Value to return if the setting is not defined. 5779 * 5780 * @return The setting's current value, or 'def' if it is not defined 5781 * or not a valid {@code long}. 5782 */ 5783 public static long getLong(ContentResolver cr, String name, long def) { 5784 String valString = getString(cr, name); 5785 long value; 5786 try { 5787 value = valString != null ? Long.parseLong(valString) : def; 5788 } catch (NumberFormatException e) { 5789 value = def; 5790 } 5791 return value; 5792 } 5793 5794 /** 5795 * Convenience function for retrieving a single secure settings value 5796 * as a {@code long}. Note that internally setting values are always 5797 * stored as strings; this function converts the string to a {@code long} 5798 * for you. 5799 * <p> 5800 * This version does not take a default value. If the setting has not 5801 * been set, or the string value is not a number, 5802 * it throws {@link SettingNotFoundException}. 5803 * 5804 * @param cr The ContentResolver to access. 5805 * @param name The name of the setting to retrieve. 5806 * 5807 * @return The setting's current value. 5808 * @throws SettingNotFoundException Thrown if a setting by the given 5809 * name can't be found or the setting value is not an integer. 5810 */ 5811 public static long getLong(ContentResolver cr, String name) 5812 throws SettingNotFoundException { 5813 String valString = getString(cr, name); 5814 try { 5815 return Long.parseLong(valString); 5816 } catch (NumberFormatException e) { 5817 throw new SettingNotFoundException(name); 5818 } 5819 } 5820 5821 /** 5822 * Convenience function for updating a secure settings value as a long 5823 * integer. This will either create a new entry in the table if the 5824 * given name does not exist, or modify the value of the existing row 5825 * with that name. Note that internally setting values are always 5826 * stored as strings, so this function converts the given value to a 5827 * string before storing it. 5828 * 5829 * @param cr The ContentResolver to access. 5830 * @param name The name of the setting to modify. 5831 * @param value The new value for the setting. 5832 * @return true if the value was set, false on database errors 5833 */ 5834 public static boolean putLong(ContentResolver cr, String name, long value) { 5835 return putString(cr, name, Long.toString(value)); 5836 } 5837 5838 /** 5839 * Convenience function for retrieving a single secure settings value 5840 * as a floating point number. Note that internally setting values are 5841 * always stored as strings; this function converts the string to an 5842 * float for you. The default value will be returned if the setting 5843 * is not defined or not a valid float. 5844 * 5845 * @param cr The ContentResolver to access. 5846 * @param name The name of the setting to retrieve. 5847 * @param def Value to return if the setting is not defined. 5848 * 5849 * @return The setting's current value, or 'def' if it is not defined 5850 * or not a valid float. 5851 */ 5852 public static float getFloat(ContentResolver cr, String name, float def) { 5853 String v = getString(cr, name); 5854 try { 5855 return v != null ? Float.parseFloat(v) : def; 5856 } catch (NumberFormatException e) { 5857 return def; 5858 } 5859 } 5860 5861 /** 5862 * Convenience function for retrieving a single secure settings value 5863 * as a float. Note that internally setting values are always 5864 * stored as strings; this function converts the string to a float 5865 * for you. 5866 * <p> 5867 * This version does not take a default value. If the setting has not 5868 * been set, or the string value is not a number, 5869 * it throws {@link SettingNotFoundException}. 5870 * 5871 * @param cr The ContentResolver to access. 5872 * @param name The name of the setting to retrieve. 5873 * 5874 * @throws SettingNotFoundException Thrown if a setting by the given 5875 * name can't be found or the setting value is not a float. 5876 * 5877 * @return The setting's current value. 5878 */ 5879 public static float getFloat(ContentResolver cr, String name) 5880 throws SettingNotFoundException { 5881 String v = getString(cr, name); 5882 if (v == null) { 5883 throw new SettingNotFoundException(name); 5884 } 5885 try { 5886 return Float.parseFloat(v); 5887 } catch (NumberFormatException e) { 5888 throw new SettingNotFoundException(name); 5889 } 5890 } 5891 5892 /** 5893 * Convenience function for updating a single settings value as a 5894 * floating point number. This will either create a new entry in the 5895 * table if the given name does not exist, or modify the value of the 5896 * existing row with that name. Note that internally setting values 5897 * are always stored as strings, so this function converts the given 5898 * value to a string before storing it. 5899 * 5900 * @param cr The ContentResolver to access. 5901 * @param name The name of the setting to modify. 5902 * @param value The new value for the setting. 5903 * @return true if the value was set, false on database errors 5904 */ 5905 public static boolean putFloat(ContentResolver cr, String name, float value) { 5906 return putString(cr, name, Float.toString(value)); 5907 } 5908 } 5909 5910 /** 5911 * User-defined bookmarks and shortcuts. The target of each bookmark is an 5912 * Intent URL, allowing it to be either a web page or a particular 5913 * application activity. 5914 * 5915 * @hide 5916 */ 5917 public static final class Bookmarks implements BaseColumns 5918 { 5919 private static final String TAG = "Bookmarks"; 5920 5921 /** 5922 * The content:// style URL for this table 5923 */ 5924 public static final Uri CONTENT_URI = 5925 Uri.parse("content://" + AUTHORITY + "/bookmarks"); 5926 5927 /** 5928 * The row ID. 5929 * <p>Type: INTEGER</p> 5930 */ 5931 public static final String ID = "_id"; 5932 5933 /** 5934 * Descriptive name of the bookmark that can be displayed to the user. 5935 * If this is empty, the title should be resolved at display time (use 5936 * {@link #getTitle(Context, Cursor)} any time you want to display the 5937 * title of a bookmark.) 5938 * <P> 5939 * Type: TEXT 5940 * </P> 5941 */ 5942 public static final String TITLE = "title"; 5943 5944 /** 5945 * Arbitrary string (displayed to the user) that allows bookmarks to be 5946 * organized into categories. There are some special names for 5947 * standard folders, which all start with '@'. The label displayed for 5948 * the folder changes with the locale (via {@link #getLabelForFolder}) but 5949 * the folder name does not change so you can consistently query for 5950 * the folder regardless of the current locale. 5951 * 5952 * <P>Type: TEXT</P> 5953 * 5954 */ 5955 public static final String FOLDER = "folder"; 5956 5957 /** 5958 * The Intent URL of the bookmark, describing what it points to. This 5959 * value is given to {@link android.content.Intent#getIntent} to create 5960 * an Intent that can be launched. 5961 * <P>Type: TEXT</P> 5962 */ 5963 public static final String INTENT = "intent"; 5964 5965 /** 5966 * Optional shortcut character associated with this bookmark. 5967 * <P>Type: INTEGER</P> 5968 */ 5969 public static final String SHORTCUT = "shortcut"; 5970 5971 /** 5972 * The order in which the bookmark should be displayed 5973 * <P>Type: INTEGER</P> 5974 */ 5975 public static final String ORDERING = "ordering"; 5976 5977 private static final String[] sIntentProjection = { INTENT }; 5978 private static final String[] sShortcutProjection = { ID, SHORTCUT }; 5979 private static final String sShortcutSelection = SHORTCUT + "=?"; 5980 5981 /** 5982 * Convenience function to retrieve the bookmarked Intent for a 5983 * particular shortcut key. 5984 * 5985 * @param cr The ContentResolver to query. 5986 * @param shortcut The shortcut key. 5987 * 5988 * @return Intent The bookmarked URL, or null if there is no bookmark 5989 * matching the given shortcut. 5990 */ 5991 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut) 5992 { 5993 Intent intent = null; 5994 5995 Cursor c = cr.query(CONTENT_URI, 5996 sIntentProjection, sShortcutSelection, 5997 new String[] { String.valueOf((int) shortcut) }, ORDERING); 5998 // Keep trying until we find a valid shortcut 5999 try { 6000 while (intent == null && c.moveToNext()) { 6001 try { 6002 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT)); 6003 intent = Intent.parseUri(intentURI, 0); 6004 } catch (java.net.URISyntaxException e) { 6005 // The stored URL is bad... ignore it. 6006 } catch (IllegalArgumentException e) { 6007 // Column not found 6008 Log.w(TAG, "Intent column not found", e); 6009 } 6010 } 6011 } finally { 6012 if (c != null) c.close(); 6013 } 6014 6015 return intent; 6016 } 6017 6018 /** 6019 * Add a new bookmark to the system. 6020 * 6021 * @param cr The ContentResolver to query. 6022 * @param intent The desired target of the bookmark. 6023 * @param title Bookmark title that is shown to the user; null if none 6024 * or it should be resolved to the intent's title. 6025 * @param folder Folder in which to place the bookmark; null if none. 6026 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If 6027 * this is non-zero and there is an existing bookmark entry 6028 * with this same shortcut, then that existing shortcut is 6029 * cleared (the bookmark is not removed). 6030 * @return The unique content URL for the new bookmark entry. 6031 */ 6032 public static Uri add(ContentResolver cr, 6033 Intent intent, 6034 String title, 6035 String folder, 6036 char shortcut, 6037 int ordering) 6038 { 6039 // If a shortcut is supplied, and it is already defined for 6040 // another bookmark, then remove the old definition. 6041 if (shortcut != 0) { 6042 cr.delete(CONTENT_URI, sShortcutSelection, 6043 new String[] { String.valueOf((int) shortcut) }); 6044 } 6045 6046 ContentValues values = new ContentValues(); 6047 if (title != null) values.put(TITLE, title); 6048 if (folder != null) values.put(FOLDER, folder); 6049 values.put(INTENT, intent.toUri(0)); 6050 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut); 6051 values.put(ORDERING, ordering); 6052 return cr.insert(CONTENT_URI, values); 6053 } 6054 6055 /** 6056 * Return the folder name as it should be displayed to the user. This 6057 * takes care of localizing special folders. 6058 * 6059 * @param r Resources object for current locale; only need access to 6060 * system resources. 6061 * @param folder The value found in the {@link #FOLDER} column. 6062 * 6063 * @return CharSequence The label for this folder that should be shown 6064 * to the user. 6065 */ 6066 public static CharSequence getLabelForFolder(Resources r, String folder) { 6067 return folder; 6068 } 6069 6070 /** 6071 * Return the title as it should be displayed to the user. This takes 6072 * care of localizing bookmarks that point to activities. 6073 * 6074 * @param context A context. 6075 * @param cursor A cursor pointing to the row whose title should be 6076 * returned. The cursor must contain at least the {@link #TITLE} 6077 * and {@link #INTENT} columns. 6078 * @return A title that is localized and can be displayed to the user, 6079 * or the empty string if one could not be found. 6080 */ 6081 public static CharSequence getTitle(Context context, Cursor cursor) { 6082 int titleColumn = cursor.getColumnIndex(TITLE); 6083 int intentColumn = cursor.getColumnIndex(INTENT); 6084 if (titleColumn == -1 || intentColumn == -1) { 6085 throw new IllegalArgumentException( 6086 "The cursor must contain the TITLE and INTENT columns."); 6087 } 6088 6089 String title = cursor.getString(titleColumn); 6090 if (!TextUtils.isEmpty(title)) { 6091 return title; 6092 } 6093 6094 String intentUri = cursor.getString(intentColumn); 6095 if (TextUtils.isEmpty(intentUri)) { 6096 return ""; 6097 } 6098 6099 Intent intent; 6100 try { 6101 intent = Intent.parseUri(intentUri, 0); 6102 } catch (URISyntaxException e) { 6103 return ""; 6104 } 6105 6106 PackageManager packageManager = context.getPackageManager(); 6107 ResolveInfo info = packageManager.resolveActivity(intent, 0); 6108 return info != null ? info.loadLabel(packageManager) : ""; 6109 } 6110 } 6111 6112 /** 6113 * Returns the device ID that we should use when connecting to the mobile gtalk server. 6114 * This is a string like "android-0x1242", where the hex string is the Android ID obtained 6115 * from the GoogleLoginService. 6116 * 6117 * @param androidId The Android ID for this device. 6118 * @return The device ID that should be used when connecting to the mobile gtalk server. 6119 * @hide 6120 */ 6121 public static String getGTalkDeviceId(long androidId) { 6122 return "android-" + Long.toHexString(androidId); 6123 } 6124} 6125