Settings.java revision 80274caf49f0b0d204693318facde0e9feb779bf
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 * IMPORTANT: If you add a new public settings you also have to add it to 3856 * PUBLIC_SETTINGS below. If the new setting is hidden you have to add 3857 * it to PRIVATE_SETTINGS below. Also add a validator that can validate 3858 * the setting value. See an example above. 3859 */ 3860 3861 /** 3862 * Settings to backup. This is here so that it's in the same place as the settings 3863 * keys and easy to update. 3864 * 3865 * NOTE: Settings are backed up and restored in the order they appear 3866 * in this array. If you have one setting depending on another, 3867 * make sure that they are ordered appropriately. 3868 * 3869 * @hide 3870 */ 3871 public static final String[] SETTINGS_TO_BACKUP = { 3872 STAY_ON_WHILE_PLUGGED_IN, // moved to global 3873 WIFI_USE_STATIC_IP, 3874 WIFI_STATIC_IP, 3875 WIFI_STATIC_GATEWAY, 3876 WIFI_STATIC_NETMASK, 3877 WIFI_STATIC_DNS1, 3878 WIFI_STATIC_DNS2, 3879 BLUETOOTH_DISCOVERABILITY, 3880 BLUETOOTH_DISCOVERABILITY_TIMEOUT, 3881 FONT_SCALE, 3882 DIM_SCREEN, 3883 SCREEN_OFF_TIMEOUT, 3884 SCREEN_BRIGHTNESS, 3885 SCREEN_BRIGHTNESS_MODE, 3886 SCREEN_AUTO_BRIGHTNESS_ADJ, 3887 SCREEN_BRIGHTNESS_FOR_VR, 3888 VIBRATE_INPUT_DEVICES, 3889 MODE_RINGER_STREAMS_AFFECTED, 3890 TEXT_AUTO_REPLACE, 3891 TEXT_AUTO_CAPS, 3892 TEXT_AUTO_PUNCTUATE, 3893 TEXT_SHOW_PASSWORD, 3894 AUTO_TIME, // moved to global 3895 AUTO_TIME_ZONE, // moved to global 3896 TIME_12_24, 3897 DATE_FORMAT, 3898 DTMF_TONE_WHEN_DIALING, 3899 DTMF_TONE_TYPE_WHEN_DIALING, 3900 HEARING_AID, 3901 TTY_MODE, 3902 MASTER_MONO, 3903 SOUND_EFFECTS_ENABLED, 3904 HAPTIC_FEEDBACK_ENABLED, 3905 POWER_SOUNDS_ENABLED, // moved to global 3906 DOCK_SOUNDS_ENABLED, // moved to global 3907 LOCKSCREEN_SOUNDS_ENABLED, 3908 SHOW_WEB_SUGGESTIONS, 3909 SIP_CALL_OPTIONS, 3910 SIP_RECEIVE_CALLS, 3911 POINTER_SPEED, 3912 VIBRATE_WHEN_RINGING, 3913 RINGTONE, 3914 LOCK_TO_APP_ENABLED, 3915 NOTIFICATION_SOUND, 3916 ACCELEROMETER_ROTATION 3917 }; 3918 3919 /** 3920 * These are all public system settings 3921 * 3922 * @hide 3923 */ 3924 public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>(); 3925 static { 3926 PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR); 3927 PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP); 3928 PUBLIC_SETTINGS.add(WIFI_STATIC_IP); 3929 PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY); 3930 PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK); 3931 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1); 3932 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2); 3933 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY); 3934 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT); 3935 PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED); 3936 PUBLIC_SETTINGS.add(FONT_SCALE); 3937 PUBLIC_SETTINGS.add(DIM_SCREEN); 3938 PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT); 3939 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS); 3940 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE); 3941 PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED); 3942 PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED); 3943 PUBLIC_SETTINGS.add(VIBRATE_ON); 3944 PUBLIC_SETTINGS.add(VOLUME_RING); 3945 PUBLIC_SETTINGS.add(VOLUME_SYSTEM); 3946 PUBLIC_SETTINGS.add(VOLUME_VOICE); 3947 PUBLIC_SETTINGS.add(VOLUME_MUSIC); 3948 PUBLIC_SETTINGS.add(VOLUME_ALARM); 3949 PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION); 3950 PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO); 3951 PUBLIC_SETTINGS.add(RINGTONE); 3952 PUBLIC_SETTINGS.add(NOTIFICATION_SOUND); 3953 PUBLIC_SETTINGS.add(ALARM_ALERT); 3954 PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE); 3955 PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS); 3956 PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE); 3957 PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD); 3958 PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS); 3959 PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY); 3960 PUBLIC_SETTINGS.add(TIME_12_24); 3961 PUBLIC_SETTINGS.add(DATE_FORMAT); 3962 PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN); 3963 PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION); 3964 PUBLIC_SETTINGS.add(USER_ROTATION); 3965 PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING); 3966 PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED); 3967 PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); 3968 PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS); 3969 PUBLIC_SETTINGS.add(VIBRATE_WHEN_RINGING); 3970 } 3971 3972 /** 3973 * These are all hidden system settings. 3974 * 3975 * @hide 3976 */ 3977 public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>(); 3978 static { 3979 PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP); 3980 PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR); 3981 PRIVATE_SETTINGS.add(ADVANCED_SETTINGS); 3982 PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ); 3983 PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES); 3984 PRIVATE_SETTINGS.add(VOLUME_MASTER); 3985 PRIVATE_SETTINGS.add(MASTER_MONO); 3986 PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME); 3987 PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT); 3988 PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER); 3989 PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY); 3990 PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING); 3991 PRIVATE_SETTINGS.add(HEARING_AID); 3992 PRIVATE_SETTINGS.add(TTY_MODE); 3993 PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE); 3994 PRIVATE_SETTINGS.add(POINTER_LOCATION); 3995 PRIVATE_SETTINGS.add(SHOW_TOUCHES); 3996 PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG); 3997 PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED); 3998 PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED); 3999 PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED); 4000 PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED); 4001 PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND); 4002 PRIVATE_SETTINGS.add(DESK_DOCK_SOUND); 4003 PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND); 4004 PRIVATE_SETTINGS.add(CAR_DOCK_SOUND); 4005 PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND); 4006 PRIVATE_SETTINGS.add(LOCK_SOUND); 4007 PRIVATE_SETTINGS.add(UNLOCK_SOUND); 4008 PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS); 4009 PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS); 4010 PRIVATE_SETTINGS.add(SIP_ALWAYS); 4011 PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY); 4012 PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME); 4013 PRIVATE_SETTINGS.add(POINTER_SPEED); 4014 PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED); 4015 PRIVATE_SETTINGS.add(EGG_MODE); 4016 } 4017 4018 /** 4019 * These are all public system settings 4020 * 4021 * @hide 4022 */ 4023 public static final Map<String, Validator> VALIDATORS = new ArrayMap<>(); 4024 static { 4025 VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR); 4026 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 4027 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR); 4028 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT, 4029 BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR); 4030 VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR); 4031 VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR); 4032 VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR); 4033 VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR); 4034 VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR); 4035 VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR); 4036 VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR); 4037 VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR); 4038 VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR); 4039 VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR); 4040 VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR); 4041 VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR); 4042 VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR); 4043 VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR); 4044 VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR); 4045 VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR); 4046 VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR); 4047 VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR); 4048 VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR); 4049 VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR); 4050 VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR); 4051 VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR); 4052 VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR); 4053 VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR); 4054 VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR); 4055 VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR); 4056 VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR); 4057 VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR); 4058 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); 4059 VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR); 4060 VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR); 4061 VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR); 4062 VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR); 4063 VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR); 4064 VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR); 4065 VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR); 4066 VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR); 4067 VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 4068 HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR); 4069 VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR); 4070 VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR); 4071 VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR); 4072 VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR); 4073 VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR); 4074 VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR); 4075 VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR); 4076 VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG, 4077 WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR); 4078 VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR); 4079 VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR); 4080 VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR); 4081 VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR); 4082 VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR); 4083 VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR); 4084 VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR); 4085 VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR); 4086 VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR); 4087 VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR); 4088 VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR); 4089 VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR); 4090 VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); 4091 VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); 4092 VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); 4093 } 4094 4095 /** 4096 * These entries are considered common between the personal and the managed profile, 4097 * since the managed profile doesn't get to change them. 4098 */ 4099 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 4100 static { 4101 CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT); 4102 CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED); 4103 CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED); 4104 CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD); 4105 CLONE_TO_MANAGED_PROFILE.add(TIME_12_24); 4106 } 4107 4108 /** @hide */ 4109 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 4110 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 4111 } 4112 4113 /** 4114 * These entries should be cloned from this profile's parent only if the dependency's 4115 * value is true ("1") 4116 * 4117 * Note: the dependencies must be Secure settings 4118 * 4119 * @hide 4120 */ 4121 public static final Map<String, String> CLONE_FROM_PARENT_ON_VALUE = new ArrayMap<>(); 4122 static { 4123 CLONE_FROM_PARENT_ON_VALUE.put(RINGTONE, Secure.SYNC_PARENT_SOUNDS); 4124 CLONE_FROM_PARENT_ON_VALUE.put(NOTIFICATION_SOUND, Secure.SYNC_PARENT_SOUNDS); 4125 CLONE_FROM_PARENT_ON_VALUE.put(ALARM_ALERT, Secure.SYNC_PARENT_SOUNDS); 4126 } 4127 4128 /** @hide */ 4129 public static void getCloneFromParentOnValueSettings(Map<String, String> outMap) { 4130 outMap.putAll(CLONE_FROM_PARENT_ON_VALUE); 4131 } 4132 4133 /** 4134 * System settings which can be accessed by instant apps. 4135 * @hide 4136 */ 4137 public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>(); 4138 static { 4139 INSTANT_APP_SETTINGS.add(TEXT_AUTO_REPLACE); 4140 INSTANT_APP_SETTINGS.add(TEXT_AUTO_CAPS); 4141 INSTANT_APP_SETTINGS.add(TEXT_AUTO_PUNCTUATE); 4142 INSTANT_APP_SETTINGS.add(TEXT_SHOW_PASSWORD); 4143 INSTANT_APP_SETTINGS.add(DATE_FORMAT); 4144 INSTANT_APP_SETTINGS.add(FONT_SCALE); 4145 INSTANT_APP_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); 4146 INSTANT_APP_SETTINGS.add(TIME_12_24); 4147 INSTANT_APP_SETTINGS.add(SOUND_EFFECTS_ENABLED); 4148 } 4149 4150 /** 4151 * When to use Wi-Fi calling 4152 * 4153 * @see android.telephony.TelephonyManager.WifiCallingChoices 4154 * @hide 4155 */ 4156 public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls"; 4157 4158 // Settings moved to Settings.Secure 4159 4160 /** 4161 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} 4162 * instead 4163 */ 4164 @Deprecated 4165 public static final String ADB_ENABLED = Global.ADB_ENABLED; 4166 4167 /** 4168 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead 4169 */ 4170 @Deprecated 4171 public static final String ANDROID_ID = Secure.ANDROID_ID; 4172 4173 /** 4174 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 4175 */ 4176 @Deprecated 4177 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 4178 4179 /** 4180 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 4181 */ 4182 @Deprecated 4183 public static final String DATA_ROAMING = Global.DATA_ROAMING; 4184 4185 /** 4186 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 4187 */ 4188 @Deprecated 4189 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 4190 4191 /** 4192 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead 4193 */ 4194 @Deprecated 4195 public static final String HTTP_PROXY = Global.HTTP_PROXY; 4196 4197 /** 4198 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 4199 */ 4200 @Deprecated 4201 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 4202 4203 /** 4204 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} 4205 * instead 4206 */ 4207 @Deprecated 4208 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; 4209 4210 /** 4211 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead 4212 */ 4213 @Deprecated 4214 public static final String LOGGING_ID = Secure.LOGGING_ID; 4215 4216 /** 4217 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 4218 */ 4219 @Deprecated 4220 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 4221 4222 /** 4223 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} 4224 * instead 4225 */ 4226 @Deprecated 4227 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; 4228 4229 /** 4230 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} 4231 * instead 4232 */ 4233 @Deprecated 4234 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; 4235 4236 /** 4237 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} 4238 * instead 4239 */ 4240 @Deprecated 4241 public static final String PARENTAL_CONTROL_REDIRECT_URL = 4242 Secure.PARENTAL_CONTROL_REDIRECT_URL; 4243 4244 /** 4245 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead 4246 */ 4247 @Deprecated 4248 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; 4249 4250 /** 4251 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 4252 */ 4253 @Deprecated 4254 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 4255 4256 /** 4257 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 4258 */ 4259 @Deprecated 4260 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 4261 4262 /** 4263 * @deprecated Use 4264 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 4265 */ 4266 @Deprecated 4267 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 4268 4269 /** 4270 * @deprecated Use 4271 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 4272 */ 4273 @Deprecated 4274 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 4275 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 4276 4277 /** 4278 * @deprecated Use 4279 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead 4280 */ 4281 @Deprecated 4282 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 4283 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 4284 4285 /** 4286 * @deprecated Use 4287 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead 4288 */ 4289 @Deprecated 4290 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 4291 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 4292 4293 /** 4294 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 4295 * instead 4296 */ 4297 @Deprecated 4298 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 4299 4300 /** 4301 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead 4302 */ 4303 @Deprecated 4304 public static final String WIFI_ON = Global.WIFI_ON; 4305 4306 /** 4307 * @deprecated Use 4308 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} 4309 * instead 4310 */ 4311 @Deprecated 4312 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 4313 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; 4314 4315 /** 4316 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead 4317 */ 4318 @Deprecated 4319 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; 4320 4321 /** 4322 * @deprecated Use 4323 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead 4324 */ 4325 @Deprecated 4326 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 4327 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; 4328 4329 /** 4330 * @deprecated Use 4331 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead 4332 */ 4333 @Deprecated 4334 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 4335 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; 4336 4337 /** 4338 * @deprecated Use 4339 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} 4340 * instead 4341 */ 4342 @Deprecated 4343 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 4344 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; 4345 4346 /** 4347 * @deprecated Use 4348 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead 4349 */ 4350 @Deprecated 4351 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 4352 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; 4353 4354 /** 4355 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} 4356 * instead 4357 */ 4358 @Deprecated 4359 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; 4360 4361 /** 4362 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 4363 */ 4364 @Deprecated 4365 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON; 4366 4367 /** 4368 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead 4369 */ 4370 @Deprecated 4371 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; 4372 4373 /** 4374 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} 4375 * instead 4376 */ 4377 @Deprecated 4378 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; 4379 4380 /** 4381 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} 4382 * instead 4383 */ 4384 @Deprecated 4385 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = 4386 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; 4387 4388 /** 4389 * Checks if the specified app can modify system settings. As of API 4390 * level 23, an app cannot modify system settings unless it declares the 4391 * {@link android.Manifest.permission#WRITE_SETTINGS} 4392 * permission in its manifest, <em>and</em> the user specifically grants 4393 * the app this capability. To prompt the user to grant this approval, 4394 * the app must send an intent with the action {@link 4395 * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes 4396 * the system to display a permission management screen. 4397 * 4398 * @param context App context. 4399 * @return true if the calling app can write to system settings, false otherwise 4400 */ 4401 public static boolean canWrite(Context context) { 4402 return isCallingPackageAllowedToWriteSettings(context, Process.myUid(), 4403 context.getOpPackageName(), false); 4404 } 4405 } 4406 4407 /** 4408 * Secure system settings, containing system preferences that applications 4409 * can read but are not allowed to write. These are for preferences that 4410 * the user must explicitly modify through the system UI or specialized 4411 * APIs for those values, not modified directly by applications. 4412 */ 4413 public static final class Secure extends NameValueTable { 4414 /** 4415 * The content:// style URL for this table 4416 */ 4417 public static final Uri CONTENT_URI = 4418 Uri.parse("content://" + AUTHORITY + "/secure"); 4419 4420 private static final ContentProviderHolder sProviderHolder = 4421 new ContentProviderHolder(CONTENT_URI); 4422 4423 // Populated lazily, guarded by class object: 4424 private static final NameValueCache sNameValueCache = new NameValueCache( 4425 CONTENT_URI, 4426 CALL_METHOD_GET_SECURE, 4427 CALL_METHOD_PUT_SECURE, 4428 sProviderHolder); 4429 4430 private static ILockSettings sLockSettings = null; 4431 4432 private static boolean sIsSystemProcess; 4433 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; 4434 private static final HashSet<String> MOVED_TO_GLOBAL; 4435 static { 4436 MOVED_TO_LOCK_SETTINGS = new HashSet<>(3); 4437 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); 4438 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); 4439 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); 4440 4441 MOVED_TO_GLOBAL = new HashSet<>(); 4442 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED); 4443 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED); 4444 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON); 4445 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU); 4446 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS); 4447 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE); 4448 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE); 4449 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE); 4450 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI); 4451 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING); 4452 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED); 4453 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED); 4454 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); 4455 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); 4456 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); 4457 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); 4458 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); 4459 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); 4460 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES); 4461 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE); 4462 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED); 4463 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES); 4464 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL); 4465 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED); 4466 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE); 4467 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION); 4468 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE); 4469 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES); 4470 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE); 4471 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION); 4472 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE); 4473 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES); 4474 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE); 4475 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE); 4476 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF); 4477 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING); 4478 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER); 4479 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT); 4480 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT); 4481 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS); 4482 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT); 4483 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS); 4484 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT); 4485 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS); 4486 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL); 4487 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST); 4488 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL); 4489 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN); 4490 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED); 4491 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED); 4492 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED); 4493 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL); 4494 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE); 4495 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS); 4496 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND); 4497 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS); 4498 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT); 4499 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS); 4500 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); 4501 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); 4502 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT); 4503 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON); 4504 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME); 4505 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE); 4506 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS); 4507 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED); 4508 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED); 4509 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN); 4510 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI); 4511 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON); 4512 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED); 4513 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON); 4514 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE); 4515 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT); 4516 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE); 4517 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS); 4518 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS); 4519 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS); 4520 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL); 4521 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD); 4522 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD); 4523 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR); 4524 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS); 4525 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES); 4526 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB); 4527 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT); 4528 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT); 4529 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX); 4530 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX); 4531 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL); 4532 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD); 4533 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE); 4534 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES); 4535 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES); 4536 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS); 4537 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY); 4538 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED); 4539 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER); 4540 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON); 4541 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION); 4542 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION); 4543 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY); 4544 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY); 4545 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT); 4546 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY); 4547 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST); 4548 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT); 4549 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); 4550 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY); 4551 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER); 4552 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE); 4553 MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY); 4554 } 4555 4556 /** @hide */ 4557 public static void getMovedToGlobalSettings(Set<String> outKeySet) { 4558 outKeySet.addAll(MOVED_TO_GLOBAL); 4559 } 4560 4561 /** 4562 * Look up a name in the database. 4563 * @param resolver to access the database with 4564 * @param name to look up in the table 4565 * @return the corresponding value, or null if not present 4566 */ 4567 public static String getString(ContentResolver resolver, String name) { 4568 return getStringForUser(resolver, name, UserHandle.myUserId()); 4569 } 4570 4571 /** @hide */ 4572 public static String getStringForUser(ContentResolver resolver, String name, 4573 int userHandle) { 4574 if (MOVED_TO_GLOBAL.contains(name)) { 4575 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 4576 + " to android.provider.Settings.Global."); 4577 return Global.getStringForUser(resolver, name, userHandle); 4578 } 4579 4580 if (MOVED_TO_LOCK_SETTINGS.contains(name)) { 4581 synchronized (Secure.class) { 4582 if (sLockSettings == null) { 4583 sLockSettings = ILockSettings.Stub.asInterface( 4584 (IBinder) ServiceManager.getService("lock_settings")); 4585 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; 4586 } 4587 } 4588 if (sLockSettings != null && !sIsSystemProcess) { 4589 // No context; use the ActivityThread's context as an approximation for 4590 // determining the target API level. 4591 Application application = ActivityThread.currentApplication(); 4592 4593 boolean isPreMnc = application != null 4594 && application.getApplicationInfo() != null 4595 && application.getApplicationInfo().targetSdkVersion 4596 <= VERSION_CODES.LOLLIPOP_MR1; 4597 if (isPreMnc) { 4598 try { 4599 return sLockSettings.getString(name, "0", userHandle); 4600 } catch (RemoteException re) { 4601 // Fall through 4602 } 4603 } else { 4604 throw new SecurityException("Settings.Secure." + name 4605 + " is deprecated and no longer accessible." 4606 + " See API documentation for potential replacements."); 4607 } 4608 } 4609 } 4610 4611 return sNameValueCache.getStringForUser(resolver, name, userHandle); 4612 } 4613 4614 /** 4615 * Store a name/value pair into the database. 4616 * @param resolver to access the database with 4617 * @param name to store 4618 * @param value to associate with the name 4619 * @return true if the value was set, false on database errors 4620 */ 4621 public static boolean putString(ContentResolver resolver, String name, String value) { 4622 return putStringForUser(resolver, name, value, UserHandle.myUserId()); 4623 } 4624 4625 /** @hide */ 4626 public static boolean putStringForUser(ContentResolver resolver, String name, String value, 4627 int userHandle) { 4628 return putStringForUser(resolver, name, value, null, false, userHandle); 4629 } 4630 4631 /** @hide */ 4632 public static boolean putStringForUser(@NonNull ContentResolver resolver, 4633 @NonNull String name, @Nullable String value, @Nullable String tag, 4634 boolean makeDefault, @UserIdInt int userHandle) { 4635 if (LOCATION_MODE.equals(name)) { 4636 // Map LOCATION_MODE to underlying location provider storage API 4637 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle); 4638 } 4639 if (MOVED_TO_GLOBAL.contains(name)) { 4640 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 4641 + " to android.provider.Settings.Global"); 4642 return Global.putStringForUser(resolver, name, value, 4643 tag, makeDefault, userHandle); 4644 } 4645 return sNameValueCache.putStringForUser(resolver, name, value, tag, 4646 makeDefault, userHandle); 4647 } 4648 4649 /** 4650 * Store a name/value pair into the database. 4651 * <p> 4652 * The method takes an optional tag to associate with the setting 4653 * which can be used to clear only settings made by your package and 4654 * associated with this tag by passing the tag to {@link 4655 * #resetToDefaults(ContentResolver, String)}. Anyone can override 4656 * the current tag. Also if another package changes the setting 4657 * then the tag will be set to the one specified in the set call 4658 * which can be null. Also any of the settings setters that do not 4659 * take a tag as an argument effectively clears the tag. 4660 * </p><p> 4661 * For example, if you set settings A and B with tags T1 and T2 and 4662 * another app changes setting A (potentially to the same value), it 4663 * can assign to it a tag T3 (note that now the package that changed 4664 * the setting is not yours). Now if you reset your changes for T1 and 4665 * T2 only setting B will be reset and A not (as it was changed by 4666 * another package) but since A did not change you are in the desired 4667 * initial state. Now if the other app changes the value of A (assuming 4668 * you registered an observer in the beginning) you would detect that 4669 * the setting was changed by another app and handle this appropriately 4670 * (ignore, set back to some value, etc). 4671 * </p><p> 4672 * Also the method takes an argument whether to make the value the 4673 * default for this setting. If the system already specified a default 4674 * value, then the one passed in here will <strong>not</strong> 4675 * be set as the default. 4676 * </p> 4677 * 4678 * @param resolver to access the database with. 4679 * @param name to store. 4680 * @param value to associate with the name. 4681 * @param tag to associate with the setting. 4682 * @param makeDefault whether to make the value the default one. 4683 * @return true if the value was set, false on database errors. 4684 * 4685 * @see #resetToDefaults(ContentResolver, String) 4686 * 4687 * @hide 4688 */ 4689 @SystemApi 4690 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 4691 public static boolean putString(@NonNull ContentResolver resolver, 4692 @NonNull String name, @Nullable String value, @Nullable String tag, 4693 boolean makeDefault) { 4694 return putStringForUser(resolver, name, value, tag, makeDefault, 4695 UserHandle.myUserId()); 4696 } 4697 4698 /** 4699 * Reset the settings to their defaults. This would reset <strong>only</strong> 4700 * settings set by the caller's package. Think of it of a way to undo your own 4701 * changes to the global settings. Passing in the optional tag will reset only 4702 * settings changed by your package and associated with this tag. 4703 * 4704 * @param resolver Handle to the content resolver. 4705 * @param tag Optional tag which should be associated with the settings to reset. 4706 * 4707 * @see #putString(ContentResolver, String, String, String, boolean) 4708 * 4709 * @hide 4710 */ 4711 @SystemApi 4712 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 4713 public static void resetToDefaults(@NonNull ContentResolver resolver, 4714 @Nullable String tag) { 4715 resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS, 4716 UserHandle.myUserId()); 4717 } 4718 4719 /** 4720 * 4721 * Reset the settings to their defaults for a given user with a specific mode. The 4722 * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS} 4723 * allowing resetting the settings made by a package and associated with the tag. 4724 * 4725 * @param resolver Handle to the content resolver. 4726 * @param tag Optional tag which should be associated with the settings to reset. 4727 * @param mode The reset mode. 4728 * @param userHandle The user for which to reset to defaults. 4729 * 4730 * @see #RESET_MODE_PACKAGE_DEFAULTS 4731 * @see #RESET_MODE_UNTRUSTED_DEFAULTS 4732 * @see #RESET_MODE_UNTRUSTED_CHANGES 4733 * @see #RESET_MODE_TRUSTED_DEFAULTS 4734 * 4735 * @hide 4736 */ 4737 public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver, 4738 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) { 4739 try { 4740 Bundle arg = new Bundle(); 4741 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 4742 if (tag != null) { 4743 arg.putString(CALL_METHOD_TAG_KEY, tag); 4744 } 4745 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode); 4746 IContentProvider cp = sProviderHolder.getProvider(resolver); 4747 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_SECURE, null, arg); 4748 } catch (RemoteException e) { 4749 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e); 4750 } 4751 } 4752 4753 /** 4754 * Construct the content URI for a particular name/value pair, 4755 * useful for monitoring changes with a ContentObserver. 4756 * @param name to look up in the table 4757 * @return the corresponding content URI, or null if not present 4758 */ 4759 public static Uri getUriFor(String name) { 4760 if (MOVED_TO_GLOBAL.contains(name)) { 4761 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" 4762 + " to android.provider.Settings.Global, returning global URI."); 4763 return Global.getUriFor(Global.CONTENT_URI, name); 4764 } 4765 return getUriFor(CONTENT_URI, name); 4766 } 4767 4768 /** 4769 * Convenience function for retrieving a single secure settings value 4770 * as an integer. Note that internally setting values are always 4771 * stored as strings; this function converts the string to an integer 4772 * for you. The default value will be returned if the setting is 4773 * not defined or not an integer. 4774 * 4775 * @param cr The ContentResolver to access. 4776 * @param name The name of the setting to retrieve. 4777 * @param def Value to return if the setting is not defined. 4778 * 4779 * @return The setting's current value, or 'def' if it is not defined 4780 * or not a valid integer. 4781 */ 4782 public static int getInt(ContentResolver cr, String name, int def) { 4783 return getIntForUser(cr, name, def, UserHandle.myUserId()); 4784 } 4785 4786 /** @hide */ 4787 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 4788 if (LOCATION_MODE.equals(name)) { 4789 // Map from to underlying location provider storage API to location mode 4790 return getLocationModeForUser(cr, userHandle); 4791 } 4792 String v = getStringForUser(cr, name, userHandle); 4793 try { 4794 return v != null ? Integer.parseInt(v) : def; 4795 } catch (NumberFormatException e) { 4796 return def; 4797 } 4798 } 4799 4800 /** 4801 * Convenience function for retrieving a single secure settings value 4802 * as an integer. Note that internally setting values are always 4803 * stored as strings; this function converts the string to an integer 4804 * for you. 4805 * <p> 4806 * This version does not take a default value. If the setting has not 4807 * been set, or the string value is not a number, 4808 * it throws {@link SettingNotFoundException}. 4809 * 4810 * @param cr The ContentResolver to access. 4811 * @param name The name of the setting to retrieve. 4812 * 4813 * @throws SettingNotFoundException Thrown if a setting by the given 4814 * name can't be found or the setting value is not an integer. 4815 * 4816 * @return The setting's current value. 4817 */ 4818 public static int getInt(ContentResolver cr, String name) 4819 throws SettingNotFoundException { 4820 return getIntForUser(cr, name, UserHandle.myUserId()); 4821 } 4822 4823 /** @hide */ 4824 public static int getIntForUser(ContentResolver cr, String name, int userHandle) 4825 throws SettingNotFoundException { 4826 if (LOCATION_MODE.equals(name)) { 4827 // Map from to underlying location provider storage API to location mode 4828 return getLocationModeForUser(cr, userHandle); 4829 } 4830 String v = getStringForUser(cr, name, userHandle); 4831 try { 4832 return Integer.parseInt(v); 4833 } catch (NumberFormatException e) { 4834 throw new SettingNotFoundException(name); 4835 } 4836 } 4837 4838 /** 4839 * Convenience function for updating a single settings value as an 4840 * integer. This will either create a new entry in the table if the 4841 * given name does not exist, or modify the value of the existing row 4842 * with that name. Note that internally setting values are always 4843 * stored as strings, so this function converts the given value to a 4844 * string before storing it. 4845 * 4846 * @param cr The ContentResolver to access. 4847 * @param name The name of the setting to modify. 4848 * @param value The new value for the setting. 4849 * @return true if the value was set, false on database errors 4850 */ 4851 public static boolean putInt(ContentResolver cr, String name, int value) { 4852 return putIntForUser(cr, name, value, UserHandle.myUserId()); 4853 } 4854 4855 /** @hide */ 4856 public static boolean putIntForUser(ContentResolver cr, String name, int value, 4857 int userHandle) { 4858 return putStringForUser(cr, name, Integer.toString(value), userHandle); 4859 } 4860 4861 /** 4862 * Convenience function for retrieving a single secure settings value 4863 * as a {@code long}. Note that internally setting values are always 4864 * stored as strings; this function converts the string to a {@code long} 4865 * for you. The default value will be returned if the setting is 4866 * not defined or not a {@code long}. 4867 * 4868 * @param cr The ContentResolver to access. 4869 * @param name The name of the setting to retrieve. 4870 * @param def Value to return if the setting is not defined. 4871 * 4872 * @return The setting's current value, or 'def' if it is not defined 4873 * or not a valid {@code long}. 4874 */ 4875 public static long getLong(ContentResolver cr, String name, long def) { 4876 return getLongForUser(cr, name, def, UserHandle.myUserId()); 4877 } 4878 4879 /** @hide */ 4880 public static long getLongForUser(ContentResolver cr, String name, long def, 4881 int userHandle) { 4882 String valString = getStringForUser(cr, name, userHandle); 4883 long value; 4884 try { 4885 value = valString != null ? Long.parseLong(valString) : def; 4886 } catch (NumberFormatException e) { 4887 value = def; 4888 } 4889 return value; 4890 } 4891 4892 /** 4893 * Convenience function for retrieving a single secure settings value 4894 * as a {@code long}. Note that internally setting values are always 4895 * stored as strings; this function converts the string to a {@code long} 4896 * for you. 4897 * <p> 4898 * This version does not take a default value. If the setting has not 4899 * been set, or the string value is not a number, 4900 * it throws {@link SettingNotFoundException}. 4901 * 4902 * @param cr The ContentResolver to access. 4903 * @param name The name of the setting to retrieve. 4904 * 4905 * @return The setting's current value. 4906 * @throws SettingNotFoundException Thrown if a setting by the given 4907 * name can't be found or the setting value is not an integer. 4908 */ 4909 public static long getLong(ContentResolver cr, String name) 4910 throws SettingNotFoundException { 4911 return getLongForUser(cr, name, UserHandle.myUserId()); 4912 } 4913 4914 /** @hide */ 4915 public static long getLongForUser(ContentResolver cr, String name, int userHandle) 4916 throws SettingNotFoundException { 4917 String valString = getStringForUser(cr, name, userHandle); 4918 try { 4919 return Long.parseLong(valString); 4920 } catch (NumberFormatException e) { 4921 throw new SettingNotFoundException(name); 4922 } 4923 } 4924 4925 /** 4926 * Convenience function for updating a secure settings value as a long 4927 * integer. This will either create a new entry in the table if the 4928 * given name does not exist, or modify the value of the existing row 4929 * with that name. Note that internally setting values are always 4930 * stored as strings, so this function converts the given value to a 4931 * string before storing it. 4932 * 4933 * @param cr The ContentResolver to access. 4934 * @param name The name of the setting to modify. 4935 * @param value The new value for the setting. 4936 * @return true if the value was set, false on database errors 4937 */ 4938 public static boolean putLong(ContentResolver cr, String name, long value) { 4939 return putLongForUser(cr, name, value, UserHandle.myUserId()); 4940 } 4941 4942 /** @hide */ 4943 public static boolean putLongForUser(ContentResolver cr, String name, long value, 4944 int userHandle) { 4945 return putStringForUser(cr, name, Long.toString(value), userHandle); 4946 } 4947 4948 /** 4949 * Convenience function for retrieving a single secure settings value 4950 * as a floating point number. Note that internally setting values are 4951 * always stored as strings; this function converts the string to an 4952 * float for you. The default value will be returned if the setting 4953 * is not defined or not a valid float. 4954 * 4955 * @param cr The ContentResolver to access. 4956 * @param name The name of the setting to retrieve. 4957 * @param def Value to return if the setting is not defined. 4958 * 4959 * @return The setting's current value, or 'def' if it is not defined 4960 * or not a valid float. 4961 */ 4962 public static float getFloat(ContentResolver cr, String name, float def) { 4963 return getFloatForUser(cr, name, def, UserHandle.myUserId()); 4964 } 4965 4966 /** @hide */ 4967 public static float getFloatForUser(ContentResolver cr, String name, float def, 4968 int userHandle) { 4969 String v = getStringForUser(cr, name, userHandle); 4970 try { 4971 return v != null ? Float.parseFloat(v) : def; 4972 } catch (NumberFormatException e) { 4973 return def; 4974 } 4975 } 4976 4977 /** 4978 * Convenience function for retrieving a single secure settings value 4979 * as a float. Note that internally setting values are always 4980 * stored as strings; this function converts the string to a float 4981 * for you. 4982 * <p> 4983 * This version does not take a default value. If the setting has not 4984 * been set, or the string value is not a number, 4985 * it throws {@link SettingNotFoundException}. 4986 * 4987 * @param cr The ContentResolver to access. 4988 * @param name The name of the setting to retrieve. 4989 * 4990 * @throws SettingNotFoundException Thrown if a setting by the given 4991 * name can't be found or the setting value is not a float. 4992 * 4993 * @return The setting's current value. 4994 */ 4995 public static float getFloat(ContentResolver cr, String name) 4996 throws SettingNotFoundException { 4997 return getFloatForUser(cr, name, UserHandle.myUserId()); 4998 } 4999 5000 /** @hide */ 5001 public static float getFloatForUser(ContentResolver cr, String name, int userHandle) 5002 throws SettingNotFoundException { 5003 String v = getStringForUser(cr, name, userHandle); 5004 if (v == null) { 5005 throw new SettingNotFoundException(name); 5006 } 5007 try { 5008 return Float.parseFloat(v); 5009 } catch (NumberFormatException e) { 5010 throw new SettingNotFoundException(name); 5011 } 5012 } 5013 5014 /** 5015 * Convenience function for updating a single settings value as a 5016 * floating point number. This will either create a new entry in the 5017 * table if the given name does not exist, or modify the value of the 5018 * existing row with that name. Note that internally setting values 5019 * are always stored as strings, so this function converts the given 5020 * value to a string before storing it. 5021 * 5022 * @param cr The ContentResolver to access. 5023 * @param name The name of the setting to modify. 5024 * @param value The new value for the setting. 5025 * @return true if the value was set, false on database errors 5026 */ 5027 public static boolean putFloat(ContentResolver cr, String name, float value) { 5028 return putFloatForUser(cr, name, value, UserHandle.myUserId()); 5029 } 5030 5031 /** @hide */ 5032 public static boolean putFloatForUser(ContentResolver cr, String name, float value, 5033 int userHandle) { 5034 return putStringForUser(cr, name, Float.toString(value), userHandle); 5035 } 5036 5037 /** 5038 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED} 5039 * instead 5040 */ 5041 @Deprecated 5042 public static final String DEVELOPMENT_SETTINGS_ENABLED = 5043 Global.DEVELOPMENT_SETTINGS_ENABLED; 5044 5045 /** 5046 * When the user has enable the option to have a "bug report" command 5047 * in the power menu. 5048 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead 5049 * @hide 5050 */ 5051 @Deprecated 5052 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 5053 5054 /** 5055 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead 5056 */ 5057 @Deprecated 5058 public static final String ADB_ENABLED = Global.ADB_ENABLED; 5059 5060 /** 5061 * Setting to allow mock locations and location provider status to be injected into the 5062 * LocationManager service for testing purposes during application development. These 5063 * locations and status values override actual location and status information generated 5064 * by network, gps, or other location providers. 5065 * 5066 * @deprecated This settings is not used anymore. 5067 */ 5068 @Deprecated 5069 public static final String ALLOW_MOCK_LOCATION = "mock_location"; 5070 5071 /** 5072 * A 64-bit number (as a hex string) that is randomly 5073 * generated when the user first sets up the device and should remain 5074 * constant for the lifetime of the user's device. The value may 5075 * change if a factory reset is performed on the device. 5076 * <p class="note"><strong>Note:</strong> When a device has <a 5077 * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a> 5078 * (available on certain devices running Android 4.2 or higher), each user appears as a 5079 * completely separate device, so the {@code ANDROID_ID} value is unique to each 5080 * user.</p> 5081 */ 5082 public static final String ANDROID_ID = "android_id"; 5083 5084 /** 5085 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 5086 */ 5087 @Deprecated 5088 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; 5089 5090 /** 5091 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead 5092 */ 5093 @Deprecated 5094 public static final String DATA_ROAMING = Global.DATA_ROAMING; 5095 5096 /** 5097 * Setting to record the input method used by default, holding the ID 5098 * of the desired method. 5099 */ 5100 public static final String DEFAULT_INPUT_METHOD = "default_input_method"; 5101 5102 /** 5103 * Setting to record the input method subtype used by default, holding the ID 5104 * of the desired method. 5105 */ 5106 public static final String SELECTED_INPUT_METHOD_SUBTYPE = 5107 "selected_input_method_subtype"; 5108 5109 /** 5110 * Setting to record the history of input method subtype, holding the pair of ID of IME 5111 * and its last used subtype. 5112 * @hide 5113 */ 5114 public static final String INPUT_METHODS_SUBTYPE_HISTORY = 5115 "input_methods_subtype_history"; 5116 5117 /** 5118 * Setting to record the visibility of input method selector 5119 */ 5120 public static final String INPUT_METHOD_SELECTOR_VISIBILITY = 5121 "input_method_selector_visibility"; 5122 5123 /** 5124 * The currently selected voice interaction service flattened ComponentName. 5125 * @hide 5126 */ 5127 @TestApi 5128 public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; 5129 5130 /** 5131 * The currently selected autofill service flattened ComponentName. 5132 * @hide 5133 */ 5134 @TestApi 5135 public static final String AUTOFILL_SERVICE = "autofill_service"; 5136 5137 /** 5138 * bluetooth HCI snoop log configuration 5139 * @hide 5140 */ 5141 public static final String BLUETOOTH_HCI_LOG = 5142 "bluetooth_hci_log"; 5143 5144 /** 5145 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead 5146 */ 5147 @Deprecated 5148 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED; 5149 5150 /** 5151 * Whether the current user has been set up via setup wizard (0 = false, 1 = true) 5152 * @hide 5153 */ 5154 public static final String USER_SETUP_COMPLETE = "user_setup_complete"; 5155 5156 /** 5157 * Prefix for category name that marks whether a suggested action from that category was 5158 * completed. 5159 * @hide 5160 */ 5161 public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category."; 5162 5163 /** 5164 * List of input methods that are currently enabled. This is a string 5165 * containing the IDs of all enabled input methods, each ID separated 5166 * by ':'. 5167 */ 5168 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; 5169 5170 /** 5171 * List of system input methods that are currently disabled. This is a string 5172 * containing the IDs of all disabled input methods, each ID separated 5173 * by ':'. 5174 * @hide 5175 */ 5176 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods"; 5177 5178 /** 5179 * Whether to show the IME when a hard keyboard is connected. This is a boolean that 5180 * determines if the IME should be shown when a hard keyboard is attached. 5181 * @hide 5182 */ 5183 public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; 5184 5185 /** 5186 * Host name and port for global http proxy. Uses ':' seperator for 5187 * between host and port. 5188 * 5189 * @deprecated Use {@link Global#HTTP_PROXY} 5190 */ 5191 @Deprecated 5192 public static final String HTTP_PROXY = Global.HTTP_PROXY; 5193 5194 /** 5195 * Package designated as always-on VPN provider. 5196 * 5197 * @hide 5198 */ 5199 public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app"; 5200 5201 /** 5202 * Whether to block networking outside of VPN connections while always-on is set. 5203 * @see #ALWAYS_ON_VPN_APP 5204 * 5205 * @hide 5206 */ 5207 public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown"; 5208 5209 /** 5210 * Whether applications can be installed for this user via the system's 5211 * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism. 5212 * 5213 * <p>1 = permit app installation via the system package installer intent 5214 * <p>0 = do not allow use of the package installer 5215 * @deprecated Starting from {@link android.os.Build.VERSION_CODES#O}, apps should use 5216 * {@link PackageManager#canRequestPackageInstalls()} 5217 * @see PackageManager#canRequestPackageInstalls() 5218 */ 5219 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 5220 5221 /** 5222 * A flag to tell {@link com.android.server.devicepolicy.DevicePolicyManagerService} that 5223 * the default for {@link #INSTALL_NON_MARKET_APPS} is reversed for this user on OTA. So it 5224 * can set the restriction {@link android.os.UserManager#DISALLOW_INSTALL_UNKNOWN_SOURCES} 5225 * on behalf of the profile owner if needed to make the change transparent for profile 5226 * owners. 5227 * 5228 * @hide 5229 */ 5230 public static final String UNKNOWN_SOURCES_DEFAULT_REVERSED = 5231 "unknown_sources_default_reversed"; 5232 5233 /** 5234 * Comma-separated list of location providers that activities may access. Do not rely on 5235 * this value being present in settings.db or on ContentObserver notifications on the 5236 * corresponding Uri. 5237 * 5238 * @deprecated use {@link #LOCATION_MODE} and 5239 * {@link LocationManager#MODE_CHANGED_ACTION} (or 5240 * {@link LocationManager#PROVIDERS_CHANGED_ACTION}) 5241 */ 5242 @Deprecated 5243 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; 5244 5245 /** 5246 * The degree of location access enabled by the user. 5247 * <p> 5248 * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link 5249 * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link 5250 * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link 5251 * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location 5252 * modes that might be added in the future. 5253 * <p> 5254 * Note: do not rely on this value being present in settings.db or on ContentObserver 5255 * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} 5256 * to receive changes in this value. 5257 */ 5258 public static final String LOCATION_MODE = "location_mode"; 5259 /** 5260 * Stores the previous location mode when {@link #LOCATION_MODE} is set to 5261 * {@link #LOCATION_MODE_OFF} 5262 * @hide 5263 */ 5264 public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode"; 5265 5266 /** 5267 * Sets all location providers to the previous states before location was turned off. 5268 * @hide 5269 */ 5270 public static final int LOCATION_MODE_PREVIOUS = -1; 5271 /** 5272 * Location access disabled. 5273 */ 5274 public static final int LOCATION_MODE_OFF = 0; 5275 /** 5276 * Network Location Provider disabled, but GPS and other sensors enabled. 5277 */ 5278 public static final int LOCATION_MODE_SENSORS_ONLY = 1; 5279 /** 5280 * Reduced power usage, such as limiting the number of GPS updates per hour. Requests 5281 * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to 5282 * {@link android.location.Criteria#POWER_MEDIUM}. 5283 */ 5284 public static final int LOCATION_MODE_BATTERY_SAVING = 2; 5285 /** 5286 * Best-effort location computation allowed. 5287 */ 5288 public static final int LOCATION_MODE_HIGH_ACCURACY = 3; 5289 5290 /** 5291 * A flag containing settings used for biometric weak 5292 * @hide 5293 */ 5294 @Deprecated 5295 public static final String LOCK_BIOMETRIC_WEAK_FLAGS = 5296 "lock_biometric_weak_flags"; 5297 5298 /** 5299 * Whether lock-to-app will lock the keyguard when exiting. 5300 * @hide 5301 */ 5302 public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked"; 5303 5304 /** 5305 * Whether autolock is enabled (0 = false, 1 = true) 5306 * 5307 * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security 5308 * level of the keyguard. Accessing this setting from an app that is targeting 5309 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}. 5310 */ 5311 @Deprecated 5312 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; 5313 5314 /** 5315 * Whether lock pattern is visible as user enters (0 = false, 1 = true) 5316 * 5317 * @deprecated Accessing this setting from an app that is targeting 5318 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}. 5319 */ 5320 @Deprecated 5321 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; 5322 5323 /** 5324 * Whether lock pattern will vibrate as user enters (0 = false, 1 = 5325 * true) 5326 * 5327 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the 5328 * lockscreen uses 5329 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}. 5330 * Accessing this setting from an app that is targeting 5331 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}. 5332 */ 5333 @Deprecated 5334 public static final String 5335 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; 5336 5337 /** 5338 * This preference allows the device to be locked given time after screen goes off, 5339 * subject to current DeviceAdmin policy limits. 5340 * @hide 5341 */ 5342 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout"; 5343 5344 5345 /** 5346 * This preference contains the string that shows for owner info on LockScreen. 5347 * @hide 5348 * @deprecated 5349 */ 5350 @Deprecated 5351 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info"; 5352 5353 /** 5354 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited). 5355 * @hide 5356 */ 5357 @Deprecated 5358 public static final String LOCK_SCREEN_APPWIDGET_IDS = 5359 "lock_screen_appwidget_ids"; 5360 5361 /** 5362 * Id of the appwidget shown on the lock screen when appwidgets are disabled. 5363 * @hide 5364 */ 5365 @Deprecated 5366 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID = 5367 "lock_screen_fallback_appwidget_id"; 5368 5369 /** 5370 * Index of the lockscreen appwidget to restore, -1 if none. 5371 * @hide 5372 */ 5373 @Deprecated 5374 public static final String LOCK_SCREEN_STICKY_APPWIDGET = 5375 "lock_screen_sticky_appwidget"; 5376 5377 /** 5378 * This preference enables showing the owner info on LockScreen. 5379 * @hide 5380 * @deprecated 5381 */ 5382 @Deprecated 5383 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = 5384 "lock_screen_owner_info_enabled"; 5385 5386 /** 5387 * When set by a user, allows notifications to be shown atop a securely locked screen 5388 * in their full "private" form (same as when the device is unlocked). 5389 * @hide 5390 */ 5391 public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = 5392 "lock_screen_allow_private_notifications"; 5393 5394 /** 5395 * When set by a user, allows notification remote input atop a securely locked screen 5396 * without having to unlock 5397 * @hide 5398 */ 5399 public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT = 5400 "lock_screen_allow_remote_input"; 5401 5402 /** 5403 * Set by the system to track if the user needs to see the call to action for 5404 * the lockscreen notification policy. 5405 * @hide 5406 */ 5407 public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING = 5408 "show_note_about_notification_hiding"; 5409 5410 /** 5411 * Set to 1 by the system after trust agents have been initialized. 5412 * @hide 5413 */ 5414 public static final String TRUST_AGENTS_INITIALIZED = 5415 "trust_agents_initialized"; 5416 5417 /** 5418 * The Logging ID (a unique 64-bit value) as a hex string. 5419 * Used as a pseudonymous identifier for logging. 5420 * @deprecated This identifier is poorly initialized and has 5421 * many collisions. It should not be used. 5422 */ 5423 @Deprecated 5424 public static final String LOGGING_ID = "logging_id"; 5425 5426 /** 5427 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead 5428 */ 5429 @Deprecated 5430 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE; 5431 5432 /** 5433 * No longer supported. 5434 */ 5435 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 5436 5437 /** 5438 * No longer supported. 5439 */ 5440 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 5441 5442 /** 5443 * No longer supported. 5444 */ 5445 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 5446 5447 /** 5448 * Settings classname to launch when Settings is clicked from All 5449 * Applications. Needed because of user testing between the old 5450 * and new Settings apps. 5451 */ 5452 // TODO: 881807 5453 public static final String SETTINGS_CLASSNAME = "settings_classname"; 5454 5455 /** 5456 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead 5457 */ 5458 @Deprecated 5459 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; 5460 5461 /** 5462 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead 5463 */ 5464 @Deprecated 5465 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL; 5466 5467 /** 5468 * If accessibility is enabled. 5469 */ 5470 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; 5471 5472 /** 5473 * Setting specifying if the accessibility shortcut dialog has been shown to this user. 5474 * @hide 5475 */ 5476 public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN = 5477 "accessibility_shortcut_dialog_shown"; 5478 5479 /** 5480 * Setting specifying the the accessibility service to be toggled via the accessibility 5481 * shortcut. Must be its flattened {@link ComponentName}. 5482 * @hide 5483 */ 5484 public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE = 5485 "accessibility_shortcut_target_service"; 5486 5487 /** 5488 * If touch exploration is enabled. 5489 */ 5490 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; 5491 5492 /** 5493 * List of the enabled accessibility providers. 5494 */ 5495 public static final String ENABLED_ACCESSIBILITY_SERVICES = 5496 "enabled_accessibility_services"; 5497 5498 /** 5499 * List of the accessibility services to which the user has granted 5500 * permission to put the device into touch exploration mode. 5501 * 5502 * @hide 5503 */ 5504 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = 5505 "touch_exploration_granted_accessibility_services"; 5506 5507 /** 5508 * Whether to speak passwords while in accessibility mode. 5509 * 5510 * @deprecated The speaking of passwords is controlled by individual accessibility services. 5511 * Apps should ignore this setting and provide complete information to accessibility 5512 * at all times, which was the behavior when this value was {@code true}. 5513 */ 5514 @Deprecated 5515 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; 5516 5517 /** 5518 * Whether to draw text with high contrast while in accessibility mode. 5519 * 5520 * @hide 5521 */ 5522 public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED = 5523 "high_text_contrast_enabled"; 5524 5525 /** 5526 * If injection of accessibility enhancing JavaScript screen-reader 5527 * is enabled. 5528 * <p> 5529 * Note: The JavaScript based screen-reader is served by the 5530 * Google infrastructure and enable users with disabilities to 5531 * efficiently navigate in and explore web content. 5532 * </p> 5533 * <p> 5534 * This property represents a boolean value. 5535 * </p> 5536 * @hide 5537 */ 5538 public static final String ACCESSIBILITY_SCRIPT_INJECTION = 5539 "accessibility_script_injection"; 5540 5541 /** 5542 * The URL for the injected JavaScript based screen-reader used 5543 * for providing accessibility of content in WebView. 5544 * <p> 5545 * Note: The JavaScript based screen-reader is served by the 5546 * Google infrastructure and enable users with disabilities to 5547 * efficiently navigate in and explore web content. 5548 * </p> 5549 * <p> 5550 * This property represents a string value. 5551 * </p> 5552 * @hide 5553 */ 5554 public static final String ACCESSIBILITY_SCREEN_READER_URL = 5555 "accessibility_script_injection_url"; 5556 5557 /** 5558 * Key bindings for navigation in built-in accessibility support for web content. 5559 * <p> 5560 * Note: These key bindings are for the built-in accessibility navigation for 5561 * web content which is used as a fall back solution if JavaScript in a WebView 5562 * is not enabled or the user has not opted-in script injection from Google. 5563 * </p> 5564 * <p> 5565 * The bindings are separated by semi-colon. A binding is a mapping from 5566 * a key to a sequence of actions (for more details look at 5567 * android.webkit.AccessibilityInjector). A key is represented as the hexademical 5568 * string representation of an integer obtained from a meta state (optional) shifted 5569 * sixteen times left and bitwise ored with a key code. An action is represented 5570 * as a hexademical string representation of an integer where the first two digits 5571 * are navigation action index, the second, the third, and the fourth digit pairs 5572 * represent the action arguments. The separate actions in a binding are colon 5573 * separated. The key and the action sequence it maps to are separated by equals. 5574 * </p> 5575 * <p> 5576 * For example, the binding below maps the DPAD right button to traverse the 5577 * current navigation axis once without firing an accessibility event and to 5578 * perform the same traversal again but to fire an event: 5579 * <code> 5580 * 0x16=0x01000100:0x01000101; 5581 * </code> 5582 * </p> 5583 * <p> 5584 * The goal of this binding is to enable dynamic rebinding of keys to 5585 * navigation actions for web content without requiring a framework change. 5586 * </p> 5587 * <p> 5588 * This property represents a string value. 5589 * </p> 5590 * @hide 5591 */ 5592 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS = 5593 "accessibility_web_content_key_bindings"; 5594 5595 /** 5596 * Setting that specifies whether the display magnification is enabled. 5597 * Display magnifications allows the user to zoom in the display content 5598 * and is targeted to low vision users. The current magnification scale 5599 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}. 5600 * 5601 * @hide 5602 */ 5603 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = 5604 "accessibility_display_magnification_enabled"; 5605 5606 /** 5607 * Setting that specifies what the display magnification scale is. 5608 * Display magnifications allows the user to zoom in the display 5609 * content and is targeted to low vision users. Whether a display 5610 * magnification is performed is controlled by 5611 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} 5612 * 5613 * @hide 5614 */ 5615 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = 5616 "accessibility_display_magnification_scale"; 5617 5618 /** 5619 * Unused mangnification setting 5620 * 5621 * @hide 5622 * @deprecated 5623 */ 5624 @Deprecated 5625 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE = 5626 "accessibility_display_magnification_auto_update"; 5627 5628 /** 5629 * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be 5630 * modified from an AccessibilityService using the SoftKeyboardController. 5631 * 5632 * @hide 5633 */ 5634 public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE = 5635 "accessibility_soft_keyboard_mode"; 5636 5637 /** 5638 * Default soft keyboard behavior. 5639 * 5640 * @hide 5641 */ 5642 public static final int SHOW_MODE_AUTO = 0; 5643 5644 /** 5645 * Soft keyboard is never shown. 5646 * 5647 * @hide 5648 */ 5649 public static final int SHOW_MODE_HIDDEN = 1; 5650 5651 /** 5652 * Setting that specifies whether timed text (captions) should be 5653 * displayed in video content. Text display properties are controlled by 5654 * the following settings: 5655 * <ul> 5656 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE} 5657 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR} 5658 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR} 5659 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR} 5660 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE} 5661 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE} 5662 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE} 5663 * </ul> 5664 * 5665 * @hide 5666 */ 5667 public static final String ACCESSIBILITY_CAPTIONING_ENABLED = 5668 "accessibility_captioning_enabled"; 5669 5670 /** 5671 * Setting that specifies the language for captions as a locale string, 5672 * e.g. en_US. 5673 * 5674 * @see java.util.Locale#toString 5675 * @hide 5676 */ 5677 public static final String ACCESSIBILITY_CAPTIONING_LOCALE = 5678 "accessibility_captioning_locale"; 5679 5680 /** 5681 * Integer property that specifies the preset style for captions, one 5682 * of: 5683 * <ul> 5684 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM} 5685 * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS} 5686 * </ul> 5687 * 5688 * @see java.util.Locale#toString 5689 * @hide 5690 */ 5691 public static final String ACCESSIBILITY_CAPTIONING_PRESET = 5692 "accessibility_captioning_preset"; 5693 5694 /** 5695 * Integer property that specifes the background color for captions as a 5696 * packed 32-bit color. 5697 * 5698 * @see android.graphics.Color#argb 5699 * @hide 5700 */ 5701 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR = 5702 "accessibility_captioning_background_color"; 5703 5704 /** 5705 * Integer property that specifes the foreground color for captions as a 5706 * packed 32-bit color. 5707 * 5708 * @see android.graphics.Color#argb 5709 * @hide 5710 */ 5711 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR = 5712 "accessibility_captioning_foreground_color"; 5713 5714 /** 5715 * Integer property that specifes the edge type for captions, one of: 5716 * <ul> 5717 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE} 5718 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE} 5719 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW} 5720 * </ul> 5721 * 5722 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR 5723 * @hide 5724 */ 5725 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE = 5726 "accessibility_captioning_edge_type"; 5727 5728 /** 5729 * Integer property that specifes the edge color for captions as a 5730 * packed 32-bit color. 5731 * 5732 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE 5733 * @see android.graphics.Color#argb 5734 * @hide 5735 */ 5736 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR = 5737 "accessibility_captioning_edge_color"; 5738 5739 /** 5740 * Integer property that specifes the window color for captions as a 5741 * packed 32-bit color. 5742 * 5743 * @see android.graphics.Color#argb 5744 * @hide 5745 */ 5746 public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR = 5747 "accessibility_captioning_window_color"; 5748 5749 /** 5750 * String property that specifies the typeface for captions, one of: 5751 * <ul> 5752 * <li>DEFAULT 5753 * <li>MONOSPACE 5754 * <li>SANS_SERIF 5755 * <li>SERIF 5756 * </ul> 5757 * 5758 * @see android.graphics.Typeface 5759 * @hide 5760 */ 5761 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE = 5762 "accessibility_captioning_typeface"; 5763 5764 /** 5765 * Floating point property that specifies font scaling for captions. 5766 * 5767 * @hide 5768 */ 5769 public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE = 5770 "accessibility_captioning_font_scale"; 5771 5772 /** 5773 * Setting that specifies whether display color inversion is enabled. 5774 */ 5775 public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = 5776 "accessibility_display_inversion_enabled"; 5777 5778 /** 5779 * Setting that specifies whether display color space adjustment is 5780 * enabled. 5781 * 5782 * @hide 5783 */ 5784 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED = 5785 "accessibility_display_daltonizer_enabled"; 5786 5787 /** 5788 * Integer property that specifies the type of color space adjustment to 5789 * perform. Valid values are defined in AccessibilityManager. 5790 * 5791 * @hide 5792 */ 5793 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER = 5794 "accessibility_display_daltonizer"; 5795 5796 /** 5797 * Setting that specifies whether automatic click when the mouse pointer stops moving is 5798 * enabled. 5799 * 5800 * @hide 5801 */ 5802 public static final String ACCESSIBILITY_AUTOCLICK_ENABLED = 5803 "accessibility_autoclick_enabled"; 5804 5805 /** 5806 * Integer setting specifying amount of time in ms the mouse pointer has to stay still 5807 * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set. 5808 * 5809 * @see #ACCESSIBILITY_AUTOCLICK_ENABLED 5810 * @hide 5811 */ 5812 public static final String ACCESSIBILITY_AUTOCLICK_DELAY = 5813 "accessibility_autoclick_delay"; 5814 5815 /** 5816 * Whether or not larger size icons are used for the pointer of mouse/trackpad for 5817 * accessibility. 5818 * (0 = false, 1 = true) 5819 * @hide 5820 */ 5821 public static final String ACCESSIBILITY_LARGE_POINTER_ICON = 5822 "accessibility_large_pointer_icon"; 5823 5824 /** 5825 * The timeout for considering a press to be a long press in milliseconds. 5826 * @hide 5827 */ 5828 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout"; 5829 5830 /** 5831 * The duration in milliseconds between the first tap's up event and the second tap's 5832 * down event for an interaction to be considered part of the same multi-press. 5833 * @hide 5834 */ 5835 public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout"; 5836 5837 /** 5838 * List of the enabled print services. 5839 * 5840 * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade 5841 * from pre-N. 5842 * 5843 * @hide 5844 */ 5845 public static final String ENABLED_PRINT_SERVICES = 5846 "enabled_print_services"; 5847 5848 /** 5849 * List of the disabled print services. 5850 * 5851 * @hide 5852 */ 5853 public static final String DISABLED_PRINT_SERVICES = 5854 "disabled_print_services"; 5855 5856 /** 5857 * The saved value for WindowManagerService.setForcedDisplayDensity() 5858 * formatted as a single integer representing DPI. If unset, then use 5859 * the real display density. 5860 * 5861 * @hide 5862 */ 5863 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced"; 5864 5865 /** 5866 * Setting to always use the default text-to-speech settings regardless 5867 * of the application settings. 5868 * 1 = override application settings, 5869 * 0 = use application settings (if specified). 5870 * 5871 * @deprecated The value of this setting is no longer respected by 5872 * the framework text to speech APIs as of the Ice Cream Sandwich release. 5873 */ 5874 @Deprecated 5875 public static final String TTS_USE_DEFAULTS = "tts_use_defaults"; 5876 5877 /** 5878 * Default text-to-speech engine speech rate. 100 = 1x 5879 */ 5880 public static final String TTS_DEFAULT_RATE = "tts_default_rate"; 5881 5882 /** 5883 * Default text-to-speech engine pitch. 100 = 1x 5884 */ 5885 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch"; 5886 5887 /** 5888 * Default text-to-speech engine. 5889 */ 5890 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth"; 5891 5892 /** 5893 * Default text-to-speech language. 5894 * 5895 * @deprecated this setting is no longer in use, as of the Ice Cream 5896 * Sandwich release. Apps should never need to read this setting directly, 5897 * instead can query the TextToSpeech framework classes for the default 5898 * locale. {@link TextToSpeech#getLanguage()}. 5899 */ 5900 @Deprecated 5901 public static final String TTS_DEFAULT_LANG = "tts_default_lang"; 5902 5903 /** 5904 * Default text-to-speech country. 5905 * 5906 * @deprecated this setting is no longer in use, as of the Ice Cream 5907 * Sandwich release. Apps should never need to read this setting directly, 5908 * instead can query the TextToSpeech framework classes for the default 5909 * locale. {@link TextToSpeech#getLanguage()}. 5910 */ 5911 @Deprecated 5912 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country"; 5913 5914 /** 5915 * Default text-to-speech locale variant. 5916 * 5917 * @deprecated this setting is no longer in use, as of the Ice Cream 5918 * Sandwich release. Apps should never need to read this setting directly, 5919 * instead can query the TextToSpeech framework classes for the 5920 * locale that is in use {@link TextToSpeech#getLanguage()}. 5921 */ 5922 @Deprecated 5923 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant"; 5924 5925 /** 5926 * Stores the default tts locales on a per engine basis. Stored as 5927 * a comma seperated list of values, each value being of the form 5928 * {@code engine_name:locale} for example, 5929 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This 5930 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and 5931 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this 5932 * setting directly, and can query the TextToSpeech framework classes 5933 * for the locale that is in use. 5934 * 5935 * @hide 5936 */ 5937 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale"; 5938 5939 /** 5940 * Space delimited list of plugin packages that are enabled. 5941 */ 5942 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins"; 5943 5944 /** 5945 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} 5946 * instead. 5947 */ 5948 @Deprecated 5949 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 5950 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; 5951 5952 /** 5953 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} 5954 * instead. 5955 */ 5956 @Deprecated 5957 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 5958 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; 5959 5960 /** 5961 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} 5962 * instead. 5963 */ 5964 @Deprecated 5965 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = 5966 Global.WIFI_NUM_OPEN_NETWORKS_KEPT; 5967 5968 /** 5969 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} 5970 * instead. 5971 */ 5972 @Deprecated 5973 public static final String WIFI_ON = Global.WIFI_ON; 5974 5975 /** 5976 * The acceptable packet loss percentage (range 0 - 100) before trying 5977 * another AP on the same network. 5978 * @deprecated This setting is not used. 5979 */ 5980 @Deprecated 5981 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = 5982 "wifi_watchdog_acceptable_packet_loss_percentage"; 5983 5984 /** 5985 * The number of access points required for a network in order for the 5986 * watchdog to monitor it. 5987 * @deprecated This setting is not used. 5988 */ 5989 @Deprecated 5990 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; 5991 5992 /** 5993 * The delay between background checks. 5994 * @deprecated This setting is not used. 5995 */ 5996 @Deprecated 5997 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = 5998 "wifi_watchdog_background_check_delay_ms"; 5999 6000 /** 6001 * Whether the Wi-Fi watchdog is enabled for background checking even 6002 * after it thinks the user has connected to a good access point. 6003 * @deprecated This setting is not used. 6004 */ 6005 @Deprecated 6006 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = 6007 "wifi_watchdog_background_check_enabled"; 6008 6009 /** 6010 * The timeout for a background ping 6011 * @deprecated This setting is not used. 6012 */ 6013 @Deprecated 6014 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = 6015 "wifi_watchdog_background_check_timeout_ms"; 6016 6017 /** 6018 * The number of initial pings to perform that *may* be ignored if they 6019 * fail. Again, if these fail, they will *not* be used in packet loss 6020 * calculation. For example, one network always seemed to time out for 6021 * the first couple pings, so this is set to 3 by default. 6022 * @deprecated This setting is not used. 6023 */ 6024 @Deprecated 6025 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = 6026 "wifi_watchdog_initial_ignored_ping_count"; 6027 6028 /** 6029 * The maximum number of access points (per network) to attempt to test. 6030 * If this number is reached, the watchdog will no longer monitor the 6031 * initial connection state for the network. This is a safeguard for 6032 * networks containing multiple APs whose DNS does not respond to pings. 6033 * @deprecated This setting is not used. 6034 */ 6035 @Deprecated 6036 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; 6037 6038 /** 6039 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead 6040 */ 6041 @Deprecated 6042 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 6043 6044 /** 6045 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled. 6046 * @deprecated This setting is not used. 6047 */ 6048 @Deprecated 6049 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list"; 6050 6051 /** 6052 * The number of pings to test if an access point is a good connection. 6053 * @deprecated This setting is not used. 6054 */ 6055 @Deprecated 6056 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; 6057 6058 /** 6059 * The delay between pings. 6060 * @deprecated This setting is not used. 6061 */ 6062 @Deprecated 6063 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; 6064 6065 /** 6066 * The timeout per ping. 6067 * @deprecated This setting is not used. 6068 */ 6069 @Deprecated 6070 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; 6071 6072 /** 6073 * @deprecated Use 6074 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead 6075 */ 6076 @Deprecated 6077 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT; 6078 6079 /** 6080 * @deprecated Use 6081 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead 6082 */ 6083 @Deprecated 6084 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 6085 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; 6086 6087 /** 6088 * The number of milliseconds to hold on to a PendingIntent based request. This delay gives 6089 * the receivers of the PendingIntent an opportunity to make a new network request before 6090 * the Network satisfying the request is potentially removed. 6091 * 6092 * @hide 6093 */ 6094 public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS = 6095 "connectivity_release_pending_intent_delay_ms"; 6096 6097 /** 6098 * Whether background data usage is allowed. 6099 * 6100 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, 6101 * availability of background data depends on several 6102 * combined factors. When background data is unavailable, 6103 * {@link ConnectivityManager#getActiveNetworkInfo()} will 6104 * now appear disconnected. 6105 */ 6106 @Deprecated 6107 public static final String BACKGROUND_DATA = "background_data"; 6108 6109 /** 6110 * Origins for which browsers should allow geolocation by default. 6111 * The value is a space-separated list of origins. 6112 */ 6113 public static final String ALLOWED_GEOLOCATION_ORIGINS 6114 = "allowed_geolocation_origins"; 6115 6116 /** 6117 * The preferred TTY mode 0 = TTy Off, CDMA default 6118 * 1 = TTY Full 6119 * 2 = TTY HCO 6120 * 3 = TTY VCO 6121 * @hide 6122 */ 6123 public static final String PREFERRED_TTY_MODE = 6124 "preferred_tty_mode"; 6125 6126 /** 6127 * Whether the enhanced voice privacy mode is enabled. 6128 * 0 = normal voice privacy 6129 * 1 = enhanced voice privacy 6130 * @hide 6131 */ 6132 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled"; 6133 6134 /** 6135 * Whether the TTY mode mode is enabled. 6136 * 0 = disabled 6137 * 1 = enabled 6138 * @hide 6139 */ 6140 public static final String TTY_MODE_ENABLED = "tty_mode_enabled"; 6141 6142 /** 6143 * Controls whether settings backup is enabled. 6144 * Type: int ( 0 = disabled, 1 = enabled ) 6145 * @hide 6146 */ 6147 public static final String BACKUP_ENABLED = "backup_enabled"; 6148 6149 /** 6150 * Controls whether application data is automatically restored from backup 6151 * at install time. 6152 * Type: int ( 0 = disabled, 1 = enabled ) 6153 * @hide 6154 */ 6155 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; 6156 6157 /** 6158 * Indicates whether settings backup has been fully provisioned. 6159 * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) 6160 * @hide 6161 */ 6162 public static final String BACKUP_PROVISIONED = "backup_provisioned"; 6163 6164 /** 6165 * Component of the transport to use for backup/restore. 6166 * @hide 6167 */ 6168 public static final String BACKUP_TRANSPORT = "backup_transport"; 6169 6170 /** 6171 * Version for which the setup wizard was last shown. Bumped for 6172 * each release when there is new setup information to show. 6173 * @hide 6174 */ 6175 public static final String LAST_SETUP_SHOWN = "last_setup_shown"; 6176 6177 /** 6178 * The interval in milliseconds after which Wi-Fi is considered idle. 6179 * When idle, it is possible for the device to be switched from Wi-Fi to 6180 * the mobile data network. 6181 * @hide 6182 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS} 6183 * instead. 6184 */ 6185 @Deprecated 6186 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS; 6187 6188 /** 6189 * The global search provider chosen by the user (if multiple global 6190 * search providers are installed). This will be the provider returned 6191 * by {@link SearchManager#getGlobalSearchActivity()} if it's still 6192 * installed. This setting is stored as a flattened component name as 6193 * per {@link ComponentName#flattenToString()}. 6194 * 6195 * @hide 6196 */ 6197 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY = 6198 "search_global_search_activity"; 6199 6200 /** 6201 * The number of promoted sources in GlobalSearch. 6202 * @hide 6203 */ 6204 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources"; 6205 /** 6206 * The maximum number of suggestions returned by GlobalSearch. 6207 * @hide 6208 */ 6209 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display"; 6210 /** 6211 * The number of suggestions GlobalSearch will ask each non-web search source for. 6212 * @hide 6213 */ 6214 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source"; 6215 /** 6216 * The number of suggestions the GlobalSearch will ask the web search source for. 6217 * @hide 6218 */ 6219 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT = 6220 "search_web_results_override_limit"; 6221 /** 6222 * The number of milliseconds that GlobalSearch will wait for suggestions from 6223 * promoted sources before continuing with all other sources. 6224 * @hide 6225 */ 6226 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS = 6227 "search_promoted_source_deadline_millis"; 6228 /** 6229 * The number of milliseconds before GlobalSearch aborts search suggesiton queries. 6230 * @hide 6231 */ 6232 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis"; 6233 /** 6234 * The maximum number of milliseconds that GlobalSearch shows the previous results 6235 * after receiving a new query. 6236 * @hide 6237 */ 6238 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis"; 6239 /** 6240 * The maximum age of log data used for shortcuts in GlobalSearch. 6241 * @hide 6242 */ 6243 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis"; 6244 /** 6245 * The maximum age of log data used for source ranking in GlobalSearch. 6246 * @hide 6247 */ 6248 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS = 6249 "search_max_source_event_age_millis"; 6250 /** 6251 * The minimum number of impressions needed to rank a source in GlobalSearch. 6252 * @hide 6253 */ 6254 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING = 6255 "search_min_impressions_for_source_ranking"; 6256 /** 6257 * The minimum number of clicks needed to rank a source in GlobalSearch. 6258 * @hide 6259 */ 6260 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING = 6261 "search_min_clicks_for_source_ranking"; 6262 /** 6263 * The maximum number of shortcuts shown by GlobalSearch. 6264 * @hide 6265 */ 6266 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned"; 6267 /** 6268 * The size of the core thread pool for suggestion queries in GlobalSearch. 6269 * @hide 6270 */ 6271 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE = 6272 "search_query_thread_core_pool_size"; 6273 /** 6274 * The maximum size of the thread pool for suggestion queries in GlobalSearch. 6275 * @hide 6276 */ 6277 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE = 6278 "search_query_thread_max_pool_size"; 6279 /** 6280 * The size of the core thread pool for shortcut refreshing in GlobalSearch. 6281 * @hide 6282 */ 6283 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE = 6284 "search_shortcut_refresh_core_pool_size"; 6285 /** 6286 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch. 6287 * @hide 6288 */ 6289 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE = 6290 "search_shortcut_refresh_max_pool_size"; 6291 /** 6292 * The maximun time that excess threads in the GlobalSeach thread pools will 6293 * wait before terminating. 6294 * @hide 6295 */ 6296 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS = 6297 "search_thread_keepalive_seconds"; 6298 /** 6299 * The maximum number of concurrent suggestion queries to each source. 6300 * @hide 6301 */ 6302 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT = 6303 "search_per_source_concurrent_query_limit"; 6304 6305 /** 6306 * Whether or not alert sounds are played on StorageManagerService events. 6307 * (0 = false, 1 = true) 6308 * @hide 6309 */ 6310 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; 6311 6312 /** 6313 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true) 6314 * @hide 6315 */ 6316 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart"; 6317 6318 /** 6319 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true) 6320 * @hide 6321 */ 6322 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt"; 6323 6324 /** 6325 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true) 6326 * @hide 6327 */ 6328 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled"; 6329 6330 /** 6331 * If nonzero, ANRs in invisible background processes bring up a dialog. 6332 * Otherwise, the process will be silently killed. 6333 * 6334 * Also prevents ANRs and crash dialogs from being suppressed. 6335 * @hide 6336 */ 6337 public static final String ANR_SHOW_BACKGROUND = "anr_show_background"; 6338 6339 /** 6340 * The {@link ComponentName} string of the service to be used as the voice recognition 6341 * service. 6342 * 6343 * @hide 6344 */ 6345 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service"; 6346 6347 /** 6348 * Stores whether an user has consented to have apps verified through PAM. 6349 * The value is boolean (1 or 0). 6350 * 6351 * @hide 6352 */ 6353 public static final String PACKAGE_VERIFIER_USER_CONSENT = 6354 "package_verifier_user_consent"; 6355 6356 /** 6357 * The {@link ComponentName} string of the selected spell checker service which is 6358 * one of the services managed by the text service manager. 6359 * 6360 * @hide 6361 */ 6362 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker"; 6363 6364 /** 6365 * The {@link ComponentName} string of the selected subtype of the selected spell checker 6366 * service which is one of the services managed by the text service manager. 6367 * 6368 * @hide 6369 */ 6370 public static final String SELECTED_SPELL_CHECKER_SUBTYPE = 6371 "selected_spell_checker_subtype"; 6372 6373 /** 6374 * The {@link ComponentName} string whether spell checker is enabled or not. 6375 * 6376 * @hide 6377 */ 6378 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled"; 6379 6380 /** 6381 * What happens when the user presses the Power button while in-call 6382 * and the screen is on.<br/> 6383 * <b>Values:</b><br/> 6384 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/> 6385 * 2 - The Power button hangs up the current call.<br/> 6386 * 6387 * @hide 6388 */ 6389 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior"; 6390 6391 /** 6392 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen". 6393 * @hide 6394 */ 6395 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1; 6396 6397 /** 6398 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up". 6399 * @hide 6400 */ 6401 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2; 6402 6403 /** 6404 * INCALL_POWER_BUTTON_BEHAVIOR default value. 6405 * @hide 6406 */ 6407 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT = 6408 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF; 6409 6410 /** 6411 * What happens when the user presses the Back button while in-call 6412 * and the screen is on.<br/> 6413 * <b>Values:</b><br/> 6414 * 0 - The Back buttons does nothing different.<br/> 6415 * 1 - The Back button hangs up the current call.<br/> 6416 * 6417 * @hide 6418 */ 6419 public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior"; 6420 6421 /** 6422 * INCALL_BACK_BUTTON_BEHAVIOR value for no action. 6423 * @hide 6424 */ 6425 public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0; 6426 6427 /** 6428 * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up". 6429 * @hide 6430 */ 6431 public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1; 6432 6433 /** 6434 * INCALL_POWER_BUTTON_BEHAVIOR default value. 6435 * @hide 6436 */ 6437 public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT = 6438 INCALL_BACK_BUTTON_BEHAVIOR_NONE; 6439 6440 /** 6441 * Whether the device should wake when the wake gesture sensor detects motion. 6442 * @hide 6443 */ 6444 public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled"; 6445 6446 /** 6447 * Whether the device should doze if configured. 6448 * @hide 6449 */ 6450 public static final String DOZE_ENABLED = "doze_enabled"; 6451 6452 /** 6453 * Whether doze should be always on. 6454 * @hide 6455 */ 6456 public static final String DOZE_ALWAYS_ON = "doze_always_on"; 6457 6458 /** 6459 * Whether the device should pulse on pick up gesture. 6460 * @hide 6461 */ 6462 public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up"; 6463 6464 /** 6465 * Whether the device should pulse on double tap gesture. 6466 * @hide 6467 */ 6468 public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap"; 6469 6470 /** 6471 * The current night mode that has been selected by the user. Owned 6472 * and controlled by UiModeManagerService. Constants are as per 6473 * UiModeManager. 6474 * @hide 6475 */ 6476 public static final String UI_NIGHT_MODE = "ui_night_mode"; 6477 6478 /** 6479 * Whether screensavers are enabled. 6480 * @hide 6481 */ 6482 public static final String SCREENSAVER_ENABLED = "screensaver_enabled"; 6483 6484 /** 6485 * The user's chosen screensaver components. 6486 * 6487 * These will be launched by the PhoneWindowManager after a timeout when not on 6488 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1). 6489 * @hide 6490 */ 6491 public static final String SCREENSAVER_COMPONENTS = "screensaver_components"; 6492 6493 /** 6494 * If screensavers are enabled, whether the screensaver should be automatically launched 6495 * when the device is inserted into a (desk) dock. 6496 * @hide 6497 */ 6498 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock"; 6499 6500 /** 6501 * If screensavers are enabled, whether the screensaver should be automatically launched 6502 * when the screen times out when not on battery. 6503 * @hide 6504 */ 6505 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep"; 6506 6507 /** 6508 * If screensavers are enabled, the default screensaver component. 6509 * @hide 6510 */ 6511 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component"; 6512 6513 /** 6514 * The default NFC payment component 6515 * @hide 6516 */ 6517 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component"; 6518 6519 /** 6520 * Whether NFC payment is handled by the foreground application or a default. 6521 * @hide 6522 */ 6523 public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground"; 6524 6525 /** 6526 * Specifies the package name currently configured to be the primary sms application 6527 * @hide 6528 */ 6529 public static final String SMS_DEFAULT_APPLICATION = "sms_default_application"; 6530 6531 /** 6532 * Specifies the package name currently configured to be the default dialer application 6533 * @hide 6534 */ 6535 public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application"; 6536 6537 /** 6538 * Specifies the package name currently configured to be the emergency assistance application 6539 * 6540 * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE 6541 * 6542 * @hide 6543 */ 6544 public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application"; 6545 6546 /** 6547 * Specifies whether the current app context on scren (assist data) will be sent to the 6548 * assist application (active voice interaction service). 6549 * 6550 * @hide 6551 */ 6552 public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled"; 6553 6554 /** 6555 * Specifies whether a screenshot of the screen contents will be sent to the assist 6556 * application (active voice interaction service). 6557 * 6558 * @hide 6559 */ 6560 public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled"; 6561 6562 /** 6563 * Specifies whether the screen will show an animation if screen contents are sent to the 6564 * assist application (active voice interaction service). 6565 * 6566 * Note that the disclosure will be forced for third-party assistants or if the device 6567 * does not support disabling it. 6568 * 6569 * @hide 6570 */ 6571 public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled"; 6572 6573 /** 6574 * Name of the service components that the current user has explicitly allowed to 6575 * see and assist with all of the user's notifications. 6576 * 6577 * @hide 6578 */ 6579 public static final String ENABLED_NOTIFICATION_ASSISTANT = 6580 "enabled_notification_assistant"; 6581 6582 /** 6583 * Names of the service components that the current user has explicitly allowed to 6584 * see all of the user's notifications, separated by ':'. 6585 * 6586 * @hide 6587 */ 6588 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners"; 6589 6590 /** 6591 * Names of the packages that the current user has explicitly allowed to 6592 * manage notification policy configuration, separated by ':'. 6593 * 6594 * @hide 6595 */ 6596 @TestApi 6597 public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = 6598 "enabled_notification_policy_access_packages"; 6599 6600 /** 6601 * Defines whether managed profile ringtones should be synced from it's parent profile 6602 * <p> 6603 * 0 = ringtones are not synced 6604 * 1 = ringtones are synced from the profile's parent (default) 6605 * <p> 6606 * This value is only used for managed profiles. 6607 * @hide 6608 */ 6609 public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds"; 6610 6611 /** @hide */ 6612 public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations"; 6613 6614 /** 6615 * This is the query URI for finding a print service to install. 6616 * 6617 * @hide 6618 */ 6619 public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri"; 6620 6621 /** 6622 * This is the query URI for finding a NFC payment service to install. 6623 * 6624 * @hide 6625 */ 6626 public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri"; 6627 6628 /** 6629 * If enabled, apps should try to skip any introductory hints on first launch. This might 6630 * apply to users that are already familiar with the environment or temporary users. 6631 * <p> 6632 * Type : int (0 to show hints, 1 to skip showing hints) 6633 */ 6634 public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints"; 6635 6636 /** 6637 * Persisted playback time after a user confirmation of an unsafe volume level. 6638 * 6639 * @hide 6640 */ 6641 public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms"; 6642 6643 /** 6644 * This preference enables notification display on the lockscreen. 6645 * @hide 6646 */ 6647 public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = 6648 "lock_screen_show_notifications"; 6649 6650 /** 6651 * This preference stores the last stack active task time for each user, which affects what 6652 * tasks will be visible in Overview. 6653 * @hide 6654 */ 6655 public static final String OVERVIEW_LAST_STACK_ACTIVE_TIME = 6656 "overview_last_stack_active_time"; 6657 6658 /** 6659 * List of TV inputs that are currently hidden. This is a string 6660 * containing the IDs of all hidden TV inputs. Each ID is encoded by 6661 * {@link android.net.Uri#encode(String)} and separated by ':'. 6662 * @hide 6663 */ 6664 public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs"; 6665 6666 /** 6667 * List of custom TV input labels. This is a string containing <TV input id, custom name> 6668 * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)} 6669 * and separated by ','. Each pair is separated by ':'. 6670 * @hide 6671 */ 6672 public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels"; 6673 6674 /** 6675 * Whether automatic routing of system audio to USB audio peripheral is disabled. 6676 * The value is boolean (1 or 0), where 1 means automatic routing is disabled, 6677 * and 0 means automatic routing is enabled. 6678 * 6679 * @hide 6680 */ 6681 public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED = 6682 "usb_audio_automatic_routing_disabled"; 6683 6684 /** 6685 * The timeout in milliseconds before the device fully goes to sleep after 6686 * a period of inactivity. This value sets an upper bound on how long the device 6687 * will stay awake or dreaming without user activity. It should generally 6688 * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device 6689 * will sleep before it ever has a chance to dream. 6690 * <p> 6691 * Use -1 to disable this timeout. 6692 * </p> 6693 * 6694 * @hide 6695 */ 6696 public static final String SLEEP_TIMEOUT = "sleep_timeout"; 6697 6698 /** 6699 * Controls whether double tap to wake is enabled. 6700 * @hide 6701 */ 6702 public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake"; 6703 6704 /** 6705 * The current assistant component. It could be a voice interaction service, 6706 * or an activity that handles ACTION_ASSIST, or empty which means using the default 6707 * handling. 6708 * 6709 * @hide 6710 */ 6711 public static final String ASSISTANT = "assistant"; 6712 6713 /** 6714 * Whether the camera launch gesture should be disabled. 6715 * 6716 * @hide 6717 */ 6718 public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled"; 6719 6720 /** 6721 * Whether the camera launch gesture to double tap the power button when the screen is off 6722 * should be disabled. 6723 * 6724 * @hide 6725 */ 6726 public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED = 6727 "camera_double_tap_power_gesture_disabled"; 6728 6729 /** 6730 * Whether the camera double twist gesture to flip between front and back mode should be 6731 * enabled. 6732 * 6733 * @hide 6734 */ 6735 public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED = 6736 "camera_double_twist_to_flip_enabled"; 6737 6738 /** 6739 * Whether the assist gesture should be enabled. 6740 * 6741 * @hide 6742 */ 6743 public static final String ASSIST_GESTURE_ENABLED = "assist_gesture_enabled"; 6744 6745 /** 6746 * Sensitivity control for the assist gesture. 6747 * 6748 * @hide 6749 */ 6750 public static final String ASSIST_GESTURE_SENSITIVITY = "assist_gesture_sensitivity"; 6751 6752 /** 6753 * Control whether Night display is currently activated. 6754 * @hide 6755 */ 6756 public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated"; 6757 6758 /** 6759 * Control whether Night display will automatically activate/deactivate. 6760 * @hide 6761 */ 6762 public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode"; 6763 6764 /** 6765 * Custom time when Night display is scheduled to activate. 6766 * Represented as milliseconds from midnight (e.g. 79200000 == 10pm). 6767 * @hide 6768 */ 6769 public static final String NIGHT_DISPLAY_CUSTOM_START_TIME = "night_display_custom_start_time"; 6770 6771 /** 6772 * Custom time when Night display is scheduled to deactivate. 6773 * Represented as milliseconds from midnight (e.g. 21600000 == 6am). 6774 * @hide 6775 */ 6776 public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time"; 6777 6778 /** 6779 * Names of the service components that the current user has explicitly allowed to 6780 * be a VR mode listener, separated by ':'. 6781 * 6782 * @hide 6783 */ 6784 public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners"; 6785 6786 /** 6787 * Behavior of the display while in VR mode. 6788 * 6789 * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}. 6790 * 6791 * @hide 6792 */ 6793 public static final String VR_DISPLAY_MODE = "vr_display_mode"; 6794 6795 /** 6796 * Lower the display persistence while the system is in VR mode. 6797 * 6798 * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE 6799 * 6800 * @hide. 6801 */ 6802 public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0; 6803 6804 /** 6805 * Do not alter the display persistence while the system is in VR mode. 6806 * 6807 * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE 6808 * 6809 * @hide. 6810 */ 6811 public static final int VR_DISPLAY_MODE_OFF = 1; 6812 6813 /** 6814 * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least 6815 * once. 6816 * 6817 * <p>This is used to ensure that we only take one pass which will disable apps that are not 6818 * privileged (if any). From then on, we only want to enable apps (when a matching SIM is 6819 * inserted), to avoid disabling an app that the user might actively be using. 6820 * 6821 * <p>Will be set to 1 once executed. 6822 * 6823 * @hide 6824 */ 6825 public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled"; 6826 6827 /** 6828 * Whether parent user can access remote contact in managed profile. 6829 * 6830 * @hide 6831 */ 6832 public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH = 6833 "managed_profile_contact_remote_search"; 6834 6835 /** 6836 * Whether or not the automatic storage manager is enabled and should run on the device. 6837 * 6838 * @hide 6839 */ 6840 public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED = 6841 "automatic_storage_manager_enabled"; 6842 6843 /** 6844 * How many days of information for the automatic storage manager to retain on the device. 6845 * 6846 * @hide 6847 */ 6848 public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN = 6849 "automatic_storage_manager_days_to_retain"; 6850 6851 /** 6852 * Default number of days of information for the automatic storage manager to retain. 6853 * 6854 * @hide 6855 */ 6856 public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90; 6857 6858 /** 6859 * How many bytes the automatic storage manager has cleared out. 6860 * 6861 * @hide 6862 */ 6863 public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED = 6864 "automatic_storage_manager_bytes_cleared"; 6865 6866 6867 /** 6868 * Last run time for the automatic storage manager. 6869 * 6870 * @hide 6871 */ 6872 public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN = 6873 "automatic_storage_manager_last_run"; 6874 6875 /** 6876 * Whether SystemUI navigation keys is enabled. 6877 * @hide 6878 */ 6879 public static final String SYSTEM_NAVIGATION_KEYS_ENABLED = 6880 "system_navigation_keys_enabled"; 6881 6882 /** 6883 * Holds comma separated list of ordering of QS tiles. 6884 * @hide 6885 */ 6886 public static final String QS_TILES = "sysui_qs_tiles"; 6887 6888 /** 6889 * Whether preloaded APKs have been installed for the user. 6890 * @hide 6891 */ 6892 public static final String DEMO_USER_SETUP_COMPLETE 6893 = "demo_user_setup_complete"; 6894 6895 /** 6896 * Specifies whether the web action API is enabled. 6897 * 6898 * @hide 6899 */ 6900 public static final String WEB_ACTION_ENABLED = "web_action_enabled"; 6901 6902 /** 6903 * Has this pairable device been paired or upgraded from a previously paired system. 6904 * @hide 6905 */ 6906 public static final String DEVICE_PAIRED = "device_paired"; 6907 6908 /** 6909 * Integer state indicating whether package verifier is enabled. 6910 * TODO(b/34259924): Remove this setting. 6911 * 6912 * @hide 6913 */ 6914 public static final String PACKAGE_VERIFIER_STATE = "package_verifier_state"; 6915 6916 /** 6917 * Specifies additional package name for broadcasting the CMAS messages. 6918 * @hide 6919 */ 6920 public static final String CMAS_ADDITIONAL_BROADCAST_PKG = "cmas_additional_broadcast_pkg"; 6921 6922 /** 6923 * This are the settings to be backed up. 6924 * 6925 * NOTE: Settings are backed up and restored in the order they appear 6926 * in this array. If you have one setting depending on another, 6927 * make sure that they are ordered appropriately. 6928 * 6929 * @hide 6930 */ 6931 public static final String[] SETTINGS_TO_BACKUP = { 6932 BUGREPORT_IN_POWER_MENU, // moved to global 6933 ALLOW_MOCK_LOCATION, 6934 PARENTAL_CONTROL_ENABLED, 6935 PARENTAL_CONTROL_REDIRECT_URL, 6936 USB_MASS_STORAGE_ENABLED, // moved to global 6937 ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 6938 ACCESSIBILITY_DISPLAY_DALTONIZER, 6939 ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 6940 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 6941 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 6942 ACCESSIBILITY_SCRIPT_INJECTION, 6943 ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS, 6944 ENABLED_ACCESSIBILITY_SERVICES, 6945 ENABLED_NOTIFICATION_LISTENERS, 6946 ENABLED_VR_LISTENERS, 6947 ENABLED_INPUT_METHODS, 6948 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, 6949 TOUCH_EXPLORATION_ENABLED, 6950 ACCESSIBILITY_ENABLED, 6951 ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, 6952 ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, 6953 ACCESSIBILITY_SPEAK_PASSWORD, 6954 ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, 6955 ACCESSIBILITY_CAPTIONING_PRESET, 6956 ACCESSIBILITY_CAPTIONING_ENABLED, 6957 ACCESSIBILITY_CAPTIONING_LOCALE, 6958 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, 6959 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, 6960 ACCESSIBILITY_CAPTIONING_EDGE_TYPE, 6961 ACCESSIBILITY_CAPTIONING_EDGE_COLOR, 6962 ACCESSIBILITY_CAPTIONING_TYPEFACE, 6963 ACCESSIBILITY_CAPTIONING_FONT_SCALE, 6964 ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, 6965 TTS_USE_DEFAULTS, 6966 TTS_DEFAULT_RATE, 6967 TTS_DEFAULT_PITCH, 6968 TTS_DEFAULT_SYNTH, 6969 TTS_DEFAULT_LANG, 6970 TTS_DEFAULT_COUNTRY, 6971 TTS_ENABLED_PLUGINS, 6972 TTS_DEFAULT_LOCALE, 6973 SHOW_IME_WITH_HARD_KEYBOARD, 6974 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global 6975 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global 6976 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global 6977 SELECTED_SPELL_CHECKER, 6978 SELECTED_SPELL_CHECKER_SUBTYPE, 6979 SPELL_CHECKER_ENABLED, 6980 MOUNT_PLAY_NOTIFICATION_SND, 6981 MOUNT_UMS_AUTOSTART, 6982 MOUNT_UMS_PROMPT, 6983 MOUNT_UMS_NOTIFY_ENABLED, 6984 SLEEP_TIMEOUT, 6985 DOUBLE_TAP_TO_WAKE, 6986 WAKE_GESTURE_ENABLED, 6987 LONG_PRESS_TIMEOUT, 6988 CAMERA_GESTURE_DISABLED, 6989 ACCESSIBILITY_AUTOCLICK_ENABLED, 6990 ACCESSIBILITY_AUTOCLICK_DELAY, 6991 ACCESSIBILITY_LARGE_POINTER_ICON, 6992 PREFERRED_TTY_MODE, 6993 ENHANCED_VOICE_PRIVACY_ENABLED, 6994 TTY_MODE_ENABLED, 6995 INCALL_POWER_BUTTON_BEHAVIOR, 6996 NIGHT_DISPLAY_CUSTOM_START_TIME, 6997 NIGHT_DISPLAY_CUSTOM_END_TIME, 6998 NIGHT_DISPLAY_AUTO_MODE, 6999 NIGHT_DISPLAY_ACTIVATED, 7000 SYNC_PARENT_SOUNDS, 7001 CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 7002 CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 7003 SYSTEM_NAVIGATION_KEYS_ENABLED, 7004 QS_TILES, 7005 DOZE_ENABLED, 7006 DOZE_PULSE_ON_PICK_UP, 7007 DOZE_PULSE_ON_DOUBLE_TAP, 7008 NFC_PAYMENT_DEFAULT_COMPONENT, 7009 AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, 7010 ASSIST_GESTURE_ENABLED, 7011 ASSIST_GESTURE_SENSITIVITY, 7012 VR_DISPLAY_MODE 7013 }; 7014 7015 /** 7016 * These entries are considered common between the personal and the managed profile, 7017 * since the managed profile doesn't get to change them. 7018 */ 7019 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>(); 7020 7021 static { 7022 CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED); 7023 CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION); 7024 CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS); 7025 CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD); 7026 CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES); 7027 CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS); 7028 CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); 7029 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE); 7030 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED); 7031 CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE); 7032 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER); 7033 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE); 7034 } 7035 7036 /** @hide */ 7037 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) { 7038 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE); 7039 } 7040 7041 /** 7042 * Secure settings which can be accessed by instant apps. 7043 * @hide 7044 */ 7045 public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>(); 7046 static { 7047 INSTANT_APP_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES); 7048 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD); 7049 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED); 7050 7051 INSTANT_APP_SETTINGS.add(DEFAULT_INPUT_METHOD); 7052 INSTANT_APP_SETTINGS.add(ENABLED_INPUT_METHODS); 7053 } 7054 7055 /** 7056 * Helper method for determining if a location provider is enabled. 7057 * 7058 * @param cr the content resolver to use 7059 * @param provider the location provider to query 7060 * @return true if the provider is enabled 7061 * 7062 * @deprecated use {@link #LOCATION_MODE} or 7063 * {@link LocationManager#isProviderEnabled(String)} 7064 */ 7065 @Deprecated 7066 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { 7067 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); 7068 } 7069 7070 /** 7071 * Helper method for determining if a location provider is enabled. 7072 * @param cr the content resolver to use 7073 * @param provider the location provider to query 7074 * @param userId the userId to query 7075 * @return true if the provider is enabled 7076 * @deprecated use {@link #LOCATION_MODE} or 7077 * {@link LocationManager#isProviderEnabled(String)} 7078 * @hide 7079 */ 7080 @Deprecated 7081 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { 7082 String allowedProviders = Settings.Secure.getStringForUser(cr, 7083 LOCATION_PROVIDERS_ALLOWED, userId); 7084 return TextUtils.delimitedStringContains(allowedProviders, ',', provider); 7085 } 7086 7087 /** 7088 * Thread-safe method for enabling or disabling a single location provider. 7089 * @param cr the content resolver to use 7090 * @param provider the location provider to enable or disable 7091 * @param enabled true if the provider should be enabled 7092 * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE} 7093 */ 7094 @Deprecated 7095 public static final void setLocationProviderEnabled(ContentResolver cr, 7096 String provider, boolean enabled) { 7097 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); 7098 } 7099 7100 /** 7101 * Thread-safe method for enabling or disabling a single location provider. 7102 * 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 * @param userId the userId for which to enable/disable providers 7107 * @return true if the value was set, false on database errors 7108 * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and 7109 * {@link #LOCATION_MODE} 7110 * @hide 7111 */ 7112 @Deprecated 7113 public static final boolean setLocationProviderEnabledForUser(ContentResolver cr, 7114 String provider, boolean enabled, int userId) { 7115 synchronized (mLocationSettingsLock) { 7116 // to ensure thread safety, we write the provider name with a '+' or '-' 7117 // and let the SettingsProvider handle it rather than reading and modifying 7118 // the list of enabled providers. 7119 if (enabled) { 7120 provider = "+" + provider; 7121 } else { 7122 provider = "-" + provider; 7123 } 7124 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, 7125 userId); 7126 } 7127 } 7128 7129 /** 7130 * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}. 7131 */ 7132 private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) { 7133 final int mode = getLocationModeForUser(cr, userId); 7134 return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId); 7135 } 7136 7137 /** 7138 * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}. 7139 */ 7140 private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) { 7141 int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, 7142 LOCATION_MODE_HIGH_ACCURACY, userId); 7143 // Make sure that the previous mode is never "off". Otherwise the user won't be able to 7144 // turn on location any longer. 7145 if (mode == LOCATION_MODE_OFF) { 7146 mode = LOCATION_MODE_HIGH_ACCURACY; 7147 } 7148 return setLocationModeForUser(cr, mode, userId); 7149 } 7150 7151 /** 7152 * Thread-safe method for setting the location mode to one of 7153 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 7154 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. 7155 * Necessary because the mode is a composite of the underlying location provider 7156 * settings. 7157 * 7158 * @param cr the content resolver to use 7159 * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} 7160 * @param userId the userId for which to change mode 7161 * @return true if the value was set, false on database errors 7162 * 7163 * @throws IllegalArgumentException if mode is not one of the supported values 7164 */ 7165 private static final boolean setLocationModeForUser(ContentResolver cr, int mode, 7166 int userId) { 7167 synchronized (mLocationSettingsLock) { 7168 boolean gps = false; 7169 boolean network = false; 7170 switch (mode) { 7171 case LOCATION_MODE_PREVIOUS: 7172 // Retrieve the actual mode and set to that mode. 7173 return restoreLocationModeForUser(cr, userId); 7174 case LOCATION_MODE_OFF: 7175 saveLocationModeForUser(cr, userId); 7176 break; 7177 case LOCATION_MODE_SENSORS_ONLY: 7178 gps = true; 7179 break; 7180 case LOCATION_MODE_BATTERY_SAVING: 7181 network = true; 7182 break; 7183 case LOCATION_MODE_HIGH_ACCURACY: 7184 gps = true; 7185 network = true; 7186 break; 7187 default: 7188 throw new IllegalArgumentException("Invalid location mode: " + mode); 7189 } 7190 // Note it's important that we set the NLP mode first. The Google implementation 7191 // of NLP clears its NLP consent setting any time it receives a 7192 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also, 7193 // it shows an NLP consent dialog any time it receives the broadcast, NLP is 7194 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first, 7195 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting, 7196 // and 3) the receiver happened to complete before we enabled NLP, then the Google 7197 // NLP would detect the attempt to enable NLP and show a redundant NLP consent 7198 // dialog. Then the people who wrote the setup wizard would be sad. 7199 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser( 7200 cr, LocationManager.NETWORK_PROVIDER, network, userId); 7201 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser( 7202 cr, LocationManager.GPS_PROVIDER, gps, userId); 7203 return gpsSuccess && nlpSuccess; 7204 } 7205 } 7206 7207 /** 7208 * Thread-safe method for reading the location mode, returns one of 7209 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, 7210 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary 7211 * because the mode is a composite of the underlying location provider settings. 7212 * 7213 * @param cr the content resolver to use 7214 * @param userId the userId for which to read the mode 7215 * @return the location mode 7216 */ 7217 private static final int getLocationModeForUser(ContentResolver cr, int userId) { 7218 synchronized (mLocationSettingsLock) { 7219 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( 7220 cr, LocationManager.GPS_PROVIDER, userId); 7221 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( 7222 cr, LocationManager.NETWORK_PROVIDER, userId); 7223 if (gpsEnabled && networkEnabled) { 7224 return LOCATION_MODE_HIGH_ACCURACY; 7225 } else if (gpsEnabled) { 7226 return LOCATION_MODE_SENSORS_ONLY; 7227 } else if (networkEnabled) { 7228 return LOCATION_MODE_BATTERY_SAVING; 7229 } else { 7230 return LOCATION_MODE_OFF; 7231 } 7232 } 7233 } 7234 } 7235 7236 /** 7237 * Global system settings, containing preferences that always apply identically 7238 * to all defined users. Applications can read these but are not allowed to write; 7239 * like the "Secure" settings, these are for preferences that the user must 7240 * explicitly modify through the system UI or specialized APIs for those values. 7241 */ 7242 public static final class Global extends NameValueTable { 7243 /** 7244 * The content:// style URL for global secure settings items. Not public. 7245 */ 7246 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global"); 7247 7248 /** 7249 * Whether users are allowed to add more users or guest from lockscreen. 7250 * <p> 7251 * Type: int 7252 * @hide 7253 */ 7254 public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked"; 7255 7256 /** 7257 * Setting whether the global gesture for enabling accessibility is enabled. 7258 * If this gesture is enabled the user will be able to perfrom it to enable 7259 * the accessibility state without visiting the settings app. 7260 * 7261 * @hide 7262 * No longer used. Should be removed once all dependencies have been updated. 7263 */ 7264 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED = 7265 "enable_accessibility_global_gesture_enabled"; 7266 7267 /** 7268 * Whether Airplane Mode is on. 7269 */ 7270 public static final String AIRPLANE_MODE_ON = "airplane_mode_on"; 7271 7272 /** 7273 * Whether Theater Mode is on. 7274 * {@hide} 7275 */ 7276 @SystemApi 7277 public static final String THEATER_MODE_ON = "theater_mode_on"; 7278 7279 /** 7280 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio. 7281 */ 7282 public static final String RADIO_BLUETOOTH = "bluetooth"; 7283 7284 /** 7285 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio. 7286 */ 7287 public static final String RADIO_WIFI = "wifi"; 7288 7289 /** 7290 * {@hide} 7291 */ 7292 public static final String RADIO_WIMAX = "wimax"; 7293 /** 7294 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. 7295 */ 7296 public static final String RADIO_CELL = "cell"; 7297 7298 /** 7299 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. 7300 */ 7301 public static final String RADIO_NFC = "nfc"; 7302 7303 /** 7304 * A comma separated list of radios that need to be disabled when airplane mode 7305 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are 7306 * included in the comma separated list. 7307 */ 7308 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; 7309 7310 /** 7311 * A comma separated list of radios that should to be disabled when airplane mode 7312 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is 7313 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi 7314 * will be turned off when entering airplane mode, but the user will be able to reenable 7315 * Wifi in the Settings app. 7316 * 7317 * {@hide} 7318 */ 7319 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios"; 7320 7321 /** 7322 * A Long representing a bitmap of profiles that should be disabled when bluetooth starts. 7323 * See {@link android.bluetooth.BluetoothProfile}. 7324 * {@hide} 7325 */ 7326 public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles"; 7327 7328 /** 7329 * A semi-colon separated list of Bluetooth interoperability workarounds. 7330 * Each entry is a partial Bluetooth device address string and an integer representing 7331 * the feature to be disabled, separated by a comma. The integer must correspond 7332 * to a interoperability feature as defined in "interop.h" in /system/bt. 7333 * <p> 7334 * Example: <br/> 7335 * "00:11:22,0;01:02:03:04,2" 7336 * @hide 7337 */ 7338 public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list"; 7339 7340 /** 7341 * The policy for deciding when Wi-Fi should go to sleep (which will in 7342 * turn switch to using the mobile data as an Internet connection). 7343 * <p> 7344 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT}, 7345 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or 7346 * {@link #WIFI_SLEEP_POLICY_NEVER}. 7347 */ 7348 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy"; 7349 7350 /** 7351 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep 7352 * policy, which is to sleep shortly after the turning off 7353 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting. 7354 */ 7355 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; 7356 7357 /** 7358 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when 7359 * the device is on battery, and never go to sleep when the device is 7360 * plugged in. 7361 */ 7362 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; 7363 7364 /** 7365 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. 7366 */ 7367 public static final int WIFI_SLEEP_POLICY_NEVER = 2; 7368 7369 /** 7370 * Value to specify if the user prefers the date, time and time zone 7371 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 7372 */ 7373 public static final String AUTO_TIME = "auto_time"; 7374 7375 /** 7376 * Value to specify if the user prefers the time zone 7377 * to be automatically fetched from the network (NITZ). 1=yes, 0=no 7378 */ 7379 public static final String AUTO_TIME_ZONE = "auto_time_zone"; 7380 7381 /** 7382 * URI for the car dock "in" event sound. 7383 * @hide 7384 */ 7385 public static final String CAR_DOCK_SOUND = "car_dock_sound"; 7386 7387 /** 7388 * URI for the car dock "out" event sound. 7389 * @hide 7390 */ 7391 public static final String CAR_UNDOCK_SOUND = "car_undock_sound"; 7392 7393 /** 7394 * URI for the desk dock "in" event sound. 7395 * @hide 7396 */ 7397 public static final String DESK_DOCK_SOUND = "desk_dock_sound"; 7398 7399 /** 7400 * URI for the desk dock "out" event sound. 7401 * @hide 7402 */ 7403 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound"; 7404 7405 /** 7406 * Whether to play a sound for dock events. 7407 * @hide 7408 */ 7409 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled"; 7410 7411 /** 7412 * Whether to play a sound for dock events, only when an accessibility service is on. 7413 * @hide 7414 */ 7415 public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility"; 7416 7417 /** 7418 * URI for the "device locked" (keyguard shown) sound. 7419 * @hide 7420 */ 7421 public static final String LOCK_SOUND = "lock_sound"; 7422 7423 /** 7424 * URI for the "device unlocked" sound. 7425 * @hide 7426 */ 7427 public static final String UNLOCK_SOUND = "unlock_sound"; 7428 7429 /** 7430 * URI for the "device is trusted" sound, which is played when the device enters the trusted 7431 * state without unlocking. 7432 * @hide 7433 */ 7434 public static final String TRUSTED_SOUND = "trusted_sound"; 7435 7436 /** 7437 * URI for the low battery sound file. 7438 * @hide 7439 */ 7440 public static final String LOW_BATTERY_SOUND = "low_battery_sound"; 7441 7442 /** 7443 * Whether to play a sound for low-battery alerts. 7444 * @hide 7445 */ 7446 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled"; 7447 7448 /** 7449 * URI for the "wireless charging started" sound. 7450 * @hide 7451 */ 7452 public static final String WIRELESS_CHARGING_STARTED_SOUND = 7453 "wireless_charging_started_sound"; 7454 7455 /** 7456 * Whether to play a sound for charging events. 7457 * @hide 7458 */ 7459 public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; 7460 7461 /** 7462 * Whether we keep the device on while the device is plugged in. 7463 * Supported values are: 7464 * <ul> 7465 * <li>{@code 0} to never stay on while plugged in</li> 7466 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li> 7467 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li> 7468 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li> 7469 * </ul> 7470 * These values can be OR-ed together. 7471 */ 7472 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; 7473 7474 /** 7475 * When the user has enable the option to have a "bug report" command 7476 * in the power menu. 7477 * @hide 7478 */ 7479 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; 7480 7481 /** 7482 * Whether ADB is enabled. 7483 */ 7484 public static final String ADB_ENABLED = "adb_enabled"; 7485 7486 /** 7487 * Whether Views are allowed to save their attribute data. 7488 * @hide 7489 */ 7490 public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes"; 7491 7492 /** 7493 * Whether assisted GPS should be enabled or not. 7494 * @hide 7495 */ 7496 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled"; 7497 7498 /** 7499 * Whether bluetooth is enabled/disabled 7500 * 0=disabled. 1=enabled. 7501 */ 7502 public static final String BLUETOOTH_ON = "bluetooth_on"; 7503 7504 /** 7505 * CDMA Cell Broadcast SMS 7506 * 0 = CDMA Cell Broadcast SMS disabled 7507 * 1 = CDMA Cell Broadcast SMS enabled 7508 * @hide 7509 */ 7510 public static final String CDMA_CELL_BROADCAST_SMS = 7511 "cdma_cell_broadcast_sms"; 7512 7513 /** 7514 * The CDMA roaming mode 0 = Home Networks, CDMA default 7515 * 1 = Roaming on Affiliated networks 7516 * 2 = Roaming on any networks 7517 * @hide 7518 */ 7519 public static final String CDMA_ROAMING_MODE = "roaming_settings"; 7520 7521 /** 7522 * The CDMA subscription mode 0 = RUIM/SIM (default) 7523 * 1 = NV 7524 * @hide 7525 */ 7526 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; 7527 7528 /** Inactivity timeout to track mobile data activity. 7529 * 7530 * If set to a positive integer, it indicates the inactivity timeout value in seconds to 7531 * infer the data activity of mobile network. After a period of no activity on mobile 7532 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE} 7533 * intent is fired to indicate a transition of network status from "active" to "idle". Any 7534 * subsequent activity on mobile networks triggers the firing of {@code 7535 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active". 7536 * 7537 * Network activity refers to transmitting or receiving data on the network interfaces. 7538 * 7539 * Tracking is disabled if set to zero or negative value. 7540 * 7541 * @hide 7542 */ 7543 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile"; 7544 7545 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE} 7546 * but for Wifi network. 7547 * @hide 7548 */ 7549 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi"; 7550 7551 /** 7552 * Whether or not data roaming is enabled. (0 = false, 1 = true) 7553 */ 7554 public static final String DATA_ROAMING = "data_roaming"; 7555 7556 /** 7557 * The value passed to a Mobile DataConnection via bringUp which defines the 7558 * number of retries to preform when setting up the initial connection. The default 7559 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1. 7560 * @hide 7561 */ 7562 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry"; 7563 7564 /** 7565 * Whether any package can be on external storage. When this is true, any 7566 * package, regardless of manifest values, is a candidate for installing 7567 * or moving onto external storage. (0 = false, 1 = true) 7568 * @hide 7569 */ 7570 public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external"; 7571 7572 /** 7573 * Whether any activity can be resized. When this is true, any 7574 * activity, regardless of manifest values, can be resized for multi-window. 7575 * (0 = false, 1 = true) 7576 * @hide 7577 */ 7578 public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES 7579 = "force_resizable_activities"; 7580 7581 /** 7582 * Whether to enable experimental freeform support for windows. 7583 * @hide 7584 */ 7585 public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT 7586 = "enable_freeform_support"; 7587 7588 /** 7589 * Whether user has enabled development settings. 7590 */ 7591 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; 7592 7593 /** 7594 * Whether the device has been provisioned (0 = false, 1 = true). 7595 * <p>On a multiuser device with a separate system user, the screen may be locked 7596 * as soon as this is set to true and further activities cannot be launched on the 7597 * system user unless they are marked to show over keyguard. 7598 */ 7599 public static final String DEVICE_PROVISIONED = "device_provisioned"; 7600 7601 /** 7602 * Whether mobile data should be allowed while the device is being provisioned. 7603 * This allows the provisioning process to turn off mobile data before the user 7604 * has an opportunity to set things up, preventing other processes from burning 7605 * precious bytes before wifi is setup. 7606 * (0 = false, 1 = true) 7607 * @hide 7608 */ 7609 public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED = 7610 "device_provisioning_mobile_data"; 7611 7612 /** 7613 * The saved value for WindowManagerService.setForcedDisplaySize(). 7614 * Two integers separated by a comma. If unset, then use the real display size. 7615 * @hide 7616 */ 7617 public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; 7618 7619 /** 7620 * The saved value for WindowManagerService.setForcedDisplayScalingMode(). 7621 * 0 or unset if scaling is automatic, 1 if scaling is disabled. 7622 * @hide 7623 */ 7624 public static final String DISPLAY_SCALING_FORCE = "display_scaling_force"; 7625 7626 /** 7627 * The maximum size, in bytes, of a download that the download manager will transfer over 7628 * a non-wifi connection. 7629 * @hide 7630 */ 7631 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE = 7632 "download_manager_max_bytes_over_mobile"; 7633 7634 /** 7635 * The recommended maximum size, in bytes, of a download that the download manager should 7636 * transfer over a non-wifi connection. Over this size, the use will be warned, but will 7637 * have the option to start the download over the mobile connection anyway. 7638 * @hide 7639 */ 7640 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE = 7641 "download_manager_recommended_max_bytes_over_mobile"; 7642 7643 /** 7644 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead 7645 */ 7646 @Deprecated 7647 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; 7648 7649 /** 7650 * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be 7651 * sent or processed. (0 = false, 1 = true) 7652 * @hide 7653 */ 7654 public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled"; 7655 7656 /** 7657 * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted, 7658 * and the output is redirected to AV Receiver connected via 7659 * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}. 7660 * @hide 7661 */ 7662 public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled"; 7663 7664 /** 7665 * Whether TV will automatically turn on upon reception of the CEC command 7666 * <Text View On> or <Image View On>. (0 = false, 1 = true) 7667 * @hide 7668 */ 7669 public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED = 7670 "hdmi_control_auto_wakeup_enabled"; 7671 7672 /** 7673 * Whether TV will also turn off other CEC devices when it goes to standby mode. 7674 * (0 = false, 1 = true) 7675 * @hide 7676 */ 7677 public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED = 7678 "hdmi_control_auto_device_off_enabled"; 7679 7680 /** 7681 * The interval in milliseconds at which location requests will be throttled when they are 7682 * coming from the background. 7683 * @hide 7684 */ 7685 public static final String LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS = 7686 "location_background_throttle_interval_ms"; 7687 7688 /** 7689 * Packages that are whitelisted for background throttling (throttling will not be applied). 7690 * @hide 7691 */ 7692 public static final String LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST = 7693 "location_background_throttle_package_whitelist"; 7694 7695 /** 7696 * Whether TV will switch to MHL port when a mobile device is plugged in. 7697 * (0 = false, 1 = true) 7698 * @hide 7699 */ 7700 public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled"; 7701 7702 /** 7703 * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true) 7704 * @hide 7705 */ 7706 public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled"; 7707 7708 /** 7709 * Whether mobile data connections are allowed by the user. See 7710 * ConnectivityManager for more info. 7711 * @hide 7712 */ 7713 public static final String MOBILE_DATA = "mobile_data"; 7714 7715 /** 7716 * Whether the mobile data connection should remain active even when higher 7717 * priority networks like WiFi are active, to help make network switching faster. 7718 * 7719 * See ConnectivityService for more info. 7720 * 7721 * (0 = disabled, 1 = enabled) 7722 * @hide 7723 */ 7724 public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on"; 7725 7726 /** 7727 * Size of the event buffer for IP connectivity metrics. 7728 * @hide 7729 */ 7730 public static final String CONNECTIVITY_METRICS_BUFFER_SIZE = 7731 "connectivity_metrics_buffer_size"; 7732 7733 /** {@hide} */ 7734 public static final String NETSTATS_ENABLED = "netstats_enabled"; 7735 /** {@hide} */ 7736 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval"; 7737 /** {@hide} */ 7738 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age"; 7739 /** {@hide} */ 7740 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes"; 7741 /** {@hide} */ 7742 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled"; 7743 7744 /** {@hide} */ 7745 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration"; 7746 /** {@hide} */ 7747 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes"; 7748 /** {@hide} */ 7749 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age"; 7750 /** {@hide} */ 7751 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age"; 7752 7753 /** {@hide} */ 7754 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration"; 7755 /** {@hide} */ 7756 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes"; 7757 /** {@hide} */ 7758 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age"; 7759 /** {@hide} */ 7760 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age"; 7761 7762 /** {@hide} */ 7763 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration"; 7764 /** {@hide} */ 7765 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes"; 7766 /** {@hide} */ 7767 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age"; 7768 /** {@hide} */ 7769 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age"; 7770 7771 /** 7772 * User preference for which network(s) should be used. Only the 7773 * connectivity service should touch this. 7774 */ 7775 public static final String NETWORK_PREFERENCE = "network_preference"; 7776 7777 /** 7778 * Which package name to use for network scoring. If null, or if the package is not a valid 7779 * scorer app, external network scores will neither be requested nor accepted. 7780 * @hide 7781 */ 7782 public static final String NETWORK_SCORER_APP = "network_scorer_app"; 7783 7784 /** 7785 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment 7786 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been 7787 * exceeded. 7788 * @hide 7789 */ 7790 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff"; 7791 7792 /** 7793 * The length of time in milli-seconds that automatic small adjustments to 7794 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded. 7795 * @hide 7796 */ 7797 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing"; 7798 7799 /** Preferred NTP server. {@hide} */ 7800 public static final String NTP_SERVER = "ntp_server"; 7801 /** Timeout in milliseconds to wait for NTP server. {@hide} */ 7802 public static final String NTP_TIMEOUT = "ntp_timeout"; 7803 7804 /** {@hide} */ 7805 public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval"; 7806 7807 /** 7808 * Sample validity in seconds to configure for the system DNS resolver. 7809 * {@hide} 7810 */ 7811 public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS = 7812 "dns_resolver_sample_validity_seconds"; 7813 7814 /** 7815 * Success threshold in percent for use with the system DNS resolver. 7816 * {@hide} 7817 */ 7818 public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT = 7819 "dns_resolver_success_threshold_percent"; 7820 7821 /** 7822 * Minimum number of samples needed for statistics to be considered meaningful in the 7823 * system DNS resolver. 7824 * {@hide} 7825 */ 7826 public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples"; 7827 7828 /** 7829 * Maximum number taken into account for statistics purposes in the system DNS resolver. 7830 * {@hide} 7831 */ 7832 public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples"; 7833 7834 /** 7835 * Whether to disable the automatic scheduling of system updates. 7836 * 1 = system updates won't be automatically scheduled (will always 7837 * present notification instead). 7838 * 0 = system updates will be automatically scheduled. (default) 7839 * @hide 7840 */ 7841 @SystemApi 7842 public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update"; 7843 7844 /** 7845 * Whether the package manager should send package verification broadcasts for verifiers to 7846 * review apps prior to installation. 7847 * 1 = request apps to be verified prior to installation, if a verifier exists. 7848 * 0 = do not verify apps before installation 7849 * @hide 7850 */ 7851 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable"; 7852 7853 /** Timeout for package verification. 7854 * @hide */ 7855 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout"; 7856 7857 /** Default response code for package verification. 7858 * @hide */ 7859 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response"; 7860 7861 /** 7862 * Show package verification setting in the Settings app. 7863 * 1 = show (default) 7864 * 0 = hide 7865 * @hide 7866 */ 7867 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible"; 7868 7869 /** 7870 * Run package verification on apps installed through ADB/ADT/USB 7871 * 1 = perform package verification on ADB installs (default) 7872 * 0 = bypass package verification on ADB installs 7873 * @hide 7874 */ 7875 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs"; 7876 7877 /** 7878 * Time since last fstrim (milliseconds) after which we force one to happen 7879 * during device startup. If unset, the default is 3 days. 7880 * @hide 7881 */ 7882 public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval"; 7883 7884 /** 7885 * The interval in milliseconds at which to check packet counts on the 7886 * mobile data interface when screen is on, to detect possible data 7887 * connection problems. 7888 * @hide 7889 */ 7890 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS = 7891 "pdp_watchdog_poll_interval_ms"; 7892 7893 /** 7894 * The interval in milliseconds at which to check packet counts on the 7895 * mobile data interface when screen is off, to detect possible data 7896 * connection problems. 7897 * @hide 7898 */ 7899 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = 7900 "pdp_watchdog_long_poll_interval_ms"; 7901 7902 /** 7903 * The interval in milliseconds at which to check packet counts on the 7904 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} 7905 * outgoing packets has been reached without incoming packets. 7906 * @hide 7907 */ 7908 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = 7909 "pdp_watchdog_error_poll_interval_ms"; 7910 7911 /** 7912 * The number of outgoing packets sent without seeing an incoming packet 7913 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} 7914 * device is logged to the event log 7915 * @hide 7916 */ 7917 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = 7918 "pdp_watchdog_trigger_packet_count"; 7919 7920 /** 7921 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}) 7922 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before 7923 * attempting data connection recovery. 7924 * @hide 7925 */ 7926 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = 7927 "pdp_watchdog_error_poll_count"; 7928 7929 /** 7930 * The number of failed PDP reset attempts before moving to something more 7931 * drastic: re-registering to the network. 7932 * @hide 7933 */ 7934 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = 7935 "pdp_watchdog_max_pdp_reset_fail_count"; 7936 7937 /** 7938 * A positive value indicates how often the SamplingProfiler 7939 * should take snapshots. Zero value means SamplingProfiler 7940 * is disabled. 7941 * 7942 * @hide 7943 */ 7944 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms"; 7945 7946 /** 7947 * URL to open browser on to allow user to manage a prepay account 7948 * @hide 7949 */ 7950 public static final String SETUP_PREPAID_DATA_SERVICE_URL = 7951 "setup_prepaid_data_service_url"; 7952 7953 /** 7954 * URL to attempt a GET on to see if this is a prepay device 7955 * @hide 7956 */ 7957 public static final String SETUP_PREPAID_DETECTION_TARGET_URL = 7958 "setup_prepaid_detection_target_url"; 7959 7960 /** 7961 * Host to check for a redirect to after an attempt to GET 7962 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there, 7963 * this is a prepaid device with zero balance.) 7964 * @hide 7965 */ 7966 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST = 7967 "setup_prepaid_detection_redir_host"; 7968 7969 /** 7970 * The interval in milliseconds at which to check the number of SMS sent out without asking 7971 * for use permit, to limit the un-authorized SMS usage. 7972 * 7973 * @hide 7974 */ 7975 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS = 7976 "sms_outgoing_check_interval_ms"; 7977 7978 /** 7979 * The number of outgoing SMS sent without asking for user permit (of {@link 7980 * #SMS_OUTGOING_CHECK_INTERVAL_MS} 7981 * 7982 * @hide 7983 */ 7984 public static final String SMS_OUTGOING_CHECK_MAX_COUNT = 7985 "sms_outgoing_check_max_count"; 7986 7987 /** 7988 * Used to disable SMS short code confirmation - defaults to true. 7989 * True indcates we will do the check, etc. Set to false to disable. 7990 * @see com.android.internal.telephony.SmsUsageMonitor 7991 * @hide 7992 */ 7993 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation"; 7994 7995 /** 7996 * Used to select which country we use to determine premium sms codes. 7997 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM, 7998 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK, 7999 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH. 8000 * @hide 8001 */ 8002 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule"; 8003 8004 /** 8005 * Used to select TCP's default initial receiver window size in segments - defaults to a build config value 8006 * @hide 8007 */ 8008 public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd"; 8009 8010 /** 8011 * Used to disable Tethering on a device - defaults to true 8012 * @hide 8013 */ 8014 public static final String TETHER_SUPPORTED = "tether_supported"; 8015 8016 /** 8017 * Used to require DUN APN on the device or not - defaults to a build config value 8018 * which defaults to false 8019 * @hide 8020 */ 8021 public static final String TETHER_DUN_REQUIRED = "tether_dun_required"; 8022 8023 /** 8024 * Used to hold a gservices-provisioned apn value for DUN. If set, or the 8025 * corresponding build config values are set it will override the APN DB 8026 * values. 8027 * Consists of a comma seperated list of strings: 8028 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" 8029 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" 8030 * @hide 8031 */ 8032 public static final String TETHER_DUN_APN = "tether_dun_apn"; 8033 8034 /** 8035 * List of carrier apps which are whitelisted to prompt the user for install when 8036 * a sim card with matching uicc carrier privilege rules is inserted. 8037 * 8038 * The value is "package1;package2;..." 8039 * @hide 8040 */ 8041 public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist"; 8042 8043 /** 8044 * USB Mass Storage Enabled 8045 */ 8046 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; 8047 8048 /** 8049 * If this setting is set (to anything), then all references 8050 * to Gmail on the device must change to Google Mail. 8051 */ 8052 public static final String USE_GOOGLE_MAIL = "use_google_mail"; 8053 8054 /** 8055 * Webview Data reduction proxy key. 8056 * @hide 8057 */ 8058 public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = 8059 "webview_data_reduction_proxy_key"; 8060 8061 /** 8062 * Whether or not the WebView fallback mechanism should be enabled. 8063 * 0=disabled, 1=enabled. 8064 * @hide 8065 */ 8066 public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED = 8067 "webview_fallback_logic_enabled"; 8068 8069 /** 8070 * Name of the package used as WebView provider (if unset the provider is instead determined 8071 * by the system). 8072 * @hide 8073 */ 8074 public static final String WEBVIEW_PROVIDER = "webview_provider"; 8075 8076 /** 8077 * Developer setting to enable WebView multiprocess rendering. 8078 * @hide 8079 */ 8080 @SystemApi 8081 public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess"; 8082 8083 /** 8084 * The maximum number of notifications shown in 24 hours when switching networks. 8085 * @hide 8086 */ 8087 public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT = 8088 "network_switch_notification_daily_limit"; 8089 8090 /** 8091 * The minimum time in milliseconds between notifications when switching networks. 8092 * @hide 8093 */ 8094 public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS = 8095 "network_switch_notification_rate_limit_millis"; 8096 8097 /** 8098 * Whether to automatically switch away from wifi networks that lose Internet access. 8099 * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always 8100 * avoids such networks. Valid values are: 8101 * 8102 * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013. 8103 * null: Ask the user whether to switch away from bad wifi. 8104 * 1: Avoid bad wifi. 8105 * 8106 * @hide 8107 */ 8108 public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi"; 8109 8110 /** 8111 * User setting for ConnectivityManager.getMeteredMultipathPreference(). This value may be 8112 * overridden by the system based on device or application state. If null, the value 8113 * specified by config_networkMeteredMultipathPreference is used. 8114 * 8115 * @hide 8116 */ 8117 public static final String NETWORK_METERED_MULTIPATH_PREFERENCE = 8118 "network_metered_multipath_preference"; 8119 8120 /** 8121 * The thresholds of the wifi throughput badging (SD, HD etc.) as a comma-delimited list of 8122 * colon-delimited key-value pairs. The key is the badging enum value defined in 8123 * android.net.ScoredNetwork and the value is the minimum sustained network throughput in 8124 * kbps required for the badge. For example: "10:3000,20:5000,30:25000" 8125 * 8126 * @hide 8127 */ 8128 @SystemApi 8129 public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds"; 8130 8131 /** 8132 * Whether Wifi display is enabled/disabled 8133 * 0=disabled. 1=enabled. 8134 * @hide 8135 */ 8136 public static final String WIFI_DISPLAY_ON = "wifi_display_on"; 8137 8138 /** 8139 * Whether Wifi display certification mode is enabled/disabled 8140 * 0=disabled. 1=enabled. 8141 * @hide 8142 */ 8143 public static final String WIFI_DISPLAY_CERTIFICATION_ON = 8144 "wifi_display_certification_on"; 8145 8146 /** 8147 * WPS Configuration method used by Wifi display, this setting only 8148 * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled). 8149 * 8150 * Possible values are: 8151 * 8152 * WpsInfo.INVALID: use default WPS method chosen by framework 8153 * WpsInfo.PBC : use Push button 8154 * WpsInfo.KEYPAD : use Keypad 8155 * WpsInfo.DISPLAY: use Display 8156 * @hide 8157 */ 8158 public static final String WIFI_DISPLAY_WPS_CONFIG = 8159 "wifi_display_wps_config"; 8160 8161 /** 8162 * Whether to notify the user of open networks. 8163 * <p> 8164 * If not connected and the scan results have an open network, we will 8165 * put this notification up. If we attempt to connect to a network or 8166 * the open network(s) disappear, we remove the notification. When we 8167 * show the notification, we will not show it again for 8168 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. 8169 */ 8170 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = 8171 "wifi_networks_available_notification_on"; 8172 /** 8173 * {@hide} 8174 */ 8175 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = 8176 "wimax_networks_available_notification_on"; 8177 8178 /** 8179 * Delay (in seconds) before repeating the Wi-Fi networks available notification. 8180 * Connecting to a network will reset the timer. 8181 */ 8182 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = 8183 "wifi_networks_available_repeat_delay"; 8184 8185 /** 8186 * 802.11 country code in ISO 3166 format 8187 * @hide 8188 */ 8189 public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; 8190 8191 /** 8192 * The interval in milliseconds to issue wake up scans when wifi needs 8193 * to connect. This is necessary to connect to an access point when 8194 * device is on the move and the screen is off. 8195 * @hide 8196 */ 8197 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS = 8198 "wifi_framework_scan_interval_ms"; 8199 8200 /** 8201 * The interval in milliseconds after which Wi-Fi is considered idle. 8202 * When idle, it is possible for the device to be switched from Wi-Fi to 8203 * the mobile data network. 8204 * @hide 8205 */ 8206 public static final String WIFI_IDLE_MS = "wifi_idle_ms"; 8207 8208 /** 8209 * When the number of open networks exceeds this number, the 8210 * least-recently-used excess networks will be removed. 8211 */ 8212 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; 8213 8214 /** 8215 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. 8216 */ 8217 public static final String WIFI_ON = "wifi_on"; 8218 8219 /** 8220 * Setting to allow scans to be enabled even wifi is turned off for connectivity. 8221 * @hide 8222 */ 8223 public static final String WIFI_SCAN_ALWAYS_AVAILABLE = 8224 "wifi_scan_always_enabled"; 8225 8226 /** 8227 * Value to specify if Wi-Fi Wakeup feature is enabled. 8228 * 8229 * Type: int (0 for false, 1 for true) 8230 * @hide 8231 */ 8232 @SystemApi 8233 public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled"; 8234 8235 /** 8236 * Value to specify whether network quality scores and badging should be shown in the UI. 8237 * 8238 * Type: int (0 for false, 1 for true) 8239 * @hide 8240 */ 8241 public static final String NETWORK_SCORING_UI_ENABLED = "network_scoring_ui_enabled"; 8242 8243 /** 8244 * Value to specify if network recommendations from 8245 * {@link com.android.server.NetworkScoreService} are enabled. 8246 * 8247 * Type: int 8248 * Valid values: 8249 * -1 = Forced off 8250 * 0 = Disabled 8251 * 1 = Enabled 8252 * 8253 * Most readers of this setting should simply check if value == 1 to determined the 8254 * enabled state. 8255 * @hide 8256 */ 8257 @SystemApi 8258 public static final String NETWORK_RECOMMENDATIONS_ENABLED = 8259 "network_recommendations_enabled"; 8260 8261 /** 8262 * Which package name to use for network recommendations. If null, network recommendations 8263 * will neither be requested nor accepted. 8264 * 8265 * Use {@link NetworkScoreManager#getActiveScorerPackage()} to read this value and 8266 * {@link NetworkScoreManager#setActiveScorer(String)} to write it. 8267 * 8268 * Type: string - package name 8269 * @hide 8270 */ 8271 public static final String NETWORK_RECOMMENDATIONS_PACKAGE = 8272 "network_recommendations_package"; 8273 8274 /** 8275 * Value to specify if the Wi-Fi Framework should defer to 8276 * {@link com.android.server.NetworkScoreService} for evaluating saved open networks. 8277 * 8278 * Type: int (0 for false, 1 for true) 8279 * @hide 8280 */ 8281 @SystemApi 8282 public static final String CURATE_SAVED_OPEN_NETWORKS = "curate_saved_open_networks"; 8283 8284 /** 8285 * The package name of the application that connect and secures high quality open wifi 8286 * networks automatically. 8287 * 8288 * Type: string package name or null if the feature is either not provided or disabled. 8289 * @hide 8290 */ 8291 public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package"; 8292 8293 /** 8294 * The number of milliseconds the {@link com.android.server.NetworkScoreService} 8295 * will give a recommendation request to complete before returning a default response. 8296 * 8297 * Type: long 8298 * @hide 8299 */ 8300 public static final String NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS = 8301 "network_recommendation_request_timeout_ms"; 8302 8303 /** 8304 * The expiration time in milliseconds for the {@link android.net.WifiKey} request cache in 8305 * {@link com.android.server.wifi.RecommendedNetworkEvaluator}. 8306 * 8307 * Type: long 8308 * @hide 8309 */ 8310 public static final String RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS = 8311 "recommended_network_evaluator_cache_expiry_ms"; 8312 8313 /** 8314 * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for 8315 * connectivity. 8316 * @hide 8317 */ 8318 public static final String BLE_SCAN_ALWAYS_AVAILABLE = 8319 "ble_scan_always_enabled"; 8320 8321 /** 8322 * Used to save the Wifi_ON state prior to tethering. 8323 * This state will be checked to restore Wifi after 8324 * the user turns off tethering. 8325 * 8326 * @hide 8327 */ 8328 public static final String WIFI_SAVED_STATE = "wifi_saved_state"; 8329 8330 /** 8331 * The interval in milliseconds to scan as used by the wifi supplicant 8332 * @hide 8333 */ 8334 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS = 8335 "wifi_supplicant_scan_interval_ms"; 8336 8337 /** 8338 * whether frameworks handles wifi auto-join 8339 * @hide 8340 */ 8341 public static final String WIFI_ENHANCED_AUTO_JOIN = 8342 "wifi_enhanced_auto_join"; 8343 8344 /** 8345 * whether settings show RSSI 8346 * @hide 8347 */ 8348 public static final String WIFI_NETWORK_SHOW_RSSI = 8349 "wifi_network_show_rssi"; 8350 8351 /** 8352 * The interval in milliseconds to scan at supplicant when p2p is connected 8353 * @hide 8354 */ 8355 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS = 8356 "wifi_scan_interval_p2p_connected_ms"; 8357 8358 /** 8359 * Whether the Wi-Fi watchdog is enabled. 8360 */ 8361 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; 8362 8363 /** 8364 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and 8365 * the setting needs to be set to 0 to disable it. 8366 * @hide 8367 */ 8368 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED = 8369 "wifi_watchdog_poor_network_test_enabled"; 8370 8371 /** 8372 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and 8373 * needs to be set to 0 to disable it. 8374 * @hide 8375 */ 8376 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED = 8377 "wifi_suspend_optimizations_enabled"; 8378 8379 /** 8380 * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1 8381 * will enable it. In the future, additional values may be supported. 8382 * @hide 8383 */ 8384 public static final String WIFI_VERBOSE_LOGGING_ENABLED = 8385 "wifi_verbose_logging_enabled"; 8386 8387 /** 8388 * The maximum number of times we will retry a connection to an access 8389 * point for which we have failed in acquiring an IP address from DHCP. 8390 * A value of N means that we will make N+1 connection attempts in all. 8391 */ 8392 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; 8393 8394 /** 8395 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile 8396 * data connectivity to be established after a disconnect from Wi-Fi. 8397 */ 8398 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = 8399 "wifi_mobile_data_transition_wakelock_timeout_ms"; 8400 8401 /** 8402 * This setting controls whether WiFi configurations created by a Device Owner app 8403 * should be locked down (that is, be editable or removable only by the Device Owner App, 8404 * not even by Settings app). 8405 * This setting takes integer values. Non-zero values mean DO created configurations 8406 * are locked down. Value of zero means they are not. Default value in the absence of 8407 * actual value to this setting is 0. 8408 */ 8409 public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN = 8410 "wifi_device_owner_configs_lockdown"; 8411 8412 /** 8413 * The operational wifi frequency band 8414 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, 8415 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or 8416 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} 8417 * 8418 * @hide 8419 */ 8420 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; 8421 8422 /** 8423 * The Wi-Fi peer-to-peer device name 8424 * @hide 8425 */ 8426 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name"; 8427 8428 /** 8429 * The min time between wifi disable and wifi enable 8430 * @hide 8431 */ 8432 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay"; 8433 8434 /** 8435 * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect 8436 * from an ephemeral network if there is no BSSID for that network with a non-null score that 8437 * has been seen in this time period. 8438 * 8439 * If this is less than or equal to zero, we use a more conservative behavior and only check 8440 * for a non-null score from the currently connected or target BSSID. 8441 * @hide 8442 */ 8443 public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS = 8444 "wifi_ephemeral_out_of_range_timeout_ms"; 8445 8446 /** 8447 * The number of milliseconds to delay when checking for data stalls during 8448 * non-aggressive detection. (screen is turned off.) 8449 * @hide 8450 */ 8451 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS = 8452 "data_stall_alarm_non_aggressive_delay_in_ms"; 8453 8454 /** 8455 * The number of milliseconds to delay when checking for data stalls during 8456 * aggressive detection. (screen on or suspected data stall) 8457 * @hide 8458 */ 8459 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS = 8460 "data_stall_alarm_aggressive_delay_in_ms"; 8461 8462 /** 8463 * The number of milliseconds to allow the provisioning apn to remain active 8464 * @hide 8465 */ 8466 public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS = 8467 "provisioning_apn_alarm_delay_in_ms"; 8468 8469 /** 8470 * The interval in milliseconds at which to check gprs registration 8471 * after the first registration mismatch of gprs and voice service, 8472 * to detect possible data network registration problems. 8473 * 8474 * @hide 8475 */ 8476 public static final String GPRS_REGISTER_CHECK_PERIOD_MS = 8477 "gprs_register_check_period_ms"; 8478 8479 /** 8480 * Nonzero causes Log.wtf() to crash. 8481 * @hide 8482 */ 8483 public static final String WTF_IS_FATAL = "wtf_is_fatal"; 8484 8485 /** 8486 * Ringer mode. This is used internally, changing this value will not 8487 * change the ringer mode. See AudioManager. 8488 */ 8489 public static final String MODE_RINGER = "mode_ringer"; 8490 8491 /** 8492 * Overlay display devices setting. 8493 * The associated value is a specially formatted string that describes the 8494 * size and density of simulated secondary display devices. 8495 * <p> 8496 * Format: {width}x{height}/{dpi};... 8497 * </p><p> 8498 * Example: 8499 * <ul> 8500 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li> 8501 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first 8502 * at 1080p and the second at 720p.</li> 8503 * <li>If the value is empty, then no overlay display devices are created.</li> 8504 * </ul></p> 8505 * 8506 * @hide 8507 */ 8508 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices"; 8509 8510 /** 8511 * Threshold values for the duration and level of a discharge cycle, 8512 * under which we log discharge cycle info. 8513 * 8514 * @hide 8515 */ 8516 public static final String 8517 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold"; 8518 8519 /** @hide */ 8520 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; 8521 8522 /** 8523 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR 8524 * intents on application crashes and ANRs. If this is disabled, the 8525 * crash/ANR dialog will never display the "Report" button. 8526 * <p> 8527 * Type: int (0 = disallow, 1 = allow) 8528 * 8529 * @hide 8530 */ 8531 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; 8532 8533 /** 8534 * Maximum age of entries kept by {@link DropBoxManager}. 8535 * 8536 * @hide 8537 */ 8538 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds"; 8539 8540 /** 8541 * Maximum number of entry files which {@link DropBoxManager} will keep 8542 * around. 8543 * 8544 * @hide 8545 */ 8546 public static final String DROPBOX_MAX_FILES = "dropbox_max_files"; 8547 8548 /** 8549 * Maximum amount of disk space used by {@link DropBoxManager} no matter 8550 * what. 8551 * 8552 * @hide 8553 */ 8554 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb"; 8555 8556 /** 8557 * Percent of free disk (excluding reserve) which {@link DropBoxManager} 8558 * will use. 8559 * 8560 * @hide 8561 */ 8562 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent"; 8563 8564 /** 8565 * Percent of total disk which {@link DropBoxManager} will never dip 8566 * into. 8567 * 8568 * @hide 8569 */ 8570 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent"; 8571 8572 /** 8573 * Prefix for per-tag dropbox disable/enable settings. 8574 * 8575 * @hide 8576 */ 8577 public static final String DROPBOX_TAG_PREFIX = "dropbox:"; 8578 8579 /** 8580 * Lines of logcat to include with system crash/ANR/etc. reports, as a 8581 * prefix of the dropbox tag of the report type. For example, 8582 * "logcat_for_system_server_anr" controls the lines of logcat captured 8583 * with system server ANR reports. 0 to disable. 8584 * 8585 * @hide 8586 */ 8587 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_"; 8588 8589 /** 8590 * The interval in minutes after which the amount of free storage left 8591 * on the device is logged to the event log 8592 * 8593 * @hide 8594 */ 8595 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; 8596 8597 /** 8598 * Threshold for the amount of change in disk free space required to 8599 * report the amount of free space. Used to prevent spamming the logs 8600 * when the disk free space isn't changing frequently. 8601 * 8602 * @hide 8603 */ 8604 public static final String 8605 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; 8606 8607 /** 8608 * Minimum percentage of free storage on the device that is used to 8609 * determine if the device is running low on storage. The default is 10. 8610 * <p> 8611 * Say this value is set to 10, the device is considered running low on 8612 * storage if 90% or more of the device storage is filled up. 8613 * 8614 * @hide 8615 */ 8616 public static final String 8617 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; 8618 8619 /** 8620 * Maximum byte size of the low storage threshold. This is to ensure 8621 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an 8622 * overly large threshold for large storage devices. Currently this must 8623 * be less than 2GB. This default is 500MB. 8624 * 8625 * @hide 8626 */ 8627 public static final String 8628 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes"; 8629 8630 /** 8631 * Minimum bytes of free storage on the device before the data partition 8632 * is considered full. By default, 1 MB is reserved to avoid system-wide 8633 * SQLite disk full exceptions. 8634 * 8635 * @hide 8636 */ 8637 public static final String 8638 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes"; 8639 8640 /** 8641 * Minimum percentage of storage on the device that is reserved for 8642 * cached data. 8643 * 8644 * @hide 8645 */ 8646 public static final String 8647 SYS_STORAGE_CACHE_PERCENTAGE = "sys_storage_cache_percentage"; 8648 8649 /** 8650 * Maximum bytes of storage on the device that is reserved for cached 8651 * data. 8652 * 8653 * @hide 8654 */ 8655 public static final String 8656 SYS_STORAGE_CACHE_MAX_BYTES = "sys_storage_cache_max_bytes"; 8657 8658 /** 8659 * The maximum reconnect delay for short network outages or when the 8660 * network is suspended due to phone use. 8661 * 8662 * @hide 8663 */ 8664 public static final String 8665 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; 8666 8667 /** 8668 * The number of milliseconds to delay before sending out 8669 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored. 8670 * 8671 * @hide 8672 */ 8673 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay"; 8674 8675 8676 /** 8677 * Network sampling interval, in seconds. We'll generate link information 8678 * about bytes/packets sent and error rates based on data sampled in this interval 8679 * 8680 * @hide 8681 */ 8682 8683 public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS = 8684 "connectivity_sampling_interval_in_seconds"; 8685 8686 /** 8687 * The series of successively longer delays used in retrying to download PAC file. 8688 * Last delay is used between successful PAC downloads. 8689 * 8690 * @hide 8691 */ 8692 public static final String PAC_CHANGE_DELAY = "pac_change_delay"; 8693 8694 /** 8695 * Don't attempt to detect captive portals. 8696 * 8697 * @hide 8698 */ 8699 public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0; 8700 8701 /** 8702 * When detecting a captive portal, display a notification that 8703 * prompts the user to sign in. 8704 * 8705 * @hide 8706 */ 8707 public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1; 8708 8709 /** 8710 * When detecting a captive portal, immediately disconnect from the 8711 * network and do not reconnect to that network in the future. 8712 * 8713 * @hide 8714 */ 8715 public static final int CAPTIVE_PORTAL_MODE_AVOID = 2; 8716 8717 /** 8718 * What to do when connecting a network that presents a captive portal. 8719 * Must be one of the CAPTIVE_PORTAL_MODE_* constants above. 8720 * 8721 * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT. 8722 * @hide 8723 */ 8724 public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode"; 8725 8726 /** 8727 * Setting to turn off captive portal detection. Feature is enabled by 8728 * default and the setting needs to be set to 0 to disable it. 8729 * 8730 * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection 8731 * @hide 8732 */ 8733 @Deprecated 8734 public static final String 8735 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled"; 8736 8737 /** 8738 * The server used for captive portal detection upon a new conection. A 8739 * 204 response code from the server is used for validation. 8740 * TODO: remove this deprecated symbol. 8741 * 8742 * @hide 8743 */ 8744 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server"; 8745 8746 /** 8747 * The URL used for HTTPS captive portal detection upon a new connection. 8748 * A 204 response code from the server is used for validation. 8749 * 8750 * @hide 8751 */ 8752 public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url"; 8753 8754 /** 8755 * The URL used for HTTP captive portal detection upon a new connection. 8756 * A 204 response code from the server is used for validation. 8757 * 8758 * @hide 8759 */ 8760 public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url"; 8761 8762 /** 8763 * The URL used for fallback HTTP captive portal detection when previous HTTP 8764 * and HTTPS captive portal detection attemps did not return a conclusive answer. 8765 * 8766 * @hide 8767 */ 8768 public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url"; 8769 8770 /** 8771 * Whether to use HTTPS for network validation. This is enabled by default and the setting 8772 * needs to be set to 0 to disable it. This setting is a misnomer because captive portals 8773 * don't actually use HTTPS, but it's consistent with the other settings. 8774 * 8775 * @hide 8776 */ 8777 public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https"; 8778 8779 /** 8780 * Which User-Agent string to use in the header of the captive portal detection probes. 8781 * The User-Agent field is unset when this setting has no value (HttpUrlConnection default). 8782 * 8783 * @hide 8784 */ 8785 public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent"; 8786 8787 /** 8788 * Whether network service discovery is enabled. 8789 * 8790 * @hide 8791 */ 8792 public static final String NSD_ON = "nsd_on"; 8793 8794 /** 8795 * Let user pick default install location. 8796 * 8797 * @hide 8798 */ 8799 public static final String SET_INSTALL_LOCATION = "set_install_location"; 8800 8801 /** 8802 * Default install location value. 8803 * 0 = auto, let system decide 8804 * 1 = internal 8805 * 2 = sdcard 8806 * @hide 8807 */ 8808 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; 8809 8810 /** 8811 * ms during which to consume extra events related to Inet connection 8812 * condition after a transtion to fully-connected 8813 * 8814 * @hide 8815 */ 8816 public static final String 8817 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay"; 8818 8819 /** 8820 * ms during which to consume extra events related to Inet connection 8821 * condtion after a transtion to partly-connected 8822 * 8823 * @hide 8824 */ 8825 public static final String 8826 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay"; 8827 8828 /** {@hide} */ 8829 public static final String 8830 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default"; 8831 8832 /** 8833 * Host name and port for global http proxy. Uses ':' seperator for 8834 * between host and port. 8835 */ 8836 public static final String HTTP_PROXY = "http_proxy"; 8837 8838 /** 8839 * Host name for global http proxy. Set via ConnectivityManager. 8840 * 8841 * @hide 8842 */ 8843 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host"; 8844 8845 /** 8846 * Integer host port for global http proxy. Set via ConnectivityManager. 8847 * 8848 * @hide 8849 */ 8850 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port"; 8851 8852 /** 8853 * Exclusion list for global proxy. This string contains a list of 8854 * comma-separated domains where the global proxy does not apply. 8855 * Domains should be listed in a comma- separated list. Example of 8856 * acceptable formats: ".domain1.com,my.domain2.com" Use 8857 * ConnectivityManager to set/get. 8858 * 8859 * @hide 8860 */ 8861 public static final String 8862 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list"; 8863 8864 /** 8865 * The location PAC File for the proxy. 8866 * @hide 8867 */ 8868 public static final String 8869 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url"; 8870 8871 /** 8872 * Enables the UI setting to allow the user to specify the global HTTP 8873 * proxy and associated exclusion list. 8874 * 8875 * @hide 8876 */ 8877 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy"; 8878 8879 /** 8880 * Setting for default DNS in case nobody suggests one 8881 * 8882 * @hide 8883 */ 8884 public static final String DEFAULT_DNS_SERVER = "default_dns_server"; 8885 8886 /** {@hide} */ 8887 public static final String 8888 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; 8889 /** {@hide} */ 8890 public static final String 8891 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; 8892 /** {@hide} */ 8893 public static final String 8894 BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_"; 8895 /** {@hide} */ 8896 public static final String 8897 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; 8898 /** {@hide} */ 8899 public static final String 8900 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_"; 8901 /** {@hide} */ 8902 public static final String 8903 BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_"; 8904 /** {@hide} */ 8905 public static final String 8906 BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_"; 8907 /** {@hide} */ 8908 public static final String 8909 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_"; 8910 /** {@hide} */ 8911 public static final String 8912 BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_"; 8913 8914 /** 8915 * Activity manager specific settings. 8916 * This is encoded as a key=value list, separated by commas. Ex: 8917 * 8918 * "enforce_bg_check=true,max_cached_processes=24" 8919 * 8920 * The following keys are supported: 8921 * 8922 * <pre> 8923 * enforce_bg_check (boolean) 8924 * max_cached_processes (int) 8925 * </pre> 8926 * 8927 * <p> 8928 * Type: string 8929 * @hide 8930 * @see com.android.server.am.ActivityManagerConstants 8931 */ 8932 public static final String ACTIVITY_MANAGER_CONSTANTS = "activity_manager_constants"; 8933 8934 /** 8935 * Device Idle (Doze) specific settings. 8936 * This is encoded as a key=value list, separated by commas. Ex: 8937 * 8938 * "inactive_to=60000,sensing_to=400000" 8939 * 8940 * The following keys are supported: 8941 * 8942 * <pre> 8943 * inactive_to (long) 8944 * sensing_to (long) 8945 * motion_inactive_to (long) 8946 * idle_after_inactive_to (long) 8947 * idle_pending_to (long) 8948 * max_idle_pending_to (long) 8949 * idle_pending_factor (float) 8950 * idle_to (long) 8951 * max_idle_to (long) 8952 * idle_factor (float) 8953 * min_time_to_alarm (long) 8954 * max_temp_app_whitelist_duration (long) 8955 * notification_whitelist_duration (long) 8956 * </pre> 8957 * 8958 * <p> 8959 * Type: string 8960 * @hide 8961 * @see com.android.server.DeviceIdleController.Constants 8962 */ 8963 public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants"; 8964 8965 /** 8966 * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS} 8967 * 8968 * <p> 8969 * Type: string 8970 * @hide 8971 * @see com.android.server.DeviceIdleController.Constants 8972 */ 8973 public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch"; 8974 8975 /** 8976 * Battery Saver specific settings 8977 * This is encoded as a key=value list, separated by commas. Ex: 8978 * 8979 * "vibration_disabled=true,adjust_brightness_factor=0.5" 8980 * 8981 * The following keys are supported: 8982 * 8983 * <pre> 8984 * vibration_disabled (boolean) 8985 * animation_disabled (boolean) 8986 * soundtrigger_disabled (boolean) 8987 * fullbackup_deferred (boolean) 8988 * keyvaluebackup_deferred (boolean) 8989 * firewall_disabled (boolean) 8990 * gps_mode (int) 8991 * adjust_brightness_disabled (boolean) 8992 * adjust_brightness_factor (float) 8993 * </pre> 8994 * @hide 8995 * @see com.android.server.power.BatterySaverPolicy 8996 */ 8997 public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants"; 8998 8999 /** 9000 * App standby (app idle) specific settings. 9001 * This is encoded as a key=value list, separated by commas. Ex: 9002 * 9003 * "idle_duration=5000,parole_interval=4500" 9004 * 9005 * The following keys are supported: 9006 * 9007 * <pre> 9008 * idle_duration2 (long) 9009 * wallclock_threshold (long) 9010 * parole_interval (long) 9011 * parole_duration (long) 9012 * 9013 * idle_duration (long) // This is deprecated and used to circumvent b/26355386. 9014 * </pre> 9015 * 9016 * <p> 9017 * Type: string 9018 * @hide 9019 * @see com.android.server.usage.UsageStatsService.SettingsObserver 9020 */ 9021 public static final String APP_IDLE_CONSTANTS = "app_idle_constants"; 9022 9023 /** 9024 * Power manager specific settings. 9025 * This is encoded as a key=value list, separated by commas. Ex: 9026 * 9027 * "no_cached_wake_locks=1" 9028 * 9029 * The following keys are supported: 9030 * 9031 * <pre> 9032 * no_cached_wake_locks (boolean) 9033 * </pre> 9034 * 9035 * <p> 9036 * Type: string 9037 * @hide 9038 * @see com.android.server.power.PowerManagerConstants 9039 */ 9040 public static final String POWER_MANAGER_CONSTANTS = "power_manager_constants"; 9041 9042 /** 9043 * Alarm manager specific settings. 9044 * This is encoded as a key=value list, separated by commas. Ex: 9045 * 9046 * "min_futurity=5000,allow_while_idle_short_time=4500" 9047 * 9048 * The following keys are supported: 9049 * 9050 * <pre> 9051 * min_futurity (long) 9052 * min_interval (long) 9053 * allow_while_idle_short_time (long) 9054 * allow_while_idle_long_time (long) 9055 * allow_while_idle_whitelist_duration (long) 9056 * </pre> 9057 * 9058 * <p> 9059 * Type: string 9060 * @hide 9061 * @see com.android.server.AlarmManagerService.Constants 9062 */ 9063 public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants"; 9064 9065 /** 9066 * Job scheduler specific settings. 9067 * This is encoded as a key=value list, separated by commas. Ex: 9068 * 9069 * "min_ready_jobs_count=2,moderate_use_factor=.5" 9070 * 9071 * The following keys are supported: 9072 * 9073 * <pre> 9074 * min_idle_count (int) 9075 * min_charging_count (int) 9076 * min_connectivity_count (int) 9077 * min_content_count (int) 9078 * min_ready_jobs_count (int) 9079 * heavy_use_factor (float) 9080 * moderate_use_factor (float) 9081 * fg_job_count (int) 9082 * bg_normal_job_count (int) 9083 * bg_moderate_job_count (int) 9084 * bg_low_job_count (int) 9085 * bg_critical_job_count (int) 9086 * </pre> 9087 * 9088 * <p> 9089 * Type: string 9090 * @hide 9091 * @see com.android.server.job.JobSchedulerService.Constants 9092 */ 9093 public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants"; 9094 9095 /** 9096 * ShortcutManager specific settings. 9097 * This is encoded as a key=value list, separated by commas. Ex: 9098 * 9099 * "reset_interval_sec=86400,max_updates_per_interval=1" 9100 * 9101 * The following keys are supported: 9102 * 9103 * <pre> 9104 * reset_interval_sec (long) 9105 * max_updates_per_interval (int) 9106 * max_icon_dimension_dp (int, DP) 9107 * max_icon_dimension_dp_lowram (int, DP) 9108 * max_shortcuts (int) 9109 * icon_quality (int, 0-100) 9110 * icon_format (String) 9111 * </pre> 9112 * 9113 * <p> 9114 * Type: string 9115 * @hide 9116 * @see com.android.server.pm.ShortcutService.ConfigConstants 9117 */ 9118 public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants"; 9119 9120 /** 9121 * Get the key that retrieves a bluetooth headset's priority. 9122 * @hide 9123 */ 9124 public static final String getBluetoothHeadsetPriorityKey(String address) { 9125 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9126 } 9127 9128 /** 9129 * Get the key that retrieves a bluetooth a2dp sink's priority. 9130 * @hide 9131 */ 9132 public static final String getBluetoothA2dpSinkPriorityKey(String address) { 9133 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9134 } 9135 9136 /** 9137 * Get the key that retrieves a bluetooth a2dp src's priority. 9138 * @hide 9139 */ 9140 public static final String getBluetoothA2dpSrcPriorityKey(String address) { 9141 return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9142 } 9143 9144 /** 9145 * Get the key that retrieves a bluetooth Input Device's priority. 9146 * @hide 9147 */ 9148 public static final String getBluetoothInputDevicePriorityKey(String address) { 9149 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9150 } 9151 9152 /** 9153 * Get the key that retrieves a bluetooth pan client priority. 9154 * @hide 9155 */ 9156 public static final String getBluetoothPanPriorityKey(String address) { 9157 return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9158 } 9159 9160 /** 9161 * Get the key that retrieves a bluetooth map priority. 9162 * @hide 9163 */ 9164 public static final String getBluetoothMapPriorityKey(String address) { 9165 return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9166 } 9167 9168 /** 9169 * Get the key that retrieves a bluetooth map client priority. 9170 * @hide 9171 */ 9172 public static final String getBluetoothMapClientPriorityKey(String address) { 9173 return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9174 } 9175 9176 /** 9177 * Get the key that retrieves a bluetooth pbap client priority. 9178 * @hide 9179 */ 9180 public static final String getBluetoothPbapClientPriorityKey(String address) { 9181 return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9182 } 9183 9184 /** 9185 * Get the key that retrieves a bluetooth sap priority. 9186 * @hide 9187 */ 9188 public static final String getBluetoothSapPriorityKey(String address) { 9189 return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); 9190 } 9191 9192 /** 9193 * Scaling factor for normal window animations. Setting to 0 will 9194 * disable window animations. 9195 */ 9196 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; 9197 9198 /** 9199 * Scaling factor for activity transition animations. Setting to 0 will 9200 * disable window animations. 9201 */ 9202 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; 9203 9204 /** 9205 * Scaling factor for Animator-based animations. This affects both the 9206 * start delay and duration of all such animations. Setting to 0 will 9207 * cause animations to end immediately. The default value is 1. 9208 */ 9209 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale"; 9210 9211 /** 9212 * Scaling factor for normal window animations. Setting to 0 will 9213 * disable window animations. 9214 * 9215 * @hide 9216 */ 9217 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations"; 9218 9219 /** 9220 * If 0, the compatibility mode is off for all applications. 9221 * If 1, older applications run under compatibility mode. 9222 * TODO: remove this settings before code freeze (bug/1907571) 9223 * @hide 9224 */ 9225 public static final String COMPATIBILITY_MODE = "compatibility_mode"; 9226 9227 /** 9228 * CDMA only settings 9229 * Emergency Tone 0 = Off 9230 * 1 = Alert 9231 * 2 = Vibrate 9232 * @hide 9233 */ 9234 public static final String EMERGENCY_TONE = "emergency_tone"; 9235 9236 /** 9237 * CDMA only settings 9238 * Whether the auto retry is enabled. The value is 9239 * boolean (1 or 0). 9240 * @hide 9241 */ 9242 public static final String CALL_AUTO_RETRY = "call_auto_retry"; 9243 9244 /** 9245 * A setting that can be read whether the emergency affordance is currently needed. 9246 * The value is a boolean (1 or 0). 9247 * @hide 9248 */ 9249 public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed"; 9250 9251 /** 9252 * See RIL_PreferredNetworkType in ril.h 9253 * @hide 9254 */ 9255 public static final String PREFERRED_NETWORK_MODE = 9256 "preferred_network_mode"; 9257 9258 /** 9259 * Name of an application package to be debugged. 9260 */ 9261 public static final String DEBUG_APP = "debug_app"; 9262 9263 /** 9264 * If 1, when launching DEBUG_APP it will wait for the debugger before 9265 * starting user code. If 0, it will run normally. 9266 */ 9267 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger"; 9268 9269 /** 9270 * Control whether the process CPU usage meter should be shown. 9271 * 9272 * @deprecated This functionality is no longer available as of 9273 * {@link android.os.Build.VERSION_CODES#N_MR1}. 9274 */ 9275 @Deprecated 9276 public static final String SHOW_PROCESSES = "show_processes"; 9277 9278 /** 9279 * If 1 low power mode is enabled. 9280 * @hide 9281 */ 9282 public static final String LOW_POWER_MODE = "low_power"; 9283 9284 /** 9285 * Battery level [1-99] at which low power mode automatically turns on. 9286 * If 0, it will not automatically turn on. 9287 * @hide 9288 */ 9289 public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level"; 9290 9291 /** 9292 * If not 0, the activity manager will aggressively finish activities and 9293 * processes as soon as they are no longer needed. If 0, the normal 9294 * extended lifetime is used. 9295 */ 9296 public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; 9297 9298 /** 9299 * Use Dock audio output for media: 9300 * 0 = disabled 9301 * 1 = enabled 9302 * @hide 9303 */ 9304 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled"; 9305 9306 /** 9307 * The surround sound formats AC3, DTS or IEC61937 are 9308 * available for use if they are detected. 9309 * This is the default mode. 9310 * 9311 * Note that AUTO is equivalent to ALWAYS for Android TVs and other 9312 * devices that have an S/PDIF output. This is because S/PDIF 9313 * is unidirectional and the TV cannot know if a decoder is 9314 * connected. So it assumes they are always available. 9315 * @hide 9316 */ 9317 public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0; 9318 9319 /** 9320 * AC3, DTS or IEC61937 are NEVER available, even if they 9321 * are detected by the hardware. Those formats will not be 9322 * reported. 9323 * 9324 * An example use case would be an AVR reports that it is capable of 9325 * surround sound decoding but is broken. If NEVER is chosen 9326 * then apps must use PCM output instead of encoded output. 9327 * @hide 9328 */ 9329 public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1; 9330 9331 /** 9332 * AC3, DTS or IEC61937 are ALWAYS available, even if they 9333 * are not detected by the hardware. Those formats will be 9334 * reported as part of the HDMI output capability. Applications 9335 * are then free to use either PCM or encoded output. 9336 * 9337 * An example use case would be a when TV was connected over 9338 * TOS-link to an AVR. But the TV could not see it because TOS-link 9339 * is unidirectional. 9340 * @hide 9341 */ 9342 public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2; 9343 9344 /** 9345 * Set to ENCODED_SURROUND_OUTPUT_AUTO, 9346 * ENCODED_SURROUND_OUTPUT_NEVER or 9347 * ENCODED_SURROUND_OUTPUT_ALWAYS 9348 * @hide 9349 */ 9350 public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output"; 9351 9352 /** 9353 * Persisted safe headphone volume management state by AudioService 9354 * @hide 9355 */ 9356 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; 9357 9358 /** 9359 * URL for tzinfo (time zone) updates 9360 * @hide 9361 */ 9362 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url"; 9363 9364 /** 9365 * URL for tzinfo (time zone) update metadata 9366 * @hide 9367 */ 9368 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url"; 9369 9370 /** 9371 * URL for selinux (mandatory access control) updates 9372 * @hide 9373 */ 9374 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url"; 9375 9376 /** 9377 * URL for selinux (mandatory access control) update metadata 9378 * @hide 9379 */ 9380 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url"; 9381 9382 /** 9383 * URL for sms short code updates 9384 * @hide 9385 */ 9386 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL = 9387 "sms_short_codes_content_url"; 9388 9389 /** 9390 * URL for sms short code update metadata 9391 * @hide 9392 */ 9393 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL = 9394 "sms_short_codes_metadata_url"; 9395 9396 /** 9397 * URL for apn_db updates 9398 * @hide 9399 */ 9400 public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url"; 9401 9402 /** 9403 * URL for apn_db update metadata 9404 * @hide 9405 */ 9406 public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url"; 9407 9408 /** 9409 * URL for cert pinlist updates 9410 * @hide 9411 */ 9412 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url"; 9413 9414 /** 9415 * URL for cert pinlist updates 9416 * @hide 9417 */ 9418 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url"; 9419 9420 /** 9421 * URL for intent firewall updates 9422 * @hide 9423 */ 9424 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL = 9425 "intent_firewall_content_url"; 9426 9427 /** 9428 * URL for intent firewall update metadata 9429 * @hide 9430 */ 9431 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL = 9432 "intent_firewall_metadata_url"; 9433 9434 /** 9435 * SELinux enforcement status. If 0, permissive; if 1, enforcing. 9436 * @hide 9437 */ 9438 public static final String SELINUX_STATUS = "selinux_status"; 9439 9440 /** 9441 * Developer setting to force RTL layout. 9442 * @hide 9443 */ 9444 public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl"; 9445 9446 /** 9447 * Milliseconds after screen-off after which low battery sounds will be silenced. 9448 * 9449 * If zero, battery sounds will always play. 9450 * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider. 9451 * 9452 * @hide 9453 */ 9454 public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout"; 9455 9456 /** 9457 * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after 9458 * the caller is done with this, they should call {@link ContentResolver#delete} to 9459 * clean up any value that they may have written. 9460 * 9461 * @hide 9462 */ 9463 public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms"; 9464 9465 /** 9466 * Defines global runtime overrides to window policy. 9467 * 9468 * See {@link com.android.server.policy.PolicyControl} for value format. 9469 * 9470 * @hide 9471 */ 9472 public static final String POLICY_CONTROL = "policy_control"; 9473 9474 /** 9475 * Defines global zen mode. ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS, 9476 * or ZEN_MODE_NO_INTERRUPTIONS. 9477 * 9478 * @hide 9479 */ 9480 public static final String ZEN_MODE = "zen_mode"; 9481 9482 /** @hide */ public static final int ZEN_MODE_OFF = 0; 9483 /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1; 9484 /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2; 9485 /** @hide */ public static final int ZEN_MODE_ALARMS = 3; 9486 9487 /** @hide */ public static String zenModeToString(int mode) { 9488 if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS"; 9489 if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS"; 9490 if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS"; 9491 return "ZEN_MODE_OFF"; 9492 } 9493 9494 /** @hide */ public static boolean isValidZenMode(int value) { 9495 switch (value) { 9496 case Global.ZEN_MODE_OFF: 9497 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: 9498 case Global.ZEN_MODE_ALARMS: 9499 case Global.ZEN_MODE_NO_INTERRUPTIONS: 9500 return true; 9501 default: 9502 return false; 9503 } 9504 } 9505 9506 /** 9507 * Value of the ringer before entering zen mode. 9508 * 9509 * @hide 9510 */ 9511 public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level"; 9512 9513 /** 9514 * Opaque value, changes when persisted zen mode configuration changes. 9515 * 9516 * @hide 9517 */ 9518 public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; 9519 9520 /** 9521 * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. 9522 * 9523 * @hide 9524 */ 9525 public static final String HEADS_UP_NOTIFICATIONS_ENABLED = 9526 "heads_up_notifications_enabled"; 9527 9528 /** @hide */ public static final int HEADS_UP_OFF = 0; 9529 /** @hide */ public static final int HEADS_UP_ON = 1; 9530 9531 /** 9532 * The name of the device 9533 */ 9534 public static final String DEVICE_NAME = "device_name"; 9535 9536 /** 9537 * Whether the NetworkScoringService has been first initialized. 9538 * <p> 9539 * Type: int (0 for false, 1 for true) 9540 * @hide 9541 */ 9542 public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned"; 9543 9544 /** 9545 * Whether the user wants to be prompted for password to decrypt the device on boot. 9546 * This only matters if the storage is encrypted. 9547 * <p> 9548 * Type: int (0 for false, 1 for true) 9549 * @hide 9550 */ 9551 public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt"; 9552 9553 /** 9554 * Whether the Volte is enabled 9555 * <p> 9556 * Type: int (0 for false, 1 for true) 9557 * @hide 9558 */ 9559 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; 9560 9561 /** 9562 * Whether VT (Video Telephony over IMS) is enabled 9563 * <p> 9564 * Type: int (0 for false, 1 for true) 9565 * 9566 * @hide 9567 */ 9568 public static final String VT_IMS_ENABLED = "vt_ims_enabled"; 9569 9570 /** 9571 * Whether WFC is enabled 9572 * <p> 9573 * Type: int (0 for false, 1 for true) 9574 * 9575 * @hide 9576 */ 9577 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled"; 9578 9579 /** 9580 * WFC mode on home/non-roaming network. 9581 * <p> 9582 * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only 9583 * 9584 * @hide 9585 */ 9586 public static final String WFC_IMS_MODE = "wfc_ims_mode"; 9587 9588 /** 9589 * WFC mode on roaming network. 9590 * <p> 9591 * Type: int - see {@link #WFC_IMS_MODE} for values 9592 * 9593 * @hide 9594 */ 9595 public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode"; 9596 9597 /** 9598 * Whether WFC roaming is enabled 9599 * <p> 9600 * Type: int (0 for false, 1 for true) 9601 * 9602 * @hide 9603 */ 9604 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled"; 9605 9606 /** 9607 * Whether user can enable/disable LTE as a preferred network. A carrier might control 9608 * this via gservices, OMA-DM, carrier app, etc. 9609 * <p> 9610 * Type: int (0 for false, 1 for true) 9611 * @hide 9612 */ 9613 public static final String LTE_SERVICE_FORCED = "lte_service_forced"; 9614 9615 /** 9616 * Ephemeral app cookie max size in bytes. 9617 * <p> 9618 * Type: int 9619 * @hide 9620 */ 9621 public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES = 9622 "ephemeral_cookie_max_size_bytes"; 9623 9624 /** 9625 * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is 9626 * enabled. Set to zero to disable. 9627 * <p> 9628 * Type: int (0 for false, 1 for true) 9629 * 9630 * @hide 9631 */ 9632 public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature"; 9633 9634 /** 9635 * The duration for caching uninstalled instant apps. 9636 * <p> 9637 * Type: long 9638 * @hide 9639 */ 9640 public static final String UNINSTALLED_INSTANT_APP_CACHE_DURATION_MILLIS = 9641 "uninstalled_instant_app_cache_duration_millis"; 9642 9643 /** 9644 * Allows switching users when system user is locked. 9645 * <p> 9646 * Type: int 9647 * @hide 9648 */ 9649 public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED = 9650 "allow_user_switching_when_system_user_locked"; 9651 9652 /** 9653 * Boot count since the device starts running APK level 24. 9654 * <p> 9655 * Type: int 9656 */ 9657 public static final String BOOT_COUNT = "boot_count"; 9658 9659 /** 9660 * Whether the safe boot is disallowed. 9661 * 9662 * <p>This setting should have the identical value as the corresponding user restriction. 9663 * The purpose of the setting is to make the restriction available in early boot stages 9664 * before the user restrictions are loaded. 9665 * @hide 9666 */ 9667 public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed"; 9668 9669 /** 9670 * Whether this device is currently in retail demo mode. If true, device 9671 * usage is severely limited. 9672 * <p> 9673 * Type: int (0 for false, 1 for true) 9674 * @hide 9675 */ 9676 public static final String DEVICE_DEMO_MODE = "device_demo_mode"; 9677 9678 /** 9679 * Retail mode specific settings. This is encoded as a key=value list, separated by commas. 9680 * Ex: "user_inactivity_timeout_ms=30000,warning_dialog_timeout_ms=10000". The following 9681 * keys are supported: 9682 * 9683 * <pre> 9684 * user_inactivity_timeout_ms (long) 9685 * warning_dialog_timeout_ms (long) 9686 * </pre> 9687 * <p> 9688 * Type: string 9689 * 9690 * @hide 9691 */ 9692 public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants"; 9693 9694 /** 9695 * The reason for the settings database being downgraded. This is only for 9696 * troubleshooting purposes and its value should not be interpreted in any way. 9697 * 9698 * Type: string 9699 * 9700 * @hide 9701 */ 9702 public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason"; 9703 9704 /** 9705 * Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by 9706 * default. Set to 0 to disable. 9707 * 9708 * @hide 9709 */ 9710 public static final String CONTACTS_DATABASE_WAL_ENABLED = "contacts_database_wal_enabled"; 9711 9712 /** 9713 * Flag to enable the link to location permissions in location setting. Set to 0 to disable. 9714 * 9715 * @hide 9716 */ 9717 public static final String LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED = 9718 "location_settings_link_to_permissions_enabled"; 9719 9720 /** 9721 * Settings to backup. This is here so that it's in the same place as the settings 9722 * keys and easy to update. 9723 * 9724 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System 9725 * and Secure as well. This is because those tables drive both backup and 9726 * restore, and restore needs to properly whitelist keys that used to live 9727 * in those namespaces. The keys will only actually be backed up / restored 9728 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). 9729 * 9730 * NOTE: Settings are backed up and restored in the order they appear 9731 * in this array. If you have one setting depending on another, 9732 * make sure that they are ordered appropriately. 9733 * 9734 * @hide 9735 */ 9736 public static final String[] SETTINGS_TO_BACKUP = { 9737 BUGREPORT_IN_POWER_MENU, 9738 STAY_ON_WHILE_PLUGGED_IN, 9739 AUTO_TIME, 9740 AUTO_TIME_ZONE, 9741 POWER_SOUNDS_ENABLED, 9742 DOCK_SOUNDS_ENABLED, 9743 CHARGING_SOUNDS_ENABLED, 9744 USB_MASS_STORAGE_ENABLED, 9745 NETWORK_RECOMMENDATIONS_ENABLED, 9746 CURATE_SAVED_OPEN_NETWORKS, 9747 WIFI_WAKEUP_ENABLED, 9748 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 9749 USE_OPEN_WIFI_PACKAGE, 9750 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, 9751 EMERGENCY_TONE, 9752 CALL_AUTO_RETRY, 9753 DOCK_AUDIO_MEDIA_ENABLED, 9754 ENCODED_SURROUND_OUTPUT, 9755 LOW_POWER_MODE_TRIGGER_LEVEL 9756 }; 9757 9758 private static final ContentProviderHolder sProviderHolder = 9759 new ContentProviderHolder(CONTENT_URI); 9760 9761 // Populated lazily, guarded by class object: 9762 private static final NameValueCache sNameValueCache = new NameValueCache( 9763 CONTENT_URI, 9764 CALL_METHOD_GET_GLOBAL, 9765 CALL_METHOD_PUT_GLOBAL, 9766 sProviderHolder); 9767 9768 // Certain settings have been moved from global to the per-user secure namespace 9769 private static final HashSet<String> MOVED_TO_SECURE; 9770 static { 9771 MOVED_TO_SECURE = new HashSet<>(1); 9772 MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); 9773 } 9774 9775 /** @hide */ 9776 public static void getMovedToSecureSettings(Set<String> outKeySet) { 9777 outKeySet.addAll(MOVED_TO_SECURE); 9778 } 9779 9780 /** 9781 * Look up a name in the database. 9782 * @param resolver to access the database with 9783 * @param name to look up in the table 9784 * @return the corresponding value, or null if not present 9785 */ 9786 public static String getString(ContentResolver resolver, String name) { 9787 return getStringForUser(resolver, name, UserHandle.myUserId()); 9788 } 9789 9790 /** @hide */ 9791 public static String getStringForUser(ContentResolver resolver, String name, 9792 int userHandle) { 9793 if (MOVED_TO_SECURE.contains(name)) { 9794 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 9795 + " to android.provider.Settings.Secure, returning read-only value."); 9796 return Secure.getStringForUser(resolver, name, userHandle); 9797 } 9798 return sNameValueCache.getStringForUser(resolver, name, userHandle); 9799 } 9800 9801 /** 9802 * Store a name/value pair into the database. 9803 * @param resolver to access the database with 9804 * @param name to store 9805 * @param value to associate with the name 9806 * @return true if the value was set, false on database errors 9807 */ 9808 public static boolean putString(ContentResolver resolver, 9809 String name, String value) { 9810 return putStringForUser(resolver, name, value, null, false, UserHandle.myUserId()); 9811 } 9812 9813 /** 9814 * Store a name/value pair into the database. 9815 * <p> 9816 * The method takes an optional tag to associate with the setting 9817 * which can be used to clear only settings made by your package and 9818 * associated with this tag by passing the tag to {@link 9819 * #resetToDefaults(ContentResolver, String)}. Anyone can override 9820 * the current tag. Also if another package changes the setting 9821 * then the tag will be set to the one specified in the set call 9822 * which can be null. Also any of the settings setters that do not 9823 * take a tag as an argument effectively clears the tag. 9824 * </p><p> 9825 * For example, if you set settings A and B with tags T1 and T2 and 9826 * another app changes setting A (potentially to the same value), it 9827 * can assign to it a tag T3 (note that now the package that changed 9828 * the setting is not yours). Now if you reset your changes for T1 and 9829 * T2 only setting B will be reset and A not (as it was changed by 9830 * another package) but since A did not change you are in the desired 9831 * initial state. Now if the other app changes the value of A (assuming 9832 * you registered an observer in the beginning) you would detect that 9833 * the setting was changed by another app and handle this appropriately 9834 * (ignore, set back to some value, etc). 9835 * </p><p> 9836 * Also the method takes an argument whether to make the value the 9837 * default for this setting. If the system already specified a default 9838 * value, then the one passed in here will <strong>not</strong> 9839 * be set as the default. 9840 * </p> 9841 * 9842 * @param resolver to access the database with. 9843 * @param name to store. 9844 * @param value to associate with the name. 9845 * @param tag to associated with the setting. 9846 * @param makeDefault whether to make the value the default one. 9847 * @return true if the value was set, false on database errors. 9848 * 9849 * @see #resetToDefaults(ContentResolver, String) 9850 * 9851 * @hide 9852 */ 9853 @SystemApi 9854 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 9855 public static boolean putString(@NonNull ContentResolver resolver, 9856 @NonNull String name, @Nullable String value, @Nullable String tag, 9857 boolean makeDefault) { 9858 return putStringForUser(resolver, name, value, tag, makeDefault, 9859 UserHandle.myUserId()); 9860 } 9861 9862 /** 9863 * Reset the settings to their defaults. This would reset <strong>only</strong> 9864 * settings set by the caller's package. Think of it of a way to undo your own 9865 * changes to the secure settings. Passing in the optional tag will reset only 9866 * settings changed by your package and associated with this tag. 9867 * 9868 * @param resolver Handle to the content resolver. 9869 * @param tag Optional tag which should be associated with the settings to reset. 9870 * 9871 * @see #putString(ContentResolver, String, String, String, boolean) 9872 * 9873 * @hide 9874 */ 9875 @SystemApi 9876 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) 9877 public static void resetToDefaults(@NonNull ContentResolver resolver, 9878 @Nullable String tag) { 9879 resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS, 9880 UserHandle.myUserId()); 9881 } 9882 9883 /** 9884 * Reset the settings to their defaults for a given user with a specific mode. The 9885 * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS} 9886 * allowing resetting the settings made by a package and associated with the tag. 9887 * 9888 * @param resolver Handle to the content resolver. 9889 * @param tag Optional tag which should be associated with the settings to reset. 9890 * @param mode The reset mode. 9891 * @param userHandle The user for which to reset to defaults. 9892 * 9893 * @see #RESET_MODE_PACKAGE_DEFAULTS 9894 * @see #RESET_MODE_UNTRUSTED_DEFAULTS 9895 * @see #RESET_MODE_UNTRUSTED_CHANGES 9896 * @see #RESET_MODE_TRUSTED_DEFAULTS 9897 * 9898 * @hide 9899 */ 9900 public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver, 9901 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) { 9902 try { 9903 Bundle arg = new Bundle(); 9904 arg.putInt(CALL_METHOD_USER_KEY, userHandle); 9905 if (tag != null) { 9906 arg.putString(CALL_METHOD_TAG_KEY, tag); 9907 } 9908 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode); 9909 IContentProvider cp = sProviderHolder.getProvider(resolver); 9910 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_GLOBAL, null, arg); 9911 } catch (RemoteException e) { 9912 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e); 9913 } 9914 } 9915 9916 /** @hide */ 9917 public static boolean putStringForUser(ContentResolver resolver, 9918 String name, String value, int userHandle) { 9919 return putStringForUser(resolver, name, value, null, false, userHandle); 9920 } 9921 9922 /** @hide */ 9923 public static boolean putStringForUser(@NonNull ContentResolver resolver, 9924 @NonNull String name, @Nullable String value, @Nullable String tag, 9925 boolean makeDefault, @UserIdInt int userHandle) { 9926 if (LOCAL_LOGV) { 9927 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value 9928 + " for " + userHandle); 9929 } 9930 // Global and Secure have the same access policy so we can forward writes 9931 if (MOVED_TO_SECURE.contains(name)) { 9932 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" 9933 + " to android.provider.Settings.Secure, value is unchanged."); 9934 return Secure.putStringForUser(resolver, name, value, tag, 9935 makeDefault, userHandle); 9936 } 9937 return sNameValueCache.putStringForUser(resolver, name, value, tag, 9938 makeDefault, userHandle); 9939 } 9940 9941 /** 9942 * Construct the content URI for a particular name/value pair, 9943 * useful for monitoring changes with a ContentObserver. 9944 * @param name to look up in the table 9945 * @return the corresponding content URI, or null if not present 9946 */ 9947 public static Uri getUriFor(String name) { 9948 return getUriFor(CONTENT_URI, name); 9949 } 9950 9951 /** 9952 * Convenience function for retrieving a single secure settings value 9953 * as an integer. Note that internally setting values are always 9954 * stored as strings; this function converts the string to an integer 9955 * for you. The default value will be returned if the setting is 9956 * not defined or not an integer. 9957 * 9958 * @param cr The ContentResolver to access. 9959 * @param name The name of the setting to retrieve. 9960 * @param def Value to return if the setting is not defined. 9961 * 9962 * @return The setting's current value, or 'def' if it is not defined 9963 * or not a valid integer. 9964 */ 9965 public static int getInt(ContentResolver cr, String name, int def) { 9966 String v = getString(cr, name); 9967 try { 9968 return v != null ? Integer.parseInt(v) : def; 9969 } catch (NumberFormatException e) { 9970 return def; 9971 } 9972 } 9973 9974 /** 9975 * Convenience function for retrieving a single secure settings value 9976 * as an integer. Note that internally setting values are always 9977 * stored as strings; this function converts the string to an integer 9978 * for you. 9979 * <p> 9980 * This version does not take a default value. If the setting has not 9981 * been set, or the string value is not a number, 9982 * it throws {@link SettingNotFoundException}. 9983 * 9984 * @param cr The ContentResolver to access. 9985 * @param name The name of the setting to retrieve. 9986 * 9987 * @throws SettingNotFoundException Thrown if a setting by the given 9988 * name can't be found or the setting value is not an integer. 9989 * 9990 * @return The setting's current value. 9991 */ 9992 public static int getInt(ContentResolver cr, String name) 9993 throws SettingNotFoundException { 9994 String v = getString(cr, name); 9995 try { 9996 return Integer.parseInt(v); 9997 } catch (NumberFormatException e) { 9998 throw new SettingNotFoundException(name); 9999 } 10000 } 10001 10002 /** 10003 * Convenience function for updating a single settings value as an 10004 * integer. This will either create a new entry in the table if the 10005 * given name does not exist, or modify the value of the existing row 10006 * with that name. Note that internally setting values are always 10007 * stored as strings, so this function converts the given value to a 10008 * string before storing it. 10009 * 10010 * @param cr The ContentResolver to access. 10011 * @param name The name of the setting to modify. 10012 * @param value The new value for the setting. 10013 * @return true if the value was set, false on database errors 10014 */ 10015 public static boolean putInt(ContentResolver cr, String name, int value) { 10016 return putString(cr, name, Integer.toString(value)); 10017 } 10018 10019 /** 10020 * Convenience function for retrieving a single secure settings value 10021 * as a {@code long}. Note that internally setting values are always 10022 * stored as strings; this function converts the string to a {@code long} 10023 * for you. The default value will be returned if the setting is 10024 * not defined or not a {@code long}. 10025 * 10026 * @param cr The ContentResolver to access. 10027 * @param name The name of the setting to retrieve. 10028 * @param def Value to return if the setting is not defined. 10029 * 10030 * @return The setting's current value, or 'def' if it is not defined 10031 * or not a valid {@code long}. 10032 */ 10033 public static long getLong(ContentResolver cr, String name, long def) { 10034 String valString = getString(cr, name); 10035 long value; 10036 try { 10037 value = valString != null ? Long.parseLong(valString) : def; 10038 } catch (NumberFormatException e) { 10039 value = def; 10040 } 10041 return value; 10042 } 10043 10044 /** 10045 * Convenience function for retrieving a single secure settings value 10046 * as a {@code long}. Note that internally setting values are always 10047 * stored as strings; this function converts the string to a {@code long} 10048 * for you. 10049 * <p> 10050 * This version does not take a default value. If the setting has not 10051 * been set, or the string value is not a number, 10052 * it throws {@link SettingNotFoundException}. 10053 * 10054 * @param cr The ContentResolver to access. 10055 * @param name The name of the setting to retrieve. 10056 * 10057 * @return The setting's current value. 10058 * @throws SettingNotFoundException Thrown if a setting by the given 10059 * name can't be found or the setting value is not an integer. 10060 */ 10061 public static long getLong(ContentResolver cr, String name) 10062 throws SettingNotFoundException { 10063 String valString = getString(cr, name); 10064 try { 10065 return Long.parseLong(valString); 10066 } catch (NumberFormatException e) { 10067 throw new SettingNotFoundException(name); 10068 } 10069 } 10070 10071 /** 10072 * Convenience function for updating a secure settings value as a long 10073 * integer. This will either create a new entry in the table if the 10074 * given name does not exist, or modify the value of the existing row 10075 * with that name. Note that internally setting values are always 10076 * stored as strings, so this function converts the given value to a 10077 * string before storing it. 10078 * 10079 * @param cr The ContentResolver to access. 10080 * @param name The name of the setting to modify. 10081 * @param value The new value for the setting. 10082 * @return true if the value was set, false on database errors 10083 */ 10084 public static boolean putLong(ContentResolver cr, String name, long value) { 10085 return putString(cr, name, Long.toString(value)); 10086 } 10087 10088 /** 10089 * Convenience function for retrieving a single secure settings value 10090 * as a floating point number. Note that internally setting values are 10091 * always stored as strings; this function converts the string to an 10092 * float for you. The default value will be returned if the setting 10093 * is not defined or not a valid float. 10094 * 10095 * @param cr The ContentResolver to access. 10096 * @param name The name of the setting to retrieve. 10097 * @param def Value to return if the setting is not defined. 10098 * 10099 * @return The setting's current value, or 'def' if it is not defined 10100 * or not a valid float. 10101 */ 10102 public static float getFloat(ContentResolver cr, String name, float def) { 10103 String v = getString(cr, name); 10104 try { 10105 return v != null ? Float.parseFloat(v) : def; 10106 } catch (NumberFormatException e) { 10107 return def; 10108 } 10109 } 10110 10111 /** 10112 * Convenience function for retrieving a single secure settings value 10113 * as a float. Note that internally setting values are always 10114 * stored as strings; this function converts the string to a float 10115 * for you. 10116 * <p> 10117 * This version does not take a default value. If the setting has not 10118 * been set, or the string value is not a number, 10119 * it throws {@link SettingNotFoundException}. 10120 * 10121 * @param cr The ContentResolver to access. 10122 * @param name The name of the setting to retrieve. 10123 * 10124 * @throws SettingNotFoundException Thrown if a setting by the given 10125 * name can't be found or the setting value is not a float. 10126 * 10127 * @return The setting's current value. 10128 */ 10129 public static float getFloat(ContentResolver cr, String name) 10130 throws SettingNotFoundException { 10131 String v = getString(cr, name); 10132 if (v == null) { 10133 throw new SettingNotFoundException(name); 10134 } 10135 try { 10136 return Float.parseFloat(v); 10137 } catch (NumberFormatException e) { 10138 throw new SettingNotFoundException(name); 10139 } 10140 } 10141 10142 /** 10143 * Convenience function for updating a single settings value as a 10144 * floating point number. This will either create a new entry in the 10145 * table if the given name does not exist, or modify the value of the 10146 * existing row with that name. Note that internally setting values 10147 * are always stored as strings, so this function converts the given 10148 * value to a string before storing it. 10149 * 10150 * @param cr The ContentResolver to access. 10151 * @param name The name of the setting to modify. 10152 * @param value The new value for the setting. 10153 * @return true if the value was set, false on database errors 10154 */ 10155 public static boolean putFloat(ContentResolver cr, String name, float value) { 10156 return putString(cr, name, Float.toString(value)); 10157 } 10158 10159 /** 10160 * Subscription to be used for voice call on a multi sim device. The supported values 10161 * are 0 = SUB1, 1 = SUB2 and etc. 10162 * @hide 10163 */ 10164 public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; 10165 10166 /** 10167 * Used to provide option to user to select subscription during dial. 10168 * The supported values are 0 = disable or 1 = enable prompt. 10169 * @hide 10170 */ 10171 public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt"; 10172 10173 /** 10174 * Subscription to be used for data 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_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; 10179 10180 /** 10181 * Subscription to be used for SMS on a multi sim device. The supported values 10182 * are 0 = SUB1, 1 = SUB2 and etc. 10183 * @hide 10184 */ 10185 public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms"; 10186 10187 /** 10188 * Used to provide option to user to select subscription during send SMS. 10189 * The value 1 - enable, 0 - disable 10190 * @hide 10191 */ 10192 public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt"; 10193 10194 10195 10196 /** User preferred subscriptions setting. 10197 * This holds the details of the user selected subscription from the card and 10198 * the activation status. Each settings string have the coma separated values 10199 * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index 10200 * @hide 10201 */ 10202 public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1", 10203 "user_preferred_sub2","user_preferred_sub3"}; 10204 10205 /** 10206 * Whether to enable new contacts aggregator or not. 10207 * The value 1 - enable, 0 - disable 10208 * @hide 10209 */ 10210 public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator"; 10211 10212 /** 10213 * Whether to enable contacts metadata syncing or not 10214 * The value 1 - enable, 0 - disable 10215 * 10216 * @removed 10217 */ 10218 @Deprecated 10219 public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync"; 10220 10221 /** 10222 * Whether to enable contacts metadata syncing or not 10223 * The value 1 - enable, 0 - disable 10224 */ 10225 public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled"; 10226 10227 /** 10228 * Whether to enable cellular on boot. 10229 * The value 1 - enable, 0 - disable 10230 * @hide 10231 */ 10232 public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot"; 10233 10234 /** 10235 * The maximum allowed notification enqueue rate in Hertz. 10236 * 10237 * Should be a float, and includes both posts and updates. 10238 * @hide 10239 */ 10240 public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate"; 10241 10242 /** 10243 * Whether cell is enabled/disabled 10244 * @hide 10245 */ 10246 public static final String CELL_ON = "cell_on"; 10247 10248 /** 10249 * Global settings which can be accessed by instant apps. 10250 * @hide 10251 */ 10252 public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>(); 10253 static { 10254 INSTANT_APP_SETTINGS.add(WAIT_FOR_DEBUGGER); 10255 INSTANT_APP_SETTINGS.add(DEVICE_PROVISIONED); 10256 INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES); 10257 INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RTL); 10258 INSTANT_APP_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES); 10259 } 10260 10261 /** 10262 * Whether to show the high temperature warning notification. 10263 * @hide 10264 */ 10265 public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning"; 10266 10267 /** 10268 * Temperature at which the high temperature warning notification should be shown. 10269 * @hide 10270 */ 10271 public static final String WARNING_TEMPERATURE = "warning_temperature"; 10272 10273 /** 10274 * Whether the diskstats logging task is enabled/disabled. 10275 * @hide 10276 */ 10277 public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging"; 10278 10279 /** 10280 * Whether the cache quota calculation task is enabled/disabled. 10281 * @hide 10282 */ 10283 public static final String ENABLE_CACHE_QUOTA_CALCULATION = 10284 "enable_cache_quota_calculation"; 10285 } 10286 10287 /** 10288 * User-defined bookmarks and shortcuts. The target of each bookmark is an 10289 * Intent URL, allowing it to be either a web page or a particular 10290 * application activity. 10291 * 10292 * @hide 10293 */ 10294 public static final class Bookmarks implements BaseColumns 10295 { 10296 private static final String TAG = "Bookmarks"; 10297 10298 /** 10299 * The content:// style URL for this table 10300 */ 10301 public static final Uri CONTENT_URI = 10302 Uri.parse("content://" + AUTHORITY + "/bookmarks"); 10303 10304 /** 10305 * The row ID. 10306 * <p>Type: INTEGER</p> 10307 */ 10308 public static final String ID = "_id"; 10309 10310 /** 10311 * Descriptive name of the bookmark that can be displayed to the user. 10312 * If this is empty, the title should be resolved at display time (use 10313 * {@link #getTitle(Context, Cursor)} any time you want to display the 10314 * title of a bookmark.) 10315 * <P> 10316 * Type: TEXT 10317 * </P> 10318 */ 10319 public static final String TITLE = "title"; 10320 10321 /** 10322 * Arbitrary string (displayed to the user) that allows bookmarks to be 10323 * organized into categories. There are some special names for 10324 * standard folders, which all start with '@'. The label displayed for 10325 * the folder changes with the locale (via {@link #getLabelForFolder}) but 10326 * the folder name does not change so you can consistently query for 10327 * the folder regardless of the current locale. 10328 * 10329 * <P>Type: TEXT</P> 10330 * 10331 */ 10332 public static final String FOLDER = "folder"; 10333 10334 /** 10335 * The Intent URL of the bookmark, describing what it points to. This 10336 * value is given to {@link android.content.Intent#getIntent} to create 10337 * an Intent that can be launched. 10338 * <P>Type: TEXT</P> 10339 */ 10340 public static final String INTENT = "intent"; 10341 10342 /** 10343 * Optional shortcut character associated with this bookmark. 10344 * <P>Type: INTEGER</P> 10345 */ 10346 public static final String SHORTCUT = "shortcut"; 10347 10348 /** 10349 * The order in which the bookmark should be displayed 10350 * <P>Type: INTEGER</P> 10351 */ 10352 public static final String ORDERING = "ordering"; 10353 10354 private static final String[] sIntentProjection = { INTENT }; 10355 private static final String[] sShortcutProjection = { ID, SHORTCUT }; 10356 private static final String sShortcutSelection = SHORTCUT + "=?"; 10357 10358 /** 10359 * Convenience function to retrieve the bookmarked Intent for a 10360 * particular shortcut key. 10361 * 10362 * @param cr The ContentResolver to query. 10363 * @param shortcut The shortcut key. 10364 * 10365 * @return Intent The bookmarked URL, or null if there is no bookmark 10366 * matching the given shortcut. 10367 */ 10368 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut) 10369 { 10370 Intent intent = null; 10371 10372 Cursor c = cr.query(CONTENT_URI, 10373 sIntentProjection, sShortcutSelection, 10374 new String[] { String.valueOf((int) shortcut) }, ORDERING); 10375 // Keep trying until we find a valid shortcut 10376 try { 10377 while (intent == null && c.moveToNext()) { 10378 try { 10379 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT)); 10380 intent = Intent.parseUri(intentURI, 0); 10381 } catch (java.net.URISyntaxException e) { 10382 // The stored URL is bad... ignore it. 10383 } catch (IllegalArgumentException e) { 10384 // Column not found 10385 Log.w(TAG, "Intent column not found", e); 10386 } 10387 } 10388 } finally { 10389 if (c != null) c.close(); 10390 } 10391 10392 return intent; 10393 } 10394 10395 /** 10396 * Add a new bookmark to the system. 10397 * 10398 * @param cr The ContentResolver to query. 10399 * @param intent The desired target of the bookmark. 10400 * @param title Bookmark title that is shown to the user; null if none 10401 * or it should be resolved to the intent's title. 10402 * @param folder Folder in which to place the bookmark; null if none. 10403 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If 10404 * this is non-zero and there is an existing bookmark entry 10405 * with this same shortcut, then that existing shortcut is 10406 * cleared (the bookmark is not removed). 10407 * @return The unique content URL for the new bookmark entry. 10408 */ 10409 public static Uri add(ContentResolver cr, 10410 Intent intent, 10411 String title, 10412 String folder, 10413 char shortcut, 10414 int ordering) 10415 { 10416 // If a shortcut is supplied, and it is already defined for 10417 // another bookmark, then remove the old definition. 10418 if (shortcut != 0) { 10419 cr.delete(CONTENT_URI, sShortcutSelection, 10420 new String[] { String.valueOf((int) shortcut) }); 10421 } 10422 10423 ContentValues values = new ContentValues(); 10424 if (title != null) values.put(TITLE, title); 10425 if (folder != null) values.put(FOLDER, folder); 10426 values.put(INTENT, intent.toUri(0)); 10427 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut); 10428 values.put(ORDERING, ordering); 10429 return cr.insert(CONTENT_URI, values); 10430 } 10431 10432 /** 10433 * Return the folder name as it should be displayed to the user. This 10434 * takes care of localizing special folders. 10435 * 10436 * @param r Resources object for current locale; only need access to 10437 * system resources. 10438 * @param folder The value found in the {@link #FOLDER} column. 10439 * 10440 * @return CharSequence The label for this folder that should be shown 10441 * to the user. 10442 */ 10443 public static CharSequence getLabelForFolder(Resources r, String folder) { 10444 return folder; 10445 } 10446 10447 /** 10448 * Return the title as it should be displayed to the user. This takes 10449 * care of localizing bookmarks that point to activities. 10450 * 10451 * @param context A context. 10452 * @param cursor A cursor pointing to the row whose title should be 10453 * returned. The cursor must contain at least the {@link #TITLE} 10454 * and {@link #INTENT} columns. 10455 * @return A title that is localized and can be displayed to the user, 10456 * or the empty string if one could not be found. 10457 */ 10458 public static CharSequence getTitle(Context context, Cursor cursor) { 10459 int titleColumn = cursor.getColumnIndex(TITLE); 10460 int intentColumn = cursor.getColumnIndex(INTENT); 10461 if (titleColumn == -1 || intentColumn == -1) { 10462 throw new IllegalArgumentException( 10463 "The cursor must contain the TITLE and INTENT columns."); 10464 } 10465 10466 String title = cursor.getString(titleColumn); 10467 if (!TextUtils.isEmpty(title)) { 10468 return title; 10469 } 10470 10471 String intentUri = cursor.getString(intentColumn); 10472 if (TextUtils.isEmpty(intentUri)) { 10473 return ""; 10474 } 10475 10476 Intent intent; 10477 try { 10478 intent = Intent.parseUri(intentUri, 0); 10479 } catch (URISyntaxException e) { 10480 return ""; 10481 } 10482 10483 PackageManager packageManager = context.getPackageManager(); 10484 ResolveInfo info = packageManager.resolveActivity(intent, 0); 10485 return info != null ? info.loadLabel(packageManager) : ""; 10486 } 10487 } 10488 10489 /** 10490 * Returns the device ID that we should use when connecting to the mobile gtalk server. 10491 * This is a string like "android-0x1242", where the hex string is the Android ID obtained 10492 * from the GoogleLoginService. 10493 * 10494 * @param androidId The Android ID for this device. 10495 * @return The device ID that should be used when connecting to the mobile gtalk server. 10496 * @hide 10497 */ 10498 public static String getGTalkDeviceId(long androidId) { 10499 return "android-" + Long.toHexString(androidId); 10500 } 10501 10502 private static final String[] PM_WRITE_SETTINGS = { 10503 android.Manifest.permission.WRITE_SETTINGS 10504 }; 10505 private static final String[] PM_CHANGE_NETWORK_STATE = { 10506 android.Manifest.permission.CHANGE_NETWORK_STATE, 10507 android.Manifest.permission.WRITE_SETTINGS 10508 }; 10509 private static final String[] PM_SYSTEM_ALERT_WINDOW = { 10510 android.Manifest.permission.SYSTEM_ALERT_WINDOW 10511 }; 10512 10513 /** 10514 * Performs a strict and comprehensive check of whether a calling package is allowed to 10515 * write/modify system settings, as the condition differs for pre-M, M+, and 10516 * privileged/preinstalled apps. If the provided uid does not match the 10517 * callingPackage, a negative result will be returned. 10518 * @hide 10519 */ 10520 public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid, 10521 String callingPackage, boolean throwException) { 10522 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10523 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS, 10524 PM_WRITE_SETTINGS, false); 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. The caller is expected to have 10532 * the WRITE_SETTINGS permission declared. 10533 * 10534 * Note: if the check is successful, the operation of this app will be updated to the 10535 * current time. 10536 * @hide 10537 */ 10538 public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid, 10539 String callingPackage, boolean throwException) { 10540 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10541 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS, 10542 PM_WRITE_SETTINGS, true); 10543 } 10544 10545 /** 10546 * Performs a strict and comprehensive check of whether a calling package is allowed to 10547 * change the state of network, as the condition differs for pre-M, M+, and 10548 * privileged/preinstalled apps. The caller is expected to have either the 10549 * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these 10550 * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and 10551 * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal 10552 * permission and cannot be revoked. See http://b/23597341 10553 * 10554 * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation 10555 * of this app will be updated to the current time. 10556 * @hide 10557 */ 10558 public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid, 10559 String callingPackage, boolean throwException) { 10560 if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE) 10561 == PackageManager.PERMISSION_GRANTED) { 10562 return true; 10563 } 10564 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10565 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS, 10566 PM_CHANGE_NETWORK_STATE, true); 10567 } 10568 10569 /** 10570 * Performs a strict and comprehensive check of whether a calling package is allowed to 10571 * draw on top of other apps, as the conditions differs for pre-M, M+, and 10572 * privileged/preinstalled apps. If the provided uid does not match the callingPackage, 10573 * a negative result will be returned. 10574 * @hide 10575 */ 10576 public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid, 10577 String callingPackage, boolean throwException) { 10578 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10579 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW, 10580 PM_SYSTEM_ALERT_WINDOW, false); 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 * 10589 * Note: if the check is successful, the operation of this app will be updated to the 10590 * current time. 10591 * @hide 10592 */ 10593 public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String 10594 callingPackage, boolean throwException) { 10595 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid, 10596 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW, 10597 PM_SYSTEM_ALERT_WINDOW, true); 10598 } 10599 10600 /** 10601 * Helper method to perform a general and comprehensive check of whether an operation that is 10602 * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and 10603 * OP_WRITE_SETTINGS 10604 * @hide 10605 */ 10606 public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context, 10607 int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[] 10608 permissions, boolean makeNote) { 10609 if (callingPackage == null) { 10610 return false; 10611 } 10612 10613 AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE); 10614 int mode = AppOpsManager.MODE_DEFAULT; 10615 if (makeNote) { 10616 mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage); 10617 } else { 10618 mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage); 10619 } 10620 10621 switch (mode) { 10622 case AppOpsManager.MODE_ALLOWED: 10623 return true; 10624 10625 case AppOpsManager.MODE_DEFAULT: 10626 // this is the default operating mode after an app's installation 10627 // In this case we will check all associated static permission to see 10628 // if it is granted during install time. 10629 for (String permission : permissions) { 10630 if (context.checkCallingOrSelfPermission(permission) == PackageManager 10631 .PERMISSION_GRANTED) { 10632 // if either of the permissions are granted, we will allow it 10633 return true; 10634 } 10635 } 10636 10637 default: 10638 // this is for all other cases trickled down here... 10639 if (!throwException) { 10640 return false; 10641 } 10642 } 10643 10644 // prepare string to throw SecurityException 10645 StringBuilder exceptionMessage = new StringBuilder(); 10646 exceptionMessage.append(callingPackage); 10647 exceptionMessage.append(" was not granted "); 10648 if (permissions.length > 1) { 10649 exceptionMessage.append(" either of these permissions: "); 10650 } else { 10651 exceptionMessage.append(" this permission: "); 10652 } 10653 for (int i = 0; i < permissions.length; i++) { 10654 exceptionMessage.append(permissions[i]); 10655 exceptionMessage.append((i == permissions.length - 1) ? "." : ", "); 10656 } 10657 10658 throw new SecurityException(exceptionMessage.toString()); 10659 } 10660 10661 /** 10662 * Retrieves a correponding package name for a given uid. It will query all 10663 * packages that are associated with the given uid, but it will return only 10664 * the zeroth result. 10665 * Note: If package could not be found, a null is returned. 10666 * @hide 10667 */ 10668 public static String getPackageNameForUid(Context context, int uid) { 10669 String[] packages = context.getPackageManager().getPackagesForUid(uid); 10670 if (packages == null) { 10671 return null; 10672 } 10673 return packages[0]; 10674 } 10675} 10676