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