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