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