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