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