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