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