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