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