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