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