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