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