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