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