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