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