Settings.java revision fac595ae56badaee5ad52f1d47aaa98d8bafb432
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.Manifest; 20import android.annotation.IntDef; 21import android.annotation.IntRange; 22import android.annotation.NonNull; 23import android.annotation.Nullable; 24import android.annotation.RequiresPermission; 25import android.annotation.SdkConstant; 26import android.annotation.SdkConstant.SdkConstantType; 27import android.annotation.SystemApi; 28import android.annotation.TestApi; 29import android.annotation.UserIdInt; 30import android.app.ActivityThread; 31import android.app.AppOpsManager; 32import android.app.Application; 33import android.app.SearchManager; 34import android.app.WallpaperManager; 35import android.content.ComponentName; 36import android.content.ContentResolver; 37import android.content.ContentValues; 38import android.content.Context; 39import android.content.IContentProvider; 40import android.content.Intent; 41import android.content.pm.ActivityInfo; 42import android.content.pm.PackageManager; 43import android.content.pm.ResolveInfo; 44import android.content.res.Configuration; 45import android.content.res.Resources; 46import android.database.Cursor; 47import android.database.SQLException; 48import android.location.LocationManager; 49import android.net.ConnectivityManager; 50import android.net.Uri; 51import android.net.wifi.WifiManager; 52import android.os.BatteryManager; 53import android.os.Build.VERSION_CODES; 54import android.os.Bundle; 55import android.os.DropBoxManager; 56import android.os.IBinder; 57import android.os.LocaleList; 58import android.os.Process; 59import android.os.RemoteException; 60import android.os.ServiceManager; 61import android.os.UserHandle; 62import android.speech.tts.TextToSpeech; 63import android.text.TextUtils; 64import android.util.AndroidException; 65import android.util.ArrayMap; 66import android.util.ArraySet; 67import android.util.Log; 68import android.util.MemoryIntArray; 69 70import com.android.internal.annotations.GuardedBy; 71import com.android.internal.util.ArrayUtils; 72import com.android.internal.widget.ILockSettings; 73 74import java.io.IOException; 75import java.lang.annotation.Retention; 76import java.lang.annotation.RetentionPolicy; 77import java.net.URISyntaxException; 78import java.text.SimpleDateFormat; 79import java.util.HashMap; 80import java.util.HashSet; 81import java.util.Locale; 82import java.util.Map; 83import java.util.Set; 84 85/** 86 * The Settings provider contains global system-level device preferences. 87 */ 88public final class Settings { 89 90 // Intent actions for Settings 91 92 /** 93 * Activity Action: Show system settings. 94 * <p> 95 * Input: Nothing. 96 * <p> 97 * Output: Nothing. 98 */ 99 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 100 public static final String ACTION_SETTINGS = "android.settings.SETTINGS"; 101 102 /** 103 * Activity Action: Show settings to allow configuration of APNs. 104 * <p> 105 * Input: Nothing. 106 * <p> 107 * Output: Nothing. 108 */ 109 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 110 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS"; 111 112 /** 113 * Activity Action: Show settings to allow configuration of current location 114 * sources. 115 * <p> 116 * In some cases, a matching Activity may not exist, so ensure you 117 * safeguard against this. 118 * <p> 119 * Input: Nothing. 120 * <p> 121 * Output: Nothing. 122 */ 123 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 124 public static final String ACTION_LOCATION_SOURCE_SETTINGS = 125 "android.settings.LOCATION_SOURCE_SETTINGS"; 126 127 /** 128 * Activity Action: Show settings to allow configuration of users. 129 * <p> 130 * In some cases, a matching Activity may not exist, so ensure you 131 * safeguard against this. 132 * <p> 133 * Input: Nothing. 134 * <p> 135 * Output: Nothing. 136 * @hide 137 */ 138 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 139 public static final String ACTION_USER_SETTINGS = 140 "android.settings.USER_SETTINGS"; 141 142 /** 143 * Activity Action: Show settings to allow configuration of wireless controls 144 * such as Wi-Fi, Bluetooth and Mobile networks. 145 * <p> 146 * In some cases, a matching Activity may not exist, so ensure you 147 * safeguard against this. 148 * <p> 149 * Input: Nothing. 150 * <p> 151 * Output: Nothing. 152 */ 153 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 154 public static final String ACTION_WIRELESS_SETTINGS = 155 "android.settings.WIRELESS_SETTINGS"; 156 157 /** 158 * Activity Action: Show tether provisioning activity. 159 * 160 * <p> 161 * In some cases, a matching Activity may not exist, so ensure you 162 * safeguard against this. 163 * <p> 164 * Input: {@link ConnectivityManager.EXTRA_TETHER_TYPE} should be included to specify which type 165 * of tethering should be checked. {@link ConnectivityManager.EXTRA_PROVISION_CALLBACK} should 166 * contain a {@link ResultReceiver} which will be called back with a tether result code. 167 * <p> 168 * Output: The result of the provisioning check. 169 * {@link ConnectivityManager.TETHER_ERROR_NO_ERROR} if successful, 170 * {@link ConnectivityManager.TETHER_ERROR_PROVISION_FAILED} for failure. 171 * 172 * @hide 173 */ 174 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 175 public static final String ACTION_TETHER_PROVISIONING = 176 "android.settings.TETHER_PROVISIONING_UI"; 177 178 /** 179 * Activity Action: Show settings to allow entering/exiting airplane mode. 180 * <p> 181 * In some cases, a matching Activity may not exist, so ensure you 182 * safeguard against this. 183 * <p> 184 * Input: Nothing. 185 * <p> 186 * Output: Nothing. 187 */ 188 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 189 public static final String ACTION_AIRPLANE_MODE_SETTINGS = 190 "android.settings.AIRPLANE_MODE_SETTINGS"; 191 192 /** 193 * Activity Action: Modify Airplane mode settings using a voice command. 194 * <p> 195 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 196 * <p> 197 * This intent MUST be started using 198 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 199 * startVoiceActivity}. 200 * <p> 201 * Note: The activity implementing this intent MUST verify that 202 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before 203 * modifying the setting. 204 * <p> 205 * Input: To tell which state airplane mode should be set to, add the 206 * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified. 207 * If the extra is not included, no changes will be made. 208 * <p> 209 * Output: Nothing. 210 */ 211 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 212 public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE = 213 "android.settings.VOICE_CONTROL_AIRPLANE_MODE"; 214 215 /** 216 * Activity Action: Show settings for accessibility modules. 217 * <p> 218 * In some cases, a matching Activity may not exist, so ensure you 219 * safeguard against this. 220 * <p> 221 * Input: Nothing. 222 * <p> 223 * Output: Nothing. 224 */ 225 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 226 public static final String ACTION_ACCESSIBILITY_SETTINGS = 227 "android.settings.ACCESSIBILITY_SETTINGS"; 228 229 /** 230 * Activity Action: Show settings to control access to usage information. 231 * <p> 232 * In some cases, a matching Activity may not exist, so ensure you 233 * safeguard against this. 234 * <p> 235 * Input: Nothing. 236 * <p> 237 * Output: Nothing. 238 */ 239 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 240 public static final String ACTION_USAGE_ACCESS_SETTINGS = 241 "android.settings.USAGE_ACCESS_SETTINGS"; 242 243 /** 244 * Activity Category: Show application settings related to usage access. 245 * <p> 246 * An activity that provides a user interface for adjusting usage access related 247 * preferences for its containing application. Optional but recommended for apps that 248 * use {@link android.Manifest.permission#PACKAGE_USAGE_STATS}. 249 * <p> 250 * The activity may define meta-data to describe what usage access is 251 * used for within their app with {@link #METADATA_USAGE_ACCESS_REASON}, which 252 * will be displayed in Settings. 253 * <p> 254 * Input: Nothing. 255 * <p> 256 * Output: Nothing. 257 */ 258 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 259 public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG = 260 "android.intent.category.USAGE_ACCESS_CONFIG"; 261 262 /** 263 * Metadata key: Reason for needing usage access. 264 * <p> 265 * A key for metadata attached to an activity that receives action 266 * {@link #INTENT_CATEGORY_USAGE_ACCESS_CONFIG}, shown to the 267 * user as description of how the app uses usage access. 268 * <p> 269 */ 270 public static final String METADATA_USAGE_ACCESS_REASON = 271 "android.settings.metadata.USAGE_ACCESS_REASON"; 272 273 /** 274 * Activity Action: Show settings to allow configuration of security and 275 * location privacy. 276 * <p> 277 * In some cases, a matching Activity may not exist, so ensure you 278 * safeguard against this. 279 * <p> 280 * Input: Nothing. 281 * <p> 282 * Output: Nothing. 283 */ 284 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 285 public static final String ACTION_SECURITY_SETTINGS = 286 "android.settings.SECURITY_SETTINGS"; 287 288 /** 289 * Activity Action: Show trusted credentials settings, opening to the user tab, 290 * to allow management of installed credentials. 291 * <p> 292 * In some cases, a matching Activity may not exist, so ensure you 293 * safeguard against this. 294 * <p> 295 * Input: Nothing. 296 * <p> 297 * Output: Nothing. 298 * @hide 299 */ 300 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 301 public static final String ACTION_TRUSTED_CREDENTIALS_USER = 302 "com.android.settings.TRUSTED_CREDENTIALS_USER"; 303 304 /** 305 * Activity Action: Show dialog explaining that an installed CA cert may enable 306 * monitoring of encrypted network traffic. 307 * <p> 308 * In some cases, a matching Activity may not exist, so ensure you 309 * safeguard against this. Add {@link #EXTRA_NUMBER_OF_CERTIFICATES} extra to indicate the 310 * number of certificates. 311 * <p> 312 * Input: Nothing. 313 * <p> 314 * Output: Nothing. 315 * @hide 316 */ 317 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 318 public static final String ACTION_MONITORING_CERT_INFO = 319 "com.android.settings.MONITORING_CERT_INFO"; 320 321 /** 322 * Activity Action: Show settings to allow configuration of privacy options. 323 * <p> 324 * In some cases, a matching Activity may not exist, so ensure you 325 * safeguard against this. 326 * <p> 327 * Input: Nothing. 328 * <p> 329 * Output: Nothing. 330 */ 331 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 332 public static final String ACTION_PRIVACY_SETTINGS = 333 "android.settings.PRIVACY_SETTINGS"; 334 335 /** 336 * Activity Action: Show settings to allow configuration of VPN. 337 * <p> 338 * In some cases, a matching Activity may not exist, so ensure you 339 * safeguard against this. 340 * <p> 341 * Input: Nothing. 342 * <p> 343 * Output: Nothing. 344 */ 345 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 346 public static final String ACTION_VPN_SETTINGS = 347 "android.settings.VPN_SETTINGS"; 348 349 /** 350 * Activity Action: Show settings to allow configuration of Wi-Fi. 351 * <p> 352 * In some cases, a matching Activity may not exist, so ensure you 353 * safeguard against this. 354 * <p> 355 * Input: Nothing. 356 * <p> 357 * Output: Nothing. 358 */ 359 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 360 public static final String ACTION_WIFI_SETTINGS = 361 "android.settings.WIFI_SETTINGS"; 362 363 /** 364 * Activity Action: Show settings to allow configuration of a static IP 365 * address for Wi-Fi. 366 * <p> 367 * In some cases, a matching Activity may not exist, so ensure you safeguard 368 * against this. 369 * <p> 370 * Input: Nothing. 371 * <p> 372 * Output: Nothing. 373 */ 374 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 375 public static final String ACTION_WIFI_IP_SETTINGS = 376 "android.settings.WIFI_IP_SETTINGS"; 377 378 /** 379 * Activity Action: Show settings to allow the configuration of Wi-Fi features. 380 * <p> 381 * In some cases, a matching Activity may not exist, so ensure you 382 * safeguard against this. 383 * <p> 384 * Input: Nothing. 385 * <p> 386 * Output: Nothing. 387 * @hide 388 */ 389 @SystemApi 390 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 391 public static final String ACTION_CONFIGURE_WIFI_SETTINGS = 392 "android.settings.CONFIGURE_WIFI_SETTINGS"; 393 394 /** 395 * Activity Action: Show settings to allow configuration of Wi-Fi saved networks. 396 * <p> 397 * In some cases, a matching Activity may not exist, so ensure you 398 * safeguard against this. 399 * <p> 400 * Input: Nothing. 401 * <p> 402 * Output: Nothing. 403 * @hide 404 */ 405 @SystemApi 406 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 407 public static final String ACTION_WIFI_SAVED_NETWORK_SETTINGS = 408 "android.settings.WIFI_SAVED_NETWORK_SETTINGS"; 409 410 /** 411 * Activity Action: Show settings to allow configuration of Bluetooth. 412 * <p> 413 * In some cases, a matching Activity may not exist, so ensure you 414 * safeguard against this. 415 * <p> 416 * Input: Nothing. 417 * <p> 418 * Output: Nothing. 419 */ 420 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 421 public static final String ACTION_BLUETOOTH_SETTINGS = 422 "android.settings.BLUETOOTH_SETTINGS"; 423 424 /** 425 * Activity Action: Show settings to allow configuration of cast endpoints. 426 * <p> 427 * In some cases, a matching Activity may not exist, so ensure you 428 * safeguard against this. 429 * <p> 430 * Input: Nothing. 431 * <p> 432 * Output: Nothing. 433 */ 434 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 435 public static final String ACTION_CAST_SETTINGS = 436 "android.settings.CAST_SETTINGS"; 437 438 /** 439 * Activity Action: Show settings to allow configuration of date and time. 440 * <p> 441 * In some cases, a matching Activity may not exist, so ensure you 442 * safeguard against this. 443 * <p> 444 * Input: Nothing. 445 * <p> 446 * Output: Nothing. 447 */ 448 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 449 public static final String ACTION_DATE_SETTINGS = 450 "android.settings.DATE_SETTINGS"; 451 452 /** 453 * Activity Action: Show settings to allow configuration of sound and volume. 454 * <p> 455 * In some cases, a matching Activity may not exist, so ensure you 456 * safeguard against this. 457 * <p> 458 * Input: Nothing. 459 * <p> 460 * Output: Nothing. 461 */ 462 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 463 public static final String ACTION_SOUND_SETTINGS = 464 "android.settings.SOUND_SETTINGS"; 465 466 /** 467 * Activity Action: Show settings to allow configuration of display. 468 * <p> 469 * In some cases, a matching Activity may not exist, so ensure you 470 * safeguard against this. 471 * <p> 472 * Input: Nothing. 473 * <p> 474 * Output: Nothing. 475 */ 476 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 477 public static final String ACTION_DISPLAY_SETTINGS = 478 "android.settings.DISPLAY_SETTINGS"; 479 480 /** 481 * Activity Action: Show settings to allow configuration of Night display. 482 * <p> 483 * In some cases, a matching Activity may not exist, so ensure you 484 * safeguard against this. 485 * <p> 486 * Input: Nothing. 487 * <p> 488 * Output: Nothing. 489 * 490 * @hide 491 */ 492 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 493 public static final String ACTION_NIGHT_DISPLAY_SETTINGS = 494 "android.settings.NIGHT_DISPLAY_SETTINGS"; 495 496 /** 497 * Activity Action: Show settings to allow configuration of locale. 498 * <p> 499 * In some cases, a matching Activity may not exist, so ensure you 500 * safeguard against this. 501 * <p> 502 * Input: Nothing. 503 * <p> 504 * Output: Nothing. 505 */ 506 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 507 public static final String ACTION_LOCALE_SETTINGS = 508 "android.settings.LOCALE_SETTINGS"; 509 510 /** 511 * Activity Action: Show settings to configure input methods, in particular 512 * allowing the user to enable input methods. 513 * <p> 514 * In some cases, a matching Activity may not exist, so ensure you 515 * safeguard against this. 516 * <p> 517 * Input: Nothing. 518 * <p> 519 * Output: Nothing. 520 */ 521 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 522 public static final String ACTION_VOICE_INPUT_SETTINGS = 523 "android.settings.VOICE_INPUT_SETTINGS"; 524 525 /** 526 * Activity Action: Show settings to configure input methods, in particular 527 * allowing the user to enable input methods. 528 * <p> 529 * In some cases, a matching Activity may not exist, so ensure you 530 * safeguard against this. 531 * <p> 532 * Input: Nothing. 533 * <p> 534 * Output: Nothing. 535 */ 536 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 537 public static final String ACTION_INPUT_METHOD_SETTINGS = 538 "android.settings.INPUT_METHOD_SETTINGS"; 539 540 /** 541 * Activity Action: Show settings to enable/disable input method subtypes. 542 * <p> 543 * In some cases, a matching Activity may not exist, so ensure you 544 * safeguard against this. 545 * <p> 546 * To tell which input method's subtypes are displayed in the settings, add 547 * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id. 548 * If there is no extra in this Intent, subtypes from all installed input methods 549 * will be displayed in the settings. 550 * 551 * @see android.view.inputmethod.InputMethodInfo#getId 552 * <p> 553 * Input: Nothing. 554 * <p> 555 * Output: Nothing. 556 */ 557 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 558 public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = 559 "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"; 560 561 /** 562 * Activity Action: Show a dialog to select input method. 563 * <p> 564 * In some cases, a matching Activity may not exist, so ensure you 565 * safeguard against this. 566 * <p> 567 * Input: Nothing. 568 * <p> 569 * Output: Nothing. 570 * @hide 571 */ 572 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 573 public static final String ACTION_SHOW_INPUT_METHOD_PICKER = 574 "android.settings.SHOW_INPUT_METHOD_PICKER"; 575 576 /** 577 * Activity Action: Show settings to manage the user input dictionary. 578 * <p> 579 * Starting with {@link android.os.Build.VERSION_CODES#KITKAT}, 580 * it is guaranteed there will always be an appropriate implementation for this Intent action. 581 * In prior releases of the platform this was optional, so ensure you safeguard against it. 582 * <p> 583 * Input: Nothing. 584 * <p> 585 * Output: Nothing. 586 */ 587 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 588 public static final String ACTION_USER_DICTIONARY_SETTINGS = 589 "android.settings.USER_DICTIONARY_SETTINGS"; 590 591 /** 592 * Activity Action: Show settings to configure the hardware keyboard. 593 * <p> 594 * In some cases, a matching Activity may not exist, so ensure you 595 * safeguard against this. 596 * <p> 597 * Input: Nothing. 598 * <p> 599 * Output: Nothing. 600 */ 601 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 602 public static final String ACTION_HARD_KEYBOARD_SETTINGS = 603 "android.settings.HARD_KEYBOARD_SETTINGS"; 604 605 /** 606 * Activity Action: Adds a word to the user dictionary. 607 * <p> 608 * In some cases, a matching Activity may not exist, so ensure you 609 * safeguard against this. 610 * <p> 611 * Input: An extra with key <code>word</code> that contains the word 612 * that should be added to the dictionary. 613 * <p> 614 * Output: Nothing. 615 * 616 * @hide 617 */ 618 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 619 public static final String ACTION_USER_DICTIONARY_INSERT = 620 "com.android.settings.USER_DICTIONARY_INSERT"; 621 622 /** 623 * Activity Action: Show settings to allow configuration of application-related settings. 624 * <p> 625 * In some cases, a matching Activity may not exist, so ensure you 626 * safeguard against this. 627 * <p> 628 * Input: Nothing. 629 * <p> 630 * Output: Nothing. 631 */ 632 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 633 public static final String ACTION_APPLICATION_SETTINGS = 634 "android.settings.APPLICATION_SETTINGS"; 635 636 /** 637 * Activity Action: Show settings to allow configuration of application 638 * development-related settings. As of 639 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is 640 * a required part of the platform. 641 * <p> 642 * Input: Nothing. 643 * <p> 644 * Output: Nothing. 645 */ 646 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 647 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = 648 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"; 649 650 /** 651 * Activity Action: Show settings to allow configuration of quick launch shortcuts. 652 * <p> 653 * In some cases, a matching Activity may not exist, so ensure you 654 * safeguard against this. 655 * <p> 656 * Input: Nothing. 657 * <p> 658 * Output: Nothing. 659 */ 660 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 661 public static final String ACTION_QUICK_LAUNCH_SETTINGS = 662 "android.settings.QUICK_LAUNCH_SETTINGS"; 663 664 /** 665 * Activity Action: Show settings to manage installed applications. 666 * <p> 667 * In some cases, a matching Activity may not exist, so ensure you 668 * safeguard against this. 669 * <p> 670 * Input: Nothing. 671 * <p> 672 * Output: Nothing. 673 */ 674 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 675 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = 676 "android.settings.MANAGE_APPLICATIONS_SETTINGS"; 677 678 /** 679 * Activity Action: Show settings to manage all applications. 680 * <p> 681 * In some cases, a matching Activity may not exist, so ensure you 682 * safeguard against this. 683 * <p> 684 * Input: Nothing. 685 * <p> 686 * Output: Nothing. 687 */ 688 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 689 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = 690 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"; 691 692 /** 693 * Activity Action: Show screen for controlling which apps can draw on top of other apps. 694 * <p> 695 * In some cases, a matching Activity may not exist, so ensure you 696 * safeguard against this. 697 * <p> 698 * Input: Optionally, the Intent's data URI can specify the application package name to 699 * directly invoke the management GUI specific to the package name. For example 700 * "package:com.my.app". 701 * <p> 702 * Output: Nothing. 703 */ 704 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 705 public static final String ACTION_MANAGE_OVERLAY_PERMISSION = 706 "android.settings.action.MANAGE_OVERLAY_PERMISSION"; 707 708 /** 709 * Activity Action: Show screen for controlling which apps are allowed to write/modify 710 * system settings. 711 * <p> 712 * In some cases, a matching Activity may not exist, so ensure you 713 * safeguard against this. 714 * <p> 715 * Input: Optionally, the Intent's data URI can specify the application package name to 716 * directly invoke the management GUI specific to the package name. For example 717 * "package:com.my.app". 718 * <p> 719 * Output: Nothing. 720 */ 721 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 722 public static final String ACTION_MANAGE_WRITE_SETTINGS = 723 "android.settings.action.MANAGE_WRITE_SETTINGS"; 724 725 /** 726 * Activity Action: Show screen of details about a particular application. 727 * <p> 728 * In some cases, a matching Activity may not exist, so ensure you 729 * safeguard against this. 730 * <p> 731 * Input: The Intent's data URI specifies the application package name 732 * to be shown, with the "package" scheme. That is "package:com.my.app". 733 * <p> 734 * Output: Nothing. 735 */ 736 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 737 public static final String ACTION_APPLICATION_DETAILS_SETTINGS = 738 "android.settings.APPLICATION_DETAILS_SETTINGS"; 739 740 /** 741 * Activity Action: Show screen for controlling which apps can ignore battery optimizations. 742 * <p> 743 * Input: Nothing. 744 * <p> 745 * Output: Nothing. 746 * <p> 747 * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations 748 * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is 749 * already ignoring optimizations. You can use 750 * {@link #ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} to ask the user to put you 751 * on this list. 752 */ 753 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 754 public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS = 755 "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"; 756 757 /** 758 * Activity Action: Ask the user to allow an app to ignore battery optimizations (that is, 759 * put them on the whitelist of apps shown by 760 * {@link #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}). For an app to use this, it also 761 * must hold the {@link android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} 762 * permission. 763 * <p><b>Note:</b> most applications should <em>not</em> use this; there are many facilities 764 * provided by the platform for applications to operate correctly in the various power 765 * saving modes. This is only for unusual applications that need to deeply control their own 766 * execution, at the potential expense of the user's battery life. Note that these applications 767 * greatly run the risk of showing to the user as high power consumers on their device.</p> 768 * <p> 769 * Input: The Intent's data URI must specify the application package name 770 * to be shown, with the "package" scheme. That is "package:com.my.app". 771 * <p> 772 * Output: Nothing. 773 * <p> 774 * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations 775 * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is 776 * already ignoring optimizations. 777 */ 778 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 779 public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = 780 "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"; 781 782 /** 783 * Activity Action: Show screen for controlling background data 784 * restrictions for a particular application. 785 * <p> 786 * Input: Intent's data URI set with an application name, using the 787 * "package" schema (like "package:com.my.app"). 788 * 789 * <p> 790 * Output: Nothing. 791 * <p> 792 * Applications can also use {@link android.net.ConnectivityManager#getRestrictBackgroundStatus 793 * ConnectivityManager#getRestrictBackgroundStatus()} to determine the 794 * status of the background data restrictions for them. 795 */ 796 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 797 public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS = 798 "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS"; 799 800 /** 801 * @hide 802 * Activity Action: Show the "app ops" settings screen. 803 * <p> 804 * Input: Nothing. 805 * <p> 806 * Output: Nothing. 807 */ 808 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 809 public static final String ACTION_APP_OPS_SETTINGS = 810 "android.settings.APP_OPS_SETTINGS"; 811 812 /** 813 * Activity Action: Show settings for system update functionality. 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 * 822 * @hide 823 */ 824 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 825 public static final String ACTION_SYSTEM_UPDATE_SETTINGS = 826 "android.settings.SYSTEM_UPDATE_SETTINGS"; 827 828 /** 829 * Activity Action: Show settings to allow configuration of sync settings. 830 * <p> 831 * In some cases, a matching Activity may not exist, so ensure you 832 * safeguard against this. 833 * <p> 834 * The account types available to add via the add account button may be restricted by adding an 835 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's 836 * authorities. Only account types which can sync with that content provider will be offered to 837 * the user. 838 * <p> 839 * Input: Nothing. 840 * <p> 841 * Output: Nothing. 842 */ 843 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 844 public static final String ACTION_SYNC_SETTINGS = 845 "android.settings.SYNC_SETTINGS"; 846 847 /** 848 * Activity Action: Show add account screen for creating a new account. 849 * <p> 850 * In some cases, a matching Activity may not exist, so ensure you 851 * safeguard against this. 852 * <p> 853 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES} 854 * extra to the Intent with one or more syncable content provider's authorities. Only account 855 * types which can sync with that content provider will be offered to the user. 856 * <p> 857 * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the 858 * Intent with one or more account types. 859 * <p> 860 * Input: Nothing. 861 * <p> 862 * Output: Nothing. 863 */ 864 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 865 public static final String ACTION_ADD_ACCOUNT = 866 "android.settings.ADD_ACCOUNT_SETTINGS"; 867 868 /** 869 * Activity Action: Show settings for selecting the network operator. 870 * <p> 871 * In some cases, a matching Activity may not exist, so ensure you 872 * safeguard against this. 873 * <p> 874 * Input: Nothing. 875 * <p> 876 * Output: Nothing. 877 */ 878 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 879 public static final String ACTION_NETWORK_OPERATOR_SETTINGS = 880 "android.settings.NETWORK_OPERATOR_SETTINGS"; 881 882 /** 883 * Activity Action: Show settings for selection of 2G/3G. 884 * <p> 885 * In some cases, a matching Activity may not exist, so ensure you 886 * safeguard against this. 887 * <p> 888 * Input: Nothing. 889 * <p> 890 * Output: Nothing. 891 */ 892 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 893 public static final String ACTION_DATA_ROAMING_SETTINGS = 894 "android.settings.DATA_ROAMING_SETTINGS"; 895 896 /** 897 * Activity Action: Show settings for internal storage. 898 * <p> 899 * In some cases, a matching Activity may not exist, so ensure you 900 * safeguard against this. 901 * <p> 902 * Input: Nothing. 903 * <p> 904 * Output: Nothing. 905 */ 906 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 907 public static final String ACTION_INTERNAL_STORAGE_SETTINGS = 908 "android.settings.INTERNAL_STORAGE_SETTINGS"; 909 /** 910 * Activity Action: Show settings for memory card storage. 911 * <p> 912 * In some cases, a matching Activity may not exist, so ensure you 913 * safeguard against this. 914 * <p> 915 * Input: Nothing. 916 * <p> 917 * Output: Nothing. 918 */ 919 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 920 public static final String ACTION_MEMORY_CARD_SETTINGS = 921 "android.settings.MEMORY_CARD_SETTINGS"; 922 923 /** 924 * Activity Action: Show settings for global search. 925 * <p> 926 * In some cases, a matching Activity may not exist, so ensure you 927 * safeguard against this. 928 * <p> 929 * Input: Nothing. 930 * <p> 931 * Output: Nothing 932 */ 933 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 934 public static final String ACTION_SEARCH_SETTINGS = 935 "android.search.action.SEARCH_SETTINGS"; 936 937 /** 938 * Activity Action: Show general device information settings (serial 939 * number, software version, phone number, etc.). 940 * <p> 941 * In some cases, a matching Activity may not exist, so ensure you 942 * safeguard against this. 943 * <p> 944 * Input: Nothing. 945 * <p> 946 * Output: Nothing 947 */ 948 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 949 public static final String ACTION_DEVICE_INFO_SETTINGS = 950 "android.settings.DEVICE_INFO_SETTINGS"; 951 952 /** 953 * Activity Action: Show NFC settings. 954 * <p> 955 * This shows UI that allows NFC to be turned on or off. 956 * <p> 957 * In some cases, a matching Activity may not exist, so ensure you 958 * safeguard against this. 959 * <p> 960 * Input: Nothing. 961 * <p> 962 * Output: Nothing 963 * @see android.nfc.NfcAdapter#isEnabled() 964 */ 965 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 966 public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS"; 967 968 /** 969 * Activity Action: Show NFC Sharing settings. 970 * <p> 971 * This shows UI that allows NDEF Push (Android Beam) to be turned on or 972 * off. 973 * <p> 974 * In some cases, a matching Activity may not exist, so ensure you 975 * safeguard against this. 976 * <p> 977 * Input: Nothing. 978 * <p> 979 * Output: Nothing 980 * @see android.nfc.NfcAdapter#isNdefPushEnabled() 981 */ 982 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 983 public static final String ACTION_NFCSHARING_SETTINGS = 984 "android.settings.NFCSHARING_SETTINGS"; 985 986 /** 987 * Activity Action: Show NFC Tap & Pay settings 988 * <p> 989 * This shows UI that allows the user to configure Tap&Pay 990 * settings. 991 * <p> 992 * In some cases, a matching Activity may not exist, so ensure you 993 * safeguard against this. 994 * <p> 995 * Input: Nothing. 996 * <p> 997 * Output: Nothing 998 */ 999 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1000 public static final String ACTION_NFC_PAYMENT_SETTINGS = 1001 "android.settings.NFC_PAYMENT_SETTINGS"; 1002 1003 /** 1004 * Activity Action: Show Daydream settings. 1005 * <p> 1006 * In some cases, a matching Activity may not exist, so ensure you 1007 * safeguard against this. 1008 * <p> 1009 * Input: Nothing. 1010 * <p> 1011 * Output: Nothing. 1012 * @see android.service.dreams.DreamService 1013 */ 1014 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1015 public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS"; 1016 1017 /** 1018 * Activity Action: Show Notification listener settings. 1019 * <p> 1020 * In some cases, a matching Activity may not exist, so ensure you 1021 * safeguard against this. 1022 * <p> 1023 * Input: Nothing. 1024 * <p> 1025 * Output: Nothing. 1026 * @see android.service.notification.NotificationListenerService 1027 */ 1028 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1029 public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS 1030 = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"; 1031 1032 /** 1033 * Activity Action: Show Do Not Disturb access settings. 1034 * <p> 1035 * Users can grant and deny access to Do Not Disturb configuration from here. 1036 * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more 1037 * details. 1038 * <p> 1039 * Input: Nothing. 1040 * <p> 1041 * Output: Nothing. 1042 */ 1043 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1044 public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS 1045 = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"; 1046 1047 /** 1048 * @hide 1049 */ 1050 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1051 public static final String ACTION_CONDITION_PROVIDER_SETTINGS 1052 = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS"; 1053 1054 /** 1055 * Activity Action: Show settings for video captioning. 1056 * <p> 1057 * In some cases, a matching Activity may not exist, so ensure you safeguard 1058 * against this. 1059 * <p> 1060 * Input: Nothing. 1061 * <p> 1062 * Output: Nothing. 1063 */ 1064 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1065 public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS"; 1066 1067 /** 1068 * Activity Action: Show the top level print settings. 1069 * <p> 1070 * In some cases, a matching Activity may not exist, so ensure you 1071 * safeguard against this. 1072 * <p> 1073 * Input: Nothing. 1074 * <p> 1075 * Output: Nothing. 1076 */ 1077 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1078 public static final String ACTION_PRINT_SETTINGS = 1079 "android.settings.ACTION_PRINT_SETTINGS"; 1080 1081 /** 1082 * Activity Action: Show Zen Mode configuration settings. 1083 * 1084 * @hide 1085 */ 1086 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1087 public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; 1088 1089 /** 1090 * Activity Action: Show Zen Mode priority configuration settings. 1091 */ 1092 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1093 public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS 1094 = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"; 1095 1096 /** 1097 * Activity Action: Show Zen Mode automation configuration settings. 1098 * 1099 * @hide 1100 */ 1101 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1102 public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS 1103 = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS"; 1104 1105 /** 1106 * Activity Action: Modify do not disturb mode settings. 1107 * <p> 1108 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 1109 * <p> 1110 * This intent MUST be started using 1111 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 1112 * startVoiceActivity}. 1113 * <p> 1114 * Note: The Activity implementing this intent MUST verify that 1115 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}. 1116 * returns true before modifying the setting. 1117 * <p> 1118 * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate 1119 * how long the user wishes to avoid interruptions for. The optional 1120 * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is 1121 * enabling or disabling do not disturb mode. If either extra is not included, the 1122 * user maybe asked to provide the value. 1123 * <p> 1124 * Output: Nothing. 1125 */ 1126 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1127 public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE = 1128 "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE"; 1129 1130 /** 1131 * Activity Action: Show Zen Mode schedule rule configuration settings. 1132 * 1133 * @hide 1134 */ 1135 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1136 public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS 1137 = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS"; 1138 1139 /** 1140 * Activity Action: Show Zen Mode event rule configuration settings. 1141 * 1142 * @hide 1143 */ 1144 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1145 public static final String ACTION_ZEN_MODE_EVENT_RULE_SETTINGS 1146 = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS"; 1147 1148 /** 1149 * Activity Action: Show Zen Mode external rule configuration settings. 1150 * 1151 * @hide 1152 */ 1153 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1154 public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS 1155 = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS"; 1156 1157 /** 1158 * Activity Action: Show the regulatory information screen for the device. 1159 * <p> 1160 * In some cases, a matching Activity may not exist, so ensure you safeguard 1161 * against this. 1162 * <p> 1163 * Input: Nothing. 1164 * <p> 1165 * Output: Nothing. 1166 */ 1167 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1168 public static final String 1169 ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO"; 1170 1171 /** 1172 * Activity Action: Show Device Name Settings. 1173 * <p> 1174 * In some cases, a matching Activity may not exist, so ensure you safeguard 1175 * against this. 1176 * 1177 * @hide 1178 */ 1179 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1180 public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME"; 1181 1182 /** 1183 * Activity Action: Show pairing settings. 1184 * <p> 1185 * In some cases, a matching Activity may not exist, so ensure you safeguard 1186 * against this. 1187 * 1188 * @hide 1189 */ 1190 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1191 public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS"; 1192 1193 /** 1194 * Activity Action: Show battery saver settings. 1195 * <p> 1196 * In some cases, a matching Activity may not exist, so ensure you safeguard 1197 * against this. 1198 */ 1199 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1200 public static final String ACTION_BATTERY_SAVER_SETTINGS 1201 = "android.settings.BATTERY_SAVER_SETTINGS"; 1202 1203 /** 1204 * Activity Action: Modify Battery Saver mode setting using a voice command. 1205 * <p> 1206 * In some cases, a matching Activity may not exist, so ensure you safeguard against this. 1207 * <p> 1208 * This intent MUST be started using 1209 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity 1210 * startVoiceActivity}. 1211 * <p> 1212 * Note: The activity implementing this intent MUST verify that 1213 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before 1214 * modifying the setting. 1215 * <p> 1216 * Input: To tell which state batter saver mode should be set to, add the 1217 * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified. 1218 * If the extra is not included, no changes will be made. 1219 * <p> 1220 * Output: Nothing. 1221 */ 1222 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1223 public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE = 1224 "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE"; 1225 1226 /** 1227 * Activity Action: Show Home selection settings. If there are multiple activities 1228 * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you 1229 * to pick your preferred activity. 1230 */ 1231 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1232 public static final String ACTION_HOME_SETTINGS 1233 = "android.settings.HOME_SETTINGS"; 1234 1235 /** 1236 * Activity Action: Show Default apps settings. 1237 * <p> 1238 * In some cases, a matching Activity may not exist, so ensure you 1239 * safeguard against this. 1240 * <p> 1241 * Input: Nothing. 1242 * <p> 1243 * Output: Nothing. 1244 */ 1245 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1246 public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS 1247 = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS"; 1248 1249 /** 1250 * Activity Action: Show notification settings. 1251 * 1252 * @hide 1253 */ 1254 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1255 public static final String ACTION_NOTIFICATION_SETTINGS 1256 = "android.settings.NOTIFICATION_SETTINGS"; 1257 1258 /** 1259 * Activity Action: Show notification settings for a single app. 1260 * 1261 * @hide 1262 */ 1263 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1264 public static final String ACTION_APP_NOTIFICATION_SETTINGS 1265 = "android.settings.APP_NOTIFICATION_SETTINGS"; 1266 1267 /** 1268 * Activity Action: Show notification redaction settings. 1269 * 1270 * @hide 1271 */ 1272 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1273 public static final String ACTION_APP_NOTIFICATION_REDACTION 1274 = "android.settings.ACTION_APP_NOTIFICATION_REDACTION"; 1275 1276 /** @hide */ public static final String EXTRA_APP_UID = "app_uid"; 1277 /** @hide */ public static final String EXTRA_APP_PACKAGE = "app_package"; 1278 1279 /** 1280 * Activity Action: Show a dialog with disabled by policy message. 1281 * <p> If an user action is disabled by policy, this dialog can be triggered to let 1282 * the user know about this. 1283 * <p> 1284 * Input: Nothing. 1285 * <p> 1286 * Output: Nothing. 1287 * 1288 * @hide 1289 */ 1290 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1291 public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS 1292 = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS"; 1293 1294 /** 1295 * Activity Action: Show a dialog for remote bugreport flow. 1296 * <p> 1297 * Input: Nothing. 1298 * <p> 1299 * Output: Nothing. 1300 * 1301 * @hide 1302 */ 1303 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1304 public static final String ACTION_SHOW_REMOTE_BUGREPORT_DIALOG 1305 = "android.settings.SHOW_REMOTE_BUGREPORT_DIALOG"; 1306 1307 /** 1308 * Activity Action: Show VR listener settings. 1309 * <p> 1310 * Input: Nothing. 1311 * <p> 1312 * Output: Nothing. 1313 * 1314 * @see android.service.vr.VrListenerService 1315 */ 1316 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1317 public static final String ACTION_VR_LISTENER_SETTINGS 1318 = "android.settings.VR_LISTENER_SETTINGS"; 1319 1320 /** 1321 * Activity Action: Show Storage Manager settings. 1322 * <p> 1323 * Input: Nothing. 1324 * <p> 1325 * Output: Nothing. 1326 * 1327 * @hide 1328 */ 1329 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1330 public static final String ACTION_STORAGE_MANAGER_SETTINGS 1331 = "android.settings.STORAGE_MANAGER_SETTINGS"; 1332 1333 /** 1334 * Activity Action: Allows user to select current webview implementation. 1335 * <p> 1336 * Input: Nothing. 1337 * <p> 1338 * Output: Nothing. 1339 */ 1340 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1341 public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS"; 1342 1343 /** 1344 * Activity Action: Show enterprise privacy section. 1345 * <p> 1346 * Input: Nothing. 1347 * <p> 1348 * Output: Nothing. 1349 * @hide 1350 */ 1351 @SystemApi 1352 @TestApi 1353 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1354 public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS 1355 = "android.settings.ENTERPRISE_PRIVACY_SETTINGS"; 1356 1357 // End of Intent actions for Settings 1358 1359 /** 1360 * @hide - Private call() method on SettingsProvider to read from 'system' table. 1361 */ 1362 public static final String CALL_METHOD_GET_SYSTEM = "GET_system"; 1363 1364 /** 1365 * @hide - Private call() method on SettingsProvider to read from 'secure' table. 1366 */ 1367 public static final String CALL_METHOD_GET_SECURE = "GET_secure"; 1368 1369 /** 1370 * @hide - Private call() method on SettingsProvider to read from 'global' table. 1371 */ 1372 public static final String CALL_METHOD_GET_GLOBAL = "GET_global"; 1373 1374 /** 1375 * @hide - Specifies that the caller of the fast-path call()-based flow tracks 1376 * the settings generation in order to cache values locally. If this key is 1377 * mapped to a <code>null</code> string extra in the request bundle, the response 1378 * bundle will contain the same key mapped to a parcelable extra which would be 1379 * an {@link android.util.MemoryIntArray}. The response will also contain an 1380 * integer mapped to the {@link #CALL_METHOD_GENERATION_INDEX_KEY} which is the 1381 * index in the array clients should use to lookup the generation. For efficiency 1382 * the caller should request the generation tracking memory array only if it 1383 * doesn't already have it. 1384 * 1385 * @see #CALL_METHOD_GENERATION_INDEX_KEY 1386 */ 1387 public static final String CALL_METHOD_TRACK_GENERATION_KEY = "_track_generation"; 1388 1389 /** 1390 * @hide Key with the location in the {@link android.util.MemoryIntArray} where 1391 * to look up the generation id of the backing table. The value is an integer. 1392 * 1393 * @see #CALL_METHOD_TRACK_GENERATION_KEY 1394 */ 1395 public static final String CALL_METHOD_GENERATION_INDEX_KEY = "_generation_index"; 1396 1397 /** 1398 * @hide Key with the settings table generation. The value is an integer. 1399 * 1400 * @see #CALL_METHOD_TRACK_GENERATION_KEY 1401 */ 1402 public static final String CALL_METHOD_GENERATION_KEY = "_generation"; 1403 1404 /** 1405 * @hide - User handle argument extra to the fast-path call()-based requests 1406 */ 1407 public static final String CALL_METHOD_USER_KEY = "_user"; 1408 1409 /** 1410 * @hide - Boolean argument extra to the fast-path call()-based requests 1411 */ 1412 public static final String CALL_METHOD_MAKE_DEFAULT_KEY = "_make_default"; 1413 1414 /** 1415 * @hide - User handle argument extra to the fast-path call()-based requests 1416 */ 1417 public static final String CALL_METHOD_RESET_MODE_KEY = "_reset_mode"; 1418 1419 /** 1420 * @hide - String argument extra to the fast-path call()-based requests 1421 */ 1422 public static final String CALL_METHOD_TAG_KEY = "_tag"; 1423 1424 /** @hide - Private call() method to write to 'system' table */ 1425 public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system"; 1426 1427 /** @hide - Private call() method to write to 'secure' table */ 1428 public static final String CALL_METHOD_PUT_SECURE = "PUT_secure"; 1429 1430 /** @hide - Private call() method to write to 'global' table */ 1431 public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global"; 1432 1433 /** @hide - Private call() method to reset to defaults the 'global' table */ 1434 public static final String CALL_METHOD_RESET_GLOBAL = "RESET_global"; 1435 1436 /** @hide - Private call() method to reset to defaults the 'secure' table */ 1437 public static final String CALL_METHOD_RESET_SECURE = "RESET_secure"; 1438 1439 /** 1440 * Activity Extra: Limit available options in launched activity based on the given authority. 1441 * <p> 1442 * This can be passed as an extra field in an Activity Intent with one or more syncable content 1443 * provider's authorities as a String[]. This field is used by some intents to alter the 1444 * behavior of the called activity. 1445 * <p> 1446 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based 1447 * on the authority given. 1448 */ 1449 public static final String EXTRA_AUTHORITIES = "authorities"; 1450 1451 /** 1452 * Activity Extra: Limit available options in launched activity based on the given account 1453 * types. 1454 * <p> 1455 * This can be passed as an extra field in an Activity Intent with one or more account types 1456 * as a String[]. This field is used by some intents to alter the behavior of the called 1457 * activity. 1458 * <p> 1459 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified 1460 * list. 1461 */ 1462 public static final String EXTRA_ACCOUNT_TYPES = "account_types"; 1463 1464 public static final String EXTRA_INPUT_METHOD_ID = "input_method_id"; 1465 1466 /** 1467 * Activity Extra: The device identifier to act upon. 1468 * <p> 1469 * This can be passed as an extra field in an Activity Intent with a single 1470 * InputDeviceIdentifier. This field is used by some activities to jump straight into the 1471 * settings for the given device. 1472 * <p> 1473 * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout 1474 * dialog for the given device. 1475 * @hide 1476 */ 1477 public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier"; 1478 1479 /** 1480 * Activity Extra: Enable or disable Airplane Mode. 1481 * <p> 1482 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE} 1483 * intent as a boolean to indicate if it should be enabled. 1484 */ 1485 public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled"; 1486 1487 /** 1488 * Activity Extra: Enable or disable Battery saver mode. 1489 * <p> 1490 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE} 1491 * intent as a boolean to indicate if it should be enabled. 1492 */ 1493 public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED = 1494 "android.settings.extra.battery_saver_mode_enabled"; 1495 1496 /** 1497 * Activity Extra: Enable or disable Do Not Disturb mode. 1498 * <p> 1499 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE} 1500 * intent as a boolean to indicate if it should be enabled. 1501 */ 1502 public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = 1503 "android.settings.extra.do_not_disturb_mode_enabled"; 1504 1505 /** 1506 * Activity Extra: How many minutes to enable do not disturb mode for. 1507 * <p> 1508 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE} 1509 * intent to indicate how long do not disturb mode should be enabled for. 1510 */ 1511 public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = 1512 "android.settings.extra.do_not_disturb_mode_minutes"; 1513 1514 /** 1515 * Reset mode: reset to defaults only settings changed by the 1516 * calling package. If there is a default set the setting 1517 * will be set to it, otherwise the setting will be deleted. 1518 * This is the only type of reset available to non-system clients. 1519 * @hide 1520 */ 1521 public static final int RESET_MODE_PACKAGE_DEFAULTS = 1; 1522 1523 /** 1524 * Reset mode: reset all settings set by untrusted packages, which is 1525 * packages that aren't a part of the system, to the current defaults. 1526 * If there is a default set the setting will be set to it, otherwise 1527 * the setting will be deleted. This mode is only available to the system. 1528 * @hide 1529 */ 1530 public static final int RESET_MODE_UNTRUSTED_DEFAULTS = 2; 1531 1532 /** 1533 * Reset mode: delete all settings set by untrusted packages, which is 1534 * packages that aren't a part of the system. If a setting is set by an 1535 * untrusted package it will be deleted if its default is not provided 1536 * by the system, otherwise the setting will be set to its default. 1537 * This mode is only available to the system. 1538 * @hide 1539 */ 1540 public static final int RESET_MODE_UNTRUSTED_CHANGES = 3; 1541 1542 /** 1543 * Reset mode: reset all settings to defaults specified by trusted 1544 * packages, which is packages that are a part of the system, and 1545 * delete all settings set by untrusted packages. If a setting has 1546 * a default set by a system package it will be set to the default, 1547 * otherwise the setting will be deleted. This mode is only available 1548 * to the system. 1549 * @hide 1550 */ 1551 public static final int RESET_MODE_TRUSTED_DEFAULTS = 4; 1552 1553 /** @hide */ 1554 @Retention(RetentionPolicy.SOURCE) 1555 @IntDef({ 1556 RESET_MODE_PACKAGE_DEFAULTS, 1557 RESET_MODE_UNTRUSTED_DEFAULTS, 1558 RESET_MODE_UNTRUSTED_CHANGES, 1559 RESET_MODE_TRUSTED_DEFAULTS 1560 }) 1561 public @interface ResetMode{} 1562 1563 /** 1564 * Activity Extra: Number of certificates 1565 * <p> 1566 * This can be passed as an extra field to the {@link #ACTION_MONITORING_CERT_INFO} 1567 * intent to indicate the number of certificates 1568 * @hide 1569 */ 1570 public static final String EXTRA_NUMBER_OF_CERTIFICATES = 1571 "android.settings.extra.number_of_certificates"; 1572 1573 private static final String JID_RESOURCE_PREFIX = "android"; 1574 1575 public static final String AUTHORITY = "settings"; 1576 1577 private static final String TAG = "Settings"; 1578 private static final boolean LOCAL_LOGV = false; 1579 1580 // Lock ensures that when enabling/disabling the master location switch, we don't end up 1581 // with a partial enable/disable state in multi-threaded situations. 1582 private static final Object mLocationSettingsLock = new Object(); 1583 1584 public static class SettingNotFoundException extends AndroidException { 1585 public SettingNotFoundException(String msg) { 1586 super(msg); 1587 } 1588 } 1589 1590 /** 1591 * Common base for tables of name/value settings. 1592 */ 1593 public static class NameValueTable implements BaseColumns { 1594 public static final String NAME = "name"; 1595 public static final String VALUE = "value"; 1596 1597 protected static boolean putString(ContentResolver resolver, Uri uri, 1598 String name, String value) { 1599 // The database will take care of replacing duplicates. 1600 try { 1601 ContentValues values = new ContentValues(); 1602 values.put(NAME, name); 1603 values.put(VALUE, value); 1604 resolver.insert(uri, values); 1605 return true; 1606 } catch (SQLException e) { 1607 Log.w(TAG, "Can't set key " + name + " in " + uri, e); 1608 return false; 1609 } 1610 } 1611 1612 public static Uri getUriFor(Uri uri, String name) { 1613 return Uri.withAppendedPath(uri, name); 1614 } 1615 } 1616 1617 private static final class GenerationTracker { 1618 private final MemoryIntArray mArray; 1619 private final Runnable mErrorHandler; 1620 private final int mIndex; 1621 private int mCurrentGeneration; 1622 1623 public GenerationTracker(@NonNull MemoryIntArray array, int index, 1624 int generation, Runnable errorHandler) { 1625 mArray = array; 1626 mIndex = index; 1627 mErrorHandler = errorHandler; 1628 mCurrentGeneration = generation; 1629 } 1630 1631 public boolean isGenerationChanged() { 1632 final int currentGeneration = readCurrentGeneration(); 1633 if (currentGeneration >= 0) { 1634 if (currentGeneration == mCurrentGeneration) { 1635 return false; 1636 } 1637 mCurrentGeneration = currentGeneration; 1638 } 1639 return true; 1640 } 1641 1642 private int readCurrentGeneration() { 1643 try { 1644 return mArray.get(mIndex); 1645 } catch (IOException e) { 1646 Log.e(TAG, "Error getting current generation", e); 1647 if (mErrorHandler != null) { 1648 mErrorHandler.run(); 1649 } 1650 } 1651 return -1; 1652 } 1653 1654 public void destroy() { 1655 try { 1656 mArray.close(); 1657 } catch (IOException e) { 1658 Log.e(TAG, "Error closing backing array", e); 1659 if (mErrorHandler != null) { 1660 mErrorHandler.run(); 1661 } 1662 } 1663 } 1664 } 1665 1666 private static final class ContentProviderHolder { 1667 private final Object mLock = new Object(); 1668 1669 @GuardedBy("mLock") 1670 private final Uri mUri; 1671 @GuardedBy("mLock") 1672 private IContentProvider mContentProvider; 1673 1674 public ContentProviderHolder(Uri uri) { 1675 mUri = uri; 1676 } 1677 1678 public IContentProvider getProvider(ContentResolver contentResolver) { 1679 synchronized (mLock) { 1680 if (mContentProvider == null) { 1681 mContentProvider = contentResolver 1682 .acquireProvider(mUri.getAuthority()); 1683 } 1684 return mContentProvider; 1685 } 1686 } 1687 } 1688 1689 // Thread-safe. 1690 private static class NameValueCache { 1691 private static final boolean DEBUG = false; 1692 1693 private static final String[] SELECT_VALUE_PROJECTION = new String[] { 1694 Settings.NameValueTable.VALUE 1695 }; 1696 1697 private static final String NAME_EQ_PLACEHOLDER = "name=?"; 1698 1699 // Must synchronize on 'this' to access mValues and mValuesVersion. 1700 private final HashMap<String, String> mValues = new HashMap<>(); 1701 1702 private final Uri mUri; 1703 private final ContentProviderHolder mProviderHolder; 1704 1705 // The method we'll call (or null, to not use) on the provider 1706 // for the fast path of retrieving settings. 1707 private final String mCallGetCommand; 1708 private final String mCallSetCommand; 1709 1710 @GuardedBy("this") 1711 private GenerationTracker mGenerationTracker; 1712 1713 public NameValueCache(Uri uri, String getCommand, String setCommand, 1714 ContentProviderHolder providerHolder) { 1715 mUri = uri; 1716 mCallGetCommand = getCommand; 1717 mCallSetCommand = setCommand; 1718 mProviderHolder = providerHolder; 1719 } 1720 1721 public boolean putStringForUser(ContentResolver cr, String name, String value, 1722 String tag, boolean makeDefault, final int userHandle) { 1723 try { 1724 Bundle arg = new Bundle(); 1725 arg.putString(Settings.NameValueTable.VALUE, value); 1726 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 1727 if (tag != null) { 1728 arg.putString(CALL_METHOD_TAG_KEY, tag); 1729 } 1730 if (makeDefault) { 1731 arg.putBoolean(CALL_METHOD_MAKE_DEFAULT_KEY, true); 1732 } 1733 IContentProvider cp = mProviderHolder.getProvider(cr); 1734 cp.call(cr.getPackageName(), mCallSetCommand, name, arg); 1735 } catch (RemoteException e) { 1736 Log.w(TAG, "Can't set key " + name + " in " + mUri, e); 1737 return false; 1738 } 1739 return true; 1740 } 1741 1742 public String getStringForUser(ContentResolver cr, String name, final int userHandle) { 1743 final boolean isSelf = (userHandle == UserHandle.myUserId()); 1744 if (isSelf) { 1745 synchronized (NameValueCache.this) { 1746 if (mGenerationTracker != null) { 1747 if (mGenerationTracker.isGenerationChanged()) { 1748 if (DEBUG) { 1749 Log.i(TAG, "Generation changed for type:" 1750 + mUri.getPath() + " in package:" 1751 + cr.getPackageName() +" and user:" + userHandle); 1752 } 1753 mValues.clear(); 1754 } else if (mValues.containsKey(name)) { 1755 return mValues.get(name); 1756 } 1757 } 1758 } 1759 } else { 1760 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle 1761 + " by user " + UserHandle.myUserId() + " so skipping cache"); 1762 } 1763 1764 IContentProvider cp = mProviderHolder.getProvider(cr); 1765 1766 // Try the fast path first, not using query(). If this 1767 // fails (alternate Settings provider that doesn't support 1768 // this interface?) then we fall back to the query/table 1769 // interface. 1770 if (mCallGetCommand != null) { 1771 try { 1772 Bundle args = null; 1773 if (!isSelf) { 1774 args = new Bundle(); 1775 args.putInt(CALL_METHOD_USER_KEY, userHandle); 1776 } 1777 boolean needsGenerationTracker = false; 1778 synchronized (NameValueCache.this) { 1779 if (isSelf && mGenerationTracker == null) { 1780 needsGenerationTracker = true; 1781 if (args == null) { 1782 args = new Bundle(); 1783 } 1784 args.putString(CALL_METHOD_TRACK_GENERATION_KEY, null); 1785 if (DEBUG) { 1786 Log.i(TAG, "Requested generation tracker for type: "+ mUri.getPath() 1787 + " in package:" + cr.getPackageName() +" and user:" 1788 + userHandle); 1789 } 1790 } 1791 } 1792 Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args); 1793 if (b != null) { 1794 String value = b.getString(Settings.NameValueTable.VALUE); 1795 // Don't update our cache for reads of other users' data 1796 if (isSelf) { 1797 synchronized (NameValueCache.this) { 1798 if (needsGenerationTracker) { 1799 MemoryIntArray array = b.getParcelable( 1800 CALL_METHOD_TRACK_GENERATION_KEY); 1801 final int index = b.getInt( 1802 CALL_METHOD_GENERATION_INDEX_KEY, -1); 1803 if (array != null && index >= 0) { 1804 final int generation = b.getInt( 1805 CALL_METHOD_GENERATION_KEY, 0); 1806 if (DEBUG) { 1807 Log.i(TAG, "Received generation tracker for type:" 1808 + mUri.getPath() + " in package:" 1809 + cr.getPackageName() + " and user:" 1810 + userHandle + " with index:" + index); 1811 } 1812 if (mGenerationTracker != null) { 1813 mGenerationTracker.destroy(); 1814 } 1815 mGenerationTracker = new GenerationTracker(array, index, 1816 generation, () -> { 1817 synchronized (NameValueCache.this) { 1818 Log.e(TAG, "Error accessing generation" 1819 + " tracker - removing"); 1820 if (mGenerationTracker != null) { 1821 GenerationTracker generationTracker = 1822 mGenerationTracker; 1823 mGenerationTracker = null; 1824 generationTracker.destroy(); 1825 mValues.clear(); 1826 } 1827 } 1828 }); 1829 } 1830 } 1831 mValues.put(name, value); 1832 } 1833 } else { 1834 if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle 1835 + " by " + UserHandle.myUserId() 1836 + " so not updating cache"); 1837 } 1838 return value; 1839 } 1840 // If the response Bundle is null, we fall through 1841 // to the query interface below. 1842 } catch (RemoteException e) { 1843 // Not supported by the remote side? Fall through 1844 // to query(). 1845 } 1846 } 1847 1848 Cursor c = null; 1849 try { 1850 Bundle queryArgs = ContentResolver.createSqlQueryBundle( 1851 NAME_EQ_PLACEHOLDER, new String[]{name}, null); 1852 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs, null); 1853 if (c == null) { 1854 Log.w(TAG, "Can't get key " + name + " from " + mUri); 1855 return null; 1856 } 1857 1858 String value = c.moveToNext() ? c.getString(0) : null; 1859 synchronized (NameValueCache.this) { 1860 mValues.put(name, value); 1861 } 1862 if (LOCAL_LOGV) { 1863 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " + 1864 name + " = " + (value == null ? "(null)" : value)); 1865 } 1866 return value; 1867 } catch (RemoteException e) { 1868 Log.w(TAG, "Can't get key " + name + " from " + mUri, e); 1869 return null; // Return null, but don't cache it. 1870 } finally { 1871 if (c != null) c.close(); 1872 } 1873 } 1874 } 1875 1876 /** 1877 * Checks if the specified context can draw on top of other apps. As of API 1878 * level 23, an app cannot draw on top of other apps unless it declares the 1879 * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its 1880 * manifest, <em>and</em> the user specifically grants the app this 1881 * capability. To prompt the user to grant this approval, the app must send an 1882 * intent with the action 1883 * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}, which 1884 * causes the system to display a permission management screen. 1885 * 1886 * @param context App context. 1887 * @return true if the specified context can draw on top of other apps, false otherwise 1888 */ 1889 public static boolean canDrawOverlays(Context context) { 1890 return Settings.isCallingPackageAllowedToDrawOverlays(context, Process.myUid(), 1891 context.getOpPackageName(), false); 1892 } 1893 1894 /** 1895 * System settings, containing miscellaneous system preferences. This 1896 * table holds simple name/value pairs. There are convenience 1897 * functions for accessing individual settings entries. 1898 */ 1899 public static final class System extends NameValueTable { 1900 private static final float DEFAULT_FONT_SCALE = 1.0f; 1901 1902 /** @hide */ 1903 public static interface Validator { 1904 public boolean validate(String value); 1905 } 1906 1907 /** 1908 * The content:// style URL for this table 1909 */ 1910 public static final Uri CONTENT_URI = 1911 Uri.parse("content://" + AUTHORITY + "/system"); 1912 1913 private static final ContentProviderHolder sProviderHolder = 1914 new ContentProviderHolder(CONTENT_URI); 1915 1916 private static final NameValueCache sNameValueCache = new NameValueCache( 1917 CONTENT_URI, 1918 CALL_METHOD_GET_SYSTEM, 1919 CALL_METHOD_PUT_SYSTEM, 1920 sProviderHolder); 1921 1922 private static final HashSet<String> MOVED_TO_SECURE; 1923 static { 1924 MOVED_TO_SECURE = new HashSet<>(30); 1925 MOVED_TO_SECURE.add(Secure.ANDROID_ID); 1926 MOVED_TO_SECURE.add(Secure.HTTP_PROXY); 1927 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED); 1928 MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS); 1929 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED); 1930 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE); 1931 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 1932 MOVED_TO_SECURE.add(Secure.LOGGING_ID); 1933 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED); 1934 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE); 1935 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL); 1936 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME); 1937 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL); 1938 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 1939 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 1940 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT); 1941 MOVED_TO_SECURE.add(Secure.WIFI_ON); 1942 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE); 1943 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT); 1944 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS); 1945 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED); 1946 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS); 1947 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT); 1948 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS); 1949 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON); 1950 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT); 1951 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS); 1952 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); 1953 1954 // At one time in System, then Global, but now back in Secure 1955 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); 1956 } 1957 1958 private static final HashSet<String> MOVED_TO_GLOBAL; 1959 private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL; 1960 static { 1961 MOVED_TO_GLOBAL = new HashSet<>(); 1962 MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<>(); 1963 1964 // these were originally in system but migrated to secure in the past, 1965 // so are duplicated in the Secure.* namespace 1966 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED); 1967 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); 1968 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); 1969 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); 1970 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); 1971 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); 1972 1973 // these are moving directly from system to global 1974 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON); 1975 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS); 1976 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); 1977 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME); 1978 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE); 1979 MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND); 1980 MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND); 1981 MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND); 1982 MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND); 1983 MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED); 1984 MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND); 1985 MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND); 1986 MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND); 1987 MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED); 1988 MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN); 1989 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY); 1990 MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER); 1991 MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE); 1992 MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE); 1993 MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE); 1994 MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS); 1995 MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE); 1996 MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE); 1997 MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY); 1998 MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP); 1999 MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER); 2000 MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES); 2001 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL); 2002 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL); 2003 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL); 2004 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL); 2005 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL); 2006 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL); 2007 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL); 2008 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL); 2009 } 2010 2011 private static final Validator sBooleanValidator = 2012 new DiscreteValueValidator(new String[] {"0", "1"}); 2013 2014 private static final Validator sNonNegativeIntegerValidator = new Validator() { 2015 @Override 2016 public boolean validate(String value) { 2017 try { 2018 return Integer.parseInt(value) >= 0; 2019 } catch (NumberFormatException e) { 2020 return false; 2021 } 2022 } 2023 }; 2024 2025 private static final Validator sUriValidator = new Validator() { 2026 @Override 2027 public boolean validate(String value) { 2028 try { 2029 Uri.decode(value); 2030 return true; 2031 } catch (IllegalArgumentException e) { 2032 return false; 2033 } 2034 } 2035 }; 2036 2037 private static final Validator sLenientIpAddressValidator = new Validator() { 2038 private static final int MAX_IPV6_LENGTH = 45; 2039 2040 @Override 2041 public boolean validate(String value) { 2042 return value.length() <= MAX_IPV6_LENGTH; 2043 } 2044 }; 2045 2046 /** @hide */ 2047 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 2048 outKeySet.addAll(MOVED_TO_GLOBAL); 2049 outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL); 2050 } 2051 2052 /** @hide */ 2053 public static void getMovedToSecureSettings(Set<String> outKeySet) { 2054 outKeySet.addAll(MOVED_TO_SECURE); 2055 } 2056 2057 /** @hide */ 2058 public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) { 2059 outKeySet.addAll(MOVED_TO_GLOBAL); 2060 } 2061 2062 /** 2063 * Look up a name in the database. 2064 * @param resolver to access the database with 2065 * @param name to look up in the table 2066 * @return the corresponding value, or null if not present 2067 */ 2068 public static String getString(ContentResolver resolver, String name) { 2069 return getStringForUser(resolver, name, UserHandle.myUserId()); 2070 } 2071 2072 /** @hide */ 2073 public static String getStringForUser(ContentResolver resolver, String name, 2074 int userHandle) { 2075 if (MOVED_TO_SECURE.contains(name)) { 2076 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2077 + " to android.provider.Settings.Secure, returning read-only value."); 2078 return Secure.getStringForUser(resolver, name, userHandle); 2079 } 2080 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 2081 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2082 + " to android.provider.Settings.Global, returning read-only value."); 2083 return Global.getStringForUser(resolver, name, userHandle); 2084 } 2085 return sNameValueCache.getStringForUser(resolver, name, userHandle); 2086 } 2087 2088 /** 2089 * Store a name/value pair into the database. 2090 * @param resolver to access the database with 2091 * @param name to store 2092 * @param value to associate with the name 2093 * @return true if the value was set, false on database errors 2094 */ 2095 public static boolean putString(ContentResolver resolver, String name, String value) { 2096 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 2097 } 2098 2099 /** @hide */ 2100 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 2101 int userHandle) { 2102 if (MOVED_TO_SECURE.contains(name)) { 2103 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2104 + " to android.provider.Settings.Secure, value is unchanged."); 2105 return false; 2106 } 2107 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 2108 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2109 + " to android.provider.Settings.Global, value is unchanged."); 2110 return false; 2111 } 2112 return sNameValueCache.putStringForUser(resolver, name, value, null, false, userHandle); 2113 } 2114 2115 /** 2116 * Construct the content URI for a particular name/value pair, 2117 * useful for monitoring changes with a ContentObserver. 2118 * @param name to look up in the table 2119 * @return the corresponding content URI, or null if not present 2120 */ 2121 public static Uri getUriFor(String name) { 2122 if (MOVED_TO_SECURE.contains(name)) { 2123 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2124 + " to android.provider.Settings.Secure, returning Secure URI."); 2125 return Secure.getUriFor(Secure.CONTENT_URI, name); 2126 } 2127 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { 2128 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 2129 + " to android.provider.Settings.Global, returning read-only global URI."); 2130 return Global.getUriFor(Global.CONTENT_URI, name); 2131 } 2132 return getUriFor(CONTENT_URI, name); 2133 } 2134 2135 /** 2136 * Convenience function for retrieving a single system settings value 2137 * as an integer. Note that internally setting values are always 2138 * stored as strings; this function converts the string to an integer 2139 * for you. The default value will be returned if the setting is 2140 * not defined or not an integer. 2141 * 2142 * @param cr The ContentResolver to access. 2143 * @param name The name of the setting to retrieve. 2144 * @param def Value to return if the setting is not defined. 2145 * 2146 * @return The setting's current value, or 'def' if it is not defined 2147 * or not a valid integer. 2148 */ 2149 public static int getInt(ContentResolver cr, String name, int def) { 2150 return getIntForUser(cr, name, def, UserHandle.myUserId()); 2151 } 2152 2153 /** @hide */ 2154 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 2155 String v = getStringForUser(cr, name, userHandle); 2156 try { 2157 return v != null ? Integer.parseInt(v) : def; 2158 } catch (NumberFormatException e) { 2159 return def; 2160 } 2161 } 2162 2163 /** 2164 * Convenience function for retrieving a single system settings value 2165 * as an integer. Note that internally setting values are always 2166 * stored as strings; this function converts the string to an integer 2167 * for you. 2168 * <p> 2169 * This version does not take a default value. If the setting has not 2170 * been set, or the string value is not a number, 2171 * it throws {@link SettingNotFoundException}. 2172 * 2173 * @param cr The ContentResolver to access. 2174 * @param name The name of the setting to retrieve. 2175 * 2176 * @throws SettingNotFoundException Thrown if a setting by the given 2177 * name can't be found or the setting value is not an integer. 2178 * 2179 * @return The setting's current value. 2180 */ 2181 public static int getInt(ContentResolver cr, String name) 2182 throws SettingNotFoundException { 2183 return getIntForUser(cr, name, UserHandle.myUserId()); 2184 } 2185 2186 /** @hide */ 2187 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 2188 throws SettingNotFoundException { 2189 String v = getStringForUser(cr, name, userHandle); 2190 try { 2191 return Integer.parseInt(v); 2192 } catch (NumberFormatException e) { 2193 throw new SettingNotFoundException(name); 2194 } 2195 } 2196 2197 /** 2198 * Convenience function for updating a single settings value as an 2199 * integer. This will either create a new entry in the table if the 2200 * given name does not exist, or modify the value of the existing row 2201 * with that name. Note that internally setting values are always 2202 * stored as strings, so this function converts the given value to a 2203 * string before storing it. 2204 * 2205 * @param cr The ContentResolver to access. 2206 * @param name The name of the setting to modify. 2207 * @param value The new value for the setting. 2208 * @return true if the value was set, false on database errors 2209 */ 2210 public static boolean putInt(ContentResolver cr, String name, int value) { 2211 return putIntForUser(cr, name, value, UserHandle.myUserId()); 2212 } 2213 2214 /** @hide */ 2215 public static boolean putIntForUser(ContentResolver cr, String name, int value, 2216 int userHandle) { 2217 return putStringForUser(cr, name, Integer.toString(value), userHandle); 2218 } 2219 2220 /** 2221 * Convenience function for retrieving a single system settings value 2222 * as a {@code long}. Note that internally setting values are always 2223 * stored as strings; this function converts the string to a {@code long} 2224 * for you. The default value will be returned if the setting is 2225 * not defined or not a {@code long}. 2226 * 2227 * @param cr The ContentResolver to access. 2228 * @param name The name of the setting to retrieve. 2229 * @param def Value to return if the setting is not defined. 2230 * 2231 * @return The setting's current value, or 'def' if it is not defined 2232 * or not a valid {@code long}. 2233 */ 2234 public static long getLong(ContentResolver cr, String name, long def) { 2235 return getLongForUser(cr, name, def, UserHandle.myUserId()); 2236 } 2237 2238 /** @hide */ 2239 public static long getLongForUser(ContentResolver cr, String name, long def, 2240 int userHandle) { 2241 String valString = getStringForUser(cr, name, userHandle); 2242 long value; 2243 try { 2244 value = valString != null ? Long.parseLong(valString) : def; 2245 } catch (NumberFormatException e) { 2246 value = def; 2247 } 2248 return value; 2249 } 2250 2251 /** 2252 * Convenience function for retrieving a single system settings value 2253 * as a {@code long}. Note that internally setting values are always 2254 * stored as strings; this function converts the string to a {@code long} 2255 * for you. 2256 * <p> 2257 * This version does not take a default value. If the setting has not 2258 * been set, or the string value is not a number, 2259 * it throws {@link SettingNotFoundException}. 2260 * 2261 * @param cr The ContentResolver to access. 2262 * @param name The name of the setting to retrieve. 2263 * 2264 * @return The setting's current value. 2265 * @throws SettingNotFoundException Thrown if a setting by the given 2266 * name can't be found or the setting value is not an integer. 2267 */ 2268 public static long getLong(ContentResolver cr, String name) 2269 throws SettingNotFoundException { 2270 return getLongForUser(cr, name, UserHandle.myUserId()); 2271 } 2272 2273 /** @hide */ 2274 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 2275 throws SettingNotFoundException { 2276 String valString = getStringForUser(cr, name, userHandle); 2277 try { 2278 return Long.parseLong(valString); 2279 } catch (NumberFormatException e) { 2280 throw new SettingNotFoundException(name); 2281 } 2282 } 2283 2284 /** 2285 * Convenience function for updating a single settings value as a long 2286 * integer. This will either create a new entry in the table if the 2287 * given name does not exist, or modify the value of the existing row 2288 * with that name. Note that internally setting values are always 2289 * stored as strings, so this function converts the given value to a 2290 * string before storing it. 2291 * 2292 * @param cr The ContentResolver to access. 2293 * @param name The name of the setting to modify. 2294 * @param value The new value for the setting. 2295 * @return true if the value was set, false on database errors 2296 */ 2297 public static boolean putLong(ContentResolver cr, String name, long value) { 2298 return putLongForUser(cr, name, value, UserHandle.myUserId()); 2299 } 2300 2301 /** @hide */ 2302 public static boolean putLongForUser(ContentResolver cr, String name, long value, 2303 int userHandle) { 2304 return putStringForUser(cr, name, Long.toString(value), userHandle); 2305 } 2306 2307 /** 2308 * Convenience function for retrieving a single system settings value 2309 * as a floating point number. Note that internally setting values are 2310 * always stored as strings; this function converts the string to an 2311 * float for you. The default value will be returned if the setting 2312 * is not defined or not a valid float. 2313 * 2314 * @param cr The ContentResolver to access. 2315 * @param name The name of the setting to retrieve. 2316 * @param def Value to return if the setting is not defined. 2317 * 2318 * @return The setting's current value, or 'def' if it is not defined 2319 * or not a valid float. 2320 */ 2321 public static float getFloat(ContentResolver cr, String name, float def) { 2322 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 2323 } 2324 2325 /** @hide */ 2326 public static float getFloatForUser(ContentResolver cr, String name, float def, 2327 int userHandle) { 2328 String v = getStringForUser(cr, name, userHandle); 2329 try { 2330 return v != null ? Float.parseFloat(v) : def; 2331 } catch (NumberFormatException e) { 2332 return def; 2333 } 2334 } 2335 2336 /** 2337 * Convenience function for retrieving a single system settings value 2338 * as a float. Note that internally setting values are always 2339 * stored as strings; this function converts the string to a float 2340 * for you. 2341 * <p> 2342 * This version does not take a default value. If the setting has not 2343 * been set, or the string value is not a number, 2344 * it throws {@link SettingNotFoundException}. 2345 * 2346 * @param cr The ContentResolver to access. 2347 * @param name The name of the setting to retrieve. 2348 * 2349 * @throws SettingNotFoundException Thrown if a setting by the given 2350 * name can't be found or the setting value is not a float. 2351 * 2352 * @return The setting's current value. 2353 */ 2354 public static float getFloat(ContentResolver cr, String name) 2355 throws SettingNotFoundException { 2356 return getFloatForUser(cr, name, UserHandle.myUserId()); 2357 } 2358 2359 /** @hide */ 2360 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 2361 throws SettingNotFoundException { 2362 String v = getStringForUser(cr, name, userHandle); 2363 if (v == null) { 2364 throw new SettingNotFoundException(name); 2365 } 2366 try { 2367 return Float.parseFloat(v); 2368 } catch (NumberFormatException e) { 2369 throw new SettingNotFoundException(name); 2370 } 2371 } 2372 2373 /** 2374 * Convenience function for updating a single settings value as a 2375 * floating point number. This will either create a new entry in the 2376 * table if the given name does not exist, or modify the value of the 2377 * existing row with that name. Note that internally setting values 2378 * are always stored as strings, so this function converts the given 2379 * value to a string before storing it. 2380 * 2381 * @param cr The ContentResolver to access. 2382 * @param name The name of the setting to modify. 2383 * @param value The new value for the setting. 2384 * @return true if the value was set, false on database errors 2385 */ 2386 public static boolean putFloat(ContentResolver cr, String name, float value) { 2387 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 2388 } 2389 2390 /** @hide */ 2391 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 2392 int userHandle) { 2393 return putStringForUser(cr, name, Float.toString(value), userHandle); 2394 } 2395 2396 /** 2397 * Convenience function to read all of the current 2398 * configuration-related settings into a 2399 * {@link Configuration} object. 2400 * 2401 * @param cr The ContentResolver to access. 2402 * @param outConfig Where to place the configuration settings. 2403 */ 2404 public static void getConfiguration(ContentResolver cr, Configuration outConfig) { 2405 adjustConfigurationForUser(cr, outConfig, UserHandle.myUserId(), 2406 false /* updateSettingsIfEmpty */); 2407 } 2408 2409 /** @hide */ 2410 public static void adjustConfigurationForUser(ContentResolver cr, Configuration outConfig, 2411 int userHandle, boolean updateSettingsIfEmpty) { 2412 outConfig.fontScale = Settings.System.getFloatForUser( 2413 cr, FONT_SCALE, DEFAULT_FONT_SCALE, userHandle); 2414 if (outConfig.fontScale < 0) { 2415 outConfig.fontScale = DEFAULT_FONT_SCALE; 2416 } 2417 2418 final String localeValue = 2419 Settings.System.getStringForUser(cr, SYSTEM_LOCALES, userHandle); 2420 if (localeValue != null) { 2421 outConfig.setLocales(LocaleList.forLanguageTags(localeValue)); 2422 } else { 2423 // Do not update configuration with emtpy settings since we need to take over the 2424 // locale list of previous user if the settings value is empty. This happens when a 2425 // new user is created. 2426 2427 if (updateSettingsIfEmpty) { 2428 // Make current configuration persistent. This is necessary the first time a 2429 // user log in. At the first login, the configuration settings are empty, so we 2430 // need to store the adjusted configuration as the initial settings. 2431 Settings.System.putStringForUser( 2432 cr, SYSTEM_LOCALES, outConfig.getLocales().toLanguageTags(), 2433 userHandle); 2434 } 2435 } 2436 } 2437 2438 /** 2439 * @hide Erase the fields in the Configuration that should be applied 2440 * by the settings. 2441 */ 2442 public static void clearConfiguration(Configuration inoutConfig) { 2443 inoutConfig.fontScale = 0; 2444 if (!inoutConfig.userSetLocale && !inoutConfig.getLocales().isEmpty()) { 2445 inoutConfig.clearLocales(); 2446 } 2447 } 2448 2449 /** 2450 * Convenience function to write a batch of configuration-related 2451 * settings from a {@link Configuration} object. 2452 * 2453 * @param cr The ContentResolver to access. 2454 * @param config The settings to write. 2455 * @return true if the values were set, false on database errors 2456 */ 2457 public static boolean putConfiguration(ContentResolver cr, Configuration config) { 2458 return putConfigurationForUser(cr, config, UserHandle.myUserId()); 2459 } 2460 2461 /** @hide */ 2462 public static boolean putConfigurationForUser(ContentResolver cr, Configuration config, 2463 int userHandle) { 2464 return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle) && 2465 Settings.System.putStringForUser( 2466 cr, SYSTEM_LOCALES, config.getLocales().toLanguageTags(), userHandle); 2467 } 2468 2469 /** @hide */ 2470 public static boolean hasInterestingConfigurationChanges(int changes) { 2471 return (changes & ActivityInfo.CONFIG_FONT_SCALE) != 0 || 2472 (changes & ActivityInfo.CONFIG_LOCALE) != 0; 2473 } 2474 2475 /** @deprecated - Do not use */ 2476 @Deprecated 2477 public static boolean getShowGTalkServiceStatus(ContentResolver cr) { 2478 return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId()); 2479 } 2480 2481 /** 2482 * @hide 2483 * @deprecated - Do not use 2484 */ 2485 @Deprecated 2486 public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr, 2487 int userHandle) { 2488 return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0; 2489 } 2490 2491 /** @deprecated - Do not use */ 2492 @Deprecated 2493 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) { 2494 setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId()); 2495 } 2496 2497 /** 2498 * @hide 2499 * @deprecated - Do not use 2500 */ 2501 @Deprecated 2502 public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag, 2503 int userHandle) { 2504 putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle); 2505 } 2506 2507 private static final class DiscreteValueValidator implements Validator { 2508 private final String[] mValues; 2509 2510 public DiscreteValueValidator(String[] values) { 2511 mValues = values; 2512 } 2513 2514 @Override 2515 public boolean validate(String value) { 2516 return ArrayUtils.contains(mValues, value); 2517 } 2518 } 2519 2520 private static final class InclusiveIntegerRangeValidator implements Validator { 2521 private final int mMin; 2522 private final int mMax; 2523 2524 public InclusiveIntegerRangeValidator(int min, int max) { 2525 mMin = min; 2526 mMax = max; 2527 } 2528 2529 @Override 2530 public boolean validate(String value) { 2531 try { 2532 final int intValue = Integer.parseInt(value); 2533 return intValue >= mMin && intValue <= mMax; 2534 } catch (NumberFormatException e) { 2535 return false; 2536 } 2537 } 2538 } 2539 2540 private static final class InclusiveFloatRangeValidator implements Validator { 2541 private final float mMin; 2542 private final float mMax; 2543 2544 public InclusiveFloatRangeValidator(float min, float max) { 2545 mMin = min; 2546 mMax = max; 2547 } 2548 2549 @Override 2550 public boolean validate(String value) { 2551 try { 2552 final float floatValue = Float.parseFloat(value); 2553 return floatValue >= mMin && floatValue <= mMax; 2554 } catch (NumberFormatException e) { 2555 return false; 2556 } 2557 } 2558 } 2559 2560 /** 2561 * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead 2562 */ 2563 @Deprecated 2564 public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN; 2565 2566 /** 2567 * What happens when the user presses the end call button if they're not 2568 * on a call.<br/> 2569 * <b>Values:</b><br/> 2570 * 0 - The end button does nothing.<br/> 2571 * 1 - The end button goes to the home screen.<br/> 2572 * 2 - The end button puts the device to sleep and locks the keyguard.<br/> 2573 * 3 - The end button goes to the home screen. If the user is already on the 2574 * home screen, it puts the device to sleep. 2575 */ 2576 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior"; 2577 2578 private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR = 2579 new InclusiveIntegerRangeValidator(0, 3); 2580 2581 /** 2582 * END_BUTTON_BEHAVIOR value for "go home". 2583 * @hide 2584 */ 2585 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1; 2586 2587 /** 2588 * END_BUTTON_BEHAVIOR value for "go to sleep". 2589 * @hide 2590 */ 2591 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2; 2592 2593 /** 2594 * END_BUTTON_BEHAVIOR default value. 2595 * @hide 2596 */ 2597 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP; 2598 2599 /** 2600 * Is advanced settings mode turned on. 0 == no, 1 == yes 2601 * @hide 2602 */ 2603 public static final String ADVANCED_SETTINGS = "advanced_settings"; 2604 2605 private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator; 2606 2607 /** 2608 * ADVANCED_SETTINGS default value. 2609 * @hide 2610 */ 2611 public static final int ADVANCED_SETTINGS_DEFAULT = 0; 2612 2613 /** 2614 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead 2615 */ 2616 @Deprecated 2617 public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON; 2618 2619 /** 2620 * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead 2621 */ 2622 @Deprecated 2623 public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH; 2624 2625 /** 2626 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead 2627 */ 2628 @Deprecated 2629 public static final String RADIO_WIFI = Global.RADIO_WIFI; 2630 2631 /** 2632 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead 2633 * {@hide} 2634 */ 2635 @Deprecated 2636 public static final String RADIO_WIMAX = Global.RADIO_WIMAX; 2637 2638 /** 2639 * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead 2640 */ 2641 @Deprecated 2642 public static final String RADIO_CELL = Global.RADIO_CELL; 2643 2644 /** 2645 * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead 2646 */ 2647 @Deprecated 2648 public static final String RADIO_NFC = Global.RADIO_NFC; 2649 2650 /** 2651 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead 2652 */ 2653 @Deprecated 2654 public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS; 2655 2656 /** 2657 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead 2658 * 2659 * {@hide} 2660 */ 2661 @Deprecated 2662 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = 2663 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS; 2664 2665 /** 2666 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead 2667 */ 2668 @Deprecated 2669 public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY; 2670 2671 /** 2672 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead 2673 */ 2674 @Deprecated 2675 public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT; 2676 2677 /** 2678 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead 2679 */ 2680 @Deprecated 2681 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 2682 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED; 2683 2684 /** 2685 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead 2686 */ 2687 @Deprecated 2688 public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER; 2689 2690 /** 2691 * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead 2692 */ 2693 @Deprecated 2694 public static final String MODE_RINGER = Global.MODE_RINGER; 2695 2696 /** 2697 * Whether to use static IP and other static network attributes. 2698 * <p> 2699 * Set to 1 for true and 0 for false. 2700 * 2701 * @deprecated Use {@link WifiManager} instead 2702 */ 2703 @Deprecated 2704 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; 2705 2706 private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator; 2707 2708 /** 2709 * The static IP address. 2710 * <p> 2711 * Example: "192.168.1.51" 2712 * 2713 * @deprecated Use {@link WifiManager} instead 2714 */ 2715 @Deprecated 2716 public static final String WIFI_STATIC_IP = "wifi_static_ip"; 2717 2718 private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator; 2719 2720 /** 2721 * If using static IP, the gateway's IP address. 2722 * <p> 2723 * Example: "192.168.1.1" 2724 * 2725 * @deprecated Use {@link WifiManager} instead 2726 */ 2727 @Deprecated 2728 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; 2729 2730 private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator; 2731 2732 /** 2733 * If using static IP, the net mask. 2734 * <p> 2735 * Example: "255.255.255.0" 2736 * 2737 * @deprecated Use {@link WifiManager} instead 2738 */ 2739 @Deprecated 2740 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; 2741 2742 private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator; 2743 2744 /** 2745 * If using static IP, the primary DNS's IP address. 2746 * <p> 2747 * Example: "192.168.1.1" 2748 * 2749 * @deprecated Use {@link WifiManager} instead 2750 */ 2751 @Deprecated 2752 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; 2753 2754 private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator; 2755 2756 /** 2757 * If using static IP, the secondary DNS's IP address. 2758 * <p> 2759 * Example: "192.168.1.2" 2760 * 2761 * @deprecated Use {@link WifiManager} instead 2762 */ 2763 @Deprecated 2764 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; 2765 2766 private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator; 2767 2768 /** 2769 * Determines whether remote devices may discover and/or connect to 2770 * this device. 2771 * <P>Type: INT</P> 2772 * 2 -- discoverable and connectable 2773 * 1 -- connectable but not discoverable 2774 * 0 -- neither connectable nor discoverable 2775 */ 2776 public static final String BLUETOOTH_DISCOVERABILITY = 2777 "bluetooth_discoverability"; 2778 2779 private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR = 2780 new InclusiveIntegerRangeValidator(0, 2); 2781 2782 /** 2783 * Bluetooth discoverability timeout. If this value is nonzero, then 2784 * Bluetooth becomes discoverable for a certain number of seconds, 2785 * after which is becomes simply connectable. The value is in seconds. 2786 */ 2787 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = 2788 "bluetooth_discoverability_timeout"; 2789 2790 private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR = 2791 sNonNegativeIntegerValidator; 2792 2793 /** 2794 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED} 2795 * instead 2796 */ 2797 @Deprecated 2798 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED; 2799 2800 /** 2801 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE} 2802 * instead 2803 */ 2804 @Deprecated 2805 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 2806 2807 /** 2808 * @deprecated Use 2809 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED} 2810 * instead 2811 */ 2812 @Deprecated 2813 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = 2814 "lock_pattern_tactile_feedback_enabled"; 2815 2816 /** 2817 * A formatted string of the next alarm that is set, or the empty string 2818 * if there is no alarm set. 2819 * 2820 * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}. 2821 */ 2822 @Deprecated 2823 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; 2824 2825 private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() { 2826 private static final int MAX_LENGTH = 1000; 2827 2828 @Override 2829 public boolean validate(String value) { 2830 // TODO: No idea what the correct format is. 2831 return value == null || value.length() < MAX_LENGTH; 2832 } 2833 }; 2834 2835 /** 2836 * Scaling factor for fonts, float. 2837 */ 2838 public static final String FONT_SCALE = "font_scale"; 2839 2840 private static final Validator FONT_SCALE_VALIDATOR = new Validator() { 2841 @Override 2842 public boolean validate(String value) { 2843 try { 2844 return Float.parseFloat(value) >= 0; 2845 } catch (NumberFormatException e) { 2846 return false; 2847 } 2848 } 2849 }; 2850 2851 /** 2852 * The serialized system locale value. 2853 * 2854 * Do not use this value directory. 2855 * To get system locale, use {@link LocaleList#getDefault} instead. 2856 * To update system locale, use {@link com.android.internal.app.LocalePicker#updateLocales} 2857 * instead. 2858 * @hide 2859 */ 2860 public static final String SYSTEM_LOCALES = "system_locales"; 2861 2862 2863 /** 2864 * Name of an application package to be debugged. 2865 * 2866 * @deprecated Use {@link Global#DEBUG_APP} instead 2867 */ 2868 @Deprecated 2869 public static final String DEBUG_APP = Global.DEBUG_APP; 2870 2871 /** 2872 * If 1, when launching DEBUG_APP it will wait for the debugger before 2873 * starting user code. If 0, it will run normally. 2874 * 2875 * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead 2876 */ 2877 @Deprecated 2878 public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER; 2879 2880 /** 2881 * Whether or not to dim the screen. 0=no 1=yes 2882 * @deprecated This setting is no longer used. 2883 */ 2884 @Deprecated 2885 public static final String DIM_SCREEN = "dim_screen"; 2886 2887 private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator; 2888 2889 /** 2890 * The amount of time in milliseconds before the device goes to sleep or begins 2891 * to dream after a period of inactivity. This value is also known as the 2892 * user activity timeout period since the screen isn't necessarily turned off 2893 * when it expires. 2894 */ 2895 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; 2896 2897 private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator; 2898 2899 /** 2900 * The screen backlight brightness between 0 and 255. 2901 */ 2902 public static final String SCREEN_BRIGHTNESS = "screen_brightness"; 2903 2904 private static final Validator SCREEN_BRIGHTNESS_VALIDATOR = 2905 new InclusiveIntegerRangeValidator(0, 255); 2906 2907 /** 2908 * The screen backlight brightness between 0 and 255. 2909 * @hide 2910 */ 2911 public static final String SCREEN_BRIGHTNESS_FOR_VR = "screen_brightness_for_vr"; 2912 2913 private static final Validator SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR = 2914 new InclusiveIntegerRangeValidator(0, 255); 2915 2916 /** 2917 * Control whether to enable automatic brightness mode. 2918 */ 2919 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; 2920 2921 private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator; 2922 2923 /** 2924 * Adjustment to auto-brightness to make it generally more (>0.0 <1.0) 2925 * or less (<0.0 >-1.0) bright. 2926 * @hide 2927 */ 2928 public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj"; 2929 2930 private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR = 2931 new InclusiveFloatRangeValidator(-1, 1); 2932 2933 /** 2934 * SCREEN_BRIGHTNESS_MODE value for manual mode. 2935 */ 2936 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0; 2937 2938 /** 2939 * SCREEN_BRIGHTNESS_MODE value for automatic mode. 2940 */ 2941 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; 2942 2943 /** 2944 * Control whether the process CPU usage meter should be shown. 2945 * 2946 * @deprecated This functionality is no longer available as of 2947 * {@link android.os.Build.VERSION_CODES#N_MR1}. 2948 */ 2949 @Deprecated 2950 public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES; 2951 2952 /** 2953 * If 1, the activity manager will aggressively finish activities and 2954 * processes as soon as they are no longer needed. If 0, the normal 2955 * extended lifetime is used. 2956 * 2957 * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead 2958 */ 2959 @Deprecated 2960 public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES; 2961 2962 /** 2963 * Determines which streams are affected by ringer mode changes. The 2964 * stream type's bit should be set to 1 if it should be muted when going 2965 * into an inaudible ringer mode. 2966 */ 2967 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; 2968 2969 private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR = 2970 sNonNegativeIntegerValidator; 2971 2972 /** 2973 * Determines which streams are affected by mute. The 2974 * stream type's bit should be set to 1 if it should be muted when a mute request 2975 * is received. 2976 */ 2977 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; 2978 2979 private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR = 2980 sNonNegativeIntegerValidator; 2981 2982 /** 2983 * Whether vibrate is on for different events. This is used internally, 2984 * changing this value will not change the vibrate. See AudioManager. 2985 */ 2986 public static final String VIBRATE_ON = "vibrate_on"; 2987 2988 private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator; 2989 2990 /** 2991 * If 1, redirects the system vibrator to all currently attached input devices 2992 * that support vibration. If there are no such input devices, then the system 2993 * vibrator is used instead. 2994 * If 0, does not register the system vibrator. 2995 * 2996 * This setting is mainly intended to provide a compatibility mechanism for 2997 * applications that only know about the system vibrator and do not use the 2998 * input device vibrator API. 2999 * 3000 * @hide 3001 */ 3002 public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices"; 3003 3004 private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator; 3005 3006 /** 3007 * Ringer volume. This is used internally, changing this value will not 3008 * change the volume. See AudioManager. 3009 * 3010 * @removed Not used by anything since API 2. 3011 */ 3012 public static final String VOLUME_RING = "volume_ring"; 3013 3014 /** 3015 * System/notifications volume. This is used internally, changing this 3016 * value will not change the volume. See AudioManager. 3017 * 3018 * @removed Not used by anything since API 2. 3019 */ 3020 public static final String VOLUME_SYSTEM = "volume_system"; 3021 3022 /** 3023 * Voice call volume. This is used internally, changing this value will 3024 * not change the volume. See AudioManager. 3025 * 3026 * @removed Not used by anything since API 2. 3027 */ 3028 public static final String VOLUME_VOICE = "volume_voice"; 3029 3030 /** 3031 * Music/media/gaming volume. This is used internally, changing this 3032 * value will not change the volume. See AudioManager. 3033 * 3034 * @removed Not used by anything since API 2. 3035 */ 3036 public static final String VOLUME_MUSIC = "volume_music"; 3037 3038 /** 3039 * Alarm volume. This is used internally, changing this 3040 * value will not change the volume. See AudioManager. 3041 * 3042 * @removed Not used by anything since API 2. 3043 */ 3044 public static final String VOLUME_ALARM = "volume_alarm"; 3045 3046 /** 3047 * Notification volume. This is used internally, changing this 3048 * value will not change the volume. See AudioManager. 3049 * 3050 * @removed Not used by anything since API 2. 3051 */ 3052 public static final String VOLUME_NOTIFICATION = "volume_notification"; 3053 3054 /** 3055 * Bluetooth Headset volume. This is used internally, changing this value will 3056 * not change the volume. See AudioManager. 3057 * 3058 * @removed Not used by anything since API 2. 3059 */ 3060 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; 3061 3062 /** 3063 * Master volume (float in the range 0.0f to 1.0f). 3064 * 3065 * @hide 3066 */ 3067 public static final String VOLUME_MASTER = "volume_master"; 3068 3069 /** 3070 * Master mono (int 1 = mono, 0 = normal). 3071 * 3072 * @hide 3073 */ 3074 public static final String MASTER_MONO = "master_mono"; 3075 3076 private static final Validator MASTER_MONO_VALIDATOR = sBooleanValidator; 3077 3078 /** 3079 * Whether the notifications should use the ring volume (value of 1) or 3080 * a separate notification volume (value of 0). In most cases, users 3081 * will have this enabled so the notification and ringer volumes will be 3082 * the same. However, power users can disable this and use the separate 3083 * notification volume control. 3084 * <p> 3085 * Note: This is a one-off setting that will be removed in the future 3086 * when there is profile support. For this reason, it is kept hidden 3087 * from the public APIs. 3088 * 3089 * @hide 3090 * @deprecated 3091 */ 3092 @Deprecated 3093 public static final String NOTIFICATIONS_USE_RING_VOLUME = 3094 "notifications_use_ring_volume"; 3095 3096 private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator; 3097 3098 /** 3099 * Whether silent mode should allow vibration feedback. This is used 3100 * internally in AudioService and the Sound settings activity to 3101 * coordinate decoupling of vibrate and silent modes. This setting 3102 * will likely be removed in a future release with support for 3103 * audio/vibe feedback profiles. 3104 * 3105 * Not used anymore. On devices with vibrator, the user explicitly selects 3106 * silent or vibrate mode. 3107 * Kept for use by legacy database upgrade code in DatabaseHelper. 3108 * @hide 3109 */ 3110 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent"; 3111 3112 private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator; 3113 3114 /** 3115 * The mapping of stream type (integer) to its setting. 3116 * 3117 * @removed Not used by anything since API 2. 3118 */ 3119 public static final String[] VOLUME_SETTINGS = { 3120 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, 3121 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO 3122 }; 3123 3124 /** 3125 * Appended to various volume related settings to record the previous 3126 * values before they the settings were affected by a silent/vibrate 3127 * ringer mode change. 3128 * 3129 * @removed Not used by anything since API 2. 3130 */ 3131 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible"; 3132 3133 /** 3134 * Persistent store for the system-wide default ringtone URI. 3135 * <p> 3136 * If you need to play the default ringtone at any given time, it is recommended 3137 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve 3138 * to the set default ringtone at the time of playing. 3139 * 3140 * @see #DEFAULT_RINGTONE_URI 3141 */ 3142 public static final String RINGTONE = "ringtone"; 3143 3144 private static final Validator RINGTONE_VALIDATOR = sUriValidator; 3145 3146 /** 3147 * A {@link Uri} that will point to the current default ringtone at any 3148 * given time. 3149 * <p> 3150 * If the current default ringtone is in the DRM provider and the caller 3151 * does not have permission, the exception will be a 3152 * FileNotFoundException. 3153 */ 3154 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE); 3155 3156 /** {@hide} */ 3157 public static final String RINGTONE_CACHE = "ringtone_cache"; 3158 /** {@hide} */ 3159 public static final Uri RINGTONE_CACHE_URI = getUriFor(RINGTONE_CACHE); 3160 3161 /** 3162 * Persistent store for the system-wide default notification sound. 3163 * 3164 * @see #RINGTONE 3165 * @see #DEFAULT_NOTIFICATION_URI 3166 */ 3167 public static final String NOTIFICATION_SOUND = "notification_sound"; 3168 3169 private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator; 3170 3171 /** 3172 * A {@link Uri} that will point to the current default notification 3173 * sound at any given time. 3174 * 3175 * @see #DEFAULT_RINGTONE_URI 3176 */ 3177 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND); 3178 3179 /** {@hide} */ 3180 public static final String NOTIFICATION_SOUND_CACHE = "notification_sound_cache"; 3181 /** {@hide} */ 3182 public static final Uri NOTIFICATION_SOUND_CACHE_URI = getUriFor(NOTIFICATION_SOUND_CACHE); 3183 3184 /** 3185 * Persistent store for the system-wide default alarm alert. 3186 * 3187 * @see #RINGTONE 3188 * @see #DEFAULT_ALARM_ALERT_URI 3189 */ 3190 public static final String ALARM_ALERT = "alarm_alert"; 3191 3192 private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator; 3193 3194 /** 3195 * A {@link Uri} that will point to the current default alarm alert at 3196 * any given time. 3197 * 3198 * @see #DEFAULT_ALARM_ALERT_URI 3199 */ 3200 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT); 3201 3202 /** {@hide} */ 3203 public static final String ALARM_ALERT_CACHE = "alarm_alert_cache"; 3204 /** {@hide} */ 3205 public static final Uri ALARM_ALERT_CACHE_URI = getUriFor(ALARM_ALERT_CACHE); 3206 3207 /** 3208 * Persistent store for the system default media button event receiver. 3209 * 3210 * @hide 3211 */ 3212 public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver"; 3213 3214 private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() { 3215 @Override 3216 public boolean validate(String value) { 3217 try { 3218 ComponentName.unflattenFromString(value); 3219 return true; 3220 } catch (NullPointerException e) { 3221 return false; 3222 } 3223 } 3224 }; 3225 3226 /** 3227 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off 3228 */ 3229 public static final String TEXT_AUTO_REPLACE = "auto_replace"; 3230 3231 private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator; 3232 3233 /** 3234 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off 3235 */ 3236 public static final String TEXT_AUTO_CAPS = "auto_caps"; 3237 3238 private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator; 3239 3240 /** 3241 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This 3242 * feature converts two spaces to a "." and space. 3243 */ 3244 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; 3245 3246 private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator; 3247 3248 /** 3249 * Setting to showing password characters in text editors. 1 = On, 0 = Off 3250 */ 3251 public static final String TEXT_SHOW_PASSWORD = "show_password"; 3252 3253 private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator; 3254 3255 public static final String SHOW_GTALK_SERVICE_STATUS = 3256 "SHOW_GTALK_SERVICE_STATUS"; 3257 3258 private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator; 3259 3260 /** 3261 * Name of activity to use for wallpaper on the home screen. 3262 * 3263 * @deprecated Use {@link WallpaperManager} instead. 3264 */ 3265 @Deprecated 3266 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; 3267 3268 private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() { 3269 private static final int MAX_LENGTH = 1000; 3270 3271 @Override 3272 public boolean validate(String value) { 3273 if (value != null && value.length() > MAX_LENGTH) { 3274 return false; 3275 } 3276 return ComponentName.unflattenFromString(value) != null; 3277 } 3278 }; 3279 3280 /** 3281 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME} 3282 * instead 3283 */ 3284 @Deprecated 3285 public static final String AUTO_TIME = Global.AUTO_TIME; 3286 3287 /** 3288 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE} 3289 * instead 3290 */ 3291 @Deprecated 3292 public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; 3293 3294 /** 3295 * Display times as 12 or 24 hours 3296 * 12 3297 * 24 3298 */ 3299 public static final String TIME_12_24 = "time_12_24"; 3300 3301 /** @hide */ 3302 public static final Validator TIME_12_24_VALIDATOR = 3303 new DiscreteValueValidator(new String[] {"12", "24"}); 3304 3305 /** 3306 * Date format string 3307 * mm/dd/yyyy 3308 * dd/mm/yyyy 3309 * yyyy/mm/dd 3310 */ 3311 public static final String DATE_FORMAT = "date_format"; 3312 3313 /** @hide */ 3314 public static final Validator DATE_FORMAT_VALIDATOR = new Validator() { 3315 @Override 3316 public boolean validate(String value) { 3317 try { 3318 new SimpleDateFormat(value); 3319 return true; 3320 } catch (IllegalArgumentException e) { 3321 return false; 3322 } 3323 } 3324 }; 3325 3326 /** 3327 * Whether the setup wizard has been run before (on first boot), or if 3328 * it still needs to be run. 3329 * 3330 * nonzero = it has been run in the past 3331 * 0 = it has not been run in the past 3332 */ 3333 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; 3334 3335 /** @hide */ 3336 public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator; 3337 3338 /** 3339 * Scaling factor for normal window animations. Setting to 0 will disable window 3340 * animations. 3341 * 3342 * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead 3343 */ 3344 @Deprecated 3345 public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE; 3346 3347 /** 3348 * Scaling factor for activity transition animations. Setting to 0 will disable window 3349 * animations. 3350 * 3351 * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead 3352 */ 3353 @Deprecated 3354 public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE; 3355 3356 /** 3357 * Scaling factor for Animator-based animations. This affects both the start delay and 3358 * duration of all such animations. Setting to 0 will cause animations to end immediately. 3359 * The default value is 1. 3360 * 3361 * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead 3362 */ 3363 @Deprecated 3364 public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE; 3365 3366 /** 3367 * Control whether the accelerometer will be used to change screen 3368 * orientation. If 0, it will not be used unless explicitly requested 3369 * by the application; if 1, it will be used by default unless explicitly 3370 * disabled by the application. 3371 */ 3372 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; 3373 3374 /** @hide */ 3375 public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator; 3376 3377 /** 3378 * Default screen rotation when no other policy applies. 3379 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a 3380 * preference, this rotation value will be used. Must be one of the 3381 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}. 3382 * 3383 * @see android.view.Display#getRotation 3384 */ 3385 public static final String USER_ROTATION = "user_rotation"; 3386 3387 /** @hide */ 3388 public static final Validator USER_ROTATION_VALIDATOR = 3389 new InclusiveIntegerRangeValidator(0, 3); 3390 3391 /** 3392 * Control whether the rotation lock toggle in the System UI should be hidden. 3393 * Typically this is done for accessibility purposes to make it harder for 3394 * the user to accidentally toggle the rotation lock while the display rotation 3395 * has been locked for accessibility. 3396 * 3397 * If 0, then rotation lock toggle is not hidden for accessibility (although it may be 3398 * unavailable for other reasons). If 1, then the rotation lock toggle is hidden. 3399 * 3400 * @hide 3401 */ 3402 public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY = 3403 "hide_rotation_lock_toggle_for_accessibility"; 3404 3405 /** @hide */ 3406 public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR = 3407 sBooleanValidator; 3408 3409 /** 3410 * Whether the phone vibrates when it is ringing due to an incoming call. This will 3411 * be used by Phone and Setting apps; it shouldn't affect other apps. 3412 * The value is boolean (1 or 0). 3413 * 3414 * Note: this is not same as "vibrate on ring", which had been available until ICS. 3415 * It was about AudioManager's setting and thus affected all the applications which 3416 * relied on the setting, while this is purely about the vibration setting for incoming 3417 * calls. 3418 */ 3419 public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing"; 3420 3421 /** @hide */ 3422 public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator; 3423 3424 /** 3425 * Whether the audible DTMF tones are played by the dialer when dialing. The value is 3426 * boolean (1 or 0). 3427 */ 3428 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; 3429 3430 /** @hide */ 3431 public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator; 3432 3433 /** 3434 * CDMA only settings 3435 * DTMF tone type played by the dialer when dialing. 3436 * 0 = Normal 3437 * 1 = Long 3438 */ 3439 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type"; 3440 3441 /** @hide */ 3442 public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator; 3443 3444 /** 3445 * Whether the hearing aid is enabled. The value is 3446 * boolean (1 or 0). 3447 * @hide 3448 */ 3449 public static final String HEARING_AID = "hearing_aid"; 3450 3451 /** @hide */ 3452 public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator; 3453 3454 /** 3455 * CDMA only settings 3456 * TTY Mode 3457 * 0 = OFF 3458 * 1 = FULL 3459 * 2 = VCO 3460 * 3 = HCO 3461 * @hide 3462 */ 3463 public static final String TTY_MODE = "tty_mode"; 3464 3465 /** @hide */ 3466 public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3); 3467 3468 /** 3469 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is 3470 * boolean (1 or 0). 3471 */ 3472 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; 3473 3474 /** @hide */ 3475 public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator; 3476 3477 /** 3478 * Whether the haptic feedback (long presses, ...) are enabled. The value is 3479 * boolean (1 or 0). 3480 */ 3481 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; 3482 3483 /** @hide */ 3484 public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator; 3485 3486 /** 3487 * @deprecated Each application that shows web suggestions should have its own 3488 * setting for this. 3489 */ 3490 @Deprecated 3491 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; 3492 3493 /** @hide */ 3494 public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator; 3495 3496 /** 3497 * Whether the notification LED should repeatedly flash when a notification is 3498 * pending. The value is boolean (1 or 0). 3499 * @hide 3500 */ 3501 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; 3502 3503 /** @hide */ 3504 public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator; 3505 3506 /** 3507 * Show pointer location on screen? 3508 * 0 = no 3509 * 1 = yes 3510 * @hide 3511 */ 3512 public static final String POINTER_LOCATION = "pointer_location"; 3513 3514 /** @hide */ 3515 public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator; 3516 3517 /** 3518 * Show touch positions on screen? 3519 * 0 = no 3520 * 1 = yes 3521 * @hide 3522 */ 3523 public static final String SHOW_TOUCHES = "show_touches"; 3524 3525 /** @hide */ 3526 public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator; 3527 3528 /** 3529 * Log raw orientation data from 3530 * {@link com.android.server.policy.WindowOrientationListener} for use with the 3531 * orientationplot.py tool. 3532 * 0 = no 3533 * 1 = yes 3534 * @hide 3535 */ 3536 public static final String WINDOW_ORIENTATION_LISTENER_LOG = 3537 "window_orientation_listener_log"; 3538 3539 /** @hide */ 3540 public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator; 3541 3542 /** 3543 * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED} 3544 * instead 3545 * @hide 3546 */ 3547 @Deprecated 3548 public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED; 3549 3550 /** 3551 * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED} 3552 * instead 3553 * @hide 3554 */ 3555 @Deprecated 3556 public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED; 3557 3558 /** 3559 * Whether to play sounds when the keyguard is shown and dismissed. 3560 * @hide 3561 */ 3562 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; 3563 3564 /** @hide */ 3565 public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator; 3566 3567 /** 3568 * Whether the lockscreen should be completely disabled. 3569 * @hide 3570 */ 3571 public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; 3572 3573 /** @hide */ 3574 public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator; 3575 3576 /** 3577 * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} 3578 * instead 3579 * @hide 3580 */ 3581 @Deprecated 3582 public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND; 3583 3584 /** 3585 * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND} 3586 * instead 3587 * @hide 3588 */ 3589 @Deprecated 3590 public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND; 3591 3592 /** 3593 * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} 3594 * instead 3595 * @hide 3596 */ 3597 @Deprecated 3598 public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; 3599 3600 /** 3601 * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} 3602 * instead 3603 * @hide 3604 */ 3605 @Deprecated 3606 public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; 3607 3608 /** 3609 * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} 3610 * instead 3611 * @hide 3612 */ 3613 @Deprecated 3614 public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; 3615 3616 /** 3617 * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} 3618 * instead 3619 * @hide 3620 */ 3621 @Deprecated 3622 public static final String LOCK_SOUND = Global.LOCK_SOUND; 3623 3624 /** 3625 * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} 3626 * instead 3627 * @hide 3628 */ 3629 @Deprecated 3630 public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; 3631 3632 /** 3633 * Receive incoming SIP calls? 3634 * 0 = no 3635 * 1 = yes 3636 * @hide 3637 */ 3638 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; 3639 3640 /** @hide */ 3641 public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator; 3642 3643 /** 3644 * Call Preference String. 3645 * "SIP_ALWAYS" : Always use SIP with network access 3646 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address 3647 * @hide 3648 */ 3649 public static final String SIP_CALL_OPTIONS = "sip_call_options"; 3650 3651 /** @hide */ 3652 public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator( 3653 new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"}); 3654 3655 /** 3656 * One of the sip call options: Always use SIP with network access. 3657 * @hide 3658 */ 3659 public static final String SIP_ALWAYS = "SIP_ALWAYS"; 3660 3661 /** @hide */ 3662 public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator; 3663 3664 /** 3665 * One of the sip call options: Only if destination is a SIP address. 3666 * @hide 3667 */ 3668 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; 3669 3670 /** @hide */ 3671 public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator; 3672 3673 /** 3674 * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that 3675 * the user should be prompted each time a call is made whether it should be placed using 3676 * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with 3677 * SIP_ADDRESS_ONLY. 3678 * @hide 3679 */ 3680 @Deprecated 3681 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; 3682 3683 /** @hide */ 3684 public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator; 3685 3686 /** 3687 * Pointer speed setting. 3688 * This is an integer value in a range between -7 and +7, so there are 15 possible values. 3689 * -7 = slowest 3690 * 0 = default speed 3691 * +7 = fastest 3692 * @hide 3693 */ 3694 public static final String POINTER_SPEED = "pointer_speed"; 3695 3696 /** @hide */ 3697 public static final Validator POINTER_SPEED_VALIDATOR = 3698 new InclusiveFloatRangeValidator(-7, 7); 3699 3700 /** 3701 * Whether lock-to-app will be triggered by long-press on recents. 3702 * @hide 3703 */ 3704 public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled"; 3705 3706 /** @hide */ 3707 public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator; 3708 3709 /** 3710 * I am the lolrus. 3711 * <p> 3712 * Nonzero values indicate that the user has a bukkit. 3713 * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>. 3714 * @hide 3715 */ 3716 public static final String EGG_MODE = "egg_mode"; 3717 3718 /** @hide */ 3719 public static final Validator EGG_MODE_VALIDATOR = new Validator() { 3720 @Override 3721 public boolean validate(String value) { 3722 try { 3723 return Long.parseLong(value) >= 0; 3724 } catch (NumberFormatException e) { 3725 return false; 3726 } 3727 } 3728 }; 3729 3730 /** 3731 * IMPORTANT: If you add a new public settings you also have to add it to 3732 * PUBLIC_SETTINGS below. If the new setting is hidden you have to add 3733 * it to PRIVATE_SETTINGS below. Also add a validator that can validate 3734 * the setting value. See an example above. 3735 */ 3736 3737 /** 3738 * Settings to backup. This is here so that it's in the same place as the settings 3739 * keys and easy to update. 3740 * 3741 * NOTE: Settings are backed up and restored in the order they appear 3742 * in this array. If you have one setting depending on another, 3743 * make sure that they are ordered appropriately. 3744 * 3745 * @hide 3746 */ 3747 public static final String[] SETTINGS_TO_BACKUP = { 3748 STAY_ON_WHILE_PLUGGED_IN, // moved to global 3749 WIFI_USE_STATIC_IP, 3750 WIFI_STATIC_IP, 3751 WIFI_STATIC_GATEWAY, 3752 WIFI_STATIC_NETMASK, 3753 WIFI_STATIC_DNS1, 3754 WIFI_STATIC_DNS2, 3755 BLUETOOTH_DISCOVERABILITY, 3756 BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3757 FONT_SCALE, 3758 DIM_SCREEN, 3759 SCREEN_OFF_TIMEOUT, 3760 SCREEN_BRIGHTNESS, 3761 SCREEN_BRIGHTNESS_MODE, 3762 SCREEN_AUTO_BRIGHTNESS_ADJ, 3763 VIBRATE_INPUT_DEVICES, 3764 MODE_RINGER_STREAMS_AFFECTED, 3765 TEXT_AUTO_REPLACE, 3766 TEXT_AUTO_CAPS, 3767 TEXT_AUTO_PUNCTUATE, 3768 TEXT_SHOW_PASSWORD, 3769 AUTO_TIME, // moved to global 3770 AUTO_TIME_ZONE, // moved to global 3771 TIME_12_24, 3772 DATE_FORMAT, 3773 DTMF_TONE_WHEN_DIALING, 3774 DTMF_TONE_TYPE_WHEN_DIALING, 3775 HEARING_AID, 3776 TTY_MODE, 3777 MASTER_MONO, 3778 SOUND_EFFECTS_ENABLED, 3779 HAPTIC_FEEDBACK_ENABLED, 3780 POWER_SOUNDS_ENABLED, // moved to global 3781 DOCK_SOUNDS_ENABLED, // moved to global 3782 LOCKSCREEN_SOUNDS_ENABLED, 3783 SHOW_WEB_SUGGESTIONS, 3784 SIP_CALL_OPTIONS, 3785 SIP_RECEIVE_CALLS, 3786 POINTER_SPEED, 3787 VIBRATE_WHEN_RINGING, 3788 RINGTONE, 3789 LOCK_TO_APP_ENABLED, 3790 NOTIFICATION_SOUND, 3791 ACCELEROMETER_ROTATION 3792 }; 3793 3794 /** 3795 * These are all public system settings 3796 * 3797 * @hide 3798 */ 3799 public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>(); 3800 static { 3801 PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR); 3802 PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP); 3803 PUBLIC_SETTINGS.add(WIFI_STATIC_IP); 3804 PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY); 3805 PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK); 3806 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1); 3807 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2); 3808 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY); 3809 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT); 3810 PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED); 3811 PUBLIC_SETTINGS.add(FONT_SCALE); 3812 PUBLIC_SETTINGS.add(DIM_SCREEN); 3813 PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT); 3814 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS); 3815 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE); 3816 PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED); 3817 PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED); 3818 PUBLIC_SETTINGS.add(VIBRATE_ON); 3819 PUBLIC_SETTINGS.add(VOLUME_RING); 3820 PUBLIC_SETTINGS.add(VOLUME_SYSTEM); 3821 PUBLIC_SETTINGS.add(VOLUME_VOICE); 3822 PUBLIC_SETTINGS.add(VOLUME_MUSIC); 3823 PUBLIC_SETTINGS.add(VOLUME_ALARM); 3824 PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION); 3825 PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO); 3826 PUBLIC_SETTINGS.add(RINGTONE); 3827 PUBLIC_SETTINGS.add(NOTIFICATION_SOUND); 3828 PUBLIC_SETTINGS.add(ALARM_ALERT); 3829 PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE); 3830 PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS); 3831 PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE); 3832 PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD); 3833 PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS); 3834 PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY); 3835 PUBLIC_SETTINGS.add(TIME_12_24); 3836 PUBLIC_SETTINGS.add(DATE_FORMAT); 3837 PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN); 3838 PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION); 3839 PUBLIC_SETTINGS.add(USER_ROTATION); 3840 PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING); 3841 PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED); 3842 PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); 3843 PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS); 3844 PUBLIC_SETTINGS.add(VIBRATE_WHEN_RINGING); 3845 } 3846 3847 /** 3848 * These are all hidden system settings. 3849 * 3850 * @hide 3851 */ 3852 public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>(); 3853 static { 3854 PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP); 3855 PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR); 3856 PRIVATE_SETTINGS.add(ADVANCED_SETTINGS); 3857 PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ); 3858 PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES); 3859 PRIVATE_SETTINGS.add(VOLUME_MASTER); 3860 PRIVATE_SETTINGS.add(MASTER_MONO); 3861 PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME); 3862 PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT); 3863 PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER); 3864 PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY); 3865 PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING); 3866 PRIVATE_SETTINGS.add(HEARING_AID); 3867 PRIVATE_SETTINGS.add(TTY_MODE); 3868 PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE); 3869 PRIVATE_SETTINGS.add(POINTER_LOCATION); 3870 PRIVATE_SETTINGS.add(SHOW_TOUCHES); 3871 PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG); 3872 PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED); 3873 PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED); 3874 PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED); 3875 PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED); 3876 PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND); 3877 PRIVATE_SETTINGS.add(DESK_DOCK_SOUND); 3878 PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND); 3879 PRIVATE_SETTINGS.add(CAR_DOCK_SOUND); 3880 PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND); 3881 PRIVATE_SETTINGS.add(LOCK_SOUND); 3882 PRIVATE_SETTINGS.add(UNLOCK_SOUND); 3883 PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS); 3884 PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS); 3885 PRIVATE_SETTINGS.add(SIP_ALWAYS); 3886 PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY); 3887 PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME); 3888 PRIVATE_SETTINGS.add(POINTER_SPEED); 3889 PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED); 3890 PRIVATE_SETTINGS.add(EGG_MODE); 3891 } 3892 3893 /** 3894 * These are all public system settings 3895 * 3896 * @hide 3897 */ 3898 public static final Map<String, Validator> VALIDATORS = new ArrayMap<>(); 3899 static { 3900 VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR); 3901 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 3902 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR); 3903 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3904 BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR); 3905 VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR); 3906 VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR); 3907 VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR); 3908 VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR); 3909 VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR); 3910 VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR); 3911 VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR); 3912 VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR); 3913 VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR); 3914 VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR); 3915 VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR); 3916 VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR); 3917 VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR); 3918 VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR); 3919 VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR); 3920 VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR); 3921 VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR); 3922 VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR); 3923 VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR); 3924 VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR); 3925 VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR); 3926 VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR); 3927 VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR); 3928 VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR); 3929 VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR); 3930 VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR); 3931 VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR); 3932 VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR); 3933 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 3934 VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR); 3935 VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR); 3936 VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR); 3937 VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR); 3938 VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR); 3939 VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR); 3940 VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR); 3941 VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR); 3942 VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 3943 HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR); 3944 VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR); 3945 VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR); 3946 VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR); 3947 VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR); 3948 VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR); 3949 VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR); 3950 VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR); 3951 VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG, 3952 WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR); 3953 VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR); 3954 VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR); 3955 VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR); 3956 VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR); 3957 VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR); 3958 VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR); 3959 VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR); 3960 VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR); 3961 VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR); 3962 VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR); 3963 VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR); 3964 VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR); 3965 VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); 3966 VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); 3967 VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); 3968 } 3969 3970 /** 3971 * These entries are considered common between the personal and the managed profile, 3972 * since the managed profile doesn't get to change them. 3973 */ 3974 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 3975 static { 3976 CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT); 3977 CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED); 3978 CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED); 3979 CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD); 3980 CLONE_TO_MANAGED_PROFILE.add(TIME_12_24); 3981 } 3982 3983 /** @hide */ 3984 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 3985 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 3986 } 3987 3988 /** 3989 * These entries should be cloned from this profile's parent only if the dependency's 3990 * value is true ("1") 3991 * 3992 * Note: the dependencies must be Secure settings 3993 * 3994 * @hide 3995 */ 3996 public static final Map<String, String> CLONE_FROM_PARENT_ON_VALUE = new ArrayMap<>(); 3997 static { 3998 CLONE_FROM_PARENT_ON_VALUE.put(RINGTONE, Secure.SYNC_PARENT_SOUNDS); 3999 CLONE_FROM_PARENT_ON_VALUE.put(NOTIFICATION_SOUND, Secure.SYNC_PARENT_SOUNDS); 4000 CLONE_FROM_PARENT_ON_VALUE.put(ALARM_ALERT, Secure.SYNC_PARENT_SOUNDS); 4001 } 4002 4003 /** @hide */ 4004 public static void getCloneFromParentOnValueSettings(Map<String, String> outMap) { 4005 outMap.putAll(CLONE_FROM_PARENT_ON_VALUE); 4006 } 4007 4008 /** 4009 * When to use Wi-Fi calling 4010 * 4011 * @see android.telephony.TelephonyManager.WifiCallingChoices 4012 * @hide 4013 */ 4014 public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls"; 4015 4016 // Settings moved to Settings.Secure 4017 4018 /** 4019 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} 4020 * instead 4021 */ 4022 @Deprecated 4023 public static final String ADB_ENABLED = Global.ADB_ENABLED; 4024 4025 /** 4026 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead 4027 */ 4028 @Deprecated 4029 public static final String ANDROID_ID = Secure.ANDROID_ID; 4030 4031 /** 4032 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 4033 */ 4034 @Deprecated 4035 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 4036 4037 /** 4038 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 4039 */ 4040 @Deprecated 4041 public static final String DATA_ROAMING = Global.DATA_ROAMING; 4042 4043 /** 4044 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 4045 */ 4046 @Deprecated 4047 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 4048 4049 /** 4050 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead 4051 */ 4052 @Deprecated 4053 public static final String HTTP_PROXY = Global.HTTP_PROXY; 4054 4055 /** 4056 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 4057 */ 4058 @Deprecated 4059 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 4060 4061 /** 4062 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} 4063 * instead 4064 */ 4065 @Deprecated 4066 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; 4067 4068 /** 4069 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead 4070 */ 4071 @Deprecated 4072 public static final String LOGGING_ID = Secure.LOGGING_ID; 4073 4074 /** 4075 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 4076 */ 4077 @Deprecated 4078 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 4079 4080 /** 4081 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} 4082 * instead 4083 */ 4084 @Deprecated 4085 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; 4086 4087 /** 4088 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} 4089 * instead 4090 */ 4091 @Deprecated 4092 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; 4093 4094 /** 4095 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} 4096 * instead 4097 */ 4098 @Deprecated 4099 public static final String PARENTAL_CONTROL_REDIRECT_URL = 4100 Secure.PARENTAL_CONTROL_REDIRECT_URL; 4101 4102 /** 4103 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead 4104 */ 4105 @Deprecated 4106 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; 4107 4108 /** 4109 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 4110 */ 4111 @Deprecated 4112 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 4113 4114 /** 4115 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 4116 */ 4117 @Deprecated 4118 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 4119 4120 /** 4121 * @deprecated Use 4122 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 4123 */ 4124 @Deprecated 4125 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 4126 4127 /** 4128 * @deprecated Use 4129 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 4130 */ 4131 @Deprecated 4132 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 4133 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 4134 4135 /** 4136 * @deprecated Use 4137 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead 4138 */ 4139 @Deprecated 4140 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4141 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 4142 4143 /** 4144 * @deprecated Use 4145 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead 4146 */ 4147 @Deprecated 4148 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 4149 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 4150 4151 /** 4152 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 4153 * instead 4154 */ 4155 @Deprecated 4156 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 4157 4158 /** 4159 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead 4160 */ 4161 @Deprecated 4162 public static final String WIFI_ON = Global.WIFI_ON; 4163 4164 /** 4165 * @deprecated Use 4166 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} 4167 * instead 4168 */ 4169 @Deprecated 4170 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 4171 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; 4172 4173 /** 4174 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead 4175 */ 4176 @Deprecated 4177 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; 4178 4179 /** 4180 * @deprecated Use 4181 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead 4182 */ 4183 @Deprecated 4184 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 4185 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; 4186 4187 /** 4188 * @deprecated Use 4189 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead 4190 */ 4191 @Deprecated 4192 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 4193 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; 4194 4195 /** 4196 * @deprecated Use 4197 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} 4198 * instead 4199 */ 4200 @Deprecated 4201 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 4202 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; 4203 4204 /** 4205 * @deprecated Use 4206 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead 4207 */ 4208 @Deprecated 4209 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 4210 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; 4211 4212 /** 4213 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} 4214 * instead 4215 */ 4216 @Deprecated 4217 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; 4218 4219 /** 4220 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 4221 */ 4222 @Deprecated 4223 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON; 4224 4225 /** 4226 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead 4227 */ 4228 @Deprecated 4229 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; 4230 4231 /** 4232 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} 4233 * instead 4234 */ 4235 @Deprecated 4236 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; 4237 4238 /** 4239 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} 4240 * instead 4241 */ 4242 @Deprecated 4243 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = 4244 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; 4245 4246 /** 4247 * Checks if the specified app can modify system settings. As of API 4248 * level 23, an app cannot modify system settings unless it declares the 4249 * {@link android.Manifest.permission#WRITE_SETTINGS} 4250 * permission in its manifest, <em>and</em> the user specifically grants 4251 * the app this capability. To prompt the user to grant this approval, 4252 * the app must send an intent with the action {@link 4253 * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes 4254 * the system to display a permission management screen. 4255 * 4256 * @param context App context. 4257 * @return true if the calling app can write to system settings, false otherwise 4258 */ 4259 public static boolean canWrite(Context context) { 4260 return isCallingPackageAllowedToWriteSettings(context, Process.myUid(), 4261 context.getOpPackageName(), false); 4262 } 4263 } 4264 4265 /** 4266 * Secure system settings, containing system preferences that applications 4267 * can read but are not allowed to write. These are for preferences that 4268 * the user must explicitly modify through the system UI or specialized 4269 * APIs for those values, not modified directly by applications. 4270 */ 4271 public static final class Secure extends NameValueTable { 4272 /** 4273 * The content:// style URL for this table 4274 */ 4275 public static final Uri CONTENT_URI = 4276 Uri.parse("content://" + AUTHORITY + "/secure"); 4277 4278 private static final ContentProviderHolder sProviderHolder = 4279 new ContentProviderHolder(CONTENT_URI); 4280 4281 // Populated lazily, guarded by class object: 4282 private static final NameValueCache sNameValueCache = new NameValueCache( 4283 CONTENT_URI, 4284 CALL_METHOD_GET_SECURE, 4285 CALL_METHOD_PUT_SECURE, 4286 sProviderHolder); 4287 4288 private static ILockSettings sLockSettings = null; 4289 4290 private static boolean sIsSystemProcess; 4291 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; 4292 private static final HashSet<String> MOVED_TO_GLOBAL; 4293 static { 4294 MOVED_TO_LOCK_SETTINGS = new HashSet<>(3); 4295 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); 4296 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); 4297 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 4298 4299 MOVED_TO_GLOBAL = new HashSet<>(); 4300 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED); 4301 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED); 4302 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON); 4303 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU); 4304 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS); 4305 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE); 4306 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE); 4307 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE); 4308 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI); 4309 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING); 4310 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED); 4311 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED); 4312 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); 4313 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); 4314 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); 4315 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); 4316 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); 4317 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); 4318 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES); 4319 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE); 4320 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED); 4321 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES); 4322 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL); 4323 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED); 4324 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE); 4325 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION); 4326 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE); 4327 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES); 4328 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE); 4329 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION); 4330 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE); 4331 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES); 4332 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE); 4333 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE); 4334 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF); 4335 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING); 4336 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER); 4337 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT); 4338 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT); 4339 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS); 4340 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT); 4341 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS); 4342 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT); 4343 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS); 4344 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL); 4345 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST); 4346 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL); 4347 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN); 4348 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED); 4349 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED); 4350 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED); 4351 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); 4352 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); 4353 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); 4354 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); 4355 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); 4356 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); 4357 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); 4358 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 4359 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 4360 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); 4361 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); 4362 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); 4363 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); 4364 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); 4365 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); 4366 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED); 4367 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN); 4368 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI); 4369 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); 4370 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); 4371 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); 4372 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); 4373 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); 4374 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); 4375 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); 4376 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); 4377 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); 4378 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); 4379 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); 4380 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); 4381 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); 4382 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); 4383 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); 4384 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); 4385 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); 4386 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); 4387 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); 4388 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); 4389 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); 4390 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); 4391 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); 4392 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); 4393 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); 4394 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); 4395 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); 4396 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); 4397 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); 4398 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); 4399 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); 4400 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); 4401 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); 4402 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); 4403 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); 4404 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); 4405 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); 4406 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); 4407 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); 4408 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); 4409 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); 4410 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); 4411 MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY); 4412 } 4413 4414 /** @hide */ 4415 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 4416 outKeySet.addAll(MOVED_TO_GLOBAL); 4417 } 4418 4419 /** 4420 * Look up a name in the database. 4421 * @param resolver to access the database with 4422 * @param name to look up in the table 4423 * @return the corresponding value, or null if not present 4424 */ 4425 public static String getString(ContentResolver resolver, String name) { 4426 return getStringForUser(resolver, name, UserHandle.myUserId()); 4427 } 4428 4429 /** @hide */ 4430 public static String getStringForUser(ContentResolver resolver, String name, 4431 int userHandle) { 4432 if (MOVED_TO_GLOBAL.contains(name)) { 4433 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 4434 + " to android.provider.Settings.Global."); 4435 return Global.getStringForUser(resolver, name, userHandle); 4436 } 4437 4438 if (MOVED_TO_LOCK_SETTINGS.contains(name)) { 4439 synchronized (Secure.class) { 4440 if (sLockSettings == null) { 4441 sLockSettings = ILockSettings.Stub.asInterface( 4442 (IBinder) ServiceManager.getService("lock_settings")); 4443 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; 4444 } 4445 } 4446 if (sLockSettings != null && !sIsSystemProcess) { 4447 // No context; use the ActivityThread's context as an approximation for 4448 // determining the target API level. 4449 Application application = ActivityThread.currentApplication(); 4450 4451 boolean isPreMnc = application != null 4452 && application.getApplicationInfo() != null 4453 && application.getApplicationInfo().targetSdkVersion 4454 <= VERSION_CODES.LOLLIPOP_MR1; 4455 if (isPreMnc) { 4456 try { 4457 return sLockSettings.getString(name, "0", userHandle); 4458 } catch (RemoteException re) { 4459 // Fall through 4460 } 4461 } else { 4462 throw new SecurityException("Settings.Secure." + name 4463 + " is deprecated and no longer accessible." 4464 + " See API documentation for potential replacements."); 4465 } 4466 } 4467 } 4468 4469 return sNameValueCache.getStringForUser(resolver, name, userHandle); 4470 } 4471 4472 /** 4473 * Store a name/value pair into the database. 4474 * @param resolver to access the database with 4475 * @param name to store 4476 * @param value to associate with the name 4477 * @return true if the value was set, false on database errors 4478 */ 4479 public static boolean putString(ContentResolver resolver, String name, String value) { 4480 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 4481 } 4482 4483 /** @hide */ 4484 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 4485 int userHandle) { 4486 return putStringForUser(resolver, name, value, null, false, userHandle); 4487 } 4488 4489 /** @hide */ 4490 public static boolean putStringForUser(@NonNull ContentResolver resolver, 4491 @NonNull String name, @Nullable String value, @Nullable String tag, 4492 boolean makeDefault, @UserIdInt int userHandle) { 4493 if (LOCATION_MODE.equals(name)) { 4494 // Map LOCATION_MODE to underlying location provider storage API 4495 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle); 4496 } 4497 if (MOVED_TO_GLOBAL.contains(name)) { 4498 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" 4499 + " to android.provider.Settings.Global"); 4500 return Global.putStringForUser(resolver, name, value, 4501 tag, makeDefault, userHandle); 4502 } 4503 return sNameValueCache.putStringForUser(resolver, name, value, tag, 4504 makeDefault, userHandle); 4505 } 4506 4507 /** 4508 * Store a name/value pair into the database. 4509 * <p> 4510 * The method takes an optional tag to associate with the setting 4511 * which can be used to clear only settings made by your package and 4512 * associated with this tag by passing the tag to {@link 4513 * #resetToDefaults(ContentResolver, String)}. Anyone can override 4514 * the current tag. Also if another package changes the setting 4515 * then the tag will be set to the one specified in the set call 4516 * which can be null. Also any of the settings setters that do not 4517 * take a tag as an argument effectively clears the tag. 4518 * </p><p> 4519 * For example, if you set settings A and B with tags T1 and T2 and 4520 * another app changes setting A (potentially to the same value), it 4521 * can assign to it a tag T3 (note that now the package that changed 4522 * the setting is not yours). Now if you reset your changes for T1 and 4523 * T2 only setting B will be reset and A not (as it was changed by 4524 * another package) but since A did not change you are in the desired 4525 * initial state. Now if the other app changes the value of A (assuming 4526 * you registered an observer in the beginning) you would detect that 4527 * the setting was changed by another app and handle this appropriately 4528 * (ignore, set back to some value, etc). 4529 * </p><p> 4530 * Also the method takes an argument whether to make the value the 4531 * default for this setting. If the system already specified a default 4532 * value, then the one passed in here will <strong>not</strong> 4533 * be set as the default. 4534 * </p> 4535 * 4536 * @param resolver to access the database with. 4537 * @param name to store. 4538 * @param value to associate with the name. 4539 * @param tag to associate with the setting. 4540 * @param makeDefault whether to make the value the default one. 4541 * @return true if the value was set, false on database errors. 4542 * 4543 * @see #resetToDefaults(ContentResolver, String) 4544 * 4545 * @hide 4546 */ 4547 @SystemApi 4548 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 4549 public static boolean putString(@NonNull ContentResolver resolver, 4550 @NonNull String name, @Nullable String value, @Nullable String tag, 4551 boolean makeDefault) { 4552 return putStringForUser(resolver, name, value, tag, makeDefault, 4553 UserHandle.myUserId()); 4554 } 4555 4556 /** 4557 * Reset the settings to their defaults. This would reset <strong>only</strong> 4558 * settings set by the caller's package. Think of it of a way to undo your own 4559 * changes to the global settings. Passing in the optional tag will reset only 4560 * settings changed by your package and associated with this tag. 4561 * 4562 * @param resolver Handle to the content resolver. 4563 * @param tag Optional tag which should be associated with the settings to reset. 4564 * 4565 * @see #putString(ContentResolver, String, String, String, boolean) 4566 * 4567 * @hide 4568 */ 4569 @SystemApi 4570 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 4571 public static void resetToDefaults(@NonNull ContentResolver resolver, 4572 @Nullable String tag) { 4573 resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS, 4574 UserHandle.myUserId()); 4575 } 4576 4577 /** 4578 * 4579 * Reset the settings to their defaults for a given user with a specific mode. The 4580 * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS} 4581 * allowing resetting the settings made by a package and associated with the tag. 4582 * 4583 * @param resolver Handle to the content resolver. 4584 * @param tag Optional tag which should be associated with the settings to reset. 4585 * @param mode The reset mode. 4586 * @param userHandle The user for which to reset to defaults. 4587 * 4588 * @see #RESET_MODE_PACKAGE_DEFAULTS 4589 * @see #RESET_MODE_UNTRUSTED_DEFAULTS 4590 * @see #RESET_MODE_UNTRUSTED_CHANGES 4591 * @see #RESET_MODE_TRUSTED_DEFAULTS 4592 * 4593 * @hide 4594 */ 4595 public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver, 4596 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) { 4597 try { 4598 Bundle arg = new Bundle(); 4599 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 4600 if (tag != null) { 4601 arg.putString(CALL_METHOD_TAG_KEY, tag); 4602 } 4603 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode); 4604 IContentProvider cp = sProviderHolder.getProvider(resolver); 4605 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_SECURE, null, arg); 4606 } catch (RemoteException e) { 4607 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e); 4608 } 4609 } 4610 4611 /** 4612 * Construct the content URI for a particular name/value pair, 4613 * useful for monitoring changes with a ContentObserver. 4614 * @param name to look up in the table 4615 * @return the corresponding content URI, or null if not present 4616 */ 4617 public static Uri getUriFor(String name) { 4618 if (MOVED_TO_GLOBAL.contains(name)) { 4619 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 4620 + " to android.provider.Settings.Global, returning global URI."); 4621 return Global.getUriFor(Global.CONTENT_URI, name); 4622 } 4623 return getUriFor(CONTENT_URI, name); 4624 } 4625 4626 /** 4627 * Convenience function for retrieving a single secure settings value 4628 * as an integer. Note that internally setting values are always 4629 * stored as strings; this function converts the string to an integer 4630 * for you. The default value will be returned if the setting is 4631 * not defined or not an integer. 4632 * 4633 * @param cr The ContentResolver to access. 4634 * @param name The name of the setting to retrieve. 4635 * @param def Value to return if the setting is not defined. 4636 * 4637 * @return The setting's current value, or 'def' if it is not defined 4638 * or not a valid integer. 4639 */ 4640 public static int getInt(ContentResolver cr, String name, int def) { 4641 return getIntForUser(cr, name, def, UserHandle.myUserId()); 4642 } 4643 4644 /** @hide */ 4645 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 4646 if (LOCATION_MODE.equals(name)) { 4647 // Map from to underlying location provider storage API to location mode 4648 return getLocationModeForUser(cr, userHandle); 4649 } 4650 String v = getStringForUser(cr, name, userHandle); 4651 try { 4652 return v != null ? Integer.parseInt(v) : def; 4653 } catch (NumberFormatException e) { 4654 return def; 4655 } 4656 } 4657 4658 /** 4659 * Convenience function for retrieving a single secure settings value 4660 * as an integer. Note that internally setting values are always 4661 * stored as strings; this function converts the string to an integer 4662 * for you. 4663 * <p> 4664 * This version does not take a default value. If the setting has not 4665 * been set, or the string value is not a number, 4666 * it throws {@link SettingNotFoundException}. 4667 * 4668 * @param cr The ContentResolver to access. 4669 * @param name The name of the setting to retrieve. 4670 * 4671 * @throws SettingNotFoundException Thrown if a setting by the given 4672 * name can't be found or the setting value is not an integer. 4673 * 4674 * @return The setting's current value. 4675 */ 4676 public static int getInt(ContentResolver cr, String name) 4677 throws SettingNotFoundException { 4678 return getIntForUser(cr, name, UserHandle.myUserId()); 4679 } 4680 4681 /** @hide */ 4682 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 4683 throws SettingNotFoundException { 4684 if (LOCATION_MODE.equals(name)) { 4685 // Map from to underlying location provider storage API to location mode 4686 return getLocationModeForUser(cr, userHandle); 4687 } 4688 String v = getStringForUser(cr, name, userHandle); 4689 try { 4690 return Integer.parseInt(v); 4691 } catch (NumberFormatException e) { 4692 throw new SettingNotFoundException(name); 4693 } 4694 } 4695 4696 /** 4697 * Convenience function for updating a single settings value as an 4698 * integer. This will either create a new entry in the table if the 4699 * given name does not exist, or modify the value of the existing row 4700 * with that name. Note that internally setting values are always 4701 * stored as strings, so this function converts the given value to a 4702 * string before storing it. 4703 * 4704 * @param cr The ContentResolver to access. 4705 * @param name The name of the setting to modify. 4706 * @param value The new value for the setting. 4707 * @return true if the value was set, false on database errors 4708 */ 4709 public static boolean putInt(ContentResolver cr, String name, int value) { 4710 return putIntForUser(cr, name, value, UserHandle.myUserId()); 4711 } 4712 4713 /** @hide */ 4714 public static boolean putIntForUser(ContentResolver cr, String name, int value, 4715 int userHandle) { 4716 return putStringForUser(cr, name, Integer.toString(value), userHandle); 4717 } 4718 4719 /** 4720 * Convenience function for retrieving a single secure settings value 4721 * as a {@code long}. Note that internally setting values are always 4722 * stored as strings; this function converts the string to a {@code long} 4723 * for you. The default value will be returned if the setting is 4724 * not defined or not a {@code long}. 4725 * 4726 * @param cr The ContentResolver to access. 4727 * @param name The name of the setting to retrieve. 4728 * @param def Value to return if the setting is not defined. 4729 * 4730 * @return The setting's current value, or 'def' if it is not defined 4731 * or not a valid {@code long}. 4732 */ 4733 public static long getLong(ContentResolver cr, String name, long def) { 4734 return getLongForUser(cr, name, def, UserHandle.myUserId()); 4735 } 4736 4737 /** @hide */ 4738 public static long getLongForUser(ContentResolver cr, String name, long def, 4739 int userHandle) { 4740 String valString = getStringForUser(cr, name, userHandle); 4741 long value; 4742 try { 4743 value = valString != null ? Long.parseLong(valString) : def; 4744 } catch (NumberFormatException e) { 4745 value = def; 4746 } 4747 return value; 4748 } 4749 4750 /** 4751 * Convenience function for retrieving a single secure settings value 4752 * as a {@code long}. Note that internally setting values are always 4753 * stored as strings; this function converts the string to a {@code long} 4754 * for you. 4755 * <p> 4756 * This version does not take a default value. If the setting has not 4757 * been set, or the string value is not a number, 4758 * it throws {@link SettingNotFoundException}. 4759 * 4760 * @param cr The ContentResolver to access. 4761 * @param name The name of the setting to retrieve. 4762 * 4763 * @return The setting's current value. 4764 * @throws SettingNotFoundException Thrown if a setting by the given 4765 * name can't be found or the setting value is not an integer. 4766 */ 4767 public static long getLong(ContentResolver cr, String name) 4768 throws SettingNotFoundException { 4769 return getLongForUser(cr, name, UserHandle.myUserId()); 4770 } 4771 4772 /** @hide */ 4773 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 4774 throws SettingNotFoundException { 4775 String valString = getStringForUser(cr, name, userHandle); 4776 try { 4777 return Long.parseLong(valString); 4778 } catch (NumberFormatException e) { 4779 throw new SettingNotFoundException(name); 4780 } 4781 } 4782 4783 /** 4784 * Convenience function for updating a secure settings value as a long 4785 * integer. This will either create a new entry in the table if the 4786 * given name does not exist, or modify the value of the existing row 4787 * with that name. Note that internally setting values are always 4788 * stored as strings, so this function converts the given value to a 4789 * string before storing it. 4790 * 4791 * @param cr The ContentResolver to access. 4792 * @param name The name of the setting to modify. 4793 * @param value The new value for the setting. 4794 * @return true if the value was set, false on database errors 4795 */ 4796 public static boolean putLong(ContentResolver cr, String name, long value) { 4797 return putLongForUser(cr, name, value, UserHandle.myUserId()); 4798 } 4799 4800 /** @hide */ 4801 public static boolean putLongForUser(ContentResolver cr, String name, long value, 4802 int userHandle) { 4803 return putStringForUser(cr, name, Long.toString(value), userHandle); 4804 } 4805 4806 /** 4807 * Convenience function for retrieving a single secure settings value 4808 * as a floating point number. Note that internally setting values are 4809 * always stored as strings; this function converts the string to an 4810 * float for you. The default value will be returned if the setting 4811 * is not defined or not a valid float. 4812 * 4813 * @param cr The ContentResolver to access. 4814 * @param name The name of the setting to retrieve. 4815 * @param def Value to return if the setting is not defined. 4816 * 4817 * @return The setting's current value, or 'def' if it is not defined 4818 * or not a valid float. 4819 */ 4820 public static float getFloat(ContentResolver cr, String name, float def) { 4821 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 4822 } 4823 4824 /** @hide */ 4825 public static float getFloatForUser(ContentResolver cr, String name, float def, 4826 int userHandle) { 4827 String v = getStringForUser(cr, name, userHandle); 4828 try { 4829 return v != null ? Float.parseFloat(v) : def; 4830 } catch (NumberFormatException e) { 4831 return def; 4832 } 4833 } 4834 4835 /** 4836 * Convenience function for retrieving a single secure settings value 4837 * as a float. Note that internally setting values are always 4838 * stored as strings; this function converts the string to a float 4839 * for you. 4840 * <p> 4841 * This version does not take a default value. If the setting has not 4842 * been set, or the string value is not a number, 4843 * it throws {@link SettingNotFoundException}. 4844 * 4845 * @param cr The ContentResolver to access. 4846 * @param name The name of the setting to retrieve. 4847 * 4848 * @throws SettingNotFoundException Thrown if a setting by the given 4849 * name can't be found or the setting value is not a float. 4850 * 4851 * @return The setting's current value. 4852 */ 4853 public static float getFloat(ContentResolver cr, String name) 4854 throws SettingNotFoundException { 4855 return getFloatForUser(cr, name, UserHandle.myUserId()); 4856 } 4857 4858 /** @hide */ 4859 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 4860 throws SettingNotFoundException { 4861 String v = getStringForUser(cr, name, userHandle); 4862 if (v == null) { 4863 throw new SettingNotFoundException(name); 4864 } 4865 try { 4866 return Float.parseFloat(v); 4867 } catch (NumberFormatException e) { 4868 throw new SettingNotFoundException(name); 4869 } 4870 } 4871 4872 /** 4873 * Convenience function for updating a single settings value as a 4874 * floating point number. This will either create a new entry in the 4875 * table if the given name does not exist, or modify the value of the 4876 * existing row with that name. Note that internally setting values 4877 * are always stored as strings, so this function converts the given 4878 * value to a string before storing it. 4879 * 4880 * @param cr The ContentResolver to access. 4881 * @param name The name of the setting to modify. 4882 * @param value The new value for the setting. 4883 * @return true if the value was set, false on database errors 4884 */ 4885 public static boolean putFloat(ContentResolver cr, String name, float value) { 4886 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 4887 } 4888 4889 /** @hide */ 4890 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 4891 int userHandle) { 4892 return putStringForUser(cr, name, Float.toString(value), userHandle); 4893 } 4894 4895 /** 4896 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} 4897 * instead 4898 */ 4899 @Deprecated 4900 public static final String DEVELOPMENT_SETTINGS_ENABLED = 4901 Global.DEVELOPMENT_SETTINGS_ENABLED; 4902 4903 /** 4904 * When the user has enable the option to have a "bug report" command 4905 * in the power menu. 4906 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead 4907 * @hide 4908 */ 4909 @Deprecated 4910 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 4911 4912 /** 4913 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead 4914 */ 4915 @Deprecated 4916 public static final String ADB_ENABLED = Global.ADB_ENABLED; 4917 4918 /** 4919 * Setting to allow mock locations and location provider status to be injected into the 4920 * LocationManager service for testing purposes during application development. These 4921 * locations and status values override actual location and status information generated 4922 * by network, gps, or other location providers. 4923 * 4924 * @deprecated This settings is not used anymore. 4925 */ 4926 @Deprecated 4927 public static final String ALLOW_MOCK_LOCATION = "mock_location"; 4928 4929 /** 4930 * A 64-bit number (as a hex string) that is randomly 4931 * generated when the user first sets up the device and should remain 4932 * constant for the lifetime of the user's device. The value may 4933 * change if a factory reset is performed on the device. 4934 * <p class="note"><strong>Note:</strong> When a device has <a 4935 * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a> 4936 * (available on certain devices running Android 4.2 or higher), each user appears as a 4937 * completely separate device, so the {@code ANDROID_ID} value is unique to each 4938 * user.</p> 4939 */ 4940 public static final String ANDROID_ID = "android_id"; 4941 4942 /** 4943 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 4944 */ 4945 @Deprecated 4946 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 4947 4948 /** 4949 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 4950 */ 4951 @Deprecated 4952 public static final String DATA_ROAMING = Global.DATA_ROAMING; 4953 4954 /** 4955 * Setting to record the input method used by default, holding the ID 4956 * of the desired method. 4957 */ 4958 public static final String DEFAULT_INPUT_METHOD = "default_input_method"; 4959 4960 /** 4961 * Setting to record the input method subtype used by default, holding the ID 4962 * of the desired method. 4963 */ 4964 public static final String SELECTED_INPUT_METHOD_SUBTYPE = 4965 "selected_input_method_subtype"; 4966 4967 /** 4968 * Setting to record the history of input method subtype, holding the pair of ID of IME 4969 * and its last used subtype. 4970 * @hide 4971 */ 4972 public static final String INPUT_METHODS_SUBTYPE_HISTORY = 4973 "input_methods_subtype_history"; 4974 4975 /** 4976 * Setting to record the visibility of input method selector 4977 */ 4978 public static final String INPUT_METHOD_SELECTOR_VISIBILITY = 4979 "input_method_selector_visibility"; 4980 4981 /** 4982 * The currently selected voice interaction service flattened ComponentName. 4983 * @hide 4984 */ 4985 @TestApi 4986 public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; 4987 4988 /** 4989 * The currently selected auto-fill service flattened ComponentName. 4990 * @hide 4991 */ 4992 @TestApi 4993 public static final String AUTO_FILL_SERVICE = "auto_fill_service"; 4994 4995 /** 4996 * bluetooth HCI snoop log configuration 4997 * @hide 4998 */ 4999 public static final String BLUETOOTH_HCI_LOG = 5000 "bluetooth_hci_log"; 5001 5002 /** 5003 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 5004 */ 5005 @Deprecated 5006 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 5007 5008 /** 5009 * Whether the current user has been set up via setup wizard (0 = false, 1 = true) 5010 * @hide 5011 */ 5012 public static final String USER_SETUP_COMPLETE = "user_setup_complete"; 5013 5014 /** 5015 * Prefix for category name that marks whether a suggested action from that category was 5016 * completed. 5017 * @hide 5018 */ 5019 public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category."; 5020 5021 /** 5022 * List of input methods that are currently enabled. This is a string 5023 * containing the IDs of all enabled input methods, each ID separated 5024 * by ':'. 5025 */ 5026 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; 5027 5028 /** 5029 * List of system input methods that are currently disabled. This is a string 5030 * containing the IDs of all disabled input methods, each ID separated 5031 * by ':'. 5032 * @hide 5033 */ 5034 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; 5035 5036 /** 5037 * Whether to show the IME when a hard keyboard is connected. This is a boolean that 5038 * determines if the IME should be shown when a hard keyboard is attached. 5039 * @hide 5040 */ 5041 public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; 5042 5043 /** 5044 * Host name and port for global http proxy. Uses ':' seperator for 5045 * between host and port. 5046 * 5047 * @deprecated Use {@link Global#HTTP_PROXY} 5048 */ 5049 @Deprecated 5050 public static final String HTTP_PROXY = Global.HTTP_PROXY; 5051 5052 /** 5053 * Package designated as always-on VPN provider. 5054 * 5055 * @hide 5056 */ 5057 public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app"; 5058 5059 /** 5060 * Whether to block networking outside of VPN connections while always-on is set. 5061 * @see #ALWAYS_ON_VPN_APP 5062 * 5063 * @hide 5064 */ 5065 public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown"; 5066 5067 /** 5068 * Whether applications can be installed for this user via the system's 5069 * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism. 5070 * 5071 * <p>1 = permit app installation via the system package installer intent 5072 * <p>0 = do not allow use of the package installer 5073 */ 5074 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 5075 5076 /** 5077 * Comma-separated list of location providers that activities may access. Do not rely on 5078 * this value being present in settings.db or on ContentObserver notifications on the 5079 * corresponding Uri. 5080 * 5081 * @deprecated use {@link #LOCATION_MODE} and 5082 * {@link LocationManager#MODE_CHANGED_ACTION} (or 5083 * {@link LocationManager#PROVIDERS_CHANGED_ACTION}) 5084 */ 5085 @Deprecated 5086 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; 5087 5088 /** 5089 * The degree of location access enabled by the user. 5090 * <p> 5091 * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link 5092 * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link 5093 * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link 5094 * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location 5095 * modes that might be added in the future. 5096 * <p> 5097 * Note: do not rely on this value being present in settings.db or on ContentObserver 5098 * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} 5099 * to receive changes in this value. 5100 */ 5101 public static final String LOCATION_MODE = "location_mode"; 5102 /** 5103 * Stores the previous location mode when {@link #LOCATION_MODE} is set to 5104 * {@link #LOCATION_MODE_OFF} 5105 * @hide 5106 */ 5107 public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode"; 5108 5109 /** 5110 * Sets all location providers to the previous states before location was turned off. 5111 * @hide 5112 */ 5113 public static final int LOCATION_MODE_PREVIOUS = -1; 5114 /** 5115 * Location access disabled. 5116 */ 5117 public static final int LOCATION_MODE_OFF = 0; 5118 /** 5119 * Network Location Provider disabled, but GPS and other sensors enabled. 5120 */ 5121 public static final int LOCATION_MODE_SENSORS_ONLY = 1; 5122 /** 5123 * Reduced power usage, such as limiting the number of GPS updates per hour. Requests 5124 * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to 5125 * {@link android.location.Criteria#POWER_MEDIUM}. 5126 */ 5127 public static final int LOCATION_MODE_BATTERY_SAVING = 2; 5128 /** 5129 * Best-effort location computation allowed. 5130 */ 5131 public static final int LOCATION_MODE_HIGH_ACCURACY = 3; 5132 5133 /** 5134 * A flag containing settings used for biometric weak 5135 * @hide 5136 */ 5137 @Deprecated 5138 public static final String LOCK_BIOMETRIC_WEAK_FLAGS = 5139 "lock_biometric_weak_flags"; 5140 5141 /** 5142 * Whether lock-to-app will lock the keyguard when exiting. 5143 * @hide 5144 */ 5145 public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked"; 5146 5147 /** 5148 * Whether autolock is enabled (0 = false, 1 = true) 5149 * 5150 * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security 5151 * level of the keyguard. Accessing this setting from an app that is targeting 5152 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}. 5153 */ 5154 @Deprecated 5155 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; 5156 5157 /** 5158 * Whether lock pattern is visible as user enters (0 = false, 1 = true) 5159 * 5160 * @deprecated Accessing this setting from an app that is targeting 5161 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}. 5162 */ 5163 @Deprecated 5164 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 5165 5166 /** 5167 * Whether lock pattern will vibrate as user enters (0 = false, 1 = 5168 * true) 5169 * 5170 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the 5171 * lockscreen uses 5172 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. 5173 * Accessing this setting from an app that is targeting 5174 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}. 5175 */ 5176 @Deprecated 5177 public static final String 5178 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; 5179 5180 /** 5181 * This preference allows the device to be locked given time after screen goes off, 5182 * subject to current DeviceAdmin policy limits. 5183 * @hide 5184 */ 5185 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; 5186 5187 5188 /** 5189 * This preference contains the string that shows for owner info on LockScreen. 5190 * @hide 5191 * @deprecated 5192 */ 5193 @Deprecated 5194 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; 5195 5196 /** 5197 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). 5198 * @hide 5199 */ 5200 @Deprecated 5201 public static final String LOCK_SCREEN_APPWIDGET_IDS = 5202 "lock_screen_appwidget_ids"; 5203 5204 /** 5205 * Id of the appwidget shown on the lock screen when appwidgets are disabled. 5206 * @hide 5207 */ 5208 @Deprecated 5209 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = 5210 "lock_screen_fallback_appwidget_id"; 5211 5212 /** 5213 * Index of the lockscreen appwidget to restore, -1 if none. 5214 * @hide 5215 */ 5216 @Deprecated 5217 public static final String LOCK_SCREEN_STICKY_APPWIDGET = 5218 "lock_screen_sticky_appwidget"; 5219 5220 /** 5221 * This preference enables showing the owner info on LockScreen. 5222 * @hide 5223 * @deprecated 5224 */ 5225 @Deprecated 5226 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = 5227 "lock_screen_owner_info_enabled"; 5228 5229 /** 5230 * When set by a user, allows notifications to be shown atop a securely locked screen 5231 * in their full "private" form (same as when the device is unlocked). 5232 * @hide 5233 */ 5234 public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = 5235 "lock_screen_allow_private_notifications"; 5236 5237 /** 5238 * When set by a user, allows notification remote input atop a securely locked screen 5239 * without having to unlock 5240 * @hide 5241 */ 5242 public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT = 5243 "lock_screen_allow_remote_input"; 5244 5245 /** 5246 * Set by the system to track if the user needs to see the call to action for 5247 * the lockscreen notification policy. 5248 * @hide 5249 */ 5250 public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING = 5251 "show_note_about_notification_hiding"; 5252 5253 /** 5254 * Set to 1 by the system after trust agents have been initialized. 5255 * @hide 5256 */ 5257 public static final String TRUST_AGENTS_INITIALIZED = 5258 "trust_agents_initialized"; 5259 5260 /** 5261 * The Logging ID (a unique 64-bit value) as a hex string. 5262 * Used as a pseudonymous identifier for logging. 5263 * @deprecated This identifier is poorly initialized and has 5264 * many collisions. It should not be used. 5265 */ 5266 @Deprecated 5267 public static final String LOGGING_ID = "logging_id"; 5268 5269 /** 5270 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 5271 */ 5272 @Deprecated 5273 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 5274 5275 /** 5276 * No longer supported. 5277 */ 5278 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 5279 5280 /** 5281 * No longer supported. 5282 */ 5283 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 5284 5285 /** 5286 * No longer supported. 5287 */ 5288 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 5289 5290 /** 5291 * Settings classname to launch when Settings is clicked from All 5292 * Applications. Needed because of user testing between the old 5293 * and new Settings apps. 5294 */ 5295 // TODO: 881807 5296 public static final String SETTINGS_CLASSNAME = "settings_classname"; 5297 5298 /** 5299 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 5300 */ 5301 @Deprecated 5302 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 5303 5304 /** 5305 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 5306 */ 5307 @Deprecated 5308 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 5309 5310 /** 5311 * If accessibility is enabled. 5312 */ 5313 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; 5314 5315 /** 5316 * If touch exploration is enabled. 5317 */ 5318 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; 5319 5320 /** 5321 * List of the enabled accessibility providers. 5322 */ 5323 public static final String ENABLED_ACCESSIBILITY_SERVICES = 5324 "enabled_accessibility_services"; 5325 5326 /** 5327 * List of the accessibility services to which the user has granted 5328 * permission to put the device into touch exploration mode. 5329 * 5330 * @hide 5331 */ 5332 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = 5333 "touch_exploration_granted_accessibility_services"; 5334 5335 /** 5336 * Whether to speak passwords while in accessibility mode. 5337 */ 5338 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; 5339 5340 /** 5341 * Whether to draw text with high contrast while in accessibility mode. 5342 * 5343 * @hide 5344 */ 5345 public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED = 5346 "high_text_contrast_enabled"; 5347 5348 /** 5349 * If injection of accessibility enhancing JavaScript screen-reader 5350 * is enabled. 5351 * <p> 5352 * Note: The JavaScript based screen-reader is served by the 5353 * Google infrastructure and enable users with disabilities to 5354 * efficiently navigate in and explore web content. 5355 * </p> 5356 * <p> 5357 * This property represents a boolean value. 5358 * </p> 5359 * @hide 5360 */ 5361 public static final String ACCESSIBILITY_SCRIPT_INJECTION = 5362 "accessibility_script_injection"; 5363 5364 /** 5365 * The URL for the injected JavaScript based screen-reader used 5366 * for providing accessibility of content in WebView. 5367 * <p> 5368 * Note: The JavaScript based screen-reader is served by the 5369 * Google infrastructure and enable users with disabilities to 5370 * efficiently navigate in and explore web content. 5371 * </p> 5372 * <p> 5373 * This property represents a string value. 5374 * </p> 5375 * @hide 5376 */ 5377 public static final String ACCESSIBILITY_SCREEN_READER_URL = 5378 "accessibility_script_injection_url"; 5379 5380 /** 5381 * Key bindings for navigation in built-in accessibility support for web content. 5382 * <p> 5383 * Note: These key bindings are for the built-in accessibility navigation for 5384 * web content which is used as a fall back solution if JavaScript in a WebView 5385 * is not enabled or the user has not opted-in script injection from Google. 5386 * </p> 5387 * <p> 5388 * The bindings are separated by semi-colon. A binding is a mapping from 5389 * a key to a sequence of actions (for more details look at 5390 * android.webkit.AccessibilityInjector). A key is represented as the hexademical 5391 * string representation of an integer obtained from a meta state (optional) shifted 5392 * sixteen times left and bitwise ored with a key code. An action is represented 5393 * as a hexademical string representation of an integer where the first two digits 5394 * are navigation action index, the second, the third, and the fourth digit pairs 5395 * represent the action arguments. The separate actions in a binding are colon 5396 * separated. The key and the action sequence it maps to are separated by equals. 5397 * </p> 5398 * <p> 5399 * For example, the binding below maps the DPAD right button to traverse the 5400 * current navigation axis once without firing an accessibility event and to 5401 * perform the same traversal again but to fire an event: 5402 * <code> 5403 * 0x16=0x01000100:0x01000101; 5404 * </code> 5405 * </p> 5406 * <p> 5407 * The goal of this binding is to enable dynamic rebinding of keys to 5408 * navigation actions for web content without requiring a framework change. 5409 * </p> 5410 * <p> 5411 * This property represents a string value. 5412 * </p> 5413 * @hide 5414 */ 5415 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = 5416 "accessibility_web_content_key_bindings"; 5417 5418 /** 5419 * Setting that specifies whether the display magnification is enabled. 5420 * Display magnifications allows the user to zoom in the display content 5421 * and is targeted to low vision users. The current magnification scale 5422 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. 5423 * 5424 * @hide 5425 */ 5426 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = 5427 "accessibility_display_magnification_enabled"; 5428 5429 /** 5430 * Setting that specifies what the display magnification scale is. 5431 * Display magnifications allows the user to zoom in the display 5432 * content and is targeted to low vision users. Whether a display 5433 * magnification is performed is controlled by 5434 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 5435 * 5436 * @hide 5437 */ 5438 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = 5439 "accessibility_display_magnification_scale"; 5440 5441 /** 5442 * Unused mangnification setting 5443 * 5444 * @hide 5445 * @deprecated 5446 */ 5447 @Deprecated 5448 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = 5449 "accessibility_display_magnification_auto_update"; 5450 5451 /** 5452 * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be 5453 * modified from an AccessibilityService using the SoftKeyboardController. 5454 * 5455 * @hide 5456 */ 5457 public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE = 5458 "accessibility_soft_keyboard_mode"; 5459 5460 /** 5461 * Default soft keyboard behavior. 5462 * 5463 * @hide 5464 */ 5465 public static final int SHOW_MODE_AUTO = 0; 5466 5467 /** 5468 * Soft keyboard is never shown. 5469 * 5470 * @hide 5471 */ 5472 public static final int SHOW_MODE_HIDDEN = 1; 5473 5474 /** 5475 * Setting that specifies whether timed text (captions) should be 5476 * displayed in video content. Text display properties are controlled by 5477 * the following settings: 5478 * <ul> 5479 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE} 5480 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR} 5481 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR} 5482 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR} 5483 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE} 5484 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE} 5485 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE} 5486 * </ul> 5487 * 5488 * @hide 5489 */ 5490 public static final String ACCESSIBILITY_CAPTIONING_ENABLED = 5491 "accessibility_captioning_enabled"; 5492 5493 /** 5494 * Setting that specifies the language for captions as a locale string, 5495 * e.g. en_US. 5496 * 5497 * @see java.util.Locale#toString 5498 * @hide 5499 */ 5500 public static final String ACCESSIBILITY_CAPTIONING_LOCALE = 5501 "accessibility_captioning_locale"; 5502 5503 /** 5504 * Integer property that specifies the preset style for captions, one 5505 * of: 5506 * <ul> 5507 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM} 5508 * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS} 5509 * </ul> 5510 * 5511 * @see java.util.Locale#toString 5512 * @hide 5513 */ 5514 public static final String ACCESSIBILITY_CAPTIONING_PRESET = 5515 "accessibility_captioning_preset"; 5516 5517 /** 5518 * Integer property that specifes the background color for captions as a 5519 * packed 32-bit color. 5520 * 5521 * @see android.graphics.Color#argb 5522 * @hide 5523 */ 5524 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR = 5525 "accessibility_captioning_background_color"; 5526 5527 /** 5528 * Integer property that specifes the foreground color for captions as a 5529 * packed 32-bit color. 5530 * 5531 * @see android.graphics.Color#argb 5532 * @hide 5533 */ 5534 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR = 5535 "accessibility_captioning_foreground_color"; 5536 5537 /** 5538 * Integer property that specifes the edge type for captions, one of: 5539 * <ul> 5540 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE} 5541 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE} 5542 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW} 5543 * </ul> 5544 * 5545 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR 5546 * @hide 5547 */ 5548 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE = 5549 "accessibility_captioning_edge_type"; 5550 5551 /** 5552 * Integer property that specifes the edge color for captions as a 5553 * packed 32-bit color. 5554 * 5555 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE 5556 * @see android.graphics.Color#argb 5557 * @hide 5558 */ 5559 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR = 5560 "accessibility_captioning_edge_color"; 5561 5562 /** 5563 * Integer property that specifes the window color for captions as a 5564 * packed 32-bit color. 5565 * 5566 * @see android.graphics.Color#argb 5567 * @hide 5568 */ 5569 public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR = 5570 "accessibility_captioning_window_color"; 5571 5572 /** 5573 * String property that specifies the typeface for captions, one of: 5574 * <ul> 5575 * <li>DEFAULT 5576 * <li>MONOSPACE 5577 * <li>SANS_SERIF 5578 * <li>SERIF 5579 * </ul> 5580 * 5581 * @see android.graphics.Typeface 5582 * @hide 5583 */ 5584 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE = 5585 "accessibility_captioning_typeface"; 5586 5587 /** 5588 * Floating point property that specifies font scaling for captions. 5589 * 5590 * @hide 5591 */ 5592 public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE = 5593 "accessibility_captioning_font_scale"; 5594 5595 /** 5596 * Setting that specifies whether display color inversion is enabled. 5597 */ 5598 public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = 5599 "accessibility_display_inversion_enabled"; 5600 5601 /** 5602 * Setting that specifies whether display color space adjustment is 5603 * enabled. 5604 * 5605 * @hide 5606 */ 5607 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED = 5608 "accessibility_display_daltonizer_enabled"; 5609 5610 /** 5611 * Integer property that specifies the type of color space adjustment to 5612 * perform. Valid values are defined in AccessibilityManager. 5613 * 5614 * @hide 5615 */ 5616 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER = 5617 "accessibility_display_daltonizer"; 5618 5619 /** 5620 * Setting that specifies whether automatic click when the mouse pointer stops moving is 5621 * enabled. 5622 * 5623 * @hide 5624 */ 5625 public static final String ACCESSIBILITY_AUTOCLICK_ENABLED = 5626 "accessibility_autoclick_enabled"; 5627 5628 /** 5629 * Integer setting specifying amount of time in ms the mouse pointer has to stay still 5630 * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set. 5631 * 5632 * @see #ACCESSIBILITY_AUTOCLICK_ENABLED 5633 * @hide 5634 */ 5635 public static final String ACCESSIBILITY_AUTOCLICK_DELAY = 5636 "accessibility_autoclick_delay"; 5637 5638 /** 5639 * Whether or not larger size icons are used for the pointer of mouse/trackpad for 5640 * accessibility. 5641 * (0 = false, 1 = true) 5642 * @hide 5643 */ 5644 public static final String ACCESSIBILITY_LARGE_POINTER_ICON = 5645 "accessibility_large_pointer_icon"; 5646 5647 /** 5648 * The timeout for considering a press to be a long press in milliseconds. 5649 * @hide 5650 */ 5651 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; 5652 5653 /** 5654 * The duration in milliseconds between the first tap's up event and the second tap's 5655 * down event for an interaction to be considered part of the same multi-press. 5656 * @hide 5657 */ 5658 public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout"; 5659 5660 /** 5661 * List of the enabled print services. 5662 * 5663 * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade 5664 * from pre-N. 5665 * 5666 * @hide 5667 */ 5668 public static final String ENABLED_PRINT_SERVICES = 5669 "enabled_print_services"; 5670 5671 /** 5672 * List of the disabled print services. 5673 * 5674 * @hide 5675 */ 5676 public static final String DISABLED_PRINT_SERVICES = 5677 "disabled_print_services"; 5678 5679 /** 5680 * The saved value for WindowManagerService.setForcedDisplayDensity() 5681 * formatted as a single integer representing DPI. If unset, then use 5682 * the real display density. 5683 * 5684 * @hide 5685 */ 5686 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; 5687 5688 /** 5689 * Setting to always use the default text-to-speech settings regardless 5690 * of the application settings. 5691 * 1 = override application settings, 5692 * 0 = use application settings (if specified). 5693 * 5694 * @deprecated The value of this setting is no longer respected by 5695 * the framework text to speech APIs as of the Ice Cream Sandwich release. 5696 */ 5697 @Deprecated 5698 public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; 5699 5700 /** 5701 * Default text-to-speech engine speech rate. 100 = 1x 5702 */ 5703 public static final String TTS_DEFAULT_RATE = "tts_default_rate"; 5704 5705 /** 5706 * Default text-to-speech engine pitch. 100 = 1x 5707 */ 5708 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; 5709 5710 /** 5711 * Default text-to-speech engine. 5712 */ 5713 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; 5714 5715 /** 5716 * Default text-to-speech language. 5717 * 5718 * @deprecated this setting is no longer in use, as of the Ice Cream 5719 * Sandwich release. Apps should never need to read this setting directly, 5720 * instead can query the TextToSpeech framework classes for the default 5721 * locale. {@link TextToSpeech#getLanguage()}. 5722 */ 5723 @Deprecated 5724 public static final String TTS_DEFAULT_LANG = "tts_default_lang"; 5725 5726 /** 5727 * Default text-to-speech country. 5728 * 5729 * @deprecated this setting is no longer in use, as of the Ice Cream 5730 * Sandwich release. Apps should never need to read this setting directly, 5731 * instead can query the TextToSpeech framework classes for the default 5732 * locale. {@link TextToSpeech#getLanguage()}. 5733 */ 5734 @Deprecated 5735 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; 5736 5737 /** 5738 * Default text-to-speech locale variant. 5739 * 5740 * @deprecated this setting is no longer in use, as of the Ice Cream 5741 * Sandwich release. Apps should never need to read this setting directly, 5742 * instead can query the TextToSpeech framework classes for the 5743 * locale that is in use {@link TextToSpeech#getLanguage()}. 5744 */ 5745 @Deprecated 5746 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; 5747 5748 /** 5749 * Stores the default tts locales on a per engine basis. Stored as 5750 * a comma seperated list of values, each value being of the form 5751 * {@code engine_name:locale} for example, 5752 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This 5753 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and 5754 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this 5755 * setting directly, and can query the TextToSpeech framework classes 5756 * for the locale that is in use. 5757 * 5758 * @hide 5759 */ 5760 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; 5761 5762 /** 5763 * Space delimited list of plugin packages that are enabled. 5764 */ 5765 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; 5766 5767 /** 5768 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} 5769 * instead. 5770 */ 5771 @Deprecated 5772 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 5773 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 5774 5775 /** 5776 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} 5777 * instead. 5778 */ 5779 @Deprecated 5780 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 5781 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 5782 5783 /** 5784 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 5785 * instead. 5786 */ 5787 @Deprecated 5788 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = 5789 Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 5790 5791 /** 5792 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} 5793 * instead. 5794 */ 5795 @Deprecated 5796 public static final String WIFI_ON = Global.WIFI_ON; 5797 5798 /** 5799 * The acceptable packet loss percentage (range 0 - 100) before trying 5800 * another AP on the same network. 5801 * @deprecated This setting is not used. 5802 */ 5803 @Deprecated 5804 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 5805 "wifi_watchdog_acceptable_packet_loss_percentage"; 5806 5807 /** 5808 * The number of access points required for a network in order for the 5809 * watchdog to monitor it. 5810 * @deprecated This setting is not used. 5811 */ 5812 @Deprecated 5813 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; 5814 5815 /** 5816 * The delay between background checks. 5817 * @deprecated This setting is not used. 5818 */ 5819 @Deprecated 5820 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 5821 "wifi_watchdog_background_check_delay_ms"; 5822 5823 /** 5824 * Whether the Wi-Fi watchdog is enabled for background checking even 5825 * after it thinks the user has connected to a good access point. 5826 * @deprecated This setting is not used. 5827 */ 5828 @Deprecated 5829 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 5830 "wifi_watchdog_background_check_enabled"; 5831 5832 /** 5833 * The timeout for a background ping 5834 * @deprecated This setting is not used. 5835 */ 5836 @Deprecated 5837 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 5838 "wifi_watchdog_background_check_timeout_ms"; 5839 5840 /** 5841 * The number of initial pings to perform that *may* be ignored if they 5842 * fail. Again, if these fail, they will *not* be used in packet loss 5843 * calculation. For example, one network always seemed to time out for 5844 * the first couple pings, so this is set to 3 by default. 5845 * @deprecated This setting is not used. 5846 */ 5847 @Deprecated 5848 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 5849 "wifi_watchdog_initial_ignored_ping_count"; 5850 5851 /** 5852 * The maximum number of access points (per network) to attempt to test. 5853 * If this number is reached, the watchdog will no longer monitor the 5854 * initial connection state for the network. This is a safeguard for 5855 * networks containing multiple APs whose DNS does not respond to pings. 5856 * @deprecated This setting is not used. 5857 */ 5858 @Deprecated 5859 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; 5860 5861 /** 5862 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 5863 */ 5864 @Deprecated 5865 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 5866 5867 /** 5868 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. 5869 * @deprecated This setting is not used. 5870 */ 5871 @Deprecated 5872 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; 5873 5874 /** 5875 * The number of pings to test if an access point is a good connection. 5876 * @deprecated This setting is not used. 5877 */ 5878 @Deprecated 5879 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; 5880 5881 /** 5882 * The delay between pings. 5883 * @deprecated This setting is not used. 5884 */ 5885 @Deprecated 5886 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; 5887 5888 /** 5889 * The timeout per ping. 5890 * @deprecated This setting is not used. 5891 */ 5892 @Deprecated 5893 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; 5894 5895 /** 5896 * @deprecated Use 5897 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 5898 */ 5899 @Deprecated 5900 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 5901 5902 /** 5903 * @deprecated Use 5904 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 5905 */ 5906 @Deprecated 5907 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 5908 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 5909 5910 /** 5911 * The number of milliseconds to hold on to a PendingIntent based request. This delay gives 5912 * the receivers of the PendingIntent an opportunity to make a new network request before 5913 * the Network satisfying the request is potentially removed. 5914 * 5915 * @hide 5916 */ 5917 public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS = 5918 "connectivity_release_pending_intent_delay_ms"; 5919 5920 /** 5921 * Whether background data usage is allowed. 5922 * 5923 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, 5924 * availability of background data depends on several 5925 * combined factors. When background data is unavailable, 5926 * {@link ConnectivityManager#getActiveNetworkInfo()} will 5927 * now appear disconnected. 5928 */ 5929 @Deprecated 5930 public static final String BACKGROUND_DATA = "background_data"; 5931 5932 /** 5933 * Origins for which browsers should allow geolocation by default. 5934 * The value is a space-separated list of origins. 5935 */ 5936 public static final String ALLOWED_GEOLOCATION_ORIGINS 5937 = "allowed_geolocation_origins"; 5938 5939 /** 5940 * The preferred TTY mode 0 = TTy Off, CDMA default 5941 * 1 = TTY Full 5942 * 2 = TTY HCO 5943 * 3 = TTY VCO 5944 * @hide 5945 */ 5946 public static final String PREFERRED_TTY_MODE = 5947 "preferred_tty_mode"; 5948 5949 /** 5950 * Whether the enhanced voice privacy mode is enabled. 5951 * 0 = normal voice privacy 5952 * 1 = enhanced voice privacy 5953 * @hide 5954 */ 5955 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; 5956 5957 /** 5958 * Whether the TTY mode mode is enabled. 5959 * 0 = disabled 5960 * 1 = enabled 5961 * @hide 5962 */ 5963 public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; 5964 5965 /** 5966 * Controls whether settings backup is enabled. 5967 * Type: int ( 0 = disabled, 1 = enabled ) 5968 * @hide 5969 */ 5970 public static final String BACKUP_ENABLED = "backup_enabled"; 5971 5972 /** 5973 * Controls whether application data is automatically restored from backup 5974 * at install time. 5975 * Type: int ( 0 = disabled, 1 = enabled ) 5976 * @hide 5977 */ 5978 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; 5979 5980 /** 5981 * Indicates whether settings backup has been fully provisioned. 5982 * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) 5983 * @hide 5984 */ 5985 public static final String BACKUP_PROVISIONED = "backup_provisioned"; 5986 5987 /** 5988 * Component of the transport to use for backup/restore. 5989 * @hide 5990 */ 5991 public static final String BACKUP_TRANSPORT = "backup_transport"; 5992 5993 /** 5994 * Version for which the setup wizard was last shown. Bumped for 5995 * each release when there is new setup information to show. 5996 * @hide 5997 */ 5998 public static final String LAST_SETUP_SHOWN = "last_setup_shown"; 5999 6000 /** 6001 * The interval in milliseconds after which Wi-Fi is considered idle. 6002 * When idle, it is possible for the device to be switched from Wi-Fi to 6003 * the mobile data network. 6004 * @hide 6005 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} 6006 * instead. 6007 */ 6008 @Deprecated 6009 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; 6010 6011 /** 6012 * The global search provider chosen by the user (if multiple global 6013 * search providers are installed). This will be the provider returned 6014 * by {@link SearchManager#getGlobalSearchActivity()} if it's still 6015 * installed. This setting is stored as a flattened component name as 6016 * per {@link ComponentName#flattenToString()}. 6017 * 6018 * @hide 6019 */ 6020 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY = 6021 "search_global_search_activity"; 6022 6023 /** 6024 * The number of promoted sources in GlobalSearch. 6025 * @hide 6026 */ 6027 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources"; 6028 /** 6029 * The maximum number of suggestions returned by GlobalSearch. 6030 * @hide 6031 */ 6032 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display"; 6033 /** 6034 * The number of suggestions GlobalSearch will ask each non-web search source for. 6035 * @hide 6036 */ 6037 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source"; 6038 /** 6039 * The number of suggestions the GlobalSearch will ask the web search source for. 6040 * @hide 6041 */ 6042 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT = 6043 "search_web_results_override_limit"; 6044 /** 6045 * The number of milliseconds that GlobalSearch will wait for suggestions from 6046 * promoted sources before continuing with all other sources. 6047 * @hide 6048 */ 6049 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS = 6050 "search_promoted_source_deadline_millis"; 6051 /** 6052 * The number of milliseconds before GlobalSearch aborts search suggesiton queries. 6053 * @hide 6054 */ 6055 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis"; 6056 /** 6057 * The maximum number of milliseconds that GlobalSearch shows the previous results 6058 * after receiving a new query. 6059 * @hide 6060 */ 6061 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis"; 6062 /** 6063 * The maximum age of log data used for shortcuts in GlobalSearch. 6064 * @hide 6065 */ 6066 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis"; 6067 /** 6068 * The maximum age of log data used for source ranking in GlobalSearch. 6069 * @hide 6070 */ 6071 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS = 6072 "search_max_source_event_age_millis"; 6073 /** 6074 * The minimum number of impressions needed to rank a source in GlobalSearch. 6075 * @hide 6076 */ 6077 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING = 6078 "search_min_impressions_for_source_ranking"; 6079 /** 6080 * The minimum number of clicks needed to rank a source in GlobalSearch. 6081 * @hide 6082 */ 6083 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING = 6084 "search_min_clicks_for_source_ranking"; 6085 /** 6086 * The maximum number of shortcuts shown by GlobalSearch. 6087 * @hide 6088 */ 6089 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned"; 6090 /** 6091 * The size of the core thread pool for suggestion queries in GlobalSearch. 6092 * @hide 6093 */ 6094 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE = 6095 "search_query_thread_core_pool_size"; 6096 /** 6097 * The maximum size of the thread pool for suggestion queries in GlobalSearch. 6098 * @hide 6099 */ 6100 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE = 6101 "search_query_thread_max_pool_size"; 6102 /** 6103 * The size of the core thread pool for shortcut refreshing in GlobalSearch. 6104 * @hide 6105 */ 6106 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE = 6107 "search_shortcut_refresh_core_pool_size"; 6108 /** 6109 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch. 6110 * @hide 6111 */ 6112 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE = 6113 "search_shortcut_refresh_max_pool_size"; 6114 /** 6115 * The maximun time that excess threads in the GlobalSeach thread pools will 6116 * wait before terminating. 6117 * @hide 6118 */ 6119 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS = 6120 "search_thread_keepalive_seconds"; 6121 /** 6122 * The maximum number of concurrent suggestion queries to each source. 6123 * @hide 6124 */ 6125 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = 6126 "search_per_source_concurrent_query_limit"; 6127 6128 /** 6129 * Whether or not alert sounds are played on StorageManagerService events. 6130 * (0 = false, 1 = true) 6131 * @hide 6132 */ 6133 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; 6134 6135 /** 6136 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true) 6137 * @hide 6138 */ 6139 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart"; 6140 6141 /** 6142 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true) 6143 * @hide 6144 */ 6145 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt"; 6146 6147 /** 6148 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true) 6149 * @hide 6150 */ 6151 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled"; 6152 6153 /** 6154 * If nonzero, ANRs in invisible background processes bring up a dialog. 6155 * Otherwise, the process will be silently killed. 6156 * 6157 * Also prevents ANRs and crash dialogs from being suppressed. 6158 * @hide 6159 */ 6160 public static final String ANR_SHOW_BACKGROUND = "anr_show_background"; 6161 6162 /** 6163 * The {@link ComponentName} string of the service to be used as the voice recognition 6164 * service. 6165 * 6166 * @hide 6167 */ 6168 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service"; 6169 6170 /** 6171 * Stores whether an user has consented to have apps verified through PAM. 6172 * The value is boolean (1 or 0). 6173 * 6174 * @hide 6175 */ 6176 public static final String PACKAGE_VERIFIER_USER_CONSENT = 6177 "package_verifier_user_consent"; 6178 6179 /** 6180 * The {@link ComponentName} string of the selected spell checker service which is 6181 * one of the services managed by the text service manager. 6182 * 6183 * @hide 6184 */ 6185 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker"; 6186 6187 /** 6188 * The {@link ComponentName} string of the selected subtype of the selected spell checker 6189 * service which is one of the services managed by the text service manager. 6190 * 6191 * @hide 6192 */ 6193 public static final String SELECTED_SPELL_CHECKER_SUBTYPE = 6194 "selected_spell_checker_subtype"; 6195 6196 /** 6197 * The {@link ComponentName} string whether spell checker is enabled or not. 6198 * 6199 * @hide 6200 */ 6201 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled"; 6202 6203 /** 6204 * What happens when the user presses the Power button while in-call 6205 * and the screen is on.<br/> 6206 * <b>Values:</b><br/> 6207 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/> 6208 * 2 - The Power button hangs up the current call.<br/> 6209 * 6210 * @hide 6211 */ 6212 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; 6213 6214 /** 6215 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". 6216 * @hide 6217 */ 6218 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1; 6219 6220 /** 6221 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up". 6222 * @hide 6223 */ 6224 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2; 6225 6226 /** 6227 * INCALL_POWER_BUTTON_BEHAVIOR default value. 6228 * @hide 6229 */ 6230 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT = 6231 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF; 6232 6233 /** 6234 * What happens when the user presses the Back button while in-call 6235 * and the screen is on.<br/> 6236 * <b>Values:</b><br/> 6237 * 0 - The Back buttons does nothing different.<br/> 6238 * 1 - The Back button hangs up the current call.<br/> 6239 * 6240 * @hide 6241 */ 6242 public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior"; 6243 6244 /** 6245 * INCALL_BACK_BUTTON_BEHAVIOR value for no action. 6246 * @hide 6247 */ 6248 public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0; 6249 6250 /** 6251 * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up". 6252 * @hide 6253 */ 6254 public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1; 6255 6256 /** 6257 * INCALL_POWER_BUTTON_BEHAVIOR default value. 6258 * @hide 6259 */ 6260 public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT = 6261 INCALL_BACK_BUTTON_BEHAVIOR_NONE; 6262 6263 /** 6264 * Whether the device should wake when the wake gesture sensor detects motion. 6265 * @hide 6266 */ 6267 public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled"; 6268 6269 /** 6270 * Whether the device should doze if configured. 6271 * @hide 6272 */ 6273 public static final String DOZE_ENABLED = "doze_enabled"; 6274 6275 /** 6276 * Whether doze should be always on. 6277 * @hide 6278 */ 6279 public static final String DOZE_ALWAYS_ON = "doze_always_on"; 6280 6281 /** 6282 * Whether the device should pulse on pick up gesture. 6283 * @hide 6284 */ 6285 public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up"; 6286 6287 /** 6288 * Whether the device should pulse on double tap gesture. 6289 * @hide 6290 */ 6291 public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap"; 6292 6293 /** 6294 * The current night mode that has been selected by the user. Owned 6295 * and controlled by UiModeManagerService. Constants are as per 6296 * UiModeManager. 6297 * @hide 6298 */ 6299 public static final String UI_NIGHT_MODE = "ui_night_mode"; 6300 6301 /** 6302 * Whether screensavers are enabled. 6303 * @hide 6304 */ 6305 public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; 6306 6307 /** 6308 * The user's chosen screensaver components. 6309 * 6310 * These will be launched by the PhoneWindowManager after a timeout when not on 6311 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). 6312 * @hide 6313 */ 6314 public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; 6315 6316 /** 6317 * If screensavers are enabled, whether the screensaver should be automatically launched 6318 * when the device is inserted into a (desk) dock. 6319 * @hide 6320 */ 6321 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; 6322 6323 /** 6324 * If screensavers are enabled, whether the screensaver should be automatically launched 6325 * when the screen times out when not on battery. 6326 * @hide 6327 */ 6328 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; 6329 6330 /** 6331 * If screensavers are enabled, the default screensaver component. 6332 * @hide 6333 */ 6334 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; 6335 6336 /** 6337 * The default NFC payment component 6338 * @hide 6339 */ 6340 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component"; 6341 6342 /** 6343 * Whether NFC payment is handled by the foreground application or a default. 6344 * @hide 6345 */ 6346 public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground"; 6347 6348 /** 6349 * Specifies the package name currently configured to be the primary sms application 6350 * @hide 6351 */ 6352 public static final String SMS_DEFAULT_APPLICATION = "sms_default_application"; 6353 6354 /** 6355 * Specifies the package name currently configured to be the default dialer application 6356 * @hide 6357 */ 6358 public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application"; 6359 6360 /** 6361 * Specifies the package name currently configured to be the emergency assistance application 6362 * 6363 * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE 6364 * 6365 * @hide 6366 */ 6367 public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application"; 6368 6369 /** 6370 * Specifies whether the current app context on scren (assist data) will be sent to the 6371 * assist application (active voice interaction service). 6372 * 6373 * @hide 6374 */ 6375 public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled"; 6376 6377 /** 6378 * Specifies whether a screenshot of the screen contents will be sent to the assist 6379 * application (active voice interaction service). 6380 * 6381 * @hide 6382 */ 6383 public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled"; 6384 6385 /** 6386 * Specifies whether the screen will show an animation if screen contents are sent to the 6387 * assist application (active voice interaction service). 6388 * 6389 * Note that the disclosure will be forced for third-party assistants or if the device 6390 * does not support disabling it. 6391 * 6392 * @hide 6393 */ 6394 public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled"; 6395 6396 /** 6397 * Name of the service components that the current user has explicitly allowed to 6398 * see and assist with all of the user's notifications. 6399 * 6400 * @hide 6401 */ 6402 public static final String ENABLED_NOTIFICATION_ASSISTANT = 6403 "enabled_notification_assistant"; 6404 6405 /** 6406 * Names of the service components that the current user has explicitly allowed to 6407 * see all of the user's notifications, separated by ':'. 6408 * 6409 * @hide 6410 */ 6411 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners"; 6412 6413 /** 6414 * Names of the packages that the current user has explicitly allowed to 6415 * manage notification policy configuration, separated by ':'. 6416 * 6417 * @hide 6418 */ 6419 @TestApi 6420 public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = 6421 "enabled_notification_policy_access_packages"; 6422 6423 /** 6424 * Defines whether managed profile ringtones should be synced from it's parent profile 6425 * <p> 6426 * 0 = ringtones are not synced 6427 * 1 = ringtones are synced from the profile's parent (default) 6428 * <p> 6429 * This value is only used for managed profiles. 6430 * @hide 6431 */ 6432 public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds"; 6433 6434 /** @hide */ 6435 public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations"; 6436 6437 /** 6438 * This is the query URI for finding a print service to install. 6439 * 6440 * @hide 6441 */ 6442 public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri"; 6443 6444 /** 6445 * This is the query URI for finding a NFC payment service to install. 6446 * 6447 * @hide 6448 */ 6449 public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri"; 6450 6451 /** 6452 * If enabled, apps should try to skip any introductory hints on first launch. This might 6453 * apply to users that are already familiar with the environment or temporary users. 6454 * <p> 6455 * Type : int (0 to show hints, 1 to skip showing hints) 6456 */ 6457 public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints"; 6458 6459 /** 6460 * Persisted playback time after a user confirmation of an unsafe volume level. 6461 * 6462 * @hide 6463 */ 6464 public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms"; 6465 6466 /** 6467 * This preference enables notification display on the lockscreen. 6468 * @hide 6469 */ 6470 public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = 6471 "lock_screen_show_notifications"; 6472 6473 /** 6474 * List of TV inputs that are currently hidden. This is a string 6475 * containing the IDs of all hidden TV inputs. Each ID is encoded by 6476 * {@link android.net.Uri#encode(String)} and separated by ':'. 6477 * @hide 6478 */ 6479 public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs"; 6480 6481 /** 6482 * List of custom TV input labels. This is a string containing <TV input id, custom name> 6483 * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)} 6484 * and separated by ','. Each pair is separated by ':'. 6485 * @hide 6486 */ 6487 public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels"; 6488 6489 /** 6490 * Whether automatic routing of system audio to USB audio peripheral is disabled. 6491 * The value is boolean (1 or 0), where 1 means automatic routing is disabled, 6492 * and 0 means automatic routing is enabled. 6493 * 6494 * @hide 6495 */ 6496 public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED = 6497 "usb_audio_automatic_routing_disabled"; 6498 6499 /** 6500 * The timeout in milliseconds before the device fully goes to sleep after 6501 * a period of inactivity. This value sets an upper bound on how long the device 6502 * will stay awake or dreaming without user activity. It should generally 6503 * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device 6504 * will sleep before it ever has a chance to dream. 6505 * <p> 6506 * Use -1 to disable this timeout. 6507 * </p> 6508 * 6509 * @hide 6510 */ 6511 public static final String SLEEP_TIMEOUT = "sleep_timeout"; 6512 6513 /** 6514 * Controls whether double tap to wake is enabled. 6515 * @hide 6516 */ 6517 public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake"; 6518 6519 /** 6520 * The current assistant component. It could be a voice interaction service, 6521 * or an activity that handles ACTION_ASSIST, or empty which means using the default 6522 * handling. 6523 * 6524 * @hide 6525 */ 6526 public static final String ASSISTANT = "assistant"; 6527 6528 /** 6529 * Whether the camera launch gesture should be disabled. 6530 * 6531 * @hide 6532 */ 6533 public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled"; 6534 6535 /** 6536 * Whether the camera launch gesture to double tap the power button when the screen is off 6537 * should be disabled. 6538 * 6539 * @hide 6540 */ 6541 public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED = 6542 "camera_double_tap_power_gesture_disabled"; 6543 6544 /** 6545 * Whether the camera double twist gesture to flip between front and back mode should be 6546 * enabled. 6547 * 6548 * @hide 6549 */ 6550 public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED = 6551 "camera_double_twist_to_flip_enabled"; 6552 6553 /** 6554 * Control whether Night display is currently activated. 6555 * @hide 6556 */ 6557 public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated"; 6558 6559 /** 6560 * Control whether Night display will automatically activate/deactivate. 6561 * @hide 6562 */ 6563 public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode"; 6564 6565 /** 6566 * Custom time when Night display is scheduled to activate. 6567 * Represented as milliseconds from midnight (e.g. 79200000 == 10pm). 6568 * @hide 6569 */ 6570 public static final String NIGHT_DISPLAY_CUSTOM_START_TIME = "night_display_custom_start_time"; 6571 6572 /** 6573 * Custom time when Night display is scheduled to deactivate. 6574 * Represented as milliseconds from midnight (e.g. 21600000 == 6am). 6575 * @hide 6576 */ 6577 public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time"; 6578 6579 /** 6580 * Whether brightness should automatically adjust based on twilight state. 6581 * @hide 6582 */ 6583 public static final String BRIGHTNESS_USE_TWILIGHT = "brightness_use_twilight"; 6584 6585 /** 6586 * Names of the service components that the current user has explicitly allowed to 6587 * be a VR mode listener, separated by ':'. 6588 * 6589 * @hide 6590 */ 6591 public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners"; 6592 6593 /** 6594 * Behavior of the display while in VR mode. 6595 * 6596 * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}. 6597 * 6598 * @hide 6599 */ 6600 public static final String VR_DISPLAY_MODE = "vr_display_mode"; 6601 6602 /** 6603 * Lower the display persistence while the system is in VR mode. 6604 * 6605 * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE 6606 * 6607 * @hide. 6608 */ 6609 public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0; 6610 6611 /** 6612 * Do not alter the display persistence while the system is in VR mode. 6613 * 6614 * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE 6615 * 6616 * @hide. 6617 */ 6618 public static final int VR_DISPLAY_MODE_OFF = 1; 6619 6620 /** 6621 * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least 6622 * once. 6623 * 6624 * <p>This is used to ensure that we only take one pass which will disable apps that are not 6625 * privileged (if any). From then on, we only want to enable apps (when a matching SIM is 6626 * inserted), to avoid disabling an app that the user might actively be using. 6627 * 6628 * <p>Will be set to 1 once executed. 6629 * 6630 * @hide 6631 */ 6632 public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled"; 6633 6634 /** 6635 * Whether parent user can access remote contact in managed profile. 6636 * 6637 * @hide 6638 */ 6639 public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH = 6640 "managed_profile_contact_remote_search"; 6641 6642 /** 6643 * Whether or not the automatic storage manager is enabled and should run on the device. 6644 * 6645 * @hide 6646 */ 6647 public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED = 6648 "automatic_storage_manager_enabled"; 6649 6650 /** 6651 * How many days of information for the automatic storage manager to retain on the device. 6652 * 6653 * @hide 6654 */ 6655 public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN = 6656 "automatic_storage_manager_days_to_retain"; 6657 6658 /** 6659 * Default number of days of information for the automatic storage manager to retain. 6660 * 6661 * @hide 6662 */ 6663 public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90; 6664 6665 /** 6666 * How many bytes the automatic storage manager has cleared out. 6667 * 6668 * @hide 6669 */ 6670 public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED = 6671 "automatic_storage_manager_bytes_cleared"; 6672 6673 6674 /** 6675 * Last run time for the automatic storage manager. 6676 * 6677 * @hide 6678 */ 6679 public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN = 6680 "automatic_storage_manager_last_run"; 6681 6682 /** 6683 * Whether SystemUI navigation keys is enabled. 6684 * @hide 6685 */ 6686 public static final String SYSTEM_NAVIGATION_KEYS_ENABLED = 6687 "system_navigation_keys_enabled"; 6688 6689 /** 6690 * Whether Downloads folder backup is enabled and should run on the device. 6691 * 6692 * @hide 6693 */ 6694 public static final String DOWNLOADS_BACKUP_ENABLED = "downloads_backup_enabled"; 6695 6696 /** 6697 * Whether Downloads folder backup should only occur if the device is using a metered 6698 * network. 6699 * 6700 * @hide 6701 */ 6702 public static final String DOWNLOADS_BACKUP_ALLOW_METERED = 6703 "downloads_backup_allow_metered"; 6704 6705 /** 6706 * Whether Downloads folder backup should only occur if the device is charging. 6707 * 6708 * @hide 6709 */ 6710 public static final String DOWNLOADS_BACKUP_CHARGING_ONLY = 6711 "downloads_backup_charging_only"; 6712 6713 /** 6714 * How many days of information for the automatic storage manager to retain on the device 6715 * for downloads. 6716 * 6717 * @hide 6718 */ 6719 public static final String AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN = 6720 "automatic_storage_manager_downloads_days_to_retain"; 6721 6722 /** 6723 * Holds comma separated list of ordering of QS tiles. 6724 * @hide 6725 */ 6726 public static final String QS_TILES = "sysui_qs_tiles"; 6727 6728 /** 6729 * Whether preloaded APKs have been installed for the user. 6730 * @hide 6731 */ 6732 public static final String DEMO_USER_SETUP_COMPLETE 6733 = "demo_user_setup_complete"; 6734 6735 /** 6736 * Specifies whether the web action API is enabled. 6737 * 6738 * @hide 6739 */ 6740 public static final String WEB_ACTION_ENABLED = "web_action_enabled"; 6741 6742 /** 6743 * Has this pairable device been paired or upgraded from a previously paired system. 6744 * @hide 6745 */ 6746 public static final String DEVICE_PAIRED = "device_paired"; 6747 6748 /** 6749 * This are the settings to be backed up. 6750 * 6751 * NOTE: Settings are backed up and restored in the order they appear 6752 * in this array. If you have one setting depending on another, 6753 * make sure that they are ordered appropriately. 6754 * 6755 * @hide 6756 */ 6757 public static final String[] SETTINGS_TO_BACKUP = { 6758 BUGREPORT_IN_POWER_MENU, // moved to global 6759 ALLOW_MOCK_LOCATION, 6760 PARENTAL_CONTROL_ENABLED, 6761 PARENTAL_CONTROL_REDIRECT_URL, 6762 USB_MASS_STORAGE_ENABLED, // moved to global 6763 ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 6764 ACCESSIBILITY_DISPLAY_DALTONIZER, 6765 ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 6766 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 6767 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 6768 ACCESSIBILITY_SCRIPT_INJECTION, 6769 ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS, 6770 ENABLED_ACCESSIBILITY_SERVICES, 6771 ENABLED_NOTIFICATION_LISTENERS, 6772 ENABLED_VR_LISTENERS, 6773 ENABLED_INPUT_METHODS, 6774 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, 6775 TOUCH_EXPLORATION_ENABLED, 6776 ACCESSIBILITY_ENABLED, 6777 ACCESSIBILITY_SPEAK_PASSWORD, 6778 ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, 6779 ACCESSIBILITY_CAPTIONING_PRESET, 6780 ACCESSIBILITY_CAPTIONING_ENABLED, 6781 ACCESSIBILITY_CAPTIONING_LOCALE, 6782 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, 6783 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, 6784 ACCESSIBILITY_CAPTIONING_EDGE_TYPE, 6785 ACCESSIBILITY_CAPTIONING_EDGE_COLOR, 6786 ACCESSIBILITY_CAPTIONING_TYPEFACE, 6787 ACCESSIBILITY_CAPTIONING_FONT_SCALE, 6788 ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, 6789 TTS_USE_DEFAULTS, 6790 TTS_DEFAULT_RATE, 6791 TTS_DEFAULT_PITCH, 6792 TTS_DEFAULT_SYNTH, 6793 TTS_DEFAULT_LANG, 6794 TTS_DEFAULT_COUNTRY, 6795 TTS_ENABLED_PLUGINS, 6796 TTS_DEFAULT_LOCALE, 6797 SHOW_IME_WITH_HARD_KEYBOARD, 6798 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global 6799 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global 6800 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global 6801 SELECTED_SPELL_CHECKER, 6802 SELECTED_SPELL_CHECKER_SUBTYPE, 6803 SPELL_CHECKER_ENABLED, 6804 MOUNT_PLAY_NOTIFICATION_SND, 6805 MOUNT_UMS_AUTOSTART, 6806 MOUNT_UMS_PROMPT, 6807 MOUNT_UMS_NOTIFY_ENABLED, 6808 SLEEP_TIMEOUT, 6809 DOUBLE_TAP_TO_WAKE, 6810 WAKE_GESTURE_ENABLED, 6811 LONG_PRESS_TIMEOUT, 6812 CAMERA_GESTURE_DISABLED, 6813 ACCESSIBILITY_AUTOCLICK_ENABLED, 6814 ACCESSIBILITY_AUTOCLICK_DELAY, 6815 ACCESSIBILITY_LARGE_POINTER_ICON, 6816 PREFERRED_TTY_MODE, 6817 ENHANCED_VOICE_PRIVACY_ENABLED, 6818 TTY_MODE_ENABLED, 6819 INCALL_POWER_BUTTON_BEHAVIOR, 6820 NIGHT_DISPLAY_CUSTOM_START_TIME, 6821 NIGHT_DISPLAY_CUSTOM_END_TIME, 6822 NIGHT_DISPLAY_AUTO_MODE, 6823 NIGHT_DISPLAY_ACTIVATED, 6824 SYNC_PARENT_SOUNDS, 6825 CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 6826 CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 6827 SYSTEM_NAVIGATION_KEYS_ENABLED, 6828 QS_TILES, 6829 DOZE_ENABLED, 6830 DOZE_PULSE_ON_PICK_UP, 6831 DOZE_PULSE_ON_DOUBLE_TAP, 6832 NFC_PAYMENT_DEFAULT_COMPONENT 6833 }; 6834 6835 /** 6836 * These entries are considered common between the personal and the managed profile, 6837 * since the managed profile doesn't get to change them. 6838 */ 6839 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 6840 6841 static { 6842 CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED); 6843 CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION); 6844 CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS); 6845 CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD); 6846 CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES); 6847 CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS); 6848 CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); 6849 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE); 6850 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED); 6851 CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE); 6852 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER); 6853 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE); 6854 } 6855 6856 /** @hide */ 6857 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 6858 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 6859 } 6860 6861 /** 6862 * Helper method for determining if a location provider is enabled. 6863 * 6864 * @param cr the content resolver to use 6865 * @param provider the location provider to query 6866 * @return true if the provider is enabled 6867 * 6868 * @deprecated use {@link #LOCATION_MODE} or 6869 * {@link LocationManager#isProviderEnabled(String)} 6870 */ 6871 @Deprecated 6872 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { 6873 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); 6874 } 6875 6876 /** 6877 * Helper method for determining if a location provider is enabled. 6878 * @param cr the content resolver to use 6879 * @param provider the location provider to query 6880 * @param userId the userId to query 6881 * @return true if the provider is enabled 6882 * @deprecated use {@link #LOCATION_MODE} or 6883 * {@link LocationManager#isProviderEnabled(String)} 6884 * @hide 6885 */ 6886 @Deprecated 6887 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { 6888 String allowedProviders = Settings.Secure.getStringForUser(cr, 6889 LOCATION_PROVIDERS_ALLOWED, userId); 6890 return TextUtils.delimitedStringContains(allowedProviders, ',', provider); 6891 } 6892 6893 /** 6894 * Thread-safe method for enabling or disabling a single location provider. 6895 * @param cr the content resolver to use 6896 * @param provider the location provider to enable or disable 6897 * @param enabled true if the provider should be enabled 6898 * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE} 6899 */ 6900 @Deprecated 6901 public static final void setLocationProviderEnabled(ContentResolver cr, 6902 String provider, boolean enabled) { 6903 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); 6904 } 6905 6906 /** 6907 * Thread-safe method for enabling or disabling a single location provider. 6908 * 6909 * @param cr the content resolver to use 6910 * @param provider the location provider to enable or disable 6911 * @param enabled true if the provider should be enabled 6912 * @param userId the userId for which to enable/disable providers 6913 * @return true if the value was set, false on database errors 6914 * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and 6915 * {@link #LOCATION_MODE} 6916 * @hide 6917 */ 6918 @Deprecated 6919 public static final boolean setLocationProviderEnabledForUser(ContentResolver cr, 6920 String provider, boolean enabled, int userId) { 6921 synchronized (mLocationSettingsLock) { 6922 // to ensure thread safety, we write the provider name with a '+' or '-' 6923 // and let the SettingsProvider handle it rather than reading and modifying 6924 // the list of enabled providers. 6925 if (enabled) { 6926 provider = "+" + provider; 6927 } else { 6928 provider = "-" + provider; 6929 } 6930 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, 6931 userId); 6932 } 6933 } 6934 6935 /** 6936 * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}. 6937 */ 6938 private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) { 6939 final int mode = getLocationModeForUser(cr, userId); 6940 return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId); 6941 } 6942 6943 /** 6944 * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}. 6945 */ 6946 private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) { 6947 int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, 6948 LOCATION_MODE_HIGH_ACCURACY, userId); 6949 // Make sure that the previous mode is never "off". Otherwise the user won't be able to 6950 // turn on location any longer. 6951 if (mode == LOCATION_MODE_OFF) { 6952 mode = LOCATION_MODE_HIGH_ACCURACY; 6953 } 6954 return setLocationModeForUser(cr, mode, userId); 6955 } 6956 6957 /** 6958 * Thread-safe method for setting the location mode to one of 6959 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 6960 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. 6961 * Necessary because the mode is a composite of the underlying location provider 6962 * settings. 6963 * 6964 * @param cr the content resolver to use 6965 * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} 6966 * @param userId the userId for which to change mode 6967 * @return true if the value was set, false on database errors 6968 * 6969 * @throws IllegalArgumentException if mode is not one of the supported values 6970 */ 6971 private static final boolean setLocationModeForUser(ContentResolver cr, int mode, 6972 int userId) { 6973 synchronized (mLocationSettingsLock) { 6974 boolean gps = false; 6975 boolean network = false; 6976 switch (mode) { 6977 case LOCATION_MODE_PREVIOUS: 6978 // Retrieve the actual mode and set to that mode. 6979 return restoreLocationModeForUser(cr, userId); 6980 case LOCATION_MODE_OFF: 6981 saveLocationModeForUser(cr, userId); 6982 break; 6983 case LOCATION_MODE_SENSORS_ONLY: 6984 gps = true; 6985 break; 6986 case LOCATION_MODE_BATTERY_SAVING: 6987 network = true; 6988 break; 6989 case LOCATION_MODE_HIGH_ACCURACY: 6990 gps = true; 6991 network = true; 6992 break; 6993 default: 6994 throw new IllegalArgumentException("Invalid location mode: " + mode); 6995 } 6996 // Note it's important that we set the NLP mode first. The Google implementation 6997 // of NLP clears its NLP consent setting any time it receives a 6998 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also, 6999 // it shows an NLP consent dialog any time it receives the broadcast, NLP is 7000 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first, 7001 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting, 7002 // and 3) the receiver happened to complete before we enabled NLP, then the Google 7003 // NLP would detect the attempt to enable NLP and show a redundant NLP consent 7004 // dialog. Then the people who wrote the setup wizard would be sad. 7005 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser( 7006 cr, LocationManager.NETWORK_PROVIDER, network, userId); 7007 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser( 7008 cr, LocationManager.GPS_PROVIDER, gps, userId); 7009 return gpsSuccess && nlpSuccess; 7010 } 7011 } 7012 7013 /** 7014 * Thread-safe method for reading the location mode, returns one of 7015 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 7016 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary 7017 * because the mode is a composite of the underlying location provider settings. 7018 * 7019 * @param cr the content resolver to use 7020 * @param userId the userId for which to read the mode 7021 * @return the location mode 7022 */ 7023 private static final int getLocationModeForUser(ContentResolver cr, int userId) { 7024 synchronized (mLocationSettingsLock) { 7025 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( 7026 cr, LocationManager.GPS_PROVIDER, userId); 7027 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( 7028 cr, LocationManager.NETWORK_PROVIDER, userId); 7029 if (gpsEnabled && networkEnabled) { 7030 return LOCATION_MODE_HIGH_ACCURACY; 7031 } else if (gpsEnabled) { 7032 return LOCATION_MODE_SENSORS_ONLY; 7033 } else if (networkEnabled) { 7034 return LOCATION_MODE_BATTERY_SAVING; 7035 } else { 7036 return LOCATION_MODE_OFF; 7037 } 7038 } 7039 } 7040 } 7041 7042 /** 7043 * Global system settings, containing preferences that always apply identically 7044 * to all defined users. Applications can read these but are not allowed to write; 7045 * like the "Secure" settings, these are for preferences that the user must 7046 * explicitly modify through the system UI or specialized APIs for those values. 7047 */ 7048 public static final class Global extends NameValueTable { 7049 /** 7050 * The content:// style URL for global secure settings items. Not public. 7051 */ 7052 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); 7053 7054 /** 7055 * Whether users are allowed to add more users or guest from lockscreen. 7056 * <p> 7057 * Type: int 7058 * @hide 7059 */ 7060 public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked"; 7061 7062 /** 7063 * Setting whether the global gesture for enabling accessibility is enabled. 7064 * If this gesture is enabled the user will be able to perfrom it to enable 7065 * the accessibility state without visiting the settings app. 7066 * @hide 7067 */ 7068 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = 7069 "enable_accessibility_global_gesture_enabled"; 7070 7071 /** 7072 * Whether Airplane Mode is on. 7073 */ 7074 public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; 7075 7076 /** 7077 * Whether Theater Mode is on. 7078 * {@hide} 7079 */ 7080 @SystemApi 7081 public static final String THEATER_MODE_ON = "theater_mode_on"; 7082 7083 /** 7084 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. 7085 */ 7086 public static final String RADIO_BLUETOOTH = "bluetooth"; 7087 7088 /** 7089 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. 7090 */ 7091 public static final String RADIO_WIFI = "wifi"; 7092 7093 /** 7094 * {@hide} 7095 */ 7096 public static final String RADIO_WIMAX = "wimax"; 7097 /** 7098 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. 7099 */ 7100 public static final String RADIO_CELL = "cell"; 7101 7102 /** 7103 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. 7104 */ 7105 public static final String RADIO_NFC = "nfc"; 7106 7107 /** 7108 * A comma separated list of radios that need to be disabled when airplane mode 7109 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are 7110 * included in the comma separated list. 7111 */ 7112 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; 7113 7114 /** 7115 * A comma separated list of radios that should to be disabled when airplane mode 7116 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is 7117 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi 7118 * will be turned off when entering airplane mode, but the user will be able to reenable 7119 * Wifi in the Settings app. 7120 * 7121 * {@hide} 7122 */ 7123 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; 7124 7125 /** 7126 * A Long representing a bitmap of profiles that should be disabled when bluetooth starts. 7127 * See {@link android.bluetooth.BluetoothProfile}. 7128 * {@hide} 7129 */ 7130 public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles"; 7131 7132 /** 7133 * A semi-colon separated list of Bluetooth interoperability workarounds. 7134 * Each entry is a partial Bluetooth device address string and an integer representing 7135 * the feature to be disabled, separated by a comma. The integer must correspond 7136 * to a interoperability feature as defined in "interop.h" in /system/bt. 7137 * <p> 7138 * Example: <br/> 7139 * "00:11:22,0;01:02:03:04,2" 7140 * @hide 7141 */ 7142 public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list"; 7143 7144 /** 7145 * The policy for deciding when Wi-Fi should go to sleep (which will in 7146 * turn switch to using the mobile data as an Internet connection). 7147 * <p> 7148 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, 7149 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or 7150 * {@link #WIFI_SLEEP_POLICY_NEVER}. 7151 */ 7152 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; 7153 7154 /** 7155 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep 7156 * policy, which is to sleep shortly after the turning off 7157 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. 7158 */ 7159 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; 7160 7161 /** 7162 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when 7163 * the device is on battery, and never go to sleep when the device is 7164 * plugged in. 7165 */ 7166 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; 7167 7168 /** 7169 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. 7170 */ 7171 public static final int WIFI_SLEEP_POLICY_NEVER = 2; 7172 7173 /** 7174 * Value to specify if the user prefers the date, time and time zone 7175 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 7176 */ 7177 public static final String AUTO_TIME = "auto_time"; 7178 7179 /** 7180 * Value to specify if the user prefers the time zone 7181 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 7182 */ 7183 public static final String AUTO_TIME_ZONE = "auto_time_zone"; 7184 7185 /** 7186 * URI for the car dock "in" event sound. 7187 * @hide 7188 */ 7189 public static final String CAR_DOCK_SOUND = "car_dock_sound"; 7190 7191 /** 7192 * URI for the car dock "out" event sound. 7193 * @hide 7194 */ 7195 public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; 7196 7197 /** 7198 * URI for the desk dock "in" event sound. 7199 * @hide 7200 */ 7201 public static final String DESK_DOCK_SOUND = "desk_dock_sound"; 7202 7203 /** 7204 * URI for the desk dock "out" event sound. 7205 * @hide 7206 */ 7207 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; 7208 7209 /** 7210 * Whether to play a sound for dock events. 7211 * @hide 7212 */ 7213 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; 7214 7215 /** 7216 * Whether to play a sound for dock events, only when an accessibility service is on. 7217 * @hide 7218 */ 7219 public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility"; 7220 7221 /** 7222 * URI for the "device locked" (keyguard shown) sound. 7223 * @hide 7224 */ 7225 public static final String LOCK_SOUND = "lock_sound"; 7226 7227 /** 7228 * URI for the "device unlocked" sound. 7229 * @hide 7230 */ 7231 public static final String UNLOCK_SOUND = "unlock_sound"; 7232 7233 /** 7234 * URI for the "device is trusted" sound, which is played when the device enters the trusted 7235 * state without unlocking. 7236 * @hide 7237 */ 7238 public static final String TRUSTED_SOUND = "trusted_sound"; 7239 7240 /** 7241 * URI for the low battery sound file. 7242 * @hide 7243 */ 7244 public static final String LOW_BATTERY_SOUND = "low_battery_sound"; 7245 7246 /** 7247 * Whether to play a sound for low-battery alerts. 7248 * @hide 7249 */ 7250 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; 7251 7252 /** 7253 * URI for the "wireless charging started" sound. 7254 * @hide 7255 */ 7256 public static final String WIRELESS_CHARGING_STARTED_SOUND = 7257 "wireless_charging_started_sound"; 7258 7259 /** 7260 * Whether to play a sound for charging events. 7261 * @hide 7262 */ 7263 public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; 7264 7265 /** 7266 * Whether we keep the device on while the device is plugged in. 7267 * Supported values are: 7268 * <ul> 7269 * <li>{@code 0} to never stay on while plugged in</li> 7270 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li> 7271 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li> 7272 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li> 7273 * </ul> 7274 * These values can be OR-ed together. 7275 */ 7276 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; 7277 7278 /** 7279 * When the user has enable the option to have a "bug report" command 7280 * in the power menu. 7281 * @hide 7282 */ 7283 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 7284 7285 /** 7286 * Whether ADB is enabled. 7287 */ 7288 public static final String ADB_ENABLED = "adb_enabled"; 7289 7290 /** 7291 * Whether Views are allowed to save their attribute data. 7292 * @hide 7293 */ 7294 public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes"; 7295 7296 /** 7297 * Whether assisted GPS should be enabled or not. 7298 * @hide 7299 */ 7300 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; 7301 7302 /** 7303 * Whether bluetooth is enabled/disabled 7304 * 0=disabled. 1=enabled. 7305 */ 7306 public static final String BLUETOOTH_ON = "bluetooth_on"; 7307 7308 /** 7309 * CDMA Cell Broadcast SMS 7310 * 0 = CDMA Cell Broadcast SMS disabled 7311 * 1 = CDMA Cell Broadcast SMS enabled 7312 * @hide 7313 */ 7314 public static final String CDMA_CELL_BROADCAST_SMS = 7315 "cdma_cell_broadcast_sms"; 7316 7317 /** 7318 * The CDMA roaming mode 0 = Home Networks, CDMA default 7319 * 1 = Roaming on Affiliated networks 7320 * 2 = Roaming on any networks 7321 * @hide 7322 */ 7323 public static final String CDMA_ROAMING_MODE = "roaming_settings"; 7324 7325 /** 7326 * The CDMA subscription mode 0 = RUIM/SIM (default) 7327 * 1 = NV 7328 * @hide 7329 */ 7330 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; 7331 7332 /** Inactivity timeout to track mobile data activity. 7333 * 7334 * If set to a positive integer, it indicates the inactivity timeout value in seconds to 7335 * infer the data activity of mobile network. After a period of no activity on mobile 7336 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} 7337 * intent is fired to indicate a transition of network status from "active" to "idle". Any 7338 * subsequent activity on mobile networks triggers the firing of {@code 7339 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". 7340 * 7341 * Network activity refers to transmitting or receiving data on the network interfaces. 7342 * 7343 * Tracking is disabled if set to zero or negative value. 7344 * 7345 * @hide 7346 */ 7347 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; 7348 7349 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} 7350 * but for Wifi network. 7351 * @hide 7352 */ 7353 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; 7354 7355 /** 7356 * Whether or not data roaming is enabled. (0 = false, 1 = true) 7357 */ 7358 public static final String DATA_ROAMING = "data_roaming"; 7359 7360 /** 7361 * The value passed to a Mobile DataConnection via bringUp which defines the 7362 * number of retries to preform when setting up the initial connection. The default 7363 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1. 7364 * @hide 7365 */ 7366 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry"; 7367 7368 /** 7369 * Whether any package can be on external storage. When this is true, any 7370 * package, regardless of manifest values, is a candidate for installing 7371 * or moving onto external storage. (0 = false, 1 = true) 7372 * @hide 7373 */ 7374 public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external"; 7375 7376 /** 7377 * Whether any activity can be resized. When this is true, any 7378 * activity, regardless of manifest values, can be resized for multi-window. 7379 * (0 = false, 1 = true) 7380 * @hide 7381 */ 7382 public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES 7383 = "force_resizable_activities"; 7384 7385 /** 7386 * Whether to enable experimental freeform support for windows. 7387 * @hide 7388 */ 7389 public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT 7390 = "enable_freeform_support"; 7391 7392 /** 7393 * Whether user has enabled development settings. 7394 */ 7395 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; 7396 7397 /** 7398 * Whether the device has been provisioned (0 = false, 1 = true). 7399 * <p>On a multiuser device with a separate system user, the screen may be locked 7400 * as soon as this is set to true and further activities cannot be launched on the 7401 * system user unless they are marked to show over keyguard. 7402 */ 7403 public static final String DEVICE_PROVISIONED = "device_provisioned"; 7404 7405 /** 7406 * Whether mobile data should be allowed while the device is being provisioned. 7407 * This allows the provisioning process to turn off mobile data before the user 7408 * has an opportunity to set things up, preventing other processes from burning 7409 * precious bytes before wifi is setup. 7410 * (0 = false, 1 = true) 7411 * @hide 7412 */ 7413 public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED = 7414 "device_provisioning_mobile_data"; 7415 7416 /** 7417 * The saved value for WindowManagerService.setForcedDisplaySize(). 7418 * Two integers separated by a comma. If unset, then use the real display size. 7419 * @hide 7420 */ 7421 public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; 7422 7423 /** 7424 * The saved value for WindowManagerService.setForcedDisplayScalingMode(). 7425 * 0 or unset if scaling is automatic, 1 if scaling is disabled. 7426 * @hide 7427 */ 7428 public static final String DISPLAY_SCALING_FORCE = "display_scaling_force"; 7429 7430 /** 7431 * The maximum size, in bytes, of a download that the download manager will transfer over 7432 * a non-wifi connection. 7433 * @hide 7434 */ 7435 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = 7436 "download_manager_max_bytes_over_mobile"; 7437 7438 /** 7439 * The recommended maximum size, in bytes, of a download that the download manager should 7440 * transfer over a non-wifi connection. Over this size, the use will be warned, but will 7441 * have the option to start the download over the mobile connection anyway. 7442 * @hide 7443 */ 7444 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = 7445 "download_manager_recommended_max_bytes_over_mobile"; 7446 7447 /** 7448 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 7449 */ 7450 @Deprecated 7451 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 7452 7453 /** 7454 * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be 7455 * sent or processed. (0 = false, 1 = true) 7456 * @hide 7457 */ 7458 public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled"; 7459 7460 /** 7461 * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted, 7462 * and the output is redirected to AV Receiver connected via 7463 * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}. 7464 * @hide 7465 */ 7466 public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled"; 7467 7468 /** 7469 * Whether TV will automatically turn on upon reception of the CEC command 7470 * <Text View On> or <Image View On>. (0 = false, 1 = true) 7471 * @hide 7472 */ 7473 public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED = 7474 "hdmi_control_auto_wakeup_enabled"; 7475 7476 /** 7477 * Whether TV will also turn off other CEC devices when it goes to standby mode. 7478 * (0 = false, 1 = true) 7479 * @hide 7480 */ 7481 public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED = 7482 "hdmi_control_auto_device_off_enabled"; 7483 7484 /** 7485 * Whether TV will switch to MHL port when a mobile device is plugged in. 7486 * (0 = false, 1 = true) 7487 * @hide 7488 */ 7489 public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled"; 7490 7491 /** 7492 * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true) 7493 * @hide 7494 */ 7495 public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled"; 7496 7497 /** 7498 * Whether mobile data connections are allowed by the user. See 7499 * ConnectivityManager for more info. 7500 * @hide 7501 */ 7502 public static final String MOBILE_DATA = "mobile_data"; 7503 7504 /** 7505 * Whether the mobile data connection should remain active even when higher 7506 * priority networks like WiFi are active, to help make network switching faster. 7507 * 7508 * See ConnectivityService for more info. 7509 * 7510 * (0 = disabled, 1 = enabled) 7511 * @hide 7512 */ 7513 public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on"; 7514 7515 /** 7516 * Size of the event buffer for IP connectivity metrics. 7517 * @hide 7518 */ 7519 public static final String CONNECTIVITY_METRICS_BUFFER_SIZE = 7520 "connectivity_metrics_buffer_size"; 7521 7522 /** {@hide} */ 7523 public static final String NETSTATS_ENABLED = "netstats_enabled"; 7524 /** {@hide} */ 7525 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; 7526 /** {@hide} */ 7527 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; 7528 /** {@hide} */ 7529 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; 7530 /** {@hide} */ 7531 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; 7532 7533 /** {@hide} */ 7534 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; 7535 /** {@hide} */ 7536 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; 7537 /** {@hide} */ 7538 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; 7539 /** {@hide} */ 7540 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; 7541 7542 /** {@hide} */ 7543 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; 7544 /** {@hide} */ 7545 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; 7546 /** {@hide} */ 7547 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; 7548 /** {@hide} */ 7549 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; 7550 7551 /** {@hide} */ 7552 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; 7553 /** {@hide} */ 7554 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; 7555 /** {@hide} */ 7556 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; 7557 /** {@hide} */ 7558 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; 7559 7560 /** 7561 * User preference for which network(s) should be used. Only the 7562 * connectivity service should touch this. 7563 */ 7564 public static final String NETWORK_PREFERENCE = "network_preference"; 7565 7566 /** 7567 * Which package name to use for network scoring. If null, or if the package is not a valid 7568 * scorer app, external network scores will neither be requested nor accepted. 7569 * @hide 7570 */ 7571 public static final String NETWORK_SCORER_APP = "network_scorer_app"; 7572 7573 /** 7574 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment 7575 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been 7576 * exceeded. 7577 * @hide 7578 */ 7579 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; 7580 7581 /** 7582 * The length of time in milli-seconds that automatic small adjustments to 7583 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. 7584 * @hide 7585 */ 7586 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; 7587 7588 /** Preferred NTP server. {@hide} */ 7589 public static final String NTP_SERVER = "ntp_server"; 7590 /** Timeout in milliseconds to wait for NTP server. {@hide} */ 7591 public static final String NTP_TIMEOUT = "ntp_timeout"; 7592 7593 /** {@hide} */ 7594 public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval"; 7595 7596 /** 7597 * Sample validity in seconds to configure for the system DNS resolver. 7598 * {@hide} 7599 */ 7600 public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS = 7601 "dns_resolver_sample_validity_seconds"; 7602 7603 /** 7604 * Success threshold in percent for use with the system DNS resolver. 7605 * {@hide} 7606 */ 7607 public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT = 7608 "dns_resolver_success_threshold_percent"; 7609 7610 /** 7611 * Minimum number of samples needed for statistics to be considered meaningful in the 7612 * system DNS resolver. 7613 * {@hide} 7614 */ 7615 public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples"; 7616 7617 /** 7618 * Maximum number taken into account for statistics purposes in the system DNS resolver. 7619 * {@hide} 7620 */ 7621 public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples"; 7622 7623 /** 7624 * Whether to disable the automatic scheduling of system updates. 7625 * 1 = system updates won't be automatically scheduled (will always 7626 * present notification instead). 7627 * 0 = system updates will be automatically scheduled. (default) 7628 * @hide 7629 */ 7630 @SystemApi 7631 public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update"; 7632 7633 /** 7634 * Whether the package manager should send package verification broadcasts for verifiers to 7635 * review apps prior to installation. 7636 * 1 = request apps to be verified prior to installation, if a verifier exists. 7637 * 0 = do not verify apps before installation 7638 * @hide 7639 */ 7640 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; 7641 7642 /** Timeout for package verification. 7643 * @hide */ 7644 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; 7645 7646 /** Default response code for package verification. 7647 * @hide */ 7648 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; 7649 7650 /** 7651 * Show package verification setting in the Settings app. 7652 * 1 = show (default) 7653 * 0 = hide 7654 * @hide 7655 */ 7656 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; 7657 7658 /** 7659 * Run package verification on apps installed through ADB/ADT/USB 7660 * 1 = perform package verification on ADB installs (default) 7661 * 0 = bypass package verification on ADB installs 7662 * @hide 7663 */ 7664 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; 7665 7666 /** 7667 * Time since last fstrim (milliseconds) after which we force one to happen 7668 * during device startup. If unset, the default is 3 days. 7669 * @hide 7670 */ 7671 public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval"; 7672 7673 /** 7674 * The interval in milliseconds at which to check packet counts on the 7675 * mobile data interface when screen is on, to detect possible data 7676 * connection problems. 7677 * @hide 7678 */ 7679 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = 7680 "pdp_watchdog_poll_interval_ms"; 7681 7682 /** 7683 * The interval in milliseconds at which to check packet counts on the 7684 * mobile data interface when screen is off, to detect possible data 7685 * connection problems. 7686 * @hide 7687 */ 7688 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = 7689 "pdp_watchdog_long_poll_interval_ms"; 7690 7691 /** 7692 * The interval in milliseconds at which to check packet counts on the 7693 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} 7694 * outgoing packets has been reached without incoming packets. 7695 * @hide 7696 */ 7697 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = 7698 "pdp_watchdog_error_poll_interval_ms"; 7699 7700 /** 7701 * The number of outgoing packets sent without seeing an incoming packet 7702 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} 7703 * device is logged to the event log 7704 * @hide 7705 */ 7706 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = 7707 "pdp_watchdog_trigger_packet_count"; 7708 7709 /** 7710 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) 7711 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before 7712 * attempting data connection recovery. 7713 * @hide 7714 */ 7715 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = 7716 "pdp_watchdog_error_poll_count"; 7717 7718 /** 7719 * The number of failed PDP reset attempts before moving to something more 7720 * drastic: re-registering to the network. 7721 * @hide 7722 */ 7723 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = 7724 "pdp_watchdog_max_pdp_reset_fail_count"; 7725 7726 /** 7727 * A positive value indicates how often the SamplingProfiler 7728 * should take snapshots. Zero value means SamplingProfiler 7729 * is disabled. 7730 * 7731 * @hide 7732 */ 7733 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; 7734 7735 /** 7736 * URL to open browser on to allow user to manage a prepay account 7737 * @hide 7738 */ 7739 public static final String SETUP_PREPAID_DATA_SERVICE_URL = 7740 "setup_prepaid_data_service_url"; 7741 7742 /** 7743 * URL to attempt a GET on to see if this is a prepay device 7744 * @hide 7745 */ 7746 public static final String SETUP_PREPAID_DETECTION_TARGET_URL = 7747 "setup_prepaid_detection_target_url"; 7748 7749 /** 7750 * Host to check for a redirect to after an attempt to GET 7751 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, 7752 * this is a prepaid device with zero balance.) 7753 * @hide 7754 */ 7755 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = 7756 "setup_prepaid_detection_redir_host"; 7757 7758 /** 7759 * The interval in milliseconds at which to check the number of SMS sent out without asking 7760 * for use permit, to limit the un-authorized SMS usage. 7761 * 7762 * @hide 7763 */ 7764 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = 7765 "sms_outgoing_check_interval_ms"; 7766 7767 /** 7768 * The number of outgoing SMS sent without asking for user permit (of {@link 7769 * #SMS_OUTGOING_CHECK_INTERVAL_MS} 7770 * 7771 * @hide 7772 */ 7773 public static final String SMS_OUTGOING_CHECK_MAX_COUNT = 7774 "sms_outgoing_check_max_count"; 7775 7776 /** 7777 * Used to disable SMS short code confirmation - defaults to true. 7778 * True indcates we will do the check, etc. Set to false to disable. 7779 * @see com.android.internal.telephony.SmsUsageMonitor 7780 * @hide 7781 */ 7782 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; 7783 7784 /** 7785 * Used to select which country we use to determine premium sms codes. 7786 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, 7787 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, 7788 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. 7789 * @hide 7790 */ 7791 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; 7792 7793 /** 7794 * Used to select TCP's default initial receiver window size in segments - defaults to a build config value 7795 * @hide 7796 */ 7797 public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd"; 7798 7799 /** 7800 * Used to disable Tethering on a device - defaults to true 7801 * @hide 7802 */ 7803 public static final String TETHER_SUPPORTED = "tether_supported"; 7804 7805 /** 7806 * Used to require DUN APN on the device or not - defaults to a build config value 7807 * which defaults to false 7808 * @hide 7809 */ 7810 public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; 7811 7812 /** 7813 * Used to hold a gservices-provisioned apn value for DUN. If set, or the 7814 * corresponding build config values are set it will override the APN DB 7815 * values. 7816 * Consists of a comma seperated list of strings: 7817 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" 7818 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" 7819 * @hide 7820 */ 7821 public static final String TETHER_DUN_APN = "tether_dun_apn"; 7822 7823 /** 7824 * List of carrier apps which are whitelisted to prompt the user for install when 7825 * a sim card with matching uicc carrier privilege rules is inserted. 7826 * 7827 * The value is "package1;package2;..." 7828 * @hide 7829 */ 7830 public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist"; 7831 7832 /** 7833 * USB Mass Storage Enabled 7834 */ 7835 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; 7836 7837 /** 7838 * If this setting is set (to anything), then all references 7839 * to Gmail on the device must change to Google Mail. 7840 */ 7841 public static final String USE_GOOGLE_MAIL = "use_google_mail"; 7842 7843 /** 7844 * Webview Data reduction proxy key. 7845 * @hide 7846 */ 7847 public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = 7848 "webview_data_reduction_proxy_key"; 7849 7850 /** 7851 * Whether or not the WebView fallback mechanism should be enabled. 7852 * 0=disabled, 1=enabled. 7853 * @hide 7854 */ 7855 public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED = 7856 "webview_fallback_logic_enabled"; 7857 7858 /** 7859 * Name of the package used as WebView provider (if unset the provider is instead determined 7860 * by the system). 7861 * @hide 7862 */ 7863 public static final String WEBVIEW_PROVIDER = "webview_provider"; 7864 7865 /** 7866 * Developer setting to enable WebView multiprocess rendering. 7867 * @hide 7868 */ 7869 @SystemApi 7870 public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess"; 7871 7872 /** 7873 * The maximum number of notifications shown in 24 hours when switching networks. 7874 * @hide 7875 */ 7876 public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT = 7877 "network_switch_notification_daily_limit"; 7878 7879 /** 7880 * The minimum time in milliseconds between notifications when switching networks. 7881 * @hide 7882 */ 7883 public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS = 7884 "network_switch_notification_rate_limit_millis"; 7885 7886 /** 7887 * Whether to automatically switch away from wifi networks that lose Internet access. 7888 * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always 7889 * avoids such networks. Valid values are: 7890 * 7891 * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013. 7892 * null: Ask the user whether to switch away from bad wifi. 7893 * 1: Avoid bad wifi. 7894 * 7895 * @hide 7896 */ 7897 public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi"; 7898 7899 /** 7900 * Whether Wifi display is enabled/disabled 7901 * 0=disabled. 1=enabled. 7902 * @hide 7903 */ 7904 public static final String WIFI_DISPLAY_ON = "wifi_display_on"; 7905 7906 /** 7907 * Whether Wifi display certification mode is enabled/disabled 7908 * 0=disabled. 1=enabled. 7909 * @hide 7910 */ 7911 public static final String WIFI_DISPLAY_CERTIFICATION_ON = 7912 "wifi_display_certification_on"; 7913 7914 /** 7915 * WPS Configuration method used by Wifi display, this setting only 7916 * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled). 7917 * 7918 * Possible values are: 7919 * 7920 * WpsInfo.INVALID: use default WPS method chosen by framework 7921 * WpsInfo.PBC : use Push button 7922 * WpsInfo.KEYPAD : use Keypad 7923 * WpsInfo.DISPLAY: use Display 7924 * @hide 7925 */ 7926 public static final String WIFI_DISPLAY_WPS_CONFIG = 7927 "wifi_display_wps_config"; 7928 7929 /** 7930 * Whether to notify the user of open networks. 7931 * <p> 7932 * If not connected and the scan results have an open network, we will 7933 * put this notification up. If we attempt to connect to a network or 7934 * the open network(s) disappear, we remove the notification. When we 7935 * show the notification, we will not show it again for 7936 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. 7937 */ 7938 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 7939 "wifi_networks_available_notification_on"; 7940 /** 7941 * {@hide} 7942 */ 7943 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = 7944 "wimax_networks_available_notification_on"; 7945 7946 /** 7947 * Delay (in seconds) before repeating the Wi-Fi networks available notification. 7948 * Connecting to a network will reset the timer. 7949 */ 7950 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 7951 "wifi_networks_available_repeat_delay"; 7952 7953 /** 7954 * 802.11 country code in ISO 3166 format 7955 * @hide 7956 */ 7957 public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; 7958 7959 /** 7960 * The interval in milliseconds to issue wake up scans when wifi needs 7961 * to connect. This is necessary to connect to an access point when 7962 * device is on the move and the screen is off. 7963 * @hide 7964 */ 7965 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = 7966 "wifi_framework_scan_interval_ms"; 7967 7968 /** 7969 * The interval in milliseconds after which Wi-Fi is considered idle. 7970 * When idle, it is possible for the device to be switched from Wi-Fi to 7971 * the mobile data network. 7972 * @hide 7973 */ 7974 public static final String WIFI_IDLE_MS = "wifi_idle_ms"; 7975 7976 /** 7977 * When the number of open networks exceeds this number, the 7978 * least-recently-used excess networks will be removed. 7979 */ 7980 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; 7981 7982 /** 7983 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. 7984 */ 7985 public static final String WIFI_ON = "wifi_on"; 7986 7987 /** 7988 * Setting to allow scans to be enabled even wifi is turned off for connectivity. 7989 * @hide 7990 */ 7991 public static final String WIFI_SCAN_ALWAYS_AVAILABLE = 7992 "wifi_scan_always_enabled"; 7993 7994 /** 7995 * Value to specify if Wi-Fi Wakeup feature is enabled. 7996 * 7997 * Type: int (0 for false, 1 for true) 7998 * @hide 7999 */ 8000 @SystemApi 8001 public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled"; 8002 8003 /** 8004 * Value to specify if network recommendations from 8005 * {@link com.android.server.NetworkScoreService} are enabled. 8006 * 8007 * Type: int (0 for false, 1 for true) 8008 * @hide 8009 */ 8010 @SystemApi 8011 public static final String NETWORK_RECOMMENDATIONS_ENABLED = 8012 "network_recommendations_enabled"; 8013 8014 /** 8015 * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for 8016 * connectivity. 8017 * @hide 8018 */ 8019 public static final String BLE_SCAN_ALWAYS_AVAILABLE = 8020 "ble_scan_always_enabled"; 8021 8022 /** 8023 * Used to save the Wifi_ON state prior to tethering. 8024 * This state will be checked to restore Wifi after 8025 * the user turns off tethering. 8026 * 8027 * @hide 8028 */ 8029 public static final String WIFI_SAVED_STATE = "wifi_saved_state"; 8030 8031 /** 8032 * The interval in milliseconds to scan as used by the wifi supplicant 8033 * @hide 8034 */ 8035 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = 8036 "wifi_supplicant_scan_interval_ms"; 8037 8038 /** 8039 * whether frameworks handles wifi auto-join 8040 * @hide 8041 */ 8042 public static final String WIFI_ENHANCED_AUTO_JOIN = 8043 "wifi_enhanced_auto_join"; 8044 8045 /** 8046 * whether settings show RSSI 8047 * @hide 8048 */ 8049 public static final String WIFI_NETWORK_SHOW_RSSI = 8050 "wifi_network_show_rssi"; 8051 8052 /** 8053 * The interval in milliseconds to scan at supplicant when p2p is connected 8054 * @hide 8055 */ 8056 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = 8057 "wifi_scan_interval_p2p_connected_ms"; 8058 8059 /** 8060 * Whether the Wi-Fi watchdog is enabled. 8061 */ 8062 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 8063 8064 /** 8065 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and 8066 * the setting needs to be set to 0 to disable it. 8067 * @hide 8068 */ 8069 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = 8070 "wifi_watchdog_poor_network_test_enabled"; 8071 8072 /** 8073 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and 8074 * needs to be set to 0 to disable it. 8075 * @hide 8076 */ 8077 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = 8078 "wifi_suspend_optimizations_enabled"; 8079 8080 /** 8081 * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1 8082 * will enable it. In the future, additional values may be supported. 8083 * @hide 8084 */ 8085 public static final String WIFI_VERBOSE_LOGGING_ENABLED = 8086 "wifi_verbose_logging_enabled"; 8087 8088 /** 8089 * The maximum number of times we will retry a connection to an access 8090 * point for which we have failed in acquiring an IP address from DHCP. 8091 * A value of N means that we will make N+1 connection attempts in all. 8092 */ 8093 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; 8094 8095 /** 8096 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile 8097 * data connectivity to be established after a disconnect from Wi-Fi. 8098 */ 8099 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 8100 "wifi_mobile_data_transition_wakelock_timeout_ms"; 8101 8102 /** 8103 * This setting controls whether WiFi configurations created by a Device Owner app 8104 * should be locked down (that is, be editable or removable only by the Device Owner App, 8105 * not even by Settings app). 8106 * This setting takes integer values. Non-zero values mean DO created configurations 8107 * are locked down. Value of zero means they are not. Default value in the absence of 8108 * actual value to this setting is 0. 8109 */ 8110 public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN = 8111 "wifi_device_owner_configs_lockdown"; 8112 8113 /** 8114 * The operational wifi frequency band 8115 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, 8116 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or 8117 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} 8118 * 8119 * @hide 8120 */ 8121 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; 8122 8123 /** 8124 * The Wi-Fi peer-to-peer device name 8125 * @hide 8126 */ 8127 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; 8128 8129 /** 8130 * The min time between wifi disable and wifi enable 8131 * @hide 8132 */ 8133 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay"; 8134 8135 /** 8136 * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect 8137 * from an ephemeral network if there is no BSSID for that network with a non-null score that 8138 * has been seen in this time period. 8139 * 8140 * If this is less than or equal to zero, we use a more conservative behavior and only check 8141 * for a non-null score from the currently connected or target BSSID. 8142 * @hide 8143 */ 8144 public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS = 8145 "wifi_ephemeral_out_of_range_timeout_ms"; 8146 8147 /** 8148 * The number of milliseconds to delay when checking for data stalls during 8149 * non-aggressive detection. (screen is turned off.) 8150 * @hide 8151 */ 8152 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = 8153 "data_stall_alarm_non_aggressive_delay_in_ms"; 8154 8155 /** 8156 * The number of milliseconds to delay when checking for data stalls during 8157 * aggressive detection. (screen on or suspected data stall) 8158 * @hide 8159 */ 8160 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = 8161 "data_stall_alarm_aggressive_delay_in_ms"; 8162 8163 /** 8164 * The number of milliseconds to allow the provisioning apn to remain active 8165 * @hide 8166 */ 8167 public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS = 8168 "provisioning_apn_alarm_delay_in_ms"; 8169 8170 /** 8171 * The interval in milliseconds at which to check gprs registration 8172 * after the first registration mismatch of gprs and voice service, 8173 * to detect possible data network registration problems. 8174 * 8175 * @hide 8176 */ 8177 public static final String GPRS_REGISTER_CHECK_PERIOD_MS = 8178 "gprs_register_check_period_ms"; 8179 8180 /** 8181 * Nonzero causes Log.wtf() to crash. 8182 * @hide 8183 */ 8184 public static final String WTF_IS_FATAL = "wtf_is_fatal"; 8185 8186 /** 8187 * Ringer mode. This is used internally, changing this value will not 8188 * change the ringer mode. See AudioManager. 8189 */ 8190 public static final String MODE_RINGER = "mode_ringer"; 8191 8192 /** 8193 * Overlay display devices setting. 8194 * The associated value is a specially formatted string that describes the 8195 * size and density of simulated secondary display devices. 8196 * <p> 8197 * Format: {width}x{height}/{dpi};... 8198 * </p><p> 8199 * Example: 8200 * <ul> 8201 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li> 8202 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first 8203 * at 1080p and the second at 720p.</li> 8204 * <li>If the value is empty, then no overlay display devices are created.</li> 8205 * </ul></p> 8206 * 8207 * @hide 8208 */ 8209 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; 8210 8211 /** 8212 * Threshold values for the duration and level of a discharge cycle, 8213 * under which we log discharge cycle info. 8214 * 8215 * @hide 8216 */ 8217 public static final String 8218 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; 8219 8220 /** @hide */ 8221 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; 8222 8223 /** 8224 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR 8225 * intents on application crashes and ANRs. If this is disabled, the 8226 * crash/ANR dialog will never display the "Report" button. 8227 * <p> 8228 * Type: int (0 = disallow, 1 = allow) 8229 * 8230 * @hide 8231 */ 8232 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; 8233 8234 /** 8235 * Maximum age of entries kept by {@link DropBoxManager}. 8236 * 8237 * @hide 8238 */ 8239 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; 8240 8241 /** 8242 * Maximum number of entry files which {@link DropBoxManager} will keep 8243 * around. 8244 * 8245 * @hide 8246 */ 8247 public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; 8248 8249 /** 8250 * Maximum amount of disk space used by {@link DropBoxManager} no matter 8251 * what. 8252 * 8253 * @hide 8254 */ 8255 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; 8256 8257 /** 8258 * Percent of free disk (excluding reserve) which {@link DropBoxManager} 8259 * will use. 8260 * 8261 * @hide 8262 */ 8263 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; 8264 8265 /** 8266 * Percent of total disk which {@link DropBoxManager} will never dip 8267 * into. 8268 * 8269 * @hide 8270 */ 8271 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; 8272 8273 /** 8274 * Prefix for per-tag dropbox disable/enable settings. 8275 * 8276 * @hide 8277 */ 8278 public static final String DROPBOX_TAG_PREFIX = "dropbox:"; 8279 8280 /** 8281 * Lines of logcat to include with system crash/ANR/etc. reports, as a 8282 * prefix of the dropbox tag of the report type. For example, 8283 * "logcat_for_system_server_anr" controls the lines of logcat captured 8284 * with system server ANR reports. 0 to disable. 8285 * 8286 * @hide 8287 */ 8288 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; 8289 8290 /** 8291 * The interval in minutes after which the amount of free storage left 8292 * on the device is logged to the event log 8293 * 8294 * @hide 8295 */ 8296 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; 8297 8298 /** 8299 * Threshold for the amount of change in disk free space required to 8300 * report the amount of free space. Used to prevent spamming the logs 8301 * when the disk free space isn't changing frequently. 8302 * 8303 * @hide 8304 */ 8305 public static final String 8306 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; 8307 8308 /** 8309 * Minimum percentage of free storage on the device that is used to 8310 * determine if the device is running low on storage. The default is 10. 8311 * <p> 8312 * Say this value is set to 10, the device is considered running low on 8313 * storage if 90% or more of the device storage is filled up. 8314 * 8315 * @hide 8316 */ 8317 public static final String 8318 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; 8319 8320 /** 8321 * Maximum byte size of the low storage threshold. This is to ensure 8322 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an 8323 * overly large threshold for large storage devices. Currently this must 8324 * be less than 2GB. This default is 500MB. 8325 * 8326 * @hide 8327 */ 8328 public static final String 8329 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; 8330 8331 /** 8332 * Minimum bytes of free storage on the device before the data partition 8333 * is considered full. By default, 1 MB is reserved to avoid system-wide 8334 * SQLite disk full exceptions. 8335 * 8336 * @hide 8337 */ 8338 public static final String 8339 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; 8340 8341 /** 8342 * The maximum reconnect delay for short network outages or when the 8343 * network is suspended due to phone use. 8344 * 8345 * @hide 8346 */ 8347 public static final String 8348 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; 8349 8350 /** 8351 * The number of milliseconds to delay before sending out 8352 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored. 8353 * 8354 * @hide 8355 */ 8356 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; 8357 8358 8359 /** 8360 * Network sampling interval, in seconds. We'll generate link information 8361 * about bytes/packets sent and error rates based on data sampled in this interval 8362 * 8363 * @hide 8364 */ 8365 8366 public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS = 8367 "connectivity_sampling_interval_in_seconds"; 8368 8369 /** 8370 * The series of successively longer delays used in retrying to download PAC file. 8371 * Last delay is used between successful PAC downloads. 8372 * 8373 * @hide 8374 */ 8375 public static final String PAC_CHANGE_DELAY = "pac_change_delay"; 8376 8377 /** 8378 * Don't attempt to detect captive portals. 8379 * 8380 * @hide 8381 */ 8382 public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0; 8383 8384 /** 8385 * When detecting a captive portal, display a notification that 8386 * prompts the user to sign in. 8387 * 8388 * @hide 8389 */ 8390 public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1; 8391 8392 /** 8393 * When detecting a captive portal, immediately disconnect from the 8394 * network and do not reconnect to that network in the future. 8395 * 8396 * @hide 8397 */ 8398 public static final int CAPTIVE_PORTAL_MODE_AVOID = 2; 8399 8400 /** 8401 * What to do when connecting a network that presents a captive portal. 8402 * Must be one of the CAPTIVE_PORTAL_MODE_* constants above. 8403 * 8404 * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT. 8405 * @hide 8406 */ 8407 public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode"; 8408 8409 /** 8410 * Setting to turn off captive portal detection. Feature is enabled by 8411 * default and the setting needs to be set to 0 to disable it. 8412 * 8413 * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection 8414 * @hide 8415 */ 8416 @Deprecated 8417 public static final String 8418 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; 8419 8420 /** 8421 * The server used for captive portal detection upon a new conection. A 8422 * 204 response code from the server is used for validation. 8423 * TODO: remove this deprecated symbol. 8424 * 8425 * @hide 8426 */ 8427 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; 8428 8429 /** 8430 * The URL used for HTTPS captive portal detection upon a new connection. 8431 * A 204 response code from the server is used for validation. 8432 * 8433 * @hide 8434 */ 8435 public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url"; 8436 8437 /** 8438 * The URL used for HTTP captive portal detection upon a new connection. 8439 * A 204 response code from the server is used for validation. 8440 * 8441 * @hide 8442 */ 8443 public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url"; 8444 8445 /** 8446 * The URL used for fallback HTTP captive portal detection when previous HTTP 8447 * and HTTPS captive portal detection attemps did not return a conclusive answer. 8448 * 8449 * @hide 8450 */ 8451 public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url"; 8452 8453 /** 8454 * Whether to use HTTPS for network validation. This is enabled by default and the setting 8455 * needs to be set to 0 to disable it. This setting is a misnomer because captive portals 8456 * don't actually use HTTPS, but it's consistent with the other settings. 8457 * 8458 * @hide 8459 */ 8460 public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https"; 8461 8462 /** 8463 * Which User-Agent string to use in the header of the captive portal detection probes. 8464 * The User-Agent field is unset when this setting has no value (HttpUrlConnection default). 8465 * 8466 * @hide 8467 */ 8468 public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent"; 8469 8470 /** 8471 * Whether network service discovery is enabled. 8472 * 8473 * @hide 8474 */ 8475 public static final String NSD_ON = "nsd_on"; 8476 8477 /** 8478 * Let user pick default install location. 8479 * 8480 * @hide 8481 */ 8482 public static final String SET_INSTALL_LOCATION = "set_install_location"; 8483 8484 /** 8485 * Default install location value. 8486 * 0 = auto, let system decide 8487 * 1 = internal 8488 * 2 = sdcard 8489 * @hide 8490 */ 8491 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; 8492 8493 /** 8494 * ms during which to consume extra events related to Inet connection 8495 * condition after a transtion to fully-connected 8496 * 8497 * @hide 8498 */ 8499 public static final String 8500 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; 8501 8502 /** 8503 * ms during which to consume extra events related to Inet connection 8504 * condtion after a transtion to partly-connected 8505 * 8506 * @hide 8507 */ 8508 public static final String 8509 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; 8510 8511 /** {@hide} */ 8512 public static final String 8513 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; 8514 8515 /** 8516 * Host name and port for global http proxy. Uses ':' seperator for 8517 * between host and port. 8518 */ 8519 public static final String HTTP_PROXY = "http_proxy"; 8520 8521 /** 8522 * Host name for global http proxy. Set via ConnectivityManager. 8523 * 8524 * @hide 8525 */ 8526 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; 8527 8528 /** 8529 * Integer host port for global http proxy. Set via ConnectivityManager. 8530 * 8531 * @hide 8532 */ 8533 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; 8534 8535 /** 8536 * Exclusion list for global proxy. This string contains a list of 8537 * comma-separated domains where the global proxy does not apply. 8538 * Domains should be listed in a comma- separated list. Example of 8539 * acceptable formats: ".domain1.com,my.domain2.com" Use 8540 * ConnectivityManager to set/get. 8541 * 8542 * @hide 8543 */ 8544 public static final String 8545 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; 8546 8547 /** 8548 * The location PAC File for the proxy. 8549 * @hide 8550 */ 8551 public static final String 8552 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url"; 8553 8554 /** 8555 * Enables the UI setting to allow the user to specify the global HTTP 8556 * proxy and associated exclusion list. 8557 * 8558 * @hide 8559 */ 8560 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; 8561 8562 /** 8563 * Setting for default DNS in case nobody suggests one 8564 * 8565 * @hide 8566 */ 8567 public static final String DEFAULT_DNS_SERVER = "default_dns_server"; 8568 8569 /** {@hide} */ 8570 public static final String 8571 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; 8572 /** {@hide} */ 8573 public static final String 8574 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; 8575 /** {@hide} */ 8576 public static final String 8577 BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_"; 8578 /** {@hide} */ 8579 public static final String 8580 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; 8581 /** {@hide} */ 8582 public static final String 8583 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_"; 8584 /** {@hide} */ 8585 public static final String 8586 BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_"; 8587 /** {@hide} */ 8588 public static final String 8589 BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_"; 8590 /** {@hide} */ 8591 public static final String 8592 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_"; 8593 /** {@hide} */ 8594 public static final String 8595 BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_"; 8596 8597 /** 8598 * Device Idle (Doze) specific settings. 8599 * This is encoded as a key=value list, separated by commas. Ex: 8600 * 8601 * "inactive_to=60000,sensing_to=400000" 8602 * 8603 * The following keys are supported: 8604 * 8605 * <pre> 8606 * inactive_to (long) 8607 * sensing_to (long) 8608 * motion_inactive_to (long) 8609 * idle_after_inactive_to (long) 8610 * idle_pending_to (long) 8611 * max_idle_pending_to (long) 8612 * idle_pending_factor (float) 8613 * idle_to (long) 8614 * max_idle_to (long) 8615 * idle_factor (float) 8616 * min_time_to_alarm (long) 8617 * max_temp_app_whitelist_duration (long) 8618 * notification_whitelist_duration (long) 8619 * </pre> 8620 * 8621 * <p> 8622 * Type: string 8623 * @hide 8624 * @see com.android.server.DeviceIdleController.Constants 8625 */ 8626 public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants"; 8627 8628 /** 8629 * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS} 8630 * 8631 * <p> 8632 * Type: string 8633 * @hide 8634 * @see com.android.server.DeviceIdleController.Constants 8635 */ 8636 public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch"; 8637 8638 /** 8639 * App standby (app idle) specific settings. 8640 * This is encoded as a key=value list, separated by commas. Ex: 8641 * 8642 * "idle_duration=5000,parole_interval=4500" 8643 * 8644 * The following keys are supported: 8645 * 8646 * <pre> 8647 * idle_duration2 (long) 8648 * wallclock_threshold (long) 8649 * parole_interval (long) 8650 * parole_duration (long) 8651 * 8652 * idle_duration (long) // This is deprecated and used to circumvent b/26355386. 8653 * </pre> 8654 * 8655 * <p> 8656 * Type: string 8657 * @hide 8658 * @see com.android.server.usage.UsageStatsService.SettingsObserver 8659 */ 8660 public static final String APP_IDLE_CONSTANTS = "app_idle_constants"; 8661 8662 /** 8663 * Alarm manager specific settings. 8664 * This is encoded as a key=value list, separated by commas. Ex: 8665 * 8666 * "min_futurity=5000,allow_while_idle_short_time=4500" 8667 * 8668 * The following keys are supported: 8669 * 8670 * <pre> 8671 * min_futurity (long) 8672 * min_interval (long) 8673 * allow_while_idle_short_time (long) 8674 * allow_while_idle_long_time (long) 8675 * allow_while_idle_whitelist_duration (long) 8676 * </pre> 8677 * 8678 * <p> 8679 * Type: string 8680 * @hide 8681 * @see com.android.server.AlarmManagerService.Constants 8682 */ 8683 public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants"; 8684 8685 /** 8686 * Job scheduler specific settings. 8687 * This is encoded as a key=value list, separated by commas. Ex: 8688 * 8689 * "min_ready_jobs_count=2,moderate_use_factor=.5" 8690 * 8691 * The following keys are supported: 8692 * 8693 * <pre> 8694 * min_idle_count (int) 8695 * min_charging_count (int) 8696 * min_connectivity_count (int) 8697 * min_content_count (int) 8698 * min_ready_jobs_count (int) 8699 * heavy_use_factor (float) 8700 * moderate_use_factor (float) 8701 * fg_job_count (int) 8702 * bg_normal_job_count (int) 8703 * bg_moderate_job_count (int) 8704 * bg_low_job_count (int) 8705 * bg_critical_job_count (int) 8706 * </pre> 8707 * 8708 * <p> 8709 * Type: string 8710 * @hide 8711 * @see com.android.server.job.JobSchedulerService.Constants 8712 */ 8713 public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants"; 8714 8715 /** 8716 * ShortcutManager specific settings. 8717 * This is encoded as a key=value list, separated by commas. Ex: 8718 * 8719 * "reset_interval_sec=86400,max_updates_per_interval=1" 8720 * 8721 * The following keys are supported: 8722 * 8723 * <pre> 8724 * reset_interval_sec (long) 8725 * max_updates_per_interval (int) 8726 * max_icon_dimension_dp (int, DP) 8727 * max_icon_dimension_dp_lowram (int, DP) 8728 * max_shortcuts (int) 8729 * icon_quality (int, 0-100) 8730 * icon_format (String) 8731 * </pre> 8732 * 8733 * <p> 8734 * Type: string 8735 * @hide 8736 * @see com.android.server.pm.ShortcutService.ConfigConstants 8737 */ 8738 public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants"; 8739 8740 /** 8741 * Get the key that retrieves a bluetooth headset's priority. 8742 * @hide 8743 */ 8744 public static final String getBluetoothHeadsetPriorityKey(String address) { 8745 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8746 } 8747 8748 /** 8749 * Get the key that retrieves a bluetooth a2dp sink's priority. 8750 * @hide 8751 */ 8752 public static final String getBluetoothA2dpSinkPriorityKey(String address) { 8753 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8754 } 8755 8756 /** 8757 * Get the key that retrieves a bluetooth a2dp src's priority. 8758 * @hide 8759 */ 8760 public static final String getBluetoothA2dpSrcPriorityKey(String address) { 8761 return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8762 } 8763 8764 /** 8765 * Get the key that retrieves a bluetooth Input Device's priority. 8766 * @hide 8767 */ 8768 public static final String getBluetoothInputDevicePriorityKey(String address) { 8769 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8770 } 8771 8772 /** 8773 * Get the key that retrieves a bluetooth pan client priority. 8774 * @hide 8775 */ 8776 public static final String getBluetoothPanPriorityKey(String address) { 8777 return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8778 } 8779 8780 /** 8781 * Get the key that retrieves a bluetooth map priority. 8782 * @hide 8783 */ 8784 public static final String getBluetoothMapPriorityKey(String address) { 8785 return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8786 } 8787 8788 /** 8789 * Get the key that retrieves a bluetooth map client priority. 8790 * @hide 8791 */ 8792 public static final String getBluetoothMapClientPriorityKey(String address) { 8793 return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8794 } 8795 8796 /** 8797 * Get the key that retrieves a bluetooth pbap client priority. 8798 * @hide 8799 */ 8800 public static final String getBluetoothPbapClientPriorityKey(String address) { 8801 return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8802 } 8803 8804 /** 8805 * Get the key that retrieves a bluetooth sap priority. 8806 * @hide 8807 */ 8808 public static final String getBluetoothSapPriorityKey(String address) { 8809 return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 8810 } 8811 8812 /** 8813 * Scaling factor for normal window animations. Setting to 0 will 8814 * disable window animations. 8815 */ 8816 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; 8817 8818 /** 8819 * Scaling factor for activity transition animations. Setting to 0 will 8820 * disable window animations. 8821 */ 8822 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; 8823 8824 /** 8825 * Scaling factor for Animator-based animations. This affects both the 8826 * start delay and duration of all such animations. Setting to 0 will 8827 * cause animations to end immediately. The default value is 1. 8828 */ 8829 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; 8830 8831 /** 8832 * Scaling factor for normal window animations. Setting to 0 will 8833 * disable window animations. 8834 * 8835 * @hide 8836 */ 8837 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; 8838 8839 /** 8840 * If 0, the compatibility mode is off for all applications. 8841 * If 1, older applications run under compatibility mode. 8842 * TODO: remove this settings before code freeze (bug/1907571) 8843 * @hide 8844 */ 8845 public static final String COMPATIBILITY_MODE = "compatibility_mode"; 8846 8847 /** 8848 * CDMA only settings 8849 * Emergency Tone 0 = Off 8850 * 1 = Alert 8851 * 2 = Vibrate 8852 * @hide 8853 */ 8854 public static final String EMERGENCY_TONE = "emergency_tone"; 8855 8856 /** 8857 * CDMA only settings 8858 * Whether the auto retry is enabled. The value is 8859 * boolean (1 or 0). 8860 * @hide 8861 */ 8862 public static final String CALL_AUTO_RETRY = "call_auto_retry"; 8863 8864 /** 8865 * A setting that can be read whether the emergency affordance is currently needed. 8866 * The value is a boolean (1 or 0). 8867 * @hide 8868 */ 8869 public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed"; 8870 8871 /** 8872 * See RIL_PreferredNetworkType in ril.h 8873 * @hide 8874 */ 8875 public static final String PREFERRED_NETWORK_MODE = 8876 "preferred_network_mode"; 8877 8878 /** 8879 * Name of an application package to be debugged. 8880 */ 8881 public static final String DEBUG_APP = "debug_app"; 8882 8883 /** 8884 * If 1, when launching DEBUG_APP it will wait for the debugger before 8885 * starting user code. If 0, it will run normally. 8886 */ 8887 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; 8888 8889 /** 8890 * Control whether the process CPU usage meter should be shown. 8891 * 8892 * @deprecated This functionality is no longer available as of 8893 * {@link android.os.Build.VERSION_CODES#N_MR1}. 8894 */ 8895 @Deprecated 8896 public static final String SHOW_PROCESSES = "show_processes"; 8897 8898 /** 8899 * If 1 low power mode is enabled. 8900 * @hide 8901 */ 8902 public static final String LOW_POWER_MODE = "low_power"; 8903 8904 /** 8905 * Battery level [1-99] at which low power mode automatically turns on. 8906 * If 0, it will not automatically turn on. 8907 * @hide 8908 */ 8909 public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level"; 8910 8911 /** 8912 * If not 0, the activity manager will aggressively finish activities and 8913 * processes as soon as they are no longer needed. If 0, the normal 8914 * extended lifetime is used. 8915 */ 8916 public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; 8917 8918 /** 8919 * Use Dock audio output for media: 8920 * 0 = disabled 8921 * 1 = enabled 8922 * @hide 8923 */ 8924 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; 8925 8926 /** 8927 * The surround sound formats AC3, DTS or IEC61937 are 8928 * available for use if they are detected. 8929 * This is the default mode. 8930 * 8931 * Note that AUTO is equivalent to ALWAYS for Android TVs and other 8932 * devices that have an S/PDIF output. This is because S/PDIF 8933 * is unidirectional and the TV cannot know if a decoder is 8934 * connected. So it assumes they are always available. 8935 * @hide 8936 */ 8937 public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0; 8938 8939 /** 8940 * AC3, DTS or IEC61937 are NEVER available, even if they 8941 * are detected by the hardware. Those formats will not be 8942 * reported. 8943 * 8944 * An example use case would be an AVR reports that it is capable of 8945 * surround sound decoding but is broken. If NEVER is chosen 8946 * then apps must use PCM output instead of encoded output. 8947 * @hide 8948 */ 8949 public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1; 8950 8951 /** 8952 * AC3, DTS or IEC61937 are ALWAYS available, even if they 8953 * are not detected by the hardware. Those formats will be 8954 * reported as part of the HDMI output capability. Applications 8955 * are then free to use either PCM or encoded output. 8956 * 8957 * An example use case would be a when TV was connected over 8958 * TOS-link to an AVR. But the TV could not see it because TOS-link 8959 * is unidirectional. 8960 * @hide 8961 */ 8962 public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2; 8963 8964 /** 8965 * Set to ENCODED_SURROUND_OUTPUT_AUTO, 8966 * ENCODED_SURROUND_OUTPUT_NEVER or 8967 * ENCODED_SURROUND_OUTPUT_ALWAYS 8968 * @hide 8969 */ 8970 public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output"; 8971 8972 /** 8973 * Persisted safe headphone volume management state by AudioService 8974 * @hide 8975 */ 8976 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; 8977 8978 /** 8979 * URL for tzinfo (time zone) updates 8980 * @hide 8981 */ 8982 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url"; 8983 8984 /** 8985 * URL for tzinfo (time zone) update metadata 8986 * @hide 8987 */ 8988 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url"; 8989 8990 /** 8991 * URL for selinux (mandatory access control) updates 8992 * @hide 8993 */ 8994 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url"; 8995 8996 /** 8997 * URL for selinux (mandatory access control) update metadata 8998 * @hide 8999 */ 9000 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url"; 9001 9002 /** 9003 * URL for sms short code updates 9004 * @hide 9005 */ 9006 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL = 9007 "sms_short_codes_content_url"; 9008 9009 /** 9010 * URL for sms short code update metadata 9011 * @hide 9012 */ 9013 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL = 9014 "sms_short_codes_metadata_url"; 9015 9016 /** 9017 * URL for apn_db updates 9018 * @hide 9019 */ 9020 public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url"; 9021 9022 /** 9023 * URL for apn_db update metadata 9024 * @hide 9025 */ 9026 public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url"; 9027 9028 /** 9029 * URL for cert pinlist updates 9030 * @hide 9031 */ 9032 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url"; 9033 9034 /** 9035 * URL for cert pinlist updates 9036 * @hide 9037 */ 9038 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url"; 9039 9040 /** 9041 * URL for intent firewall updates 9042 * @hide 9043 */ 9044 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL = 9045 "intent_firewall_content_url"; 9046 9047 /** 9048 * URL for intent firewall update metadata 9049 * @hide 9050 */ 9051 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL = 9052 "intent_firewall_metadata_url"; 9053 9054 /** 9055 * SELinux enforcement status. If 0, permissive; if 1, enforcing. 9056 * @hide 9057 */ 9058 public static final String SELINUX_STATUS = "selinux_status"; 9059 9060 /** 9061 * Developer setting to force RTL layout. 9062 * @hide 9063 */ 9064 public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl"; 9065 9066 /** 9067 * Milliseconds after screen-off after which low battery sounds will be silenced. 9068 * 9069 * If zero, battery sounds will always play. 9070 * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider. 9071 * 9072 * @hide 9073 */ 9074 public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout"; 9075 9076 /** 9077 * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after 9078 * the caller is done with this, they should call {@link ContentResolver#delete} to 9079 * clean up any value that they may have written. 9080 * 9081 * @hide 9082 */ 9083 public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms"; 9084 9085 /** 9086 * Defines global runtime overrides to window policy. 9087 * 9088 * See {@link com.android.server.policy.PolicyControl} for value format. 9089 * 9090 * @hide 9091 */ 9092 public static final String POLICY_CONTROL = "policy_control"; 9093 9094 /** 9095 * Defines global zen mode. ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS, 9096 * or ZEN_MODE_NO_INTERRUPTIONS. 9097 * 9098 * @hide 9099 */ 9100 public static final String ZEN_MODE = "zen_mode"; 9101 9102 /** @hide */ public static final int ZEN_MODE_OFF = 0; 9103 /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1; 9104 /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2; 9105 /** @hide */ public static final int ZEN_MODE_ALARMS = 3; 9106 9107 /** @hide */ public static String zenModeToString(int mode) { 9108 if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS"; 9109 if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS"; 9110 if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS"; 9111 return "ZEN_MODE_OFF"; 9112 } 9113 9114 /** @hide */ public static boolean isValidZenMode(int value) { 9115 switch (value) { 9116 case Global.ZEN_MODE_OFF: 9117 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: 9118 case Global.ZEN_MODE_ALARMS: 9119 case Global.ZEN_MODE_NO_INTERRUPTIONS: 9120 return true; 9121 default: 9122 return false; 9123 } 9124 } 9125 9126 /** 9127 * Value of the ringer before entering zen mode. 9128 * 9129 * @hide 9130 */ 9131 public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level"; 9132 9133 /** 9134 * Opaque value, changes when persisted zen mode configuration changes. 9135 * 9136 * @hide 9137 */ 9138 public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; 9139 9140 /** 9141 * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. 9142 * 9143 * @hide 9144 */ 9145 public static final String HEADS_UP_NOTIFICATIONS_ENABLED = 9146 "heads_up_notifications_enabled"; 9147 9148 /** @hide */ public static final int HEADS_UP_OFF = 0; 9149 /** @hide */ public static final int HEADS_UP_ON = 1; 9150 9151 /** 9152 * The name of the device 9153 */ 9154 public static final String DEVICE_NAME = "device_name"; 9155 9156 /** 9157 * Whether the NetworkScoringService has been first initialized. 9158 * <p> 9159 * Type: int (0 for false, 1 for true) 9160 * @hide 9161 */ 9162 public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned"; 9163 9164 /** 9165 * Whether the user wants to be prompted for password to decrypt the device on boot. 9166 * This only matters if the storage is encrypted. 9167 * <p> 9168 * Type: int (0 for false, 1 for true) 9169 * @hide 9170 */ 9171 public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt"; 9172 9173 /** 9174 * Whether the Volte is enabled 9175 * <p> 9176 * Type: int (0 for false, 1 for true) 9177 * @hide 9178 */ 9179 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; 9180 9181 /** 9182 * Whether VT (Video Telephony over IMS) is enabled 9183 * <p> 9184 * Type: int (0 for false, 1 for true) 9185 * 9186 * @hide 9187 */ 9188 public static final String VT_IMS_ENABLED = "vt_ims_enabled"; 9189 9190 /** 9191 * Whether WFC is enabled 9192 * <p> 9193 * Type: int (0 for false, 1 for true) 9194 * 9195 * @hide 9196 */ 9197 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled"; 9198 9199 /** 9200 * WFC mode on home/non-roaming network. 9201 * <p> 9202 * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only 9203 * 9204 * @hide 9205 */ 9206 public static final String WFC_IMS_MODE = "wfc_ims_mode"; 9207 9208 /** 9209 * WFC mode on roaming network. 9210 * <p> 9211 * Type: int - see {@link WFC_IMS_MODE} for values 9212 * 9213 * @hide 9214 */ 9215 public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode"; 9216 9217 /** 9218 * Whether WFC roaming is enabled 9219 * <p> 9220 * Type: int (0 for false, 1 for true) 9221 * 9222 * @hide 9223 */ 9224 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled"; 9225 9226 /** 9227 * Whether user can enable/disable LTE as a preferred network. A carrier might control 9228 * this via gservices, OMA-DM, carrier app, etc. 9229 * <p> 9230 * Type: int (0 for false, 1 for true) 9231 * @hide 9232 */ 9233 public static final String LTE_SERVICE_FORCED = "lte_service_forced"; 9234 9235 /** 9236 * Ephemeral app cookie max size in bytes. 9237 * <p> 9238 * Type: int 9239 * @hide 9240 */ 9241 public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES = 9242 "ephemeral_cookie_max_size_bytes"; 9243 9244 /** 9245 * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is 9246 * enabled. Set to zero to disable. 9247 * <p> 9248 * Type: int (0 for false, 1 for true) 9249 * 9250 * @hide 9251 */ 9252 public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature"; 9253 9254 /** 9255 * The duration for caching uninstalled ephemeral apps. 9256 * <p> 9257 * Type: long 9258 * @hide 9259 */ 9260 public static final String UNINSTALLED_EPHEMERAL_APP_CACHE_DURATION_MILLIS = 9261 "uninstalled_ephemeral_app_cache_duration_millis"; 9262 9263 /** 9264 * Allows switching users when system user is locked. 9265 * <p> 9266 * Type: int 9267 * @hide 9268 */ 9269 public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED = 9270 "allow_user_switching_when_system_user_locked"; 9271 9272 /** 9273 * Boot count since the device starts running APK level 24. 9274 * <p> 9275 * Type: int 9276 */ 9277 public static final String BOOT_COUNT = "boot_count"; 9278 9279 /** 9280 * Whether the safe boot is disallowed. 9281 * 9282 * <p>This setting should have the identical value as the corresponding user restriction. 9283 * The purpose of the setting is to make the restriction available in early boot stages 9284 * before the user restrictions are loaded. 9285 * @hide 9286 */ 9287 public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed"; 9288 9289 /** 9290 * Whether this device is currently in retail demo mode. If true, device 9291 * usage is severely limited. 9292 * <p> 9293 * Type: int (0 for false, 1 for true) 9294 * @hide 9295 */ 9296 public static final String DEVICE_DEMO_MODE = "device_demo_mode"; 9297 9298 /** 9299 * Retail mode specific settings. This is encoded as a key=value list, separated by commas. 9300 * Ex: "user_inactivity_timeout_ms=30000,warning_dialog_timeout_ms=10000". The following 9301 * keys are supported: 9302 * 9303 * <pre> 9304 * user_inactivity_timeout_ms (long) 9305 * warning_dialog_timeout_ms (long) 9306 * </pre> 9307 * <p> 9308 * Type: string 9309 * 9310 * @hide 9311 */ 9312 public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants"; 9313 9314 /** 9315 * The reason for the settings database being downgraded. This is only for 9316 * troubleshooting purposes and its value should not be interpreted in any way. 9317 * 9318 * Type: string 9319 * 9320 * @hide 9321 */ 9322 public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason"; 9323 9324 /** 9325 * Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by 9326 * default. Set to 0 to disable. 9327 * 9328 * @hide 9329 */ 9330 public static final String CONTACTS_DATABASE_WAL_ENABLED = "contacts_database_wal_enabled"; 9331 9332 /** 9333 * Settings to backup. This is here so that it's in the same place as the settings 9334 * keys and easy to update. 9335 * 9336 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System 9337 * and Secure as well. This is because those tables drive both backup and 9338 * restore, and restore needs to properly whitelist keys that used to live 9339 * in those namespaces. The keys will only actually be backed up / restored 9340 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). 9341 * 9342 * NOTE: Settings are backed up and restored in the order they appear 9343 * in this array. If you have one setting depending on another, 9344 * make sure that they are ordered appropriately. 9345 * 9346 * @hide 9347 */ 9348 public static final String[] SETTINGS_TO_BACKUP = { 9349 BUGREPORT_IN_POWER_MENU, 9350 STAY_ON_WHILE_PLUGGED_IN, 9351 AUTO_TIME, 9352 AUTO_TIME_ZONE, 9353 POWER_SOUNDS_ENABLED, 9354 DOCK_SOUNDS_ENABLED, 9355 CHARGING_SOUNDS_ENABLED, 9356 USB_MASS_STORAGE_ENABLED, 9357 ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 9358 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 9359 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 9360 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 9361 WIFI_NUM_OPEN_NETWORKS_KEPT, 9362 EMERGENCY_TONE, 9363 CALL_AUTO_RETRY, 9364 DOCK_AUDIO_MEDIA_ENABLED, 9365 ENCODED_SURROUND_OUTPUT, 9366 LOW_POWER_MODE_TRIGGER_LEVEL 9367 }; 9368 9369 private static final ContentProviderHolder sProviderHolder = 9370 new ContentProviderHolder(CONTENT_URI); 9371 9372 // Populated lazily, guarded by class object: 9373 private static final NameValueCache sNameValueCache = new NameValueCache( 9374 CONTENT_URI, 9375 CALL_METHOD_GET_GLOBAL, 9376 CALL_METHOD_PUT_GLOBAL, 9377 sProviderHolder); 9378 9379 // Certain settings have been moved from global to the per-user secure namespace 9380 private static final HashSet<String> MOVED_TO_SECURE; 9381 static { 9382 MOVED_TO_SECURE = new HashSet<>(1); 9383 MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); 9384 } 9385 9386 /** @hide */ 9387 public static void getMovedToSecureSettings(Set<String> outKeySet) { 9388 outKeySet.addAll(MOVED_TO_SECURE); 9389 } 9390 9391 /** 9392 * Look up a name in the database. 9393 * @param resolver to access the database with 9394 * @param name to look up in the table 9395 * @return the corresponding value, or null if not present 9396 */ 9397 public static String getString(ContentResolver resolver, String name) { 9398 return getStringForUser(resolver, name, UserHandle.myUserId()); 9399 } 9400 9401 /** @hide */ 9402 public static String getStringForUser(ContentResolver resolver, String name, 9403 int userHandle) { 9404 if (MOVED_TO_SECURE.contains(name)) { 9405 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 9406 + " to android.provider.Settings.Secure, returning read-only value."); 9407 return Secure.getStringForUser(resolver, name, userHandle); 9408 } 9409 return sNameValueCache.getStringForUser(resolver, name, userHandle); 9410 } 9411 9412 /** 9413 * Store a name/value pair into the database. 9414 * @param resolver to access the database with 9415 * @param name to store 9416 * @param value to associate with the name 9417 * @return true if the value was set, false on database errors 9418 */ 9419 public static boolean putString(ContentResolver resolver, 9420 String name, String value) { 9421 return putStringForUser(resolver, name, value, null, false, UserHandle.myUserId()); 9422 } 9423 9424 /** 9425 * Store a name/value pair into the database. 9426 * <p> 9427 * The method takes an optional tag to associate with the setting 9428 * which can be used to clear only settings made by your package and 9429 * associated with this tag by passing the tag to {@link 9430 * #resetToDefaults(ContentResolver, String)}. Anyone can override 9431 * the current tag. Also if another package changes the setting 9432 * then the tag will be set to the one specified in the set call 9433 * which can be null. Also any of the settings setters that do not 9434 * take a tag as an argument effectively clears the tag. 9435 * </p><p> 9436 * For example, if you set settings A and B with tags T1 and T2 and 9437 * another app changes setting A (potentially to the same value), it 9438 * can assign to it a tag T3 (note that now the package that changed 9439 * the setting is not yours). Now if you reset your changes for T1 and 9440 * T2 only setting B will be reset and A not (as it was changed by 9441 * another package) but since A did not change you are in the desired 9442 * initial state. Now if the other app changes the value of A (assuming 9443 * you registered an observer in the beginning) you would detect that 9444 * the setting was changed by another app and handle this appropriately 9445 * (ignore, set back to some value, etc). 9446 * </p><p> 9447 * Also the method takes an argument whether to make the value the 9448 * default for this setting. If the system already specified a default 9449 * value, then the one passed in here will <strong>not</strong> 9450 * be set as the default. 9451 * </p> 9452 * 9453 * @param resolver to access the database with. 9454 * @param name to store. 9455 * @param value to associate with the name. 9456 * @param tag to associated with the setting. 9457 * @param makeDefault whether to make the value the default one. 9458 * @return true if the value was set, false on database errors. 9459 * 9460 * @see #resetToDefaults(ContentResolver, String) 9461 * 9462 * @hide 9463 */ 9464 @SystemApi 9465 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 9466 public static boolean putString(@NonNull ContentResolver resolver, 9467 @NonNull String name, @Nullable String value, @Nullable String tag, 9468 boolean makeDefault) { 9469 return putStringForUser(resolver, name, value, tag, makeDefault, 9470 UserHandle.myUserId()); 9471 } 9472 9473 /** 9474 * Reset the settings to their defaults. This would reset <strong>only</strong> 9475 * settings set by the caller's package. Think of it of a way to undo your own 9476 * changes to the secure settings. Passing in the optional tag will reset only 9477 * settings changed by your package and associated with this tag. 9478 * 9479 * @param resolver Handle to the content resolver. 9480 * @param tag Optional tag which should be associated with the settings to reset. 9481 * 9482 * @see #putString(ContentResolver, String, String, String, boolean) 9483 * 9484 * @hide 9485 */ 9486 @SystemApi 9487 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 9488 public static void resetToDefaults(@NonNull ContentResolver resolver, 9489 @Nullable String tag) { 9490 resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS, 9491 UserHandle.myUserId()); 9492 } 9493 9494 /** 9495 * Reset the settings to their defaults for a given user with a specific mode. The 9496 * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS} 9497 * allowing resetting the settings made by a package and associated with the tag. 9498 * 9499 * @param resolver Handle to the content resolver. 9500 * @param tag Optional tag which should be associated with the settings to reset. 9501 * @param mode The reset mode. 9502 * @param userHandle The user for which to reset to defaults. 9503 * 9504 * @see #RESET_MODE_PACKAGE_DEFAULTS 9505 * @see #RESET_MODE_UNTRUSTED_DEFAULTS 9506 * @see #RESET_MODE_UNTRUSTED_CHANGES 9507 * @see #RESET_MODE_TRUSTED_DEFAULTS 9508 * 9509 * @hide 9510 */ 9511 public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver, 9512 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) { 9513 try { 9514 Bundle arg = new Bundle(); 9515 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 9516 if (tag != null) { 9517 arg.putString(CALL_METHOD_TAG_KEY, tag); 9518 } 9519 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode); 9520 IContentProvider cp = sProviderHolder.getProvider(resolver); 9521 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_GLOBAL, null, arg); 9522 } catch (RemoteException e) { 9523 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e); 9524 } 9525 } 9526 9527 /** @hide */ 9528 public static boolean putStringForUser(ContentResolver resolver, 9529 String name, String value, int userHandle) { 9530 return putStringForUser(resolver, name, value, null, false, userHandle); 9531 } 9532 9533 /** @hide */ 9534 public static boolean putStringForUser(@NonNull ContentResolver resolver, 9535 @NonNull String name, @Nullable String value, @Nullable String tag, 9536 boolean makeDefault, @UserIdInt int userHandle) { 9537 if (LOCAL_LOGV) { 9538 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value 9539 + " for " + userHandle); 9540 } 9541 // Global and Secure have the same access policy so we can forward writes 9542 if (MOVED_TO_SECURE.contains(name)) { 9543 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 9544 + " to android.provider.Settings.Secure, value is unchanged."); 9545 return Secure.putStringForUser(resolver, name, value, tag, 9546 makeDefault, userHandle); 9547 } 9548 return sNameValueCache.putStringForUser(resolver, name, value, tag, 9549 makeDefault, userHandle); 9550 } 9551 9552 /** 9553 * Construct the content URI for a particular name/value pair, 9554 * useful for monitoring changes with a ContentObserver. 9555 * @param name to look up in the table 9556 * @return the corresponding content URI, or null if not present 9557 */ 9558 public static Uri getUriFor(String name) { 9559 return getUriFor(CONTENT_URI, name); 9560 } 9561 9562 /** 9563 * Convenience function for retrieving a single secure settings value 9564 * as an integer. Note that internally setting values are always 9565 * stored as strings; this function converts the string to an integer 9566 * for you. The default value will be returned if the setting is 9567 * not defined or not an integer. 9568 * 9569 * @param cr The ContentResolver to access. 9570 * @param name The name of the setting to retrieve. 9571 * @param def Value to return if the setting is not defined. 9572 * 9573 * @return The setting's current value, or 'def' if it is not defined 9574 * or not a valid integer. 9575 */ 9576 public static int getInt(ContentResolver cr, String name, int def) { 9577 String v = getString(cr, name); 9578 try { 9579 return v != null ? Integer.parseInt(v) : def; 9580 } catch (NumberFormatException e) { 9581 return def; 9582 } 9583 } 9584 9585 /** 9586 * Convenience function for retrieving a single secure settings value 9587 * as an integer. Note that internally setting values are always 9588 * stored as strings; this function converts the string to an integer 9589 * for you. 9590 * <p> 9591 * This version does not take a default value. If the setting has not 9592 * been set, or the string value is not a number, 9593 * it throws {@link SettingNotFoundException}. 9594 * 9595 * @param cr The ContentResolver to access. 9596 * @param name The name of the setting to retrieve. 9597 * 9598 * @throws SettingNotFoundException Thrown if a setting by the given 9599 * name can't be found or the setting value is not an integer. 9600 * 9601 * @return The setting's current value. 9602 */ 9603 public static int getInt(ContentResolver cr, String name) 9604 throws SettingNotFoundException { 9605 String v = getString(cr, name); 9606 try { 9607 return Integer.parseInt(v); 9608 } catch (NumberFormatException e) { 9609 throw new SettingNotFoundException(name); 9610 } 9611 } 9612 9613 /** 9614 * Convenience function for updating a single settings value as an 9615 * integer. This will either create a new entry in the table if the 9616 * given name does not exist, or modify the value of the existing row 9617 * with that name. Note that internally setting values are always 9618 * stored as strings, so this function converts the given value to a 9619 * string before storing it. 9620 * 9621 * @param cr The ContentResolver to access. 9622 * @param name The name of the setting to modify. 9623 * @param value The new value for the setting. 9624 * @return true if the value was set, false on database errors 9625 */ 9626 public static boolean putInt(ContentResolver cr, String name, int value) { 9627 return putString(cr, name, Integer.toString(value)); 9628 } 9629 9630 /** 9631 * Convenience function for retrieving a single secure settings value 9632 * as a {@code long}. Note that internally setting values are always 9633 * stored as strings; this function converts the string to a {@code long} 9634 * for you. The default value will be returned if the setting is 9635 * not defined or not a {@code long}. 9636 * 9637 * @param cr The ContentResolver to access. 9638 * @param name The name of the setting to retrieve. 9639 * @param def Value to return if the setting is not defined. 9640 * 9641 * @return The setting's current value, or 'def' if it is not defined 9642 * or not a valid {@code long}. 9643 */ 9644 public static long getLong(ContentResolver cr, String name, long def) { 9645 String valString = getString(cr, name); 9646 long value; 9647 try { 9648 value = valString != null ? Long.parseLong(valString) : def; 9649 } catch (NumberFormatException e) { 9650 value = def; 9651 } 9652 return value; 9653 } 9654 9655 /** 9656 * Convenience function for retrieving a single secure settings value 9657 * as a {@code long}. Note that internally setting values are always 9658 * stored as strings; this function converts the string to a {@code long} 9659 * for you. 9660 * <p> 9661 * This version does not take a default value. If the setting has not 9662 * been set, or the string value is not a number, 9663 * it throws {@link SettingNotFoundException}. 9664 * 9665 * @param cr The ContentResolver to access. 9666 * @param name The name of the setting to retrieve. 9667 * 9668 * @return The setting's current value. 9669 * @throws SettingNotFoundException Thrown if a setting by the given 9670 * name can't be found or the setting value is not an integer. 9671 */ 9672 public static long getLong(ContentResolver cr, String name) 9673 throws SettingNotFoundException { 9674 String valString = getString(cr, name); 9675 try { 9676 return Long.parseLong(valString); 9677 } catch (NumberFormatException e) { 9678 throw new SettingNotFoundException(name); 9679 } 9680 } 9681 9682 /** 9683 * Convenience function for updating a secure settings value as a long 9684 * integer. This will either create a new entry in the table if the 9685 * given name does not exist, or modify the value of the existing row 9686 * with that name. Note that internally setting values are always 9687 * stored as strings, so this function converts the given value to a 9688 * string before storing it. 9689 * 9690 * @param cr The ContentResolver to access. 9691 * @param name The name of the setting to modify. 9692 * @param value The new value for the setting. 9693 * @return true if the value was set, false on database errors 9694 */ 9695 public static boolean putLong(ContentResolver cr, String name, long value) { 9696 return putString(cr, name, Long.toString(value)); 9697 } 9698 9699 /** 9700 * Convenience function for retrieving a single secure settings value 9701 * as a floating point number. Note that internally setting values are 9702 * always stored as strings; this function converts the string to an 9703 * float for you. The default value will be returned if the setting 9704 * is not defined or not a valid float. 9705 * 9706 * @param cr The ContentResolver to access. 9707 * @param name The name of the setting to retrieve. 9708 * @param def Value to return if the setting is not defined. 9709 * 9710 * @return The setting's current value, or 'def' if it is not defined 9711 * or not a valid float. 9712 */ 9713 public static float getFloat(ContentResolver cr, String name, float def) { 9714 String v = getString(cr, name); 9715 try { 9716 return v != null ? Float.parseFloat(v) : def; 9717 } catch (NumberFormatException e) { 9718 return def; 9719 } 9720 } 9721 9722 /** 9723 * Convenience function for retrieving a single secure settings value 9724 * as a float. Note that internally setting values are always 9725 * stored as strings; this function converts the string to a float 9726 * for you. 9727 * <p> 9728 * This version does not take a default value. If the setting has not 9729 * been set, or the string value is not a number, 9730 * it throws {@link SettingNotFoundException}. 9731 * 9732 * @param cr The ContentResolver to access. 9733 * @param name The name of the setting to retrieve. 9734 * 9735 * @throws SettingNotFoundException Thrown if a setting by the given 9736 * name can't be found or the setting value is not a float. 9737 * 9738 * @return The setting's current value. 9739 */ 9740 public static float getFloat(ContentResolver cr, String name) 9741 throws SettingNotFoundException { 9742 String v = getString(cr, name); 9743 if (v == null) { 9744 throw new SettingNotFoundException(name); 9745 } 9746 try { 9747 return Float.parseFloat(v); 9748 } catch (NumberFormatException e) { 9749 throw new SettingNotFoundException(name); 9750 } 9751 } 9752 9753 /** 9754 * Convenience function for updating a single settings value as a 9755 * floating point number. This will either create a new entry in the 9756 * table if the given name does not exist, or modify the value of the 9757 * existing row with that name. Note that internally setting values 9758 * are always stored as strings, so this function converts the given 9759 * value to a string before storing it. 9760 * 9761 * @param cr The ContentResolver to access. 9762 * @param name The name of the setting to modify. 9763 * @param value The new value for the setting. 9764 * @return true if the value was set, false on database errors 9765 */ 9766 public static boolean putFloat(ContentResolver cr, String name, float value) { 9767 return putString(cr, name, Float.toString(value)); 9768 } 9769 9770 /** 9771 * Subscription to be used for voice call on a multi sim device. The supported values 9772 * are 0 = SUB1, 1 = SUB2 and etc. 9773 * @hide 9774 */ 9775 public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; 9776 9777 /** 9778 * Used to provide option to user to select subscription during dial. 9779 * The supported values are 0 = disable or 1 = enable prompt. 9780 * @hide 9781 */ 9782 public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt"; 9783 9784 /** 9785 * Subscription to be used for data call on a multi sim device. The supported values 9786 * are 0 = SUB1, 1 = SUB2 and etc. 9787 * @hide 9788 */ 9789 public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; 9790 9791 /** 9792 * Subscription to be used for SMS on a multi sim device. The supported values 9793 * are 0 = SUB1, 1 = SUB2 and etc. 9794 * @hide 9795 */ 9796 public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms"; 9797 9798 /** 9799 * Used to provide option to user to select subscription during send SMS. 9800 * The value 1 - enable, 0 - disable 9801 * @hide 9802 */ 9803 public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt"; 9804 9805 9806 9807 /** User preferred subscriptions setting. 9808 * This holds the details of the user selected subscription from the card and 9809 * the activation status. Each settings string have the coma separated values 9810 * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index 9811 * @hide 9812 */ 9813 public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1", 9814 "user_preferred_sub2","user_preferred_sub3"}; 9815 9816 /** 9817 * Whether to enable new contacts aggregator or not. 9818 * The value 1 - enable, 0 - disable 9819 * @hide 9820 */ 9821 public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator"; 9822 9823 /** 9824 * Whether to enable contacts metadata syncing or not 9825 * The value 1 - enable, 0 - disable 9826 * 9827 * @removed 9828 */ 9829 @Deprecated 9830 public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync"; 9831 9832 /** 9833 * Whether to enable contacts metadata syncing or not 9834 * The value 1 - enable, 0 - disable 9835 */ 9836 public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled"; 9837 9838 /** 9839 * Whether to enable cellular on boot. 9840 * The value 1 - enable, 0 - disable 9841 * @hide 9842 */ 9843 public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot"; 9844 9845 /** 9846 * The maximum allowed notification enqueue rate in Hertz. 9847 * 9848 * Should be a float, and includes both posts and updates. 9849 * @hide 9850 */ 9851 public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate"; 9852 9853 /** 9854 * Whether cell is enabled/disabled 9855 * @hide 9856 */ 9857 public static final String CELL_ON = "cell_on"; 9858 } 9859 9860 /** 9861 * User-defined bookmarks and shortcuts. The target of each bookmark is an 9862 * Intent URL, allowing it to be either a web page or a particular 9863 * application activity. 9864 * 9865 * @hide 9866 */ 9867 public static final class Bookmarks implements BaseColumns 9868 { 9869 private static final String TAG = "Bookmarks"; 9870 9871 /** 9872 * The content:// style URL for this table 9873 */ 9874 public static final Uri CONTENT_URI = 9875 Uri.parse("content://" + AUTHORITY + "/bookmarks"); 9876 9877 /** 9878 * The row ID. 9879 * <p>Type: INTEGER</p> 9880 */ 9881 public static final String ID = "_id"; 9882 9883 /** 9884 * Descriptive name of the bookmark that can be displayed to the user. 9885 * If this is empty, the title should be resolved at display time (use 9886 * {@link #getTitle(Context, Cursor)} any time you want to display the 9887 * title of a bookmark.) 9888 * <P> 9889 * Type: TEXT 9890 * </P> 9891 */ 9892 public static final String TITLE = "title"; 9893 9894 /** 9895 * Arbitrary string (displayed to the user) that allows bookmarks to be 9896 * organized into categories. There are some special names for 9897 * standard folders, which all start with '@'. The label displayed for 9898 * the folder changes with the locale (via {@link #getLabelForFolder}) but 9899 * the folder name does not change so you can consistently query for 9900 * the folder regardless of the current locale. 9901 * 9902 * <P>Type: TEXT</P> 9903 * 9904 */ 9905 public static final String FOLDER = "folder"; 9906 9907 /** 9908 * The Intent URL of the bookmark, describing what it points to. This 9909 * value is given to {@link android.content.Intent#getIntent} to create 9910 * an Intent that can be launched. 9911 * <P>Type: TEXT</P> 9912 */ 9913 public static final String INTENT = "intent"; 9914 9915 /** 9916 * Optional shortcut character associated with this bookmark. 9917 * <P>Type: INTEGER</P> 9918 */ 9919 public static final String SHORTCUT = "shortcut"; 9920 9921 /** 9922 * The order in which the bookmark should be displayed 9923 * <P>Type: INTEGER</P> 9924 */ 9925 public static final String ORDERING = "ordering"; 9926 9927 private static final String[] sIntentProjection = { INTENT }; 9928 private static final String[] sShortcutProjection = { ID, SHORTCUT }; 9929 private static final String sShortcutSelection = SHORTCUT + "=?"; 9930 9931 /** 9932 * Convenience function to retrieve the bookmarked Intent for a 9933 * particular shortcut key. 9934 * 9935 * @param cr The ContentResolver to query. 9936 * @param shortcut The shortcut key. 9937 * 9938 * @return Intent The bookmarked URL, or null if there is no bookmark 9939 * matching the given shortcut. 9940 */ 9941 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut) 9942 { 9943 Intent intent = null; 9944 9945 Cursor c = cr.query(CONTENT_URI, 9946 sIntentProjection, sShortcutSelection, 9947 new String[] { String.valueOf((int) shortcut) }, ORDERING); 9948 // Keep trying until we find a valid shortcut 9949 try { 9950 while (intent == null && c.moveToNext()) { 9951 try { 9952 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT)); 9953 intent = Intent.parseUri(intentURI, 0); 9954 } catch (java.net.URISyntaxException e) { 9955 // The stored URL is bad... ignore it. 9956 } catch (IllegalArgumentException e) { 9957 // Column not found 9958 Log.w(TAG, "Intent column not found", e); 9959 } 9960 } 9961 } finally { 9962 if (c != null) c.close(); 9963 } 9964 9965 return intent; 9966 } 9967 9968 /** 9969 * Add a new bookmark to the system. 9970 * 9971 * @param cr The ContentResolver to query. 9972 * @param intent The desired target of the bookmark. 9973 * @param title Bookmark title that is shown to the user; null if none 9974 * or it should be resolved to the intent's title. 9975 * @param folder Folder in which to place the bookmark; null if none. 9976 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If 9977 * this is non-zero and there is an existing bookmark entry 9978 * with this same shortcut, then that existing shortcut is 9979 * cleared (the bookmark is not removed). 9980 * @return The unique content URL for the new bookmark entry. 9981 */ 9982 public static Uri add(ContentResolver cr, 9983 Intent intent, 9984 String title, 9985 String folder, 9986 char shortcut, 9987 int ordering) 9988 { 9989 // If a shortcut is supplied, and it is already defined for 9990 // another bookmark, then remove the old definition. 9991 if (shortcut != 0) { 9992 cr.delete(CONTENT_URI, sShortcutSelection, 9993 new String[] { String.valueOf((int) shortcut) }); 9994 } 9995 9996 ContentValues values = new ContentValues(); 9997 if (title != null) values.put(TITLE, title); 9998 if (folder != null) values.put(FOLDER, folder); 9999 values.put(INTENT, intent.toUri(0)); 10000 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut); 10001 values.put(ORDERING, ordering); 10002 return cr.insert(CONTENT_URI, values); 10003 } 10004 10005 /** 10006 * Return the folder name as it should be displayed to the user. This 10007 * takes care of localizing special folders. 10008 * 10009 * @param r Resources object for current locale; only need access to 10010 * system resources. 10011 * @param folder The value found in the {@link #FOLDER} column. 10012 * 10013 * @return CharSequence The label for this folder that should be shown 10014 * to the user. 10015 */ 10016 public static CharSequence getLabelForFolder(Resources r, String folder) { 10017 return folder; 10018 } 10019 10020 /** 10021 * Return the title as it should be displayed to the user. This takes 10022 * care of localizing bookmarks that point to activities. 10023 * 10024 * @param context A context. 10025 * @param cursor A cursor pointing to the row whose title should be 10026 * returned. The cursor must contain at least the {@link #TITLE} 10027 * and {@link #INTENT} columns. 10028 * @return A title that is localized and can be displayed to the user, 10029 * or the empty string if one could not be found. 10030 */ 10031 public static CharSequence getTitle(Context context, Cursor cursor) { 10032 int titleColumn = cursor.getColumnIndex(TITLE); 10033 int intentColumn = cursor.getColumnIndex(INTENT); 10034 if (titleColumn == -1 || intentColumn == -1) { 10035 throw new IllegalArgumentException( 10036 "The cursor must contain the TITLE and INTENT columns."); 10037 } 10038 10039 String title = cursor.getString(titleColumn); 10040 if (!TextUtils.isEmpty(title)) { 10041 return title; 10042 } 10043 10044 String intentUri = cursor.getString(intentColumn); 10045 if (TextUtils.isEmpty(intentUri)) { 10046 return ""; 10047 } 10048 10049 Intent intent; 10050 try { 10051 intent = Intent.parseUri(intentUri, 0); 10052 } catch (URISyntaxException e) { 10053 return ""; 10054 } 10055 10056 PackageManager packageManager = context.getPackageManager(); 10057 ResolveInfo info = packageManager.resolveActivity(intent, 0); 10058 return info != null ? info.loadLabel(packageManager) : ""; 10059 } 10060 } 10061 10062 /** 10063 * Returns the device ID that we should use when connecting to the mobile gtalk server. 10064 * This is a string like "android-0x1242", where the hex string is the Android ID obtained 10065 * from the GoogleLoginService. 10066 * 10067 * @param androidId The Android ID for this device. 10068 * @return The device ID that should be used when connecting to the mobile gtalk server. 10069 * @hide 10070 */ 10071 public static String getGTalkDeviceId(long androidId) { 10072 return "android-" + Long.toHexString(androidId); 10073 } 10074 10075 private static final String[] PM_WRITE_SETTINGS = { 10076 android.Manifest.permission.WRITE_SETTINGS 10077 }; 10078 private static final String[] PM_CHANGE_NETWORK_STATE = { 10079 android.Manifest.permission.CHANGE_NETWORK_STATE, 10080 android.Manifest.permission.WRITE_SETTINGS 10081 }; 10082 private static final String[] PM_SYSTEM_ALERT_WINDOW = { 10083 android.Manifest.permission.SYSTEM_ALERT_WINDOW 10084 }; 10085 10086 /** 10087 * Performs a strict and comprehensive check of whether a calling package is allowed to 10088 * write/modify system settings, as the condition differs for pre-M, M+, and 10089 * privileged/preinstalled apps. If the provided uid does not match the 10090 * callingPackage, a negative result will be returned. 10091 * @hide 10092 */ 10093 public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid, 10094 String callingPackage, boolean throwException) { 10095 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10096 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS, 10097 PM_WRITE_SETTINGS, false); 10098 } 10099 10100 /** 10101 * Performs a strict and comprehensive check of whether a calling package is allowed to 10102 * write/modify system settings, as the condition differs for pre-M, M+, and 10103 * privileged/preinstalled apps. If the provided uid does not match the 10104 * callingPackage, a negative result will be returned. The caller is expected to have 10105 * the WRITE_SETTINGS permission declared. 10106 * 10107 * Note: if the check is successful, the operation of this app will be updated to the 10108 * current time. 10109 * @hide 10110 */ 10111 public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid, 10112 String callingPackage, boolean throwException) { 10113 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10114 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS, 10115 PM_WRITE_SETTINGS, true); 10116 } 10117 10118 /** 10119 * Performs a strict and comprehensive check of whether a calling package is allowed to 10120 * change the state of network, as the condition differs for pre-M, M+, and 10121 * privileged/preinstalled apps. The caller is expected to have either the 10122 * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these 10123 * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and 10124 * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal 10125 * permission and cannot be revoked. See http://b/23597341 10126 * 10127 * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation 10128 * of this app will be updated to the current time. 10129 * @hide 10130 */ 10131 public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid, 10132 String callingPackage, boolean throwException) { 10133 if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE) 10134 == PackageManager.PERMISSION_GRANTED) { 10135 return true; 10136 } 10137 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10138 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS, 10139 PM_CHANGE_NETWORK_STATE, true); 10140 } 10141 10142 /** 10143 * Performs a strict and comprehensive check of whether a calling package is allowed to 10144 * draw on top of other apps, as the conditions differs for pre-M, M+, and 10145 * privileged/preinstalled apps. If the provided uid does not match the callingPackage, 10146 * a negative result will be returned. 10147 * @hide 10148 */ 10149 public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid, 10150 String callingPackage, boolean throwException) { 10151 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10152 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW, 10153 PM_SYSTEM_ALERT_WINDOW, false); 10154 } 10155 10156 /** 10157 * Performs a strict and comprehensive check of whether a calling package is allowed to 10158 * draw on top of other apps, as the conditions differs for pre-M, M+, and 10159 * privileged/preinstalled apps. If the provided uid does not match the callingPackage, 10160 * a negative result will be returned. 10161 * 10162 * Note: if the check is successful, the operation of this app will be updated to the 10163 * current time. 10164 * @hide 10165 */ 10166 public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String 10167 callingPackage, boolean throwException) { 10168 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10169 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW, 10170 PM_SYSTEM_ALERT_WINDOW, true); 10171 } 10172 10173 /** 10174 * Helper method to perform a general and comprehensive check of whether an operation that is 10175 * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and 10176 * OP_WRITE_SETTINGS 10177 * @hide 10178 */ 10179 public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context, 10180 int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[] 10181 permissions, boolean makeNote) { 10182 if (callingPackage == null) { 10183 return false; 10184 } 10185 10186 AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE); 10187 int mode = AppOpsManager.MODE_DEFAULT; 10188 if (makeNote) { 10189 mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage); 10190 } else { 10191 mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage); 10192 } 10193 10194 switch (mode) { 10195 case AppOpsManager.MODE_ALLOWED: 10196 return true; 10197 10198 case AppOpsManager.MODE_DEFAULT: 10199 // this is the default operating mode after an app's installation 10200 // In this case we will check all associated static permission to see 10201 // if it is granted during install time. 10202 for (String permission : permissions) { 10203 if (context.checkCallingOrSelfPermission(permission) == PackageManager 10204 .PERMISSION_GRANTED) { 10205 // if either of the permissions are granted, we will allow it 10206 return true; 10207 } 10208 } 10209 10210 default: 10211 // this is for all other cases trickled down here... 10212 if (!throwException) { 10213 return false; 10214 } 10215 } 10216 10217 // prepare string to throw SecurityException 10218 StringBuilder exceptionMessage = new StringBuilder(); 10219 exceptionMessage.append(callingPackage); 10220 exceptionMessage.append(" was not granted "); 10221 if (permissions.length > 1) { 10222 exceptionMessage.append(" either of these permissions: "); 10223 } else { 10224 exceptionMessage.append(" this permission: "); 10225 } 10226 for (int i = 0; i < permissions.length; i++) { 10227 exceptionMessage.append(permissions[i]); 10228 exceptionMessage.append((i == permissions.length - 1) ? "." : ", "); 10229 } 10230 10231 throw new SecurityException(exceptionMessage.toString()); 10232 } 10233 10234 /** 10235 * Retrieves a correponding package name for a given uid. It will query all 10236 * packages that are associated with the given uid, but it will return only 10237 * the zeroth result. 10238 * Note: If package could not be found, a null is returned. 10239 * @hide 10240 */ 10241 public static String getPackageNameForUid(Context context, int uid) { 10242 String[] packages = context.getPackageManager().getPackagesForUid(uid); 10243 if (packages == null) { 10244 return null; 10245 } 10246 return packages[0]; 10247 } 10248} 10249