Settings.java revision 297da6ffb996460cce8efcf8fa920ea54e99731d
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.annotation.SystemApi; 22import android.app.SearchManager; 23import android.app.WallpaperManager; 24import android.content.ComponentName; 25import android.content.ContentResolver; 26import android.content.ContentValues; 27import android.content.Context; 28import android.content.IContentProvider; 29import android.content.Intent; 30import android.content.pm.ActivityInfo; 31import android.content.pm.PackageManager; 32import android.content.pm.ResolveInfo; 33import android.content.res.Configuration; 34import android.content.res.Resources; 35import android.database.Cursor; 36import android.database.SQLException; 37import android.location.LocationManager; 38import android.net.ConnectivityManager; 39import android.net.Uri; 40import android.net.wifi.WifiManager; 41import android.os.BatteryManager; 42import android.os.Bundle; 43import android.os.DropBoxManager; 44import android.os.IBinder; 45import android.os.Process; 46import android.os.RemoteException; 47import android.os.ServiceManager; 48import android.os.SystemProperties; 49import android.os.UserHandle; 50import android.os.Build.VERSION_CODES; 51import android.speech.tts.TextToSpeech; 52import android.text.TextUtils; 53import android.util.AndroidException; 54import android.util.ArrayMap; 55import android.util.ArraySet; 56import android.util.Log; 57 58import com.android.internal.util.ArrayUtils; 59import com.android.internal.widget.ILockSettings; 60 61import java.net.URISyntaxException; 62import java.text.SimpleDateFormat; 63import java.util.HashMap; 64import java.util.HashSet; 65import java.util.Locale; 66import java.util.Map; 67import java.util.Set; 68 69/** 70 * The Settings provider contains global system-level device preferences. 71 */ 72public final class Settings { 73 74 // Intent actions for Settings 75 76 /** 77 * Activity Action: Show system settings. 78 * <p> 79 * Input: Nothing. 80 * <p> 81 * Output: Nothing. 82 */ 83 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 84 public static final String ACTION_SETTINGS = "android.settings.SETTINGS"; 85 86 /** 87 * Activity Action: Show settings to allow configuration of APNs. 88 * <p> 89 * Input: Nothing. 90 * <p> 91 * Output: Nothing. 92 */ 93 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 94 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS"; 95 96 /** 97 * Activity Action: Show settings to allow configuration of current location 98 * sources. 99 * <p> 100 * In some cases, a matching Activity may not exist, so ensure you 101 * safeguard against this. 102 * <p> 103 * Input: Nothing. 104 * <p> 105 * Output: Nothing. 106 */ 107 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 108 public static final String ACTION_LOCATION_SOURCE_SETTINGS = 109 "android.settings.LOCATION_SOURCE_SETTINGS"; 110 111 /** 112 * Activity Action: Show settings to allow configuration of wireless controls 113 * such as Wi-Fi, Bluetooth and Mobile networks. 114 * <p> 115 * In some cases, a matching Activity may not exist, so ensure you 116 * safeguard against this. 117 * <p> 118 * Input: Nothing. 119 * <p> 120 * Output: Nothing. 121 */ 122 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 123 public static final String ACTION_WIRELESS_SETTINGS = 124 "android.settings.WIRELESS_SETTINGS"; 125 126 /** 127 * Activity Action: Show settings to allow entering/exiting airplane mode. 128 * <p> 129 * In some cases, a matching Activity may not exist, so ensure you 130 * safeguard against this. 131 * <p> 132 * Input: Nothing. 133 * <p> 134 * Output: Nothing. 135 */ 136 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 137 public static final String ACTION_AIRPLANE_MODE_SETTINGS = 138 "android.settings.AIRPLANE_MODE_SETTINGS"; 139 140 /** 141 * Activity Action: Modify Airplane mode settings using a voice command. 142 * <p> 143 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 144 * <p> 145 * This intent MUST be started using 146 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 147 * startVoiceActivity}. 148 * <p> 149 * Note: The activity implementing this intent MUST verify that 150 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before 151 * modifying the setting. 152 * <p> 153 * Input: To tell which state airplane mode should be set to, add the 154 * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified. 155 * If the extra is not included, no changes will be made. 156 * <p> 157 * Output: Nothing. 158 */ 159 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 160 public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE = 161 "android.settings.VOICE_CONTROL_AIRPLANE_MODE"; 162 163 /** 164 * Activity Action: Show settings for accessibility modules. 165 * <p> 166 * In some cases, a matching Activity may not exist, so ensure you 167 * safeguard against this. 168 * <p> 169 * Input: Nothing. 170 * <p> 171 * Output: Nothing. 172 */ 173 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 174 public static final String ACTION_ACCESSIBILITY_SETTINGS = 175 "android.settings.ACCESSIBILITY_SETTINGS"; 176 177 /** 178 * Activity Action: Show settings to control access to usage information. 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 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 188 public static final String ACTION_USAGE_ACCESS_SETTINGS = 189 "android.settings.USAGE_ACCESS_SETTINGS"; 190 191 /** 192 * Activity Category: Show application settings related to usage access. 193 * <p> 194 * An activity that provides a user interface for adjusting usage access related 195 * preferences for its containing application. Optional but recommended for apps that 196 * use {@link android.Manifest.permission#PACKAGE_USAGE_STATS}. 197 * <p> 198 * The activity may define meta-data to describe what usage access is 199 * used for within their app with {@link #METADATA_USAGE_ACCESS_REASON}, which 200 * will be displayed in Settings. 201 * <p> 202 * Input: Nothing. 203 * <p> 204 * Output: Nothing. 205 */ 206 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 207 public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG = 208 "android.intent.category.USAGE_ACCESS_CONFIG"; 209 210 /** 211 * Metadata key: Reason for needing usage access. 212 * <p> 213 * A key for metadata attached to an activity that receives action 214 * {@link #INTENT_CATEGORY_USAGE_ACCESS_CONFIG}, shown to the 215 * user as description of how the app uses usage access. 216 * <p> 217 */ 218 public static final String METADATA_USAGE_ACCESS_REASON = 219 "android.settings.metadata.USAGE_ACCESS_REASON"; 220 221 /** 222 * Activity Action: Show settings to allow configuration of security and 223 * location privacy. 224 * <p> 225 * In some cases, a matching Activity may not exist, so ensure you 226 * safeguard against this. 227 * <p> 228 * Input: Nothing. 229 * <p> 230 * Output: Nothing. 231 */ 232 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 233 public static final String ACTION_SECURITY_SETTINGS = 234 "android.settings.SECURITY_SETTINGS"; 235 236 /** 237 * Activity Action: Show trusted credentials settings, opening to the user tab, 238 * to allow management of installed credentials. 239 * <p> 240 * In some cases, a matching Activity may not exist, so ensure you 241 * safeguard against this. 242 * <p> 243 * Input: Nothing. 244 * <p> 245 * Output: Nothing. 246 * @hide 247 */ 248 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 249 public static final String ACTION_TRUSTED_CREDENTIALS_USER = 250 "com.android.settings.TRUSTED_CREDENTIALS_USER"; 251 252 /** 253 * Activity Action: Show dialog explaining that an installed CA cert may enable 254 * monitoring of encrypted network traffic. 255 * <p> 256 * In some cases, a matching Activity may not exist, so ensure you 257 * safeguard against this. 258 * <p> 259 * Input: Nothing. 260 * <p> 261 * Output: Nothing. 262 * @hide 263 */ 264 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 265 public static final String ACTION_MONITORING_CERT_INFO = 266 "com.android.settings.MONITORING_CERT_INFO"; 267 268 /** 269 * Activity Action: Show settings to allow configuration of privacy options. 270 * <p> 271 * In some cases, a matching Activity may not exist, so ensure you 272 * safeguard against this. 273 * <p> 274 * Input: Nothing. 275 * <p> 276 * Output: Nothing. 277 */ 278 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 279 public static final String ACTION_PRIVACY_SETTINGS = 280 "android.settings.PRIVACY_SETTINGS"; 281 282 /** 283 * Activity Action: Show settings to allow configuration of Wi-Fi. 284 * <p> 285 * In some cases, a matching Activity may not exist, so ensure you 286 * safeguard against this. 287 * <p> 288 * Input: Nothing. 289 * <p> 290 * Output: Nothing. 291 292 */ 293 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 294 public static final String ACTION_WIFI_SETTINGS = 295 "android.settings.WIFI_SETTINGS"; 296 297 /** 298 * Activity Action: Show settings to allow configuration of a static IP 299 * address for Wi-Fi. 300 * <p> 301 * In some cases, a matching Activity may not exist, so ensure you safeguard 302 * against this. 303 * <p> 304 * Input: Nothing. 305 * <p> 306 * Output: Nothing. 307 */ 308 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 309 public static final String ACTION_WIFI_IP_SETTINGS = 310 "android.settings.WIFI_IP_SETTINGS"; 311 312 /** 313 * Activity Action: Show settings to allow configuration of Bluetooth. 314 * <p> 315 * In some cases, a matching Activity may not exist, so ensure you 316 * safeguard against this. 317 * <p> 318 * Input: Nothing. 319 * <p> 320 * Output: Nothing. 321 */ 322 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 323 public static final String ACTION_BLUETOOTH_SETTINGS = 324 "android.settings.BLUETOOTH_SETTINGS"; 325 326 /** 327 * Activity Action: Show settings to allow configuration of cast endpoints. 328 * <p> 329 * In some cases, a matching Activity may not exist, so ensure you 330 * safeguard against this. 331 * <p> 332 * Input: Nothing. 333 * <p> 334 * Output: Nothing. 335 */ 336 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 337 public static final String ACTION_CAST_SETTINGS = 338 "android.settings.CAST_SETTINGS"; 339 340 /** 341 * Activity Action: Show settings to allow configuration of date and time. 342 * <p> 343 * In some cases, a matching Activity may not exist, so ensure you 344 * safeguard against this. 345 * <p> 346 * Input: Nothing. 347 * <p> 348 * Output: Nothing. 349 */ 350 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 351 public static final String ACTION_DATE_SETTINGS = 352 "android.settings.DATE_SETTINGS"; 353 354 /** 355 * Activity Action: Show settings to allow configuration of sound and volume. 356 * <p> 357 * In some cases, a matching Activity may not exist, so ensure you 358 * safeguard against this. 359 * <p> 360 * Input: Nothing. 361 * <p> 362 * Output: Nothing. 363 */ 364 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 365 public static final String ACTION_SOUND_SETTINGS = 366 "android.settings.SOUND_SETTINGS"; 367 368 /** 369 * Activity Action: Show settings to allow configuration of display. 370 * <p> 371 * In some cases, a matching Activity may not exist, so ensure you 372 * safeguard against this. 373 * <p> 374 * Input: Nothing. 375 * <p> 376 * Output: Nothing. 377 */ 378 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 379 public static final String ACTION_DISPLAY_SETTINGS = 380 "android.settings.DISPLAY_SETTINGS"; 381 382 /** 383 * Activity Action: Show settings to allow configuration of locale. 384 * <p> 385 * In some cases, a matching Activity may not exist, so ensure you 386 * safeguard against this. 387 * <p> 388 * Input: Nothing. 389 * <p> 390 * Output: Nothing. 391 */ 392 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 393 public static final String ACTION_LOCALE_SETTINGS = 394 "android.settings.LOCALE_SETTINGS"; 395 396 /** 397 * Activity Action: Show settings to configure input methods, in particular 398 * allowing the user to enable input methods. 399 * <p> 400 * In some cases, a matching Activity may not exist, so ensure you 401 * safeguard against this. 402 * <p> 403 * Input: Nothing. 404 * <p> 405 * Output: Nothing. 406 */ 407 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 408 public static final String ACTION_VOICE_INPUT_SETTINGS = 409 "android.settings.VOICE_INPUT_SETTINGS"; 410 411 /** 412 * Activity Action: Show settings to configure input methods, in particular 413 * allowing the user to enable input methods. 414 * <p> 415 * In some cases, a matching Activity may not exist, so ensure you 416 * safeguard against this. 417 * <p> 418 * Input: Nothing. 419 * <p> 420 * Output: Nothing. 421 */ 422 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 423 public static final String ACTION_INPUT_METHOD_SETTINGS = 424 "android.settings.INPUT_METHOD_SETTINGS"; 425 426 /** 427 * Activity Action: Show settings to enable/disable input method subtypes. 428 * <p> 429 * In some cases, a matching Activity may not exist, so ensure you 430 * safeguard against this. 431 * <p> 432 * To tell which input method's subtypes are displayed in the settings, add 433 * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id. 434 * If there is no extra in this Intent, subtypes from all installed input methods 435 * will be displayed in the settings. 436 * 437 * @see android.view.inputmethod.InputMethodInfo#getId 438 * <p> 439 * Input: Nothing. 440 * <p> 441 * Output: Nothing. 442 */ 443 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 444 public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = 445 "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"; 446 447 /** 448 * Activity Action: Show a dialog to select input method. 449 * <p> 450 * In some cases, a matching Activity may not exist, so ensure you 451 * safeguard against this. 452 * <p> 453 * Input: Nothing. 454 * <p> 455 * Output: Nothing. 456 * @hide 457 */ 458 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 459 public static final String ACTION_SHOW_INPUT_METHOD_PICKER = 460 "android.settings.SHOW_INPUT_METHOD_PICKER"; 461 462 /** 463 * Activity Action: Show settings to manage the user input dictionary. 464 * <p> 465 * Starting with {@link android.os.Build.VERSION_CODES#KITKAT}, 466 * it is guaranteed there will always be an appropriate implementation for this Intent action. 467 * In prior releases of the platform this was optional, so ensure you safeguard against it. 468 * <p> 469 * Input: Nothing. 470 * <p> 471 * Output: Nothing. 472 */ 473 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 474 public static final String ACTION_USER_DICTIONARY_SETTINGS = 475 "android.settings.USER_DICTIONARY_SETTINGS"; 476 477 /** 478 * Activity Action: Adds a word to the user dictionary. 479 * <p> 480 * In some cases, a matching Activity may not exist, so ensure you 481 * safeguard against this. 482 * <p> 483 * Input: An extra with key <code>word</code> that contains the word 484 * that should be added to the dictionary. 485 * <p> 486 * Output: Nothing. 487 * 488 * @hide 489 */ 490 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 491 public static final String ACTION_USER_DICTIONARY_INSERT = 492 "com.android.settings.USER_DICTIONARY_INSERT"; 493 494 /** 495 * Activity Action: Show settings to allow configuration of application-related settings. 496 * <p> 497 * In some cases, a matching Activity may not exist, so ensure you 498 * safeguard against this. 499 * <p> 500 * Input: Nothing. 501 * <p> 502 * Output: Nothing. 503 */ 504 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 505 public static final String ACTION_APPLICATION_SETTINGS = 506 "android.settings.APPLICATION_SETTINGS"; 507 508 /** 509 * Activity Action: Show settings to allow configuration of application 510 * development-related settings. As of 511 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is 512 * a required part of the platform. 513 * <p> 514 * Input: Nothing. 515 * <p> 516 * Output: Nothing. 517 */ 518 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 519 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = 520 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"; 521 522 /** 523 * Activity Action: Show settings to allow configuration of quick launch shortcuts. 524 * <p> 525 * In some cases, a matching Activity may not exist, so ensure you 526 * safeguard against this. 527 * <p> 528 * Input: Nothing. 529 * <p> 530 * Output: Nothing. 531 */ 532 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 533 public static final String ACTION_QUICK_LAUNCH_SETTINGS = 534 "android.settings.QUICK_LAUNCH_SETTINGS"; 535 536 /** 537 * Activity Action: Show settings to manage installed applications. 538 * <p> 539 * In some cases, a matching Activity may not exist, so ensure you 540 * safeguard against this. 541 * <p> 542 * Input: Nothing. 543 * <p> 544 * Output: Nothing. 545 */ 546 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 547 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = 548 "android.settings.MANAGE_APPLICATIONS_SETTINGS"; 549 550 /** 551 * Activity Action: Show settings to manage all applications. 552 * <p> 553 * In some cases, a matching Activity may not exist, so ensure you 554 * safeguard against this. 555 * <p> 556 * Input: Nothing. 557 * <p> 558 * Output: Nothing. 559 */ 560 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 561 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = 562 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"; 563 564 /** 565 * Activity Action: Show screen of details about a particular application. 566 * <p> 567 * In some cases, a matching Activity may not exist, so ensure you 568 * safeguard against this. 569 * <p> 570 * Input: The Intent's data URI specifies the application package name 571 * to be shown, with the "package" scheme. That is "package:com.my.app". 572 * <p> 573 * Output: Nothing. 574 */ 575 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 576 public static final String ACTION_APPLICATION_DETAILS_SETTINGS = 577 "android.settings.APPLICATION_DETAILS_SETTINGS"; 578 579 /** 580 * @hide 581 * Activity Action: Show the "app ops" settings screen. 582 * <p> 583 * Input: Nothing. 584 * <p> 585 * Output: Nothing. 586 */ 587 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 588 public static final String ACTION_APP_OPS_SETTINGS = 589 "android.settings.APP_OPS_SETTINGS"; 590 591 /** 592 * Activity Action: Show settings for system update functionality. 593 * <p> 594 * In some cases, a matching Activity may not exist, so ensure you 595 * safeguard against this. 596 * <p> 597 * Input: Nothing. 598 * <p> 599 * Output: Nothing. 600 * 601 * @hide 602 */ 603 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 604 public static final String ACTION_SYSTEM_UPDATE_SETTINGS = 605 "android.settings.SYSTEM_UPDATE_SETTINGS"; 606 607 /** 608 * Activity Action: Show settings to allow configuration of sync settings. 609 * <p> 610 * In some cases, a matching Activity may not exist, so ensure you 611 * safeguard against this. 612 * <p> 613 * The account types available to add via the add account button may be restricted by adding an 614 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's 615 * authorities. Only account types which can sync with that content provider will be offered to 616 * the user. 617 * <p> 618 * Input: Nothing. 619 * <p> 620 * Output: Nothing. 621 */ 622 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 623 public static final String ACTION_SYNC_SETTINGS = 624 "android.settings.SYNC_SETTINGS"; 625 626 /** 627 * Activity Action: Show add account screen for creating a new account. 628 * <p> 629 * In some cases, a matching Activity may not exist, so ensure you 630 * safeguard against this. 631 * <p> 632 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES} 633 * extra to the Intent with one or more syncable content provider's authorities. Only account 634 * types which can sync with that content provider will be offered to the user. 635 * <p> 636 * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the 637 * Intent with one or more account types. 638 * <p> 639 * Input: Nothing. 640 * <p> 641 * Output: Nothing. 642 */ 643 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 644 public static final String ACTION_ADD_ACCOUNT = 645 "android.settings.ADD_ACCOUNT_SETTINGS"; 646 647 /** 648 * Activity Action: Show settings for selecting the network operator. 649 * <p> 650 * In some cases, a matching Activity may not exist, so ensure you 651 * safeguard against this. 652 * <p> 653 * Input: Nothing. 654 * <p> 655 * Output: Nothing. 656 */ 657 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 658 public static final String ACTION_NETWORK_OPERATOR_SETTINGS = 659 "android.settings.NETWORK_OPERATOR_SETTINGS"; 660 661 /** 662 * Activity Action: Show settings for selection of 2G/3G. 663 * <p> 664 * In some cases, a matching Activity may not exist, so ensure you 665 * safeguard against this. 666 * <p> 667 * Input: Nothing. 668 * <p> 669 * Output: Nothing. 670 */ 671 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 672 public static final String ACTION_DATA_ROAMING_SETTINGS = 673 "android.settings.DATA_ROAMING_SETTINGS"; 674 675 /** 676 * Activity Action: Show settings for internal storage. 677 * <p> 678 * In some cases, a matching Activity may not exist, so ensure you 679 * safeguard against this. 680 * <p> 681 * Input: Nothing. 682 * <p> 683 * Output: Nothing. 684 */ 685 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 686 public static final String ACTION_INTERNAL_STORAGE_SETTINGS = 687 "android.settings.INTERNAL_STORAGE_SETTINGS"; 688 /** 689 * Activity Action: Show settings for memory card storage. 690 * <p> 691 * In some cases, a matching Activity may not exist, so ensure you 692 * safeguard against this. 693 * <p> 694 * Input: Nothing. 695 * <p> 696 * Output: Nothing. 697 */ 698 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 699 public static final String ACTION_MEMORY_CARD_SETTINGS = 700 "android.settings.MEMORY_CARD_SETTINGS"; 701 702 /** 703 * Activity Action: Show settings for global search. 704 * <p> 705 * In some cases, a matching Activity may not exist, so ensure you 706 * safeguard against this. 707 * <p> 708 * Input: Nothing. 709 * <p> 710 * Output: Nothing 711 */ 712 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 713 public static final String ACTION_SEARCH_SETTINGS = 714 "android.search.action.SEARCH_SETTINGS"; 715 716 /** 717 * Activity Action: Show general device information settings (serial 718 * number, software version, phone number, etc.). 719 * <p> 720 * In some cases, a matching Activity may not exist, so ensure you 721 * safeguard against this. 722 * <p> 723 * Input: Nothing. 724 * <p> 725 * Output: Nothing 726 */ 727 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 728 public static final String ACTION_DEVICE_INFO_SETTINGS = 729 "android.settings.DEVICE_INFO_SETTINGS"; 730 731 /** 732 * Activity Action: Show NFC settings. 733 * <p> 734 * This shows UI that allows NFC to be turned on or off. 735 * <p> 736 * In some cases, a matching Activity may not exist, so ensure you 737 * safeguard against this. 738 * <p> 739 * Input: Nothing. 740 * <p> 741 * Output: Nothing 742 * @see android.nfc.NfcAdapter#isEnabled() 743 */ 744 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 745 public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS"; 746 747 /** 748 * Activity Action: Show NFC Sharing settings. 749 * <p> 750 * This shows UI that allows NDEF Push (Android Beam) to be turned on or 751 * off. 752 * <p> 753 * In some cases, a matching Activity may not exist, so ensure you 754 * safeguard against this. 755 * <p> 756 * Input: Nothing. 757 * <p> 758 * Output: Nothing 759 * @see android.nfc.NfcAdapter#isNdefPushEnabled() 760 */ 761 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 762 public static final String ACTION_NFCSHARING_SETTINGS = 763 "android.settings.NFCSHARING_SETTINGS"; 764 765 /** 766 * Activity Action: Show NFC Tap & Pay settings 767 * <p> 768 * This shows UI that allows the user to configure Tap&Pay 769 * settings. 770 * <p> 771 * In some cases, a matching Activity may not exist, so ensure you 772 * safeguard against this. 773 * <p> 774 * Input: Nothing. 775 * <p> 776 * Output: Nothing 777 */ 778 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 779 public static final String ACTION_NFC_PAYMENT_SETTINGS = 780 "android.settings.NFC_PAYMENT_SETTINGS"; 781 782 /** 783 * Activity Action: Show Daydream settings. 784 * <p> 785 * In some cases, a matching Activity may not exist, so ensure you 786 * safeguard against this. 787 * <p> 788 * Input: Nothing. 789 * <p> 790 * Output: Nothing. 791 * @see android.service.dreams.DreamService 792 */ 793 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 794 public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS"; 795 796 /** 797 * Activity Action: Show Notification listener settings. 798 * <p> 799 * In some cases, a matching Activity may not exist, so ensure you 800 * safeguard against this. 801 * <p> 802 * Input: Nothing. 803 * <p> 804 * Output: Nothing. 805 * @see android.service.notification.NotificationListenerService 806 */ 807 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 808 public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS 809 = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"; 810 811 /** 812 * Activity Action: Show Do Not Disturb access settings. 813 * <p> 814 * Users can grant and deny access to Do Not Disturb configuration from here. 815 * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more 816 * details. 817 * <p> 818 * Input: Nothing. 819 * <p> 820 * Output: Nothing. 821 */ 822 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 823 public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS 824 = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"; 825 826 /** 827 * @hide 828 */ 829 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 830 public static final String ACTION_CONDITION_PROVIDER_SETTINGS 831 = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS"; 832 833 /** 834 * Activity Action: Show settings for video captioning. 835 * <p> 836 * In some cases, a matching Activity may not exist, so ensure you safeguard 837 * against this. 838 * <p> 839 * Input: Nothing. 840 * <p> 841 * Output: Nothing. 842 */ 843 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 844 public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS"; 845 846 /** 847 * Activity Action: Show the top level print settings. 848 * <p> 849 * In some cases, a matching Activity may not exist, so ensure you 850 * safeguard against this. 851 * <p> 852 * Input: Nothing. 853 * <p> 854 * Output: Nothing. 855 */ 856 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 857 public static final String ACTION_PRINT_SETTINGS = 858 "android.settings.ACTION_PRINT_SETTINGS"; 859 860 /** 861 * Activity Action: Show Zen Mode configuration settings. 862 * 863 * @hide 864 */ 865 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 866 public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; 867 868 /** 869 * Activity Action: Show Zen Mode priority configuration settings. 870 * 871 * @hide 872 */ 873 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 874 public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS 875 = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"; 876 877 /** 878 * Activity Action: Show Zen Mode automation configuration settings. 879 * 880 * @hide 881 */ 882 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 883 public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS 884 = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS"; 885 886 /** 887 * Activity Action: Modify do not disturb mode settings. 888 * <p> 889 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 890 * <p> 891 * This intent MUST be started using 892 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 893 * startVoiceActivity}. 894 * <p> 895 * Note: The Activity implementing this intent MUST verify that 896 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}. 897 * returns true before modifying the setting. 898 * <p> 899 * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate 900 * how long the user wishes to avoid interruptions for. The optional 901 * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is 902 * enabling or disabling do not disturb mode. If either extra is not included, the 903 * user maybe asked to provide the value. 904 * <p> 905 * Output: Nothing. 906 */ 907 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 908 public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE = 909 "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE"; 910 911 /** 912 * Activity Action: Show Zen Mode schedule rule configuration settings. 913 * 914 * @hide 915 */ 916 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 917 public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS 918 = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS"; 919 920 /** 921 * Activity Action: Show Zen Mode event rule configuration settings. 922 * 923 * @hide 924 */ 925 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 926 public static final String ACTION_ZEN_MODE_EVENT_RULE_SETTINGS 927 = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS"; 928 929 /** 930 * Activity Action: Show Zen Mode external rule configuration settings. 931 * 932 * @hide 933 */ 934 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 935 public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS 936 = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS"; 937 938 /** 939 * Activity Action: Show the regulatory information screen for the device. 940 * <p> 941 * In some cases, a matching Activity may not exist, so ensure you safeguard 942 * against this. 943 * <p> 944 * Input: Nothing. 945 * <p> 946 * Output: Nothing. 947 */ 948 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 949 public static final String 950 ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO"; 951 952 /** 953 * Activity Action: Show Device Name Settings. 954 * <p> 955 * In some cases, a matching Activity may not exist, so ensure you safeguard 956 * against this. 957 * 958 * @hide 959 */ 960 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 961 public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME"; 962 963 /** 964 * Activity Action: Show pairing settings. 965 * <p> 966 * In some cases, a matching Activity may not exist, so ensure you safeguard 967 * against this. 968 * 969 * @hide 970 */ 971 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 972 public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS"; 973 974 /** 975 * Activity Action: Show battery saver settings. 976 * <p> 977 * In some cases, a matching Activity may not exist, so ensure you safeguard 978 * against this. 979 */ 980 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 981 public static final String ACTION_BATTERY_SAVER_SETTINGS 982 = "android.settings.BATTERY_SAVER_SETTINGS"; 983 984 /** 985 * Activity Action: Modify Battery Saver mode setting using a voice command. 986 * <p> 987 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 988 * <p> 989 * This intent MUST be started using 990 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 991 * startVoiceActivity}. 992 * <p> 993 * Note: The activity implementing this intent MUST verify that 994 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before 995 * modifying the setting. 996 * <p> 997 * Input: To tell which state batter saver mode should be set to, add the 998 * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified. 999 * If the extra is not included, no changes will be made. 1000 * <p> 1001 * Output: Nothing. 1002 */ 1003 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1004 public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE = 1005 "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE"; 1006 1007 /** 1008 * Activity Action: Show Home selection settings. If there are multiple activities 1009 * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you 1010 * to pick your preferred activity. 1011 */ 1012 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1013 public static final String ACTION_HOME_SETTINGS 1014 = "android.settings.HOME_SETTINGS"; 1015 1016 /** 1017 * Activity Action: Show notification settings. 1018 * 1019 * @hide 1020 */ 1021 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1022 public static final String ACTION_NOTIFICATION_SETTINGS 1023 = "android.settings.NOTIFICATION_SETTINGS"; 1024 1025 /** 1026 * Activity Action: Show notification settings for a single app. 1027 * 1028 * @hide 1029 */ 1030 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1031 public static final String ACTION_APP_NOTIFICATION_SETTINGS 1032 = "android.settings.APP_NOTIFICATION_SETTINGS"; 1033 1034 /** 1035 * Activity Action: Show notification redaction settings. 1036 * 1037 * @hide 1038 */ 1039 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1040 public static final String ACTION_APP_NOTIFICATION_REDACTION 1041 = "android.settings.ACTION_APP_NOTIFICATION_REDACTION"; 1042 1043 /** @hide */ public static final String EXTRA_APP_UID = "app_uid"; 1044 /** @hide */ public static final String EXTRA_APP_PACKAGE = "app_package"; 1045 1046 // End of Intent actions for Settings 1047 1048 /** 1049 * @hide - Private call() method on SettingsProvider to read from 'system' table. 1050 */ 1051 public static final String CALL_METHOD_GET_SYSTEM = "GET_system"; 1052 1053 /** 1054 * @hide - Private call() method on SettingsProvider to read from 'secure' table. 1055 */ 1056 public static final String CALL_METHOD_GET_SECURE = "GET_secure"; 1057 1058 /** 1059 * @hide - Private call() method on SettingsProvider to read from 'global' table. 1060 */ 1061 public static final String CALL_METHOD_GET_GLOBAL = "GET_global"; 1062 1063 /** 1064 * @hide - User handle argument extra to the fast-path call()-based requests 1065 */ 1066 public static final String CALL_METHOD_USER_KEY = "_user"; 1067 1068 /** @hide - Private call() method to write to 'system' table */ 1069 public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system"; 1070 1071 /** @hide - Private call() method to write to 'secure' table */ 1072 public static final String CALL_METHOD_PUT_SECURE = "PUT_secure"; 1073 1074 /** @hide - Private call() method to write to 'global' table */ 1075 public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global"; 1076 1077 /** 1078 * Activity Extra: Limit available options in launched activity based on the given authority. 1079 * <p> 1080 * This can be passed as an extra field in an Activity Intent with one or more syncable content 1081 * provider's authorities as a String[]. This field is used by some intents to alter the 1082 * behavior of the called activity. 1083 * <p> 1084 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based 1085 * on the authority given. 1086 */ 1087 public static final String EXTRA_AUTHORITIES = "authorities"; 1088 1089 /** 1090 * Activity Extra: Limit available options in launched activity based on the given account 1091 * types. 1092 * <p> 1093 * This can be passed as an extra field in an Activity Intent with one or more account types 1094 * as a String[]. This field is used by some intents to alter the behavior of the called 1095 * activity. 1096 * <p> 1097 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified 1098 * list. 1099 */ 1100 public static final String EXTRA_ACCOUNT_TYPES = "account_types"; 1101 1102 public static final String EXTRA_INPUT_METHOD_ID = "input_method_id"; 1103 1104 /** 1105 * Activity Extra: The device identifier to act upon. 1106 * <p> 1107 * This can be passed as an extra field in an Activity Intent with a single 1108 * InputDeviceIdentifier. This field is used by some activities to jump straight into the 1109 * settings for the given device. 1110 * <p> 1111 * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout 1112 * dialog for the given device. 1113 * @hide 1114 */ 1115 public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier"; 1116 1117 /** 1118 * Activity Extra: Enable or disable Airplane Mode. 1119 * <p> 1120 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE} 1121 * intent as a boolean to indicate if it should be enabled. 1122 */ 1123 public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled"; 1124 1125 /** 1126 * Activity Extra: Enable or disable Battery saver mode. 1127 * <p> 1128 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE} 1129 * intent as a boolean to indicate if it should be enabled. 1130 */ 1131 public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED = 1132 "android.settings.extra.battery_saver_mode_enabled"; 1133 1134 /** 1135 * Activity Extra: Enable or disable Do Not Disturb mode. 1136 * <p> 1137 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE} 1138 * intent as a boolean to indicate if it should be enabled. 1139 */ 1140 public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = 1141 "android.settings.extra.do_not_disturb_mode_enabled"; 1142 1143 /** 1144 * Activity Extra: How many minutes to enable do not disturb mode for. 1145 * <p> 1146 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE} 1147 * intent to indicate how long do not disturb mode should be enabled for. 1148 */ 1149 public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = 1150 "android.settings.extra.do_not_disturb_mode_minutes"; 1151 1152 private static final String JID_RESOURCE_PREFIX = "android"; 1153 1154 public static final String AUTHORITY = "settings"; 1155 1156 private static final String TAG = "Settings"; 1157 private static final boolean LOCAL_LOGV = false; 1158 1159 // Lock ensures that when enabling/disabling the master location switch, we don't end up 1160 // with a partial enable/disable state in multi-threaded situations. 1161 private static final Object mLocationSettingsLock = new Object(); 1162 1163 public static class SettingNotFoundException extends AndroidException { 1164 public SettingNotFoundException(String msg) { 1165 super(msg); 1166 } 1167 } 1168 1169 /** 1170 * Common base for tables of name/value settings. 1171 */ 1172 public static class NameValueTable implements BaseColumns { 1173 public static final String NAME = "name"; 1174 public static final String VALUE = "value"; 1175 1176 protected static boolean putString(ContentResolver resolver, Uri uri, 1177 String name, String value) { 1178 // The database will take care of replacing duplicates. 1179 try { 1180 ContentValues values = new ContentValues(); 1181 values.put(NAME, name); 1182 values.put(VALUE, value); 1183 resolver.insert(uri, values); 1184 return true; 1185 } catch (SQLException e) { 1186 Log.w(TAG, "Can't set key " + name + " in " + uri, e); 1187 return false; 1188 } 1189 } 1190 1191 public static Uri getUriFor(Uri uri, String name) { 1192 return Uri.withAppendedPath(uri, name); 1193 } 1194 } 1195 1196 // Thread-safe. 1197 private static class NameValueCache { 1198 private final String mVersionSystemProperty; 1199 private final Uri mUri; 1200 1201 private static final String[] SELECT_VALUE = 1202 new String[] { Settings.NameValueTable.VALUE }; 1203 private static final String NAME_EQ_PLACEHOLDER = "name=?"; 1204 1205 // Must synchronize on 'this' to access mValues and mValuesVersion. 1206 private final HashMap<String, String> mValues = new HashMap<String, String>(); 1207 private long mValuesVersion = 0; 1208 1209 // Initially null; set lazily and held forever. Synchronized on 'this'. 1210 private IContentProvider mContentProvider = null; 1211 1212 // The method we'll call (or null, to not use) on the provider 1213 // for the fast path of retrieving settings. 1214 private final String mCallGetCommand; 1215 private final String mCallSetCommand; 1216 1217 public NameValueCache(String versionSystemProperty, Uri uri, 1218 String getCommand, String setCommand) { 1219 mVersionSystemProperty = versionSystemProperty; 1220 mUri = uri; 1221 mCallGetCommand = getCommand; 1222 mCallSetCommand = setCommand; 1223 } 1224 1225 private IContentProvider lazyGetProvider(ContentResolver cr) { 1226 IContentProvider cp = null; 1227 synchronized (this) { 1228 cp = mContentProvider; 1229 if (cp == null) { 1230 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority()); 1231 } 1232 } 1233 return cp; 1234 } 1235 1236 public boolean putStringForUser(ContentResolver cr, String name, String value, 1237 final int userHandle) { 1238 try { 1239 Bundle arg = new Bundle(); 1240 arg.putString(Settings.NameValueTable.VALUE, value); 1241 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 1242 IContentProvider cp = lazyGetProvider(cr); 1243 cp.call(cr.getPackageName(), mCallSetCommand, name, arg); 1244 } catch (RemoteException e) { 1245 Log.w(TAG, "Can't set key " + name + " in " + mUri, e); 1246 return false; 1247 } 1248 return true; 1249 } 1250 1251 public String getStringForUser(ContentResolver cr, String name, final int userHandle) { 1252 final boolean isSelf = (userHandle == UserHandle.myUserId()); 1253 if (isSelf) { 1254 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0); 1255 1256 // Our own user's settings data uses a client-side cache 1257 synchronized (this) { 1258 if (mValuesVersion != newValuesVersion) { 1259 if (LOCAL_LOGV || false) { 1260 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " 1261 + newValuesVersion + " != cached " + mValuesVersion); 1262 } 1263 1264 mValues.clear(); 1265 mValuesVersion = newValuesVersion; 1266 } 1267 1268 if (mValues.containsKey(name)) { 1269 return mValues.get(name); // Could be null, that's OK -- negative caching 1270 } 1271 } 1272 } else { 1273 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle 1274 + " by user " + UserHandle.myUserId() + " so skipping cache"); 1275 } 1276 1277 IContentProvider cp = lazyGetProvider(cr); 1278 1279 // Try the fast path first, not using query(). If this 1280 // fails (alternate Settings provider that doesn't support 1281 // this interface?) then we fall back to the query/table 1282 // interface. 1283 if (mCallGetCommand != null) { 1284 try { 1285 Bundle args = null; 1286 if (!isSelf) { 1287 args = new Bundle(); 1288 args.putInt(CALL_METHOD_USER_KEY, userHandle); 1289 } 1290 Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args); 1291 if (b != null) { 1292 String value = b.getPairValue(); 1293 // Don't update our cache for reads of other users' data 1294 if (isSelf) { 1295 synchronized (this) { 1296 mValues.put(name, value); 1297 } 1298 } else { 1299 if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle 1300 + " by " + UserHandle.myUserId() 1301 + " so not updating cache"); 1302 } 1303 return value; 1304 } 1305 // If the response Bundle is null, we fall through 1306 // to the query interface below. 1307 } catch (RemoteException e) { 1308 // Not supported by the remote side? Fall through 1309 // to query(). 1310 } 1311 } 1312 1313 Cursor c = null; 1314 try { 1315 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER, 1316 new String[]{name}, null, null); 1317 if (c == null) { 1318 Log.w(TAG, "Can't get key " + name + " from " + mUri); 1319 return null; 1320 } 1321 1322 String value = c.moveToNext() ? c.getString(0) : null; 1323 synchronized (this) { 1324 mValues.put(name, value); 1325 } 1326 if (LOCAL_LOGV) { 1327 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " + 1328 name + " = " + (value == null ? "(null)" : value)); 1329 } 1330 return value; 1331 } catch (RemoteException e) { 1332 Log.w(TAG, "Can't get key " + name + " from " + mUri, e); 1333 return null; // Return null, but don't cache it. 1334 } finally { 1335 if (c != null) c.close(); 1336 } 1337 } 1338 } 1339 1340 /** 1341 * System settings, containing miscellaneous system preferences. This 1342 * table holds simple name/value pairs. There are convenience 1343 * functions for accessing individual settings entries. 1344 */ 1345 public static final class System extends NameValueTable { 1346 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; 1347 1348 /** @hide */ 1349 public static interface Validator { 1350 public boolean validate(String value); 1351 } 1352 1353 /** 1354 * The content:// style URL for this table 1355 */ 1356 public static final Uri CONTENT_URI = 1357 Uri.parse("content://" + AUTHORITY + "/system"); 1358 1359 private static final NameValueCache sNameValueCache = new NameValueCache( 1360 SYS_PROP_SETTING_VERSION, 1361 CONTENT_URI, 1362 CALL_METHOD_GET_SYSTEM, 1363 CALL_METHOD_PUT_SYSTEM); 1364 1365 private static final HashSet<String> MOVED_TO_SECURE; 1366 static { 1367 MOVED_TO_SECURE = new HashSet<String>(30); 1368 MOVED_TO_SECURE.add(Secure.ANDROID_ID); 1369 MOVED_TO_SECURE.add(Secure.HTTP_PROXY); 1370 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED); 1371 MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS); 1372 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED); 1373 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE); 1374 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 1375 MOVED_TO_SECURE.add(Secure.LOGGING_ID); 1376 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED); 1377 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE); 1378 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL); 1379 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME); 1380 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL); 1381 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 1382 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 1383 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT); 1384 MOVED_TO_SECURE.add(Secure.WIFI_ON); 1385 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE); 1386 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT); 1387 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS); 1388 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED); 1389 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS); 1390 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT); 1391 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS); 1392 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON); 1393 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT); 1394 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS); 1395 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); 1396 1397 // At one time in System, then Global, but now back in Secure 1398 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); 1399 } 1400 1401 private static final HashSet<String> MOVED_TO_GLOBAL; 1402 private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL; 1403 static { 1404 MOVED_TO_GLOBAL = new HashSet<String>(); 1405 MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>(); 1406 1407 // these were originally in system but migrated to secure in the past, 1408 // so are duplicated in the Secure.* namespace 1409 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED); 1410 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); 1411 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); 1412 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); 1413 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); 1414 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); 1415 1416 // these are moving directly from system to global 1417 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON); 1418 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS); 1419 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); 1420 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME); 1421 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE); 1422 MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND); 1423 MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND); 1424 MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND); 1425 MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND); 1426 MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED); 1427 MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND); 1428 MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND); 1429 MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND); 1430 MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED); 1431 MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN); 1432 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY); 1433 MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER); 1434 MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE); 1435 MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE); 1436 MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE); 1437 MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS); 1438 MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE); 1439 MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE); 1440 MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY); 1441 MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP); 1442 MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER); 1443 MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES); 1444 MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES); 1445 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL); 1446 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL); 1447 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL); 1448 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL); 1449 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL); 1450 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL); 1451 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL); 1452 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL); 1453 } 1454 1455 private static final Validator sBooleanValidator = 1456 new DiscreteValueValidator(new String[] {"0", "1"}); 1457 1458 private static final Validator sNonNegativeIntegerValidator = new Validator() { 1459 @Override 1460 public boolean validate(String value) { 1461 try { 1462 return Integer.parseInt(value) >= 0; 1463 } catch (NumberFormatException e) { 1464 return false; 1465 } 1466 } 1467 }; 1468 1469 private static final Validator sUriValidator = new Validator() { 1470 @Override 1471 public boolean validate(String value) { 1472 try { 1473 Uri.decode(value); 1474 return true; 1475 } catch (IllegalArgumentException e) { 1476 return false; 1477 } 1478 } 1479 }; 1480 1481 private static final Validator sLenientIpAddressValidator = new Validator() { 1482 private static final int MAX_IPV6_LENGTH = 45; 1483 1484 @Override 1485 public boolean validate(String value) { 1486 return value.length() <= MAX_IPV6_LENGTH; 1487 } 1488 }; 1489 1490 /** @hide */ 1491 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 1492 outKeySet.addAll(MOVED_TO_GLOBAL); 1493 outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL); 1494 } 1495 1496 /** @hide */ 1497 public static void getMovedToSecureSettings(Set<String> outKeySet) { 1498 outKeySet.addAll(MOVED_TO_SECURE); 1499 } 1500 1501 /** @hide */ 1502 public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) { 1503 outKeySet.addAll(MOVED_TO_GLOBAL); 1504 } 1505 1506 /** 1507 * Look up a name in the database. 1508 * @param resolver to access the database with 1509 * @param name to look up in the table 1510 * @return the corresponding value, or null if not present 1511 */ 1512 public static String getString(ContentResolver resolver, String name) { 1513 return getStringForUser(resolver, name, UserHandle.myUserId()); 1514 } 1515 1516 /** @hide */ 1517 public static String getStringForUser(ContentResolver resolver, String name, 1518 int userHandle) { 1519 if (MOVED_TO_SECURE.contains(name)) { 1520 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1521 + " to android.provider.Settings.Secure, returning read-only value."); 1522 return Secure.getStringForUser(resolver, name, userHandle); 1523 } 1524 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1525 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1526 + " to android.provider.Settings.Global, returning read-only value."); 1527 return Global.getStringForUser(resolver, name, userHandle); 1528 } 1529 return sNameValueCache.getStringForUser(resolver, name, userHandle); 1530 } 1531 1532 /** 1533 * Store a name/value pair into the database. 1534 * @param resolver to access the database with 1535 * @param name to store 1536 * @param value to associate with the name 1537 * @return true if the value was set, false on database errors 1538 */ 1539 public static boolean putString(ContentResolver resolver, String name, String value) { 1540 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 1541 } 1542 1543 /** @hide */ 1544 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 1545 int userHandle) { 1546 if (MOVED_TO_SECURE.contains(name)) { 1547 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1548 + " to android.provider.Settings.Secure, value is unchanged."); 1549 return false; 1550 } 1551 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1552 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1553 + " to android.provider.Settings.Global, value is unchanged."); 1554 return false; 1555 } 1556 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 1557 } 1558 1559 /** 1560 * Construct the content URI for a particular name/value pair, 1561 * useful for monitoring changes with a ContentObserver. 1562 * @param name to look up in the table 1563 * @return the corresponding content URI, or null if not present 1564 */ 1565 public static Uri getUriFor(String name) { 1566 if (MOVED_TO_SECURE.contains(name)) { 1567 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1568 + " to android.provider.Settings.Secure, returning Secure URI."); 1569 return Secure.getUriFor(Secure.CONTENT_URI, name); 1570 } 1571 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 1572 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 1573 + " to android.provider.Settings.Global, returning read-only global URI."); 1574 return Global.getUriFor(Global.CONTENT_URI, name); 1575 } 1576 return getUriFor(CONTENT_URI, name); 1577 } 1578 1579 /** 1580 * Convenience function for retrieving a single system settings value 1581 * as an integer. Note that internally setting values are always 1582 * stored as strings; this function converts the string to an integer 1583 * for you. The default value will be returned if the setting is 1584 * not defined or not an integer. 1585 * 1586 * @param cr The ContentResolver to access. 1587 * @param name The name of the setting to retrieve. 1588 * @param def Value to return if the setting is not defined. 1589 * 1590 * @return The setting's current value, or 'def' if it is not defined 1591 * or not a valid integer. 1592 */ 1593 public static int getInt(ContentResolver cr, String name, int def) { 1594 return getIntForUser(cr, name, def, UserHandle.myUserId()); 1595 } 1596 1597 /** @hide */ 1598 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 1599 String v = getStringForUser(cr, name, userHandle); 1600 try { 1601 return v != null ? Integer.parseInt(v) : def; 1602 } catch (NumberFormatException e) { 1603 return def; 1604 } 1605 } 1606 1607 /** 1608 * Convenience function for retrieving a single system settings value 1609 * as an integer. Note that internally setting values are always 1610 * stored as strings; this function converts the string to an integer 1611 * for you. 1612 * <p> 1613 * This version does not take a default value. If the setting has not 1614 * been set, or the string value is not a number, 1615 * it throws {@link SettingNotFoundException}. 1616 * 1617 * @param cr The ContentResolver to access. 1618 * @param name The name of the setting to retrieve. 1619 * 1620 * @throws SettingNotFoundException Thrown if a setting by the given 1621 * name can't be found or the setting value is not an integer. 1622 * 1623 * @return The setting's current value. 1624 */ 1625 public static int getInt(ContentResolver cr, String name) 1626 throws SettingNotFoundException { 1627 return getIntForUser(cr, name, UserHandle.myUserId()); 1628 } 1629 1630 /** @hide */ 1631 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 1632 throws SettingNotFoundException { 1633 String v = getStringForUser(cr, name, userHandle); 1634 try { 1635 return Integer.parseInt(v); 1636 } catch (NumberFormatException e) { 1637 throw new SettingNotFoundException(name); 1638 } 1639 } 1640 1641 /** 1642 * Convenience function for updating a single settings value as an 1643 * integer. This will either create a new entry in the table if the 1644 * given name does not exist, or modify the value of the existing row 1645 * with that name. Note that internally setting values are always 1646 * stored as strings, so this function converts the given value to a 1647 * string before storing it. 1648 * 1649 * @param cr The ContentResolver to access. 1650 * @param name The name of the setting to modify. 1651 * @param value The new value for the setting. 1652 * @return true if the value was set, false on database errors 1653 */ 1654 public static boolean putInt(ContentResolver cr, String name, int value) { 1655 return putIntForUser(cr, name, value, UserHandle.myUserId()); 1656 } 1657 1658 /** @hide */ 1659 public static boolean putIntForUser(ContentResolver cr, String name, int value, 1660 int userHandle) { 1661 return putStringForUser(cr, name, Integer.toString(value), userHandle); 1662 } 1663 1664 /** 1665 * Convenience function for retrieving a single system settings value 1666 * as a {@code long}. Note that internally setting values are always 1667 * stored as strings; this function converts the string to a {@code long} 1668 * for you. The default value will be returned if the setting is 1669 * not defined or not a {@code long}. 1670 * 1671 * @param cr The ContentResolver to access. 1672 * @param name The name of the setting to retrieve. 1673 * @param def Value to return if the setting is not defined. 1674 * 1675 * @return The setting's current value, or 'def' if it is not defined 1676 * or not a valid {@code long}. 1677 */ 1678 public static long getLong(ContentResolver cr, String name, long def) { 1679 return getLongForUser(cr, name, def, UserHandle.myUserId()); 1680 } 1681 1682 /** @hide */ 1683 public static long getLongForUser(ContentResolver cr, String name, long def, 1684 int userHandle) { 1685 String valString = getStringForUser(cr, name, userHandle); 1686 long value; 1687 try { 1688 value = valString != null ? Long.parseLong(valString) : def; 1689 } catch (NumberFormatException e) { 1690 value = def; 1691 } 1692 return value; 1693 } 1694 1695 /** 1696 * Convenience function for retrieving a single system settings value 1697 * as a {@code long}. Note that internally setting values are always 1698 * stored as strings; this function converts the string to a {@code long} 1699 * for you. 1700 * <p> 1701 * This version does not take a default value. If the setting has not 1702 * been set, or the string value is not a number, 1703 * it throws {@link SettingNotFoundException}. 1704 * 1705 * @param cr The ContentResolver to access. 1706 * @param name The name of the setting to retrieve. 1707 * 1708 * @return The setting's current value. 1709 * @throws SettingNotFoundException Thrown if a setting by the given 1710 * name can't be found or the setting value is not an integer. 1711 */ 1712 public static long getLong(ContentResolver cr, String name) 1713 throws SettingNotFoundException { 1714 return getLongForUser(cr, name, UserHandle.myUserId()); 1715 } 1716 1717 /** @hide */ 1718 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 1719 throws SettingNotFoundException { 1720 String valString = getStringForUser(cr, name, userHandle); 1721 try { 1722 return Long.parseLong(valString); 1723 } catch (NumberFormatException e) { 1724 throw new SettingNotFoundException(name); 1725 } 1726 } 1727 1728 /** 1729 * Convenience function for updating a single settings value as a long 1730 * integer. This will either create a new entry in the table if the 1731 * given name does not exist, or modify the value of the existing row 1732 * with that name. Note that internally setting values are always 1733 * stored as strings, so this function converts the given value to a 1734 * string before storing it. 1735 * 1736 * @param cr The ContentResolver to access. 1737 * @param name The name of the setting to modify. 1738 * @param value The new value for the setting. 1739 * @return true if the value was set, false on database errors 1740 */ 1741 public static boolean putLong(ContentResolver cr, String name, long value) { 1742 return putLongForUser(cr, name, value, UserHandle.myUserId()); 1743 } 1744 1745 /** @hide */ 1746 public static boolean putLongForUser(ContentResolver cr, String name, long value, 1747 int userHandle) { 1748 return putStringForUser(cr, name, Long.toString(value), userHandle); 1749 } 1750 1751 /** 1752 * Convenience function for retrieving a single system settings value 1753 * as a floating point number. Note that internally setting values are 1754 * always stored as strings; this function converts the string to an 1755 * float for you. The default value will be returned if the setting 1756 * is not defined or not a valid float. 1757 * 1758 * @param cr The ContentResolver to access. 1759 * @param name The name of the setting to retrieve. 1760 * @param def Value to return if the setting is not defined. 1761 * 1762 * @return The setting's current value, or 'def' if it is not defined 1763 * or not a valid float. 1764 */ 1765 public static float getFloat(ContentResolver cr, String name, float def) { 1766 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 1767 } 1768 1769 /** @hide */ 1770 public static float getFloatForUser(ContentResolver cr, String name, float def, 1771 int userHandle) { 1772 String v = getStringForUser(cr, name, userHandle); 1773 try { 1774 return v != null ? Float.parseFloat(v) : def; 1775 } catch (NumberFormatException e) { 1776 return def; 1777 } 1778 } 1779 1780 /** 1781 * Convenience function for retrieving a single system settings value 1782 * as a float. Note that internally setting values are always 1783 * stored as strings; this function converts the string to a float 1784 * for you. 1785 * <p> 1786 * This version does not take a default value. If the setting has not 1787 * been set, or the string value is not a number, 1788 * it throws {@link SettingNotFoundException}. 1789 * 1790 * @param cr The ContentResolver to access. 1791 * @param name The name of the setting to retrieve. 1792 * 1793 * @throws SettingNotFoundException Thrown if a setting by the given 1794 * name can't be found or the setting value is not a float. 1795 * 1796 * @return The setting's current value. 1797 */ 1798 public static float getFloat(ContentResolver cr, String name) 1799 throws SettingNotFoundException { 1800 return getFloatForUser(cr, name, UserHandle.myUserId()); 1801 } 1802 1803 /** @hide */ 1804 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 1805 throws SettingNotFoundException { 1806 String v = getStringForUser(cr, name, userHandle); 1807 if (v == null) { 1808 throw new SettingNotFoundException(name); 1809 } 1810 try { 1811 return Float.parseFloat(v); 1812 } catch (NumberFormatException e) { 1813 throw new SettingNotFoundException(name); 1814 } 1815 } 1816 1817 /** 1818 * Convenience function for updating a single settings value as a 1819 * floating point number. This will either create a new entry in the 1820 * table if the given name does not exist, or modify the value of the 1821 * existing row with that name. Note that internally setting values 1822 * are always stored as strings, so this function converts the given 1823 * value to a string before storing it. 1824 * 1825 * @param cr The ContentResolver to access. 1826 * @param name The name of the setting to modify. 1827 * @param value The new value for the setting. 1828 * @return true if the value was set, false on database errors 1829 */ 1830 public static boolean putFloat(ContentResolver cr, String name, float value) { 1831 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 1832 } 1833 1834 /** @hide */ 1835 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 1836 int userHandle) { 1837 return putStringForUser(cr, name, Float.toString(value), userHandle); 1838 } 1839 1840 /** 1841 * Convenience function to read all of the current 1842 * configuration-related settings into a 1843 * {@link Configuration} object. 1844 * 1845 * @param cr The ContentResolver to access. 1846 * @param outConfig Where to place the configuration settings. 1847 */ 1848 public static void getConfiguration(ContentResolver cr, Configuration outConfig) { 1849 getConfigurationForUser(cr, outConfig, UserHandle.myUserId()); 1850 } 1851 1852 /** @hide */ 1853 public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig, 1854 int userHandle) { 1855 outConfig.fontScale = Settings.System.getFloatForUser( 1856 cr, FONT_SCALE, outConfig.fontScale, userHandle); 1857 if (outConfig.fontScale < 0) { 1858 outConfig.fontScale = 1; 1859 } 1860 } 1861 1862 /** 1863 * @hide Erase the fields in the Configuration that should be applied 1864 * by the settings. 1865 */ 1866 public static void clearConfiguration(Configuration inoutConfig) { 1867 inoutConfig.fontScale = 0; 1868 } 1869 1870 /** 1871 * Convenience function to write a batch of configuration-related 1872 * settings from a {@link Configuration} object. 1873 * 1874 * @param cr The ContentResolver to access. 1875 * @param config The settings to write. 1876 * @return true if the values were set, false on database errors 1877 */ 1878 public static boolean putConfiguration(ContentResolver cr, Configuration config) { 1879 return putConfigurationForUser(cr, config, UserHandle.myUserId()); 1880 } 1881 1882 /** @hide */ 1883 public static boolean putConfigurationForUser(ContentResolver cr, Configuration config, 1884 int userHandle) { 1885 return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle); 1886 } 1887 1888 /** @hide */ 1889 public static boolean hasInterestingConfigurationChanges(int changes) { 1890 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0; 1891 } 1892 1893 /** @deprecated - Do not use */ 1894 @Deprecated 1895 public static boolean getShowGTalkServiceStatus(ContentResolver cr) { 1896 return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId()); 1897 } 1898 1899 /** 1900 * @hide 1901 * @deprecated - Do not use 1902 */ 1903 public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr, 1904 int userHandle) { 1905 return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0; 1906 } 1907 1908 /** @deprecated - Do not use */ 1909 @Deprecated 1910 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { 1911 setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId()); 1912 } 1913 1914 /** 1915 * @hide 1916 * @deprecated - Do not use 1917 */ 1918 @Deprecated 1919 public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag, 1920 int userHandle) { 1921 putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle); 1922 } 1923 1924 private static final class DiscreteValueValidator implements Validator { 1925 private final String[] mValues; 1926 1927 public DiscreteValueValidator(String[] values) { 1928 mValues = values; 1929 } 1930 1931 @Override 1932 public boolean validate(String value) { 1933 return ArrayUtils.contains(mValues, value); 1934 } 1935 } 1936 1937 private static final class InclusiveIntegerRangeValidator implements Validator { 1938 private final int mMin; 1939 private final int mMax; 1940 1941 public InclusiveIntegerRangeValidator(int min, int max) { 1942 mMin = min; 1943 mMax = max; 1944 } 1945 1946 @Override 1947 public boolean validate(String value) { 1948 try { 1949 final int intValue = Integer.parseInt(value); 1950 return intValue >= mMin && intValue <= mMax; 1951 } catch (NumberFormatException e) { 1952 return false; 1953 } 1954 } 1955 } 1956 1957 private static final class InclusiveFloatRangeValidator implements Validator { 1958 private final float mMin; 1959 private final float mMax; 1960 1961 public InclusiveFloatRangeValidator(float min, float max) { 1962 mMin = min; 1963 mMax = max; 1964 } 1965 1966 @Override 1967 public boolean validate(String value) { 1968 try { 1969 final float floatValue = Float.parseFloat(value); 1970 return floatValue >= mMin && floatValue <= mMax; 1971 } catch (NumberFormatException e) { 1972 return false; 1973 } 1974 } 1975 } 1976 1977 /** 1978 * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead 1979 */ 1980 @Deprecated 1981 public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN; 1982 1983 /** 1984 * What happens when the user presses the end call button if they're not 1985 * on a call.<br/> 1986 * <b>Values:</b><br/> 1987 * 0 - The end button does nothing.<br/> 1988 * 1 - The end button goes to the home screen.<br/> 1989 * 2 - The end button puts the device to sleep and locks the keyguard.<br/> 1990 * 3 - The end button goes to the home screen. If the user is already on the 1991 * home screen, it puts the device to sleep. 1992 */ 1993 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior"; 1994 1995 private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR = 1996 new InclusiveIntegerRangeValidator(0, 3); 1997 1998 /** 1999 * END_BUTTON_BEHAVIOR value for "go home". 2000 * @hide 2001 */ 2002 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1; 2003 2004 /** 2005 * END_BUTTON_BEHAVIOR value for "go to sleep". 2006 * @hide 2007 */ 2008 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2; 2009 2010 /** 2011 * END_BUTTON_BEHAVIOR default value. 2012 * @hide 2013 */ 2014 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP; 2015 2016 /** 2017 * Is advanced settings mode turned on. 0 == no, 1 == yes 2018 * @hide 2019 */ 2020 public static final String ADVANCED_SETTINGS = "advanced_settings"; 2021 2022 private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator; 2023 2024 /** 2025 * ADVANCED_SETTINGS default value. 2026 * @hide 2027 */ 2028 public static final int ADVANCED_SETTINGS_DEFAULT = 0; 2029 2030 /** 2031 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead 2032 */ 2033 @Deprecated 2034 public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON; 2035 2036 /** 2037 * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead 2038 */ 2039 @Deprecated 2040 public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH; 2041 2042 /** 2043 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead 2044 */ 2045 @Deprecated 2046 public static final String RADIO_WIFI = Global.RADIO_WIFI; 2047 2048 /** 2049 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead 2050 * {@hide} 2051 */ 2052 @Deprecated 2053 public static final String RADIO_WIMAX = Global.RADIO_WIMAX; 2054 2055 /** 2056 * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead 2057 */ 2058 @Deprecated 2059 public static final String RADIO_CELL = Global.RADIO_CELL; 2060 2061 /** 2062 * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead 2063 */ 2064 @Deprecated 2065 public static final String RADIO_NFC = Global.RADIO_NFC; 2066 2067 /** 2068 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead 2069 */ 2070 @Deprecated 2071 public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS; 2072 2073 /** 2074 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead 2075 * 2076 * {@hide} 2077 */ 2078 @Deprecated 2079 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = 2080 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS; 2081 2082 /** 2083 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead 2084 */ 2085 @Deprecated 2086 public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY; 2087 2088 /** 2089 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead 2090 */ 2091 @Deprecated 2092 public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT; 2093 2094 /** 2095 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead 2096 */ 2097 @Deprecated 2098 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 2099 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED; 2100 2101 /** 2102 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead 2103 */ 2104 @Deprecated 2105 public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER; 2106 2107 /** 2108 * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead 2109 */ 2110 @Deprecated 2111 public static final String MODE_RINGER = Global.MODE_RINGER; 2112 2113 /** 2114 * Whether to use static IP and other static network attributes. 2115 * <p> 2116 * Set to 1 for true and 0 for false. 2117 * 2118 * @deprecated Use {@link WifiManager} instead 2119 */ 2120 @Deprecated 2121 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; 2122 2123 private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator; 2124 2125 /** 2126 * The static IP address. 2127 * <p> 2128 * Example: "192.168.1.51" 2129 * 2130 * @deprecated Use {@link WifiManager} instead 2131 */ 2132 @Deprecated 2133 public static final String WIFI_STATIC_IP = "wifi_static_ip"; 2134 2135 private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator; 2136 2137 /** 2138 * If using static IP, the gateway's IP address. 2139 * <p> 2140 * Example: "192.168.1.1" 2141 * 2142 * @deprecated Use {@link WifiManager} instead 2143 */ 2144 @Deprecated 2145 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; 2146 2147 private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator; 2148 2149 /** 2150 * If using static IP, the net mask. 2151 * <p> 2152 * Example: "255.255.255.0" 2153 * 2154 * @deprecated Use {@link WifiManager} instead 2155 */ 2156 @Deprecated 2157 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; 2158 2159 private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator; 2160 2161 /** 2162 * If using static IP, the primary DNS's IP address. 2163 * <p> 2164 * Example: "192.168.1.1" 2165 * 2166 * @deprecated Use {@link WifiManager} instead 2167 */ 2168 @Deprecated 2169 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; 2170 2171 private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator; 2172 2173 /** 2174 * If using static IP, the secondary DNS's IP address. 2175 * <p> 2176 * Example: "192.168.1.2" 2177 * 2178 * @deprecated Use {@link WifiManager} instead 2179 */ 2180 @Deprecated 2181 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; 2182 2183 private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator; 2184 2185 /** 2186 * Determines whether remote devices may discover and/or connect to 2187 * this device. 2188 * <P>Type: INT</P> 2189 * 2 -- discoverable and connectable 2190 * 1 -- connectable but not discoverable 2191 * 0 -- neither connectable nor discoverable 2192 */ 2193 public static final String BLUETOOTH_DISCOVERABILITY = 2194 "bluetooth_discoverability"; 2195 2196 private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR = 2197 new InclusiveIntegerRangeValidator(0, 2); 2198 2199 /** 2200 * Bluetooth discoverability timeout. If this value is nonzero, then 2201 * Bluetooth becomes discoverable for a certain number of seconds, 2202 * after which is becomes simply connectable. The value is in seconds. 2203 */ 2204 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = 2205 "bluetooth_discoverability_timeout"; 2206 2207 private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR = 2208 sNonNegativeIntegerValidator; 2209 2210 /** 2211 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED} 2212 * instead 2213 */ 2214 @Deprecated 2215 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED; 2216 2217 /** 2218 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE} 2219 * instead 2220 */ 2221 @Deprecated 2222 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 2223 2224 /** 2225 * @deprecated Use 2226 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED} 2227 * instead 2228 */ 2229 @Deprecated 2230 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = 2231 "lock_pattern_tactile_feedback_enabled"; 2232 2233 /** 2234 * A formatted string of the next alarm that is set, or the empty string 2235 * if there is no alarm set. 2236 * 2237 * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}. 2238 */ 2239 @Deprecated 2240 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; 2241 2242 private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() { 2243 private static final int MAX_LENGTH = 1000; 2244 2245 @Override 2246 public boolean validate(String value) { 2247 // TODO: No idea what the correct format is. 2248 return value == null || value.length() < MAX_LENGTH; 2249 } 2250 }; 2251 2252 /** 2253 * Scaling factor for fonts, float. 2254 */ 2255 public static final String FONT_SCALE = "font_scale"; 2256 2257 private static final Validator FONT_SCALE_VALIDATOR = new Validator() { 2258 @Override 2259 public boolean validate(String value) { 2260 try { 2261 return Float.parseFloat(value) >= 0; 2262 } catch (NumberFormatException e) { 2263 return false; 2264 } 2265 } 2266 }; 2267 2268 /** 2269 * Name of an application package to be debugged. 2270 * 2271 * @deprecated Use {@link Global#DEBUG_APP} instead 2272 */ 2273 @Deprecated 2274 public static final String DEBUG_APP = Global.DEBUG_APP; 2275 2276 /** 2277 * If 1, when launching DEBUG_APP it will wait for the debugger before 2278 * starting user code. If 0, it will run normally. 2279 * 2280 * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead 2281 */ 2282 @Deprecated 2283 public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER; 2284 2285 /** 2286 * Whether or not to dim the screen. 0=no 1=yes 2287 * @deprecated This setting is no longer used. 2288 */ 2289 @Deprecated 2290 public static final String DIM_SCREEN = "dim_screen"; 2291 2292 private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator; 2293 2294 /** 2295 * The amount of time in milliseconds before the device goes to sleep or begins 2296 * to dream after a period of inactivity. This value is also known as the 2297 * user activity timeout period since the screen isn't necessarily turned off 2298 * when it expires. 2299 */ 2300 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; 2301 2302 private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator; 2303 2304 /** 2305 * The screen backlight brightness between 0 and 255. 2306 */ 2307 public static final String SCREEN_BRIGHTNESS = "screen_brightness"; 2308 2309 private static final Validator SCREEN_BRIGHTNESS_VALIDATOR = 2310 new InclusiveIntegerRangeValidator(0, 255); 2311 2312 /** 2313 * Control whether to enable automatic brightness mode. 2314 */ 2315 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; 2316 2317 private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator; 2318 2319 /** 2320 * Adjustment to auto-brightness to make it generally more (>0.0 <1.0) 2321 * or less (<0.0 >-1.0) bright. 2322 * @hide 2323 */ 2324 public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj"; 2325 2326 private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR = 2327 new InclusiveFloatRangeValidator(-1, 1); 2328 2329 /** 2330 * SCREEN_BRIGHTNESS_MODE value for manual mode. 2331 */ 2332 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0; 2333 2334 /** 2335 * SCREEN_BRIGHTNESS_MODE value for automatic mode. 2336 */ 2337 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; 2338 2339 /** 2340 * Control whether the process CPU usage meter should be shown. 2341 * 2342 * @deprecated Use {@link Global#SHOW_PROCESSES} instead 2343 */ 2344 @Deprecated 2345 public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES; 2346 2347 /** 2348 * If 1, the activity manager will aggressively finish activities and 2349 * processes as soon as they are no longer needed. If 0, the normal 2350 * extended lifetime is used. 2351 * 2352 * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead 2353 */ 2354 @Deprecated 2355 public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES; 2356 2357 /** 2358 * Determines which streams are affected by ringer mode changes. The 2359 * stream type's bit should be set to 1 if it should be muted when going 2360 * into an inaudible ringer mode. 2361 */ 2362 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; 2363 2364 private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR = 2365 sNonNegativeIntegerValidator; 2366 2367 /** 2368 * Determines which streams are affected by mute. The 2369 * stream type's bit should be set to 1 if it should be muted when a mute request 2370 * is received. 2371 */ 2372 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; 2373 2374 private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR = 2375 sNonNegativeIntegerValidator; 2376 2377 /** 2378 * Whether vibrate is on for different events. This is used internally, 2379 * changing this value will not change the vibrate. See AudioManager. 2380 */ 2381 public static final String VIBRATE_ON = "vibrate_on"; 2382 2383 private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator; 2384 2385 /** 2386 * If 1, redirects the system vibrator to all currently attached input devices 2387 * that support vibration. If there are no such input devices, then the system 2388 * vibrator is used instead. 2389 * If 0, does not register the system vibrator. 2390 * 2391 * This setting is mainly intended to provide a compatibility mechanism for 2392 * applications that only know about the system vibrator and do not use the 2393 * input device vibrator API. 2394 * 2395 * @hide 2396 */ 2397 public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices"; 2398 2399 private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator; 2400 2401 /** 2402 * Ringer volume. This is used internally, changing this value will not 2403 * change the volume. See AudioManager. 2404 * 2405 * @removed Not used by anything since API 2. 2406 */ 2407 public static final String VOLUME_RING = "volume_ring"; 2408 2409 /** 2410 * System/notifications volume. This is used internally, changing this 2411 * value will not change the volume. See AudioManager. 2412 * 2413 * @removed Not used by anything since API 2. 2414 */ 2415 public static final String VOLUME_SYSTEM = "volume_system"; 2416 2417 /** 2418 * Voice call volume. This is used internally, changing this value will 2419 * not change the volume. See AudioManager. 2420 * 2421 * @removed Not used by anything since API 2. 2422 */ 2423 public static final String VOLUME_VOICE = "volume_voice"; 2424 2425 /** 2426 * Music/media/gaming volume. This is used internally, changing this 2427 * value will not change the volume. See AudioManager. 2428 * 2429 * @removed Not used by anything since API 2. 2430 */ 2431 public static final String VOLUME_MUSIC = "volume_music"; 2432 2433 /** 2434 * Alarm volume. This is used internally, changing this 2435 * value will not change the volume. See AudioManager. 2436 * 2437 * @removed Not used by anything since API 2. 2438 */ 2439 public static final String VOLUME_ALARM = "volume_alarm"; 2440 2441 /** 2442 * Notification volume. This is used internally, changing this 2443 * value will not change the volume. See AudioManager. 2444 * 2445 * @removed Not used by anything since API 2. 2446 */ 2447 public static final String VOLUME_NOTIFICATION = "volume_notification"; 2448 2449 /** 2450 * Bluetooth Headset volume. This is used internally, changing this value will 2451 * not change the volume. See AudioManager. 2452 * 2453 * @removed Not used by anything since API 2. 2454 */ 2455 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; 2456 2457 /** 2458 * Master volume (float in the range 0.0f to 1.0f). 2459 * 2460 * @hide 2461 */ 2462 public static final String VOLUME_MASTER = "volume_master"; 2463 2464 /** 2465 * Master volume mute (int 1 = mute, 0 = not muted). 2466 * 2467 * @hide 2468 */ 2469 public static final String VOLUME_MASTER_MUTE = "volume_master_mute"; 2470 2471 private static final Validator VOLUME_MASTER_MUTE_VALIDATOR = sBooleanValidator; 2472 2473 /** 2474 * Microphone mute (int 1 = mute, 0 = not muted). 2475 * 2476 * @hide 2477 */ 2478 public static final String MICROPHONE_MUTE = "microphone_mute"; 2479 2480 private static final Validator MICROPHONE_MUTE_VALIDATOR = sBooleanValidator; 2481 2482 /** 2483 * Whether the notifications should use the ring volume (value of 1) or 2484 * a separate notification volume (value of 0). In most cases, users 2485 * will have this enabled so the notification and ringer volumes will be 2486 * the same. However, power users can disable this and use the separate 2487 * notification volume control. 2488 * <p> 2489 * Note: This is a one-off setting that will be removed in the future 2490 * when there is profile support. For this reason, it is kept hidden 2491 * from the public APIs. 2492 * 2493 * @hide 2494 * @deprecated 2495 */ 2496 @Deprecated 2497 public static final String NOTIFICATIONS_USE_RING_VOLUME = 2498 "notifications_use_ring_volume"; 2499 2500 private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator; 2501 2502 /** 2503 * Whether silent mode should allow vibration feedback. This is used 2504 * internally in AudioService and the Sound settings activity to 2505 * coordinate decoupling of vibrate and silent modes. This setting 2506 * will likely be removed in a future release with support for 2507 * audio/vibe feedback profiles. 2508 * 2509 * Not used anymore. On devices with vibrator, the user explicitly selects 2510 * silent or vibrate mode. 2511 * Kept for use by legacy database upgrade code in DatabaseHelper. 2512 * @hide 2513 */ 2514 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent"; 2515 2516 private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator; 2517 2518 /** 2519 * The mapping of stream type (integer) to its setting. 2520 * 2521 * @removed Not used by anything since API 2. 2522 */ 2523 public static final String[] VOLUME_SETTINGS = { 2524 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, 2525 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO 2526 }; 2527 2528 /** 2529 * Appended to various volume related settings to record the previous 2530 * values before they the settings were affected by a silent/vibrate 2531 * ringer mode change. 2532 * 2533 * @removed Not used by anything since API 2. 2534 */ 2535 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible"; 2536 2537 /** 2538 * Persistent store for the system-wide default ringtone URI. 2539 * <p> 2540 * If you need to play the default ringtone at any given time, it is recommended 2541 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve 2542 * to the set default ringtone at the time of playing. 2543 * 2544 * @see #DEFAULT_RINGTONE_URI 2545 */ 2546 public static final String RINGTONE = "ringtone"; 2547 2548 private static final Validator RINGTONE_VALIDATOR = sUriValidator; 2549 2550 /** 2551 * A {@link Uri} that will point to the current default ringtone at any 2552 * given time. 2553 * <p> 2554 * If the current default ringtone is in the DRM provider and the caller 2555 * does not have permission, the exception will be a 2556 * FileNotFoundException. 2557 */ 2558 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE); 2559 2560 /** 2561 * Persistent store for the system-wide default notification sound. 2562 * 2563 * @see #RINGTONE 2564 * @see #DEFAULT_NOTIFICATION_URI 2565 */ 2566 public static final String NOTIFICATION_SOUND = "notification_sound"; 2567 2568 private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator; 2569 2570 /** 2571 * A {@link Uri} that will point to the current default notification 2572 * sound at any given time. 2573 * 2574 * @see #DEFAULT_RINGTONE_URI 2575 */ 2576 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND); 2577 2578 /** 2579 * Persistent store for the system-wide default alarm alert. 2580 * 2581 * @see #RINGTONE 2582 * @see #DEFAULT_ALARM_ALERT_URI 2583 */ 2584 public static final String ALARM_ALERT = "alarm_alert"; 2585 2586 private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator; 2587 2588 /** 2589 * A {@link Uri} that will point to the current default alarm alert at 2590 * any given time. 2591 * 2592 * @see #DEFAULT_ALARM_ALERT_URI 2593 */ 2594 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT); 2595 2596 /** 2597 * Persistent store for the system default media button event receiver. 2598 * 2599 * @hide 2600 */ 2601 public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver"; 2602 2603 private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() { 2604 @Override 2605 public boolean validate(String value) { 2606 try { 2607 ComponentName.unflattenFromString(value); 2608 return true; 2609 } catch (NullPointerException e) { 2610 return false; 2611 } 2612 } 2613 }; 2614 2615 /** 2616 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off 2617 */ 2618 public static final String TEXT_AUTO_REPLACE = "auto_replace"; 2619 2620 private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator; 2621 2622 /** 2623 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off 2624 */ 2625 public static final String TEXT_AUTO_CAPS = "auto_caps"; 2626 2627 private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator; 2628 2629 /** 2630 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This 2631 * feature converts two spaces to a "." and space. 2632 */ 2633 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; 2634 2635 private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator; 2636 2637 /** 2638 * Setting to showing password characters in text editors. 1 = On, 0 = Off 2639 */ 2640 public static final String TEXT_SHOW_PASSWORD = "show_password"; 2641 2642 private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator; 2643 2644 public static final String SHOW_GTALK_SERVICE_STATUS = 2645 "SHOW_GTALK_SERVICE_STATUS"; 2646 2647 private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator; 2648 2649 /** 2650 * Name of activity to use for wallpaper on the home screen. 2651 * 2652 * @deprecated Use {@link WallpaperManager} instead. 2653 */ 2654 @Deprecated 2655 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; 2656 2657 private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() { 2658 private static final int MAX_LENGTH = 1000; 2659 2660 @Override 2661 public boolean validate(String value) { 2662 if (value != null && value.length() > MAX_LENGTH) { 2663 return false; 2664 } 2665 return ComponentName.unflattenFromString(value) != null; 2666 } 2667 }; 2668 2669 /** 2670 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME} 2671 * instead 2672 */ 2673 @Deprecated 2674 public static final String AUTO_TIME = Global.AUTO_TIME; 2675 2676 /** 2677 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE} 2678 * instead 2679 */ 2680 @Deprecated 2681 public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; 2682 2683 /** 2684 * Display times as 12 or 24 hours 2685 * 12 2686 * 24 2687 */ 2688 public static final String TIME_12_24 = "time_12_24"; 2689 2690 /** @hide */ 2691 public static final Validator TIME_12_24_VALIDATOR = 2692 new DiscreteValueValidator(new String[] {"12", "24"}); 2693 2694 /** 2695 * Date format string 2696 * mm/dd/yyyy 2697 * dd/mm/yyyy 2698 * yyyy/mm/dd 2699 */ 2700 public static final String DATE_FORMAT = "date_format"; 2701 2702 /** @hide */ 2703 public static final Validator DATE_FORMAT_VALIDATOR = new Validator() { 2704 @Override 2705 public boolean validate(String value) { 2706 try { 2707 new SimpleDateFormat(value); 2708 return true; 2709 } catch (IllegalArgumentException e) { 2710 return false; 2711 } 2712 } 2713 }; 2714 2715 /** 2716 * Whether the setup wizard has been run before (on first boot), or if 2717 * it still needs to be run. 2718 * 2719 * nonzero = it has been run in the past 2720 * 0 = it has not been run in the past 2721 */ 2722 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; 2723 2724 /** @hide */ 2725 public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator; 2726 2727 /** 2728 * Scaling factor for normal window animations. Setting to 0 will disable window 2729 * animations. 2730 * 2731 * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead 2732 */ 2733 @Deprecated 2734 public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE; 2735 2736 /** 2737 * Scaling factor for activity transition animations. Setting to 0 will disable window 2738 * animations. 2739 * 2740 * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead 2741 */ 2742 @Deprecated 2743 public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE; 2744 2745 /** 2746 * Scaling factor for Animator-based animations. This affects both the start delay and 2747 * duration of all such animations. Setting to 0 will cause animations to end immediately. 2748 * The default value is 1. 2749 * 2750 * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead 2751 */ 2752 @Deprecated 2753 public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE; 2754 2755 /** 2756 * Control whether the accelerometer will be used to change screen 2757 * orientation. If 0, it will not be used unless explicitly requested 2758 * by the application; if 1, it will be used by default unless explicitly 2759 * disabled by the application. 2760 */ 2761 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; 2762 2763 /** @hide */ 2764 public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator; 2765 2766 /** 2767 * Default screen rotation when no other policy applies. 2768 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a 2769 * preference, this rotation value will be used. Must be one of the 2770 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}. 2771 * 2772 * @see android.view.Display#getRotation 2773 */ 2774 public static final String USER_ROTATION = "user_rotation"; 2775 2776 /** @hide */ 2777 public static final Validator USER_ROTATION_VALIDATOR = 2778 new InclusiveIntegerRangeValidator(0, 3); 2779 2780 /** 2781 * Control whether the rotation lock toggle in the System UI should be hidden. 2782 * Typically this is done for accessibility purposes to make it harder for 2783 * the user to accidentally toggle the rotation lock while the display rotation 2784 * has been locked for accessibility. 2785 * 2786 * If 0, then rotation lock toggle is not hidden for accessibility (although it may be 2787 * unavailable for other reasons). If 1, then the rotation lock toggle is hidden. 2788 * 2789 * @hide 2790 */ 2791 public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY = 2792 "hide_rotation_lock_toggle_for_accessibility"; 2793 2794 /** @hide */ 2795 public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR = 2796 sBooleanValidator; 2797 2798 /** 2799 * Whether the phone vibrates when it is ringing due to an incoming call. This will 2800 * be used by Phone and Setting apps; it shouldn't affect other apps. 2801 * The value is boolean (1 or 0). 2802 * 2803 * Note: this is not same as "vibrate on ring", which had been available until ICS. 2804 * It was about AudioManager's setting and thus affected all the applications which 2805 * relied on the setting, while this is purely about the vibration setting for incoming 2806 * calls. 2807 */ 2808 public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing"; 2809 2810 /** @hide */ 2811 public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator; 2812 2813 /** 2814 * Whether the audible DTMF tones are played by the dialer when dialing. The value is 2815 * boolean (1 or 0). 2816 */ 2817 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; 2818 2819 /** @hide */ 2820 public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator; 2821 2822 /** 2823 * CDMA only settings 2824 * DTMF tone type played by the dialer when dialing. 2825 * 0 = Normal 2826 * 1 = Long 2827 */ 2828 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type"; 2829 2830 /** @hide */ 2831 public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator; 2832 2833 /** 2834 * Whether the hearing aid is enabled. The value is 2835 * boolean (1 or 0). 2836 * @hide 2837 */ 2838 public static final String HEARING_AID = "hearing_aid"; 2839 2840 /** @hide */ 2841 public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator; 2842 2843 /** 2844 * CDMA only settings 2845 * TTY Mode 2846 * 0 = OFF 2847 * 1 = FULL 2848 * 2 = VCO 2849 * 3 = HCO 2850 * @hide 2851 */ 2852 public static final String TTY_MODE = "tty_mode"; 2853 2854 /** @hide */ 2855 public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3); 2856 2857 /** 2858 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is 2859 * boolean (1 or 0). 2860 */ 2861 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; 2862 2863 /** @hide */ 2864 public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator; 2865 2866 /** 2867 * Whether the haptic feedback (long presses, ...) are enabled. The value is 2868 * boolean (1 or 0). 2869 */ 2870 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; 2871 2872 /** @hide */ 2873 public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator; 2874 2875 /** 2876 * @deprecated Each application that shows web suggestions should have its own 2877 * setting for this. 2878 */ 2879 @Deprecated 2880 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; 2881 2882 /** @hide */ 2883 public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator; 2884 2885 /** 2886 * Whether the notification LED should repeatedly flash when a notification is 2887 * pending. The value is boolean (1 or 0). 2888 * @hide 2889 */ 2890 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; 2891 2892 /** @hide */ 2893 public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator; 2894 2895 /** 2896 * Show pointer location on screen? 2897 * 0 = no 2898 * 1 = yes 2899 * @hide 2900 */ 2901 public static final String POINTER_LOCATION = "pointer_location"; 2902 2903 /** @hide */ 2904 public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator; 2905 2906 /** 2907 * Show touch positions on screen? 2908 * 0 = no 2909 * 1 = yes 2910 * @hide 2911 */ 2912 public static final String SHOW_TOUCHES = "show_touches"; 2913 2914 /** @hide */ 2915 public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator; 2916 2917 /** 2918 * Log raw orientation data from 2919 * {@link com.android.server.policy.WindowOrientationListener} for use with the 2920 * orientationplot.py tool. 2921 * 0 = no 2922 * 1 = yes 2923 * @hide 2924 */ 2925 public static final String WINDOW_ORIENTATION_LISTENER_LOG = 2926 "window_orientation_listener_log"; 2927 2928 /** @hide */ 2929 public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator; 2930 2931 /** 2932 * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED} 2933 * instead 2934 * @hide 2935 */ 2936 @Deprecated 2937 public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED; 2938 2939 /** 2940 * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED} 2941 * instead 2942 * @hide 2943 */ 2944 @Deprecated 2945 public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED; 2946 2947 /** 2948 * Whether to play sounds when the keyguard is shown and dismissed. 2949 * @hide 2950 */ 2951 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; 2952 2953 /** @hide */ 2954 public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator; 2955 2956 /** 2957 * Whether the lockscreen should be completely disabled. 2958 * @hide 2959 */ 2960 public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; 2961 2962 /** @hide */ 2963 public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator; 2964 2965 /** 2966 * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} 2967 * instead 2968 * @hide 2969 */ 2970 @Deprecated 2971 public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND; 2972 2973 /** 2974 * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND} 2975 * instead 2976 * @hide 2977 */ 2978 @Deprecated 2979 public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND; 2980 2981 /** 2982 * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} 2983 * instead 2984 * @hide 2985 */ 2986 @Deprecated 2987 public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; 2988 2989 /** 2990 * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} 2991 * instead 2992 * @hide 2993 */ 2994 @Deprecated 2995 public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; 2996 2997 /** 2998 * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} 2999 * instead 3000 * @hide 3001 */ 3002 @Deprecated 3003 public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; 3004 3005 /** 3006 * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} 3007 * instead 3008 * @hide 3009 */ 3010 @Deprecated 3011 public static final String LOCK_SOUND = Global.LOCK_SOUND; 3012 3013 /** 3014 * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} 3015 * instead 3016 * @hide 3017 */ 3018 @Deprecated 3019 public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; 3020 3021 /** 3022 * Receive incoming SIP calls? 3023 * 0 = no 3024 * 1 = yes 3025 * @hide 3026 */ 3027 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; 3028 3029 /** @hide */ 3030 public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator; 3031 3032 /** 3033 * Call Preference String. 3034 * "SIP_ALWAYS" : Always use SIP with network access 3035 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address 3036 * @hide 3037 */ 3038 public static final String SIP_CALL_OPTIONS = "sip_call_options"; 3039 3040 /** @hide */ 3041 public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator( 3042 new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"}); 3043 3044 /** 3045 * One of the sip call options: Always use SIP with network access. 3046 * @hide 3047 */ 3048 public static final String SIP_ALWAYS = "SIP_ALWAYS"; 3049 3050 /** @hide */ 3051 public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator; 3052 3053 /** 3054 * One of the sip call options: Only if destination is a SIP address. 3055 * @hide 3056 */ 3057 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; 3058 3059 /** @hide */ 3060 public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator; 3061 3062 /** 3063 * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that 3064 * the user should be prompted each time a call is made whether it should be placed using 3065 * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with 3066 * SIP_ADDRESS_ONLY. 3067 * @hide 3068 */ 3069 @Deprecated 3070 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; 3071 3072 /** @hide */ 3073 public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator; 3074 3075 /** 3076 * Pointer speed setting. 3077 * This is an integer value in a range between -7 and +7, so there are 15 possible values. 3078 * -7 = slowest 3079 * 0 = default speed 3080 * +7 = fastest 3081 * @hide 3082 */ 3083 public static final String POINTER_SPEED = "pointer_speed"; 3084 3085 /** @hide */ 3086 public static final Validator POINTER_SPEED_VALIDATOR = 3087 new InclusiveFloatRangeValidator(-7, 7); 3088 3089 /** 3090 * Whether lock-to-app will be triggered by long-press on recents. 3091 * @hide 3092 */ 3093 public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled"; 3094 3095 /** @hide */ 3096 public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator; 3097 3098 /** 3099 * I am the lolrus. 3100 * <p> 3101 * Nonzero values indicate that the user has a bukkit. 3102 * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>. 3103 * @hide 3104 */ 3105 public static final String EGG_MODE = "egg_mode"; 3106 3107 /** @hide */ 3108 public static final Validator EGG_MODE_VALIDATOR = new Validator() { 3109 @Override 3110 public boolean validate(String value) { 3111 try { 3112 return Long.parseLong(value) >= 0; 3113 } catch (NumberFormatException e) { 3114 return false; 3115 } 3116 } 3117 }; 3118 3119 /** 3120 * IMPORTANT: If you add a new public settings you also have to add it to 3121 * PUBLIC_SETTINGS below. If the new setting is hidden you have to add 3122 * it to PRIVATE_SETTINGS below. Also add a validator that can validate 3123 * the setting value. See an example above. 3124 */ 3125 3126 /** 3127 * Settings to backup. This is here so that it's in the same place as the settings 3128 * keys and easy to update. 3129 * 3130 * NOTE: Settings are backed up and restored in the order they appear 3131 * in this array. If you have one setting depending on another, 3132 * make sure that they are ordered appropriately. 3133 * 3134 * @hide 3135 */ 3136 public static final String[] SETTINGS_TO_BACKUP = { 3137 STAY_ON_WHILE_PLUGGED_IN, // moved to global 3138 WIFI_USE_STATIC_IP, 3139 WIFI_STATIC_IP, 3140 WIFI_STATIC_GATEWAY, 3141 WIFI_STATIC_NETMASK, 3142 WIFI_STATIC_DNS1, 3143 WIFI_STATIC_DNS2, 3144 BLUETOOTH_DISCOVERABILITY, 3145 BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3146 DIM_SCREEN, 3147 SCREEN_OFF_TIMEOUT, 3148 SCREEN_BRIGHTNESS, 3149 SCREEN_BRIGHTNESS_MODE, 3150 SCREEN_AUTO_BRIGHTNESS_ADJ, 3151 VIBRATE_INPUT_DEVICES, 3152 MODE_RINGER_STREAMS_AFFECTED, 3153 TEXT_AUTO_REPLACE, 3154 TEXT_AUTO_CAPS, 3155 TEXT_AUTO_PUNCTUATE, 3156 TEXT_SHOW_PASSWORD, 3157 AUTO_TIME, // moved to global 3158 AUTO_TIME_ZONE, // moved to global 3159 TIME_12_24, 3160 DATE_FORMAT, 3161 DTMF_TONE_WHEN_DIALING, 3162 DTMF_TONE_TYPE_WHEN_DIALING, 3163 HEARING_AID, 3164 TTY_MODE, 3165 SOUND_EFFECTS_ENABLED, 3166 HAPTIC_FEEDBACK_ENABLED, 3167 POWER_SOUNDS_ENABLED, // moved to global 3168 DOCK_SOUNDS_ENABLED, // moved to global 3169 LOCKSCREEN_SOUNDS_ENABLED, 3170 SHOW_WEB_SUGGESTIONS, 3171 NOTIFICATION_LIGHT_PULSE, 3172 SIP_CALL_OPTIONS, 3173 SIP_RECEIVE_CALLS, 3174 POINTER_SPEED, 3175 VIBRATE_WHEN_RINGING, 3176 RINGTONE, 3177 LOCK_TO_APP_ENABLED, 3178 NOTIFICATION_SOUND 3179 }; 3180 3181 /** 3182 * These are all public system settings 3183 * 3184 * @hide 3185 */ 3186 public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>(); 3187 static { 3188 PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR); 3189 PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP); 3190 PUBLIC_SETTINGS.add(WIFI_STATIC_IP); 3191 PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY); 3192 PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK); 3193 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1); 3194 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2); 3195 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY); 3196 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT); 3197 PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED); 3198 PUBLIC_SETTINGS.add(FONT_SCALE); 3199 PUBLIC_SETTINGS.add(DIM_SCREEN); 3200 PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT); 3201 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS); 3202 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE); 3203 PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED); 3204 PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED); 3205 PUBLIC_SETTINGS.add(VIBRATE_ON); 3206 PUBLIC_SETTINGS.add(VOLUME_RING); 3207 PUBLIC_SETTINGS.add(VOLUME_SYSTEM); 3208 PUBLIC_SETTINGS.add(VOLUME_VOICE); 3209 PUBLIC_SETTINGS.add(VOLUME_MUSIC); 3210 PUBLIC_SETTINGS.add(VOLUME_ALARM); 3211 PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION); 3212 PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO); 3213 PUBLIC_SETTINGS.add(RINGTONE); 3214 PUBLIC_SETTINGS.add(NOTIFICATION_SOUND); 3215 PUBLIC_SETTINGS.add(ALARM_ALERT); 3216 PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE); 3217 PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS); 3218 PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE); 3219 PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD); 3220 PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS); 3221 PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY); 3222 PUBLIC_SETTINGS.add(TIME_12_24); 3223 PUBLIC_SETTINGS.add(DATE_FORMAT); 3224 PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN); 3225 PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION); 3226 PUBLIC_SETTINGS.add(USER_ROTATION); 3227 PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING); 3228 PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED); 3229 PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); 3230 PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS); 3231 } 3232 3233 /** 3234 * These are all hidden system settings. 3235 * 3236 * @hide 3237 */ 3238 public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>(); 3239 static { 3240 PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP); 3241 PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR); 3242 PRIVATE_SETTINGS.add(ADVANCED_SETTINGS); 3243 PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ); 3244 PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES); 3245 PRIVATE_SETTINGS.add(VOLUME_MASTER); 3246 PRIVATE_SETTINGS.add(VOLUME_MASTER_MUTE); 3247 PRIVATE_SETTINGS.add(MICROPHONE_MUTE); 3248 PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME); 3249 PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT); 3250 PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER); 3251 PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY); 3252 PRIVATE_SETTINGS.add(VIBRATE_WHEN_RINGING); 3253 PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING); 3254 PRIVATE_SETTINGS.add(HEARING_AID); 3255 PRIVATE_SETTINGS.add(TTY_MODE); 3256 PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE); 3257 PRIVATE_SETTINGS.add(POINTER_LOCATION); 3258 PRIVATE_SETTINGS.add(SHOW_TOUCHES); 3259 PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG); 3260 PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED); 3261 PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED); 3262 PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED); 3263 PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED); 3264 PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND); 3265 PRIVATE_SETTINGS.add(DESK_DOCK_SOUND); 3266 PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND); 3267 PRIVATE_SETTINGS.add(CAR_DOCK_SOUND); 3268 PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND); 3269 PRIVATE_SETTINGS.add(LOCK_SOUND); 3270 PRIVATE_SETTINGS.add(UNLOCK_SOUND); 3271 PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS); 3272 PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS); 3273 PRIVATE_SETTINGS.add(SIP_ALWAYS); 3274 PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY); 3275 PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME); 3276 PRIVATE_SETTINGS.add(POINTER_SPEED); 3277 PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED); 3278 PRIVATE_SETTINGS.add(EGG_MODE); 3279 } 3280 3281 /** 3282 * These are all public system settings 3283 * 3284 * @hide 3285 */ 3286 public static final Map<String, Validator> VALIDATORS = new ArrayMap<>(); 3287 static { 3288 VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR); 3289 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 3290 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR); 3291 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3292 BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR); 3293 VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR); 3294 VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR); 3295 VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR); 3296 VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR); 3297 VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR); 3298 VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR); 3299 VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR); 3300 VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR); 3301 VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR); 3302 VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR); 3303 VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR); 3304 VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR); 3305 VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR); 3306 VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR); 3307 VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR); 3308 VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR); 3309 VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR); 3310 VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR); 3311 VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR); 3312 VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR); 3313 VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR); 3314 VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR); 3315 VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR); 3316 VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR); 3317 VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR); 3318 VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR); 3319 VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR); 3320 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 3321 VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR); 3322 VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR); 3323 VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR); 3324 VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR); 3325 VALIDATORS.put(VOLUME_MASTER_MUTE, VOLUME_MASTER_MUTE_VALIDATOR); 3326 VALIDATORS.put(MICROPHONE_MUTE, MICROPHONE_MUTE_VALIDATOR); 3327 VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR); 3328 VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR); 3329 VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR); 3330 VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 3331 HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR); 3332 VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR); 3333 VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR); 3334 VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR); 3335 VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR); 3336 VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR); 3337 VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR); 3338 VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR); 3339 VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG, 3340 WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR); 3341 VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR); 3342 VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR); 3343 VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR); 3344 VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR); 3345 VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR); 3346 VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR); 3347 VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR); 3348 VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR); 3349 VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR); 3350 VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR); 3351 VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR); 3352 VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR); 3353 VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); 3354 VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); 3355 VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); 3356 } 3357 3358 /** 3359 * These entries are considered common between the personal and the managed profile, 3360 * since the managed profile doesn't get to change them. 3361 */ 3362 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 3363 static { 3364 CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT); 3365 CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED); 3366 CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED); 3367 CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD); 3368 CLONE_TO_MANAGED_PROFILE.add(TIME_12_24); 3369 } 3370 3371 /** @hide */ 3372 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 3373 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 3374 } 3375 3376 /** 3377 * When to use Wi-Fi calling 3378 * 3379 * @see android.telephony.TelephonyManager.WifiCallingChoices 3380 * @hide 3381 */ 3382 public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls"; 3383 3384 // Settings moved to Settings.Secure 3385 3386 /** 3387 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} 3388 * instead 3389 */ 3390 @Deprecated 3391 public static final String ADB_ENABLED = Global.ADB_ENABLED; 3392 3393 /** 3394 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead 3395 */ 3396 @Deprecated 3397 public static final String ANDROID_ID = Secure.ANDROID_ID; 3398 3399 /** 3400 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 3401 */ 3402 @Deprecated 3403 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 3404 3405 /** 3406 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 3407 */ 3408 @Deprecated 3409 public static final String DATA_ROAMING = Global.DATA_ROAMING; 3410 3411 /** 3412 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 3413 */ 3414 @Deprecated 3415 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 3416 3417 /** 3418 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead 3419 */ 3420 @Deprecated 3421 public static final String HTTP_PROXY = Global.HTTP_PROXY; 3422 3423 /** 3424 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 3425 */ 3426 @Deprecated 3427 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 3428 3429 /** 3430 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} 3431 * instead 3432 */ 3433 @Deprecated 3434 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; 3435 3436 /** 3437 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead 3438 */ 3439 @Deprecated 3440 public static final String LOGGING_ID = Secure.LOGGING_ID; 3441 3442 /** 3443 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 3444 */ 3445 @Deprecated 3446 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 3447 3448 /** 3449 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} 3450 * instead 3451 */ 3452 @Deprecated 3453 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; 3454 3455 /** 3456 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} 3457 * instead 3458 */ 3459 @Deprecated 3460 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; 3461 3462 /** 3463 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} 3464 * instead 3465 */ 3466 @Deprecated 3467 public static final String PARENTAL_CONTROL_REDIRECT_URL = 3468 Secure.PARENTAL_CONTROL_REDIRECT_URL; 3469 3470 /** 3471 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead 3472 */ 3473 @Deprecated 3474 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; 3475 3476 /** 3477 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 3478 */ 3479 @Deprecated 3480 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 3481 3482 /** 3483 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 3484 */ 3485 @Deprecated 3486 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 3487 3488 /** 3489 * @deprecated Use 3490 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 3491 */ 3492 @Deprecated 3493 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 3494 3495 /** 3496 * @deprecated Use 3497 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 3498 */ 3499 @Deprecated 3500 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 3501 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 3502 3503 /** 3504 * @deprecated Use 3505 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead 3506 */ 3507 @Deprecated 3508 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 3509 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 3510 3511 /** 3512 * @deprecated Use 3513 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead 3514 */ 3515 @Deprecated 3516 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 3517 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 3518 3519 /** 3520 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 3521 * instead 3522 */ 3523 @Deprecated 3524 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 3525 3526 /** 3527 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead 3528 */ 3529 @Deprecated 3530 public static final String WIFI_ON = Global.WIFI_ON; 3531 3532 /** 3533 * @deprecated Use 3534 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} 3535 * instead 3536 */ 3537 @Deprecated 3538 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 3539 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; 3540 3541 /** 3542 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead 3543 */ 3544 @Deprecated 3545 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; 3546 3547 /** 3548 * @deprecated Use 3549 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead 3550 */ 3551 @Deprecated 3552 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 3553 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; 3554 3555 /** 3556 * @deprecated Use 3557 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead 3558 */ 3559 @Deprecated 3560 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 3561 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; 3562 3563 /** 3564 * @deprecated Use 3565 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} 3566 * instead 3567 */ 3568 @Deprecated 3569 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 3570 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; 3571 3572 /** 3573 * @deprecated Use 3574 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead 3575 */ 3576 @Deprecated 3577 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 3578 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; 3579 3580 /** 3581 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} 3582 * instead 3583 */ 3584 @Deprecated 3585 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; 3586 3587 /** 3588 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 3589 */ 3590 @Deprecated 3591 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON; 3592 3593 /** 3594 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead 3595 */ 3596 @Deprecated 3597 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; 3598 3599 /** 3600 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} 3601 * instead 3602 */ 3603 @Deprecated 3604 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; 3605 3606 /** 3607 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} 3608 * instead 3609 */ 3610 @Deprecated 3611 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = 3612 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; 3613 } 3614 3615 /** 3616 * Secure system settings, containing system preferences that applications 3617 * can read but are not allowed to write. These are for preferences that 3618 * the user must explicitly modify through the system UI or specialized 3619 * APIs for those values, not modified directly by applications. 3620 */ 3621 public static final class Secure extends NameValueTable { 3622 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; 3623 3624 /** 3625 * The content:// style URL for this table 3626 */ 3627 public static final Uri CONTENT_URI = 3628 Uri.parse("content://" + AUTHORITY + "/secure"); 3629 3630 // Populated lazily, guarded by class object: 3631 private static final NameValueCache sNameValueCache = new NameValueCache( 3632 SYS_PROP_SETTING_VERSION, 3633 CONTENT_URI, 3634 CALL_METHOD_GET_SECURE, 3635 CALL_METHOD_PUT_SECURE); 3636 3637 private static ILockSettings sLockSettings = null; 3638 3639 private static boolean sIsSystemProcess; 3640 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; 3641 private static final HashSet<String> MOVED_TO_GLOBAL; 3642 static { 3643 MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3); 3644 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); 3645 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); 3646 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 3647 3648 MOVED_TO_GLOBAL = new HashSet<String>(); 3649 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED); 3650 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED); 3651 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON); 3652 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU); 3653 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS); 3654 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE); 3655 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE); 3656 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE); 3657 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI); 3658 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING); 3659 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED); 3660 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED); 3661 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED); 3662 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); 3663 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); 3664 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); 3665 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); 3666 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); 3667 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); 3668 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES); 3669 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE); 3670 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED); 3671 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES); 3672 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL); 3673 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED); 3674 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE); 3675 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION); 3676 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE); 3677 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES); 3678 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE); 3679 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION); 3680 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE); 3681 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES); 3682 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE); 3683 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE); 3684 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF); 3685 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING); 3686 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER); 3687 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT); 3688 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT); 3689 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS); 3690 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT); 3691 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS); 3692 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT); 3693 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS); 3694 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL); 3695 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST); 3696 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL); 3697 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN); 3698 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED); 3699 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED); 3700 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED); 3701 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); 3702 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); 3703 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); 3704 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); 3705 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); 3706 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); 3707 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); 3708 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 3709 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 3710 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); 3711 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); 3712 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); 3713 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); 3714 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); 3715 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); 3716 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN); 3717 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI); 3718 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); 3719 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); 3720 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); 3721 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); 3722 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); 3723 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); 3724 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); 3725 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); 3726 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); 3727 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); 3728 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); 3729 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); 3730 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); 3731 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); 3732 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); 3733 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); 3734 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); 3735 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); 3736 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); 3737 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); 3738 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); 3739 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); 3740 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); 3741 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); 3742 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); 3743 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); 3744 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); 3745 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); 3746 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); 3747 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); 3748 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); 3749 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); 3750 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); 3751 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); 3752 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); 3753 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); 3754 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); 3755 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); 3756 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); 3757 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); 3758 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); 3759 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); 3760 MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY); 3761 } 3762 3763 /** @hide */ 3764 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 3765 outKeySet.addAll(MOVED_TO_GLOBAL); 3766 } 3767 3768 /** 3769 * Look up a name in the database. 3770 * @param resolver to access the database with 3771 * @param name to look up in the table 3772 * @return the corresponding value, or null if not present 3773 */ 3774 public static String getString(ContentResolver resolver, String name) { 3775 return getStringForUser(resolver, name, UserHandle.myUserId()); 3776 } 3777 3778 /** @hide */ 3779 public static String getStringForUser(ContentResolver resolver, String name, 3780 int userHandle) { 3781 if (MOVED_TO_GLOBAL.contains(name)) { 3782 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 3783 + " to android.provider.Settings.Global."); 3784 return Global.getStringForUser(resolver, name, userHandle); 3785 } 3786 3787 if (MOVED_TO_LOCK_SETTINGS.contains(name)) { 3788 synchronized (Secure.class) { 3789 if (sLockSettings == null) { 3790 sLockSettings = ILockSettings.Stub.asInterface( 3791 (IBinder) ServiceManager.getService("lock_settings")); 3792 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; 3793 } 3794 } 3795 if (sLockSettings != null && !sIsSystemProcess) { 3796 try { 3797 return sLockSettings.getString(name, "0", userHandle); 3798 } catch (RemoteException re) { 3799 // Fall through 3800 } 3801 } 3802 } 3803 3804 return sNameValueCache.getStringForUser(resolver, name, userHandle); 3805 } 3806 3807 /** 3808 * Store a name/value pair into the database. 3809 * @param resolver to access the database with 3810 * @param name to store 3811 * @param value to associate with the name 3812 * @return true if the value was set, false on database errors 3813 */ 3814 public static boolean putString(ContentResolver resolver, String name, String value) { 3815 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 3816 } 3817 3818 /** @hide */ 3819 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 3820 int userHandle) { 3821 if (LOCATION_MODE.equals(name)) { 3822 // HACK ALERT: temporary hack to work around b/10491283. 3823 // TODO: once b/10491283 fixed, remove this hack 3824 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle); 3825 } 3826 if (MOVED_TO_GLOBAL.contains(name)) { 3827 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 3828 + " to android.provider.Settings.Global"); 3829 return Global.putStringForUser(resolver, name, value, userHandle); 3830 } 3831 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 3832 } 3833 3834 /** 3835 * Construct the content URI for a particular name/value pair, 3836 * useful for monitoring changes with a ContentObserver. 3837 * @param name to look up in the table 3838 * @return the corresponding content URI, or null if not present 3839 */ 3840 public static Uri getUriFor(String name) { 3841 if (MOVED_TO_GLOBAL.contains(name)) { 3842 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 3843 + " to android.provider.Settings.Global, returning global URI."); 3844 return Global.getUriFor(Global.CONTENT_URI, name); 3845 } 3846 return getUriFor(CONTENT_URI, name); 3847 } 3848 3849 /** 3850 * Convenience function for retrieving a single secure settings value 3851 * as an integer. Note that internally setting values are always 3852 * stored as strings; this function converts the string to an integer 3853 * for you. The default value will be returned if the setting is 3854 * not defined or not an integer. 3855 * 3856 * @param cr The ContentResolver to access. 3857 * @param name The name of the setting to retrieve. 3858 * @param def Value to return if the setting is not defined. 3859 * 3860 * @return The setting's current value, or 'def' if it is not defined 3861 * or not a valid integer. 3862 */ 3863 public static int getInt(ContentResolver cr, String name, int def) { 3864 return getIntForUser(cr, name, def, UserHandle.myUserId()); 3865 } 3866 3867 /** @hide */ 3868 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 3869 if (LOCATION_MODE.equals(name)) { 3870 // HACK ALERT: temporary hack to work around b/10491283. 3871 // TODO: once b/10491283 fixed, remove this hack 3872 return getLocationModeForUser(cr, userHandle); 3873 } 3874 String v = getStringForUser(cr, name, userHandle); 3875 try { 3876 return v != null ? Integer.parseInt(v) : def; 3877 } catch (NumberFormatException e) { 3878 return def; 3879 } 3880 } 3881 3882 /** 3883 * Convenience function for retrieving a single secure settings value 3884 * as an integer. Note that internally setting values are always 3885 * stored as strings; this function converts the string to an integer 3886 * for you. 3887 * <p> 3888 * This version does not take a default value. If the setting has not 3889 * been set, or the string value is not a number, 3890 * it throws {@link SettingNotFoundException}. 3891 * 3892 * @param cr The ContentResolver to access. 3893 * @param name The name of the setting to retrieve. 3894 * 3895 * @throws SettingNotFoundException Thrown if a setting by the given 3896 * name can't be found or the setting value is not an integer. 3897 * 3898 * @return The setting's current value. 3899 */ 3900 public static int getInt(ContentResolver cr, String name) 3901 throws SettingNotFoundException { 3902 return getIntForUser(cr, name, UserHandle.myUserId()); 3903 } 3904 3905 /** @hide */ 3906 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 3907 throws SettingNotFoundException { 3908 if (LOCATION_MODE.equals(name)) { 3909 // HACK ALERT: temporary hack to work around b/10491283. 3910 // TODO: once b/10491283 fixed, remove this hack 3911 return getLocationModeForUser(cr, userHandle); 3912 } 3913 String v = getStringForUser(cr, name, userHandle); 3914 try { 3915 return Integer.parseInt(v); 3916 } catch (NumberFormatException e) { 3917 throw new SettingNotFoundException(name); 3918 } 3919 } 3920 3921 /** 3922 * Convenience function for updating a single settings value as an 3923 * integer. This will either create a new entry in the table if the 3924 * given name does not exist, or modify the value of the existing row 3925 * with that name. Note that internally setting values are always 3926 * stored as strings, so this function converts the given value to a 3927 * string before storing it. 3928 * 3929 * @param cr The ContentResolver to access. 3930 * @param name The name of the setting to modify. 3931 * @param value The new value for the setting. 3932 * @return true if the value was set, false on database errors 3933 */ 3934 public static boolean putInt(ContentResolver cr, String name, int value) { 3935 return putIntForUser(cr, name, value, UserHandle.myUserId()); 3936 } 3937 3938 /** @hide */ 3939 public static boolean putIntForUser(ContentResolver cr, String name, int value, 3940 int userHandle) { 3941 return putStringForUser(cr, name, Integer.toString(value), userHandle); 3942 } 3943 3944 /** 3945 * Convenience function for retrieving a single secure settings value 3946 * as a {@code long}. Note that internally setting values are always 3947 * stored as strings; this function converts the string to a {@code long} 3948 * for you. The default value will be returned if the setting is 3949 * not defined or not a {@code long}. 3950 * 3951 * @param cr The ContentResolver to access. 3952 * @param name The name of the setting to retrieve. 3953 * @param def Value to return if the setting is not defined. 3954 * 3955 * @return The setting's current value, or 'def' if it is not defined 3956 * or not a valid {@code long}. 3957 */ 3958 public static long getLong(ContentResolver cr, String name, long def) { 3959 return getLongForUser(cr, name, def, UserHandle.myUserId()); 3960 } 3961 3962 /** @hide */ 3963 public static long getLongForUser(ContentResolver cr, String name, long def, 3964 int userHandle) { 3965 String valString = getStringForUser(cr, name, userHandle); 3966 long value; 3967 try { 3968 value = valString != null ? Long.parseLong(valString) : def; 3969 } catch (NumberFormatException e) { 3970 value = def; 3971 } 3972 return value; 3973 } 3974 3975 /** 3976 * Convenience function for retrieving a single secure settings value 3977 * as a {@code long}. Note that internally setting values are always 3978 * stored as strings; this function converts the string to a {@code long} 3979 * for you. 3980 * <p> 3981 * This version does not take a default value. If the setting has not 3982 * been set, or the string value is not a number, 3983 * it throws {@link SettingNotFoundException}. 3984 * 3985 * @param cr The ContentResolver to access. 3986 * @param name The name of the setting to retrieve. 3987 * 3988 * @return The setting's current value. 3989 * @throws SettingNotFoundException Thrown if a setting by the given 3990 * name can't be found or the setting value is not an integer. 3991 */ 3992 public static long getLong(ContentResolver cr, String name) 3993 throws SettingNotFoundException { 3994 return getLongForUser(cr, name, UserHandle.myUserId()); 3995 } 3996 3997 /** @hide */ 3998 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 3999 throws SettingNotFoundException { 4000 String valString = getStringForUser(cr, name, userHandle); 4001 try { 4002 return Long.parseLong(valString); 4003 } catch (NumberFormatException e) { 4004 throw new SettingNotFoundException(name); 4005 } 4006 } 4007 4008 /** 4009 * Convenience function for updating a secure settings value as a long 4010 * integer. This will either create a new entry in the table if the 4011 * given name does not exist, or modify the value of the existing row 4012 * with that name. Note that internally setting values are always 4013 * stored as strings, so this function converts the given value to a 4014 * string before storing it. 4015 * 4016 * @param cr The ContentResolver to access. 4017 * @param name The name of the setting to modify. 4018 * @param value The new value for the setting. 4019 * @return true if the value was set, false on database errors 4020 */ 4021 public static boolean putLong(ContentResolver cr, String name, long value) { 4022 return putLongForUser(cr, name, value, UserHandle.myUserId()); 4023 } 4024 4025 /** @hide */ 4026 public static boolean putLongForUser(ContentResolver cr, String name, long value, 4027 int userHandle) { 4028 return putStringForUser(cr, name, Long.toString(value), userHandle); 4029 } 4030 4031 /** 4032 * Convenience function for retrieving a single secure settings value 4033 * as a floating point number. Note that internally setting values are 4034 * always stored as strings; this function converts the string to an 4035 * float for you. The default value will be returned if the setting 4036 * is not defined or not a valid float. 4037 * 4038 * @param cr The ContentResolver to access. 4039 * @param name The name of the setting to retrieve. 4040 * @param def Value to return if the setting is not defined. 4041 * 4042 * @return The setting's current value, or 'def' if it is not defined 4043 * or not a valid float. 4044 */ 4045 public static float getFloat(ContentResolver cr, String name, float def) { 4046 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 4047 } 4048 4049 /** @hide */ 4050 public static float getFloatForUser(ContentResolver cr, String name, float def, 4051 int userHandle) { 4052 String v = getStringForUser(cr, name, userHandle); 4053 try { 4054 return v != null ? Float.parseFloat(v) : def; 4055 } catch (NumberFormatException e) { 4056 return def; 4057 } 4058 } 4059 4060 /** 4061 * Convenience function for retrieving a single secure settings value 4062 * as a float. Note that internally setting values are always 4063 * stored as strings; this function converts the string to a float 4064 * for you. 4065 * <p> 4066 * This version does not take a default value. If the setting has not 4067 * been set, or the string value is not a number, 4068 * it throws {@link SettingNotFoundException}. 4069 * 4070 * @param cr The ContentResolver to access. 4071 * @param name The name of the setting to retrieve. 4072 * 4073 * @throws SettingNotFoundException Thrown if a setting by the given 4074 * name can't be found or the setting value is not a float. 4075 * 4076 * @return The setting's current value. 4077 */ 4078 public static float getFloat(ContentResolver cr, String name) 4079 throws SettingNotFoundException { 4080 return getFloatForUser(cr, name, UserHandle.myUserId()); 4081 } 4082 4083 /** @hide */ 4084 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 4085 throws SettingNotFoundException { 4086 String v = getStringForUser(cr, name, userHandle); 4087 if (v == null) { 4088 throw new SettingNotFoundException(name); 4089 } 4090 try { 4091 return Float.parseFloat(v); 4092 } catch (NumberFormatException e) { 4093 throw new SettingNotFoundException(name); 4094 } 4095 } 4096 4097 /** 4098 * Convenience function for updating a single settings value as a 4099 * floating point number. This will either create a new entry in the 4100 * table if the given name does not exist, or modify the value of the 4101 * existing row with that name. Note that internally setting values 4102 * are always stored as strings, so this function converts the given 4103 * value to a string before storing it. 4104 * 4105 * @param cr The ContentResolver to access. 4106 * @param name The name of the setting to modify. 4107 * @param value The new value for the setting. 4108 * @return true if the value was set, false on database errors 4109 */ 4110 public static boolean putFloat(ContentResolver cr, String name, float value) { 4111 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 4112 } 4113 4114 /** @hide */ 4115 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 4116 int userHandle) { 4117 return putStringForUser(cr, name, Float.toString(value), userHandle); 4118 } 4119 4120 /** 4121 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} 4122 * instead 4123 */ 4124 @Deprecated 4125 public static final String DEVELOPMENT_SETTINGS_ENABLED = 4126 Global.DEVELOPMENT_SETTINGS_ENABLED; 4127 4128 /** 4129 * When the user has enable the option to have a "bug report" command 4130 * in the power menu. 4131 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead 4132 * @hide 4133 */ 4134 @Deprecated 4135 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 4136 4137 /** 4138 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead 4139 */ 4140 @Deprecated 4141 public static final String ADB_ENABLED = Global.ADB_ENABLED; 4142 4143 /** 4144 * Setting to allow mock locations and location provider status to be injected into the 4145 * LocationManager service for testing purposes during application development. These 4146 * locations and status values override actual location and status information generated 4147 * by network, gps, or other location providers. 4148 * 4149 * @deprecated This settings is not used anymore. 4150 */ 4151 @Deprecated 4152 public static final String ALLOW_MOCK_LOCATION = "mock_location"; 4153 4154 /** 4155 * A 64-bit number (as a hex string) that is randomly 4156 * generated when the user first sets up the device and should remain 4157 * constant for the lifetime of the user's device. The value may 4158 * change if a factory reset is performed on the device. 4159 * <p class="note"><strong>Note:</strong> When a device has <a 4160 * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a> 4161 * (available on certain devices running Android 4.2 or higher), each user appears as a 4162 * completely separate device, so the {@code ANDROID_ID} value is unique to each 4163 * user.</p> 4164 */ 4165 public static final String ANDROID_ID = "android_id"; 4166 4167 /** 4168 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 4169 */ 4170 @Deprecated 4171 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 4172 4173 /** 4174 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 4175 */ 4176 @Deprecated 4177 public static final String DATA_ROAMING = Global.DATA_ROAMING; 4178 4179 /** 4180 * Setting to record the input method used by default, holding the ID 4181 * of the desired method. 4182 */ 4183 public static final String DEFAULT_INPUT_METHOD = "default_input_method"; 4184 4185 /** 4186 * Setting to record the input method subtype used by default, holding the ID 4187 * of the desired method. 4188 */ 4189 public static final String SELECTED_INPUT_METHOD_SUBTYPE = 4190 "selected_input_method_subtype"; 4191 4192 /** 4193 * Setting to record the history of input method subtype, holding the pair of ID of IME 4194 * and its last used subtype. 4195 * @hide 4196 */ 4197 public static final String INPUT_METHODS_SUBTYPE_HISTORY = 4198 "input_methods_subtype_history"; 4199 4200 /** 4201 * Setting to record the visibility of input method selector 4202 */ 4203 public static final String INPUT_METHOD_SELECTOR_VISIBILITY = 4204 "input_method_selector_visibility"; 4205 4206 /** 4207 * The currently selected voice interaction service flattened ComponentName. 4208 * @hide 4209 */ 4210 public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; 4211 4212 /** 4213 * bluetooth HCI snoop log configuration 4214 * @hide 4215 */ 4216 public static final String BLUETOOTH_HCI_LOG = 4217 "bluetooth_hci_log"; 4218 4219 /** 4220 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 4221 */ 4222 @Deprecated 4223 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 4224 4225 /** 4226 * Whether the current user has been set up via setup wizard (0 = false, 1 = true) 4227 * @hide 4228 */ 4229 public static final String USER_SETUP_COMPLETE = "user_setup_complete"; 4230 4231 /** 4232 * List of input methods that are currently enabled. This is a string 4233 * containing the IDs of all enabled input methods, each ID separated 4234 * by ':'. 4235 */ 4236 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; 4237 4238 /** 4239 * List of system input methods that are currently disabled. This is a string 4240 * containing the IDs of all disabled input methods, each ID separated 4241 * by ':'. 4242 * @hide 4243 */ 4244 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; 4245 4246 /** 4247 * Whether to show the IME when a hard keyboard is connected. This is a boolean that 4248 * determines if the IME should be shown when a hard keyboard is attached. 4249 * @hide 4250 */ 4251 public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; 4252 4253 /** 4254 * Host name and port for global http proxy. Uses ':' seperator for 4255 * between host and port. 4256 * 4257 * @deprecated Use {@link Global#HTTP_PROXY} 4258 */ 4259 @Deprecated 4260 public static final String HTTP_PROXY = Global.HTTP_PROXY; 4261 4262 /** 4263 * Whether applications can be installed for this user via the system's 4264 * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism. 4265 * 4266 * <p>1 = permit app installation via the system package installer intent 4267 * <p>0 = do not allow use of the package installer 4268 */ 4269 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 4270 4271 /** 4272 * Comma-separated list of location providers that activities may access. Do not rely on 4273 * this value being present in settings.db or on ContentObserver notifications on the 4274 * corresponding Uri. 4275 * 4276 * @deprecated use {@link #LOCATION_MODE} and 4277 * {@link LocationManager#MODE_CHANGED_ACTION} (or 4278 * {@link LocationManager#PROVIDERS_CHANGED_ACTION}) 4279 */ 4280 @Deprecated 4281 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; 4282 4283 /** 4284 * The degree of location access enabled by the user. 4285 * <p> 4286 * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link 4287 * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link 4288 * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link 4289 * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location 4290 * modes that might be added in the future. 4291 * <p> 4292 * Note: do not rely on this value being present in settings.db or on ContentObserver 4293 * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} 4294 * to receive changes in this value. 4295 */ 4296 public static final String LOCATION_MODE = "location_mode"; 4297 4298 /** 4299 * Location access disabled. 4300 */ 4301 public static final int LOCATION_MODE_OFF = 0; 4302 /** 4303 * Network Location Provider disabled, but GPS and other sensors enabled. 4304 */ 4305 public static final int LOCATION_MODE_SENSORS_ONLY = 1; 4306 /** 4307 * Reduced power usage, such as limiting the number of GPS updates per hour. Requests 4308 * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to 4309 * {@link android.location.Criteria#POWER_MEDIUM}. 4310 */ 4311 public static final int LOCATION_MODE_BATTERY_SAVING = 2; 4312 /** 4313 * Best-effort location computation allowed. 4314 */ 4315 public static final int LOCATION_MODE_HIGH_ACCURACY = 3; 4316 4317 /** 4318 * A flag containing settings used for biometric weak 4319 * @hide 4320 */ 4321 @Deprecated 4322 public static final String LOCK_BIOMETRIC_WEAK_FLAGS = 4323 "lock_biometric_weak_flags"; 4324 4325 /** 4326 * Whether lock-to-app will lock the keyguard when exiting. 4327 * @hide 4328 */ 4329 public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked"; 4330 4331 /** 4332 * Whether autolock is enabled (0 = false, 1 = true) 4333 * 4334 * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security 4335 * level of the keyguard. 4336 */ 4337 @Deprecated 4338 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; 4339 4340 /** 4341 * Whether lock pattern is visible as user enters (0 = false, 1 = true) 4342 */ 4343 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 4344 4345 /** 4346 * Whether lock pattern will vibrate as user enters (0 = false, 1 = 4347 * true) 4348 * 4349 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the 4350 * lockscreen uses 4351 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. 4352 */ 4353 @Deprecated 4354 public static final String 4355 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; 4356 4357 /** 4358 * This preference allows the device to be locked given time after screen goes off, 4359 * subject to current DeviceAdmin policy limits. 4360 * @hide 4361 */ 4362 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; 4363 4364 4365 /** 4366 * This preference contains the string that shows for owner info on LockScreen. 4367 * @hide 4368 * @deprecated 4369 */ 4370 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; 4371 4372 /** 4373 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). 4374 * @hide 4375 */ 4376 @Deprecated 4377 public static final String LOCK_SCREEN_APPWIDGET_IDS = 4378 "lock_screen_appwidget_ids"; 4379 4380 /** 4381 * Id of the appwidget shown on the lock screen when appwidgets are disabled. 4382 * @hide 4383 */ 4384 @Deprecated 4385 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = 4386 "lock_screen_fallback_appwidget_id"; 4387 4388 /** 4389 * Index of the lockscreen appwidget to restore, -1 if none. 4390 * @hide 4391 */ 4392 @Deprecated 4393 public static final String LOCK_SCREEN_STICKY_APPWIDGET = 4394 "lock_screen_sticky_appwidget"; 4395 4396 /** 4397 * This preference enables showing the owner info on LockScreen. 4398 * @hide 4399 * @deprecated 4400 */ 4401 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = 4402 "lock_screen_owner_info_enabled"; 4403 4404 /** 4405 * When set by a user, allows notifications to be shown atop a securely locked screen 4406 * in their full "private" form (same as when the device is unlocked). 4407 * @hide 4408 */ 4409 public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = 4410 "lock_screen_allow_private_notifications"; 4411 4412 /** 4413 * Set by the system to track if the user needs to see the call to action for 4414 * the lockscreen notification policy. 4415 * @hide 4416 */ 4417 public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING = 4418 "show_note_about_notification_hiding"; 4419 4420 /** 4421 * Set to 1 by the system after trust agents have been initialized. 4422 * @hide 4423 */ 4424 public static final String TRUST_AGENTS_INITIALIZED = 4425 "trust_agents_initialized"; 4426 4427 /** 4428 * The Logging ID (a unique 64-bit value) as a hex string. 4429 * Used as a pseudonymous identifier for logging. 4430 * @deprecated This identifier is poorly initialized and has 4431 * many collisions. It should not be used. 4432 */ 4433 @Deprecated 4434 public static final String LOGGING_ID = "logging_id"; 4435 4436 /** 4437 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 4438 */ 4439 @Deprecated 4440 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 4441 4442 /** 4443 * No longer supported. 4444 */ 4445 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 4446 4447 /** 4448 * No longer supported. 4449 */ 4450 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 4451 4452 /** 4453 * No longer supported. 4454 */ 4455 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 4456 4457 /** 4458 * Settings classname to launch when Settings is clicked from All 4459 * Applications. Needed because of user testing between the old 4460 * and new Settings apps. 4461 */ 4462 // TODO: 881807 4463 public static final String SETTINGS_CLASSNAME = "settings_classname"; 4464 4465 /** 4466 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 4467 */ 4468 @Deprecated 4469 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 4470 4471 /** 4472 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 4473 */ 4474 @Deprecated 4475 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 4476 4477 /** 4478 * If accessibility is enabled. 4479 */ 4480 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; 4481 4482 /** 4483 * If touch exploration is enabled. 4484 */ 4485 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; 4486 4487 /** 4488 * List of the enabled accessibility providers. 4489 */ 4490 public static final String ENABLED_ACCESSIBILITY_SERVICES = 4491 "enabled_accessibility_services"; 4492 4493 /** 4494 * List of the accessibility services to which the user has granted 4495 * permission to put the device into touch exploration mode. 4496 * 4497 * @hide 4498 */ 4499 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = 4500 "touch_exploration_granted_accessibility_services"; 4501 4502 /** 4503 * Whether to speak passwords while in accessibility mode. 4504 */ 4505 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; 4506 4507 /** 4508 * Whether to draw text with high contrast while in accessibility mode. 4509 * 4510 * @hide 4511 */ 4512 public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED = 4513 "high_text_contrast_enabled"; 4514 4515 /** 4516 * If injection of accessibility enhancing JavaScript screen-reader 4517 * is enabled. 4518 * <p> 4519 * Note: The JavaScript based screen-reader is served by the 4520 * Google infrastructure and enable users with disabilities to 4521 * efficiently navigate in and explore web content. 4522 * </p> 4523 * <p> 4524 * This property represents a boolean value. 4525 * </p> 4526 * @hide 4527 */ 4528 public static final String ACCESSIBILITY_SCRIPT_INJECTION = 4529 "accessibility_script_injection"; 4530 4531 /** 4532 * The URL for the injected JavaScript based screen-reader used 4533 * for providing accessibility of content in WebView. 4534 * <p> 4535 * Note: The JavaScript based screen-reader is served by the 4536 * Google infrastructure and enable users with disabilities to 4537 * efficiently navigate in and explore web content. 4538 * </p> 4539 * <p> 4540 * This property represents a string value. 4541 * </p> 4542 * @hide 4543 */ 4544 public static final String ACCESSIBILITY_SCREEN_READER_URL = 4545 "accessibility_script_injection_url"; 4546 4547 /** 4548 * Key bindings for navigation in built-in accessibility support for web content. 4549 * <p> 4550 * Note: These key bindings are for the built-in accessibility navigation for 4551 * web content which is used as a fall back solution if JavaScript in a WebView 4552 * is not enabled or the user has not opted-in script injection from Google. 4553 * </p> 4554 * <p> 4555 * The bindings are separated by semi-colon. A binding is a mapping from 4556 * a key to a sequence of actions (for more details look at 4557 * android.webkit.AccessibilityInjector). A key is represented as the hexademical 4558 * string representation of an integer obtained from a meta state (optional) shifted 4559 * sixteen times left and bitwise ored with a key code. An action is represented 4560 * as a hexademical string representation of an integer where the first two digits 4561 * are navigation action index, the second, the third, and the fourth digit pairs 4562 * represent the action arguments. The separate actions in a binding are colon 4563 * separated. The key and the action sequence it maps to are separated by equals. 4564 * </p> 4565 * <p> 4566 * For example, the binding below maps the DPAD right button to traverse the 4567 * current navigation axis once without firing an accessibility event and to 4568 * perform the same traversal again but to fire an event: 4569 * <code> 4570 * 0x16=0x01000100:0x01000101; 4571 * </code> 4572 * </p> 4573 * <p> 4574 * The goal of this binding is to enable dynamic rebinding of keys to 4575 * navigation actions for web content without requiring a framework change. 4576 * </p> 4577 * <p> 4578 * This property represents a string value. 4579 * </p> 4580 * @hide 4581 */ 4582 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = 4583 "accessibility_web_content_key_bindings"; 4584 4585 /** 4586 * Setting that specifies whether the display magnification is enabled. 4587 * Display magnifications allows the user to zoom in the display content 4588 * and is targeted to low vision users. The current magnification scale 4589 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. 4590 * 4591 * @hide 4592 */ 4593 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = 4594 "accessibility_display_magnification_enabled"; 4595 4596 /** 4597 * Setting that specifies what the display magnification scale is. 4598 * Display magnifications allows the user to zoom in the display 4599 * content and is targeted to low vision users. Whether a display 4600 * magnification is performed is controlled by 4601 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 4602 * 4603 * @hide 4604 */ 4605 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = 4606 "accessibility_display_magnification_scale"; 4607 4608 /** 4609 * Setting that specifies whether the display magnification should be 4610 * automatically updated. If this fearture is enabled the system will 4611 * exit magnification mode or pan the viewport when a context change 4612 * occurs. For example, on staring a new activity or rotating the screen, 4613 * the system may zoom out so the user can see the new context he is in. 4614 * Another example is on showing a window that is not visible in the 4615 * magnified viewport the system may pan the viewport to make the window 4616 * the has popped up so the user knows that the context has changed. 4617 * Whether a screen magnification is performed is controlled by 4618 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 4619 * 4620 * @hide 4621 */ 4622 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = 4623 "accessibility_display_magnification_auto_update"; 4624 4625 /** 4626 * Setting that specifies whether timed text (captions) should be 4627 * displayed in video content. Text display properties are controlled by 4628 * the following settings: 4629 * <ul> 4630 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE} 4631 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR} 4632 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR} 4633 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR} 4634 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE} 4635 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE} 4636 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE} 4637 * </ul> 4638 * 4639 * @hide 4640 */ 4641 public static final String ACCESSIBILITY_CAPTIONING_ENABLED = 4642 "accessibility_captioning_enabled"; 4643 4644 /** 4645 * Setting that specifies the language for captions as a locale string, 4646 * e.g. en_US. 4647 * 4648 * @see java.util.Locale#toString 4649 * @hide 4650 */ 4651 public static final String ACCESSIBILITY_CAPTIONING_LOCALE = 4652 "accessibility_captioning_locale"; 4653 4654 /** 4655 * Integer property that specifies the preset style for captions, one 4656 * of: 4657 * <ul> 4658 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM} 4659 * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS} 4660 * </ul> 4661 * 4662 * @see java.util.Locale#toString 4663 * @hide 4664 */ 4665 public static final String ACCESSIBILITY_CAPTIONING_PRESET = 4666 "accessibility_captioning_preset"; 4667 4668 /** 4669 * Integer property that specifes the background color for captions as a 4670 * packed 32-bit color. 4671 * 4672 * @see android.graphics.Color#argb 4673 * @hide 4674 */ 4675 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR = 4676 "accessibility_captioning_background_color"; 4677 4678 /** 4679 * Integer property that specifes the foreground color for captions as a 4680 * packed 32-bit color. 4681 * 4682 * @see android.graphics.Color#argb 4683 * @hide 4684 */ 4685 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR = 4686 "accessibility_captioning_foreground_color"; 4687 4688 /** 4689 * Integer property that specifes the edge type for captions, one of: 4690 * <ul> 4691 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE} 4692 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE} 4693 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW} 4694 * </ul> 4695 * 4696 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR 4697 * @hide 4698 */ 4699 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE = 4700 "accessibility_captioning_edge_type"; 4701 4702 /** 4703 * Integer property that specifes the edge color for captions as a 4704 * packed 32-bit color. 4705 * 4706 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE 4707 * @see android.graphics.Color#argb 4708 * @hide 4709 */ 4710 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR = 4711 "accessibility_captioning_edge_color"; 4712 4713 /** 4714 * Integer property that specifes the window color for captions as a 4715 * packed 32-bit color. 4716 * 4717 * @see android.graphics.Color#argb 4718 * @hide 4719 */ 4720 public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR = 4721 "accessibility_captioning_window_color"; 4722 4723 /** 4724 * String property that specifies the typeface for captions, one of: 4725 * <ul> 4726 * <li>DEFAULT 4727 * <li>MONOSPACE 4728 * <li>SANS_SERIF 4729 * <li>SERIF 4730 * </ul> 4731 * 4732 * @see android.graphics.Typeface 4733 * @hide 4734 */ 4735 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE = 4736 "accessibility_captioning_typeface"; 4737 4738 /** 4739 * Floating point property that specifies font scaling for captions. 4740 * 4741 * @hide 4742 */ 4743 public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE = 4744 "accessibility_captioning_font_scale"; 4745 4746 /** 4747 * Setting that specifies whether display color inversion is enabled. 4748 */ 4749 public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = 4750 "accessibility_display_inversion_enabled"; 4751 4752 /** 4753 * Setting that specifies whether display color space adjustment is 4754 * enabled. 4755 * 4756 * @hide 4757 */ 4758 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED = 4759 "accessibility_display_daltonizer_enabled"; 4760 4761 /** 4762 * Integer property that specifies the type of color space adjustment to 4763 * perform. Valid values are defined in AccessibilityManager. 4764 * 4765 * @hide 4766 */ 4767 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER = 4768 "accessibility_display_daltonizer"; 4769 4770 /** 4771 * The timout for considering a press to be a long press in milliseconds. 4772 * @hide 4773 */ 4774 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; 4775 4776 /** 4777 * List of the enabled print services. 4778 * @hide 4779 */ 4780 public static final String ENABLED_PRINT_SERVICES = 4781 "enabled_print_services"; 4782 4783 /** 4784 * List of the system print services we enabled on first boot. On 4785 * first boot we enable all system, i.e. bundled print services, 4786 * once, so they work out-of-the-box. 4787 * @hide 4788 */ 4789 public static final String ENABLED_ON_FIRST_BOOT_SYSTEM_PRINT_SERVICES = 4790 "enabled_on_first_boot_system_print_services"; 4791 4792 /** 4793 * Setting to always use the default text-to-speech settings regardless 4794 * of the application settings. 4795 * 1 = override application settings, 4796 * 0 = use application settings (if specified). 4797 * 4798 * @deprecated The value of this setting is no longer respected by 4799 * the framework text to speech APIs as of the Ice Cream Sandwich release. 4800 */ 4801 @Deprecated 4802 public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; 4803 4804 /** 4805 * Default text-to-speech engine speech rate. 100 = 1x 4806 */ 4807 public static final String TTS_DEFAULT_RATE = "tts_default_rate"; 4808 4809 /** 4810 * Default text-to-speech engine pitch. 100 = 1x 4811 */ 4812 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; 4813 4814 /** 4815 * Default text-to-speech engine. 4816 */ 4817 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; 4818 4819 /** 4820 * Default text-to-speech language. 4821 * 4822 * @deprecated this setting is no longer in use, as of the Ice Cream 4823 * Sandwich release. Apps should never need to read this setting directly, 4824 * instead can query the TextToSpeech framework classes for the default 4825 * locale. {@link TextToSpeech#getLanguage()}. 4826 */ 4827 @Deprecated 4828 public static final String TTS_DEFAULT_LANG = "tts_default_lang"; 4829 4830 /** 4831 * Default text-to-speech country. 4832 * 4833 * @deprecated this setting is no longer in use, as of the Ice Cream 4834 * Sandwich release. Apps should never need to read this setting directly, 4835 * instead can query the TextToSpeech framework classes for the default 4836 * locale. {@link TextToSpeech#getLanguage()}. 4837 */ 4838 @Deprecated 4839 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; 4840 4841 /** 4842 * Default text-to-speech locale variant. 4843 * 4844 * @deprecated this setting is no longer in use, as of the Ice Cream 4845 * Sandwich release. Apps should never need to read this setting directly, 4846 * instead can query the TextToSpeech framework classes for the 4847 * locale that is in use {@link TextToSpeech#getLanguage()}. 4848 */ 4849 @Deprecated 4850 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; 4851 4852 /** 4853 * Stores the default tts locales on a per engine basis. Stored as 4854 * a comma seperated list of values, each value being of the form 4855 * {@code engine_name:locale} for example, 4856 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This 4857 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and 4858 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this 4859 * setting directly, and can query the TextToSpeech framework classes 4860 * for the locale that is in use. 4861 * 4862 * @hide 4863 */ 4864 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; 4865 4866 /** 4867 * Space delimited list of plugin packages that are enabled. 4868 */ 4869 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; 4870 4871 /** 4872 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} 4873 * instead. 4874 */ 4875 @Deprecated 4876 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4877 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 4878 4879 /** 4880 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} 4881 * instead. 4882 */ 4883 @Deprecated 4884 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 4885 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 4886 4887 /** 4888 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 4889 * instead. 4890 */ 4891 @Deprecated 4892 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = 4893 Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 4894 4895 /** 4896 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} 4897 * instead. 4898 */ 4899 @Deprecated 4900 public static final String WIFI_ON = Global.WIFI_ON; 4901 4902 /** 4903 * The acceptable packet loss percentage (range 0 - 100) before trying 4904 * another AP on the same network. 4905 * @deprecated This setting is not used. 4906 */ 4907 @Deprecated 4908 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 4909 "wifi_watchdog_acceptable_packet_loss_percentage"; 4910 4911 /** 4912 * The number of access points required for a network in order for the 4913 * watchdog to monitor it. 4914 * @deprecated This setting is not used. 4915 */ 4916 @Deprecated 4917 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; 4918 4919 /** 4920 * The delay between background checks. 4921 * @deprecated This setting is not used. 4922 */ 4923 @Deprecated 4924 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 4925 "wifi_watchdog_background_check_delay_ms"; 4926 4927 /** 4928 * Whether the Wi-Fi watchdog is enabled for background checking even 4929 * after it thinks the user has connected to a good access point. 4930 * @deprecated This setting is not used. 4931 */ 4932 @Deprecated 4933 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 4934 "wifi_watchdog_background_check_enabled"; 4935 4936 /** 4937 * The timeout for a background ping 4938 * @deprecated This setting is not used. 4939 */ 4940 @Deprecated 4941 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 4942 "wifi_watchdog_background_check_timeout_ms"; 4943 4944 /** 4945 * The number of initial pings to perform that *may* be ignored if they 4946 * fail. Again, if these fail, they will *not* be used in packet loss 4947 * calculation. For example, one network always seemed to time out for 4948 * the first couple pings, so this is set to 3 by default. 4949 * @deprecated This setting is not used. 4950 */ 4951 @Deprecated 4952 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 4953 "wifi_watchdog_initial_ignored_ping_count"; 4954 4955 /** 4956 * The maximum number of access points (per network) to attempt to test. 4957 * If this number is reached, the watchdog will no longer monitor the 4958 * initial connection state for the network. This is a safeguard for 4959 * networks containing multiple APs whose DNS does not respond to pings. 4960 * @deprecated This setting is not used. 4961 */ 4962 @Deprecated 4963 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; 4964 4965 /** 4966 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 4967 */ 4968 @Deprecated 4969 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 4970 4971 /** 4972 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. 4973 * @deprecated This setting is not used. 4974 */ 4975 @Deprecated 4976 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; 4977 4978 /** 4979 * The number of pings to test if an access point is a good connection. 4980 * @deprecated This setting is not used. 4981 */ 4982 @Deprecated 4983 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; 4984 4985 /** 4986 * The delay between pings. 4987 * @deprecated This setting is not used. 4988 */ 4989 @Deprecated 4990 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; 4991 4992 /** 4993 * The timeout per ping. 4994 * @deprecated This setting is not used. 4995 */ 4996 @Deprecated 4997 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; 4998 4999 /** 5000 * @deprecated Use 5001 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 5002 */ 5003 @Deprecated 5004 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 5005 5006 /** 5007 * @deprecated Use 5008 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 5009 */ 5010 @Deprecated 5011 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 5012 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 5013 5014 /** 5015 * The number of milliseconds to hold on to a PendingIntent based request. This delay gives 5016 * the receivers of the PendingIntent an opportunity to make a new network request before 5017 * the Network satisfying the request is potentially removed. 5018 * 5019 * @hide 5020 */ 5021 public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS = 5022 "connectivity_release_pending_intent_delay_ms"; 5023 5024 /** 5025 * Whether background data usage is allowed. 5026 * 5027 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, 5028 * availability of background data depends on several 5029 * combined factors. When background data is unavailable, 5030 * {@link ConnectivityManager#getActiveNetworkInfo()} will 5031 * now appear disconnected. 5032 */ 5033 @Deprecated 5034 public static final String BACKGROUND_DATA = "background_data"; 5035 5036 /** 5037 * Origins for which browsers should allow geolocation by default. 5038 * The value is a space-separated list of origins. 5039 */ 5040 public static final String ALLOWED_GEOLOCATION_ORIGINS 5041 = "allowed_geolocation_origins"; 5042 5043 /** 5044 * The preferred TTY mode 0 = TTy Off, CDMA default 5045 * 1 = TTY Full 5046 * 2 = TTY HCO 5047 * 3 = TTY VCO 5048 * @hide 5049 */ 5050 public static final String PREFERRED_TTY_MODE = 5051 "preferred_tty_mode"; 5052 5053 /** 5054 * Whether the enhanced voice privacy mode is enabled. 5055 * 0 = normal voice privacy 5056 * 1 = enhanced voice privacy 5057 * @hide 5058 */ 5059 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; 5060 5061 /** 5062 * Whether the TTY mode mode is enabled. 5063 * 0 = disabled 5064 * 1 = enabled 5065 * @hide 5066 */ 5067 public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; 5068 5069 /** 5070 * Controls whether settings backup is enabled. 5071 * Type: int ( 0 = disabled, 1 = enabled ) 5072 * @hide 5073 */ 5074 public static final String BACKUP_ENABLED = "backup_enabled"; 5075 5076 /** 5077 * Controls whether application data is automatically restored from backup 5078 * at install time. 5079 * Type: int ( 0 = disabled, 1 = enabled ) 5080 * @hide 5081 */ 5082 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; 5083 5084 /** 5085 * Indicates whether settings backup has been fully provisioned. 5086 * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) 5087 * @hide 5088 */ 5089 public static final String BACKUP_PROVISIONED = "backup_provisioned"; 5090 5091 /** 5092 * Component of the transport to use for backup/restore. 5093 * @hide 5094 */ 5095 public static final String BACKUP_TRANSPORT = "backup_transport"; 5096 5097 /** 5098 * Version for which the setup wizard was last shown. Bumped for 5099 * each release when there is new setup information to show. 5100 * @hide 5101 */ 5102 public static final String LAST_SETUP_SHOWN = "last_setup_shown"; 5103 5104 /** 5105 * The interval in milliseconds after which Wi-Fi is considered idle. 5106 * When idle, it is possible for the device to be switched from Wi-Fi to 5107 * the mobile data network. 5108 * @hide 5109 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} 5110 * instead. 5111 */ 5112 @Deprecated 5113 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; 5114 5115 /** 5116 * The global search provider chosen by the user (if multiple global 5117 * search providers are installed). This will be the provider returned 5118 * by {@link SearchManager#getGlobalSearchActivity()} if it's still 5119 * installed. This setting is stored as a flattened component name as 5120 * per {@link ComponentName#flattenToString()}. 5121 * 5122 * @hide 5123 */ 5124 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY = 5125 "search_global_search_activity"; 5126 5127 /** 5128 * The number of promoted sources in GlobalSearch. 5129 * @hide 5130 */ 5131 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources"; 5132 /** 5133 * The maximum number of suggestions returned by GlobalSearch. 5134 * @hide 5135 */ 5136 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display"; 5137 /** 5138 * The number of suggestions GlobalSearch will ask each non-web search source for. 5139 * @hide 5140 */ 5141 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source"; 5142 /** 5143 * The number of suggestions the GlobalSearch will ask the web search source for. 5144 * @hide 5145 */ 5146 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT = 5147 "search_web_results_override_limit"; 5148 /** 5149 * The number of milliseconds that GlobalSearch will wait for suggestions from 5150 * promoted sources before continuing with all other sources. 5151 * @hide 5152 */ 5153 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS = 5154 "search_promoted_source_deadline_millis"; 5155 /** 5156 * The number of milliseconds before GlobalSearch aborts search suggesiton queries. 5157 * @hide 5158 */ 5159 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis"; 5160 /** 5161 * The maximum number of milliseconds that GlobalSearch shows the previous results 5162 * after receiving a new query. 5163 * @hide 5164 */ 5165 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis"; 5166 /** 5167 * The maximum age of log data used for shortcuts in GlobalSearch. 5168 * @hide 5169 */ 5170 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis"; 5171 /** 5172 * The maximum age of log data used for source ranking in GlobalSearch. 5173 * @hide 5174 */ 5175 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS = 5176 "search_max_source_event_age_millis"; 5177 /** 5178 * The minimum number of impressions needed to rank a source in GlobalSearch. 5179 * @hide 5180 */ 5181 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING = 5182 "search_min_impressions_for_source_ranking"; 5183 /** 5184 * The minimum number of clicks needed to rank a source in GlobalSearch. 5185 * @hide 5186 */ 5187 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING = 5188 "search_min_clicks_for_source_ranking"; 5189 /** 5190 * The maximum number of shortcuts shown by GlobalSearch. 5191 * @hide 5192 */ 5193 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned"; 5194 /** 5195 * The size of the core thread pool for suggestion queries in GlobalSearch. 5196 * @hide 5197 */ 5198 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE = 5199 "search_query_thread_core_pool_size"; 5200 /** 5201 * The maximum size of the thread pool for suggestion queries in GlobalSearch. 5202 * @hide 5203 */ 5204 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE = 5205 "search_query_thread_max_pool_size"; 5206 /** 5207 * The size of the core thread pool for shortcut refreshing in GlobalSearch. 5208 * @hide 5209 */ 5210 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE = 5211 "search_shortcut_refresh_core_pool_size"; 5212 /** 5213 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch. 5214 * @hide 5215 */ 5216 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE = 5217 "search_shortcut_refresh_max_pool_size"; 5218 /** 5219 * The maximun time that excess threads in the GlobalSeach thread pools will 5220 * wait before terminating. 5221 * @hide 5222 */ 5223 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS = 5224 "search_thread_keepalive_seconds"; 5225 /** 5226 * The maximum number of concurrent suggestion queries to each source. 5227 * @hide 5228 */ 5229 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = 5230 "search_per_source_concurrent_query_limit"; 5231 5232 /** 5233 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true) 5234 * @hide 5235 */ 5236 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; 5237 5238 /** 5239 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true) 5240 * @hide 5241 */ 5242 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart"; 5243 5244 /** 5245 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true) 5246 * @hide 5247 */ 5248 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt"; 5249 5250 /** 5251 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true) 5252 * @hide 5253 */ 5254 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled"; 5255 5256 /** 5257 * If nonzero, ANRs in invisible background processes bring up a dialog. 5258 * Otherwise, the process will be silently killed. 5259 * @hide 5260 */ 5261 public static final String ANR_SHOW_BACKGROUND = "anr_show_background"; 5262 5263 /** 5264 * The {@link ComponentName} string of the service to be used as the voice recognition 5265 * service. 5266 * 5267 * @hide 5268 */ 5269 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service"; 5270 5271 /** 5272 * Stores whether an user has consented to have apps verified through PAM. 5273 * The value is boolean (1 or 0). 5274 * 5275 * @hide 5276 */ 5277 public static final String PACKAGE_VERIFIER_USER_CONSENT = 5278 "package_verifier_user_consent"; 5279 5280 /** 5281 * The {@link ComponentName} string of the selected spell checker service which is 5282 * one of the services managed by the text service manager. 5283 * 5284 * @hide 5285 */ 5286 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker"; 5287 5288 /** 5289 * The {@link ComponentName} string of the selected subtype of the selected spell checker 5290 * service which is one of the services managed by the text service manager. 5291 * 5292 * @hide 5293 */ 5294 public static final String SELECTED_SPELL_CHECKER_SUBTYPE = 5295 "selected_spell_checker_subtype"; 5296 5297 /** 5298 * The {@link ComponentName} string whether spell checker is enabled or not. 5299 * 5300 * @hide 5301 */ 5302 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled"; 5303 5304 /** 5305 * What happens when the user presses the Power button while in-call 5306 * and the screen is on.<br/> 5307 * <b>Values:</b><br/> 5308 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/> 5309 * 2 - The Power button hangs up the current call.<br/> 5310 * 5311 * @hide 5312 */ 5313 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; 5314 5315 /** 5316 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". 5317 * @hide 5318 */ 5319 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1; 5320 5321 /** 5322 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up". 5323 * @hide 5324 */ 5325 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2; 5326 5327 /** 5328 * INCALL_POWER_BUTTON_BEHAVIOR default value. 5329 * @hide 5330 */ 5331 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT = 5332 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF; 5333 5334 /** 5335 * Whether the device should wake when the wake gesture sensor detects motion. 5336 * @hide 5337 */ 5338 public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled"; 5339 5340 /** 5341 * Whether the device should doze if configured. 5342 * @hide 5343 */ 5344 public static final String DOZE_ENABLED = "doze_enabled"; 5345 5346 /** 5347 * The current night mode that has been selected by the user. Owned 5348 * and controlled by UiModeManagerService. Constants are as per 5349 * UiModeManager. 5350 * @hide 5351 */ 5352 public static final String UI_NIGHT_MODE = "ui_night_mode"; 5353 5354 /** 5355 * Whether screensavers are enabled. 5356 * @hide 5357 */ 5358 public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; 5359 5360 /** 5361 * The user's chosen screensaver components. 5362 * 5363 * These will be launched by the PhoneWindowManager after a timeout when not on 5364 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). 5365 * @hide 5366 */ 5367 public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; 5368 5369 /** 5370 * If screensavers are enabled, whether the screensaver should be automatically launched 5371 * when the device is inserted into a (desk) dock. 5372 * @hide 5373 */ 5374 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; 5375 5376 /** 5377 * If screensavers are enabled, whether the screensaver should be automatically launched 5378 * when the screen times out when not on battery. 5379 * @hide 5380 */ 5381 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; 5382 5383 /** 5384 * If screensavers are enabled, the default screensaver component. 5385 * @hide 5386 */ 5387 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; 5388 5389 /** 5390 * The default NFC payment component 5391 * @hide 5392 */ 5393 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component"; 5394 5395 /** 5396 * Whether NFC payment is handled by the foreground application or a default. 5397 * @hide 5398 */ 5399 public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground"; 5400 5401 /** 5402 * Specifies the package name currently configured to be the primary sms application 5403 * @hide 5404 */ 5405 public static final String SMS_DEFAULT_APPLICATION = "sms_default_application"; 5406 5407 /** 5408 * Specifies the package name currently configured to be the default dialer application 5409 * @hide 5410 */ 5411 public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application"; 5412 5413 /** 5414 * Specifies the package name currently configured to be the emergency assistance application 5415 * 5416 * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE 5417 * 5418 * @hide 5419 */ 5420 public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application"; 5421 5422 /** 5423 * Specifies whether the current app context on scren (assist data) will be sent to the 5424 * assist application (active voice interaction service). 5425 * 5426 * @hide 5427 */ 5428 public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled"; 5429 5430 /** 5431 * Names of the service components that the current user has explicitly allowed to 5432 * see all of the user's notifications, separated by ':'. 5433 * 5434 * @hide 5435 */ 5436 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners"; 5437 5438 /** 5439 * Names of the packages that the current user has explicitly allowed to 5440 * manage notification policy configuration, separated by ':'. 5441 * 5442 * @hide 5443 */ 5444 public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = 5445 "enabled_notification_policy_access_packages"; 5446 5447 /** 5448 * @hide 5449 */ 5450 public static final String ENABLED_CONDITION_PROVIDERS = "enabled_condition_providers"; 5451 5452 /** @hide */ 5453 public static final String BAR_SERVICE_COMPONENT = "bar_service_component"; 5454 5455 /** @hide */ 5456 public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT 5457 = "volume_controller_service_component"; 5458 5459 /** @hide */ 5460 public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations"; 5461 5462 /** 5463 * This is the query URI for finding a print service to install. 5464 * 5465 * @hide 5466 */ 5467 public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri"; 5468 5469 /** 5470 * This is the query URI for finding a NFC payment service to install. 5471 * 5472 * @hide 5473 */ 5474 public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri"; 5475 5476 /** 5477 * If enabled, apps should try to skip any introductory hints on first launch. This might 5478 * apply to users that are already familiar with the environment or temporary users. 5479 * <p> 5480 * Type : int (0 to show hints, 1 to skip showing hints) 5481 */ 5482 public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints"; 5483 5484 /** 5485 * Persisted playback time after a user confirmation of an unsafe volume level. 5486 * 5487 * @hide 5488 */ 5489 public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms"; 5490 5491 /** 5492 * This preference enables notification display on the lockscreen. 5493 * @hide 5494 */ 5495 public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = 5496 "lock_screen_show_notifications"; 5497 5498 /** 5499 * List of TV inputs that are currently hidden. This is a string 5500 * containing the IDs of all hidden TV inputs. Each ID is encoded by 5501 * {@link android.net.Uri#encode(String)} and separated by ':'. 5502 * @hide 5503 */ 5504 public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs"; 5505 5506 /** 5507 * List of custom TV input labels. This is a string containing <TV input id, custom name> 5508 * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)} 5509 * and separated by ','. Each pair is separated by ':'. 5510 * @hide 5511 */ 5512 public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels"; 5513 5514 /** 5515 * Whether automatic routing of system audio to USB audio peripheral is disabled. 5516 * The value is boolean (1 or 0), where 1 means automatic routing is disabled, 5517 * and 0 means automatic routing is enabled. 5518 * 5519 * @hide 5520 */ 5521 public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED = 5522 "usb_audio_automatic_routing_disabled"; 5523 5524 /** 5525 * The timeout in milliseconds before the device fully goes to sleep after 5526 * a period of inactivity. This value sets an upper bound on how long the device 5527 * will stay awake or dreaming without user activity. It should generally 5528 * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device 5529 * will sleep before it ever has a chance to dream. 5530 * <p> 5531 * Use -1 to disable this timeout. 5532 * </p> 5533 * 5534 * @hide 5535 */ 5536 public static final String SLEEP_TIMEOUT = "sleep_timeout"; 5537 5538 /** 5539 * Duration in milliseconds that an app should be inactive before it is considered idle. 5540 * <p/>Type: Long 5541 * @hide 5542 */ 5543 public static final String APP_IDLE_DURATION = "app_idle_duration"; 5544 5545 /** 5546 * Controls whether double tap to wake is enabled. 5547 * @hide 5548 */ 5549 public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake"; 5550 5551 /** 5552 * This are the settings to be backed up. 5553 * 5554 * NOTE: Settings are backed up and restored in the order they appear 5555 * in this array. If you have one setting depending on another, 5556 * make sure that they are ordered appropriately. 5557 * 5558 * @hide 5559 */ 5560 public static final String[] SETTINGS_TO_BACKUP = { 5561 BUGREPORT_IN_POWER_MENU, // moved to global 5562 ALLOW_MOCK_LOCATION, 5563 PARENTAL_CONTROL_ENABLED, 5564 PARENTAL_CONTROL_REDIRECT_URL, 5565 USB_MASS_STORAGE_ENABLED, // moved to global 5566 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 5567 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 5568 ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, 5569 ACCESSIBILITY_SCRIPT_INJECTION, 5570 BACKUP_AUTO_RESTORE, 5571 ENABLED_ACCESSIBILITY_SERVICES, 5572 ENABLED_NOTIFICATION_LISTENERS, 5573 ENABLED_INPUT_METHODS, 5574 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, 5575 TOUCH_EXPLORATION_ENABLED, 5576 ACCESSIBILITY_ENABLED, 5577 ACCESSIBILITY_SPEAK_PASSWORD, 5578 ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, 5579 ACCESSIBILITY_CAPTIONING_ENABLED, 5580 ACCESSIBILITY_CAPTIONING_LOCALE, 5581 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, 5582 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, 5583 ACCESSIBILITY_CAPTIONING_EDGE_TYPE, 5584 ACCESSIBILITY_CAPTIONING_EDGE_COLOR, 5585 ACCESSIBILITY_CAPTIONING_TYPEFACE, 5586 ACCESSIBILITY_CAPTIONING_FONT_SCALE, 5587 TTS_USE_DEFAULTS, 5588 TTS_DEFAULT_RATE, 5589 TTS_DEFAULT_PITCH, 5590 TTS_DEFAULT_SYNTH, 5591 TTS_DEFAULT_LANG, 5592 TTS_DEFAULT_COUNTRY, 5593 TTS_ENABLED_PLUGINS, 5594 TTS_DEFAULT_LOCALE, 5595 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global 5596 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global 5597 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global 5598 SELECTED_SPELL_CHECKER, 5599 SELECTED_SPELL_CHECKER_SUBTYPE, 5600 SPELL_CHECKER_ENABLED, 5601 MOUNT_PLAY_NOTIFICATION_SND, 5602 MOUNT_UMS_AUTOSTART, 5603 MOUNT_UMS_PROMPT, 5604 MOUNT_UMS_NOTIFY_ENABLED, 5605 UI_NIGHT_MODE, 5606 SLEEP_TIMEOUT, 5607 DOUBLE_TAP_TO_WAKE, 5608 }; 5609 5610 /** 5611 * These entries are considered common between the personal and the managed profile, 5612 * since the managed profile doesn't get to change them. 5613 */ 5614 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 5615 5616 static { 5617 CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED); 5618 CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION); 5619 CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS); 5620 CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD); 5621 CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES); 5622 CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS); 5623 CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); 5624 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED); 5625 CLONE_TO_MANAGED_PROFILE.add(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS); 5626 CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE); 5627 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER); 5628 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE); 5629 } 5630 5631 /** @hide */ 5632 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 5633 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 5634 } 5635 5636 /** 5637 * Helper method for determining if a location provider is enabled. 5638 * 5639 * @param cr the content resolver to use 5640 * @param provider the location provider to query 5641 * @return true if the provider is enabled 5642 * 5643 * @deprecated use {@link #LOCATION_MODE} or 5644 * {@link LocationManager#isProviderEnabled(String)} 5645 */ 5646 @Deprecated 5647 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { 5648 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); 5649 } 5650 5651 /** 5652 * Helper method for determining if a location provider is enabled. 5653 * @param cr the content resolver to use 5654 * @param provider the location provider to query 5655 * @param userId the userId to query 5656 * @return true if the provider is enabled 5657 * @deprecated use {@link #LOCATION_MODE} or 5658 * {@link LocationManager#isProviderEnabled(String)} 5659 * @hide 5660 */ 5661 @Deprecated 5662 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { 5663 String allowedProviders = Settings.Secure.getStringForUser(cr, 5664 LOCATION_PROVIDERS_ALLOWED, userId); 5665 return TextUtils.delimitedStringContains(allowedProviders, ',', provider); 5666 } 5667 5668 /** 5669 * Thread-safe method for enabling or disabling a single location provider. 5670 * @param cr the content resolver to use 5671 * @param provider the location provider to enable or disable 5672 * @param enabled true if the provider should be enabled 5673 * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE} 5674 */ 5675 @Deprecated 5676 public static final void setLocationProviderEnabled(ContentResolver cr, 5677 String provider, boolean enabled) { 5678 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); 5679 } 5680 5681 /** 5682 * Thread-safe method for enabling or disabling a single location provider. 5683 * 5684 * @param cr the content resolver to use 5685 * @param provider the location provider to enable or disable 5686 * @param enabled true if the provider should be enabled 5687 * @param userId the userId for which to enable/disable providers 5688 * @return true if the value was set, false on database errors 5689 * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and 5690 * {@link #LOCATION_MODE} 5691 * @hide 5692 */ 5693 @Deprecated 5694 public static final boolean setLocationProviderEnabledForUser(ContentResolver cr, 5695 String provider, boolean enabled, int userId) { 5696 synchronized (mLocationSettingsLock) { 5697 // to ensure thread safety, we write the provider name with a '+' or '-' 5698 // and let the SettingsProvider handle it rather than reading and modifying 5699 // the list of enabled providers. 5700 if (enabled) { 5701 provider = "+" + provider; 5702 } else { 5703 provider = "-" + provider; 5704 } 5705 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, 5706 userId); 5707 } 5708 } 5709 5710 /** 5711 * Thread-safe method for setting the location mode to one of 5712 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 5713 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. 5714 * 5715 * @param cr the content resolver to use 5716 * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} 5717 * @param userId the userId for which to change mode 5718 * @return true if the value was set, false on database errors 5719 * 5720 * @throws IllegalArgumentException if mode is not one of the supported values 5721 */ 5722 private static final boolean setLocationModeForUser(ContentResolver cr, int mode, 5723 int userId) { 5724 synchronized (mLocationSettingsLock) { 5725 boolean gps = false; 5726 boolean network = false; 5727 switch (mode) { 5728 case LOCATION_MODE_OFF: 5729 break; 5730 case LOCATION_MODE_SENSORS_ONLY: 5731 gps = true; 5732 break; 5733 case LOCATION_MODE_BATTERY_SAVING: 5734 network = true; 5735 break; 5736 case LOCATION_MODE_HIGH_ACCURACY: 5737 gps = true; 5738 network = true; 5739 break; 5740 default: 5741 throw new IllegalArgumentException("Invalid location mode: " + mode); 5742 } 5743 // Note it's important that we set the NLP mode first. The Google implementation 5744 // of NLP clears its NLP consent setting any time it receives a 5745 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also, 5746 // it shows an NLP consent dialog any time it receives the broadcast, NLP is 5747 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first, 5748 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting, 5749 // and 3) the receiver happened to complete before we enabled NLP, then the Google 5750 // NLP would detect the attempt to enable NLP and show a redundant NLP consent 5751 // dialog. Then the people who wrote the setup wizard would be sad. 5752 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser( 5753 cr, LocationManager.NETWORK_PROVIDER, network, userId); 5754 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser( 5755 cr, LocationManager.GPS_PROVIDER, gps, userId); 5756 return gpsSuccess && nlpSuccess; 5757 } 5758 } 5759 5760 /** 5761 * Thread-safe method for reading the location mode, returns one of 5762 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 5763 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. 5764 * 5765 * @param cr the content resolver to use 5766 * @param userId the userId for which to read the mode 5767 * @return the location mode 5768 */ 5769 private static final int getLocationModeForUser(ContentResolver cr, int userId) { 5770 synchronized (mLocationSettingsLock) { 5771 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( 5772 cr, LocationManager.GPS_PROVIDER, userId); 5773 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( 5774 cr, LocationManager.NETWORK_PROVIDER, userId); 5775 if (gpsEnabled && networkEnabled) { 5776 return LOCATION_MODE_HIGH_ACCURACY; 5777 } else if (gpsEnabled) { 5778 return LOCATION_MODE_SENSORS_ONLY; 5779 } else if (networkEnabled) { 5780 return LOCATION_MODE_BATTERY_SAVING; 5781 } else { 5782 return LOCATION_MODE_OFF; 5783 } 5784 } 5785 } 5786 } 5787 5788 /** 5789 * Global system settings, containing preferences that always apply identically 5790 * to all defined users. Applications can read these but are not allowed to write; 5791 * like the "Secure" settings, these are for preferences that the user must 5792 * explicitly modify through the system UI or specialized APIs for those values. 5793 */ 5794 public static final class Global extends NameValueTable { 5795 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; 5796 5797 /** 5798 * The content:// style URL for global secure settings items. Not public. 5799 */ 5800 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); 5801 5802 /** 5803 * Whether users are allowed to add more users or guest from lockscreen. 5804 * <p> 5805 * Type: int 5806 * @hide 5807 */ 5808 public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked"; 5809 5810 /** 5811 * Setting whether the global gesture for enabling accessibility is enabled. 5812 * If this gesture is enabled the user will be able to perfrom it to enable 5813 * the accessibility state without visiting the settings app. 5814 * @hide 5815 */ 5816 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = 5817 "enable_accessibility_global_gesture_enabled"; 5818 5819 /** 5820 * Whether Airplane Mode is on. 5821 */ 5822 public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; 5823 5824 /** 5825 * Whether Theater Mode is on. 5826 * {@hide} 5827 */ 5828 @SystemApi 5829 public static final String THEATER_MODE_ON = "theater_mode_on"; 5830 5831 /** 5832 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. 5833 */ 5834 public static final String RADIO_BLUETOOTH = "bluetooth"; 5835 5836 /** 5837 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. 5838 */ 5839 public static final String RADIO_WIFI = "wifi"; 5840 5841 /** 5842 * {@hide} 5843 */ 5844 public static final String RADIO_WIMAX = "wimax"; 5845 /** 5846 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. 5847 */ 5848 public static final String RADIO_CELL = "cell"; 5849 5850 /** 5851 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. 5852 */ 5853 public static final String RADIO_NFC = "nfc"; 5854 5855 /** 5856 * A comma separated list of radios that need to be disabled when airplane mode 5857 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are 5858 * included in the comma separated list. 5859 */ 5860 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; 5861 5862 /** 5863 * A comma separated list of radios that should to be disabled when airplane mode 5864 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is 5865 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi 5866 * will be turned off when entering airplane mode, but the user will be able to reenable 5867 * Wifi in the Settings app. 5868 * 5869 * {@hide} 5870 */ 5871 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; 5872 5873 /** 5874 * The policy for deciding when Wi-Fi should go to sleep (which will in 5875 * turn switch to using the mobile data as an Internet connection). 5876 * <p> 5877 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, 5878 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or 5879 * {@link #WIFI_SLEEP_POLICY_NEVER}. 5880 */ 5881 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; 5882 5883 /** 5884 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep 5885 * policy, which is to sleep shortly after the turning off 5886 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. 5887 */ 5888 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; 5889 5890 /** 5891 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when 5892 * the device is on battery, and never go to sleep when the device is 5893 * plugged in. 5894 */ 5895 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; 5896 5897 /** 5898 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. 5899 */ 5900 public static final int WIFI_SLEEP_POLICY_NEVER = 2; 5901 5902 /** 5903 * Value to specify if the user prefers the date, time and time zone 5904 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 5905 */ 5906 public static final String AUTO_TIME = "auto_time"; 5907 5908 /** 5909 * Value to specify if the user prefers the time zone 5910 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 5911 */ 5912 public static final String AUTO_TIME_ZONE = "auto_time_zone"; 5913 5914 /** 5915 * URI for the car dock "in" event sound. 5916 * @hide 5917 */ 5918 public static final String CAR_DOCK_SOUND = "car_dock_sound"; 5919 5920 /** 5921 * URI for the car dock "out" event sound. 5922 * @hide 5923 */ 5924 public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; 5925 5926 /** 5927 * URI for the desk dock "in" event sound. 5928 * @hide 5929 */ 5930 public static final String DESK_DOCK_SOUND = "desk_dock_sound"; 5931 5932 /** 5933 * URI for the desk dock "out" event sound. 5934 * @hide 5935 */ 5936 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; 5937 5938 /** 5939 * Whether to play a sound for dock events. 5940 * @hide 5941 */ 5942 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; 5943 5944 /** 5945 * URI for the "device locked" (keyguard shown) sound. 5946 * @hide 5947 */ 5948 public static final String LOCK_SOUND = "lock_sound"; 5949 5950 /** 5951 * URI for the "device unlocked" sound. 5952 * @hide 5953 */ 5954 public static final String UNLOCK_SOUND = "unlock_sound"; 5955 5956 /** 5957 * URI for the "device is trusted" sound, which is played when the device enters the trusted 5958 * state without unlocking. 5959 * @hide 5960 */ 5961 public static final String TRUSTED_SOUND = "trusted_sound"; 5962 5963 /** 5964 * URI for the low battery sound file. 5965 * @hide 5966 */ 5967 public static final String LOW_BATTERY_SOUND = "low_battery_sound"; 5968 5969 /** 5970 * Whether to play a sound for low-battery alerts. 5971 * @hide 5972 */ 5973 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; 5974 5975 /** 5976 * URI for the "wireless charging started" sound. 5977 * @hide 5978 */ 5979 public static final String WIRELESS_CHARGING_STARTED_SOUND = 5980 "wireless_charging_started_sound"; 5981 5982 /** 5983 * Whether to play a sound for charging events. 5984 * @hide 5985 */ 5986 public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; 5987 5988 /** 5989 * Whether we keep the device on while the device is plugged in. 5990 * Supported values are: 5991 * <ul> 5992 * <li>{@code 0} to never stay on while plugged in</li> 5993 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li> 5994 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li> 5995 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li> 5996 * </ul> 5997 * These values can be OR-ed together. 5998 */ 5999 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; 6000 6001 /** 6002 * When the user has enable the option to have a "bug report" command 6003 * in the power menu. 6004 * @hide 6005 */ 6006 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 6007 6008 /** 6009 * Whether ADB is enabled. 6010 */ 6011 public static final String ADB_ENABLED = "adb_enabled"; 6012 6013 /** 6014 * Whether Views are allowed to save their attribute data. 6015 * @hide 6016 */ 6017 public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes"; 6018 6019 /** 6020 * Whether assisted GPS should be enabled or not. 6021 * @hide 6022 */ 6023 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; 6024 6025 /** 6026 * Whether bluetooth is enabled/disabled 6027 * 0=disabled. 1=enabled. 6028 */ 6029 public static final String BLUETOOTH_ON = "bluetooth_on"; 6030 6031 /** 6032 * CDMA Cell Broadcast SMS 6033 * 0 = CDMA Cell Broadcast SMS disabled 6034 * 1 = CDMA Cell Broadcast SMS enabled 6035 * @hide 6036 */ 6037 public static final String CDMA_CELL_BROADCAST_SMS = 6038 "cdma_cell_broadcast_sms"; 6039 6040 /** 6041 * The CDMA roaming mode 0 = Home Networks, CDMA default 6042 * 1 = Roaming on Affiliated networks 6043 * 2 = Roaming on any networks 6044 * @hide 6045 */ 6046 public static final String CDMA_ROAMING_MODE = "roaming_settings"; 6047 6048 /** 6049 * The CDMA subscription mode 0 = RUIM/SIM (default) 6050 * 1 = NV 6051 * @hide 6052 */ 6053 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; 6054 6055 /** Inactivity timeout to track mobile data activity. 6056 * 6057 * If set to a positive integer, it indicates the inactivity timeout value in seconds to 6058 * infer the data activity of mobile network. After a period of no activity on mobile 6059 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} 6060 * intent is fired to indicate a transition of network status from "active" to "idle". Any 6061 * subsequent activity on mobile networks triggers the firing of {@code 6062 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". 6063 * 6064 * Network activity refers to transmitting or receiving data on the network interfaces. 6065 * 6066 * Tracking is disabled if set to zero or negative value. 6067 * 6068 * @hide 6069 */ 6070 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; 6071 6072 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} 6073 * but for Wifi network. 6074 * @hide 6075 */ 6076 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; 6077 6078 /** 6079 * Whether or not data roaming is enabled. (0 = false, 1 = true) 6080 */ 6081 public static final String DATA_ROAMING = "data_roaming"; 6082 6083 /** 6084 * The value passed to a Mobile DataConnection via bringUp which defines the 6085 * number of retries to preform when setting up the initial connection. The default 6086 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1. 6087 * @hide 6088 */ 6089 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry"; 6090 6091 /** 6092 * Whether user has enabled development settings. 6093 */ 6094 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; 6095 6096 /** 6097 * Whether the device has been provisioned (0 = false, 1 = true) 6098 */ 6099 public static final String DEVICE_PROVISIONED = "device_provisioned"; 6100 6101 /** 6102 * The saved value for WindowManagerService.setForcedDisplayDensity(). 6103 * One integer in dpi. If unset, then use the real display density. 6104 * @hide 6105 */ 6106 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; 6107 6108 /** 6109 * The saved value for WindowManagerService.setForcedDisplaySize(). 6110 * Two integers separated by a comma. If unset, then use the real display size. 6111 * @hide 6112 */ 6113 public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; 6114 6115 /** 6116 * The saved value for WindowManagerService.setForcedDisplayScalingMode(). 6117 * 0 or unset if scaling is automatic, 1 if scaling is disabled. 6118 * @hide 6119 */ 6120 public static final String DISPLAY_SCALING_FORCE = "display_scaling_force"; 6121 6122 /** 6123 * The maximum size, in bytes, of a download that the download manager will transfer over 6124 * a non-wifi connection. 6125 * @hide 6126 */ 6127 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = 6128 "download_manager_max_bytes_over_mobile"; 6129 6130 /** 6131 * The recommended maximum size, in bytes, of a download that the download manager should 6132 * transfer over a non-wifi connection. Over this size, the use will be warned, but will 6133 * have the option to start the download over the mobile connection anyway. 6134 * @hide 6135 */ 6136 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = 6137 "download_manager_recommended_max_bytes_over_mobile"; 6138 6139 /** 6140 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 6141 */ 6142 @Deprecated 6143 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 6144 6145 /** 6146 * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be 6147 * sent or processed. (0 = false, 1 = true) 6148 * @hide 6149 */ 6150 public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled"; 6151 6152 /** 6153 * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted, 6154 * and the output is redirected to AV Receiver connected via 6155 * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}. 6156 * @hide 6157 */ 6158 public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled"; 6159 6160 /** 6161 * Whether TV will automatically turn on upon reception of the CEC command 6162 * <Text View On> or <Image View On>. (0 = false, 1 = true) 6163 * @hide 6164 */ 6165 public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED = 6166 "hdmi_control_auto_wakeup_enabled"; 6167 6168 /** 6169 * Whether TV will also turn off other CEC devices when it goes to standby mode. 6170 * (0 = false, 1 = true) 6171 * @hide 6172 */ 6173 public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED = 6174 "hdmi_control_auto_device_off_enabled"; 6175 6176 /** 6177 * Whether to use the DHCP client from Lollipop and earlier instead of the newer Android DHCP 6178 * client. 6179 * (0 = false, 1 = true) 6180 * @hide 6181 */ 6182 public static final String LEGACY_DHCP_CLIENT = "legacy_dhcp_client"; 6183 6184 /** 6185 * Whether TV will switch to MHL port when a mobile device is plugged in. 6186 * (0 = false, 1 = true) 6187 * @hide 6188 */ 6189 public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled"; 6190 6191 /** 6192 * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true) 6193 * @hide 6194 */ 6195 public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled"; 6196 6197 /** 6198 * Whether mobile data connections are allowed by the user. See 6199 * ConnectivityManager for more info. 6200 * @hide 6201 */ 6202 public static final String MOBILE_DATA = "mobile_data"; 6203 6204 /** 6205 * Whether the mobile data connection should remain active even when higher 6206 * priority networks like WiFi are active, to help make network switching faster. 6207 * 6208 * See ConnectivityService for more info. 6209 * 6210 * (0 = disabled, 1 = enabled) 6211 * @hide 6212 */ 6213 public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on"; 6214 6215 /** {@hide} */ 6216 public static final String NETSTATS_ENABLED = "netstats_enabled"; 6217 /** {@hide} */ 6218 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; 6219 /** {@hide} */ 6220 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; 6221 /** {@hide} */ 6222 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; 6223 /** {@hide} */ 6224 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; 6225 6226 /** {@hide} */ 6227 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; 6228 /** {@hide} */ 6229 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; 6230 /** {@hide} */ 6231 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; 6232 /** {@hide} */ 6233 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; 6234 6235 /** {@hide} */ 6236 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; 6237 /** {@hide} */ 6238 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; 6239 /** {@hide} */ 6240 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; 6241 /** {@hide} */ 6242 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; 6243 6244 /** {@hide} */ 6245 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; 6246 /** {@hide} */ 6247 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; 6248 /** {@hide} */ 6249 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; 6250 /** {@hide} */ 6251 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; 6252 6253 /** 6254 * User preference for which network(s) should be used. Only the 6255 * connectivity service should touch this. 6256 */ 6257 public static final String NETWORK_PREFERENCE = "network_preference"; 6258 6259 /** 6260 * Which package name to use for network scoring. If null, or if the package is not a valid 6261 * scorer app, external network scores will neither be requested nor accepted. 6262 * @hide 6263 */ 6264 public static final String NETWORK_SCORER_APP = "network_scorer_app"; 6265 6266 /** 6267 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment 6268 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been 6269 * exceeded. 6270 * @hide 6271 */ 6272 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; 6273 6274 /** 6275 * The length of time in milli-seconds that automatic small adjustments to 6276 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. 6277 * @hide 6278 */ 6279 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; 6280 6281 /** Preferred NTP server. {@hide} */ 6282 public static final String NTP_SERVER = "ntp_server"; 6283 /** Timeout in milliseconds to wait for NTP server. {@hide} */ 6284 public static final String NTP_TIMEOUT = "ntp_timeout"; 6285 6286 /** 6287 * Whether the package manager should send package verification broadcasts for verifiers to 6288 * review apps prior to installation. 6289 * 1 = request apps to be verified prior to installation, if a verifier exists. 6290 * 0 = do not verify apps before installation 6291 * @hide 6292 */ 6293 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; 6294 6295 /** Timeout for package verification. 6296 * @hide */ 6297 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; 6298 6299 /** Default response code for package verification. 6300 * @hide */ 6301 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; 6302 6303 /** 6304 * Show package verification setting in the Settings app. 6305 * 1 = show (default) 6306 * 0 = hide 6307 * @hide 6308 */ 6309 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; 6310 6311 /** 6312 * Run package verification on apps installed through ADB/ADT/USB 6313 * 1 = perform package verification on ADB installs (default) 6314 * 0 = bypass package verification on ADB installs 6315 * @hide 6316 */ 6317 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; 6318 6319 /** 6320 * Time since last fstrim (milliseconds) after which we force one to happen 6321 * during device startup. If unset, the default is 3 days. 6322 * @hide 6323 */ 6324 public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval"; 6325 6326 /** 6327 * The interval in milliseconds at which to check packet counts on the 6328 * mobile data interface when screen is on, to detect possible data 6329 * connection problems. 6330 * @hide 6331 */ 6332 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = 6333 "pdp_watchdog_poll_interval_ms"; 6334 6335 /** 6336 * The interval in milliseconds at which to check packet counts on the 6337 * mobile data interface when screen is off, to detect possible data 6338 * connection problems. 6339 * @hide 6340 */ 6341 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = 6342 "pdp_watchdog_long_poll_interval_ms"; 6343 6344 /** 6345 * The interval in milliseconds at which to check packet counts on the 6346 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} 6347 * outgoing packets has been reached without incoming packets. 6348 * @hide 6349 */ 6350 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = 6351 "pdp_watchdog_error_poll_interval_ms"; 6352 6353 /** 6354 * The number of outgoing packets sent without seeing an incoming packet 6355 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} 6356 * device is logged to the event log 6357 * @hide 6358 */ 6359 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = 6360 "pdp_watchdog_trigger_packet_count"; 6361 6362 /** 6363 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) 6364 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before 6365 * attempting data connection recovery. 6366 * @hide 6367 */ 6368 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = 6369 "pdp_watchdog_error_poll_count"; 6370 6371 /** 6372 * The number of failed PDP reset attempts before moving to something more 6373 * drastic: re-registering to the network. 6374 * @hide 6375 */ 6376 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = 6377 "pdp_watchdog_max_pdp_reset_fail_count"; 6378 6379 /** 6380 * A positive value indicates how often the SamplingProfiler 6381 * should take snapshots. Zero value means SamplingProfiler 6382 * is disabled. 6383 * 6384 * @hide 6385 */ 6386 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; 6387 6388 /** 6389 * URL to open browser on to allow user to manage a prepay account 6390 * @hide 6391 */ 6392 public static final String SETUP_PREPAID_DATA_SERVICE_URL = 6393 "setup_prepaid_data_service_url"; 6394 6395 /** 6396 * URL to attempt a GET on to see if this is a prepay device 6397 * @hide 6398 */ 6399 public static final String SETUP_PREPAID_DETECTION_TARGET_URL = 6400 "setup_prepaid_detection_target_url"; 6401 6402 /** 6403 * Host to check for a redirect to after an attempt to GET 6404 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, 6405 * this is a prepaid device with zero balance.) 6406 * @hide 6407 */ 6408 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = 6409 "setup_prepaid_detection_redir_host"; 6410 6411 /** 6412 * The interval in milliseconds at which to check the number of SMS sent out without asking 6413 * for use permit, to limit the un-authorized SMS usage. 6414 * 6415 * @hide 6416 */ 6417 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = 6418 "sms_outgoing_check_interval_ms"; 6419 6420 /** 6421 * The number of outgoing SMS sent without asking for user permit (of {@link 6422 * #SMS_OUTGOING_CHECK_INTERVAL_MS} 6423 * 6424 * @hide 6425 */ 6426 public static final String SMS_OUTGOING_CHECK_MAX_COUNT = 6427 "sms_outgoing_check_max_count"; 6428 6429 /** 6430 * Used to disable SMS short code confirmation - defaults to true. 6431 * True indcates we will do the check, etc. Set to false to disable. 6432 * @see com.android.internal.telephony.SmsUsageMonitor 6433 * @hide 6434 */ 6435 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; 6436 6437 /** 6438 * Used to select which country we use to determine premium sms codes. 6439 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, 6440 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, 6441 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. 6442 * @hide 6443 */ 6444 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; 6445 6446 /** 6447 * Used to select TCP's default initial receiver window size in segments - defaults to a build config value 6448 * @hide 6449 */ 6450 public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd"; 6451 6452 /** 6453 * Used to disable Tethering on a device - defaults to true 6454 * @hide 6455 */ 6456 public static final String TETHER_SUPPORTED = "tether_supported"; 6457 6458 /** 6459 * Used to require DUN APN on the device or not - defaults to a build config value 6460 * which defaults to false 6461 * @hide 6462 */ 6463 public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; 6464 6465 /** 6466 * Used to hold a gservices-provisioned apn value for DUN. If set, or the 6467 * corresponding build config values are set it will override the APN DB 6468 * values. 6469 * Consists of a comma seperated list of strings: 6470 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" 6471 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" 6472 * @hide 6473 */ 6474 public static final String TETHER_DUN_APN = "tether_dun_apn"; 6475 6476 /** 6477 * USB Mass Storage Enabled 6478 */ 6479 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; 6480 6481 /** 6482 * If this setting is set (to anything), then all references 6483 * to Gmail on the device must change to Google Mail. 6484 */ 6485 public static final String USE_GOOGLE_MAIL = "use_google_mail"; 6486 6487 /** 6488 * Webview Data reduction proxy key. 6489 * @hide 6490 */ 6491 public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = 6492 "webview_data_reduction_proxy_key"; 6493 6494 /** 6495 * Whether Wifi display is enabled/disabled 6496 * 0=disabled. 1=enabled. 6497 * @hide 6498 */ 6499 public static final String WIFI_DISPLAY_ON = "wifi_display_on"; 6500 6501 /** 6502 * Whether Wifi display certification mode is enabled/disabled 6503 * 0=disabled. 1=enabled. 6504 * @hide 6505 */ 6506 public static final String WIFI_DISPLAY_CERTIFICATION_ON = 6507 "wifi_display_certification_on"; 6508 6509 /** 6510 * WPS Configuration method used by Wifi display, this setting only 6511 * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled). 6512 * 6513 * Possible values are: 6514 * 6515 * WpsInfo.INVALID: use default WPS method chosen by framework 6516 * WpsInfo.PBC : use Push button 6517 * WpsInfo.KEYPAD : use Keypad 6518 * WpsInfo.DISPLAY: use Display 6519 * @hide 6520 */ 6521 public static final String WIFI_DISPLAY_WPS_CONFIG = 6522 "wifi_display_wps_config"; 6523 6524 /** 6525 * Whether to notify the user of open networks. 6526 * <p> 6527 * If not connected and the scan results have an open network, we will 6528 * put this notification up. If we attempt to connect to a network or 6529 * the open network(s) disappear, we remove the notification. When we 6530 * show the notification, we will not show it again for 6531 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. 6532 */ 6533 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 6534 "wifi_networks_available_notification_on"; 6535 /** 6536 * {@hide} 6537 */ 6538 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = 6539 "wimax_networks_available_notification_on"; 6540 6541 /** 6542 * Delay (in seconds) before repeating the Wi-Fi networks available notification. 6543 * Connecting to a network will reset the timer. 6544 */ 6545 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 6546 "wifi_networks_available_repeat_delay"; 6547 6548 /** 6549 * 802.11 country code in ISO 3166 format 6550 * @hide 6551 */ 6552 public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; 6553 6554 /** 6555 * The interval in milliseconds to issue wake up scans when wifi needs 6556 * to connect. This is necessary to connect to an access point when 6557 * device is on the move and the screen is off. 6558 * @hide 6559 */ 6560 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = 6561 "wifi_framework_scan_interval_ms"; 6562 6563 /** 6564 * The interval in milliseconds after which Wi-Fi is considered idle. 6565 * When idle, it is possible for the device to be switched from Wi-Fi to 6566 * the mobile data network. 6567 * @hide 6568 */ 6569 public static final String WIFI_IDLE_MS = "wifi_idle_ms"; 6570 6571 /** 6572 * When the number of open networks exceeds this number, the 6573 * least-recently-used excess networks will be removed. 6574 */ 6575 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; 6576 6577 /** 6578 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. 6579 */ 6580 public static final String WIFI_ON = "wifi_on"; 6581 6582 /** 6583 * Setting to allow scans to be enabled even wifi is turned off for connectivity. 6584 * @hide 6585 */ 6586 public static final String WIFI_SCAN_ALWAYS_AVAILABLE = 6587 "wifi_scan_always_enabled"; 6588 6589 /** 6590 * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for 6591 * connectivity. 6592 * @hide 6593 */ 6594 public static final String BLE_SCAN_ALWAYS_AVAILABLE = 6595 "ble_scan_always_enabled"; 6596 6597 /** 6598 * Used to save the Wifi_ON state prior to tethering. 6599 * This state will be checked to restore Wifi after 6600 * the user turns off tethering. 6601 * 6602 * @hide 6603 */ 6604 public static final String WIFI_SAVED_STATE = "wifi_saved_state"; 6605 6606 /** 6607 * The interval in milliseconds to scan as used by the wifi supplicant 6608 * @hide 6609 */ 6610 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = 6611 "wifi_supplicant_scan_interval_ms"; 6612 6613 /** 6614 * whether frameworks handles wifi auto-join 6615 * @hide 6616 */ 6617 public static final String WIFI_ENHANCED_AUTO_JOIN = 6618 "wifi_enhanced_auto_join"; 6619 6620 /** 6621 * whether settings show RSSI 6622 * @hide 6623 */ 6624 public static final String WIFI_NETWORK_SHOW_RSSI = 6625 "wifi_network_show_rssi"; 6626 6627 /** 6628 * The interval in milliseconds to scan at supplicant when p2p is connected 6629 * @hide 6630 */ 6631 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = 6632 "wifi_scan_interval_p2p_connected_ms"; 6633 6634 /** 6635 * Whether the Wi-Fi watchdog is enabled. 6636 */ 6637 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 6638 6639 /** 6640 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and 6641 * the setting needs to be set to 0 to disable it. 6642 * @hide 6643 */ 6644 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = 6645 "wifi_watchdog_poor_network_test_enabled"; 6646 6647 /** 6648 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and 6649 * needs to be set to 0 to disable it. 6650 * @hide 6651 */ 6652 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = 6653 "wifi_suspend_optimizations_enabled"; 6654 6655 /** 6656 * The maximum number of times we will retry a connection to an access 6657 * point for which we have failed in acquiring an IP address from DHCP. 6658 * A value of N means that we will make N+1 connection attempts in all. 6659 */ 6660 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; 6661 6662 /** 6663 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile 6664 * data connectivity to be established after a disconnect from Wi-Fi. 6665 */ 6666 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 6667 "wifi_mobile_data_transition_wakelock_timeout_ms"; 6668 6669 /** 6670 * The operational wifi frequency band 6671 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, 6672 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or 6673 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} 6674 * 6675 * @hide 6676 */ 6677 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; 6678 6679 /** 6680 * The Wi-Fi peer-to-peer device name 6681 * @hide 6682 */ 6683 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; 6684 6685 /** 6686 * The min time between wifi disable and wifi enable 6687 * @hide 6688 */ 6689 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay"; 6690 6691 /** 6692 * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect 6693 * from an ephemeral network if there is no BSSID for that network with a non-null score that 6694 * has been seen in this time period. 6695 * 6696 * If this is less than or equal to zero, we use a more conservative behavior and only check 6697 * for a non-null score from the currently connected or target BSSID. 6698 * @hide 6699 */ 6700 public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS = 6701 "wifi_ephemeral_out_of_range_timeout_ms"; 6702 6703 /** 6704 * The number of milliseconds to delay when checking for data stalls during 6705 * non-aggressive detection. (screen is turned off.) 6706 * @hide 6707 */ 6708 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = 6709 "data_stall_alarm_non_aggressive_delay_in_ms"; 6710 6711 /** 6712 * The number of milliseconds to delay when checking for data stalls during 6713 * aggressive detection. (screen on or suspected data stall) 6714 * @hide 6715 */ 6716 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = 6717 "data_stall_alarm_aggressive_delay_in_ms"; 6718 6719 /** 6720 * The number of milliseconds to allow the provisioning apn to remain active 6721 * @hide 6722 */ 6723 public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS = 6724 "provisioning_apn_alarm_delay_in_ms"; 6725 6726 /** 6727 * The interval in milliseconds at which to check gprs registration 6728 * after the first registration mismatch of gprs and voice service, 6729 * to detect possible data network registration problems. 6730 * 6731 * @hide 6732 */ 6733 public static final String GPRS_REGISTER_CHECK_PERIOD_MS = 6734 "gprs_register_check_period_ms"; 6735 6736 /** 6737 * Nonzero causes Log.wtf() to crash. 6738 * @hide 6739 */ 6740 public static final String WTF_IS_FATAL = "wtf_is_fatal"; 6741 6742 /** 6743 * Ringer mode. This is used internally, changing this value will not 6744 * change the ringer mode. See AudioManager. 6745 */ 6746 public static final String MODE_RINGER = "mode_ringer"; 6747 6748 /** 6749 * Overlay display devices setting. 6750 * The associated value is a specially formatted string that describes the 6751 * size and density of simulated secondary display devices. 6752 * <p> 6753 * Format: {width}x{height}/{dpi};... 6754 * </p><p> 6755 * Example: 6756 * <ul> 6757 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li> 6758 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first 6759 * at 1080p and the second at 720p.</li> 6760 * <li>If the value is empty, then no overlay display devices are created.</li> 6761 * </ul></p> 6762 * 6763 * @hide 6764 */ 6765 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; 6766 6767 /** 6768 * Threshold values for the duration and level of a discharge cycle, 6769 * under which we log discharge cycle info. 6770 * 6771 * @hide 6772 */ 6773 public static final String 6774 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; 6775 6776 /** @hide */ 6777 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; 6778 6779 /** 6780 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR 6781 * intents on application crashes and ANRs. If this is disabled, the 6782 * crash/ANR dialog will never display the "Report" button. 6783 * <p> 6784 * Type: int (0 = disallow, 1 = allow) 6785 * 6786 * @hide 6787 */ 6788 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; 6789 6790 /** 6791 * Maximum age of entries kept by {@link DropBoxManager}. 6792 * 6793 * @hide 6794 */ 6795 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; 6796 6797 /** 6798 * Maximum number of entry files which {@link DropBoxManager} will keep 6799 * around. 6800 * 6801 * @hide 6802 */ 6803 public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; 6804 6805 /** 6806 * Maximum amount of disk space used by {@link DropBoxManager} no matter 6807 * what. 6808 * 6809 * @hide 6810 */ 6811 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; 6812 6813 /** 6814 * Percent of free disk (excluding reserve) which {@link DropBoxManager} 6815 * will use. 6816 * 6817 * @hide 6818 */ 6819 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; 6820 6821 /** 6822 * Percent of total disk which {@link DropBoxManager} will never dip 6823 * into. 6824 * 6825 * @hide 6826 */ 6827 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; 6828 6829 /** 6830 * Prefix for per-tag dropbox disable/enable settings. 6831 * 6832 * @hide 6833 */ 6834 public static final String DROPBOX_TAG_PREFIX = "dropbox:"; 6835 6836 /** 6837 * Lines of logcat to include with system crash/ANR/etc. reports, as a 6838 * prefix of the dropbox tag of the report type. For example, 6839 * "logcat_for_system_server_anr" controls the lines of logcat captured 6840 * with system server ANR reports. 0 to disable. 6841 * 6842 * @hide 6843 */ 6844 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; 6845 6846 /** 6847 * The interval in minutes after which the amount of free storage left 6848 * on the device is logged to the event log 6849 * 6850 * @hide 6851 */ 6852 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; 6853 6854 /** 6855 * Threshold for the amount of change in disk free space required to 6856 * report the amount of free space. Used to prevent spamming the logs 6857 * when the disk free space isn't changing frequently. 6858 * 6859 * @hide 6860 */ 6861 public static final String 6862 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; 6863 6864 /** 6865 * Minimum percentage of free storage on the device that is used to 6866 * determine if the device is running low on storage. The default is 10. 6867 * <p> 6868 * Say this value is set to 10, the device is considered running low on 6869 * storage if 90% or more of the device storage is filled up. 6870 * 6871 * @hide 6872 */ 6873 public static final String 6874 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; 6875 6876 /** 6877 * Maximum byte size of the low storage threshold. This is to ensure 6878 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an 6879 * overly large threshold for large storage devices. Currently this must 6880 * be less than 2GB. This default is 500MB. 6881 * 6882 * @hide 6883 */ 6884 public static final String 6885 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; 6886 6887 /** 6888 * Minimum bytes of free storage on the device before the data partition 6889 * is considered full. By default, 1 MB is reserved to avoid system-wide 6890 * SQLite disk full exceptions. 6891 * 6892 * @hide 6893 */ 6894 public static final String 6895 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; 6896 6897 /** 6898 * The maximum reconnect delay for short network outages or when the 6899 * network is suspended due to phone use. 6900 * 6901 * @hide 6902 */ 6903 public static final String 6904 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; 6905 6906 /** 6907 * The number of milliseconds to delay before sending out 6908 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored. 6909 * 6910 * @hide 6911 */ 6912 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; 6913 6914 6915 /** 6916 * Network sampling interval, in seconds. We'll generate link information 6917 * about bytes/packets sent and error rates based on data sampled in this interval 6918 * 6919 * @hide 6920 */ 6921 6922 public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS = 6923 "connectivity_sampling_interval_in_seconds"; 6924 6925 /** 6926 * The series of successively longer delays used in retrying to download PAC file. 6927 * Last delay is used between successful PAC downloads. 6928 * 6929 * @hide 6930 */ 6931 public static final String PAC_CHANGE_DELAY = "pac_change_delay"; 6932 6933 /** 6934 * Setting to turn off captive portal detection. Feature is enabled by 6935 * default and the setting needs to be set to 0 to disable it. 6936 * 6937 * @hide 6938 */ 6939 public static final String 6940 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; 6941 6942 /** 6943 * The server used for captive portal detection upon a new conection. A 6944 * 204 response code from the server is used for validation. 6945 * 6946 * @hide 6947 */ 6948 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; 6949 6950 /** 6951 * Whether network service discovery is enabled. 6952 * 6953 * @hide 6954 */ 6955 public static final String NSD_ON = "nsd_on"; 6956 6957 /** 6958 * Let user pick default install location. 6959 * 6960 * @hide 6961 */ 6962 public static final String SET_INSTALL_LOCATION = "set_install_location"; 6963 6964 /** 6965 * Default install location value. 6966 * 0 = auto, let system decide 6967 * 1 = internal 6968 * 2 = sdcard 6969 * @hide 6970 */ 6971 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; 6972 6973 /** 6974 * ms during which to consume extra events related to Inet connection 6975 * condition after a transtion to fully-connected 6976 * 6977 * @hide 6978 */ 6979 public static final String 6980 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; 6981 6982 /** 6983 * ms during which to consume extra events related to Inet connection 6984 * condtion after a transtion to partly-connected 6985 * 6986 * @hide 6987 */ 6988 public static final String 6989 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; 6990 6991 /** {@hide} */ 6992 public static final String 6993 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; 6994 6995 /** 6996 * Host name and port for global http proxy. Uses ':' seperator for 6997 * between host and port. 6998 */ 6999 public static final String HTTP_PROXY = "http_proxy"; 7000 7001 /** 7002 * Host name for global http proxy. Set via ConnectivityManager. 7003 * 7004 * @hide 7005 */ 7006 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; 7007 7008 /** 7009 * Integer host port for global http proxy. Set via ConnectivityManager. 7010 * 7011 * @hide 7012 */ 7013 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; 7014 7015 /** 7016 * Exclusion list for global proxy. This string contains a list of 7017 * comma-separated domains where the global proxy does not apply. 7018 * Domains should be listed in a comma- separated list. Example of 7019 * acceptable formats: ".domain1.com,my.domain2.com" Use 7020 * ConnectivityManager to set/get. 7021 * 7022 * @hide 7023 */ 7024 public static final String 7025 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; 7026 7027 /** 7028 * The location PAC File for the proxy. 7029 * @hide 7030 */ 7031 public static final String 7032 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url"; 7033 7034 /** 7035 * Enables the UI setting to allow the user to specify the global HTTP 7036 * proxy and associated exclusion list. 7037 * 7038 * @hide 7039 */ 7040 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; 7041 7042 /** 7043 * Setting for default DNS in case nobody suggests one 7044 * 7045 * @hide 7046 */ 7047 public static final String DEFAULT_DNS_SERVER = "default_dns_server"; 7048 7049 /** {@hide} */ 7050 public static final String 7051 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; 7052 /** {@hide} */ 7053 public static final String 7054 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; 7055 /** {@hide} */ 7056 public static final String 7057 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; 7058 /** {@hide} */ 7059 public static final String 7060 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_"; 7061 /** {@hide} */ 7062 public static final String 7063 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_"; 7064 7065 /** 7066 * Get the key that retrieves a bluetooth headset's priority. 7067 * @hide 7068 */ 7069 public static final String getBluetoothHeadsetPriorityKey(String address) { 7070 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7071 } 7072 7073 /** 7074 * Get the key that retrieves a bluetooth a2dp sink's priority. 7075 * @hide 7076 */ 7077 public static final String getBluetoothA2dpSinkPriorityKey(String address) { 7078 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7079 } 7080 7081 /** 7082 * Get the key that retrieves a bluetooth Input Device's priority. 7083 * @hide 7084 */ 7085 public static final String getBluetoothInputDevicePriorityKey(String address) { 7086 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7087 } 7088 7089 /** 7090 * Get the key that retrieves a bluetooth map priority. 7091 * @hide 7092 */ 7093 public static final String getBluetoothMapPriorityKey(String address) { 7094 return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7095 } 7096 7097 /** 7098 * Get the key that retrieves a bluetooth map priority. 7099 * @hide 7100 */ 7101 public static final String getBluetoothSapPriorityKey(String address) { 7102 return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 7103 } 7104 7105 /** 7106 * Scaling factor for normal window animations. Setting to 0 will 7107 * disable window animations. 7108 */ 7109 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; 7110 7111 /** 7112 * Scaling factor for activity transition animations. Setting to 0 will 7113 * disable window animations. 7114 */ 7115 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; 7116 7117 /** 7118 * Scaling factor for Animator-based animations. This affects both the 7119 * start delay and duration of all such animations. Setting to 0 will 7120 * cause animations to end immediately. The default value is 1. 7121 */ 7122 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; 7123 7124 /** 7125 * Scaling factor for normal window animations. Setting to 0 will 7126 * disable window animations. 7127 * 7128 * @hide 7129 */ 7130 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; 7131 7132 /** 7133 * If 0, the compatibility mode is off for all applications. 7134 * If 1, older applications run under compatibility mode. 7135 * TODO: remove this settings before code freeze (bug/1907571) 7136 * @hide 7137 */ 7138 public static final String COMPATIBILITY_MODE = "compatibility_mode"; 7139 7140 /** 7141 * CDMA only settings 7142 * Emergency Tone 0 = Off 7143 * 1 = Alert 7144 * 2 = Vibrate 7145 * @hide 7146 */ 7147 public static final String EMERGENCY_TONE = "emergency_tone"; 7148 7149 /** 7150 * CDMA only settings 7151 * Whether the auto retry is enabled. The value is 7152 * boolean (1 or 0). 7153 * @hide 7154 */ 7155 public static final String CALL_AUTO_RETRY = "call_auto_retry"; 7156 7157 /** 7158 * See RIL_PreferredNetworkType in ril.h 7159 * @hide 7160 */ 7161 public static final String PREFERRED_NETWORK_MODE = 7162 "preferred_network_mode"; 7163 7164 /** 7165 * Name of an application package to be debugged. 7166 */ 7167 public static final String DEBUG_APP = "debug_app"; 7168 7169 /** 7170 * If 1, when launching DEBUG_APP it will wait for the debugger before 7171 * starting user code. If 0, it will run normally. 7172 */ 7173 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; 7174 7175 /** 7176 * Control whether the process CPU usage meter should be shown. 7177 */ 7178 public static final String SHOW_PROCESSES = "show_processes"; 7179 7180 /** 7181 * If 1 low power mode is enabled. 7182 * @hide 7183 */ 7184 public static final String LOW_POWER_MODE = "low_power"; 7185 7186 /** 7187 * Battery level [1-99] at which low power mode automatically turns on. 7188 * If 0, it will not automatically turn on. 7189 * @hide 7190 */ 7191 public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level"; 7192 7193 /** 7194 * If 1, the activity manager will aggressively finish activities and 7195 * processes as soon as they are no longer needed. If 0, the normal 7196 * extended lifetime is used. 7197 */ 7198 public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; 7199 7200 /** 7201 * Use Dock audio output for media: 7202 * 0 = disabled 7203 * 1 = enabled 7204 * @hide 7205 */ 7206 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; 7207 7208 /** 7209 * Persisted safe headphone volume management state by AudioService 7210 * @hide 7211 */ 7212 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; 7213 7214 /** 7215 * URL for tzinfo (time zone) updates 7216 * @hide 7217 */ 7218 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url"; 7219 7220 /** 7221 * URL for tzinfo (time zone) update metadata 7222 * @hide 7223 */ 7224 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url"; 7225 7226 /** 7227 * URL for selinux (mandatory access control) updates 7228 * @hide 7229 */ 7230 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url"; 7231 7232 /** 7233 * URL for selinux (mandatory access control) update metadata 7234 * @hide 7235 */ 7236 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url"; 7237 7238 /** 7239 * URL for sms short code updates 7240 * @hide 7241 */ 7242 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL = 7243 "sms_short_codes_content_url"; 7244 7245 /** 7246 * URL for sms short code update metadata 7247 * @hide 7248 */ 7249 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL = 7250 "sms_short_codes_metadata_url"; 7251 7252 /** 7253 * URL for cert pinlist updates 7254 * @hide 7255 */ 7256 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url"; 7257 7258 /** 7259 * URL for cert pinlist updates 7260 * @hide 7261 */ 7262 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url"; 7263 7264 /** 7265 * URL for intent firewall updates 7266 * @hide 7267 */ 7268 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL = 7269 "intent_firewall_content_url"; 7270 7271 /** 7272 * URL for intent firewall update metadata 7273 * @hide 7274 */ 7275 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL = 7276 "intent_firewall_metadata_url"; 7277 7278 /** 7279 * SELinux enforcement status. If 0, permissive; if 1, enforcing. 7280 * @hide 7281 */ 7282 public static final String SELINUX_STATUS = "selinux_status"; 7283 7284 /** 7285 * Developer setting to force RTL layout. 7286 * @hide 7287 */ 7288 public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl"; 7289 7290 /** 7291 * Milliseconds after screen-off after which low battery sounds will be silenced. 7292 * 7293 * If zero, battery sounds will always play. 7294 * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider. 7295 * 7296 * @hide 7297 */ 7298 public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout"; 7299 7300 /** 7301 * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after 7302 * the caller is done with this, they should call {@link ContentResolver#delete} to 7303 * clean up any value that they may have written. 7304 * 7305 * @hide 7306 */ 7307 public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms"; 7308 7309 /** 7310 * Defines global runtime overrides to window policy. 7311 * 7312 * See {@link com.android.server.policy.PolicyControl} for value format. 7313 * 7314 * @hide 7315 */ 7316 public static final String POLICY_CONTROL = "policy_control"; 7317 7318 /** 7319 * Defines global zen mode. ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS, 7320 * or ZEN_MODE_NO_INTERRUPTIONS. 7321 * 7322 * @hide 7323 */ 7324 public static final String ZEN_MODE = "zen_mode"; 7325 7326 /** @hide */ public static final int ZEN_MODE_OFF = 0; 7327 /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1; 7328 /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2; 7329 /** @hide */ public static final int ZEN_MODE_ALARMS = 3; 7330 7331 /** @hide */ public static String zenModeToString(int mode) { 7332 if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS"; 7333 if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS"; 7334 if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS"; 7335 return "ZEN_MODE_OFF"; 7336 } 7337 7338 /** @hide */ public static boolean isValidZenMode(int value) { 7339 switch (value) { 7340 case Global.ZEN_MODE_OFF: 7341 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: 7342 case Global.ZEN_MODE_ALARMS: 7343 case Global.ZEN_MODE_NO_INTERRUPTIONS: 7344 return true; 7345 default: 7346 return false; 7347 } 7348 } 7349 7350 /** 7351 * Opaque value, changes when persisted zen mode configuration changes. 7352 * 7353 * @hide 7354 */ 7355 public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; 7356 7357 /** 7358 * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. 7359 * 7360 * @hide 7361 */ 7362 public static final String HEADS_UP_NOTIFICATIONS_ENABLED = 7363 "heads_up_notifications_enabled"; 7364 7365 /** @hide */ public static final int HEADS_UP_OFF = 0; 7366 /** @hide */ public static final int HEADS_UP_ON = 1; 7367 7368 /** 7369 * The name of the device 7370 * 7371 * @hide 7372 */ 7373 public static final String DEVICE_NAME = "device_name"; 7374 7375 /** 7376 * Whether it should be possible to create a guest user on the device. 7377 * <p> 7378 * Type: int (0 for disabled, 1 for enabled) 7379 * @hide 7380 */ 7381 public static final String GUEST_USER_ENABLED = "guest_user_enabled"; 7382 7383 /** 7384 * Whether the NetworkScoringService has been first initialized. 7385 * <p> 7386 * Type: int (0 for false, 1 for true) 7387 * @hide 7388 */ 7389 public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned"; 7390 7391 /** 7392 * Whether the user wants to be prompted for password to decrypt the device on boot. 7393 * This only matters if the storage is encrypted. 7394 * <p> 7395 * Type: int (0 for false, 1 for true) 7396 * @hide 7397 */ 7398 public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt"; 7399 7400 /** 7401 * Whether the Volte/VT is enabled 7402 * <p> 7403 * Type: int (0 for false, 1 for true) 7404 * @hide 7405 */ 7406 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; 7407 7408 /** 7409 * Whether WFC is enabled 7410 * <p> 7411 * Type: int (0 for false, 1 for true) 7412 * 7413 * @hide 7414 */ 7415 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled"; 7416 7417 /** 7418 * WFC Mode. 7419 * <p> 7420 * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only 7421 * 7422 * @hide 7423 */ 7424 public static final String WFC_IMS_MODE = "wfc_ims_mode"; 7425 7426 /** 7427 * Whether WFC roaming is enabled 7428 * <p> 7429 * Type: int (0 for false, 1 for true) 7430 * 7431 * @hide 7432 */ 7433 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled"; 7434 7435 /** 7436 * Global override to disable VoLTE (independent of user setting) 7437 * <p> 7438 * Type: int (1 for disable VoLTE, 0 to use user configuration) 7439 * @hide 7440 */ 7441 public static final String VOLTE_FEATURE_DISABLED = "volte_feature_disabled"; 7442 7443 /** 7444 * Whether user can enable/disable LTE as a preferred network. A carrier might control 7445 * this via gservices, OMA-DM, carrier app, etc. 7446 * <p> 7447 * Type: int (0 for false, 1 for true) 7448 * @hide 7449 */ 7450 public static final String LTE_SERVICE_FORCED = "lte_service_forced"; 7451 7452 /** 7453 * Settings to backup. This is here so that it's in the same place as the settings 7454 * keys and easy to update. 7455 * 7456 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System 7457 * and Secure as well. This is because those tables drive both backup and 7458 * restore, and restore needs to properly whitelist keys that used to live 7459 * in those namespaces. The keys will only actually be backed up / restored 7460 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). 7461 * 7462 * NOTE: Settings are backed up and restored in the order they appear 7463 * in this array. If you have one setting depending on another, 7464 * make sure that they are ordered appropriately. 7465 * 7466 * @hide 7467 */ 7468 public static final String[] SETTINGS_TO_BACKUP = { 7469 BUGREPORT_IN_POWER_MENU, 7470 STAY_ON_WHILE_PLUGGED_IN, 7471 AUTO_TIME, 7472 AUTO_TIME_ZONE, 7473 POWER_SOUNDS_ENABLED, 7474 DOCK_SOUNDS_ENABLED, 7475 USB_MASS_STORAGE_ENABLED, 7476 ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 7477 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 7478 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 7479 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 7480 WIFI_NUM_OPEN_NETWORKS_KEPT, 7481 EMERGENCY_TONE, 7482 CALL_AUTO_RETRY, 7483 DOCK_AUDIO_MEDIA_ENABLED, 7484 LOW_POWER_MODE_TRIGGER_LEVEL 7485 }; 7486 7487 // Populated lazily, guarded by class object: 7488 private static NameValueCache sNameValueCache = new NameValueCache( 7489 SYS_PROP_SETTING_VERSION, 7490 CONTENT_URI, 7491 CALL_METHOD_GET_GLOBAL, 7492 CALL_METHOD_PUT_GLOBAL); 7493 7494 // Certain settings have been moved from global to the per-user secure namespace 7495 private static final HashSet<String> MOVED_TO_SECURE; 7496 static { 7497 MOVED_TO_SECURE = new HashSet<String>(1); 7498 MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); 7499 } 7500 7501 /** @hide */ 7502 public static void getMovedToSecureSettings(Set<String> outKeySet) { 7503 outKeySet.addAll(MOVED_TO_SECURE); 7504 } 7505 7506 /** 7507 * Look up a name in the database. 7508 * @param resolver to access the database with 7509 * @param name to look up in the table 7510 * @return the corresponding value, or null if not present 7511 */ 7512 public static String getString(ContentResolver resolver, String name) { 7513 return getStringForUser(resolver, name, UserHandle.myUserId()); 7514 } 7515 7516 /** @hide */ 7517 public static String getStringForUser(ContentResolver resolver, String name, 7518 int userHandle) { 7519 if (MOVED_TO_SECURE.contains(name)) { 7520 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 7521 + " to android.provider.Settings.Secure, returning read-only value."); 7522 return Secure.getStringForUser(resolver, name, userHandle); 7523 } 7524 return sNameValueCache.getStringForUser(resolver, name, userHandle); 7525 } 7526 7527 /** 7528 * Store a name/value pair into the database. 7529 * @param resolver to access the database with 7530 * @param name to store 7531 * @param value to associate with the name 7532 * @return true if the value was set, false on database errors 7533 */ 7534 public static boolean putString(ContentResolver resolver, 7535 String name, String value) { 7536 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 7537 } 7538 7539 /** @hide */ 7540 public static boolean putStringForUser(ContentResolver resolver, 7541 String name, String value, int userHandle) { 7542 if (LOCAL_LOGV) { 7543 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value 7544 + " for " + userHandle); 7545 } 7546 // Global and Secure have the same access policy so we can forward writes 7547 if (MOVED_TO_SECURE.contains(name)) { 7548 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 7549 + " to android.provider.Settings.Secure, value is unchanged."); 7550 return Secure.putStringForUser(resolver, name, value, userHandle); 7551 } 7552 return sNameValueCache.putStringForUser(resolver, name, value, userHandle); 7553 } 7554 7555 /** 7556 * Construct the content URI for a particular name/value pair, 7557 * useful for monitoring changes with a ContentObserver. 7558 * @param name to look up in the table 7559 * @return the corresponding content URI, or null if not present 7560 */ 7561 public static Uri getUriFor(String name) { 7562 return getUriFor(CONTENT_URI, name); 7563 } 7564 7565 /** 7566 * Convenience function for retrieving a single secure settings value 7567 * as an integer. Note that internally setting values are always 7568 * stored as strings; this function converts the string to an integer 7569 * for you. The default value will be returned if the setting is 7570 * not defined or not an integer. 7571 * 7572 * @param cr The ContentResolver to access. 7573 * @param name The name of the setting to retrieve. 7574 * @param def Value to return if the setting is not defined. 7575 * 7576 * @return The setting's current value, or 'def' if it is not defined 7577 * or not a valid integer. 7578 */ 7579 public static int getInt(ContentResolver cr, String name, int def) { 7580 String v = getString(cr, name); 7581 try { 7582 return v != null ? Integer.parseInt(v) : def; 7583 } catch (NumberFormatException e) { 7584 return def; 7585 } 7586 } 7587 7588 /** 7589 * Convenience function for retrieving a single secure settings value 7590 * as an integer. Note that internally setting values are always 7591 * stored as strings; this function converts the string to an integer 7592 * for you. 7593 * <p> 7594 * This version does not take a default value. If the setting has not 7595 * been set, or the string value is not a number, 7596 * it throws {@link SettingNotFoundException}. 7597 * 7598 * @param cr The ContentResolver to access. 7599 * @param name The name of the setting to retrieve. 7600 * 7601 * @throws SettingNotFoundException Thrown if a setting by the given 7602 * name can't be found or the setting value is not an integer. 7603 * 7604 * @return The setting's current value. 7605 */ 7606 public static int getInt(ContentResolver cr, String name) 7607 throws SettingNotFoundException { 7608 String v = getString(cr, name); 7609 try { 7610 return Integer.parseInt(v); 7611 } catch (NumberFormatException e) { 7612 throw new SettingNotFoundException(name); 7613 } 7614 } 7615 7616 /** 7617 * Convenience function for updating a single settings value as an 7618 * integer. This will either create a new entry in the table if the 7619 * given name does not exist, or modify the value of the existing row 7620 * with that name. Note that internally setting values are always 7621 * stored as strings, so this function converts the given value to a 7622 * string before storing it. 7623 * 7624 * @param cr The ContentResolver to access. 7625 * @param name The name of the setting to modify. 7626 * @param value The new value for the setting. 7627 * @return true if the value was set, false on database errors 7628 */ 7629 public static boolean putInt(ContentResolver cr, String name, int value) { 7630 return putString(cr, name, Integer.toString(value)); 7631 } 7632 7633 /** 7634 * Convenience function for retrieving a single secure settings value 7635 * as a {@code long}. Note that internally setting values are always 7636 * stored as strings; this function converts the string to a {@code long} 7637 * for you. The default value will be returned if the setting is 7638 * not defined or not a {@code long}. 7639 * 7640 * @param cr The ContentResolver to access. 7641 * @param name The name of the setting to retrieve. 7642 * @param def Value to return if the setting is not defined. 7643 * 7644 * @return The setting's current value, or 'def' if it is not defined 7645 * or not a valid {@code long}. 7646 */ 7647 public static long getLong(ContentResolver cr, String name, long def) { 7648 String valString = getString(cr, name); 7649 long value; 7650 try { 7651 value = valString != null ? Long.parseLong(valString) : def; 7652 } catch (NumberFormatException e) { 7653 value = def; 7654 } 7655 return value; 7656 } 7657 7658 /** 7659 * Convenience function for retrieving a single secure settings value 7660 * as a {@code long}. Note that internally setting values are always 7661 * stored as strings; this function converts the string to a {@code long} 7662 * for you. 7663 * <p> 7664 * This version does not take a default value. If the setting has not 7665 * been set, or the string value is not a number, 7666 * it throws {@link SettingNotFoundException}. 7667 * 7668 * @param cr The ContentResolver to access. 7669 * @param name The name of the setting to retrieve. 7670 * 7671 * @return The setting's current value. 7672 * @throws SettingNotFoundException Thrown if a setting by the given 7673 * name can't be found or the setting value is not an integer. 7674 */ 7675 public static long getLong(ContentResolver cr, String name) 7676 throws SettingNotFoundException { 7677 String valString = getString(cr, name); 7678 try { 7679 return Long.parseLong(valString); 7680 } catch (NumberFormatException e) { 7681 throw new SettingNotFoundException(name); 7682 } 7683 } 7684 7685 /** 7686 * Convenience function for updating a secure settings value as a long 7687 * integer. This will either create a new entry in the table if the 7688 * given name does not exist, or modify the value of the existing row 7689 * with that name. Note that internally setting values are always 7690 * stored as strings, so this function converts the given value to a 7691 * string before storing it. 7692 * 7693 * @param cr The ContentResolver to access. 7694 * @param name The name of the setting to modify. 7695 * @param value The new value for the setting. 7696 * @return true if the value was set, false on database errors 7697 */ 7698 public static boolean putLong(ContentResolver cr, String name, long value) { 7699 return putString(cr, name, Long.toString(value)); 7700 } 7701 7702 /** 7703 * Convenience function for retrieving a single secure settings value 7704 * as a floating point number. Note that internally setting values are 7705 * always stored as strings; this function converts the string to an 7706 * float for you. The default value will be returned if the setting 7707 * is not defined or not a valid float. 7708 * 7709 * @param cr The ContentResolver to access. 7710 * @param name The name of the setting to retrieve. 7711 * @param def Value to return if the setting is not defined. 7712 * 7713 * @return The setting's current value, or 'def' if it is not defined 7714 * or not a valid float. 7715 */ 7716 public static float getFloat(ContentResolver cr, String name, float def) { 7717 String v = getString(cr, name); 7718 try { 7719 return v != null ? Float.parseFloat(v) : def; 7720 } catch (NumberFormatException e) { 7721 return def; 7722 } 7723 } 7724 7725 /** 7726 * Convenience function for retrieving a single secure settings value 7727 * as a float. Note that internally setting values are always 7728 * stored as strings; this function converts the string to a float 7729 * for you. 7730 * <p> 7731 * This version does not take a default value. If the setting has not 7732 * been set, or the string value is not a number, 7733 * it throws {@link SettingNotFoundException}. 7734 * 7735 * @param cr The ContentResolver to access. 7736 * @param name The name of the setting to retrieve. 7737 * 7738 * @throws SettingNotFoundException Thrown if a setting by the given 7739 * name can't be found or the setting value is not a float. 7740 * 7741 * @return The setting's current value. 7742 */ 7743 public static float getFloat(ContentResolver cr, String name) 7744 throws SettingNotFoundException { 7745 String v = getString(cr, name); 7746 if (v == null) { 7747 throw new SettingNotFoundException(name); 7748 } 7749 try { 7750 return Float.parseFloat(v); 7751 } catch (NumberFormatException e) { 7752 throw new SettingNotFoundException(name); 7753 } 7754 } 7755 7756 /** 7757 * Convenience function for updating a single settings value as a 7758 * floating point number. This will either create a new entry in the 7759 * table if the given name does not exist, or modify the value of the 7760 * existing row with that name. Note that internally setting values 7761 * are always stored as strings, so this function converts the given 7762 * value to a string before storing it. 7763 * 7764 * @param cr The ContentResolver to access. 7765 * @param name The name of the setting to modify. 7766 * @param value The new value for the setting. 7767 * @return true if the value was set, false on database errors 7768 */ 7769 public static boolean putFloat(ContentResolver cr, String name, float value) { 7770 return putString(cr, name, Float.toString(value)); 7771 } 7772 7773 7774 /** 7775 * Subscription to be used for voice call on a multi sim device. The supported values 7776 * are 0 = SUB1, 1 = SUB2 and etc. 7777 * @hide 7778 */ 7779 public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; 7780 7781 /** 7782 * Used to provide option to user to select subscription during dial. 7783 * The supported values are 0 = disable or 1 = enable prompt. 7784 * @hide 7785 */ 7786 public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt"; 7787 7788 /** 7789 * Subscription to be used for data call on a multi sim device. The supported values 7790 * are 0 = SUB1, 1 = SUB2 and etc. 7791 * @hide 7792 */ 7793 public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; 7794 7795 /** 7796 * Subscription to be used for SMS on a multi sim device. The supported values 7797 * are 0 = SUB1, 1 = SUB2 and etc. 7798 * @hide 7799 */ 7800 public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms"; 7801 7802 /** 7803 * Used to provide option to user to select subscription during send SMS. 7804 * The value 1 - enable, 0 - disable 7805 * @hide 7806 */ 7807 public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt"; 7808 7809 7810 7811 /** User preferred subscriptions setting. 7812 * This holds the details of the user selected subscription from the card and 7813 * the activation status. Each settings string have the coma separated values 7814 * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index 7815 * @hide 7816 */ 7817 public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1", 7818 "user_preferred_sub2","user_preferred_sub3"}; 7819 7820 /** 7821 * Whether to enable new contacts aggregator or not. 7822 * The value 1 - enable, 0 - disable 7823 * @hide 7824 */ 7825 public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator"; 7826 7827 /** 7828 * Whether to enable contacts metadata syncing or not 7829 * The value 1 - enable, 0 - disable 7830 * @hide 7831 */ 7832 public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync"; 7833 } 7834 7835 /** 7836 * User-defined bookmarks and shortcuts. The target of each bookmark is an 7837 * Intent URL, allowing it to be either a web page or a particular 7838 * application activity. 7839 * 7840 * @hide 7841 */ 7842 public static final class Bookmarks implements BaseColumns 7843 { 7844 private static final String TAG = "Bookmarks"; 7845 7846 /** 7847 * The content:// style URL for this table 7848 */ 7849 public static final Uri CONTENT_URI = 7850 Uri.parse("content://" + AUTHORITY + "/bookmarks"); 7851 7852 /** 7853 * The row ID. 7854 * <p>Type: INTEGER</p> 7855 */ 7856 public static final String ID = "_id"; 7857 7858 /** 7859 * Descriptive name of the bookmark that can be displayed to the user. 7860 * If this is empty, the title should be resolved at display time (use 7861 * {@link #getTitle(Context, Cursor)} any time you want to display the 7862 * title of a bookmark.) 7863 * <P> 7864 * Type: TEXT 7865 * </P> 7866 */ 7867 public static final String TITLE = "title"; 7868 7869 /** 7870 * Arbitrary string (displayed to the user) that allows bookmarks to be 7871 * organized into categories. There are some special names for 7872 * standard folders, which all start with '@'. The label displayed for 7873 * the folder changes with the locale (via {@link #getLabelForFolder}) but 7874 * the folder name does not change so you can consistently query for 7875 * the folder regardless of the current locale. 7876 * 7877 * <P>Type: TEXT</P> 7878 * 7879 */ 7880 public static final String FOLDER = "folder"; 7881 7882 /** 7883 * The Intent URL of the bookmark, describing what it points to. This 7884 * value is given to {@link android.content.Intent#getIntent} to create 7885 * an Intent that can be launched. 7886 * <P>Type: TEXT</P> 7887 */ 7888 public static final String INTENT = "intent"; 7889 7890 /** 7891 * Optional shortcut character associated with this bookmark. 7892 * <P>Type: INTEGER</P> 7893 */ 7894 public static final String SHORTCUT = "shortcut"; 7895 7896 /** 7897 * The order in which the bookmark should be displayed 7898 * <P>Type: INTEGER</P> 7899 */ 7900 public static final String ORDERING = "ordering"; 7901 7902 private static final String[] sIntentProjection = { INTENT }; 7903 private static final String[] sShortcutProjection = { ID, SHORTCUT }; 7904 private static final String sShortcutSelection = SHORTCUT + "=?"; 7905 7906 /** 7907 * Convenience function to retrieve the bookmarked Intent for a 7908 * particular shortcut key. 7909 * 7910 * @param cr The ContentResolver to query. 7911 * @param shortcut The shortcut key. 7912 * 7913 * @return Intent The bookmarked URL, or null if there is no bookmark 7914 * matching the given shortcut. 7915 */ 7916 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut) 7917 { 7918 Intent intent = null; 7919 7920 Cursor c = cr.query(CONTENT_URI, 7921 sIntentProjection, sShortcutSelection, 7922 new String[] { String.valueOf((int) shortcut) }, ORDERING); 7923 // Keep trying until we find a valid shortcut 7924 try { 7925 while (intent == null && c.moveToNext()) { 7926 try { 7927 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT)); 7928 intent = Intent.parseUri(intentURI, 0); 7929 } catch (java.net.URISyntaxException e) { 7930 // The stored URL is bad... ignore it. 7931 } catch (IllegalArgumentException e) { 7932 // Column not found 7933 Log.w(TAG, "Intent column not found", e); 7934 } 7935 } 7936 } finally { 7937 if (c != null) c.close(); 7938 } 7939 7940 return intent; 7941 } 7942 7943 /** 7944 * Add a new bookmark to the system. 7945 * 7946 * @param cr The ContentResolver to query. 7947 * @param intent The desired target of the bookmark. 7948 * @param title Bookmark title that is shown to the user; null if none 7949 * or it should be resolved to the intent's title. 7950 * @param folder Folder in which to place the bookmark; null if none. 7951 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If 7952 * this is non-zero and there is an existing bookmark entry 7953 * with this same shortcut, then that existing shortcut is 7954 * cleared (the bookmark is not removed). 7955 * @return The unique content URL for the new bookmark entry. 7956 */ 7957 public static Uri add(ContentResolver cr, 7958 Intent intent, 7959 String title, 7960 String folder, 7961 char shortcut, 7962 int ordering) 7963 { 7964 // If a shortcut is supplied, and it is already defined for 7965 // another bookmark, then remove the old definition. 7966 if (shortcut != 0) { 7967 cr.delete(CONTENT_URI, sShortcutSelection, 7968 new String[] { String.valueOf((int) shortcut) }); 7969 } 7970 7971 ContentValues values = new ContentValues(); 7972 if (title != null) values.put(TITLE, title); 7973 if (folder != null) values.put(FOLDER, folder); 7974 values.put(INTENT, intent.toUri(0)); 7975 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut); 7976 values.put(ORDERING, ordering); 7977 return cr.insert(CONTENT_URI, values); 7978 } 7979 7980 /** 7981 * Return the folder name as it should be displayed to the user. This 7982 * takes care of localizing special folders. 7983 * 7984 * @param r Resources object for current locale; only need access to 7985 * system resources. 7986 * @param folder The value found in the {@link #FOLDER} column. 7987 * 7988 * @return CharSequence The label for this folder that should be shown 7989 * to the user. 7990 */ 7991 public static CharSequence getLabelForFolder(Resources r, String folder) { 7992 return folder; 7993 } 7994 7995 /** 7996 * Return the title as it should be displayed to the user. This takes 7997 * care of localizing bookmarks that point to activities. 7998 * 7999 * @param context A context. 8000 * @param cursor A cursor pointing to the row whose title should be 8001 * returned. The cursor must contain at least the {@link #TITLE} 8002 * and {@link #INTENT} columns. 8003 * @return A title that is localized and can be displayed to the user, 8004 * or the empty string if one could not be found. 8005 */ 8006 public static CharSequence getTitle(Context context, Cursor cursor) { 8007 int titleColumn = cursor.getColumnIndex(TITLE); 8008 int intentColumn = cursor.getColumnIndex(INTENT); 8009 if (titleColumn == -1 || intentColumn == -1) { 8010 throw new IllegalArgumentException( 8011 "The cursor must contain the TITLE and INTENT columns."); 8012 } 8013 8014 String title = cursor.getString(titleColumn); 8015 if (!TextUtils.isEmpty(title)) { 8016 return title; 8017 } 8018 8019 String intentUri = cursor.getString(intentColumn); 8020 if (TextUtils.isEmpty(intentUri)) { 8021 return ""; 8022 } 8023 8024 Intent intent; 8025 try { 8026 intent = Intent.parseUri(intentUri, 0); 8027 } catch (URISyntaxException e) { 8028 return ""; 8029 } 8030 8031 PackageManager packageManager = context.getPackageManager(); 8032 ResolveInfo info = packageManager.resolveActivity(intent, 0); 8033 return info != null ? info.loadLabel(packageManager) : ""; 8034 } 8035 } 8036 8037 /** 8038 * Returns the device ID that we should use when connecting to the mobile gtalk server. 8039 * This is a string like "android-0x1242", where the hex string is the Android ID obtained 8040 * from the GoogleLoginService. 8041 * 8042 * @param androidId The Android ID for this device. 8043 * @return The device ID that should be used when connecting to the mobile gtalk server. 8044 * @hide 8045 */ 8046 public static String getGTalkDeviceId(long androidId) { 8047 return "android-" + Long.toHexString(androidId); 8048 } 8049} 8050