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