2 * Copyright (C) 2006 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.provider;
19 import android.Manifest;
20 import android.annotation.IntDef;
21 import android.annotation.IntRange;
22 import android.annotation.NonNull;
23 import android.annotation.Nullable;
24 import android.annotation.RequiresPermission;
25 import android.annotation.SdkConstant;
26 import android.annotation.SdkConstant.SdkConstantType;
27 import android.annotation.SystemApi;
28 import android.annotation.TestApi;
29 import android.annotation.UserIdInt;
30 import android.app.ActivityThread;
31 import android.app.AppOpsManager;
32 import android.app.Application;
33 import android.app.NotificationChannel;
34 import android.app.NotificationManager;
35 import android.app.SearchManager;
36 import android.app.WallpaperManager;
37 import android.content.ComponentName;
38 import android.content.ContentResolver;
39 import android.content.ContentValues;
40 import android.content.Context;
41 import android.content.IContentProvider;
42 import android.content.Intent;
43 import android.content.pm.ActivityInfo;
44 import android.content.pm.PackageManager;
45 import android.content.pm.ResolveInfo;
46 import android.content.res.Configuration;
47 import android.content.res.Resources;
48 import android.database.Cursor;
49 import android.database.SQLException;
50 import android.location.LocationManager;
51 import android.net.ConnectivityManager;
52 import android.net.NetworkScoreManager;
53 import android.net.Uri;
54 import android.net.wifi.WifiManager;
55 import android.os.BatteryManager;
56 import android.os.Binder;
57 import android.os.Build.VERSION_CODES;
58 import android.os.Bundle;
59 import android.os.DropBoxManager;
60 import android.os.IBinder;
61 import android.os.LocaleList;
62 import android.os.Process;
63 import android.os.RemoteException;
64 import android.os.ResultReceiver;
65 import android.os.ServiceManager;
66 import android.os.UserHandle;
67 import android.speech.tts.TextToSpeech;
68 import android.text.TextUtils;
69 import android.util.AndroidException;
70 import android.util.ArrayMap;
71 import android.util.ArraySet;
72 import android.util.Log;
73 import android.util.MemoryIntArray;
75 import com.android.internal.annotations.GuardedBy;
76 import com.android.internal.util.ArrayUtils;
77 import com.android.internal.widget.ILockSettings;
79 import java.io.IOException;
80 import java.lang.annotation.Retention;
81 import java.lang.annotation.RetentionPolicy;
82 import java.net.URISyntaxException;
83 import java.text.SimpleDateFormat;
84 import java.util.HashMap;
85 import java.util.HashSet;
86 import java.util.Locale;
91 * The Settings provider contains global system-level device preferences.
93 public final class Settings {
95 // Intent actions for Settings
98 * Activity Action: Show system settings.
104 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
105 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
108 * Activity Action: Show settings to allow configuration of APNs.
114 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
115 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
118 * Activity Action: Show settings to allow configuration of current location
121 * In some cases, a matching Activity may not exist, so ensure you
122 * safeguard against this.
128 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
129 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
130 "android.settings.LOCATION_SOURCE_SETTINGS";
133 * Activity Action: Show settings to allow configuration of users.
135 * In some cases, a matching Activity may not exist, so ensure you
136 * safeguard against this.
143 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
144 public static final String ACTION_USER_SETTINGS =
145 "android.settings.USER_SETTINGS";
148 * Activity Action: Show settings to allow configuration of wireless controls
149 * such as Wi-Fi, Bluetooth and Mobile networks.
151 * In some cases, a matching Activity may not exist, so ensure you
152 * safeguard against this.
158 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
159 public static final String ACTION_WIRELESS_SETTINGS =
160 "android.settings.WIRELESS_SETTINGS";
163 * Activity Action: Show tether provisioning activity.
166 * In some cases, a matching Activity may not exist, so ensure you
167 * safeguard against this.
169 * Input: {@link ConnectivityManager#EXTRA_TETHER_TYPE} should be included to specify which type
170 * of tethering should be checked. {@link ConnectivityManager#EXTRA_PROVISION_CALLBACK} should
171 * contain a {@link ResultReceiver} which will be called back with a tether result code.
173 * Output: The result of the provisioning check.
174 * {@link ConnectivityManager#TETHER_ERROR_NO_ERROR} if successful,
175 * {@link ConnectivityManager#TETHER_ERROR_PROVISION_FAILED} for failure.
179 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
180 public static final String ACTION_TETHER_PROVISIONING =
181 "android.settings.TETHER_PROVISIONING_UI";
184 * Activity Action: Show settings to allow entering/exiting airplane mode.
186 * In some cases, a matching Activity may not exist, so ensure you
187 * safeguard against this.
193 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
194 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
195 "android.settings.AIRPLANE_MODE_SETTINGS";
198 * Activity Action: Show mobile data usage list.
200 * Input: {@link EXTRA_NETWORK_TEMPLATE} and {@link EXTRA_SUB_ID} should be included to specify
201 * how and what mobile data statistics should be collected.
206 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
207 public static final String ACTION_MOBILE_DATA_USAGE =
208 "android.settings.MOBILE_DATA_USAGE";
211 public static final String EXTRA_NETWORK_TEMPLATE = "network_template";
213 public static final String EXTRA_SUB_ID = "sub_id";
216 * Activity Action: Modify Airplane mode settings using a voice command.
218 * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
220 * This intent MUST be started using
221 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
222 * startVoiceActivity}.
224 * Note: The activity implementing this intent MUST verify that
225 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
226 * modifying the setting.
228 * Input: To tell which state airplane mode should be set to, add the
229 * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified.
230 * If the extra is not included, no changes will be made.
234 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
235 public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE =
236 "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
239 * Activity Action: Show settings for accessibility modules.
241 * In some cases, a matching Activity may not exist, so ensure you
242 * safeguard against this.
248 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
249 public static final String ACTION_ACCESSIBILITY_SETTINGS =
250 "android.settings.ACCESSIBILITY_SETTINGS";
253 * Activity Action: Show settings to control access to usage information.
255 * In some cases, a matching Activity may not exist, so ensure you
256 * safeguard against this.
262 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
263 public static final String ACTION_USAGE_ACCESS_SETTINGS =
264 "android.settings.USAGE_ACCESS_SETTINGS";
267 * Activity Category: Show application settings related to usage access.
269 * An activity that provides a user interface for adjusting usage access related
270 * preferences for its containing application. Optional but recommended for apps that
271 * use {@link android.Manifest.permission#PACKAGE_USAGE_STATS}.
273 * The activity may define meta-data to describe what usage access is
274 * used for within their app with {@link #METADATA_USAGE_ACCESS_REASON}, which
275 * will be displayed in Settings.
281 @SdkConstant(SdkConstantType.INTENT_CATEGORY)
282 public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG =
283 "android.intent.category.USAGE_ACCESS_CONFIG";
286 * Metadata key: Reason for needing usage access.
288 * A key for metadata attached to an activity that receives action
289 * {@link #INTENT_CATEGORY_USAGE_ACCESS_CONFIG}, shown to the
290 * user as description of how the app uses usage access.
293 public static final String METADATA_USAGE_ACCESS_REASON =
294 "android.settings.metadata.USAGE_ACCESS_REASON";
297 * Activity Action: Show settings to allow configuration of security and
300 * In some cases, a matching Activity may not exist, so ensure you
301 * safeguard against this.
307 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
308 public static final String ACTION_SECURITY_SETTINGS =
309 "android.settings.SECURITY_SETTINGS";
312 * Activity Action: Show settings to allow configuration of trusted external sources
314 * Input: Optionally, the Intent's data URI can specify the application package name to
315 * directly invoke the management GUI specific to the package name. For example
316 * "package:com.my.app".
320 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
321 public static final String ACTION_MANAGE_UNKNOWN_APP_SOURCES =
322 "android.settings.MANAGE_UNKNOWN_APP_SOURCES";
325 * Activity Action: Show trusted credentials settings, opening to the user tab,
326 * to allow management of installed credentials.
328 * In some cases, a matching Activity may not exist, so ensure you
329 * safeguard against this.
336 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
337 public static final String ACTION_TRUSTED_CREDENTIALS_USER =
338 "com.android.settings.TRUSTED_CREDENTIALS_USER";
341 * Activity Action: Show dialog explaining that an installed CA cert may enable
342 * monitoring of encrypted network traffic.
344 * In some cases, a matching Activity may not exist, so ensure you
345 * safeguard against this. Add {@link #EXTRA_NUMBER_OF_CERTIFICATES} extra to indicate the
346 * number of certificates.
353 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
354 public static final String ACTION_MONITORING_CERT_INFO =
355 "com.android.settings.MONITORING_CERT_INFO";
358 * Activity Action: Show settings to allow configuration of privacy options.
360 * In some cases, a matching Activity may not exist, so ensure you
361 * safeguard against this.
367 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
368 public static final String ACTION_PRIVACY_SETTINGS =
369 "android.settings.PRIVACY_SETTINGS";
372 * Activity Action: Show settings to allow configuration of VPN.
374 * In some cases, a matching Activity may not exist, so ensure you
375 * safeguard against this.
381 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
382 public static final String ACTION_VPN_SETTINGS =
383 "android.settings.VPN_SETTINGS";
386 * Activity Action: Show settings to allow configuration of Wi-Fi.
388 * In some cases, a matching Activity may not exist, so ensure you
389 * safeguard against this.
395 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
396 public static final String ACTION_WIFI_SETTINGS =
397 "android.settings.WIFI_SETTINGS";
400 * Activity Action: Show settings to allow configuration of a static IP
403 * In some cases, a matching Activity may not exist, so ensure you safeguard
410 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
411 public static final String ACTION_WIFI_IP_SETTINGS =
412 "android.settings.WIFI_IP_SETTINGS";
415 * Activity Action: Show settings to allow configuration of Bluetooth.
417 * In some cases, a matching Activity may not exist, so ensure you
418 * safeguard against this.
424 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
425 public static final String ACTION_BLUETOOTH_SETTINGS =
426 "android.settings.BLUETOOTH_SETTINGS";
429 * Activity Action: Show settings to allow configuration of Assist Gesture.
431 * In some cases, a matching Activity may not exist, so ensure you
432 * safeguard against this.
439 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
440 public static final String ACTION_ASSIST_GESTURE_SETTINGS =
441 "android.settings.ASSIST_GESTURE_SETTINGS";
444 * Activity Action: Show settings to allow configuration of cast endpoints.
446 * In some cases, a matching Activity may not exist, so ensure you
447 * safeguard against this.
453 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
454 public static final String ACTION_CAST_SETTINGS =
455 "android.settings.CAST_SETTINGS";
458 * Activity Action: Show settings to allow configuration of date and time.
460 * In some cases, a matching Activity may not exist, so ensure you
461 * safeguard against this.
467 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
468 public static final String ACTION_DATE_SETTINGS =
469 "android.settings.DATE_SETTINGS";
472 * Activity Action: Show settings to allow configuration of sound and volume.
474 * In some cases, a matching Activity may not exist, so ensure you
475 * safeguard against this.
481 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
482 public static final String ACTION_SOUND_SETTINGS =
483 "android.settings.SOUND_SETTINGS";
486 * Activity Action: Show settings to allow configuration of display.
488 * In some cases, a matching Activity may not exist, so ensure you
489 * safeguard against this.
495 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
496 public static final String ACTION_DISPLAY_SETTINGS =
497 "android.settings.DISPLAY_SETTINGS";
500 * Activity Action: Show settings to allow configuration of Night display.
502 * In some cases, a matching Activity may not exist, so ensure you
503 * safeguard against this.
509 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
510 public static final String ACTION_NIGHT_DISPLAY_SETTINGS =
511 "android.settings.NIGHT_DISPLAY_SETTINGS";
514 * Activity Action: Show settings to allow configuration of locale.
516 * In some cases, a matching Activity may not exist, so ensure you
517 * safeguard against this.
523 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
524 public static final String ACTION_LOCALE_SETTINGS =
525 "android.settings.LOCALE_SETTINGS";
528 * Activity Action: Show settings to configure input methods, in particular
529 * allowing the user to enable input methods.
531 * In some cases, a matching Activity may not exist, so ensure you
532 * safeguard against this.
538 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
539 public static final String ACTION_VOICE_INPUT_SETTINGS =
540 "android.settings.VOICE_INPUT_SETTINGS";
543 * Activity Action: Show settings to configure input methods, in particular
544 * allowing the user to enable input methods.
546 * In some cases, a matching Activity may not exist, so ensure you
547 * safeguard against this.
553 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
554 public static final String ACTION_INPUT_METHOD_SETTINGS =
555 "android.settings.INPUT_METHOD_SETTINGS";
558 * Activity Action: Show settings to enable/disable input method subtypes.
560 * In some cases, a matching Activity may not exist, so ensure you
561 * safeguard against this.
563 * To tell which input method's subtypes are displayed in the settings, add
564 * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
565 * If there is no extra in this Intent, subtypes from all installed input methods
566 * will be displayed in the settings.
568 * @see android.view.inputmethod.InputMethodInfo#getId
574 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
575 public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
576 "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
579 * Activity Action: Show settings to manage the user input dictionary.
581 * Starting with {@link android.os.Build.VERSION_CODES#KITKAT},
582 * it is guaranteed there will always be an appropriate implementation for this Intent action.
583 * In prior releases of the platform this was optional, so ensure you safeguard against it.
589 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
590 public static final String ACTION_USER_DICTIONARY_SETTINGS =
591 "android.settings.USER_DICTIONARY_SETTINGS";
594 * Activity Action: Show settings to configure the hardware keyboard.
596 * In some cases, a matching Activity may not exist, so ensure you
597 * safeguard against this.
603 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
604 public static final String ACTION_HARD_KEYBOARD_SETTINGS =
605 "android.settings.HARD_KEYBOARD_SETTINGS";
608 * Activity Action: Adds a word to the user dictionary.
610 * In some cases, a matching Activity may not exist, so ensure you
611 * safeguard against this.
613 * Input: An extra with key <code>word</code> that contains the word
614 * that should be added to the dictionary.
620 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
621 public static final String ACTION_USER_DICTIONARY_INSERT =
622 "com.android.settings.USER_DICTIONARY_INSERT";
625 * Activity Action: Show settings to allow configuration of application-related settings.
627 * In some cases, a matching Activity may not exist, so ensure you
628 * safeguard against this.
634 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
635 public static final String ACTION_APPLICATION_SETTINGS =
636 "android.settings.APPLICATION_SETTINGS";
639 * Activity Action: Show settings to allow configuration of application
640 * development-related settings. As of
641 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
642 * a required part of the platform.
648 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
649 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
650 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
653 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
655 * In some cases, a matching Activity may not exist, so ensure you
656 * safeguard against this.
662 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
663 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
664 "android.settings.QUICK_LAUNCH_SETTINGS";
667 * Activity Action: Show settings to manage installed applications.
669 * In some cases, a matching Activity may not exist, so ensure you
670 * safeguard against this.
676 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
677 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
678 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
681 * Activity Action: Show settings to manage all applications.
683 * In some cases, a matching Activity may not exist, so ensure you
684 * safeguard against this.
690 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
691 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
692 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
695 * Activity Action: Show screen for controlling which apps can draw on top of other apps.
697 * In some cases, a matching Activity may not exist, so ensure you
698 * safeguard against this.
700 * Input: Optionally, the Intent's data URI can specify the application package name to
701 * directly invoke the management GUI specific to the package name. For example
702 * "package:com.my.app".
706 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
707 public static final String ACTION_MANAGE_OVERLAY_PERMISSION =
708 "android.settings.action.MANAGE_OVERLAY_PERMISSION";
711 * Activity Action: Show screen for controlling which apps are allowed to write/modify
714 * In some cases, a matching Activity may not exist, so ensure you
715 * safeguard against this.
717 * Input: Optionally, the Intent's data URI can specify the application package name to
718 * directly invoke the management GUI specific to the package name. For example
719 * "package:com.my.app".
723 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
724 public static final String ACTION_MANAGE_WRITE_SETTINGS =
725 "android.settings.action.MANAGE_WRITE_SETTINGS";
728 * Activity Action: Show screen of details about a particular application.
730 * In some cases, a matching Activity may not exist, so ensure you
731 * safeguard against this.
733 * Input: The Intent's data URI specifies the application package name
734 * to be shown, with the "package" scheme. That is "package:com.my.app".
738 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
739 public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
740 "android.settings.APPLICATION_DETAILS_SETTINGS";
743 * Activity Action: Show list of applications that have been running
744 * foreground services (to the user "running in the background").
746 * Input: Extras "packages" is a string array of package names.
751 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
752 public static final String ACTION_FOREGROUND_SERVICES_SETTINGS =
753 "android.settings.FOREGROUND_SERVICES_SETTINGS";
756 * Activity Action: Show screen for controlling which apps can ignore battery optimizations.
762 * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
763 * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
764 * already ignoring optimizations. You can use
765 * {@link #ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} to ask the user to put you
768 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
769 public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS =
770 "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS";
773 * Activity Action: Ask the user to allow an app to ignore battery optimizations (that is,
774 * put them on the whitelist of apps shown by
775 * {@link #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}). For an app to use this, it also
776 * must hold the {@link android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}
778 * <p><b>Note:</b> most applications should <em>not</em> use this; there are many facilities
779 * provided by the platform for applications to operate correctly in the various power
780 * saving modes. This is only for unusual applications that need to deeply control their own
781 * execution, at the potential expense of the user's battery life. Note that these applications
782 * greatly run the risk of showing to the user as high power consumers on their device.</p>
784 * Input: The Intent's data URI must specify the application package name
785 * to be shown, with the "package" scheme. That is "package:com.my.app".
789 * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
790 * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
791 * already ignoring optimizations.
793 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
794 public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS =
795 "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
798 * Activity Action: Show screen for controlling background data
799 * restrictions for a particular application.
801 * Input: Intent's data URI set with an application name, using the
802 * "package" schema (like "package:com.my.app").
807 * Applications can also use {@link android.net.ConnectivityManager#getRestrictBackgroundStatus
808 * ConnectivityManager#getRestrictBackgroundStatus()} to determine the
809 * status of the background data restrictions for them.
811 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
812 public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS =
813 "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS";
817 * Activity Action: Show the "app ops" settings screen.
823 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
824 public static final String ACTION_APP_OPS_SETTINGS =
825 "android.settings.APP_OPS_SETTINGS";
828 * Activity Action: Show settings for system update functionality.
830 * In some cases, a matching Activity may not exist, so ensure you
831 * safeguard against this.
839 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
840 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
841 "android.settings.SYSTEM_UPDATE_SETTINGS";
844 * Activity Action: Show settings for managed profile settings.
846 * In some cases, a matching Activity may not exist, so ensure you
847 * safeguard against this.
855 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
856 public static final String ACTION_MANAGED_PROFILE_SETTINGS =
857 "android.settings.MANAGED_PROFILE_SETTINGS";
860 * Activity Action: Show settings to allow configuration of sync settings.
862 * In some cases, a matching Activity may not exist, so ensure you
863 * safeguard against this.
865 * The account types available to add via the add account button may be restricted by adding an
866 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
867 * authorities. Only account types which can sync with that content provider will be offered to
874 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
875 public static final String ACTION_SYNC_SETTINGS =
876 "android.settings.SYNC_SETTINGS";
879 * Activity Action: Show add account screen for creating a new account.
881 * In some cases, a matching Activity may not exist, so ensure you
882 * safeguard against this.
884 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
885 * extra to the Intent with one or more syncable content provider's authorities. Only account
886 * types which can sync with that content provider will be offered to the user.
888 * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the
889 * Intent with one or more account types.
895 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
896 public static final String ACTION_ADD_ACCOUNT =
897 "android.settings.ADD_ACCOUNT_SETTINGS";
900 * Activity Action: Show settings for selecting the network operator.
902 * In some cases, a matching Activity may not exist, so ensure you
903 * safeguard against this.
909 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
910 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
911 "android.settings.NETWORK_OPERATOR_SETTINGS";
914 * Activity Action: Show settings for selection of 2G/3G.
916 * In some cases, a matching Activity may not exist, so ensure you
917 * safeguard against this.
923 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
924 public static final String ACTION_DATA_ROAMING_SETTINGS =
925 "android.settings.DATA_ROAMING_SETTINGS";
928 * Activity Action: Show settings for internal storage.
930 * In some cases, a matching Activity may not exist, so ensure you
931 * safeguard against this.
937 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
938 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
939 "android.settings.INTERNAL_STORAGE_SETTINGS";
941 * Activity Action: Show settings for memory card storage.
943 * In some cases, a matching Activity may not exist, so ensure you
944 * safeguard against this.
950 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
951 public static final String ACTION_MEMORY_CARD_SETTINGS =
952 "android.settings.MEMORY_CARD_SETTINGS";
955 * Activity Action: Show settings for global search.
957 * In some cases, a matching Activity may not exist, so ensure you
958 * safeguard against this.
964 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
965 public static final String ACTION_SEARCH_SETTINGS =
966 "android.search.action.SEARCH_SETTINGS";
969 * Activity Action: Show general device information settings (serial
970 * number, software version, phone number, etc.).
972 * In some cases, a matching Activity may not exist, so ensure you
973 * safeguard against this.
979 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
980 public static final String ACTION_DEVICE_INFO_SETTINGS =
981 "android.settings.DEVICE_INFO_SETTINGS";
984 * Activity Action: Show NFC settings.
986 * This shows UI that allows NFC to be turned on or off.
988 * In some cases, a matching Activity may not exist, so ensure you
989 * safeguard against this.
994 * @see android.nfc.NfcAdapter#isEnabled()
996 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
997 public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
1000 * Activity Action: Show NFC Sharing settings.
1002 * This shows UI that allows NDEF Push (Android Beam) to be turned on or
1005 * In some cases, a matching Activity may not exist, so ensure you
1006 * safeguard against this.
1011 * @see android.nfc.NfcAdapter#isNdefPushEnabled()
1013 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1014 public static final String ACTION_NFCSHARING_SETTINGS =
1015 "android.settings.NFCSHARING_SETTINGS";
1018 * Activity Action: Show NFC Tap & Pay settings
1020 * This shows UI that allows the user to configure Tap&Pay
1023 * In some cases, a matching Activity may not exist, so ensure you
1024 * safeguard against this.
1030 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1031 public static final String ACTION_NFC_PAYMENT_SETTINGS =
1032 "android.settings.NFC_PAYMENT_SETTINGS";
1035 * Activity Action: Show Daydream settings.
1037 * In some cases, a matching Activity may not exist, so ensure you
1038 * safeguard against this.
1043 * @see android.service.dreams.DreamService
1045 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1046 public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
1049 * Activity Action: Show Notification listener settings.
1051 * In some cases, a matching Activity may not exist, so ensure you
1052 * safeguard against this.
1057 * @see android.service.notification.NotificationListenerService
1059 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1060 public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS
1061 = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
1064 * Activity Action: Show Do Not Disturb access settings.
1066 * Users can grant and deny access to Do Not Disturb configuration from here.
1067 * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more
1074 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1075 public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS
1076 = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
1081 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1082 public static final String ACTION_CONDITION_PROVIDER_SETTINGS
1083 = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
1086 * Activity Action: Show settings for video captioning.
1088 * In some cases, a matching Activity may not exist, so ensure you safeguard
1095 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1096 public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
1099 * Activity Action: Show the top level print settings.
1101 * In some cases, a matching Activity may not exist, so ensure you
1102 * safeguard against this.
1108 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1109 public static final String ACTION_PRINT_SETTINGS =
1110 "android.settings.ACTION_PRINT_SETTINGS";
1113 * Activity Action: Show Zen Mode configuration settings.
1117 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1118 public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS";
1121 * Activity Action: Show Zen Mode (aka Do Not Disturb) priority configuration settings.
1123 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1124 public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS
1125 = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
1128 * Activity Action: Show Zen Mode automation configuration settings.
1132 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1133 public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS
1134 = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS";
1137 * Activity Action: Modify do not disturb mode settings.
1139 * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
1141 * This intent MUST be started using
1142 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
1143 * startVoiceActivity}.
1145 * Note: The Activity implementing this intent MUST verify that
1146 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}.
1147 * returns true before modifying the setting.
1149 * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate
1150 * how long the user wishes to avoid interruptions for. The optional
1151 * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is
1152 * enabling or disabling do not disturb mode. If either extra is not included, the
1153 * user maybe asked to provide the value.
1157 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1158 public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE =
1159 "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE";
1162 * Activity Action: Show Zen Mode schedule rule configuration settings.
1166 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1167 public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS
1168 = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS";
1171 * Activity Action: Show Zen Mode event rule configuration settings.
1175 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1176 public static final String ACTION_ZEN_MODE_EVENT_RULE_SETTINGS
1177 = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS";
1180 * Activity Action: Show Zen Mode external rule configuration settings.
1184 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1185 public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS
1186 = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS";
1189 * Activity Action: Show the regulatory information screen for the device.
1191 * In some cases, a matching Activity may not exist, so ensure you safeguard
1198 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1199 public static final String
1200 ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
1203 * Activity Action: Show Device Name Settings.
1205 * In some cases, a matching Activity may not exist, so ensure you safeguard
1210 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1211 public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME";
1214 * Activity Action: Show pairing settings.
1216 * In some cases, a matching Activity may not exist, so ensure you safeguard
1221 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1222 public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
1225 * Activity Action: Show battery saver settings.
1227 * In some cases, a matching Activity may not exist, so ensure you safeguard
1230 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1231 public static final String ACTION_BATTERY_SAVER_SETTINGS
1232 = "android.settings.BATTERY_SAVER_SETTINGS";
1235 * Activity Action: Modify Battery Saver mode setting using a voice command.
1237 * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
1239 * This intent MUST be started using
1240 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
1241 * startVoiceActivity}.
1243 * Note: The activity implementing this intent MUST verify that
1244 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
1245 * modifying the setting.
1247 * Input: To tell which state batter saver mode should be set to, add the
1248 * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified.
1249 * If the extra is not included, no changes will be made.
1253 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1254 public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE =
1255 "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE";
1258 * Activity Action: Show Home selection settings. If there are multiple activities
1259 * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you
1260 * to pick your preferred activity.
1262 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1263 public static final String ACTION_HOME_SETTINGS
1264 = "android.settings.HOME_SETTINGS";
1267 * Activity Action: Show Default apps settings.
1269 * In some cases, a matching Activity may not exist, so ensure you
1270 * safeguard against this.
1276 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1277 public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS
1278 = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS";
1281 * Activity Action: Show notification settings.
1285 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1286 public static final String ACTION_NOTIFICATION_SETTINGS
1287 = "android.settings.NOTIFICATION_SETTINGS";
1290 * Activity Action: Show notification settings for a single app.
1292 * Input: {@link #EXTRA_APP_PACKAGE}, the package containing the channel to display.
1293 * Input: Optionally, {@link #EXTRA_CHANNEL_ID}, to highlight that channel.
1297 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1298 public static final String ACTION_APP_NOTIFICATION_SETTINGS
1299 = "android.settings.APP_NOTIFICATION_SETTINGS";
1302 * Activity Action: Show notification settings for a single {@link NotificationChannel}.
1304 * Input: {@link #EXTRA_APP_PACKAGE}, the package containing the channel to display.
1305 * Input: {@link #EXTRA_CHANNEL_ID}, the id of the channel to display.
1309 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1310 public static final String ACTION_CHANNEL_NOTIFICATION_SETTINGS
1311 = "android.settings.CHANNEL_NOTIFICATION_SETTINGS";
1314 * Activity Extra: The package owner of the notification channel settings to display.
1316 * This must be passed as an extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}.
1318 public static final String EXTRA_APP_PACKAGE = "android.provider.extra.APP_PACKAGE";
1321 * Activity Extra: The {@link NotificationChannel#getId()} of the notification channel settings
1324 * This must be passed as an extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}.
1326 public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID";
1329 * Activity Action: Show notification redaction settings.
1333 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1334 public static final String ACTION_APP_NOTIFICATION_REDACTION
1335 = "android.settings.ACTION_APP_NOTIFICATION_REDACTION";
1337 /** @hide */ public static final String EXTRA_APP_UID = "app_uid";
1340 * Activity Action: Show a dialog with disabled by policy message.
1341 * <p> If an user action is disabled by policy, this dialog can be triggered to let
1342 * the user know about this.
1350 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1351 public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS
1352 = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
1355 * Activity Action: Show a dialog for remote bugreport flow.
1363 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1364 public static final String ACTION_SHOW_REMOTE_BUGREPORT_DIALOG
1365 = "android.settings.SHOW_REMOTE_BUGREPORT_DIALOG";
1368 * Activity Action: Show VR listener settings.
1374 * @see android.service.vr.VrListenerService
1376 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1377 public static final String ACTION_VR_LISTENER_SETTINGS
1378 = "android.settings.VR_LISTENER_SETTINGS";
1381 * Activity Action: Show Picture-in-picture settings.
1389 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1390 public static final String ACTION_PICTURE_IN_PICTURE_SETTINGS
1391 = "android.settings.PICTURE_IN_PICTURE_SETTINGS";
1394 * Activity Action: Show Storage Manager settings.
1402 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1403 public static final String ACTION_STORAGE_MANAGER_SETTINGS
1404 = "android.settings.STORAGE_MANAGER_SETTINGS";
1407 * Activity Action: Allows user to select current webview implementation.
1413 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1414 public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
1417 * Activity Action: Show enterprise privacy section.
1426 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1427 public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS
1428 = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
1431 * Activity Action: Show screen that let user select its Autofill Service.
1433 * Input: Intent's data URI set with an application name, using the
1434 * "package" schema (like "package:com.my.app").
1437 * Output: {@link android.app.Activity#RESULT_OK} if user selected an Autofill Service belonging
1438 * to the caller package.
1441 * <b>NOTE: </b> Applications should call
1442 * {@link android.view.autofill.AutofillManager#hasEnabledAutofillServices()} and
1443 * {@link android.view.autofill.AutofillManager#isAutofillSupported()}, and only use this action
1444 * to start an activity if they return {@code false} and {@code true} respectively.
1446 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1447 public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE =
1448 "android.settings.REQUEST_SET_AUTOFILL_SERVICE";
1450 // End of Intent actions for Settings
1453 * @hide - Private call() method on SettingsProvider to read from 'system' table.
1455 public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
1458 * @hide - Private call() method on SettingsProvider to read from 'secure' table.
1460 public static final String CALL_METHOD_GET_SECURE = "GET_secure";
1463 * @hide - Private call() method on SettingsProvider to read from 'global' table.
1465 public static final String CALL_METHOD_GET_GLOBAL = "GET_global";
1468 * @hide - Specifies that the caller of the fast-path call()-based flow tracks
1469 * the settings generation in order to cache values locally. If this key is
1470 * mapped to a <code>null</code> string extra in the request bundle, the response
1471 * bundle will contain the same key mapped to a parcelable extra which would be
1472 * an {@link android.util.MemoryIntArray}. The response will also contain an
1473 * integer mapped to the {@link #CALL_METHOD_GENERATION_INDEX_KEY} which is the
1474 * index in the array clients should use to lookup the generation. For efficiency
1475 * the caller should request the generation tracking memory array only if it
1476 * doesn't already have it.
1478 * @see #CALL_METHOD_GENERATION_INDEX_KEY
1480 public static final String CALL_METHOD_TRACK_GENERATION_KEY = "_track_generation";
1483 * @hide Key with the location in the {@link android.util.MemoryIntArray} where
1484 * to look up the generation id of the backing table. The value is an integer.
1486 * @see #CALL_METHOD_TRACK_GENERATION_KEY
1488 public static final String CALL_METHOD_GENERATION_INDEX_KEY = "_generation_index";
1491 * @hide Key with the settings table generation. The value is an integer.
1493 * @see #CALL_METHOD_TRACK_GENERATION_KEY
1495 public static final String CALL_METHOD_GENERATION_KEY = "_generation";
1498 * @hide - User handle argument extra to the fast-path call()-based requests
1500 public static final String CALL_METHOD_USER_KEY = "_user";
1503 * @hide - Boolean argument extra to the fast-path call()-based requests
1505 public static final String CALL_METHOD_MAKE_DEFAULT_KEY = "_make_default";
1508 * @hide - User handle argument extra to the fast-path call()-based requests
1510 public static final String CALL_METHOD_RESET_MODE_KEY = "_reset_mode";
1513 * @hide - String argument extra to the fast-path call()-based requests
1515 public static final String CALL_METHOD_TAG_KEY = "_tag";
1517 /** @hide - Private call() method to write to 'system' table */
1518 public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
1520 /** @hide - Private call() method to write to 'secure' table */
1521 public static final String CALL_METHOD_PUT_SECURE = "PUT_secure";
1523 /** @hide - Private call() method to write to 'global' table */
1524 public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global";
1526 /** @hide - Private call() method to reset to defaults the 'global' table */
1527 public static final String CALL_METHOD_RESET_GLOBAL = "RESET_global";
1529 /** @hide - Private call() method to reset to defaults the 'secure' table */
1530 public static final String CALL_METHOD_RESET_SECURE = "RESET_secure";
1533 * Activity Extra: Limit available options in launched activity based on the given authority.
1535 * This can be passed as an extra field in an Activity Intent with one or more syncable content
1536 * provider's authorities as a String[]. This field is used by some intents to alter the
1537 * behavior of the called activity.
1539 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
1540 * on the authority given.
1542 public static final String EXTRA_AUTHORITIES = "authorities";
1545 * Activity Extra: Limit available options in launched activity based on the given account
1548 * This can be passed as an extra field in an Activity Intent with one or more account types
1549 * as a String[]. This field is used by some intents to alter the behavior of the called
1552 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified
1555 public static final String EXTRA_ACCOUNT_TYPES = "account_types";
1557 public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
1560 * Activity Extra: The device identifier to act upon.
1562 * This can be passed as an extra field in an Activity Intent with a single
1563 * InputDeviceIdentifier. This field is used by some activities to jump straight into the
1564 * settings for the given device.
1566 * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout
1567 * dialog for the given device.
1570 public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
1573 * Activity Extra: Enable or disable Airplane Mode.
1575 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE}
1576 * intent as a boolean to indicate if it should be enabled.
1578 public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
1581 * Activity Extra: Enable or disable Battery saver mode.
1583 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE}
1584 * intent as a boolean to indicate if it should be enabled.
1586 public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED =
1587 "android.settings.extra.battery_saver_mode_enabled";
1590 * Activity Extra: Enable or disable Do Not Disturb mode.
1592 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
1593 * intent as a boolean to indicate if it should be enabled.
1595 public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED =
1596 "android.settings.extra.do_not_disturb_mode_enabled";
1599 * Activity Extra: How many minutes to enable do not disturb mode for.
1601 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
1602 * intent to indicate how long do not disturb mode should be enabled for.
1604 public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES =
1605 "android.settings.extra.do_not_disturb_mode_minutes";
1608 * Reset mode: reset to defaults only settings changed by the
1609 * calling package. If there is a default set the setting
1610 * will be set to it, otherwise the setting will be deleted.
1611 * This is the only type of reset available to non-system clients.
1614 public static final int RESET_MODE_PACKAGE_DEFAULTS = 1;
1617 * Reset mode: reset all settings set by untrusted packages, which is
1618 * packages that aren't a part of the system, to the current defaults.
1619 * If there is a default set the setting will be set to it, otherwise
1620 * the setting will be deleted. This mode is only available to the system.
1623 public static final int RESET_MODE_UNTRUSTED_DEFAULTS = 2;
1626 * Reset mode: delete all settings set by untrusted packages, which is
1627 * packages that aren't a part of the system. If a setting is set by an
1628 * untrusted package it will be deleted if its default is not provided
1629 * by the system, otherwise the setting will be set to its default.
1630 * This mode is only available to the system.
1633 public static final int RESET_MODE_UNTRUSTED_CHANGES = 3;
1636 * Reset mode: reset all settings to defaults specified by trusted
1637 * packages, which is packages that are a part of the system, and
1638 * delete all settings set by untrusted packages. If a setting has
1639 * a default set by a system package it will be set to the default,
1640 * otherwise the setting will be deleted. This mode is only available
1644 public static final int RESET_MODE_TRUSTED_DEFAULTS = 4;
1647 @Retention(RetentionPolicy.SOURCE)
1649 RESET_MODE_PACKAGE_DEFAULTS,
1650 RESET_MODE_UNTRUSTED_DEFAULTS,
1651 RESET_MODE_UNTRUSTED_CHANGES,
1652 RESET_MODE_TRUSTED_DEFAULTS
1654 public @interface ResetMode{}
1657 * Activity Extra: Number of certificates
1659 * This can be passed as an extra field to the {@link #ACTION_MONITORING_CERT_INFO}
1660 * intent to indicate the number of certificates
1663 public static final String EXTRA_NUMBER_OF_CERTIFICATES =
1664 "android.settings.extra.number_of_certificates";
1666 private static final String JID_RESOURCE_PREFIX = "android";
1668 public static final String AUTHORITY = "settings";
1670 private static final String TAG = "Settings";
1671 private static final boolean LOCAL_LOGV = false;
1673 // Lock ensures that when enabling/disabling the master location switch, we don't end up
1674 // with a partial enable/disable state in multi-threaded situations.
1675 private static final Object mLocationSettingsLock = new Object();
1677 // Used in system server calling uid workaround in call()
1678 private static boolean sInSystemServer = false;
1679 private static final Object sInSystemServerLock = new Object();
1682 public static void setInSystemServer() {
1683 synchronized (sInSystemServerLock) {
1684 sInSystemServer = true;
1689 public static boolean isInSystemServer() {
1690 synchronized (sInSystemServerLock) {
1691 return sInSystemServer;
1695 public static class SettingNotFoundException extends AndroidException {
1696 public SettingNotFoundException(String msg) {
1702 * Common base for tables of name/value settings.
1704 public static class NameValueTable implements BaseColumns {
1705 public static final String NAME = "name";
1706 public static final String VALUE = "value";
1708 protected static boolean putString(ContentResolver resolver, Uri uri,
1709 String name, String value) {
1710 // The database will take care of replacing duplicates.
1712 ContentValues values = new ContentValues();
1713 values.put(NAME, name);
1714 values.put(VALUE, value);
1715 resolver.insert(uri, values);
1717 } catch (SQLException e) {
1718 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
1723 public static Uri getUriFor(Uri uri, String name) {
1724 return Uri.withAppendedPath(uri, name);
1728 private static final class GenerationTracker {
1729 private final MemoryIntArray mArray;
1730 private final Runnable mErrorHandler;
1731 private final int mIndex;
1732 private int mCurrentGeneration;
1734 public GenerationTracker(@NonNull MemoryIntArray array, int index,
1735 int generation, Runnable errorHandler) {
1738 mErrorHandler = errorHandler;
1739 mCurrentGeneration = generation;
1742 public boolean isGenerationChanged() {
1743 final int currentGeneration = readCurrentGeneration();
1744 if (currentGeneration >= 0) {
1745 if (currentGeneration == mCurrentGeneration) {
1748 mCurrentGeneration = currentGeneration;
1753 private int readCurrentGeneration() {
1755 return mArray.get(mIndex);
1756 } catch (IOException e) {
1757 Log.e(TAG, "Error getting current generation", e);
1758 if (mErrorHandler != null) {
1759 mErrorHandler.run();
1765 public void destroy() {
1768 } catch (IOException e) {
1769 Log.e(TAG, "Error closing backing array", e);
1770 if (mErrorHandler != null) {
1771 mErrorHandler.run();
1777 private static final class ContentProviderHolder {
1778 private final Object mLock = new Object();
1781 private final Uri mUri;
1783 private IContentProvider mContentProvider;
1785 public ContentProviderHolder(Uri uri) {
1789 public IContentProvider getProvider(ContentResolver contentResolver) {
1790 synchronized (mLock) {
1791 if (mContentProvider == null) {
1792 mContentProvider = contentResolver
1793 .acquireProvider(mUri.getAuthority());
1795 return mContentProvider;
1799 public void clearProviderForTest() {
1800 synchronized (mLock) {
1801 mContentProvider = null;
1807 private static class NameValueCache {
1808 private static final boolean DEBUG = false;
1810 private static final String[] SELECT_VALUE_PROJECTION = new String[] {
1811 Settings.NameValueTable.VALUE
1814 private static final String NAME_EQ_PLACEHOLDER = "name=?";
1816 // Must synchronize on 'this' to access mValues and mValuesVersion.
1817 private final HashMap<String, String> mValues = new HashMap<>();
1819 private final Uri mUri;
1820 private final ContentProviderHolder mProviderHolder;
1822 // The method we'll call (or null, to not use) on the provider
1823 // for the fast path of retrieving settings.
1824 private final String mCallGetCommand;
1825 private final String mCallSetCommand;
1828 private GenerationTracker mGenerationTracker;
1830 public NameValueCache(Uri uri, String getCommand, String setCommand,
1831 ContentProviderHolder providerHolder) {
1833 mCallGetCommand = getCommand;
1834 mCallSetCommand = setCommand;
1835 mProviderHolder = providerHolder;
1838 public boolean putStringForUser(ContentResolver cr, String name, String value,
1839 String tag, boolean makeDefault, final int userHandle) {
1841 Bundle arg = new Bundle();
1842 arg.putString(Settings.NameValueTable.VALUE, value);
1843 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
1845 arg.putString(CALL_METHOD_TAG_KEY, tag);
1848 arg.putBoolean(CALL_METHOD_MAKE_DEFAULT_KEY, true);
1850 IContentProvider cp = mProviderHolder.getProvider(cr);
1851 cp.call(cr.getPackageName(), mCallSetCommand, name, arg);
1852 } catch (RemoteException e) {
1853 Log.w(TAG, "Can't set key " + name + " in " + mUri, e);
1859 public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
1860 final boolean isSelf = (userHandle == UserHandle.myUserId());
1862 synchronized (NameValueCache.this) {
1863 if (mGenerationTracker != null) {
1864 if (mGenerationTracker.isGenerationChanged()) {
1866 Log.i(TAG, "Generation changed for type:"
1867 + mUri.getPath() + " in package:"
1868 + cr.getPackageName() +" and user:" + userHandle);
1871 } else if (mValues.containsKey(name)) {
1872 return mValues.get(name);
1877 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle
1878 + " by user " + UserHandle.myUserId() + " so skipping cache");
1881 IContentProvider cp = mProviderHolder.getProvider(cr);
1883 // Try the fast path first, not using query(). If this
1884 // fails (alternate Settings provider that doesn't support
1885 // this interface?) then we fall back to the query/table
1887 if (mCallGetCommand != null) {
1891 args = new Bundle();
1892 args.putInt(CALL_METHOD_USER_KEY, userHandle);
1894 boolean needsGenerationTracker = false;
1895 synchronized (NameValueCache.this) {
1896 if (isSelf && mGenerationTracker == null) {
1897 needsGenerationTracker = true;
1899 args = new Bundle();
1901 args.putString(CALL_METHOD_TRACK_GENERATION_KEY, null);
1903 Log.i(TAG, "Requested generation tracker for type: "+ mUri.getPath()
1904 + " in package:" + cr.getPackageName() +" and user:"
1910 // If we're in system server and in a binder transaction we need to clear the
1911 // calling uid. This works around code in system server that did not call
1912 // clearCallingIdentity, previously this wasn't needed because reading settings
1913 // did not do permission checking but thats no longer the case.
1914 // Long term this should be removed and callers should properly call
1915 // clearCallingIdentity or use a ContentResolver from the caller as needed.
1916 if (Settings.isInSystemServer() && Binder.getCallingUid() != Process.myUid()) {
1917 final long token = Binder.clearCallingIdentity();
1919 b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
1921 Binder.restoreCallingIdentity(token);
1924 b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
1927 String value = b.getString(Settings.NameValueTable.VALUE);
1928 // Don't update our cache for reads of other users' data
1930 synchronized (NameValueCache.this) {
1931 if (needsGenerationTracker) {
1932 MemoryIntArray array = b.getParcelable(
1933 CALL_METHOD_TRACK_GENERATION_KEY);
1934 final int index = b.getInt(
1935 CALL_METHOD_GENERATION_INDEX_KEY, -1);
1936 if (array != null && index >= 0) {
1937 final int generation = b.getInt(
1938 CALL_METHOD_GENERATION_KEY, 0);
1940 Log.i(TAG, "Received generation tracker for type:"
1941 + mUri.getPath() + " in package:"
1942 + cr.getPackageName() + " and user:"
1943 + userHandle + " with index:" + index);
1945 if (mGenerationTracker != null) {
1946 mGenerationTracker.destroy();
1948 mGenerationTracker = new GenerationTracker(array, index,
1950 synchronized (NameValueCache.this) {
1951 Log.e(TAG, "Error accessing generation"
1952 + " tracker - removing");
1953 if (mGenerationTracker != null) {
1954 GenerationTracker generationTracker =
1956 mGenerationTracker = null;
1957 generationTracker.destroy();
1964 mValues.put(name, value);
1967 if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
1968 + " by " + UserHandle.myUserId()
1969 + " so not updating cache");
1973 // If the response Bundle is null, we fall through
1974 // to the query interface below.
1975 } catch (RemoteException e) {
1976 // Not supported by the remote side? Fall through
1983 Bundle queryArgs = ContentResolver.createSqlQueryBundle(
1984 NAME_EQ_PLACEHOLDER, new String[]{name}, null);
1985 // Same workaround as above.
1986 if (Settings.isInSystemServer() && Binder.getCallingUid() != Process.myUid()) {
1987 final long token = Binder.clearCallingIdentity();
1989 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs,
1992 Binder.restoreCallingIdentity(token);
1995 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs,
1999 Log.w(TAG, "Can't get key " + name + " from " + mUri);
2003 String value = c.moveToNext() ? c.getString(0) : null;
2004 synchronized (NameValueCache.this) {
2005 mValues.put(name, value);
2008 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
2009 name + " = " + (value == null ? "(null)" : value));
2012 } catch (RemoteException e) {
2013 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
2014 return null; // Return null, but don't cache it.
2016 if (c != null) c.close();
2020 public void clearGenerationTrackerForTest() {
2021 synchronized (NameValueCache.this) {
2022 if (mGenerationTracker != null) {
2023 mGenerationTracker.destroy();
2026 mGenerationTracker = null;
2032 * Checks if the specified context can draw on top of other apps. As of API
2033 * level 23, an app cannot draw on top of other apps unless it declares the
2034 * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its
2035 * manifest, <em>and</em> the user specifically grants the app this
2036 * capability. To prompt the user to grant this approval, the app must send an
2037 * intent with the action
2038 * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}, which
2039 * causes the system to display a permission management screen.
2041 * @param context App context.
2042 * @return true if the specified context can draw on top of other apps, false otherwise
2044 public static boolean canDrawOverlays(Context context) {
2045 return Settings.isCallingPackageAllowedToDrawOverlays(context, Process.myUid(),
2046 context.getOpPackageName(), false);
2050 * System settings, containing miscellaneous system preferences. This
2051 * table holds simple name/value pairs. There are convenience
2052 * functions for accessing individual settings entries.
2054 public static final class System extends NameValueTable {
2055 private static final float DEFAULT_FONT_SCALE = 1.0f;
2058 public static interface Validator {
2059 public boolean validate(String value);
2063 * The content:// style URL for this table
2065 public static final Uri CONTENT_URI =
2066 Uri.parse("content://" + AUTHORITY + "/system");
2068 private static final ContentProviderHolder sProviderHolder =
2069 new ContentProviderHolder(CONTENT_URI);
2071 private static final NameValueCache sNameValueCache = new NameValueCache(
2073 CALL_METHOD_GET_SYSTEM,
2074 CALL_METHOD_PUT_SYSTEM,
2077 private static final HashSet<String> MOVED_TO_SECURE;
2079 MOVED_TO_SECURE = new HashSet<>(30);
2080 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
2081 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
2082 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
2083 MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
2084 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
2085 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
2086 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
2087 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
2088 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
2089 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
2090 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
2091 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
2092 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
2093 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
2094 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
2095 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
2096 MOVED_TO_SECURE.add(Secure.WIFI_ON);
2097 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
2098 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
2099 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
2100 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
2101 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
2102 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
2103 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
2104 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
2105 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
2106 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
2107 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
2109 // At one time in System, then Global, but now back in Secure
2110 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
2113 private static final HashSet<String> MOVED_TO_GLOBAL;
2114 private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL;
2116 MOVED_TO_GLOBAL = new HashSet<>();
2117 MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<>();
2119 // these were originally in system but migrated to secure in the past,
2120 // so are duplicated in the Secure.* namespace
2121 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED);
2122 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON);
2123 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING);
2124 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED);
2125 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED);
2126 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY);
2128 // these are moving directly from system to global
2129 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON);
2130 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS);
2131 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
2132 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME);
2133 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE);
2134 MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND);
2135 MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND);
2136 MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND);
2137 MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND);
2138 MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED);
2139 MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND);
2140 MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND);
2141 MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND);
2142 MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED);
2143 MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
2144 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY);
2145 MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
2146 MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE);
2147 MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE);
2148 MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE);
2149 MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS);
2150 MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE);
2151 MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE);
2152 MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY);
2153 MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP);
2154 MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER);
2155 MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES);
2156 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL);
2157 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL);
2158 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL);
2159 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL);
2160 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL);
2161 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL);
2162 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL);
2163 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL);
2166 private static final Validator sBooleanValidator =
2167 new DiscreteValueValidator(new String[] {"0", "1"});
2169 private static final Validator sNonNegativeIntegerValidator = new Validator() {
2171 public boolean validate(String value) {
2173 return Integer.parseInt(value) >= 0;
2174 } catch (NumberFormatException e) {
2180 private static final Validator sUriValidator = new Validator() {
2182 public boolean validate(String value) {
2186 } catch (IllegalArgumentException e) {
2192 private static final Validator sLenientIpAddressValidator = new Validator() {
2193 private static final int MAX_IPV6_LENGTH = 45;
2196 public boolean validate(String value) {
2197 return value.length() <= MAX_IPV6_LENGTH;
2202 public static void getMovedToGlobalSettings(Set<String> outKeySet) {
2203 outKeySet.addAll(MOVED_TO_GLOBAL);
2204 outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL);
2208 public static void getMovedToSecureSettings(Set<String> outKeySet) {
2209 outKeySet.addAll(MOVED_TO_SECURE);
2213 public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) {
2214 outKeySet.addAll(MOVED_TO_GLOBAL);
2218 public static void clearProviderForTest() {
2219 sProviderHolder.clearProviderForTest();
2220 sNameValueCache.clearGenerationTrackerForTest();
2224 * Look up a name in the database.
2225 * @param resolver to access the database with
2226 * @param name to look up in the table
2227 * @return the corresponding value, or null if not present
2229 public static String getString(ContentResolver resolver, String name) {
2230 return getStringForUser(resolver, name, UserHandle.myUserId());
2234 public static String getStringForUser(ContentResolver resolver, String name,
2236 if (MOVED_TO_SECURE.contains(name)) {
2237 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2238 + " to android.provider.Settings.Secure, returning read-only value.");
2239 return Secure.getStringForUser(resolver, name, userHandle);
2241 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
2242 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2243 + " to android.provider.Settings.Global, returning read-only value.");
2244 return Global.getStringForUser(resolver, name, userHandle);
2246 return sNameValueCache.getStringForUser(resolver, name, userHandle);
2250 * Store a name/value pair into the database.
2251 * @param resolver to access the database with
2252 * @param name to store
2253 * @param value to associate with the name
2254 * @return true if the value was set, false on database errors
2256 public static boolean putString(ContentResolver resolver, String name, String value) {
2257 return putStringForUser(resolver, name, value, UserHandle.myUserId());
2261 public static boolean putStringForUser(ContentResolver resolver, String name, String value,
2263 if (MOVED_TO_SECURE.contains(name)) {
2264 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2265 + " to android.provider.Settings.Secure, value is unchanged.");
2268 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
2269 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2270 + " to android.provider.Settings.Global, value is unchanged.");
2273 return sNameValueCache.putStringForUser(resolver, name, value, null, false, userHandle);
2277 * Construct the content URI for a particular name/value pair,
2278 * useful for monitoring changes with a ContentObserver.
2279 * @param name to look up in the table
2280 * @return the corresponding content URI, or null if not present
2282 public static Uri getUriFor(String name) {
2283 if (MOVED_TO_SECURE.contains(name)) {
2284 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2285 + " to android.provider.Settings.Secure, returning Secure URI.");
2286 return Secure.getUriFor(Secure.CONTENT_URI, name);
2288 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
2289 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2290 + " to android.provider.Settings.Global, returning read-only global URI.");
2291 return Global.getUriFor(Global.CONTENT_URI, name);
2293 return getUriFor(CONTENT_URI, name);
2297 * Convenience function for retrieving a single system settings value
2298 * as an integer. Note that internally setting values are always
2299 * stored as strings; this function converts the string to an integer
2300 * for you. The default value will be returned if the setting is
2301 * not defined or not an integer.
2303 * @param cr The ContentResolver to access.
2304 * @param name The name of the setting to retrieve.
2305 * @param def Value to return if the setting is not defined.
2307 * @return The setting's current value, or 'def' if it is not defined
2308 * or not a valid integer.
2310 public static int getInt(ContentResolver cr, String name, int def) {
2311 return getIntForUser(cr, name, def, UserHandle.myUserId());
2315 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
2316 String v = getStringForUser(cr, name, userHandle);
2318 return v != null ? Integer.parseInt(v) : def;
2319 } catch (NumberFormatException e) {
2325 * Convenience function for retrieving a single system settings value
2326 * as an integer. Note that internally setting values are always
2327 * stored as strings; this function converts the string to an integer
2330 * This version does not take a default value. If the setting has not
2331 * been set, or the string value is not a number,
2332 * it throws {@link SettingNotFoundException}.
2334 * @param cr The ContentResolver to access.
2335 * @param name The name of the setting to retrieve.
2337 * @throws SettingNotFoundException Thrown if a setting by the given
2338 * name can't be found or the setting value is not an integer.
2340 * @return The setting's current value.
2342 public static int getInt(ContentResolver cr, String name)
2343 throws SettingNotFoundException {
2344 return getIntForUser(cr, name, UserHandle.myUserId());
2348 public static int getIntForUser(ContentResolver cr, String name, int userHandle)
2349 throws SettingNotFoundException {
2350 String v = getStringForUser(cr, name, userHandle);
2352 return Integer.parseInt(v);
2353 } catch (NumberFormatException e) {
2354 throw new SettingNotFoundException(name);
2359 * Convenience function for updating a single settings value as an
2360 * integer. This will either create a new entry in the table if the
2361 * given name does not exist, or modify the value of the existing row
2362 * with that name. Note that internally setting values are always
2363 * stored as strings, so this function converts the given value to a
2364 * string before storing it.
2366 * @param cr The ContentResolver to access.
2367 * @param name The name of the setting to modify.
2368 * @param value The new value for the setting.
2369 * @return true if the value was set, false on database errors
2371 public static boolean putInt(ContentResolver cr, String name, int value) {
2372 return putIntForUser(cr, name, value, UserHandle.myUserId());
2376 public static boolean putIntForUser(ContentResolver cr, String name, int value,
2378 return putStringForUser(cr, name, Integer.toString(value), userHandle);
2382 * Convenience function for retrieving a single system settings value
2383 * as a {@code long}. Note that internally setting values are always
2384 * stored as strings; this function converts the string to a {@code long}
2385 * for you. The default value will be returned if the setting is
2386 * not defined or not a {@code long}.
2388 * @param cr The ContentResolver to access.
2389 * @param name The name of the setting to retrieve.
2390 * @param def Value to return if the setting is not defined.
2392 * @return The setting's current value, or 'def' if it is not defined
2393 * or not a valid {@code long}.
2395 public static long getLong(ContentResolver cr, String name, long def) {
2396 return getLongForUser(cr, name, def, UserHandle.myUserId());
2400 public static long getLongForUser(ContentResolver cr, String name, long def,
2402 String valString = getStringForUser(cr, name, userHandle);
2405 value = valString != null ? Long.parseLong(valString) : def;
2406 } catch (NumberFormatException e) {
2413 * Convenience function for retrieving a single system settings value
2414 * as a {@code long}. Note that internally setting values are always
2415 * stored as strings; this function converts the string to a {@code long}
2418 * This version does not take a default value. If the setting has not
2419 * been set, or the string value is not a number,
2420 * it throws {@link SettingNotFoundException}.
2422 * @param cr The ContentResolver to access.
2423 * @param name The name of the setting to retrieve.
2425 * @return The setting's current value.
2426 * @throws SettingNotFoundException Thrown if a setting by the given
2427 * name can't be found or the setting value is not an integer.
2429 public static long getLong(ContentResolver cr, String name)
2430 throws SettingNotFoundException {
2431 return getLongForUser(cr, name, UserHandle.myUserId());
2435 public static long getLongForUser(ContentResolver cr, String name, int userHandle)
2436 throws SettingNotFoundException {
2437 String valString = getStringForUser(cr, name, userHandle);
2439 return Long.parseLong(valString);
2440 } catch (NumberFormatException e) {
2441 throw new SettingNotFoundException(name);
2446 * Convenience function for updating a single settings value as a long
2447 * integer. This will either create a new entry in the table if the
2448 * given name does not exist, or modify the value of the existing row
2449 * with that name. Note that internally setting values are always
2450 * stored as strings, so this function converts the given value to a
2451 * string before storing it.
2453 * @param cr The ContentResolver to access.
2454 * @param name The name of the setting to modify.
2455 * @param value The new value for the setting.
2456 * @return true if the value was set, false on database errors
2458 public static boolean putLong(ContentResolver cr, String name, long value) {
2459 return putLongForUser(cr, name, value, UserHandle.myUserId());
2463 public static boolean putLongForUser(ContentResolver cr, String name, long value,
2465 return putStringForUser(cr, name, Long.toString(value), userHandle);
2469 * Convenience function for retrieving a single system settings value
2470 * as a floating point number. Note that internally setting values are
2471 * always stored as strings; this function converts the string to an
2472 * float for you. The default value will be returned if the setting
2473 * is not defined or not a valid float.
2475 * @param cr The ContentResolver to access.
2476 * @param name The name of the setting to retrieve.
2477 * @param def Value to return if the setting is not defined.
2479 * @return The setting's current value, or 'def' if it is not defined
2480 * or not a valid float.
2482 public static float getFloat(ContentResolver cr, String name, float def) {
2483 return getFloatForUser(cr, name, def, UserHandle.myUserId());
2487 public static float getFloatForUser(ContentResolver cr, String name, float def,
2489 String v = getStringForUser(cr, name, userHandle);
2491 return v != null ? Float.parseFloat(v) : def;
2492 } catch (NumberFormatException e) {
2498 * Convenience function for retrieving a single system settings value
2499 * as a float. Note that internally setting values are always
2500 * stored as strings; this function converts the string to a float
2503 * This version does not take a default value. If the setting has not
2504 * been set, or the string value is not a number,
2505 * it throws {@link SettingNotFoundException}.
2507 * @param cr The ContentResolver to access.
2508 * @param name The name of the setting to retrieve.
2510 * @throws SettingNotFoundException Thrown if a setting by the given
2511 * name can't be found or the setting value is not a float.
2513 * @return The setting's current value.
2515 public static float getFloat(ContentResolver cr, String name)
2516 throws SettingNotFoundException {
2517 return getFloatForUser(cr, name, UserHandle.myUserId());
2521 public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
2522 throws SettingNotFoundException {
2523 String v = getStringForUser(cr, name, userHandle);
2525 throw new SettingNotFoundException(name);
2528 return Float.parseFloat(v);
2529 } catch (NumberFormatException e) {
2530 throw new SettingNotFoundException(name);
2535 * Convenience function for updating a single settings value as a
2536 * floating point number. This will either create a new entry in the
2537 * table if the given name does not exist, or modify the value of the
2538 * existing row with that name. Note that internally setting values
2539 * are always stored as strings, so this function converts the given
2540 * value to a string before storing it.
2542 * @param cr The ContentResolver to access.
2543 * @param name The name of the setting to modify.
2544 * @param value The new value for the setting.
2545 * @return true if the value was set, false on database errors
2547 public static boolean putFloat(ContentResolver cr, String name, float value) {
2548 return putFloatForUser(cr, name, value, UserHandle.myUserId());
2552 public static boolean putFloatForUser(ContentResolver cr, String name, float value,
2554 return putStringForUser(cr, name, Float.toString(value), userHandle);
2558 * Convenience function to read all of the current
2559 * configuration-related settings into a
2560 * {@link Configuration} object.
2562 * @param cr The ContentResolver to access.
2563 * @param outConfig Where to place the configuration settings.
2565 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
2566 adjustConfigurationForUser(cr, outConfig, UserHandle.myUserId(),
2567 false /* updateSettingsIfEmpty */);
2571 public static void adjustConfigurationForUser(ContentResolver cr, Configuration outConfig,
2572 int userHandle, boolean updateSettingsIfEmpty) {
2573 outConfig.fontScale = Settings.System.getFloatForUser(
2574 cr, FONT_SCALE, DEFAULT_FONT_SCALE, userHandle);
2575 if (outConfig.fontScale < 0) {
2576 outConfig.fontScale = DEFAULT_FONT_SCALE;
2579 final String localeValue =
2580 Settings.System.getStringForUser(cr, SYSTEM_LOCALES, userHandle);
2581 if (localeValue != null) {
2582 outConfig.setLocales(LocaleList.forLanguageTags(localeValue));
2584 // Do not update configuration with emtpy settings since we need to take over the
2585 // locale list of previous user if the settings value is empty. This happens when a
2586 // new user is created.
2588 if (updateSettingsIfEmpty) {
2589 // Make current configuration persistent. This is necessary the first time a
2590 // user log in. At the first login, the configuration settings are empty, so we
2591 // need to store the adjusted configuration as the initial settings.
2592 Settings.System.putStringForUser(
2593 cr, SYSTEM_LOCALES, outConfig.getLocales().toLanguageTags(),
2600 * @hide Erase the fields in the Configuration that should be applied
2603 public static void clearConfiguration(Configuration inoutConfig) {
2604 inoutConfig.fontScale = 0;
2605 if (!inoutConfig.userSetLocale && !inoutConfig.getLocales().isEmpty()) {
2606 inoutConfig.clearLocales();
2611 * Convenience function to write a batch of configuration-related
2612 * settings from a {@link Configuration} object.
2614 * @param cr The ContentResolver to access.
2615 * @param config The settings to write.
2616 * @return true if the values were set, false on database errors
2618 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
2619 return putConfigurationForUser(cr, config, UserHandle.myUserId());
2623 public static boolean putConfigurationForUser(ContentResolver cr, Configuration config,
2625 return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle) &&
2626 Settings.System.putStringForUser(
2627 cr, SYSTEM_LOCALES, config.getLocales().toLanguageTags(), userHandle);
2631 public static boolean hasInterestingConfigurationChanges(int changes) {
2632 return (changes & ActivityInfo.CONFIG_FONT_SCALE) != 0 ||
2633 (changes & ActivityInfo.CONFIG_LOCALE) != 0;
2636 /** @deprecated - Do not use */
2638 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
2639 return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId());
2644 * @deprecated - Do not use
2647 public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr,
2649 return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0;
2652 /** @deprecated - Do not use */
2654 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
2655 setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId());
2660 * @deprecated - Do not use
2663 public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag,
2665 putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
2668 private static final class DiscreteValueValidator implements Validator {
2669 private final String[] mValues;
2671 public DiscreteValueValidator(String[] values) {
2676 public boolean validate(String value) {
2677 return ArrayUtils.contains(mValues, value);
2681 private static final class InclusiveIntegerRangeValidator implements Validator {
2682 private final int mMin;
2683 private final int mMax;
2685 public InclusiveIntegerRangeValidator(int min, int max) {
2691 public boolean validate(String value) {
2693 final int intValue = Integer.parseInt(value);
2694 return intValue >= mMin && intValue <= mMax;
2695 } catch (NumberFormatException e) {
2701 private static final class InclusiveFloatRangeValidator implements Validator {
2702 private final float mMin;
2703 private final float mMax;
2705 public InclusiveFloatRangeValidator(float min, float max) {
2711 public boolean validate(String value) {
2713 final float floatValue = Float.parseFloat(value);
2714 return floatValue >= mMin && floatValue <= mMax;
2715 } catch (NumberFormatException e) {
2722 * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
2725 public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN;
2728 * What happens when the user presses the end call button if they're not
2730 * <b>Values:</b><br/>
2731 * 0 - The end button does nothing.<br/>
2732 * 1 - The end button goes to the home screen.<br/>
2733 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
2734 * 3 - The end button goes to the home screen. If the user is already on the
2735 * home screen, it puts the device to sleep.
2737 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
2739 private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR =
2740 new InclusiveIntegerRangeValidator(0, 3);
2743 * END_BUTTON_BEHAVIOR value for "go home".
2746 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
2749 * END_BUTTON_BEHAVIOR value for "go to sleep".
2752 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
2755 * END_BUTTON_BEHAVIOR default value.
2758 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
2761 * Is advanced settings mode turned on. 0 == no, 1 == yes
2764 public static final String ADVANCED_SETTINGS = "advanced_settings";
2766 private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator;
2769 * ADVANCED_SETTINGS default value.
2772 public static final int ADVANCED_SETTINGS_DEFAULT = 0;
2775 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
2778 public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON;
2781 * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead
2784 public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH;
2787 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead
2790 public static final String RADIO_WIFI = Global.RADIO_WIFI;
2793 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead
2797 public static final String RADIO_WIMAX = Global.RADIO_WIMAX;
2800 * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead
2803 public static final String RADIO_CELL = Global.RADIO_CELL;
2806 * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead
2809 public static final String RADIO_NFC = Global.RADIO_NFC;
2812 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead
2815 public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS;
2818 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead
2823 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS =
2824 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS;
2827 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead
2830 public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY;
2833 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead
2836 public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT;
2839 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead
2842 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED =
2843 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
2846 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead
2849 public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER;
2852 * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead
2855 public static final String MODE_RINGER = Global.MODE_RINGER;
2858 * Whether to use static IP and other static network attributes.
2860 * Set to 1 for true and 0 for false.
2862 * @deprecated Use {@link WifiManager} instead
2865 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
2867 private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator;
2870 * The static IP address.
2872 * Example: "192.168.1.51"
2874 * @deprecated Use {@link WifiManager} instead
2877 public static final String WIFI_STATIC_IP = "wifi_static_ip";
2879 private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator;
2882 * If using static IP, the gateway's IP address.
2884 * Example: "192.168.1.1"
2886 * @deprecated Use {@link WifiManager} instead
2889 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
2891 private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator;
2894 * If using static IP, the net mask.
2896 * Example: "255.255.255.0"
2898 * @deprecated Use {@link WifiManager} instead
2901 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
2903 private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator;
2906 * If using static IP, the primary DNS's IP address.
2908 * Example: "192.168.1.1"
2910 * @deprecated Use {@link WifiManager} instead
2913 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
2915 private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator;
2918 * If using static IP, the secondary DNS's IP address.
2920 * Example: "192.168.1.2"
2922 * @deprecated Use {@link WifiManager} instead
2925 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
2927 private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator;
2930 * Determines whether remote devices may discover and/or connect to
2933 * 2 -- discoverable and connectable
2934 * 1 -- connectable but not discoverable
2935 * 0 -- neither connectable nor discoverable
2937 public static final String BLUETOOTH_DISCOVERABILITY =
2938 "bluetooth_discoverability";
2940 private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR =
2941 new InclusiveIntegerRangeValidator(0, 2);
2944 * Bluetooth discoverability timeout. If this value is nonzero, then
2945 * Bluetooth becomes discoverable for a certain number of seconds,
2946 * after which is becomes simply connectable. The value is in seconds.
2948 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
2949 "bluetooth_discoverability_timeout";
2951 private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR =
2952 sNonNegativeIntegerValidator;
2955 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
2959 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
2962 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
2966 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2970 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
2974 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2975 "lock_pattern_tactile_feedback_enabled";
2978 * A formatted string of the next alarm that is set, or the empty string
2979 * if there is no alarm set.
2981 * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}.
2984 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
2986 private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() {
2987 private static final int MAX_LENGTH = 1000;
2990 public boolean validate(String value) {
2991 // TODO: No idea what the correct format is.
2992 return value == null || value.length() < MAX_LENGTH;
2997 * Scaling factor for fonts, float.
2999 public static final String FONT_SCALE = "font_scale";
3001 private static final Validator FONT_SCALE_VALIDATOR = new Validator() {
3003 public boolean validate(String value) {
3005 return Float.parseFloat(value) >= 0;
3006 } catch (NumberFormatException e) {
3013 * The serialized system locale value.
3015 * Do not use this value directory.
3016 * To get system locale, use {@link LocaleList#getDefault} instead.
3017 * To update system locale, use {@link com.android.internal.app.LocalePicker#updateLocales}
3021 public static final String SYSTEM_LOCALES = "system_locales";
3025 * Name of an application package to be debugged.
3027 * @deprecated Use {@link Global#DEBUG_APP} instead
3030 public static final String DEBUG_APP = Global.DEBUG_APP;
3033 * If 1, when launching DEBUG_APP it will wait for the debugger before
3034 * starting user code. If 0, it will run normally.
3036 * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead
3039 public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER;
3042 * Whether or not to dim the screen. 0=no 1=yes
3043 * @deprecated This setting is no longer used.
3046 public static final String DIM_SCREEN = "dim_screen";
3048 private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator;
3051 * The display color mode.
3054 public static final String DISPLAY_COLOR_MODE = "display_color_mode";
3057 * The amount of time in milliseconds before the device goes to sleep or begins
3058 * to dream after a period of inactivity. This value is also known as the
3059 * user activity timeout period since the screen isn't necessarily turned off
3062 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
3064 private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator;
3067 * The screen backlight brightness between 0 and 255.
3069 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
3071 private static final Validator SCREEN_BRIGHTNESS_VALIDATOR =
3072 new InclusiveIntegerRangeValidator(0, 255);
3075 * The screen backlight brightness between 0 and 255.
3078 public static final String SCREEN_BRIGHTNESS_FOR_VR = "screen_brightness_for_vr";
3080 private static final Validator SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR =
3081 new InclusiveIntegerRangeValidator(0, 255);
3084 * Control whether to enable automatic brightness mode.
3086 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
3088 private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator;
3091 * Adjustment to auto-brightness to make it generally more (>0.0 <1.0)
3092 * or less (<0.0 >-1.0) bright.
3095 public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj";
3097 private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR =
3098 new InclusiveFloatRangeValidator(-1, 1);
3101 * SCREEN_BRIGHTNESS_MODE value for manual mode.
3103 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
3106 * SCREEN_BRIGHTNESS_MODE value for automatic mode.
3108 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
3111 * Control whether the process CPU usage meter should be shown.
3113 * @deprecated This functionality is no longer available as of
3114 * {@link android.os.Build.VERSION_CODES#N_MR1}.
3117 public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES;
3120 * If 1, the activity manager will aggressively finish activities and
3121 * processes as soon as they are no longer needed. If 0, the normal
3122 * extended lifetime is used.
3124 * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead
3127 public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;
3130 * Determines which streams are affected by ringer mode changes. The
3131 * stream type's bit should be set to 1 if it should be muted when going
3132 * into an inaudible ringer mode.
3134 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
3136 private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR =
3137 sNonNegativeIntegerValidator;
3140 * Determines which streams are affected by mute. The
3141 * stream type's bit should be set to 1 if it should be muted when a mute request
3144 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
3146 private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR =
3147 sNonNegativeIntegerValidator;
3150 * Whether vibrate is on for different events. This is used internally,
3151 * changing this value will not change the vibrate. See AudioManager.
3153 public static final String VIBRATE_ON = "vibrate_on";
3155 private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator;
3158 * If 1, redirects the system vibrator to all currently attached input devices
3159 * that support vibration. If there are no such input devices, then the system
3160 * vibrator is used instead.
3161 * If 0, does not register the system vibrator.
3163 * This setting is mainly intended to provide a compatibility mechanism for
3164 * applications that only know about the system vibrator and do not use the
3165 * input device vibrator API.
3169 public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices";
3171 private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator;
3174 * Ringer volume. This is used internally, changing this value will not
3175 * change the volume. See AudioManager.
3177 * @removed Not used by anything since API 2.
3179 public static final String VOLUME_RING = "volume_ring";
3182 * System/notifications volume. This is used internally, changing this
3183 * value will not change the volume. See AudioManager.
3185 * @removed Not used by anything since API 2.
3187 public static final String VOLUME_SYSTEM = "volume_system";
3190 * Voice call volume. This is used internally, changing this value will
3191 * not change the volume. See AudioManager.
3193 * @removed Not used by anything since API 2.
3195 public static final String VOLUME_VOICE = "volume_voice";
3198 * Music/media/gaming volume. This is used internally, changing this
3199 * value will not change the volume. See AudioManager.
3201 * @removed Not used by anything since API 2.
3203 public static final String VOLUME_MUSIC = "volume_music";
3206 * Alarm volume. This is used internally, changing this
3207 * value will not change the volume. See AudioManager.
3209 * @removed Not used by anything since API 2.
3211 public static final String VOLUME_ALARM = "volume_alarm";
3214 * Notification volume. This is used internally, changing this
3215 * value will not change the volume. See AudioManager.
3217 * @removed Not used by anything since API 2.
3219 public static final String VOLUME_NOTIFICATION = "volume_notification";
3222 * Bluetooth Headset volume. This is used internally, changing this value will
3223 * not change the volume. See AudioManager.
3225 * @removed Not used by anything since API 2.
3227 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
3231 * Acessibility volume. This is used internally, changing this
3232 * value will not change the volume.
3234 public static final String VOLUME_ACCESSIBILITY = "volume_a11y";
3237 * Master volume (float in the range 0.0f to 1.0f).
3241 public static final String VOLUME_MASTER = "volume_master";
3244 * Master mono (int 1 = mono, 0 = normal).
3248 public static final String MASTER_MONO = "master_mono";
3250 private static final Validator MASTER_MONO_VALIDATOR = sBooleanValidator;
3253 * Whether the notifications should use the ring volume (value of 1) or
3254 * a separate notification volume (value of 0). In most cases, users
3255 * will have this enabled so the notification and ringer volumes will be
3256 * the same. However, power users can disable this and use the separate
3257 * notification volume control.
3259 * Note: This is a one-off setting that will be removed in the future
3260 * when there is profile support. For this reason, it is kept hidden
3261 * from the public APIs.
3267 public static final String NOTIFICATIONS_USE_RING_VOLUME =
3268 "notifications_use_ring_volume";
3270 private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator;
3273 * Whether silent mode should allow vibration feedback. This is used
3274 * internally in AudioService and the Sound settings activity to
3275 * coordinate decoupling of vibrate and silent modes. This setting
3276 * will likely be removed in a future release with support for
3277 * audio/vibe feedback profiles.
3279 * Not used anymore. On devices with vibrator, the user explicitly selects
3280 * silent or vibrate mode.
3281 * Kept for use by legacy database upgrade code in DatabaseHelper.
3284 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
3286 private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator;
3289 * The mapping of stream type (integer) to its setting.
3291 * @removed Not used by anything since API 2.
3293 public static final String[] VOLUME_SETTINGS = {
3294 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
3295 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
3300 * The mapping of stream type (integer) to its setting.
3301 * Unlike the VOLUME_SETTINGS array, this one contains as many entries as
3302 * AudioSystem.NUM_STREAM_TYPES, and has empty strings for stream types whose volumes
3303 * are never persisted.
3305 public static final String[] VOLUME_SETTINGS_INT = {
3306 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
3307 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO,
3308 "" /*STREAM_SYSTEM_ENFORCED, no setting for this stream*/,
3309 "" /*STREAM_DTMF, no setting for this stream*/,
3310 "" /*STREAM_TTS, no setting for this stream*/,
3311 VOLUME_ACCESSIBILITY
3315 * Appended to various volume related settings to record the previous
3316 * values before they the settings were affected by a silent/vibrate
3317 * ringer mode change.
3319 * @removed Not used by anything since API 2.
3321 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
3324 * Persistent store for the system-wide default ringtone URI.
3326 * If you need to play the default ringtone at any given time, it is recommended
3327 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
3328 * to the set default ringtone at the time of playing.
3330 * @see #DEFAULT_RINGTONE_URI
3332 public static final String RINGTONE = "ringtone";
3334 private static final Validator RINGTONE_VALIDATOR = sUriValidator;
3337 * A {@link Uri} that will point to the current default ringtone at any
3340 * If the current default ringtone is in the DRM provider and the caller
3341 * does not have permission, the exception will be a
3342 * FileNotFoundException.
3344 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
3347 public static final String RINGTONE_CACHE = "ringtone_cache";
3349 public static final Uri RINGTONE_CACHE_URI = getUriFor(RINGTONE_CACHE);
3352 * Persistent store for the system-wide default notification sound.
3355 * @see #DEFAULT_NOTIFICATION_URI
3357 public static final String NOTIFICATION_SOUND = "notification_sound";
3359 private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator;
3362 * A {@link Uri} that will point to the current default notification
3363 * sound at any given time.
3365 * @see #DEFAULT_RINGTONE_URI
3367 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
3370 public static final String NOTIFICATION_SOUND_CACHE = "notification_sound_cache";
3372 public static final Uri NOTIFICATION_SOUND_CACHE_URI = getUriFor(NOTIFICATION_SOUND_CACHE);
3375 * Persistent store for the system-wide default alarm alert.
3378 * @see #DEFAULT_ALARM_ALERT_URI
3380 public static final String ALARM_ALERT = "alarm_alert";
3382 private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator;
3385 * A {@link Uri} that will point to the current default alarm alert at
3388 * @see #DEFAULT_ALARM_ALERT_URI
3390 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
3393 public static final String ALARM_ALERT_CACHE = "alarm_alert_cache";
3395 public static final Uri ALARM_ALERT_CACHE_URI = getUriFor(ALARM_ALERT_CACHE);
3398 * Persistent store for the system default media button event receiver.
3402 public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
3404 private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() {
3406 public boolean validate(String value) {
3408 ComponentName.unflattenFromString(value);
3410 } catch (NullPointerException e) {
3417 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
3419 public static final String TEXT_AUTO_REPLACE = "auto_replace";
3421 private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator;
3424 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
3426 public static final String TEXT_AUTO_CAPS = "auto_caps";
3428 private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator;
3431 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
3432 * feature converts two spaces to a "." and space.
3434 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
3436 private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator;
3439 * Setting to showing password characters in text editors. 1 = On, 0 = Off
3441 public static final String TEXT_SHOW_PASSWORD = "show_password";
3443 private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator;
3445 public static final String SHOW_GTALK_SERVICE_STATUS =
3446 "SHOW_GTALK_SERVICE_STATUS";
3448 private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator;
3451 * Name of activity to use for wallpaper on the home screen.
3453 * @deprecated Use {@link WallpaperManager} instead.
3456 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
3458 private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() {
3459 private static final int MAX_LENGTH = 1000;
3462 public boolean validate(String value) {
3463 if (value != null && value.length() > MAX_LENGTH) {
3466 return ComponentName.unflattenFromString(value) != null;
3471 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME}
3475 public static final String AUTO_TIME = Global.AUTO_TIME;
3478 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE}
3482 public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE;
3485 * Display times as 12 or 24 hours
3489 public static final String TIME_12_24 = "time_12_24";
3492 public static final Validator TIME_12_24_VALIDATOR =
3493 new DiscreteValueValidator(new String[] {"12", "24"});
3496 * Date format string
3501 public static final String DATE_FORMAT = "date_format";
3504 public static final Validator DATE_FORMAT_VALIDATOR = new Validator() {
3506 public boolean validate(String value) {
3508 new SimpleDateFormat(value);
3510 } catch (IllegalArgumentException e) {
3517 * Whether the setup wizard has been run before (on first boot), or if
3518 * it still needs to be run.
3520 * nonzero = it has been run in the past
3521 * 0 = it has not been run in the past
3523 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
3526 public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator;
3529 * Scaling factor for normal window animations. Setting to 0 will disable window
3532 * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead
3535 public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE;
3538 * Scaling factor for activity transition animations. Setting to 0 will disable window
3541 * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead
3544 public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE;
3547 * Scaling factor for Animator-based animations. This affects both the start delay and
3548 * duration of all such animations. Setting to 0 will cause animations to end immediately.
3549 * The default value is 1.
3551 * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead
3554 public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
3557 * Control whether the accelerometer will be used to change screen
3558 * orientation. If 0, it will not be used unless explicitly requested
3559 * by the application; if 1, it will be used by default unless explicitly
3560 * disabled by the application.
3562 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
3565 public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator;
3568 * Default screen rotation when no other policy applies.
3569 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
3570 * preference, this rotation value will be used. Must be one of the
3571 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
3573 * @see android.view.Display#getRotation
3575 public static final String USER_ROTATION = "user_rotation";
3578 public static final Validator USER_ROTATION_VALIDATOR =
3579 new InclusiveIntegerRangeValidator(0, 3);
3582 * Control whether the rotation lock toggle in the System UI should be hidden.
3583 * Typically this is done for accessibility purposes to make it harder for
3584 * the user to accidentally toggle the rotation lock while the display rotation
3585 * has been locked for accessibility.
3587 * If 0, then rotation lock toggle is not hidden for accessibility (although it may be
3588 * unavailable for other reasons). If 1, then the rotation lock toggle is hidden.
3592 public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY =
3593 "hide_rotation_lock_toggle_for_accessibility";
3596 public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR =
3600 * Whether the phone vibrates when it is ringing due to an incoming call. This will
3601 * be used by Phone and Setting apps; it shouldn't affect other apps.
3602 * The value is boolean (1 or 0).
3604 * Note: this is not same as "vibrate on ring", which had been available until ICS.
3605 * It was about AudioManager's setting and thus affected all the applications which
3606 * relied on the setting, while this is purely about the vibration setting for incoming
3609 public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
3612 public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator;
3615 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
3618 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
3621 public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
3624 * CDMA only settings
3625 * DTMF tone type played by the dialer when dialing.
3629 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
3632 public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
3635 * Whether the hearing aid is enabled. The value is
3639 public static final String HEARING_AID = "hearing_aid";
3642 public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator;
3645 * CDMA only settings
3653 public static final String TTY_MODE = "tty_mode";
3656 public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3);
3659 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
3662 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
3665 public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator;
3668 * Whether the haptic feedback (long presses, ...) are enabled. The value is
3671 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
3674 public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator;
3677 * @deprecated Each application that shows web suggestions should have its own
3681 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
3684 public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator;
3687 * Whether the notification LED should repeatedly flash when a notification is
3688 * pending. The value is boolean (1 or 0).
3691 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
3694 public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator;
3697 * Show pointer location on screen?
3702 public static final String POINTER_LOCATION = "pointer_location";
3705 public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator;
3708 * Show touch positions on screen?
3713 public static final String SHOW_TOUCHES = "show_touches";
3716 public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator;
3719 * Log raw orientation data from
3720 * {@link com.android.server.policy.WindowOrientationListener} for use with the
3721 * orientationplot.py tool.
3726 public static final String WINDOW_ORIENTATION_LISTENER_LOG =
3727 "window_orientation_listener_log";
3730 public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator;
3733 * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED}
3738 public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED;
3741 * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED}
3746 public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED;
3749 * Whether to play sounds when the keyguard is shown and dismissed.
3752 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
3755 public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator;
3758 * Whether the lockscreen should be completely disabled.
3761 public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
3764 public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator;
3767 * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
3772 public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND;
3775 * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND}
3780 public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND;
3783 * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND}
3788 public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND;
3791 * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND}
3796 public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND;
3799 * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND}
3804 public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND;
3807 * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND}
3812 public static final String LOCK_SOUND = Global.LOCK_SOUND;
3815 * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND}
3820 public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND;
3823 * Receive incoming SIP calls?
3828 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
3831 public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator;
3834 * Call Preference String.
3835 * "SIP_ALWAYS" : Always use SIP with network access
3836 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
3839 public static final String SIP_CALL_OPTIONS = "sip_call_options";
3842 public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator(
3843 new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"});
3846 * One of the sip call options: Always use SIP with network access.
3849 public static final String SIP_ALWAYS = "SIP_ALWAYS";
3852 public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator;
3855 * One of the sip call options: Only if destination is a SIP address.
3858 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
3861 public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator;
3864 * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that
3865 * the user should be prompted each time a call is made whether it should be placed using
3866 * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with
3871 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
3874 public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator;
3877 * Pointer speed setting.
3878 * This is an integer value in a range between -7 and +7, so there are 15 possible values.
3884 public static final String POINTER_SPEED = "pointer_speed";
3887 public static final Validator POINTER_SPEED_VALIDATOR =
3888 new InclusiveFloatRangeValidator(-7, 7);
3891 * Whether lock-to-app will be triggered by long-press on recents.
3894 public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled";
3897 public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator;
3902 * Nonzero values indicate that the user has a bukkit.
3903 * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>.
3906 public static final String EGG_MODE = "egg_mode";
3909 public static final Validator EGG_MODE_VALIDATOR = new Validator() {
3911 public boolean validate(String value) {
3913 return Long.parseLong(value) >= 0;
3914 } catch (NumberFormatException e) {
3921 * Setting to determine whether or not to show the battery percentage in the status bar.
3922 * 0 - Don't show percentage
3923 * 1 - Show percentage
3926 public static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
3929 private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = sBooleanValidator;
3932 * IMPORTANT: If you add a new public settings you also have to add it to
3933 * PUBLIC_SETTINGS below. If the new setting is hidden you have to add
3934 * it to PRIVATE_SETTINGS below. Also add a validator that can validate
3935 * the setting value. See an example above.
3939 * Settings to backup. This is here so that it's in the same place as the settings
3940 * keys and easy to update.
3942 * NOTE: Settings are backed up and restored in the order they appear
3943 * in this array. If you have one setting depending on another,
3944 * make sure that they are ordered appropriately.
3948 public static final String[] SETTINGS_TO_BACKUP = {
3949 STAY_ON_WHILE_PLUGGED_IN, // moved to global
3952 WIFI_STATIC_GATEWAY,
3953 WIFI_STATIC_NETMASK,
3956 BLUETOOTH_DISCOVERABILITY,
3957 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
3962 SCREEN_BRIGHTNESS_MODE,
3963 SCREEN_AUTO_BRIGHTNESS_ADJ,
3964 SCREEN_BRIGHTNESS_FOR_VR,
3965 VIBRATE_INPUT_DEVICES,
3966 MODE_RINGER_STREAMS_AFFECTED,
3969 TEXT_AUTO_PUNCTUATE,
3971 AUTO_TIME, // moved to global
3972 AUTO_TIME_ZONE, // moved to global
3975 DTMF_TONE_WHEN_DIALING,
3976 DTMF_TONE_TYPE_WHEN_DIALING,
3980 SOUND_EFFECTS_ENABLED,
3981 HAPTIC_FEEDBACK_ENABLED,
3982 POWER_SOUNDS_ENABLED, // moved to global
3983 DOCK_SOUNDS_ENABLED, // moved to global
3984 LOCKSCREEN_SOUNDS_ENABLED,
3985 SHOW_WEB_SUGGESTIONS,
3989 VIBRATE_WHEN_RINGING,
3991 LOCK_TO_APP_ENABLED,
3993 ACCELEROMETER_ROTATION,
3994 SHOW_BATTERY_PERCENT
3998 * Keys we no longer back up under the current schema, but want to continue to
3999 * process when restoring historical backup datasets.
4003 public static final String[] LEGACY_RESTORE_SETTINGS = {
4007 * These are all public system settings
4011 public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>();
4013 PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR);
4014 PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP);
4015 PUBLIC_SETTINGS.add(WIFI_STATIC_IP);
4016 PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY);
4017 PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK);
4018 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1);
4019 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2);
4020 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY);
4021 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT);
4022 PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED);
4023 PUBLIC_SETTINGS.add(FONT_SCALE);
4024 PUBLIC_SETTINGS.add(DIM_SCREEN);
4025 PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT);
4026 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS);
4027 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE);
4028 PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED);
4029 PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED);
4030 PUBLIC_SETTINGS.add(VIBRATE_ON);
4031 PUBLIC_SETTINGS.add(VOLUME_RING);
4032 PUBLIC_SETTINGS.add(VOLUME_SYSTEM);
4033 PUBLIC_SETTINGS.add(VOLUME_VOICE);
4034 PUBLIC_SETTINGS.add(VOLUME_MUSIC);
4035 PUBLIC_SETTINGS.add(VOLUME_ALARM);
4036 PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION);
4037 PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO);
4038 PUBLIC_SETTINGS.add(RINGTONE);
4039 PUBLIC_SETTINGS.add(NOTIFICATION_SOUND);
4040 PUBLIC_SETTINGS.add(ALARM_ALERT);
4041 PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE);
4042 PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS);
4043 PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
4044 PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD);
4045 PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS);
4046 PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY);
4047 PUBLIC_SETTINGS.add(TIME_12_24);
4048 PUBLIC_SETTINGS.add(DATE_FORMAT);
4049 PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN);
4050 PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION);
4051 PUBLIC_SETTINGS.add(USER_ROTATION);
4052 PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING);
4053 PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED);
4054 PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
4055 PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS);
4056 PUBLIC_SETTINGS.add(VIBRATE_WHEN_RINGING);
4060 * These are all hidden system settings.
4064 public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>();
4066 PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP);
4067 PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR);
4068 PRIVATE_SETTINGS.add(ADVANCED_SETTINGS);
4069 PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ);
4070 PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES);
4071 PRIVATE_SETTINGS.add(VOLUME_MASTER);
4072 PRIVATE_SETTINGS.add(MASTER_MONO);
4073 PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME);
4074 PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT);
4075 PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER);
4076 PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY);
4077 PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING);
4078 PRIVATE_SETTINGS.add(HEARING_AID);
4079 PRIVATE_SETTINGS.add(TTY_MODE);
4080 PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
4081 PRIVATE_SETTINGS.add(POINTER_LOCATION);
4082 PRIVATE_SETTINGS.add(SHOW_TOUCHES);
4083 PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
4084 PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
4085 PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
4086 PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED);
4087 PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED);
4088 PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND);
4089 PRIVATE_SETTINGS.add(DESK_DOCK_SOUND);
4090 PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND);
4091 PRIVATE_SETTINGS.add(CAR_DOCK_SOUND);
4092 PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND);
4093 PRIVATE_SETTINGS.add(LOCK_SOUND);
4094 PRIVATE_SETTINGS.add(UNLOCK_SOUND);
4095 PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS);
4096 PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS);
4097 PRIVATE_SETTINGS.add(SIP_ALWAYS);
4098 PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY);
4099 PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME);
4100 PRIVATE_SETTINGS.add(POINTER_SPEED);
4101 PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED);
4102 PRIVATE_SETTINGS.add(EGG_MODE);
4103 PRIVATE_SETTINGS.add(SHOW_BATTERY_PERCENT);
4107 * These are all public system settings
4111 public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
4113 VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR);
4114 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
4115 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR);
4116 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT,
4117 BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR);
4118 VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR);
4119 VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR);
4120 VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR);
4121 VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR);
4122 VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR);
4123 VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR);
4124 VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR);
4125 VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR);
4126 VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR);
4127 VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR);
4128 VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR);
4129 VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR);
4130 VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR);
4131 VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR);
4132 VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR);
4133 VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR);
4134 VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR);
4135 VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR);
4136 VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR);
4137 VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR);
4138 VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR);
4139 VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR);
4140 VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR);
4141 VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR);
4142 VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR);
4143 VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR);
4144 VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR);
4145 VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR);
4146 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
4147 VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR);
4148 VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR);
4149 VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR);
4150 VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR);
4151 VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR);
4152 VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR);
4153 VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR);
4154 VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR);
4155 VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY,
4156 HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR);
4157 VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR);
4158 VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR);
4159 VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR);
4160 VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR);
4161 VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR);
4162 VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR);
4163 VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR);
4164 VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG,
4165 WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR);
4166 VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR);
4167 VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR);
4168 VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR);
4169 VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR);
4170 VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR);
4171 VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR);
4172 VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR);
4173 VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR);
4174 VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR);
4175 VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR);
4176 VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR);
4177 VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR);
4178 VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR);
4179 VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
4180 VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
4181 VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR);
4185 * These entries are considered common between the personal and the managed profile,
4186 * since the managed profile doesn't get to change them.
4188 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
4190 CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT);
4191 CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED);
4192 CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED);
4193 CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD);
4194 CLONE_TO_MANAGED_PROFILE.add(TIME_12_24);
4198 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
4199 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
4203 * These entries should be cloned from this profile's parent only if the dependency's
4204 * value is true ("1")
4206 * Note: the dependencies must be Secure settings
4210 public static final Map<String, String> CLONE_FROM_PARENT_ON_VALUE = new ArrayMap<>();
4212 CLONE_FROM_PARENT_ON_VALUE.put(RINGTONE, Secure.SYNC_PARENT_SOUNDS);
4213 CLONE_FROM_PARENT_ON_VALUE.put(NOTIFICATION_SOUND, Secure.SYNC_PARENT_SOUNDS);
4214 CLONE_FROM_PARENT_ON_VALUE.put(ALARM_ALERT, Secure.SYNC_PARENT_SOUNDS);
4218 public static void getCloneFromParentOnValueSettings(Map<String, String> outMap) {
4219 outMap.putAll(CLONE_FROM_PARENT_ON_VALUE);
4223 * System settings which can be accessed by instant apps.
4226 public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
4228 INSTANT_APP_SETTINGS.add(TEXT_AUTO_REPLACE);
4229 INSTANT_APP_SETTINGS.add(TEXT_AUTO_CAPS);
4230 INSTANT_APP_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
4231 INSTANT_APP_SETTINGS.add(TEXT_SHOW_PASSWORD);
4232 INSTANT_APP_SETTINGS.add(DATE_FORMAT);
4233 INSTANT_APP_SETTINGS.add(FONT_SCALE);
4234 INSTANT_APP_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
4235 INSTANT_APP_SETTINGS.add(TIME_12_24);
4236 INSTANT_APP_SETTINGS.add(SOUND_EFFECTS_ENABLED);
4237 INSTANT_APP_SETTINGS.add(ACCELEROMETER_ROTATION);
4241 * When to use Wi-Fi calling
4243 * @see android.telephony.TelephonyManager.WifiCallingChoices
4246 public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
4248 // Settings moved to Settings.Secure
4251 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
4255 public static final String ADB_ENABLED = Global.ADB_ENABLED;
4258 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
4261 public static final String ANDROID_ID = Secure.ANDROID_ID;
4264 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
4267 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
4270 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
4273 public static final String DATA_ROAMING = Global.DATA_ROAMING;
4276 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
4279 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
4282 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
4285 public static final String HTTP_PROXY = Global.HTTP_PROXY;
4288 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
4291 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
4294 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
4298 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
4301 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
4304 public static final String LOGGING_ID = Secure.LOGGING_ID;
4307 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
4310 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
4313 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
4317 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
4320 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
4324 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
4327 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
4331 public static final String PARENTAL_CONTROL_REDIRECT_URL =
4332 Secure.PARENTAL_CONTROL_REDIRECT_URL;
4335 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
4338 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
4341 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
4344 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
4347 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
4350 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
4354 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
4357 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
4361 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
4364 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
4365 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
4369 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
4372 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
4373 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
4377 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
4380 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
4381 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
4384 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
4388 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
4391 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
4394 public static final String WIFI_ON = Global.WIFI_ON;
4398 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
4402 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
4403 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
4406 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
4409 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
4413 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
4416 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
4417 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
4421 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
4424 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
4425 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
4429 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
4433 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
4434 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
4438 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
4441 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
4442 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
4445 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
4449 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
4452 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
4455 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
4458 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
4461 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
4464 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
4468 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
4471 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
4475 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
4476 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
4479 * Checks if the specified app can modify system settings. As of API
4480 * level 23, an app cannot modify system settings unless it declares the
4481 * {@link android.Manifest.permission#WRITE_SETTINGS}
4482 * permission in its manifest, <em>and</em> the user specifically grants
4483 * the app this capability. To prompt the user to grant this approval,
4484 * the app must send an intent with the action {@link
4485 * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes
4486 * the system to display a permission management screen.
4488 * @param context App context.
4489 * @return true if the calling app can write to system settings, false otherwise
4491 public static boolean canWrite(Context context) {
4492 return isCallingPackageAllowedToWriteSettings(context, Process.myUid(),
4493 context.getOpPackageName(), false);
4498 * Secure system settings, containing system preferences that applications
4499 * can read but are not allowed to write. These are for preferences that
4500 * the user must explicitly modify through the system UI or specialized
4501 * APIs for those values, not modified directly by applications.
4503 public static final class Secure extends NameValueTable {
4505 * The content:// style URL for this table
4507 public static final Uri CONTENT_URI =
4508 Uri.parse("content://" + AUTHORITY + "/secure");
4510 private static final ContentProviderHolder sProviderHolder =
4511 new ContentProviderHolder(CONTENT_URI);
4513 // Populated lazily, guarded by class object:
4514 private static final NameValueCache sNameValueCache = new NameValueCache(
4516 CALL_METHOD_GET_SECURE,
4517 CALL_METHOD_PUT_SECURE,
4520 private static ILockSettings sLockSettings = null;
4522 private static boolean sIsSystemProcess;
4523 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
4524 private static final HashSet<String> MOVED_TO_GLOBAL;
4526 MOVED_TO_LOCK_SETTINGS = new HashSet<>(3);
4527 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
4528 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
4529 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
4531 MOVED_TO_GLOBAL = new HashSet<>();
4532 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
4533 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
4534 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
4535 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
4536 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
4537 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
4538 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
4539 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
4540 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
4541 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
4542 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
4543 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
4544 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
4545 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
4546 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
4547 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
4548 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
4549 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
4550 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
4551 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
4552 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
4553 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
4554 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
4555 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
4556 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
4557 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
4558 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
4559 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
4560 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
4561 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
4562 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
4563 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
4564 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
4565 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
4566 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
4567 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
4568 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
4569 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
4570 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
4571 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
4572 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
4573 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
4574 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
4575 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS);
4576 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
4577 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
4578 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
4579 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
4580 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
4581 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
4582 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
4583 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
4584 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
4585 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
4586 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
4587 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
4588 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
4589 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
4590 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
4591 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
4592 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
4593 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
4594 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
4595 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
4596 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
4597 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
4598 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED);
4599 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN);
4600 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI);
4601 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
4602 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
4603 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
4604 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
4605 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
4606 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
4607 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
4608 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
4609 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
4610 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
4611 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
4612 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
4613 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
4614 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
4615 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
4616 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
4617 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
4618 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
4619 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
4620 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
4621 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
4622 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
4623 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
4624 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
4625 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
4626 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
4627 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
4628 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
4629 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
4630 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
4631 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
4632 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
4633 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
4634 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
4635 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
4636 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
4637 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
4638 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
4639 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
4640 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
4641 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
4642 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
4643 MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
4647 public static void getMovedToGlobalSettings(Set<String> outKeySet) {
4648 outKeySet.addAll(MOVED_TO_GLOBAL);
4652 public static void clearProviderForTest() {
4653 sProviderHolder.clearProviderForTest();
4654 sNameValueCache.clearGenerationTrackerForTest();
4658 * Look up a name in the database.
4659 * @param resolver to access the database with
4660 * @param name to look up in the table
4661 * @return the corresponding value, or null if not present
4663 public static String getString(ContentResolver resolver, String name) {
4664 return getStringForUser(resolver, name, UserHandle.myUserId());
4668 public static String getStringForUser(ContentResolver resolver, String name,
4670 if (MOVED_TO_GLOBAL.contains(name)) {
4671 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
4672 + " to android.provider.Settings.Global.");
4673 return Global.getStringForUser(resolver, name, userHandle);
4676 if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
4677 synchronized (Secure.class) {
4678 if (sLockSettings == null) {
4679 sLockSettings = ILockSettings.Stub.asInterface(
4680 (IBinder) ServiceManager.getService("lock_settings"));
4681 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
4684 if (sLockSettings != null && !sIsSystemProcess) {
4685 // No context; use the ActivityThread's context as an approximation for
4686 // determining the target API level.
4687 Application application = ActivityThread.currentApplication();
4689 boolean isPreMnc = application != null
4690 && application.getApplicationInfo() != null
4691 && application.getApplicationInfo().targetSdkVersion
4692 <= VERSION_CODES.LOLLIPOP_MR1;
4695 return sLockSettings.getString(name, "0", userHandle);
4696 } catch (RemoteException re) {
4700 throw new SecurityException("Settings.Secure." + name
4701 + " is deprecated and no longer accessible."
4702 + " See API documentation for potential replacements.");
4707 return sNameValueCache.getStringForUser(resolver, name, userHandle);
4711 * Store a name/value pair into the database.
4712 * @param resolver to access the database with
4713 * @param name to store
4714 * @param value to associate with the name
4715 * @return true if the value was set, false on database errors
4717 public static boolean putString(ContentResolver resolver, String name, String value) {
4718 return putStringForUser(resolver, name, value, UserHandle.myUserId());
4722 public static boolean putStringForUser(ContentResolver resolver, String name, String value,
4724 return putStringForUser(resolver, name, value, null, false, userHandle);
4728 public static boolean putStringForUser(@NonNull ContentResolver resolver,
4729 @NonNull String name, @Nullable String value, @Nullable String tag,
4730 boolean makeDefault, @UserIdInt int userHandle) {
4731 if (LOCATION_MODE.equals(name)) {
4732 // Map LOCATION_MODE to underlying location provider storage API
4733 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle);
4735 if (MOVED_TO_GLOBAL.contains(name)) {
4736 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
4737 + " to android.provider.Settings.Global");
4738 return Global.putStringForUser(resolver, name, value,
4739 tag, makeDefault, userHandle);
4741 return sNameValueCache.putStringForUser(resolver, name, value, tag,
4742 makeDefault, userHandle);
4746 * Store a name/value pair into the database.
4748 * The method takes an optional tag to associate with the setting
4749 * which can be used to clear only settings made by your package and
4750 * associated with this tag by passing the tag to {@link
4751 * #resetToDefaults(ContentResolver, String)}. Anyone can override
4752 * the current tag. Also if another package changes the setting
4753 * then the tag will be set to the one specified in the set call
4754 * which can be null. Also any of the settings setters that do not
4755 * take a tag as an argument effectively clears the tag.
4757 * For example, if you set settings A and B with tags T1 and T2 and
4758 * another app changes setting A (potentially to the same value), it
4759 * can assign to it a tag T3 (note that now the package that changed
4760 * the setting is not yours). Now if you reset your changes for T1 and
4761 * T2 only setting B will be reset and A not (as it was changed by
4762 * another package) but since A did not change you are in the desired
4763 * initial state. Now if the other app changes the value of A (assuming
4764 * you registered an observer in the beginning) you would detect that
4765 * the setting was changed by another app and handle this appropriately
4766 * (ignore, set back to some value, etc).
4768 * Also the method takes an argument whether to make the value the
4769 * default for this setting. If the system already specified a default
4770 * value, then the one passed in here will <strong>not</strong>
4771 * be set as the default.
4774 * @param resolver to access the database with.
4775 * @param name to store.
4776 * @param value to associate with the name.
4777 * @param tag to associate with the setting.
4778 * @param makeDefault whether to make the value the default one.
4779 * @return true if the value was set, false on database errors.
4781 * @see #resetToDefaults(ContentResolver, String)
4786 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
4787 public static boolean putString(@NonNull ContentResolver resolver,
4788 @NonNull String name, @Nullable String value, @Nullable String tag,
4789 boolean makeDefault) {
4790 return putStringForUser(resolver, name, value, tag, makeDefault,
4791 UserHandle.myUserId());
4795 * Reset the settings to their defaults. This would reset <strong>only</strong>
4796 * settings set by the caller's package. Think of it of a way to undo your own
4797 * changes to the global settings. Passing in the optional tag will reset only
4798 * settings changed by your package and associated with this tag.
4800 * @param resolver Handle to the content resolver.
4801 * @param tag Optional tag which should be associated with the settings to reset.
4803 * @see #putString(ContentResolver, String, String, String, boolean)
4808 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
4809 public static void resetToDefaults(@NonNull ContentResolver resolver,
4810 @Nullable String tag) {
4811 resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
4812 UserHandle.myUserId());
4817 * Reset the settings to their defaults for a given user with a specific mode. The
4818 * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
4819 * allowing resetting the settings made by a package and associated with the tag.
4821 * @param resolver Handle to the content resolver.
4822 * @param tag Optional tag which should be associated with the settings to reset.
4823 * @param mode The reset mode.
4824 * @param userHandle The user for which to reset to defaults.
4826 * @see #RESET_MODE_PACKAGE_DEFAULTS
4827 * @see #RESET_MODE_UNTRUSTED_DEFAULTS
4828 * @see #RESET_MODE_UNTRUSTED_CHANGES
4829 * @see #RESET_MODE_TRUSTED_DEFAULTS
4833 public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
4834 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
4836 Bundle arg = new Bundle();
4837 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
4839 arg.putString(CALL_METHOD_TAG_KEY, tag);
4841 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
4842 IContentProvider cp = sProviderHolder.getProvider(resolver);
4843 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_SECURE, null, arg);
4844 } catch (RemoteException e) {
4845 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
4850 * Construct the content URI for a particular name/value pair,
4851 * useful for monitoring changes with a ContentObserver.
4852 * @param name to look up in the table
4853 * @return the corresponding content URI, or null if not present
4855 public static Uri getUriFor(String name) {
4856 if (MOVED_TO_GLOBAL.contains(name)) {
4857 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
4858 + " to android.provider.Settings.Global, returning global URI.");
4859 return Global.getUriFor(Global.CONTENT_URI, name);
4861 return getUriFor(CONTENT_URI, name);
4865 * Convenience function for retrieving a single secure settings value
4866 * as an integer. Note that internally setting values are always
4867 * stored as strings; this function converts the string to an integer
4868 * for you. The default value will be returned if the setting is
4869 * not defined or not an integer.
4871 * @param cr The ContentResolver to access.
4872 * @param name The name of the setting to retrieve.
4873 * @param def Value to return if the setting is not defined.
4875 * @return The setting's current value, or 'def' if it is not defined
4876 * or not a valid integer.
4878 public static int getInt(ContentResolver cr, String name, int def) {
4879 return getIntForUser(cr, name, def, UserHandle.myUserId());
4883 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
4884 if (LOCATION_MODE.equals(name)) {
4885 // Map from to underlying location provider storage API to location mode
4886 return getLocationModeForUser(cr, userHandle);
4888 String v = getStringForUser(cr, name, userHandle);
4890 return v != null ? Integer.parseInt(v) : def;
4891 } catch (NumberFormatException e) {
4897 * Convenience function for retrieving a single secure settings value
4898 * as an integer. Note that internally setting values are always
4899 * stored as strings; this function converts the string to an integer
4902 * This version does not take a default value. If the setting has not
4903 * been set, or the string value is not a number,
4904 * it throws {@link SettingNotFoundException}.
4906 * @param cr The ContentResolver to access.
4907 * @param name The name of the setting to retrieve.
4909 * @throws SettingNotFoundException Thrown if a setting by the given
4910 * name can't be found or the setting value is not an integer.
4912 * @return The setting's current value.
4914 public static int getInt(ContentResolver cr, String name)
4915 throws SettingNotFoundException {
4916 return getIntForUser(cr, name, UserHandle.myUserId());
4920 public static int getIntForUser(ContentResolver cr, String name, int userHandle)
4921 throws SettingNotFoundException {
4922 if (LOCATION_MODE.equals(name)) {
4923 // Map from to underlying location provider storage API to location mode
4924 return getLocationModeForUser(cr, userHandle);
4926 String v = getStringForUser(cr, name, userHandle);
4928 return Integer.parseInt(v);
4929 } catch (NumberFormatException e) {
4930 throw new SettingNotFoundException(name);
4935 * Convenience function for updating a single settings value as an
4936 * integer. This will either create a new entry in the table if the
4937 * given name does not exist, or modify the value of the existing row
4938 * with that name. Note that internally setting values are always
4939 * stored as strings, so this function converts the given value to a
4940 * string before storing it.
4942 * @param cr The ContentResolver to access.
4943 * @param name The name of the setting to modify.
4944 * @param value The new value for the setting.
4945 * @return true if the value was set, false on database errors
4947 public static boolean putInt(ContentResolver cr, String name, int value) {
4948 return putIntForUser(cr, name, value, UserHandle.myUserId());
4952 public static boolean putIntForUser(ContentResolver cr, String name, int value,
4954 return putStringForUser(cr, name, Integer.toString(value), userHandle);
4958 * Convenience function for retrieving a single secure settings value
4959 * as a {@code long}. Note that internally setting values are always
4960 * stored as strings; this function converts the string to a {@code long}
4961 * for you. The default value will be returned if the setting is
4962 * not defined or not a {@code long}.
4964 * @param cr The ContentResolver to access.
4965 * @param name The name of the setting to retrieve.
4966 * @param def Value to return if the setting is not defined.
4968 * @return The setting's current value, or 'def' if it is not defined
4969 * or not a valid {@code long}.
4971 public static long getLong(ContentResolver cr, String name, long def) {
4972 return getLongForUser(cr, name, def, UserHandle.myUserId());
4976 public static long getLongForUser(ContentResolver cr, String name, long def,
4978 String valString = getStringForUser(cr, name, userHandle);
4981 value = valString != null ? Long.parseLong(valString) : def;
4982 } catch (NumberFormatException e) {
4989 * Convenience function for retrieving a single secure settings value
4990 * as a {@code long}. Note that internally setting values are always
4991 * stored as strings; this function converts the string to a {@code long}
4994 * This version does not take a default value. If the setting has not
4995 * been set, or the string value is not a number,
4996 * it throws {@link SettingNotFoundException}.
4998 * @param cr The ContentResolver to access.
4999 * @param name The name of the setting to retrieve.
5001 * @return The setting's current value.
5002 * @throws SettingNotFoundException Thrown if a setting by the given
5003 * name can't be found or the setting value is not an integer.
5005 public static long getLong(ContentResolver cr, String name)
5006 throws SettingNotFoundException {
5007 return getLongForUser(cr, name, UserHandle.myUserId());
5011 public static long getLongForUser(ContentResolver cr, String name, int userHandle)
5012 throws SettingNotFoundException {
5013 String valString = getStringForUser(cr, name, userHandle);
5015 return Long.parseLong(valString);
5016 } catch (NumberFormatException e) {
5017 throw new SettingNotFoundException(name);
5022 * Convenience function for updating a secure settings value as a long
5023 * integer. This will either create a new entry in the table if the
5024 * given name does not exist, or modify the value of the existing row
5025 * with that name. Note that internally setting values are always
5026 * stored as strings, so this function converts the given value to a
5027 * string before storing it.
5029 * @param cr The ContentResolver to access.
5030 * @param name The name of the setting to modify.
5031 * @param value The new value for the setting.
5032 * @return true if the value was set, false on database errors
5034 public static boolean putLong(ContentResolver cr, String name, long value) {
5035 return putLongForUser(cr, name, value, UserHandle.myUserId());
5039 public static boolean putLongForUser(ContentResolver cr, String name, long value,
5041 return putStringForUser(cr, name, Long.toString(value), userHandle);
5045 * Convenience function for retrieving a single secure settings value
5046 * as a floating point number. Note that internally setting values are
5047 * always stored as strings; this function converts the string to an
5048 * float for you. The default value will be returned if the setting
5049 * is not defined or not a valid float.
5051 * @param cr The ContentResolver to access.
5052 * @param name The name of the setting to retrieve.
5053 * @param def Value to return if the setting is not defined.
5055 * @return The setting's current value, or 'def' if it is not defined
5056 * or not a valid float.
5058 public static float getFloat(ContentResolver cr, String name, float def) {
5059 return getFloatForUser(cr, name, def, UserHandle.myUserId());
5063 public static float getFloatForUser(ContentResolver cr, String name, float def,
5065 String v = getStringForUser(cr, name, userHandle);
5067 return v != null ? Float.parseFloat(v) : def;
5068 } catch (NumberFormatException e) {
5074 * Convenience function for retrieving a single secure settings value
5075 * as a float. Note that internally setting values are always
5076 * stored as strings; this function converts the string to a float
5079 * This version does not take a default value. If the setting has not
5080 * been set, or the string value is not a number,
5081 * it throws {@link SettingNotFoundException}.
5083 * @param cr The ContentResolver to access.
5084 * @param name The name of the setting to retrieve.
5086 * @throws SettingNotFoundException Thrown if a setting by the given
5087 * name can't be found or the setting value is not a float.
5089 * @return The setting's current value.
5091 public static float getFloat(ContentResolver cr, String name)
5092 throws SettingNotFoundException {
5093 return getFloatForUser(cr, name, UserHandle.myUserId());
5097 public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
5098 throws SettingNotFoundException {
5099 String v = getStringForUser(cr, name, userHandle);
5101 throw new SettingNotFoundException(name);
5104 return Float.parseFloat(v);
5105 } catch (NumberFormatException e) {
5106 throw new SettingNotFoundException(name);
5111 * Convenience function for updating a single settings value as a
5112 * floating point number. This will either create a new entry in the
5113 * table if the given name does not exist, or modify the value of the
5114 * existing row with that name. Note that internally setting values
5115 * are always stored as strings, so this function converts the given
5116 * value to a string before storing it.
5118 * @param cr The ContentResolver to access.
5119 * @param name The name of the setting to modify.
5120 * @param value The new value for the setting.
5121 * @return true if the value was set, false on database errors
5123 public static boolean putFloat(ContentResolver cr, String name, float value) {
5124 return putFloatForUser(cr, name, value, UserHandle.myUserId());
5128 public static boolean putFloatForUser(ContentResolver cr, String name, float value,
5130 return putStringForUser(cr, name, Float.toString(value), userHandle);
5134 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
5138 public static final String DEVELOPMENT_SETTINGS_ENABLED =
5139 Global.DEVELOPMENT_SETTINGS_ENABLED;
5142 * When the user has enable the option to have a "bug report" command
5143 * in the power menu.
5144 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
5148 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
5151 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
5154 public static final String ADB_ENABLED = Global.ADB_ENABLED;
5157 * Setting to allow mock locations and location provider status to be injected into the
5158 * LocationManager service for testing purposes during application development. These
5159 * locations and status values override actual location and status information generated
5160 * by network, gps, or other location providers.
5162 * @deprecated This settings is not used anymore.
5165 public static final String ALLOW_MOCK_LOCATION = "mock_location";
5168 * On Android 8.0 (API level 26) and higher versions of the platform,
5169 * a 64-bit number (expressed as a hexadecimal string), unique to
5170 * each combination of app-signing key, user, and device.
5171 * Values of {@code ANDROID_ID} are scoped by signing key and user.
5172 * The value may change if a factory reset is performed on the
5173 * device or if an APK signing key changes.
5175 * For more information about how the platform handles {@code ANDROID_ID}
5176 * in Android 8.0 (API level 26) and higher, see <a
5177 * href="{@docRoot}preview/behavior-changes.html#privacy-all">
5178 * Android 8.0 Behavior Changes</a>.
5180 * <p class="note"><strong>Note:</strong> For apps that were installed
5181 * prior to updating the device to a version of Android 8.0
5182 * (API level 26) or higher, the value of {@code ANDROID_ID} changes
5183 * if the app is uninstalled and then reinstalled after the OTA.
5184 * To preserve values across uninstalls after an OTA to Android 8.0
5185 * or higher, developers can use
5186 * <a href="{@docRoot}guide/topics/data/keyvaluebackup.html">
5187 * Key/Value Backup</a>.</p>
5189 * <p>In versions of the platform lower than Android 8.0 (API level 26),
5190 * a 64-bit number (expressed as a hexadecimal string) that is randomly
5191 * generated when the user first sets up the device and should remain
5192 * constant for the lifetime of the user's device.
5194 * On devices that have
5195 * <a href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">
5196 * multiple users</a>, each user appears as a
5197 * completely separate device, so the {@code ANDROID_ID} value is
5198 * unique to each user.</p>
5200 * <p class="note"><strong>Note:</strong> If the caller is an Instant App the ID is scoped
5201 * to the Instant App, it is generated when the Instant App is first installed and reset if
5202 * the user clears the Instant App.
5204 public static final String ANDROID_ID = "android_id";
5207 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
5210 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
5213 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
5216 public static final String DATA_ROAMING = Global.DATA_ROAMING;
5219 * Setting to record the input method used by default, holding the ID
5220 * of the desired method.
5222 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
5225 * Setting to record the input method subtype used by default, holding the ID
5226 * of the desired method.
5228 public static final String SELECTED_INPUT_METHOD_SUBTYPE =
5229 "selected_input_method_subtype";
5232 * Setting to record the history of input method subtype, holding the pair of ID of IME
5233 * and its last used subtype.
5236 public static final String INPUT_METHODS_SUBTYPE_HISTORY =
5237 "input_methods_subtype_history";
5240 * Setting to record the visibility of input method selector
5242 public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
5243 "input_method_selector_visibility";
5246 * The currently selected voice interaction service flattened ComponentName.
5250 public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
5253 * The currently selected autofill service flattened ComponentName.
5257 public static final String AUTOFILL_SERVICE = "autofill_service";
5260 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
5263 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
5266 * Indicates whether a DPC has been downloaded during provisioning.
5268 * <p>Type: int (0 for false, 1 for true)
5270 * <p>If this is true, then any attempts to begin setup again should result in factory reset
5274 public static final String MANAGED_PROVISIONING_DPC_DOWNLOADED =
5275 "managed_provisioning_dpc_downloaded";
5278 * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
5282 public static final String USER_SETUP_COMPLETE = "user_setup_complete";
5285 * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
5286 * This value differs from USER_SETUP_COMPLETE in that it can be reset back to 0
5287 * in case SetupWizard has been re-enabled on TV devices.
5291 public static final String TV_USER_SETUP_COMPLETE = "tv_user_setup_complete";
5294 * Prefix for category name that marks whether a suggested action from that category was
5298 public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category.";
5301 * List of input methods that are currently enabled. This is a string
5302 * containing the IDs of all enabled input methods, each ID separated
5305 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
5308 * List of system input methods that are currently disabled. This is a string
5309 * containing the IDs of all disabled input methods, each ID separated
5313 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
5316 * Whether to show the IME when a hard keyboard is connected. This is a boolean that
5317 * determines if the IME should be shown when a hard keyboard is attached.
5320 public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
5323 * Host name and port for global http proxy. Uses ':' seperator for
5324 * between host and port.
5326 * @deprecated Use {@link Global#HTTP_PROXY}
5329 public static final String HTTP_PROXY = Global.HTTP_PROXY;
5332 * Package designated as always-on VPN provider.
5336 public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app";
5339 * Whether to block networking outside of VPN connections while always-on is set.
5340 * @see #ALWAYS_ON_VPN_APP
5344 public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown";
5347 * Whether applications can be installed for this user via the system's
5348 * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
5350 * <p>1 = permit app installation via the system package installer intent
5351 * <p>0 = do not allow use of the package installer
5352 * @deprecated Starting from {@link android.os.Build.VERSION_CODES#O}, apps should use
5353 * {@link PackageManager#canRequestPackageInstalls()}
5354 * @see PackageManager#canRequestPackageInstalls()
5356 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
5359 * A flag to tell {@link com.android.server.devicepolicy.DevicePolicyManagerService} that
5360 * the default for {@link #INSTALL_NON_MARKET_APPS} is reversed for this user on OTA. So it
5361 * can set the restriction {@link android.os.UserManager#DISALLOW_INSTALL_UNKNOWN_SOURCES}
5362 * on behalf of the profile owner if needed to make the change transparent for profile
5367 public static final String UNKNOWN_SOURCES_DEFAULT_REVERSED =
5368 "unknown_sources_default_reversed";
5371 * Comma-separated list of location providers that activities may access. Do not rely on
5372 * this value being present in settings.db or on ContentObserver notifications on the
5373 * corresponding Uri.
5375 * @deprecated use {@link #LOCATION_MODE} and
5376 * {@link LocationManager#MODE_CHANGED_ACTION} (or
5377 * {@link LocationManager#PROVIDERS_CHANGED_ACTION})
5380 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
5383 * The degree of location access enabled by the user.
5385 * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
5386 * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link
5387 * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link
5388 * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location
5389 * modes that might be added in the future.
5391 * Note: do not rely on this value being present in settings.db or on ContentObserver
5392 * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION}
5393 * to receive changes in this value.
5395 public static final String LOCATION_MODE = "location_mode";
5397 * Stores the previous location mode when {@link #LOCATION_MODE} is set to
5398 * {@link #LOCATION_MODE_OFF}
5401 public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode";
5404 * Sets all location providers to the previous states before location was turned off.
5407 public static final int LOCATION_MODE_PREVIOUS = -1;
5409 * Location access disabled.
5411 public static final int LOCATION_MODE_OFF = 0;
5413 * Network Location Provider disabled, but GPS and other sensors enabled.
5415 public static final int LOCATION_MODE_SENSORS_ONLY = 1;
5417 * Reduced power usage, such as limiting the number of GPS updates per hour. Requests
5418 * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to
5419 * {@link android.location.Criteria#POWER_MEDIUM}.
5421 public static final int LOCATION_MODE_BATTERY_SAVING = 2;
5423 * Best-effort location computation allowed.
5425 public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
5428 * A flag containing settings used for biometric weak
5432 public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
5433 "lock_biometric_weak_flags";
5436 * Whether lock-to-app will lock the keyguard when exiting.
5439 public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
5442 * Whether autolock is enabled (0 = false, 1 = true)
5444 * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
5445 * level of the keyguard. Accessing this setting from an app that is targeting
5446 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
5449 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
5452 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
5454 * @deprecated Accessing this setting from an app that is targeting
5455 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
5458 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
5461 * Whether lock pattern will vibrate as user enters (0 = false, 1 =
5464 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
5466 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
5467 * Accessing this setting from an app that is targeting
5468 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
5471 public static final String
5472 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
5475 * This preference allows the device to be locked given time after screen goes off,
5476 * subject to current DeviceAdmin policy limits.
5479 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
5483 * This preference contains the string that shows for owner info on LockScreen.
5488 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
5491 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
5495 public static final String LOCK_SCREEN_APPWIDGET_IDS =
5496 "lock_screen_appwidget_ids";
5499 * Id of the appwidget shown on the lock screen when appwidgets are disabled.
5503 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
5504 "lock_screen_fallback_appwidget_id";
5507 * Index of the lockscreen appwidget to restore, -1 if none.
5511 public static final String LOCK_SCREEN_STICKY_APPWIDGET =
5512 "lock_screen_sticky_appwidget";
5515 * This preference enables showing the owner info on LockScreen.
5520 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
5521 "lock_screen_owner_info_enabled";
5524 * When set by a user, allows notifications to be shown atop a securely locked screen
5525 * in their full "private" form (same as when the device is unlocked).
5528 public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
5529 "lock_screen_allow_private_notifications";
5532 * When set by a user, allows notification remote input atop a securely locked screen
5533 * without having to unlock
5536 public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT =
5537 "lock_screen_allow_remote_input";
5540 * Set by the system to track if the user needs to see the call to action for
5541 * the lockscreen notification policy.
5544 public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
5545 "show_note_about_notification_hiding";
5548 * Set to 1 by the system after trust agents have been initialized.
5551 public static final String TRUST_AGENTS_INITIALIZED =
5552 "trust_agents_initialized";
5555 * The Logging ID (a unique 64-bit value) as a hex string.
5556 * Used as a pseudonymous identifier for logging.
5557 * @deprecated This identifier is poorly initialized and has
5558 * many collisions. It should not be used.
5561 public static final String LOGGING_ID = "logging_id";
5564 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
5567 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
5570 * No longer supported.
5572 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
5575 * No longer supported.
5577 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
5580 * No longer supported.
5582 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
5585 * Settings classname to launch when Settings is clicked from All
5586 * Applications. Needed because of user testing between the old
5587 * and new Settings apps.
5590 public static final String SETTINGS_CLASSNAME = "settings_classname";
5593 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
5596 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
5599 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
5602 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
5605 * If accessibility is enabled.
5607 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
5610 * Setting specifying if the accessibility shortcut is enabled.
5613 public static final String ACCESSIBILITY_SHORTCUT_ENABLED =
5614 "accessibility_shortcut_enabled";
5617 * Setting specifying if the accessibility shortcut is enabled.
5620 public static final String ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN =
5621 "accessibility_shortcut_on_lock_screen";
5624 * Setting specifying if the accessibility shortcut dialog has been shown to this user.
5627 public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN =
5628 "accessibility_shortcut_dialog_shown";
5631 * Setting specifying the accessibility service to be toggled via the accessibility
5632 * shortcut. Must be its flattened {@link ComponentName}.
5635 public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE =
5636 "accessibility_shortcut_target_service";
5639 * Setting specifying the accessibility service or feature to be toggled via the
5640 * accessibility button in the navigation bar. This is either a flattened
5641 * {@link ComponentName} or the class name of a system class implementing a supported
5642 * accessibility feature.
5645 public static final String ACCESSIBILITY_BUTTON_TARGET_COMPONENT =
5646 "accessibility_button_target_component";
5649 * If touch exploration is enabled.
5651 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
5654 * List of the enabled accessibility providers.
5656 public static final String ENABLED_ACCESSIBILITY_SERVICES =
5657 "enabled_accessibility_services";
5660 * List of the accessibility services to which the user has granted
5661 * permission to put the device into touch exploration mode.
5665 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
5666 "touch_exploration_granted_accessibility_services";
5669 * Whether to speak passwords while in accessibility mode.
5671 * @deprecated The speaking of passwords is controlled by individual accessibility services.
5672 * Apps should ignore this setting and provide complete information to accessibility
5673 * at all times, which was the behavior when this value was {@code true}.
5676 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
5679 * Whether to draw text with high contrast while in accessibility mode.
5683 public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
5684 "high_text_contrast_enabled";
5687 * Setting that specifies whether the display magnification is enabled via a system-wide
5688 * triple tap gesture. Display magnifications allows the user to zoom in the display content
5689 * and is targeted to low vision users. The current magnification scale is controlled by
5690 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
5694 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
5695 "accessibility_display_magnification_enabled";
5698 * Setting that specifies whether the display magnification is enabled via a shortcut
5699 * affordance within the system's navigation area. Display magnifications allows the user to
5700 * zoom in the display content and is targeted to low vision users. The current
5701 * magnification scale is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
5705 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED =
5706 "accessibility_display_magnification_navbar_enabled";
5709 * Setting that specifies what the display magnification scale is.
5710 * Display magnifications allows the user to zoom in the display
5711 * content and is targeted to low vision users. Whether a display
5712 * magnification is performed is controlled by
5713 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} and
5714 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED}
5718 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
5719 "accessibility_display_magnification_scale";
5722 * Unused mangnification setting
5728 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
5729 "accessibility_display_magnification_auto_update";
5732 * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be
5733 * modified from an AccessibilityService using the SoftKeyboardController.
5737 public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE =
5738 "accessibility_soft_keyboard_mode";
5741 * Default soft keyboard behavior.
5745 public static final int SHOW_MODE_AUTO = 0;
5748 * Soft keyboard is never shown.
5752 public static final int SHOW_MODE_HIDDEN = 1;
5755 * Setting that specifies whether timed text (captions) should be
5756 * displayed in video content. Text display properties are controlled by
5757 * the following settings:
5759 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
5760 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
5761 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
5762 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
5763 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
5764 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
5765 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
5770 public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
5771 "accessibility_captioning_enabled";
5774 * Setting that specifies the language for captions as a locale string,
5777 * @see java.util.Locale#toString
5780 public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
5781 "accessibility_captioning_locale";
5784 * Integer property that specifies the preset style for captions, one
5787 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
5788 * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
5791 * @see java.util.Locale#toString
5794 public static final String ACCESSIBILITY_CAPTIONING_PRESET =
5795 "accessibility_captioning_preset";
5798 * Integer property that specifes the background color for captions as a
5799 * packed 32-bit color.
5801 * @see android.graphics.Color#argb
5804 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
5805 "accessibility_captioning_background_color";
5808 * Integer property that specifes the foreground color for captions as a
5809 * packed 32-bit color.
5811 * @see android.graphics.Color#argb
5814 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
5815 "accessibility_captioning_foreground_color";
5818 * Integer property that specifes the edge type for captions, one of:
5820 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
5821 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
5822 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
5825 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
5828 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
5829 "accessibility_captioning_edge_type";
5832 * Integer property that specifes the edge color for captions as a
5833 * packed 32-bit color.
5835 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
5836 * @see android.graphics.Color#argb
5839 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
5840 "accessibility_captioning_edge_color";
5843 * Integer property that specifes the window color for captions as a
5844 * packed 32-bit color.
5846 * @see android.graphics.Color#argb
5849 public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
5850 "accessibility_captioning_window_color";
5853 * String property that specifies the typeface for captions, one of:
5861 * @see android.graphics.Typeface
5864 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
5865 "accessibility_captioning_typeface";
5868 * Floating point property that specifies font scaling for captions.
5872 public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
5873 "accessibility_captioning_font_scale";
5876 * Setting that specifies whether display color inversion is enabled.
5878 public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
5879 "accessibility_display_inversion_enabled";
5882 * Setting that specifies whether display color space adjustment is
5887 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
5888 "accessibility_display_daltonizer_enabled";
5891 * Integer property that specifies the type of color space adjustment to
5892 * perform. Valid values are defined in AccessibilityManager.
5896 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
5897 "accessibility_display_daltonizer";
5900 * Setting that specifies whether automatic click when the mouse pointer stops moving is
5905 public static final String ACCESSIBILITY_AUTOCLICK_ENABLED =
5906 "accessibility_autoclick_enabled";
5909 * Integer setting specifying amount of time in ms the mouse pointer has to stay still
5910 * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set.
5912 * @see #ACCESSIBILITY_AUTOCLICK_ENABLED
5915 public static final String ACCESSIBILITY_AUTOCLICK_DELAY =
5916 "accessibility_autoclick_delay";
5919 * Whether or not larger size icons are used for the pointer of mouse/trackpad for
5921 * (0 = false, 1 = true)
5924 public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
5925 "accessibility_large_pointer_icon";
5928 * The timeout for considering a press to be a long press in milliseconds.
5931 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
5934 * The duration in milliseconds between the first tap's up event and the second tap's
5935 * down event for an interaction to be considered part of the same multi-press.
5938 public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout";
5941 * List of the enabled print services.
5943 * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade
5948 public static final String ENABLED_PRINT_SERVICES =
5949 "enabled_print_services";
5952 * List of the disabled print services.
5957 public static final String DISABLED_PRINT_SERVICES =
5958 "disabled_print_services";
5961 * The saved value for WindowManagerService.setForcedDisplayDensity()
5962 * formatted as a single integer representing DPI. If unset, then use
5963 * the real display density.
5967 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
5970 * Setting to always use the default text-to-speech settings regardless
5971 * of the application settings.
5972 * 1 = override application settings,
5973 * 0 = use application settings (if specified).
5975 * @deprecated The value of this setting is no longer respected by
5976 * the framework text to speech APIs as of the Ice Cream Sandwich release.
5979 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
5982 * Default text-to-speech engine speech rate. 100 = 1x
5984 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
5987 * Default text-to-speech engine pitch. 100 = 1x
5989 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
5992 * Default text-to-speech engine.
5994 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
5997 * Default text-to-speech language.
5999 * @deprecated this setting is no longer in use, as of the Ice Cream
6000 * Sandwich release. Apps should never need to read this setting directly,
6001 * instead can query the TextToSpeech framework classes for the default
6002 * locale. {@link TextToSpeech#getLanguage()}.
6005 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
6008 * Default text-to-speech country.
6010 * @deprecated this setting is no longer in use, as of the Ice Cream
6011 * Sandwich release. Apps should never need to read this setting directly,
6012 * instead can query the TextToSpeech framework classes for the default
6013 * locale. {@link TextToSpeech#getLanguage()}.
6016 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
6019 * Default text-to-speech locale variant.
6021 * @deprecated this setting is no longer in use, as of the Ice Cream
6022 * Sandwich release. Apps should never need to read this setting directly,
6023 * instead can query the TextToSpeech framework classes for the
6024 * locale that is in use {@link TextToSpeech#getLanguage()}.
6027 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
6030 * Stores the default tts locales on a per engine basis. Stored as
6031 * a comma seperated list of values, each value being of the form
6032 * {@code engine_name:locale} for example,
6033 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
6034 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
6035 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
6036 * setting directly, and can query the TextToSpeech framework classes
6037 * for the locale that is in use.
6041 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
6044 * Space delimited list of plugin packages that are enabled.
6046 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
6049 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
6053 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
6054 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
6057 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
6061 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
6062 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
6065 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
6069 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
6070 Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
6073 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
6077 public static final String WIFI_ON = Global.WIFI_ON;
6080 * The acceptable packet loss percentage (range 0 - 100) before trying
6081 * another AP on the same network.
6082 * @deprecated This setting is not used.
6085 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
6086 "wifi_watchdog_acceptable_packet_loss_percentage";
6089 * The number of access points required for a network in order for the
6090 * watchdog to monitor it.
6091 * @deprecated This setting is not used.
6094 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
6097 * The delay between background checks.
6098 * @deprecated This setting is not used.
6101 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
6102 "wifi_watchdog_background_check_delay_ms";
6105 * Whether the Wi-Fi watchdog is enabled for background checking even
6106 * after it thinks the user has connected to a good access point.
6107 * @deprecated This setting is not used.
6110 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
6111 "wifi_watchdog_background_check_enabled";
6114 * The timeout for a background ping
6115 * @deprecated This setting is not used.
6118 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
6119 "wifi_watchdog_background_check_timeout_ms";
6122 * The number of initial pings to perform that *may* be ignored if they
6123 * fail. Again, if these fail, they will *not* be used in packet loss
6124 * calculation. For example, one network always seemed to time out for
6125 * the first couple pings, so this is set to 3 by default.
6126 * @deprecated This setting is not used.
6129 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
6130 "wifi_watchdog_initial_ignored_ping_count";
6133 * The maximum number of access points (per network) to attempt to test.
6134 * If this number is reached, the watchdog will no longer monitor the
6135 * initial connection state for the network. This is a safeguard for
6136 * networks containing multiple APs whose DNS does not respond to pings.
6137 * @deprecated This setting is not used.
6140 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
6143 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
6146 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
6149 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
6150 * @deprecated This setting is not used.
6153 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
6156 * The number of pings to test if an access point is a good connection.
6157 * @deprecated This setting is not used.
6160 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
6163 * The delay between pings.
6164 * @deprecated This setting is not used.
6167 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
6170 * The timeout per ping.
6171 * @deprecated This setting is not used.
6174 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
6178 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
6181 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
6185 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
6188 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
6189 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
6192 * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
6193 * the receivers of the PendingIntent an opportunity to make a new network request before
6194 * the Network satisfying the request is potentially removed.
6198 public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
6199 "connectivity_release_pending_intent_delay_ms";
6202 * Whether background data usage is allowed.
6204 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
6205 * availability of background data depends on several
6206 * combined factors. When background data is unavailable,
6207 * {@link ConnectivityManager#getActiveNetworkInfo()} will
6208 * now appear disconnected.
6211 public static final String BACKGROUND_DATA = "background_data";
6214 * Origins for which browsers should allow geolocation by default.
6215 * The value is a space-separated list of origins.
6217 public static final String ALLOWED_GEOLOCATION_ORIGINS
6218 = "allowed_geolocation_origins";
6221 * The preferred TTY mode 0 = TTy Off, CDMA default
6227 public static final String PREFERRED_TTY_MODE =
6228 "preferred_tty_mode";
6231 * Whether the enhanced voice privacy mode is enabled.
6232 * 0 = normal voice privacy
6233 * 1 = enhanced voice privacy
6236 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
6239 * Whether the TTY mode mode is enabled.
6244 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
6247 * Controls whether settings backup is enabled.
6248 * Type: int ( 0 = disabled, 1 = enabled )
6251 public static final String BACKUP_ENABLED = "backup_enabled";
6254 * Controls whether application data is automatically restored from backup
6256 * Type: int ( 0 = disabled, 1 = enabled )
6259 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
6262 * Indicates whether settings backup has been fully provisioned.
6263 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
6266 public static final String BACKUP_PROVISIONED = "backup_provisioned";
6269 * Component of the transport to use for backup/restore.
6272 public static final String BACKUP_TRANSPORT = "backup_transport";
6275 * Version for which the setup wizard was last shown. Bumped for
6276 * each release when there is new setup information to show.
6279 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
6282 * The interval in milliseconds after which Wi-Fi is considered idle.
6283 * When idle, it is possible for the device to be switched from Wi-Fi to
6284 * the mobile data network.
6286 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
6290 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
6293 * The global search provider chosen by the user (if multiple global
6294 * search providers are installed). This will be the provider returned
6295 * by {@link SearchManager#getGlobalSearchActivity()} if it's still
6296 * installed. This setting is stored as a flattened component name as
6297 * per {@link ComponentName#flattenToString()}.
6301 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
6302 "search_global_search_activity";
6305 * The number of promoted sources in GlobalSearch.
6308 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
6310 * The maximum number of suggestions returned by GlobalSearch.
6313 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
6315 * The number of suggestions GlobalSearch will ask each non-web search source for.
6318 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
6320 * The number of suggestions the GlobalSearch will ask the web search source for.
6323 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
6324 "search_web_results_override_limit";
6326 * The number of milliseconds that GlobalSearch will wait for suggestions from
6327 * promoted sources before continuing with all other sources.
6330 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
6331 "search_promoted_source_deadline_millis";
6333 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
6336 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
6338 * The maximum number of milliseconds that GlobalSearch shows the previous results
6339 * after receiving a new query.
6342 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
6344 * The maximum age of log data used for shortcuts in GlobalSearch.
6347 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
6349 * The maximum age of log data used for source ranking in GlobalSearch.
6352 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
6353 "search_max_source_event_age_millis";
6355 * The minimum number of impressions needed to rank a source in GlobalSearch.
6358 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
6359 "search_min_impressions_for_source_ranking";
6361 * The minimum number of clicks needed to rank a source in GlobalSearch.
6364 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
6365 "search_min_clicks_for_source_ranking";
6367 * The maximum number of shortcuts shown by GlobalSearch.
6370 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
6372 * The size of the core thread pool for suggestion queries in GlobalSearch.
6375 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
6376 "search_query_thread_core_pool_size";
6378 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
6381 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
6382 "search_query_thread_max_pool_size";
6384 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
6387 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
6388 "search_shortcut_refresh_core_pool_size";
6390 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
6393 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
6394 "search_shortcut_refresh_max_pool_size";
6396 * The maximun time that excess threads in the GlobalSeach thread pools will
6397 * wait before terminating.
6400 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
6401 "search_thread_keepalive_seconds";
6403 * The maximum number of concurrent suggestion queries to each source.
6406 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
6407 "search_per_source_concurrent_query_limit";
6410 * Whether or not alert sounds are played on StorageManagerService events.
6411 * (0 = false, 1 = true)
6414 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
6417 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
6420 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
6423 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
6426 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
6429 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
6432 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
6435 * If nonzero, ANRs in invisible background processes bring up a dialog.
6436 * Otherwise, the process will be silently killed.
6438 * Also prevents ANRs and crash dialogs from being suppressed.
6441 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
6444 * The {@link ComponentName} string of the service to be used as the voice recognition
6449 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
6452 * Stores whether an user has consented to have apps verified through PAM.
6453 * The value is boolean (1 or 0).
6457 public static final String PACKAGE_VERIFIER_USER_CONSENT =
6458 "package_verifier_user_consent";
6461 * The {@link ComponentName} string of the selected spell checker service which is
6462 * one of the services managed by the text service manager.
6466 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
6469 * The {@link ComponentName} string of the selected subtype of the selected spell checker
6470 * service which is one of the services managed by the text service manager.
6474 public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
6475 "selected_spell_checker_subtype";
6478 * The {@link ComponentName} string whether spell checker is enabled or not.
6482 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
6485 * What happens when the user presses the Power button while in-call
6486 * and the screen is on.<br/>
6487 * <b>Values:</b><br/>
6488 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
6489 * 2 - The Power button hangs up the current call.<br/>
6493 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
6496 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
6499 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
6502 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
6505 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
6508 * INCALL_POWER_BUTTON_BEHAVIOR default value.
6511 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
6512 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
6515 * What happens when the user presses the Back button while in-call
6516 * and the screen is on.<br/>
6517 * <b>Values:</b><br/>
6518 * 0 - The Back buttons does nothing different.<br/>
6519 * 1 - The Back button hangs up the current call.<br/>
6523 public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior";
6526 * INCALL_BACK_BUTTON_BEHAVIOR value for no action.
6529 public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0;
6532 * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up".
6535 public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1;
6538 * INCALL_POWER_BUTTON_BEHAVIOR default value.
6541 public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT =
6542 INCALL_BACK_BUTTON_BEHAVIOR_NONE;
6545 * Whether the device should wake when the wake gesture sensor detects motion.
6548 public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
6551 * Whether the device should doze if configured.
6554 public static final String DOZE_ENABLED = "doze_enabled";
6557 * Whether doze should be always on.
6560 public static final String DOZE_ALWAYS_ON = "doze_always_on";
6563 * Whether the device should pulse on pick up gesture.
6566 public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
6569 * Whether the device should pulse on long press gesture.
6572 public static final String DOZE_PULSE_ON_LONG_PRESS = "doze_pulse_on_long_press";
6575 * Whether the device should pulse on double tap gesture.
6578 public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap";
6581 * The current night mode that has been selected by the user. Owned
6582 * and controlled by UiModeManagerService. Constants are as per
6586 public static final String UI_NIGHT_MODE = "ui_night_mode";
6589 * Whether screensavers are enabled.
6592 public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
6595 * The user's chosen screensaver components.
6597 * These will be launched by the PhoneWindowManager after a timeout when not on
6598 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
6601 public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
6604 * If screensavers are enabled, whether the screensaver should be automatically launched
6605 * when the device is inserted into a (desk) dock.
6608 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
6611 * If screensavers are enabled, whether the screensaver should be automatically launched
6612 * when the screen times out when not on battery.
6615 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
6618 * If screensavers are enabled, the default screensaver component.
6621 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
6624 * The default NFC payment component
6627 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
6630 * Whether NFC payment is handled by the foreground application or a default.
6633 public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
6636 * Specifies the package name currently configured to be the primary sms application
6639 public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
6642 * Specifies the package name currently configured to be the default dialer application
6645 public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application";
6648 * Specifies the package name currently configured to be the emergency assistance application
6650 * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
6654 public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
6657 * Specifies whether the current app context on scren (assist data) will be sent to the
6658 * assist application (active voice interaction service).
6662 public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
6665 * Specifies whether a screenshot of the screen contents will be sent to the assist
6666 * application (active voice interaction service).
6670 public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled";
6673 * Specifies whether the screen will show an animation if screen contents are sent to the
6674 * assist application (active voice interaction service).
6676 * Note that the disclosure will be forced for third-party assistants or if the device
6677 * does not support disabling it.
6681 public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled";
6684 * Read only list of the service components that the current user has explicitly allowed to
6685 * see and assist with all of the user's notifications.
6688 * {@link NotificationManager#isNotificationListenerAccessGranted(ComponentName)}.
6692 public static final String ENABLED_NOTIFICATION_ASSISTANT =
6693 "enabled_notification_assistant";
6696 * Read only list of the service components that the current user has explicitly allowed to
6697 * see all of the user's notifications, separated by ':'.
6701 * {@link NotificationManager#isNotificationAssistantAccessGranted(ComponentName)}.
6704 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
6707 * Read only list of the packages that the current user has explicitly allowed to
6708 * manage do not disturb, separated by ':'.
6710 * @deprecated Use {@link NotificationManager#isNotificationPolicyAccessGranted()}.
6715 public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES =
6716 "enabled_notification_policy_access_packages";
6719 * Defines whether managed profile ringtones should be synced from it's parent profile
6721 * 0 = ringtones are not synced
6722 * 1 = ringtones are synced from the profile's parent (default)
6724 * This value is only used for managed profiles.
6728 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
6729 public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
6732 public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
6735 * This is the query URI for finding a print service to install.
6739 public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
6742 * This is the query URI for finding a NFC payment service to install.
6746 public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
6749 * This is the query URI for finding a auto fill service to install.
6753 public static final String AUTOFILL_SERVICE_SEARCH_URI = "autofill_service_search_uri";
6756 * If enabled, apps should try to skip any introductory hints on first launch. This might
6757 * apply to users that are already familiar with the environment or temporary users.
6759 * Type : int (0 to show hints, 1 to skip showing hints)
6761 public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
6764 * Persisted playback time after a user confirmation of an unsafe volume level.
6768 public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
6771 * This preference enables notification display on the lockscreen.
6774 public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
6775 "lock_screen_show_notifications";
6778 * This preference stores the last stack active task time for each user, which affects what
6779 * tasks will be visible in Overview.
6782 public static final String OVERVIEW_LAST_STACK_ACTIVE_TIME =
6783 "overview_last_stack_active_time";
6786 * List of TV inputs that are currently hidden. This is a string
6787 * containing the IDs of all hidden TV inputs. Each ID is encoded by
6788 * {@link android.net.Uri#encode(String)} and separated by ':'.
6791 public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
6794 * List of custom TV input labels. This is a string containing <TV input id, custom name>
6795 * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
6796 * and separated by ','. Each pair is separated by ':'.
6799 public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
6802 * Whether automatic routing of system audio to USB audio peripheral is disabled.
6803 * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
6804 * and 0 means automatic routing is enabled.
6808 public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
6809 "usb_audio_automatic_routing_disabled";
6812 * The timeout in milliseconds before the device fully goes to sleep after
6813 * a period of inactivity. This value sets an upper bound on how long the device
6814 * will stay awake or dreaming without user activity. It should generally
6815 * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
6816 * will sleep before it ever has a chance to dream.
6818 * Use -1 to disable this timeout.
6823 public static final String SLEEP_TIMEOUT = "sleep_timeout";
6826 * Controls whether double tap to wake is enabled.
6829 public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
6832 * The current assistant component. It could be a voice interaction service,
6833 * or an activity that handles ACTION_ASSIST, or empty which means using the default
6838 public static final String ASSISTANT = "assistant";
6841 * Whether the camera launch gesture should be disabled.
6845 public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled";
6848 * Whether the camera launch gesture to double tap the power button when the screen is off
6849 * should be disabled.
6853 public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED =
6854 "camera_double_tap_power_gesture_disabled";
6857 * Whether the camera double twist gesture to flip between front and back mode should be
6862 public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED =
6863 "camera_double_twist_to_flip_enabled";
6866 * Whether or not the smart camera lift trigger that launches the camera when the user moves
6867 * the phone into a position for taking photos should be enabled.
6871 public static final String CAMERA_LIFT_TRIGGER_ENABLED = "camera_lift_trigger_enabled";
6874 * The default enable state of the camera lift trigger.
6878 public static final int CAMERA_LIFT_TRIGGER_ENABLED_DEFAULT = 1;
6881 * Whether the assist gesture should be enabled.
6885 public static final String ASSIST_GESTURE_ENABLED = "assist_gesture_enabled";
6888 * Sensitivity control for the assist gesture.
6892 public static final String ASSIST_GESTURE_SENSITIVITY = "assist_gesture_sensitivity";
6895 * Whether the assist gesture should silence alerts.
6899 public static final String ASSIST_GESTURE_SILENCE_ALERTS_ENABLED =
6900 "assist_gesture_silence_alerts_enabled";
6903 * Whether the assist gesture should wake the phone.
6907 public static final String ASSIST_GESTURE_WAKE_ENABLED =
6908 "assist_gesture_wake_enabled";
6911 * Whether Assist Gesture Deferred Setup has been completed
6915 public static final String ASSIST_GESTURE_SETUP_COMPLETE = "assist_gesture_setup_complete";
6918 * Control whether Night display is currently activated.
6921 public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated";
6924 * Control whether Night display will automatically activate/deactivate.
6927 public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode";
6930 * Control the color temperature of Night Display, represented in Kelvin.
6933 public static final String NIGHT_DISPLAY_COLOR_TEMPERATURE =
6934 "night_display_color_temperature";
6937 * Custom time when Night display is scheduled to activate.
6938 * Represented as milliseconds from midnight (e.g. 79200000 == 10pm).
6941 public static final String NIGHT_DISPLAY_CUSTOM_START_TIME =
6942 "night_display_custom_start_time";
6945 * Custom time when Night display is scheduled to deactivate.
6946 * Represented as milliseconds from midnight (e.g. 21600000 == 6am).
6949 public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time";
6952 * A String representing the LocalDateTime when Night display was last activated. Use to
6953 * decide whether to apply the current activated state after a reboot or user change. In
6954 * legacy cases, this is represented by the time in milliseconds (since epoch).
6957 public static final String NIGHT_DISPLAY_LAST_ACTIVATED_TIME =
6958 "night_display_last_activated_time";
6961 * Names of the service components that the current user has explicitly allowed to
6962 * be a VR mode listener, separated by ':'.
6966 public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
6969 * Behavior of the display while in VR mode.
6971 * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}.
6975 public static final String VR_DISPLAY_MODE = "vr_display_mode";
6978 * Lower the display persistence while the system is in VR mode.
6980 * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
6984 public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0;
6987 * Do not alter the display persistence while the system is in VR mode.
6989 * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
6993 public static final int VR_DISPLAY_MODE_OFF = 1;
6996 * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least
6999 * <p>This is used to ensure that we only take one pass which will disable apps that are not
7000 * privileged (if any). From then on, we only want to enable apps (when a matching SIM is
7001 * inserted), to avoid disabling an app that the user might actively be using.
7003 * <p>Will be set to 1 once executed.
7007 public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
7010 * Whether parent user can access remote contact in managed profile.
7014 public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH =
7015 "managed_profile_contact_remote_search";
7018 * Whether or not the automatic storage manager is enabled and should run on the device.
7022 public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED =
7023 "automatic_storage_manager_enabled";
7026 * How many days of information for the automatic storage manager to retain on the device.
7030 public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN =
7031 "automatic_storage_manager_days_to_retain";
7034 * Default number of days of information for the automatic storage manager to retain.
7038 public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90;
7041 * How many bytes the automatic storage manager has cleared out.
7045 public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED =
7046 "automatic_storage_manager_bytes_cleared";
7050 * Last run time for the automatic storage manager.
7054 public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN =
7055 "automatic_storage_manager_last_run";
7058 * If the automatic storage manager has been disabled by policy. Note that this doesn't
7059 * mean that the automatic storage manager is prevented from being re-enabled -- this only
7060 * means that it was turned off by policy at least once.
7064 public static final String AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY =
7065 "automatic_storage_manager_turned_off_by_policy";
7068 * Whether SystemUI navigation keys is enabled.
7071 public static final String SYSTEM_NAVIGATION_KEYS_ENABLED =
7072 "system_navigation_keys_enabled";
7075 * Holds comma separated list of ordering of QS tiles.
7078 public static final String QS_TILES = "sysui_qs_tiles";
7081 * Whether preloaded APKs have been installed for the user.
7084 public static final String DEMO_USER_SETUP_COMPLETE
7085 = "demo_user_setup_complete";
7088 * Specifies whether the web action API is enabled.
7093 public static final String INSTANT_APPS_ENABLED = "instant_apps_enabled";
7096 * Has this pairable device been paired or upgraded from a previously paired system.
7099 public static final String DEVICE_PAIRED = "device_paired";
7102 * Integer state indicating whether package verifier is enabled.
7103 * TODO(b/34259924): Remove this setting.
7107 public static final String PACKAGE_VERIFIER_STATE = "package_verifier_state";
7110 * Specifies additional package name for broadcasting the CMAS messages.
7113 public static final String CMAS_ADDITIONAL_BROADCAST_PKG = "cmas_additional_broadcast_pkg";
7116 * Whether the launcher should show any notification badges.
7117 * The value is boolean (1 or 0).
7120 public static final String NOTIFICATION_BADGING = "notification_badging";
7123 * Comma separated list of QS tiles that have been auto-added already.
7126 public static final String QS_AUTO_ADDED_TILES = "qs_auto_tiles";
7129 * This are the settings to be backed up.
7131 * NOTE: Settings are backed up and restored in the order they appear
7132 * in this array. If you have one setting depending on another,
7133 * make sure that they are ordered appropriately.
7137 public static final String[] SETTINGS_TO_BACKUP = {
7138 BUGREPORT_IN_POWER_MENU, // moved to global
7139 ALLOW_MOCK_LOCATION,
7140 PARENTAL_CONTROL_ENABLED,
7141 PARENTAL_CONTROL_REDIRECT_URL,
7142 USB_MASS_STORAGE_ENABLED, // moved to global
7143 ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
7144 ACCESSIBILITY_DISPLAY_DALTONIZER,
7145 ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
7146 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
7147 ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
7149 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
7150 ENABLED_ACCESSIBILITY_SERVICES,
7151 ENABLED_VR_LISTENERS,
7152 ENABLED_INPUT_METHODS,
7153 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
7154 TOUCH_EXPLORATION_ENABLED,
7155 ACCESSIBILITY_ENABLED,
7156 ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
7157 ACCESSIBILITY_BUTTON_TARGET_COMPONENT,
7158 ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
7159 ACCESSIBILITY_SHORTCUT_ENABLED,
7160 ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN,
7161 ACCESSIBILITY_SPEAK_PASSWORD,
7162 ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
7163 ACCESSIBILITY_CAPTIONING_PRESET,
7164 ACCESSIBILITY_CAPTIONING_ENABLED,
7165 ACCESSIBILITY_CAPTIONING_LOCALE,
7166 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
7167 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
7168 ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
7169 ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
7170 ACCESSIBILITY_CAPTIONING_TYPEFACE,
7171 ACCESSIBILITY_CAPTIONING_FONT_SCALE,
7172 ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
7178 TTS_DEFAULT_COUNTRY,
7179 TTS_ENABLED_PLUGINS,
7181 SHOW_IME_WITH_HARD_KEYBOARD,
7182 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global
7183 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global
7184 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global
7185 SELECTED_SPELL_CHECKER,
7186 SELECTED_SPELL_CHECKER_SUBTYPE,
7187 SPELL_CHECKER_ENABLED,
7188 MOUNT_PLAY_NOTIFICATION_SND,
7189 MOUNT_UMS_AUTOSTART,
7191 MOUNT_UMS_NOTIFY_ENABLED,
7194 WAKE_GESTURE_ENABLED,
7196 CAMERA_GESTURE_DISABLED,
7197 ACCESSIBILITY_AUTOCLICK_ENABLED,
7198 ACCESSIBILITY_AUTOCLICK_DELAY,
7199 ACCESSIBILITY_LARGE_POINTER_ICON,
7201 ENHANCED_VOICE_PRIVACY_ENABLED,
7203 INCALL_POWER_BUTTON_BEHAVIOR,
7204 NIGHT_DISPLAY_CUSTOM_START_TIME,
7205 NIGHT_DISPLAY_CUSTOM_END_TIME,
7206 NIGHT_DISPLAY_COLOR_TEMPERATURE,
7207 NIGHT_DISPLAY_AUTO_MODE,
7209 CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
7210 CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
7211 SYSTEM_NAVIGATION_KEYS_ENABLED,
7214 DOZE_PULSE_ON_PICK_UP,
7215 DOZE_PULSE_ON_DOUBLE_TAP,
7216 NFC_PAYMENT_DEFAULT_COMPONENT,
7217 AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
7218 ASSIST_GESTURE_ENABLED,
7219 ASSIST_GESTURE_SENSITIVITY,
7220 ASSIST_GESTURE_SETUP_COMPLETE,
7221 ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
7222 ASSIST_GESTURE_WAKE_ENABLED,
7224 NOTIFICATION_BADGING,
7225 QS_AUTO_ADDED_TILES,
7226 SCREENSAVER_ENABLED,
7227 SCREENSAVER_COMPONENTS,
7228 SCREENSAVER_ACTIVATE_ON_DOCK,
7229 SCREENSAVER_ACTIVATE_ON_SLEEP,
7233 public static final String[] LEGACY_RESTORE_SETTINGS = {
7234 ENABLED_NOTIFICATION_LISTENERS,
7235 ENABLED_NOTIFICATION_ASSISTANT,
7236 ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES
7240 * These entries are considered common between the personal and the managed profile,
7241 * since the managed profile doesn't get to change them.
7243 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
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 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
7258 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
7262 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
7263 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
7267 * Secure settings which can be accessed by instant apps.
7270 public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
7272 INSTANT_APP_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES);
7273 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD);
7274 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
7275 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_ENABLED);
7276 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_PRESET);
7277 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_EDGE_TYPE);
7278 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_EDGE_COLOR);
7279 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_LOCALE);
7280 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR);
7281 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR);
7282 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_TYPEFACE);
7283 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_FONT_SCALE);
7284 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_WINDOW_COLOR);
7285 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
7286 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_DALTONIZER);
7287 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_AUTOCLICK_DELAY);
7288 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_AUTOCLICK_ENABLED);
7289 INSTANT_APP_SETTINGS.add(ACCESSIBILITY_LARGE_POINTER_ICON);
7291 INSTANT_APP_SETTINGS.add(DEFAULT_INPUT_METHOD);
7292 INSTANT_APP_SETTINGS.add(ENABLED_INPUT_METHODS);
7294 INSTANT_APP_SETTINGS.add(ANDROID_ID);
7296 INSTANT_APP_SETTINGS.add(PACKAGE_VERIFIER_USER_CONSENT);
7297 INSTANT_APP_SETTINGS.add(ALLOW_MOCK_LOCATION);
7301 * Helper method for determining if a location provider is enabled.
7303 * @param cr the content resolver to use
7304 * @param provider the location provider to query
7305 * @return true if the provider is enabled
7307 * @deprecated use {@link #LOCATION_MODE} or
7308 * {@link LocationManager#isProviderEnabled(String)}
7311 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
7312 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
7316 * Helper method for determining if a location provider is enabled.
7317 * @param cr the content resolver to use
7318 * @param provider the location provider to query
7319 * @param userId the userId to query
7320 * @return true if the provider is enabled
7321 * @deprecated use {@link #LOCATION_MODE} or
7322 * {@link LocationManager#isProviderEnabled(String)}
7326 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
7327 String allowedProviders = Settings.Secure.getStringForUser(cr,
7328 LOCATION_PROVIDERS_ALLOWED, userId);
7329 return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
7333 * Thread-safe method for enabling or disabling a single location provider.
7334 * @param cr the content resolver to use
7335 * @param provider the location provider to enable or disable
7336 * @param enabled true if the provider should be enabled
7337 * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
7340 public static final void setLocationProviderEnabled(ContentResolver cr,
7341 String provider, boolean enabled) {
7342 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
7346 * Thread-safe method for enabling or disabling a single location provider.
7348 * @param cr the content resolver to use
7349 * @param provider the location provider to enable or disable
7350 * @param enabled true if the provider should be enabled
7351 * @param userId the userId for which to enable/disable providers
7352 * @return true if the value was set, false on database errors
7353 * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
7354 * {@link #LOCATION_MODE}
7358 public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
7359 String provider, boolean enabled, int userId) {
7360 synchronized (mLocationSettingsLock) {
7361 // to ensure thread safety, we write the provider name with a '+' or '-'
7362 // and let the SettingsProvider handle it rather than reading and modifying
7363 // the list of enabled providers.
7365 provider = "+" + provider;
7367 provider = "-" + provider;
7369 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
7375 * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
7377 private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
7378 final int mode = getLocationModeForUser(cr, userId);
7379 return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
7383 * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
7385 private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
7386 int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
7387 LOCATION_MODE_HIGH_ACCURACY, userId);
7388 // Make sure that the previous mode is never "off". Otherwise the user won't be able to
7389 // turn on location any longer.
7390 if (mode == LOCATION_MODE_OFF) {
7391 mode = LOCATION_MODE_HIGH_ACCURACY;
7393 return setLocationModeForUser(cr, mode, userId);
7397 * Thread-safe method for setting the location mode to one of
7398 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
7399 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
7400 * Necessary because the mode is a composite of the underlying location provider
7403 * @param cr the content resolver to use
7404 * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
7405 * @param userId the userId for which to change mode
7406 * @return true if the value was set, false on database errors
7408 * @throws IllegalArgumentException if mode is not one of the supported values
7410 private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
7412 synchronized (mLocationSettingsLock) {
7413 boolean gps = false;
7414 boolean network = false;
7416 case LOCATION_MODE_PREVIOUS:
7417 // Retrieve the actual mode and set to that mode.
7418 return restoreLocationModeForUser(cr, userId);
7419 case LOCATION_MODE_OFF:
7420 saveLocationModeForUser(cr, userId);
7422 case LOCATION_MODE_SENSORS_ONLY:
7425 case LOCATION_MODE_BATTERY_SAVING:
7428 case LOCATION_MODE_HIGH_ACCURACY:
7433 throw new IllegalArgumentException("Invalid location mode: " + mode);
7435 // Note it's important that we set the NLP mode first. The Google implementation
7436 // of NLP clears its NLP consent setting any time it receives a
7437 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
7438 // it shows an NLP consent dialog any time it receives the broadcast, NLP is
7439 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
7440 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
7441 // and 3) the receiver happened to complete before we enabled NLP, then the Google
7442 // NLP would detect the attempt to enable NLP and show a redundant NLP consent
7443 // dialog. Then the people who wrote the setup wizard would be sad.
7444 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
7445 cr, LocationManager.NETWORK_PROVIDER, network, userId);
7446 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
7447 cr, LocationManager.GPS_PROVIDER, gps, userId);
7448 return gpsSuccess && nlpSuccess;
7453 * Thread-safe method for reading the location mode, returns one of
7454 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
7455 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary
7456 * because the mode is a composite of the underlying location provider settings.
7458 * @param cr the content resolver to use
7459 * @param userId the userId for which to read the mode
7460 * @return the location mode
7462 private static final int getLocationModeForUser(ContentResolver cr, int userId) {
7463 synchronized (mLocationSettingsLock) {
7464 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
7465 cr, LocationManager.GPS_PROVIDER, userId);
7466 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
7467 cr, LocationManager.NETWORK_PROVIDER, userId);
7468 if (gpsEnabled && networkEnabled) {
7469 return LOCATION_MODE_HIGH_ACCURACY;
7470 } else if (gpsEnabled) {
7471 return LOCATION_MODE_SENSORS_ONLY;
7472 } else if (networkEnabled) {
7473 return LOCATION_MODE_BATTERY_SAVING;
7475 return LOCATION_MODE_OFF;
7482 * Global system settings, containing preferences that always apply identically
7483 * to all defined users. Applications can read these but are not allowed to write;
7484 * like the "Secure" settings, these are for preferences that the user must
7485 * explicitly modify through the system UI or specialized APIs for those values.
7487 public static final class Global extends NameValueTable {
7489 * The content:// style URL for global secure settings items. Not public.
7491 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
7494 * Whether users are allowed to add more users or guest from lockscreen.
7499 public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
7502 * Setting whether the global gesture for enabling accessibility is enabled.
7503 * If this gesture is enabled the user will be able to perfrom it to enable
7504 * the accessibility state without visiting the settings app.
7507 * No longer used. Should be removed once all dependencies have been updated.
7509 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
7510 "enable_accessibility_global_gesture_enabled";
7513 * Whether Airplane Mode is on.
7515 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
7518 * Whether Theater Mode is on.
7522 public static final String THEATER_MODE_ON = "theater_mode_on";
7525 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
7527 public static final String RADIO_BLUETOOTH = "bluetooth";
7530 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
7532 public static final String RADIO_WIFI = "wifi";
7537 public static final String RADIO_WIMAX = "wimax";
7539 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
7541 public static final String RADIO_CELL = "cell";
7544 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
7546 public static final String RADIO_NFC = "nfc";
7549 * A comma separated list of radios that need to be disabled when airplane mode
7550 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
7551 * included in the comma separated list.
7553 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
7556 * A comma separated list of radios that should to be disabled when airplane mode
7557 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
7558 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
7559 * will be turned off when entering airplane mode, but the user will be able to reenable
7560 * Wifi in the Settings app.
7564 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
7567 * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
7568 * See {@link android.bluetooth.BluetoothProfile}.
7571 public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
7574 * A semi-colon separated list of Bluetooth interoperability workarounds.
7575 * Each entry is a partial Bluetooth device address string and an integer representing
7576 * the feature to be disabled, separated by a comma. The integer must correspond
7577 * to a interoperability feature as defined in "interop.h" in /system/bt.
7580 * "00:11:22,0;01:02:03:04,2"
7583 public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list";
7586 * The policy for deciding when Wi-Fi should go to sleep (which will in
7587 * turn switch to using the mobile data as an Internet connection).
7589 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
7590 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
7591 * {@link #WIFI_SLEEP_POLICY_NEVER}.
7593 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
7596 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
7597 * policy, which is to sleep shortly after the turning off
7598 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
7600 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
7603 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
7604 * the device is on battery, and never go to sleep when the device is
7607 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
7610 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
7612 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
7615 * Value to specify if the user prefers the date, time and time zone
7616 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
7618 public static final String AUTO_TIME = "auto_time";
7621 * Value to specify if the user prefers the time zone
7622 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
7624 public static final String AUTO_TIME_ZONE = "auto_time_zone";
7627 * URI for the car dock "in" event sound.
7630 public static final String CAR_DOCK_SOUND = "car_dock_sound";
7633 * URI for the car dock "out" event sound.
7636 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
7639 * URI for the desk dock "in" event sound.
7642 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
7645 * URI for the desk dock "out" event sound.
7648 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
7651 * Whether to play a sound for dock events.
7654 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
7657 * Whether to play a sound for dock events, only when an accessibility service is on.
7660 public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility";
7663 * URI for the "device locked" (keyguard shown) sound.
7666 public static final String LOCK_SOUND = "lock_sound";
7669 * URI for the "device unlocked" sound.
7672 public static final String UNLOCK_SOUND = "unlock_sound";
7675 * URI for the "device is trusted" sound, which is played when the device enters the trusted
7676 * state without unlocking.
7679 public static final String TRUSTED_SOUND = "trusted_sound";
7682 * URI for the low battery sound file.
7685 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
7688 * Whether to play a sound for low-battery alerts.
7691 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
7694 * URI for the "wireless charging started" sound.
7697 public static final String WIRELESS_CHARGING_STARTED_SOUND =
7698 "wireless_charging_started_sound";
7701 * Whether to play a sound for charging events.
7704 public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
7707 * Whether we keep the device on while the device is plugged in.
7708 * Supported values are:
7710 * <li>{@code 0} to never stay on while plugged in</li>
7711 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
7712 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
7713 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
7715 * These values can be OR-ed together.
7717 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
7720 * When the user has enable the option to have a "bug report" command
7721 * in the power menu.
7724 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
7727 * Whether ADB is enabled.
7729 public static final String ADB_ENABLED = "adb_enabled";
7732 * Whether Views are allowed to save their attribute data.
7735 public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
7738 * Whether assisted GPS should be enabled or not.
7741 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
7744 * Whether bluetooth is enabled/disabled
7745 * 0=disabled. 1=enabled.
7747 public static final String BLUETOOTH_ON = "bluetooth_on";
7750 * CDMA Cell Broadcast SMS
7751 * 0 = CDMA Cell Broadcast SMS disabled
7752 * 1 = CDMA Cell Broadcast SMS enabled
7755 public static final String CDMA_CELL_BROADCAST_SMS =
7756 "cdma_cell_broadcast_sms";
7759 * The CDMA roaming mode 0 = Home Networks, CDMA default
7760 * 1 = Roaming on Affiliated networks
7761 * 2 = Roaming on any networks
7764 public static final String CDMA_ROAMING_MODE = "roaming_settings";
7767 * The CDMA subscription mode 0 = RUIM/SIM (default)
7771 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
7774 * The default value for whether background data is enabled or not.
7776 * Used by {@code NetworkPolicyManagerService}.
7780 public static final String DEFAULT_RESTRICT_BACKGROUND_DATA =
7781 "default_restrict_background_data";
7783 /** Inactivity timeout to track mobile data activity.
7785 * If set to a positive integer, it indicates the inactivity timeout value in seconds to
7786 * infer the data activity of mobile network. After a period of no activity on mobile
7787 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
7788 * intent is fired to indicate a transition of network status from "active" to "idle". Any
7789 * subsequent activity on mobile networks triggers the firing of {@code
7790 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
7792 * Network activity refers to transmitting or receiving data on the network interfaces.
7794 * Tracking is disabled if set to zero or negative value.
7798 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
7800 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
7801 * but for Wifi network.
7804 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
7807 * Whether or not data roaming is enabled. (0 = false, 1 = true)
7809 public static final String DATA_ROAMING = "data_roaming";
7812 * The value passed to a Mobile DataConnection via bringUp which defines the
7813 * number of retries to preform when setting up the initial connection. The default
7814 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
7817 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
7820 * Whether any package can be on external storage. When this is true, any
7821 * package, regardless of manifest values, is a candidate for installing
7822 * or moving onto external storage. (0 = false, 1 = true)
7825 public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
7828 * The default SM-DP+ configured for this device.
7830 * <p>An SM-DP+ is used by an LPA (see {@link android.service.euicc.EuiccService}) to
7831 * download profiles. If this value is set, the LPA will query this server for any profiles
7832 * available to this device. If any are available, they may be downloaded during device
7833 * provisioning or in settings without needing the user to enter an activation code.
7835 * @see android.service.euicc.EuiccService
7838 * TODO(b/35851809): Make this a SystemApi.
7840 public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
7843 * Whether any profile has ever been downloaded onto a eUICC on the device.
7845 * <p>Used to hide eUICC UI from users who have never made use of it and would only be
7846 * confused by seeing references to it in settings.
7847 * (0 = false, 1 = true)
7850 public static final String EUICC_PROVISIONED = "euicc_provisioned";
7853 * Whether any activity can be resized. When this is true, any
7854 * activity, regardless of manifest values, can be resized for multi-window.
7855 * (0 = false, 1 = true)
7858 public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
7859 = "force_resizable_activities";
7862 * Whether to enable experimental freeform support for windows.
7865 public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
7866 = "enable_freeform_support";
7869 * Whether user has enabled development settings.
7871 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
7874 * Whether the device has been provisioned (0 = false, 1 = true).
7875 * <p>On a multiuser device with a separate system user, the screen may be locked
7876 * as soon as this is set to true and further activities cannot be launched on the
7877 * system user unless they are marked to show over keyguard.
7879 public static final String DEVICE_PROVISIONED = "device_provisioned";
7882 * Whether mobile data should be allowed while the device is being provisioned.
7883 * This allows the provisioning process to turn off mobile data before the user
7884 * has an opportunity to set things up, preventing other processes from burning
7885 * precious bytes before wifi is setup.
7886 * (0 = false, 1 = true)
7889 public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED =
7890 "device_provisioning_mobile_data";
7893 * The saved value for WindowManagerService.setForcedDisplaySize().
7894 * Two integers separated by a comma. If unset, then use the real display size.
7897 public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
7900 * The saved value for WindowManagerService.setForcedDisplayScalingMode().
7901 * 0 or unset if scaling is automatic, 1 if scaling is disabled.
7904 public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
7907 * The maximum size, in bytes, of a download that the download manager will transfer over
7908 * a non-wifi connection.
7911 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
7912 "download_manager_max_bytes_over_mobile";
7915 * The recommended maximum size, in bytes, of a download that the download manager should
7916 * transfer over a non-wifi connection. Over this size, the use will be warned, but will
7917 * have the option to start the download over the mobile connection anyway.
7920 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
7921 "download_manager_recommended_max_bytes_over_mobile";
7924 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
7927 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
7930 * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
7931 * sent or processed. (0 = false, 1 = true)
7934 public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
7937 * Whether HDMI System Audio Control feature is enabled. If enabled, TV will try to turn on
7938 * system audio mode if there's a connected CEC-enabled AV Receiver. Then audio stream will
7939 * be played on AVR instead of TV spaeker. If disabled, the system audio mode will never be
7943 public static final String HDMI_SYSTEM_AUDIO_CONTROL_ENABLED =
7944 "hdmi_system_audio_control_enabled";
7947 * Whether TV will automatically turn on upon reception of the CEC command
7948 * <Text View On> or <Image View On>. (0 = false, 1 = true)
7951 public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
7952 "hdmi_control_auto_wakeup_enabled";
7955 * Whether TV will also turn off other CEC devices when it goes to standby mode.
7956 * (0 = false, 1 = true)
7959 public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
7960 "hdmi_control_auto_device_off_enabled";
7963 * The interval in milliseconds at which location requests will be throttled when they are
7964 * coming from the background.
7967 public static final String LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS =
7968 "location_background_throttle_interval_ms";
7971 * Most frequent location update interval in milliseconds that proximity alert is allowed
7975 public static final String LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS =
7976 "location_background_throttle_proximity_alert_interval_ms";
7979 * Packages that are whitelisted for background throttling (throttling will not be applied).
7982 public static final String LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
7983 "location_background_throttle_package_whitelist";
7986 * The interval in milliseconds at which wifi scan requests will be throttled when they are
7987 * coming from the background.
7990 public static final String WIFI_SCAN_BACKGROUND_THROTTLE_INTERVAL_MS =
7991 "wifi_scan_background_throttle_interval_ms";
7994 * Packages that are whitelisted to be exempt for wifi background throttling.
7997 public static final String WIFI_SCAN_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
7998 "wifi_scan_background_throttle_package_whitelist";
8001 * Whether TV will switch to MHL port when a mobile device is plugged in.
8002 * (0 = false, 1 = true)
8005 public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
8008 * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
8011 public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
8014 * Whether mobile data connections are allowed by the user. See
8015 * ConnectivityManager for more info.
8018 public static final String MOBILE_DATA = "mobile_data";
8021 * Whether the mobile data connection should remain active even when higher
8022 * priority networks like WiFi are active, to help make network switching faster.
8024 * See ConnectivityService for more info.
8026 * (0 = disabled, 1 = enabled)
8029 public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
8032 * Size of the event buffer for IP connectivity metrics.
8035 public static final String CONNECTIVITY_METRICS_BUFFER_SIZE =
8036 "connectivity_metrics_buffer_size";
8039 public static final String NETSTATS_ENABLED = "netstats_enabled";
8041 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
8043 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
8045 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
8047 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
8049 public static final String NETSTATS_AUGMENT_ENABLED = "netstats_augment_enabled";
8052 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
8054 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
8056 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
8058 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
8061 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
8063 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
8065 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
8067 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
8070 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
8072 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
8074 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
8076 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
8079 * User preference for which network(s) should be used. Only the
8080 * connectivity service should touch this.
8082 public static final String NETWORK_PREFERENCE = "network_preference";
8085 * Which package name to use for network scoring. If null, or if the package is not a valid
8086 * scorer app, external network scores will neither be requested nor accepted.
8089 public static final String NETWORK_SCORER_APP = "network_scorer_app";
8092 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
8093 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
8097 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
8100 * The length of time in milli-seconds that automatic small adjustments to
8101 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
8104 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
8106 /** Preferred NTP server. {@hide} */
8107 public static final String NTP_SERVER = "ntp_server";
8108 /** Timeout in milliseconds to wait for NTP server. {@hide} */
8109 public static final String NTP_TIMEOUT = "ntp_timeout";
8112 public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
8115 * Sample validity in seconds to configure for the system DNS resolver.
8118 public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS =
8119 "dns_resolver_sample_validity_seconds";
8122 * Success threshold in percent for use with the system DNS resolver.
8125 public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT =
8126 "dns_resolver_success_threshold_percent";
8129 * Minimum number of samples needed for statistics to be considered meaningful in the
8130 * system DNS resolver.
8133 public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples";
8136 * Maximum number taken into account for statistics purposes in the system DNS resolver.
8139 public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples";
8142 * Whether to disable the automatic scheduling of system updates.
8143 * 1 = system updates won't be automatically scheduled (will always
8144 * present notification instead).
8145 * 0 = system updates will be automatically scheduled. (default)
8149 public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
8152 * Whether the package manager should send package verification broadcasts for verifiers to
8153 * review apps prior to installation.
8154 * 1 = request apps to be verified prior to installation, if a verifier exists.
8155 * 0 = do not verify apps before installation
8158 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
8160 /** Timeout for package verification.
8162 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
8164 /** Default response code for package verification.
8166 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
8169 * Show package verification setting in the Settings app.
8170 * 1 = show (default)
8174 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
8177 * Run package verification on apps installed through ADB/ADT/USB
8178 * 1 = perform package verification on ADB installs (default)
8179 * 0 = bypass package verification on ADB installs
8182 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
8185 * Time since last fstrim (milliseconds) after which we force one to happen
8186 * during device startup. If unset, the default is 3 days.
8189 public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
8192 * The interval in milliseconds at which to check packet counts on the
8193 * mobile data interface when screen is on, to detect possible data
8194 * connection problems.
8197 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
8198 "pdp_watchdog_poll_interval_ms";
8201 * The interval in milliseconds at which to check packet counts on the
8202 * mobile data interface when screen is off, to detect possible data
8203 * connection problems.
8206 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
8207 "pdp_watchdog_long_poll_interval_ms";
8210 * The interval in milliseconds at which to check packet counts on the
8211 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
8212 * outgoing packets has been reached without incoming packets.
8215 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
8216 "pdp_watchdog_error_poll_interval_ms";
8219 * The number of outgoing packets sent without seeing an incoming packet
8220 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
8221 * device is logged to the event log
8224 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
8225 "pdp_watchdog_trigger_packet_count";
8228 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
8229 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
8230 * attempting data connection recovery.
8233 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
8234 "pdp_watchdog_error_poll_count";
8237 * The number of failed PDP reset attempts before moving to something more
8238 * drastic: re-registering to the network.
8241 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
8242 "pdp_watchdog_max_pdp_reset_fail_count";
8245 * A positive value indicates how often the SamplingProfiler
8246 * should take snapshots. Zero value means SamplingProfiler
8251 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
8254 * URL to open browser on to allow user to manage a prepay account
8257 public static final String SETUP_PREPAID_DATA_SERVICE_URL =
8258 "setup_prepaid_data_service_url";
8261 * URL to attempt a GET on to see if this is a prepay device
8264 public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
8265 "setup_prepaid_detection_target_url";
8268 * Host to check for a redirect to after an attempt to GET
8269 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
8270 * this is a prepaid device with zero balance.)
8273 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
8274 "setup_prepaid_detection_redir_host";
8277 * The interval in milliseconds at which to check the number of SMS sent out without asking
8278 * for use permit, to limit the un-authorized SMS usage.
8282 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
8283 "sms_outgoing_check_interval_ms";
8286 * The number of outgoing SMS sent without asking for user permit (of {@link
8287 * #SMS_OUTGOING_CHECK_INTERVAL_MS}
8291 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
8292 "sms_outgoing_check_max_count";
8295 * Used to disable SMS short code confirmation - defaults to true.
8296 * True indcates we will do the check, etc. Set to false to disable.
8297 * @see com.android.internal.telephony.SmsUsageMonitor
8300 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
8303 * Used to select which country we use to determine premium sms codes.
8304 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
8305 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
8306 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
8309 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
8312 * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
8315 public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
8318 * Used to disable Tethering on a device - defaults to true
8321 public static final String TETHER_SUPPORTED = "tether_supported";
8324 * Used to require DUN APN on the device or not - defaults to a build config value
8325 * which defaults to false
8328 public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
8331 * Used to hold a gservices-provisioned apn value for DUN. If set, or the
8332 * corresponding build config values are set it will override the APN DB
8334 * Consists of a comma seperated list of strings:
8335 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
8336 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
8339 public static final String TETHER_DUN_APN = "tether_dun_apn";
8342 * Used to disable trying to talk to any available tethering offload HAL.
8344 * Integer values are interpreted as boolean, and the absence of an explicit setting
8345 * is interpreted as |false|.
8348 public static final String TETHER_OFFLOAD_DISABLED = "tether_offload_disabled";
8351 * List of carrier apps which are whitelisted to prompt the user for install when
8352 * a sim card with matching uicc carrier privilege rules is inserted.
8354 * The value is "package1;package2;..."
8357 public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
8360 * USB Mass Storage Enabled
8362 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
8365 * If this setting is set (to anything), then all references
8366 * to Gmail on the device must change to Google Mail.
8368 public static final String USE_GOOGLE_MAIL = "use_google_mail";
8371 * Webview Data reduction proxy key.
8374 public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
8375 "webview_data_reduction_proxy_key";
8378 * Whether or not the WebView fallback mechanism should be enabled.
8379 * 0=disabled, 1=enabled.
8382 public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED =
8383 "webview_fallback_logic_enabled";
8386 * Name of the package used as WebView provider (if unset the provider is instead determined
8390 public static final String WEBVIEW_PROVIDER = "webview_provider";
8393 * Developer setting to enable WebView multiprocess rendering.
8397 public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
8400 * The maximum number of notifications shown in 24 hours when switching networks.
8403 public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT =
8404 "network_switch_notification_daily_limit";
8407 * The minimum time in milliseconds between notifications when switching networks.
8410 public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS =
8411 "network_switch_notification_rate_limit_millis";
8414 * Whether to automatically switch away from wifi networks that lose Internet access.
8415 * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always
8416 * avoids such networks. Valid values are:
8418 * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013.
8419 * null: Ask the user whether to switch away from bad wifi.
8420 * 1: Avoid bad wifi.
8424 public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi";
8427 * User setting for ConnectivityManager.getMeteredMultipathPreference(). This value may be
8428 * overridden by the system based on device or application state. If null, the value
8429 * specified by config_networkMeteredMultipathPreference is used.
8433 public static final String NETWORK_METERED_MULTIPATH_PREFERENCE =
8434 "network_metered_multipath_preference";
8437 * The thresholds of the wifi throughput badging (SD, HD etc.) as a comma-delimited list of
8438 * colon-delimited key-value pairs. The key is the badging enum value defined in
8439 * android.net.ScoredNetwork and the value is the minimum sustained network throughput in
8440 * kbps required for the badge. For example: "10:3000,20:5000,30:25000"
8445 public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
8448 * Whether Wifi display is enabled/disabled
8449 * 0=disabled. 1=enabled.
8452 public static final String WIFI_DISPLAY_ON = "wifi_display_on";
8455 * Whether Wifi display certification mode is enabled/disabled
8456 * 0=disabled. 1=enabled.
8459 public static final String WIFI_DISPLAY_CERTIFICATION_ON =
8460 "wifi_display_certification_on";
8463 * WPS Configuration method used by Wifi display, this setting only
8464 * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
8466 * Possible values are:
8468 * WpsInfo.INVALID: use default WPS method chosen by framework
8469 * WpsInfo.PBC : use Push button
8470 * WpsInfo.KEYPAD : use Keypad
8471 * WpsInfo.DISPLAY: use Display
8474 public static final String WIFI_DISPLAY_WPS_CONFIG =
8475 "wifi_display_wps_config";
8478 * Whether to notify the user of open networks.
8480 * If not connected and the scan results have an open network, we will
8481 * put this notification up. If we attempt to connect to a network or
8482 * the open network(s) disappear, we remove the notification. When we
8483 * show the notification, we will not show it again for
8484 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
8486 * @deprecated This feature is no longer controlled by this setting in
8487 * {@link android.os.Build.VERSION_CODES#O}.
8490 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
8491 "wifi_networks_available_notification_on";
8496 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
8497 "wimax_networks_available_notification_on";
8500 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
8501 * Connecting to a network will reset the timer.
8503 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
8504 "wifi_networks_available_repeat_delay";
8507 * 802.11 country code in ISO 3166 format
8510 public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
8513 * The interval in milliseconds to issue wake up scans when wifi needs
8514 * to connect. This is necessary to connect to an access point when
8515 * device is on the move and the screen is off.
8518 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
8519 "wifi_framework_scan_interval_ms";
8522 * The interval in milliseconds after which Wi-Fi is considered idle.
8523 * When idle, it is possible for the device to be switched from Wi-Fi to
8524 * the mobile data network.
8527 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
8530 * When the number of open networks exceeds this number, the
8531 * least-recently-used excess networks will be removed.
8533 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
8536 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
8538 public static final String WIFI_ON = "wifi_on";
8541 * Setting to allow scans to be enabled even wifi is turned off for connectivity.
8544 public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
8545 "wifi_scan_always_enabled";
8548 * Value to specify if Wi-Fi Wakeup feature is enabled.
8550 * Type: int (0 for false, 1 for true)
8554 public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
8557 * Value to specify if Wi-Fi Wakeup is available.
8559 * Wi-Fi Wakeup will only operate if it's available
8560 * and {@link #WIFI_WAKEUP_ENABLED} is true.
8562 * Type: int (0 for false, 1 for true)
8565 public static final String WIFI_WAKEUP_AVAILABLE = "wifi_wakeup_available";
8568 * Value to specify whether network quality scores and badging should be shown in the UI.
8570 * Type: int (0 for false, 1 for true)
8573 public static final String NETWORK_SCORING_UI_ENABLED = "network_scoring_ui_enabled";
8576 * Value to specify how long in milliseconds to retain seen score cache curves to be used
8577 * when generating SSID only bases score curves.
8582 public static final String SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS =
8583 "speed_label_cache_eviction_age_millis";
8586 * Value to specify if network recommendations from
8587 * {@link com.android.server.NetworkScoreService} are enabled.
8595 * Most readers of this setting should simply check if value == 1 to determined the
8599 public static final String NETWORK_RECOMMENDATIONS_ENABLED =
8600 "network_recommendations_enabled";
8603 * Which package name to use for network recommendations. If null, network recommendations
8604 * will neither be requested nor accepted.
8606 * Use {@link NetworkScoreManager#getActiveScorerPackage()} to read this value and
8607 * {@link NetworkScoreManager#setActiveScorer(String)} to write it.
8609 * Type: string - package name
8612 public static final String NETWORK_RECOMMENDATIONS_PACKAGE =
8613 "network_recommendations_package";
8616 * The package name of the application that connect and secures high quality open wifi
8617 * networks automatically.
8619 * Type: string package name or null if the feature is either not provided or disabled.
8622 public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
8625 * The number of milliseconds the {@link com.android.server.NetworkScoreService}
8626 * will give a recommendation request to complete before returning a default response.
8630 * @deprecated to be removed
8632 public static final String NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS =
8633 "network_recommendation_request_timeout_ms";
8636 * The expiration time in milliseconds for the {@link android.net.WifiKey} request cache in
8637 * {@link com.android.server.wifi.RecommendedNetworkEvaluator}.
8642 public static final String RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS =
8643 "recommended_network_evaluator_cache_expiry_ms";
8646 * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
8650 public static final String BLE_SCAN_ALWAYS_AVAILABLE =
8651 "ble_scan_always_enabled";
8654 * Used to save the Wifi_ON state prior to tethering.
8655 * This state will be checked to restore Wifi after
8656 * the user turns off tethering.
8660 public static final String WIFI_SAVED_STATE = "wifi_saved_state";
8663 * The interval in milliseconds to scan as used by the wifi supplicant
8666 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
8667 "wifi_supplicant_scan_interval_ms";
8670 * whether frameworks handles wifi auto-join
8673 public static final String WIFI_ENHANCED_AUTO_JOIN =
8674 "wifi_enhanced_auto_join";
8677 * whether settings show RSSI
8680 public static final String WIFI_NETWORK_SHOW_RSSI =
8681 "wifi_network_show_rssi";
8684 * The interval in milliseconds to scan at supplicant when p2p is connected
8687 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
8688 "wifi_scan_interval_p2p_connected_ms";
8691 * Whether the Wi-Fi watchdog is enabled.
8693 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
8696 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
8697 * the setting needs to be set to 0 to disable it.
8700 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
8701 "wifi_watchdog_poor_network_test_enabled";
8704 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
8705 * needs to be set to 0 to disable it.
8708 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
8709 "wifi_suspend_optimizations_enabled";
8712 * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
8713 * will enable it. In the future, additional values may be supported.
8716 public static final String WIFI_VERBOSE_LOGGING_ENABLED =
8717 "wifi_verbose_logging_enabled";
8720 * The maximum number of times we will retry a connection to an access
8721 * point for which we have failed in acquiring an IP address from DHCP.
8722 * A value of N means that we will make N+1 connection attempts in all.
8724 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
8727 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
8728 * data connectivity to be established after a disconnect from Wi-Fi.
8730 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
8731 "wifi_mobile_data_transition_wakelock_timeout_ms";
8734 * This setting controls whether WiFi configurations created by a Device Owner app
8735 * should be locked down (that is, be editable or removable only by the Device Owner App,
8736 * not even by Settings app).
8737 * This setting takes integer values. Non-zero values mean DO created configurations
8738 * are locked down. Value of zero means they are not. Default value in the absence of
8739 * actual value to this setting is 0.
8741 public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
8742 "wifi_device_owner_configs_lockdown";
8745 * The operational wifi frequency band
8746 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
8747 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
8748 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
8752 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
8755 * The Wi-Fi peer-to-peer device name
8758 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
8761 * The min time between wifi disable and wifi enable
8764 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
8767 * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
8768 * from an ephemeral network if there is no BSSID for that network with a non-null score that
8769 * has been seen in this time period.
8771 * If this is less than or equal to zero, we use a more conservative behavior and only check
8772 * for a non-null score from the currently connected or target BSSID.
8775 public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
8776 "wifi_ephemeral_out_of_range_timeout_ms";
8779 * The number of milliseconds to delay when checking for data stalls during
8780 * non-aggressive detection. (screen is turned off.)
8783 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
8784 "data_stall_alarm_non_aggressive_delay_in_ms";
8787 * The number of milliseconds to delay when checking for data stalls during
8788 * aggressive detection. (screen on or suspected data stall)
8791 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
8792 "data_stall_alarm_aggressive_delay_in_ms";
8795 * The number of milliseconds to allow the provisioning apn to remain active
8798 public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
8799 "provisioning_apn_alarm_delay_in_ms";
8802 * The interval in milliseconds at which to check gprs registration
8803 * after the first registration mismatch of gprs and voice service,
8804 * to detect possible data network registration problems.
8808 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
8809 "gprs_register_check_period_ms";
8812 * Nonzero causes Log.wtf() to crash.
8815 public static final String WTF_IS_FATAL = "wtf_is_fatal";
8818 * Ringer mode. This is used internally, changing this value will not
8819 * change the ringer mode. See AudioManager.
8821 public static final String MODE_RINGER = "mode_ringer";
8824 * Overlay display devices setting.
8825 * The associated value is a specially formatted string that describes the
8826 * size and density of simulated secondary display devices.
8828 * Format: {width}x{height}/{dpi};...
8832 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
8833 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
8834 * at 1080p and the second at 720p.</li>
8835 * <li>If the value is empty, then no overlay display devices are created.</li>
8840 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
8843 * Threshold values for the duration and level of a discharge cycle,
8844 * under which we log discharge cycle info.
8848 public static final String
8849 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
8852 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
8855 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
8856 * intents on application crashes and ANRs. If this is disabled, the
8857 * crash/ANR dialog will never display the "Report" button.
8859 * Type: int (0 = disallow, 1 = allow)
8863 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
8866 * Maximum age of entries kept by {@link DropBoxManager}.
8870 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
8873 * Maximum number of entry files which {@link DropBoxManager} will keep
8878 public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
8881 * Maximum amount of disk space used by {@link DropBoxManager} no matter
8886 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
8889 * Percent of free disk (excluding reserve) which {@link DropBoxManager}
8894 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
8897 * Percent of total disk which {@link DropBoxManager} will never dip
8902 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
8905 * Prefix for per-tag dropbox disable/enable settings.
8909 public static final String DROPBOX_TAG_PREFIX = "dropbox:";
8912 * Lines of logcat to include with system crash/ANR/etc. reports, as a
8913 * prefix of the dropbox tag of the report type. For example,
8914 * "logcat_for_system_server_anr" controls the lines of logcat captured
8915 * with system server ANR reports. 0 to disable.
8919 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
8922 * The interval in minutes after which the amount of free storage left
8923 * on the device is logged to the event log
8927 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
8930 * Threshold for the amount of change in disk free space required to
8931 * report the amount of free space. Used to prevent spamming the logs
8932 * when the disk free space isn't changing frequently.
8936 public static final String
8937 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
8940 * Minimum percentage of free storage on the device that is used to
8941 * determine if the device is running low on storage. The default is 10.
8943 * Say this value is set to 10, the device is considered running low on
8944 * storage if 90% or more of the device storage is filled up.
8948 public static final String
8949 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
8952 * Maximum byte size of the low storage threshold. This is to ensure
8953 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
8954 * overly large threshold for large storage devices. Currently this must
8955 * be less than 2GB. This default is 500MB.
8959 public static final String
8960 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
8963 * Minimum bytes of free storage on the device before the data partition
8964 * is considered full. By default, 1 MB is reserved to avoid system-wide
8965 * SQLite disk full exceptions.
8969 public static final String
8970 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
8973 * Minimum percentage of storage on the device that is reserved for
8978 public static final String
8979 SYS_STORAGE_CACHE_PERCENTAGE = "sys_storage_cache_percentage";
8982 * Maximum bytes of storage on the device that is reserved for cached
8987 public static final String
8988 SYS_STORAGE_CACHE_MAX_BYTES = "sys_storage_cache_max_bytes";
8991 * The maximum reconnect delay for short network outages or when the
8992 * network is suspended due to phone use.
8996 public static final String
8997 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
9000 * The number of milliseconds to delay before sending out
9001 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
9005 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
9009 * Network sampling interval, in seconds. We'll generate link information
9010 * about bytes/packets sent and error rates based on data sampled in this interval
9015 public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
9016 "connectivity_sampling_interval_in_seconds";
9019 * The series of successively longer delays used in retrying to download PAC file.
9020 * Last delay is used between successful PAC downloads.
9024 public static final String PAC_CHANGE_DELAY = "pac_change_delay";
9027 * Don't attempt to detect captive portals.
9031 public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0;
9034 * When detecting a captive portal, display a notification that
9035 * prompts the user to sign in.
9039 public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1;
9042 * When detecting a captive portal, immediately disconnect from the
9043 * network and do not reconnect to that network in the future.
9047 public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
9050 * What to do when connecting a network that presents a captive portal.
9051 * Must be one of the CAPTIVE_PORTAL_MODE_* constants above.
9053 * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT.
9056 public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode";
9059 * Setting to turn off captive portal detection. Feature is enabled by
9060 * default and the setting needs to be set to 0 to disable it.
9062 * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection
9066 public static final String
9067 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
9070 * The server used for captive portal detection upon a new conection. A
9071 * 204 response code from the server is used for validation.
9072 * TODO: remove this deprecated symbol.
9076 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
9079 * The URL used for HTTPS captive portal detection upon a new connection.
9080 * A 204 response code from the server is used for validation.
9084 public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url";
9087 * The URL used for HTTP captive portal detection upon a new connection.
9088 * A 204 response code from the server is used for validation.
9092 public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url";
9095 * The URL used for fallback HTTP captive portal detection when previous HTTP
9096 * and HTTPS captive portal detection attemps did not return a conclusive answer.
9100 public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
9103 * A comma separated list of URLs used for captive portal detection in addition to the
9104 * fallback HTTP url associated with the CAPTIVE_PORTAL_FALLBACK_URL settings.
9108 public static final String CAPTIVE_PORTAL_OTHER_FALLBACK_URLS =
9109 "captive_portal_other_fallback_urls";
9112 * Whether to use HTTPS for network validation. This is enabled by default and the setting
9113 * needs to be set to 0 to disable it. This setting is a misnomer because captive portals
9114 * don't actually use HTTPS, but it's consistent with the other settings.
9118 public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
9121 * Which User-Agent string to use in the header of the captive portal detection probes.
9122 * The User-Agent field is unset when this setting has no value (HttpUrlConnection default).
9126 public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent";
9129 * Whether network service discovery is enabled.
9133 public static final String NSD_ON = "nsd_on";
9136 * Let user pick default install location.
9140 public static final String SET_INSTALL_LOCATION = "set_install_location";
9143 * Default install location value.
9144 * 0 = auto, let system decide
9149 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
9152 * ms during which to consume extra events related to Inet connection
9153 * condition after a transtion to fully-connected
9157 public static final String
9158 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
9161 * ms during which to consume extra events related to Inet connection
9162 * condtion after a transtion to partly-connected
9166 public static final String
9167 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
9170 public static final String
9171 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
9174 * Host name and port for global http proxy. Uses ':' seperator for
9175 * between host and port.
9177 public static final String HTTP_PROXY = "http_proxy";
9180 * Host name for global http proxy. Set via ConnectivityManager.
9184 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
9187 * Integer host port for global http proxy. Set via ConnectivityManager.
9191 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
9194 * Exclusion list for global proxy. This string contains a list of
9195 * comma-separated domains where the global proxy does not apply.
9196 * Domains should be listed in a comma- separated list. Example of
9197 * acceptable formats: ".domain1.com,my.domain2.com" Use
9198 * ConnectivityManager to set/get.
9202 public static final String
9203 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
9206 * The location PAC File for the proxy.
9209 public static final String
9210 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
9213 * Enables the UI setting to allow the user to specify the global HTTP
9214 * proxy and associated exclusion list.
9218 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
9221 * Setting for default DNS in case nobody suggests one
9225 public static final String DEFAULT_DNS_SERVER = "default_dns_server";
9228 public static final String
9229 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
9231 public static final String
9232 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
9234 public static final String
9235 BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
9237 public static final String BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX =
9238 "bluetooth_a2dp_supports_optional_codecs_";
9240 public static final String BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX =
9241 "bluetooth_a2dp_optional_codecs_enabled_";
9243 public static final String
9244 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
9246 public static final String
9247 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
9249 public static final String
9250 BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_";
9252 public static final String
9253 BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_";
9255 public static final String
9256 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
9258 public static final String
9259 BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_";
9262 * Activity manager specific settings.
9263 * This is encoded as a key=value list, separated by commas. Ex:
9265 * "gc_timeout=5000,max_cached_processes=24"
9267 * The following keys are supported:
9270 * max_cached_processes (int)
9271 * background_settle_time (long)
9272 * fgservice_min_shown_time (long)
9273 * fgservice_min_report_time (long)
9274 * fgservice_screen_on_before_time (long)
9275 * fgservice_screen_on_after_time (long)
9276 * content_provider_retain_time (long)
9278 * gc_min_interval (long)
9279 * full_pss_min_interval (long)
9280 * full_pss_lowered_interval (long)
9281 * power_check_interval (long)
9282 * power_check_max_cpu_1 (int)
9283 * power_check_max_cpu_2 (int)
9284 * power_check_max_cpu_3 (int)
9285 * power_check_max_cpu_4 (int)
9286 * service_usage_interaction_time (long)
9287 * usage_stats_interaction_interval (long)
9288 * service_restart_duration (long)
9289 * service_reset_run_duration (long)
9290 * service_restart_duration_factor (int)
9291 * service_min_restart_time_between (long)
9292 * service_max_inactivity (long)
9293 * service_bg_start_timeout (long)
9299 * @see com.android.server.am.ActivityManagerConstants
9301 public static final String ACTIVITY_MANAGER_CONSTANTS = "activity_manager_constants";
9304 * Device Idle (Doze) specific settings.
9305 * This is encoded as a key=value list, separated by commas. Ex:
9307 * "inactive_to=60000,sensing_to=400000"
9309 * The following keys are supported:
9312 * inactive_to (long)
9314 * motion_inactive_to (long)
9315 * idle_after_inactive_to (long)
9316 * idle_pending_to (long)
9317 * max_idle_pending_to (long)
9318 * idle_pending_factor (float)
9320 * max_idle_to (long)
9321 * idle_factor (float)
9322 * min_time_to_alarm (long)
9323 * max_temp_app_whitelist_duration (long)
9324 * notification_whitelist_duration (long)
9330 * @see com.android.server.DeviceIdleController.Constants
9332 public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
9335 * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS}
9340 * @see com.android.server.DeviceIdleController.Constants
9342 public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch";
9345 * Battery Saver specific settings
9346 * This is encoded as a key=value list, separated by commas. Ex:
9348 * "vibration_disabled=true,adjust_brightness_factor=0.5"
9350 * The following keys are supported:
9353 * vibration_disabled (boolean)
9354 * animation_disabled (boolean)
9355 * soundtrigger_disabled (boolean)
9356 * fullbackup_deferred (boolean)
9357 * keyvaluebackup_deferred (boolean)
9358 * firewall_disabled (boolean)
9360 * adjust_brightness_disabled (boolean)
9361 * adjust_brightness_factor (float)
9364 * @see com.android.server.power.BatterySaverPolicy
9366 public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
9369 * Battery anomaly detection specific settings
9370 * This is encoded as a key=value list, separated by commas.
9371 * wakeup_blacklisted_tags is a string, encoded as a set of tags, encoded via
9372 * {@link Uri#encode(String)}, separated by colons. Ex:
9374 * "anomaly_detection_enabled=true,wakelock_threshold=2000,wakeup_alarm_enabled=true,"
9375 * "wakeup_alarm_threshold=10,wakeup_blacklisted_tags=tag1:tag2:with%2Ccomma:with%3Acolon"
9377 * The following keys are supported:
9380 * anomaly_detection_enabled (boolean)
9381 * wakelock_enabled (boolean)
9382 * wakelock_threshold (long)
9383 * wakeup_alarm_enabled (boolean)
9384 * wakeup_alarm_threshold (long)
9385 * wakeup_blacklisted_tags (string)
9386 * bluetooth_scan_enabled (boolean)
9387 * bluetooth_scan_threshold (long)
9391 public static final String ANOMALY_DETECTION_CONSTANTS = "anomaly_detection_constants";
9394 * Always on display(AOD) specific settings
9395 * This is encoded as a key=value list, separated by commas. Ex:
9397 * "prox_screen_off_delay=10000,screen_brightness_array=0:1:2:3:4"
9399 * The following keys are supported:
9402 * screen_brightness_array (string)
9403 * dimming_scrim_array (string)
9404 * prox_screen_off_delay (long)
9405 * prox_cooldown_trigger (long)
9406 * prox_cooldown_period (long)
9410 public static final String ALWAYS_ON_DISPLAY_CONSTANTS = "always_on_display_constants";
9413 * App standby (app idle) specific settings.
9414 * This is encoded as a key=value list, separated by commas. Ex:
9416 * "idle_duration=5000,parole_interval=4500"
9418 * The following keys are supported:
9421 * idle_duration2 (long)
9422 * wallclock_threshold (long)
9423 * parole_interval (long)
9424 * parole_duration (long)
9426 * idle_duration (long) // This is deprecated and used to circumvent b/26355386.
9432 * @see com.android.server.usage.UsageStatsService.SettingsObserver
9434 public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
9437 * Power manager specific settings.
9438 * This is encoded as a key=value list, separated by commas. Ex:
9440 * "no_cached_wake_locks=1"
9442 * The following keys are supported:
9445 * no_cached_wake_locks (boolean)
9451 * @see com.android.server.power.PowerManagerConstants
9453 public static final String POWER_MANAGER_CONSTANTS = "power_manager_constants";
9456 * Alarm manager specific settings.
9457 * This is encoded as a key=value list, separated by commas. Ex:
9459 * "min_futurity=5000,allow_while_idle_short_time=4500"
9461 * The following keys are supported:
9464 * min_futurity (long)
9465 * min_interval (long)
9466 * allow_while_idle_short_time (long)
9467 * allow_while_idle_long_time (long)
9468 * allow_while_idle_whitelist_duration (long)
9474 * @see com.android.server.AlarmManagerService.Constants
9476 public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
9479 * Job scheduler specific settings.
9480 * This is encoded as a key=value list, separated by commas. Ex:
9482 * "min_ready_jobs_count=2,moderate_use_factor=.5"
9484 * The following keys are supported:
9487 * min_idle_count (int)
9488 * min_charging_count (int)
9489 * min_connectivity_count (int)
9490 * min_content_count (int)
9491 * min_ready_jobs_count (int)
9492 * heavy_use_factor (float)
9493 * moderate_use_factor (float)
9494 * fg_job_count (int)
9495 * bg_normal_job_count (int)
9496 * bg_moderate_job_count (int)
9497 * bg_low_job_count (int)
9498 * bg_critical_job_count (int)
9504 * @see com.android.server.job.JobSchedulerService.Constants
9506 public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants";
9509 * ShortcutManager specific settings.
9510 * This is encoded as a key=value list, separated by commas. Ex:
9512 * "reset_interval_sec=86400,max_updates_per_interval=1"
9514 * The following keys are supported:
9517 * reset_interval_sec (long)
9518 * max_updates_per_interval (int)
9519 * max_icon_dimension_dp (int, DP)
9520 * max_icon_dimension_dp_lowram (int, DP)
9521 * max_shortcuts (int)
9522 * icon_quality (int, 0-100)
9523 * icon_format (String)
9529 * @see com.android.server.pm.ShortcutService.ConfigConstants
9531 public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants";
9534 * DevicePolicyManager specific settings.
9535 * This is encoded as a key=value list, separated by commas. Ex:
9538 * das_died_service_reconnect_backoff_sec (long)
9539 * das_died_service_reconnect_backoff_increase (float)
9540 * das_died_service_reconnect_max_backoff_sec (long)
9546 * see also com.android.server.devicepolicy.DevicePolicyConstants
9548 public static final String DEVICE_POLICY_CONSTANTS = "device_policy_constants";
9551 * TextClassifier specific settings.
9552 * This is encoded as a key=value list, separated by commas. Ex:
9555 * smart_selection_dark_launch (boolean)
9556 * smart_selection_enabled_for_edit_text (boolean)
9562 * see also android.view.textclassifier.TextClassifierConstants
9564 public static final String TEXT_CLASSIFIER_CONSTANTS = "text_classifier_constants";
9567 * Get the key that retrieves a bluetooth headset's priority.
9570 public static final String getBluetoothHeadsetPriorityKey(String address) {
9571 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9575 * Get the key that retrieves a bluetooth a2dp sink's priority.
9578 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
9579 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9583 * Get the key that retrieves a bluetooth a2dp src's priority.
9586 public static final String getBluetoothA2dpSrcPriorityKey(String address) {
9587 return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9591 * Get the key that retrieves a bluetooth a2dp device's ability to support optional codecs.
9594 public static final String getBluetoothA2dpSupportsOptionalCodecsKey(String address) {
9595 return BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX +
9596 address.toUpperCase(Locale.ROOT);
9600 * Get the key that retrieves whether a bluetooth a2dp device should have optional codecs
9604 public static final String getBluetoothA2dpOptionalCodecsEnabledKey(String address) {
9605 return BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX +
9606 address.toUpperCase(Locale.ROOT);
9610 * Get the key that retrieves a bluetooth Input Device's priority.
9613 public static final String getBluetoothInputDevicePriorityKey(String address) {
9614 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9618 * Get the key that retrieves a bluetooth pan client priority.
9621 public static final String getBluetoothPanPriorityKey(String address) {
9622 return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9626 * Get the key that retrieves a bluetooth map priority.
9629 public static final String getBluetoothMapPriorityKey(String address) {
9630 return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9634 * Get the key that retrieves a bluetooth map client priority.
9637 public static final String getBluetoothMapClientPriorityKey(String address) {
9638 return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9642 * Get the key that retrieves a bluetooth pbap client priority.
9645 public static final String getBluetoothPbapClientPriorityKey(String address) {
9646 return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9650 * Get the key that retrieves a bluetooth sap priority.
9653 public static final String getBluetoothSapPriorityKey(String address) {
9654 return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9658 * Scaling factor for normal window animations. Setting to 0 will
9659 * disable window animations.
9661 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
9664 * Scaling factor for activity transition animations. Setting to 0 will
9665 * disable window animations.
9667 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
9670 * Scaling factor for Animator-based animations. This affects both the
9671 * start delay and duration of all such animations. Setting to 0 will
9672 * cause animations to end immediately. The default value is 1.
9674 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
9677 * Scaling factor for normal window animations. Setting to 0 will
9678 * disable window animations.
9682 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
9685 * If 0, the compatibility mode is off for all applications.
9686 * If 1, older applications run under compatibility mode.
9687 * TODO: remove this settings before code freeze (bug/1907571)
9690 public static final String COMPATIBILITY_MODE = "compatibility_mode";
9693 * CDMA only settings
9694 * Emergency Tone 0 = Off
9699 public static final String EMERGENCY_TONE = "emergency_tone";
9702 * CDMA only settings
9703 * Whether the auto retry is enabled. The value is
9707 public static final String CALL_AUTO_RETRY = "call_auto_retry";
9710 * A setting that can be read whether the emergency affordance is currently needed.
9711 * The value is a boolean (1 or 0).
9714 public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
9717 * See RIL_PreferredNetworkType in ril.h
9720 public static final String PREFERRED_NETWORK_MODE =
9721 "preferred_network_mode";
9724 * Name of an application package to be debugged.
9726 public static final String DEBUG_APP = "debug_app";
9729 * If 1, when launching DEBUG_APP it will wait for the debugger before
9730 * starting user code. If 0, it will run normally.
9732 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
9735 * Control whether the process CPU usage meter should be shown.
9737 * @deprecated This functionality is no longer available as of
9738 * {@link android.os.Build.VERSION_CODES#N_MR1}.
9741 public static final String SHOW_PROCESSES = "show_processes";
9744 * If 1 low power mode is enabled.
9747 public static final String LOW_POWER_MODE = "low_power";
9750 * Battery level [1-99] at which low power mode automatically turns on.
9751 * If 0, it will not automatically turn on.
9754 public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
9757 * If not 0, the activity manager will aggressively finish activities and
9758 * processes as soon as they are no longer needed. If 0, the normal
9759 * extended lifetime is used.
9761 public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
9764 * Use Dock audio output for media:
9769 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
9772 * The surround sound formats AC3, DTS or IEC61937 are
9773 * available for use if they are detected.
9774 * This is the default mode.
9776 * Note that AUTO is equivalent to ALWAYS for Android TVs and other
9777 * devices that have an S/PDIF output. This is because S/PDIF
9778 * is unidirectional and the TV cannot know if a decoder is
9779 * connected. So it assumes they are always available.
9782 public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0;
9785 * AC3, DTS or IEC61937 are NEVER available, even if they
9786 * are detected by the hardware. Those formats will not be
9789 * An example use case would be an AVR reports that it is capable of
9790 * surround sound decoding but is broken. If NEVER is chosen
9791 * then apps must use PCM output instead of encoded output.
9794 public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1;
9797 * AC3, DTS or IEC61937 are ALWAYS available, even if they
9798 * are not detected by the hardware. Those formats will be
9799 * reported as part of the HDMI output capability. Applications
9800 * are then free to use either PCM or encoded output.
9802 * An example use case would be a when TV was connected over
9803 * TOS-link to an AVR. But the TV could not see it because TOS-link
9804 * is unidirectional.
9807 public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2;
9810 * Set to ENCODED_SURROUND_OUTPUT_AUTO,
9811 * ENCODED_SURROUND_OUTPUT_NEVER or
9812 * ENCODED_SURROUND_OUTPUT_ALWAYS
9815 public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output";
9818 * Persisted safe headphone volume management state by AudioService
9821 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
9824 * URL for tzinfo (time zone) updates
9827 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
9830 * URL for tzinfo (time zone) update metadata
9833 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
9836 * URL for selinux (mandatory access control) updates
9839 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
9842 * URL for selinux (mandatory access control) update metadata
9845 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
9848 * URL for sms short code updates
9851 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
9852 "sms_short_codes_content_url";
9855 * URL for sms short code update metadata
9858 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
9859 "sms_short_codes_metadata_url";
9862 * URL for apn_db updates
9865 public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
9868 * URL for apn_db update metadata
9871 public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
9874 * URL for cert pinlist updates
9877 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
9880 * URL for cert pinlist updates
9883 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
9886 * URL for intent firewall updates
9889 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
9890 "intent_firewall_content_url";
9893 * URL for intent firewall update metadata
9896 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
9897 "intent_firewall_metadata_url";
9900 * URL for lang id model updates
9903 public static final String LANG_ID_UPDATE_CONTENT_URL = "lang_id_content_url";
9906 * URL for lang id model update metadata
9909 public static final String LANG_ID_UPDATE_METADATA_URL = "lang_id_metadata_url";
9912 * URL for smart selection model updates
9915 public static final String SMART_SELECTION_UPDATE_CONTENT_URL =
9916 "smart_selection_content_url";
9919 * URL for smart selection model update metadata
9922 public static final String SMART_SELECTION_UPDATE_METADATA_URL =
9923 "smart_selection_metadata_url";
9926 * SELinux enforcement status. If 0, permissive; if 1, enforcing.
9929 public static final String SELINUX_STATUS = "selinux_status";
9932 * Developer setting to force RTL layout.
9935 public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
9938 * Milliseconds after screen-off after which low battery sounds will be silenced.
9940 * If zero, battery sounds will always play.
9941 * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
9945 public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
9948 * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
9949 * the caller is done with this, they should call {@link ContentResolver#delete} to
9950 * clean up any value that they may have written.
9954 public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
9957 * Defines global runtime overrides to window policy.
9959 * See {@link com.android.server.policy.PolicyControl} for value format.
9963 public static final String POLICY_CONTROL = "policy_control";
9966 * Defines global zen mode. ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
9967 * or ZEN_MODE_NO_INTERRUPTIONS.
9971 public static final String ZEN_MODE = "zen_mode";
9973 /** @hide */ public static final int ZEN_MODE_OFF = 0;
9974 /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
9975 /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
9976 /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
9978 /** @hide */ public static String zenModeToString(int mode) {
9979 if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
9980 if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
9981 if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
9982 return "ZEN_MODE_OFF";
9985 /** @hide */ public static boolean isValidZenMode(int value) {
9987 case Global.ZEN_MODE_OFF:
9988 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
9989 case Global.ZEN_MODE_ALARMS:
9990 case Global.ZEN_MODE_NO_INTERRUPTIONS:
9998 * Value of the ringer before entering zen mode.
10002 public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
10005 * Opaque value, changes when persisted zen mode configuration changes.
10009 public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
10012 * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON.
10016 public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
10017 "heads_up_notifications_enabled";
10019 /** @hide */ public static final int HEADS_UP_OFF = 0;
10020 /** @hide */ public static final int HEADS_UP_ON = 1;
10023 * The name of the device
10025 public static final String DEVICE_NAME = "device_name";
10028 * Whether the NetworkScoringService has been first initialized.
10030 * Type: int (0 for false, 1 for true)
10033 public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
10036 * Whether the user wants to be prompted for password to decrypt the device on boot.
10037 * This only matters if the storage is encrypted.
10039 * Type: int (0 for false, 1 for true)
10042 public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
10045 * Whether the Volte is enabled
10047 * Type: int (0 for false, 1 for true)
10050 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
10053 * Whether VT (Video Telephony over IMS) is enabled
10055 * Type: int (0 for false, 1 for true)
10059 public static final String VT_IMS_ENABLED = "vt_ims_enabled";
10062 * Whether WFC is enabled
10064 * Type: int (0 for false, 1 for true)
10068 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
10071 * WFC mode on home/non-roaming network.
10073 * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
10077 public static final String WFC_IMS_MODE = "wfc_ims_mode";
10080 * WFC mode on roaming network.
10082 * Type: int - see {@link #WFC_IMS_MODE} for values
10086 public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode";
10089 * Whether WFC roaming is enabled
10091 * Type: int (0 for false, 1 for true)
10095 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
10098 * Whether user can enable/disable LTE as a preferred network. A carrier might control
10099 * this via gservices, OMA-DM, carrier app, etc.
10101 * Type: int (0 for false, 1 for true)
10104 public static final String LTE_SERVICE_FORCED = "lte_service_forced";
10107 * Ephemeral app cookie max size in bytes.
10112 public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
10113 "ephemeral_cookie_max_size_bytes";
10116 * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is
10117 * enabled. Set to zero to disable.
10119 * Type: int (0 for false, 1 for true)
10123 public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature";
10126 * Toggle to enable/disable dexopt for instant applications. The default is for dexopt
10129 * Type: int (0 to disable, 1 to enable)
10133 public static final String INSTANT_APP_DEXOPT_ENABLED = "instant_app_dexopt_enabled";
10136 * The min period for caching installed instant apps in milliseconds.
10141 public static final String INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD =
10142 "installed_instant_app_min_cache_period";
10145 * The max period for caching installed instant apps in milliseconds.
10150 public static final String INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD =
10151 "installed_instant_app_max_cache_period";
10154 * The min period for caching uninstalled instant apps in milliseconds.
10159 public static final String UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD =
10160 "uninstalled_instant_app_min_cache_period";
10163 * The max period for caching uninstalled instant apps in milliseconds.
10168 public static final String UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD =
10169 "uninstalled_instant_app_max_cache_period";
10172 * The min period for caching unused static shared libs in milliseconds.
10177 public static final String UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD =
10178 "unused_static_shared_lib_min_cache_period";
10181 * Allows switching users when system user is locked.
10186 public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED =
10187 "allow_user_switching_when_system_user_locked";
10190 * Boot count since the device starts running APK level 24.
10194 public static final String BOOT_COUNT = "boot_count";
10197 * Whether the safe boot is disallowed.
10199 * <p>This setting should have the identical value as the corresponding user restriction.
10200 * The purpose of the setting is to make the restriction available in early boot stages
10201 * before the user restrictions are loaded.
10204 public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
10207 * Whether this device is currently in retail demo mode. If true, device
10208 * usage is severely limited.
10210 * Type: int (0 for false, 1 for true)
10213 public static final String DEVICE_DEMO_MODE = "device_demo_mode";
10216 * Indicates the maximum time that an app is blocked for the network rules to get updated.
10222 public static final String NETWORK_ACCESS_TIMEOUT_MS = "network_access_timeout_ms";
10225 * The reason for the settings database being downgraded. This is only for
10226 * troubleshooting purposes and its value should not be interpreted in any way.
10232 public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
10235 * The build id of when the settings database was first created (or re-created due it
10242 public static final String DATABASE_CREATION_BUILDID = "database_creation_buildid";
10245 * Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by
10246 * default. Set to 0 to disable.
10250 public static final String CONTACTS_DATABASE_WAL_ENABLED = "contacts_database_wal_enabled";
10253 * Flag to enable the link to location permissions in location setting. Set to 0 to disable.
10257 public static final String LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED =
10258 "location_settings_link_to_permissions_enabled";
10261 * Flag to enable use of RefactoredBackupManagerService.
10265 public static final String BACKUP_REFACTORED_SERVICE_DISABLED =
10266 "backup_refactored_service_disabled";
10269 * Flag to set the waiting time for euicc factory reset inside System > Settings
10274 public static final String EUICC_FACTORY_RESET_TIMEOUT_MILLIS =
10275 "euicc_factory_reset_timeout_millis";
10278 * Flag to set the timeout for when to refresh the storage settings cached data.
10283 public static final String STORAGE_SETTINGS_CLOBBER_THRESHOLD =
10284 "storage_settings_clobber_threshold";
10287 * Settings to backup. This is here so that it's in the same place as the settings
10288 * keys and easy to update.
10290 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
10291 * and Secure as well. This is because those tables drive both backup and
10292 * restore, and restore needs to properly whitelist keys that used to live
10293 * in those namespaces. The keys will only actually be backed up / restored
10294 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
10296 * NOTE: Settings are backed up and restored in the order they appear
10297 * in this array. If you have one setting depending on another,
10298 * make sure that they are ordered appropriately.
10302 public static final String[] SETTINGS_TO_BACKUP = {
10303 BUGREPORT_IN_POWER_MENU,
10304 STAY_ON_WHILE_PLUGGED_IN,
10307 POWER_SOUNDS_ENABLED,
10308 DOCK_SOUNDS_ENABLED,
10309 CHARGING_SOUNDS_ENABLED,
10310 USB_MASS_STORAGE_ENABLED,
10311 NETWORK_RECOMMENDATIONS_ENABLED,
10312 WIFI_WAKEUP_ENABLED,
10313 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
10314 USE_OPEN_WIFI_PACKAGE,
10315 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
10318 DOCK_AUDIO_MEDIA_ENABLED,
10319 ENCODED_SURROUND_OUTPUT,
10320 LOW_POWER_MODE_TRIGGER_LEVEL,
10325 public static final String[] LEGACY_RESTORE_SETTINGS = {
10328 private static final ContentProviderHolder sProviderHolder =
10329 new ContentProviderHolder(CONTENT_URI);
10331 // Populated lazily, guarded by class object:
10332 private static final NameValueCache sNameValueCache = new NameValueCache(
10334 CALL_METHOD_GET_GLOBAL,
10335 CALL_METHOD_PUT_GLOBAL,
10338 // Certain settings have been moved from global to the per-user secure namespace
10339 private static final HashSet<String> MOVED_TO_SECURE;
10341 MOVED_TO_SECURE = new HashSet<>(1);
10342 MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
10346 public static void getMovedToSecureSettings(Set<String> outKeySet) {
10347 outKeySet.addAll(MOVED_TO_SECURE);
10351 public static void clearProviderForTest() {
10352 sProviderHolder.clearProviderForTest();
10353 sNameValueCache.clearGenerationTrackerForTest();
10357 * Look up a name in the database.
10358 * @param resolver to access the database with
10359 * @param name to look up in the table
10360 * @return the corresponding value, or null if not present
10362 public static String getString(ContentResolver resolver, String name) {
10363 return getStringForUser(resolver, name, UserHandle.myUserId());
10367 public static String getStringForUser(ContentResolver resolver, String name,
10369 if (MOVED_TO_SECURE.contains(name)) {
10370 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
10371 + " to android.provider.Settings.Secure, returning read-only value.");
10372 return Secure.getStringForUser(resolver, name, userHandle);
10374 return sNameValueCache.getStringForUser(resolver, name, userHandle);
10378 * Store a name/value pair into the database.
10379 * @param resolver to access the database with
10380 * @param name to store
10381 * @param value to associate with the name
10382 * @return true if the value was set, false on database errors
10384 public static boolean putString(ContentResolver resolver,
10385 String name, String value) {
10386 return putStringForUser(resolver, name, value, null, false, UserHandle.myUserId());
10390 * Store a name/value pair into the database.
10392 * The method takes an optional tag to associate with the setting
10393 * which can be used to clear only settings made by your package and
10394 * associated with this tag by passing the tag to {@link
10395 * #resetToDefaults(ContentResolver, String)}. Anyone can override
10396 * the current tag. Also if another package changes the setting
10397 * then the tag will be set to the one specified in the set call
10398 * which can be null. Also any of the settings setters that do not
10399 * take a tag as an argument effectively clears the tag.
10401 * For example, if you set settings A and B with tags T1 and T2 and
10402 * another app changes setting A (potentially to the same value), it
10403 * can assign to it a tag T3 (note that now the package that changed
10404 * the setting is not yours). Now if you reset your changes for T1 and
10405 * T2 only setting B will be reset and A not (as it was changed by
10406 * another package) but since A did not change you are in the desired
10407 * initial state. Now if the other app changes the value of A (assuming
10408 * you registered an observer in the beginning) you would detect that
10409 * the setting was changed by another app and handle this appropriately
10410 * (ignore, set back to some value, etc).
10412 * Also the method takes an argument whether to make the value the
10413 * default for this setting. If the system already specified a default
10414 * value, then the one passed in here will <strong>not</strong>
10415 * be set as the default.
10418 * @param resolver to access the database with.
10419 * @param name to store.
10420 * @param value to associate with the name.
10421 * @param tag to associated with the setting.
10422 * @param makeDefault whether to make the value the default one.
10423 * @return true if the value was set, false on database errors.
10425 * @see #resetToDefaults(ContentResolver, String)
10430 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
10431 public static boolean putString(@NonNull ContentResolver resolver,
10432 @NonNull String name, @Nullable String value, @Nullable String tag,
10433 boolean makeDefault) {
10434 return putStringForUser(resolver, name, value, tag, makeDefault,
10435 UserHandle.myUserId());
10439 * Reset the settings to their defaults. This would reset <strong>only</strong>
10440 * settings set by the caller's package. Think of it of a way to undo your own
10441 * changes to the secure settings. Passing in the optional tag will reset only
10442 * settings changed by your package and associated with this tag.
10444 * @param resolver Handle to the content resolver.
10445 * @param tag Optional tag which should be associated with the settings to reset.
10447 * @see #putString(ContentResolver, String, String, String, boolean)
10452 @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
10453 public static void resetToDefaults(@NonNull ContentResolver resolver,
10454 @Nullable String tag) {
10455 resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
10456 UserHandle.myUserId());
10460 * Reset the settings to their defaults for a given user with a specific mode. The
10461 * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
10462 * allowing resetting the settings made by a package and associated with the tag.
10464 * @param resolver Handle to the content resolver.
10465 * @param tag Optional tag which should be associated with the settings to reset.
10466 * @param mode The reset mode.
10467 * @param userHandle The user for which to reset to defaults.
10469 * @see #RESET_MODE_PACKAGE_DEFAULTS
10470 * @see #RESET_MODE_UNTRUSTED_DEFAULTS
10471 * @see #RESET_MODE_UNTRUSTED_CHANGES
10472 * @see #RESET_MODE_TRUSTED_DEFAULTS
10476 public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
10477 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
10479 Bundle arg = new Bundle();
10480 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
10482 arg.putString(CALL_METHOD_TAG_KEY, tag);
10484 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
10485 IContentProvider cp = sProviderHolder.getProvider(resolver);
10486 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_GLOBAL, null, arg);
10487 } catch (RemoteException e) {
10488 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
10493 public static boolean putStringForUser(ContentResolver resolver,
10494 String name, String value, int userHandle) {
10495 return putStringForUser(resolver, name, value, null, false, userHandle);
10499 public static boolean putStringForUser(@NonNull ContentResolver resolver,
10500 @NonNull String name, @Nullable String value, @Nullable String tag,
10501 boolean makeDefault, @UserIdInt int userHandle) {
10503 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
10504 + " for " + userHandle);
10506 // Global and Secure have the same access policy so we can forward writes
10507 if (MOVED_TO_SECURE.contains(name)) {
10508 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
10509 + " to android.provider.Settings.Secure, value is unchanged.");
10510 return Secure.putStringForUser(resolver, name, value, tag,
10511 makeDefault, userHandle);
10513 return sNameValueCache.putStringForUser(resolver, name, value, tag,
10514 makeDefault, userHandle);
10518 * Construct the content URI for a particular name/value pair,
10519 * useful for monitoring changes with a ContentObserver.
10520 * @param name to look up in the table
10521 * @return the corresponding content URI, or null if not present
10523 public static Uri getUriFor(String name) {
10524 return getUriFor(CONTENT_URI, name);
10528 * Convenience function for retrieving a single secure settings value
10529 * as an integer. Note that internally setting values are always
10530 * stored as strings; this function converts the string to an integer
10531 * for you. The default value will be returned if the setting is
10532 * not defined or not an integer.
10534 * @param cr The ContentResolver to access.
10535 * @param name The name of the setting to retrieve.
10536 * @param def Value to return if the setting is not defined.
10538 * @return The setting's current value, or 'def' if it is not defined
10539 * or not a valid integer.
10541 public static int getInt(ContentResolver cr, String name, int def) {
10542 String v = getString(cr, name);
10544 return v != null ? Integer.parseInt(v) : def;
10545 } catch (NumberFormatException e) {
10551 * Convenience function for retrieving a single secure settings value
10552 * as an integer. Note that internally setting values are always
10553 * stored as strings; this function converts the string to an integer
10556 * This version does not take a default value. If the setting has not
10557 * been set, or the string value is not a number,
10558 * it throws {@link SettingNotFoundException}.
10560 * @param cr The ContentResolver to access.
10561 * @param name The name of the setting to retrieve.
10563 * @throws SettingNotFoundException Thrown if a setting by the given
10564 * name can't be found or the setting value is not an integer.
10566 * @return The setting's current value.
10568 public static int getInt(ContentResolver cr, String name)
10569 throws SettingNotFoundException {
10570 String v = getString(cr, name);
10572 return Integer.parseInt(v);
10573 } catch (NumberFormatException e) {
10574 throw new SettingNotFoundException(name);
10579 * Convenience function for updating a single settings value as an
10580 * integer. This will either create a new entry in the table if the
10581 * given name does not exist, or modify the value of the existing row
10582 * with that name. Note that internally setting values are always
10583 * stored as strings, so this function converts the given value to a
10584 * string before storing it.
10586 * @param cr The ContentResolver to access.
10587 * @param name The name of the setting to modify.
10588 * @param value The new value for the setting.
10589 * @return true if the value was set, false on database errors
10591 public static boolean putInt(ContentResolver cr, String name, int value) {
10592 return putString(cr, name, Integer.toString(value));
10596 * Convenience function for retrieving a single secure settings value
10597 * as a {@code long}. Note that internally setting values are always
10598 * stored as strings; this function converts the string to a {@code long}
10599 * for you. The default value will be returned if the setting is
10600 * not defined or not a {@code long}.
10602 * @param cr The ContentResolver to access.
10603 * @param name The name of the setting to retrieve.
10604 * @param def Value to return if the setting is not defined.
10606 * @return The setting's current value, or 'def' if it is not defined
10607 * or not a valid {@code long}.
10609 public static long getLong(ContentResolver cr, String name, long def) {
10610 String valString = getString(cr, name);
10613 value = valString != null ? Long.parseLong(valString) : def;
10614 } catch (NumberFormatException e) {
10621 * Convenience function for retrieving a single secure settings value
10622 * as a {@code long}. Note that internally setting values are always
10623 * stored as strings; this function converts the string to a {@code long}
10626 * This version does not take a default value. If the setting has not
10627 * been set, or the string value is not a number,
10628 * it throws {@link SettingNotFoundException}.
10630 * @param cr The ContentResolver to access.
10631 * @param name The name of the setting to retrieve.
10633 * @return The setting's current value.
10634 * @throws SettingNotFoundException Thrown if a setting by the given
10635 * name can't be found or the setting value is not an integer.
10637 public static long getLong(ContentResolver cr, String name)
10638 throws SettingNotFoundException {
10639 String valString = getString(cr, name);
10641 return Long.parseLong(valString);
10642 } catch (NumberFormatException e) {
10643 throw new SettingNotFoundException(name);
10648 * Convenience function for updating a secure settings value as a long
10649 * integer. This will either create a new entry in the table if the
10650 * given name does not exist, or modify the value of the existing row
10651 * with that name. Note that internally setting values are always
10652 * stored as strings, so this function converts the given value to a
10653 * string before storing it.
10655 * @param cr The ContentResolver to access.
10656 * @param name The name of the setting to modify.
10657 * @param value The new value for the setting.
10658 * @return true if the value was set, false on database errors
10660 public static boolean putLong(ContentResolver cr, String name, long value) {
10661 return putString(cr, name, Long.toString(value));
10665 * Convenience function for retrieving a single secure settings value
10666 * as a floating point number. Note that internally setting values are
10667 * always stored as strings; this function converts the string to an
10668 * float for you. The default value will be returned if the setting
10669 * is not defined or not a valid float.
10671 * @param cr The ContentResolver to access.
10672 * @param name The name of the setting to retrieve.
10673 * @param def Value to return if the setting is not defined.
10675 * @return The setting's current value, or 'def' if it is not defined
10676 * or not a valid float.
10678 public static float getFloat(ContentResolver cr, String name, float def) {
10679 String v = getString(cr, name);
10681 return v != null ? Float.parseFloat(v) : def;
10682 } catch (NumberFormatException e) {
10688 * Convenience function for retrieving a single secure settings value
10689 * as a float. Note that internally setting values are always
10690 * stored as strings; this function converts the string to a float
10693 * This version does not take a default value. If the setting has not
10694 * been set, or the string value is not a number,
10695 * it throws {@link SettingNotFoundException}.
10697 * @param cr The ContentResolver to access.
10698 * @param name The name of the setting to retrieve.
10700 * @throws SettingNotFoundException Thrown if a setting by the given
10701 * name can't be found or the setting value is not a float.
10703 * @return The setting's current value.
10705 public static float getFloat(ContentResolver cr, String name)
10706 throws SettingNotFoundException {
10707 String v = getString(cr, name);
10709 throw new SettingNotFoundException(name);
10712 return Float.parseFloat(v);
10713 } catch (NumberFormatException e) {
10714 throw new SettingNotFoundException(name);
10719 * Convenience function for updating a single settings value as a
10720 * floating point number. This will either create a new entry in the
10721 * table if the given name does not exist, or modify the value of the
10722 * existing row with that name. Note that internally setting values
10723 * are always stored as strings, so this function converts the given
10724 * value to a string before storing it.
10726 * @param cr The ContentResolver to access.
10727 * @param name The name of the setting to modify.
10728 * @param value The new value for the setting.
10729 * @return true if the value was set, false on database errors
10731 public static boolean putFloat(ContentResolver cr, String name, float value) {
10732 return putString(cr, name, Float.toString(value));
10736 * Subscription to be used for voice call on a multi sim device. The supported values
10737 * are 0 = SUB1, 1 = SUB2 and etc.
10740 public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
10743 * Used to provide option to user to select subscription during dial.
10744 * The supported values are 0 = disable or 1 = enable prompt.
10747 public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
10750 * Subscription to be used for data call on a multi sim device. The supported values
10751 * are 0 = SUB1, 1 = SUB2 and etc.
10754 public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
10757 * Subscription to be used for SMS on a multi sim device. The supported values
10758 * are 0 = SUB1, 1 = SUB2 and etc.
10761 public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
10764 * Used to provide option to user to select subscription during send SMS.
10765 * The value 1 - enable, 0 - disable
10768 public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
10772 /** User preferred subscriptions setting.
10773 * This holds the details of the user selected subscription from the card and
10774 * the activation status. Each settings string have the coma separated values
10775 * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
10778 public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
10779 "user_preferred_sub2","user_preferred_sub3"};
10782 * Whether to enable new contacts aggregator or not.
10783 * The value 1 - enable, 0 - disable
10786 public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
10789 * Whether to enable contacts metadata syncing or not
10790 * The value 1 - enable, 0 - disable
10795 public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
10798 * Whether to enable contacts metadata syncing or not
10799 * The value 1 - enable, 0 - disable
10801 public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
10804 * Whether to enable cellular on boot.
10805 * The value 1 - enable, 0 - disable
10808 public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
10811 * The maximum allowed notification enqueue rate in Hertz.
10813 * Should be a float, and includes updates only.
10816 public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate";
10819 * Displays toasts when an app posts a notification that does not specify a valid channel.
10821 * The value 1 - enable, 0 - disable
10824 public static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS =
10825 "show_notification_channel_warnings";
10828 * Whether cell is enabled/disabled
10831 public static final String CELL_ON = "cell_on";
10834 * Global settings which can be accessed by instant apps.
10837 public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
10839 INSTANT_APP_SETTINGS.add(WAIT_FOR_DEBUGGER);
10840 INSTANT_APP_SETTINGS.add(DEVICE_PROVISIONED);
10841 INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
10842 INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RTL);
10843 INSTANT_APP_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
10844 INSTANT_APP_SETTINGS.add(AIRPLANE_MODE_ON);
10845 INSTANT_APP_SETTINGS.add(WINDOW_ANIMATION_SCALE);
10846 INSTANT_APP_SETTINGS.add(TRANSITION_ANIMATION_SCALE);
10847 INSTANT_APP_SETTINGS.add(ANIMATOR_DURATION_SCALE);
10848 INSTANT_APP_SETTINGS.add(DEBUG_VIEW_ATTRIBUTES);
10849 INSTANT_APP_SETTINGS.add(WTF_IS_FATAL);
10850 INSTANT_APP_SETTINGS.add(SEND_ACTION_APP_ERROR);
10854 * Whether to show the high temperature warning notification.
10857 public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
10860 * Temperature at which the high temperature warning notification should be shown.
10863 public static final String WARNING_TEMPERATURE = "warning_temperature";
10866 * Whether the diskstats logging task is enabled/disabled.
10869 public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging";
10872 * Whether the cache quota calculation task is enabled/disabled.
10875 public static final String ENABLE_CACHE_QUOTA_CALCULATION =
10876 "enable_cache_quota_calculation";
10879 * Whether the Deletion Helper no threshold toggle is available.
10882 public static final String ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE =
10883 "enable_deletion_helper_no_threshold_toggle";
10886 * The list of snooze options for notifications
10887 * This is encoded as a key=value list, separated by commas. Ex:
10889 * "default=60,options_array=15:30:60:120"
10891 * The following keys are supported:
10895 * options_array (string)
10898 * All delays in integer minutes. Array order is respected.
10899 * Options will be used in order up to the maximum allowed by the UI.
10902 public static final String NOTIFICATION_SNOOZE_OPTIONS =
10903 "notification_snooze_options";
10907 * User-defined bookmarks and shortcuts. The target of each bookmark is an
10908 * Intent URL, allowing it to be either a web page or a particular
10909 * application activity.
10913 public static final class Bookmarks implements BaseColumns
10915 private static final String TAG = "Bookmarks";
10918 * The content:// style URL for this table
10920 public static final Uri CONTENT_URI =
10921 Uri.parse("content://" + AUTHORITY + "/bookmarks");
10925 * <p>Type: INTEGER</p>
10927 public static final String ID = "_id";
10930 * Descriptive name of the bookmark that can be displayed to the user.
10931 * If this is empty, the title should be resolved at display time (use
10932 * {@link #getTitle(Context, Cursor)} any time you want to display the
10933 * title of a bookmark.)
10938 public static final String TITLE = "title";
10941 * Arbitrary string (displayed to the user) that allows bookmarks to be
10942 * organized into categories. There are some special names for
10943 * standard folders, which all start with '@'. The label displayed for
10944 * the folder changes with the locale (via {@link #getLabelForFolder}) but
10945 * the folder name does not change so you can consistently query for
10946 * the folder regardless of the current locale.
10948 * <P>Type: TEXT</P>
10951 public static final String FOLDER = "folder";
10954 * The Intent URL of the bookmark, describing what it points to. This
10955 * value is given to {@link android.content.Intent#getIntent} to create
10956 * an Intent that can be launched.
10957 * <P>Type: TEXT</P>
10959 public static final String INTENT = "intent";
10962 * Optional shortcut character associated with this bookmark.
10963 * <P>Type: INTEGER</P>
10965 public static final String SHORTCUT = "shortcut";
10968 * The order in which the bookmark should be displayed
10969 * <P>Type: INTEGER</P>
10971 public static final String ORDERING = "ordering";
10973 private static final String[] sIntentProjection = { INTENT };
10974 private static final String[] sShortcutProjection = { ID, SHORTCUT };
10975 private static final String sShortcutSelection = SHORTCUT + "=?";
10978 * Convenience function to retrieve the bookmarked Intent for a
10979 * particular shortcut key.
10981 * @param cr The ContentResolver to query.
10982 * @param shortcut The shortcut key.
10984 * @return Intent The bookmarked URL, or null if there is no bookmark
10985 * matching the given shortcut.
10987 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
10989 Intent intent = null;
10991 Cursor c = cr.query(CONTENT_URI,
10992 sIntentProjection, sShortcutSelection,
10993 new String[] { String.valueOf((int) shortcut) }, ORDERING);
10994 // Keep trying until we find a valid shortcut
10996 while (intent == null && c.moveToNext()) {
10998 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
10999 intent = Intent.parseUri(intentURI, 0);
11000 } catch (java.net.URISyntaxException e) {
11001 // The stored URL is bad... ignore it.
11002 } catch (IllegalArgumentException e) {
11003 // Column not found
11004 Log.w(TAG, "Intent column not found", e);
11008 if (c != null) c.close();
11015 * Add a new bookmark to the system.
11017 * @param cr The ContentResolver to query.
11018 * @param intent The desired target of the bookmark.
11019 * @param title Bookmark title that is shown to the user; null if none
11020 * or it should be resolved to the intent's title.
11021 * @param folder Folder in which to place the bookmark; null if none.
11022 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
11023 * this is non-zero and there is an existing bookmark entry
11024 * with this same shortcut, then that existing shortcut is
11025 * cleared (the bookmark is not removed).
11026 * @return The unique content URL for the new bookmark entry.
11028 public static Uri add(ContentResolver cr,
11035 // If a shortcut is supplied, and it is already defined for
11036 // another bookmark, then remove the old definition.
11037 if (shortcut != 0) {
11038 cr.delete(CONTENT_URI, sShortcutSelection,
11039 new String[] { String.valueOf((int) shortcut) });
11042 ContentValues values = new ContentValues();
11043 if (title != null) values.put(TITLE, title);
11044 if (folder != null) values.put(FOLDER, folder);
11045 values.put(INTENT, intent.toUri(0));
11046 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
11047 values.put(ORDERING, ordering);
11048 return cr.insert(CONTENT_URI, values);
11052 * Return the folder name as it should be displayed to the user. This
11053 * takes care of localizing special folders.
11055 * @param r Resources object for current locale; only need access to
11056 * system resources.
11057 * @param folder The value found in the {@link #FOLDER} column.
11059 * @return CharSequence The label for this folder that should be shown
11062 public static CharSequence getLabelForFolder(Resources r, String folder) {
11067 * Return the title as it should be displayed to the user. This takes
11068 * care of localizing bookmarks that point to activities.
11070 * @param context A context.
11071 * @param cursor A cursor pointing to the row whose title should be
11072 * returned. The cursor must contain at least the {@link #TITLE}
11073 * and {@link #INTENT} columns.
11074 * @return A title that is localized and can be displayed to the user,
11075 * or the empty string if one could not be found.
11077 public static CharSequence getTitle(Context context, Cursor cursor) {
11078 int titleColumn = cursor.getColumnIndex(TITLE);
11079 int intentColumn = cursor.getColumnIndex(INTENT);
11080 if (titleColumn == -1 || intentColumn == -1) {
11081 throw new IllegalArgumentException(
11082 "The cursor must contain the TITLE and INTENT columns.");
11085 String title = cursor.getString(titleColumn);
11086 if (!TextUtils.isEmpty(title)) {
11090 String intentUri = cursor.getString(intentColumn);
11091 if (TextUtils.isEmpty(intentUri)) {
11097 intent = Intent.parseUri(intentUri, 0);
11098 } catch (URISyntaxException e) {
11102 PackageManager packageManager = context.getPackageManager();
11103 ResolveInfo info = packageManager.resolveActivity(intent, 0);
11104 return info != null ? info.loadLabel(packageManager) : "";
11109 * Returns the device ID that we should use when connecting to the mobile gtalk server.
11110 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
11111 * from the GoogleLoginService.
11113 * @param androidId The Android ID for this device.
11114 * @return The device ID that should be used when connecting to the mobile gtalk server.
11117 public static String getGTalkDeviceId(long androidId) {
11118 return "android-" + Long.toHexString(androidId);
11121 private static final String[] PM_WRITE_SETTINGS = {
11122 android.Manifest.permission.WRITE_SETTINGS
11124 private static final String[] PM_CHANGE_NETWORK_STATE = {
11125 android.Manifest.permission.CHANGE_NETWORK_STATE,
11126 android.Manifest.permission.WRITE_SETTINGS
11128 private static final String[] PM_SYSTEM_ALERT_WINDOW = {
11129 android.Manifest.permission.SYSTEM_ALERT_WINDOW
11133 * Performs a strict and comprehensive check of whether a calling package is allowed to
11134 * write/modify system settings, as the condition differs for pre-M, M+, and
11135 * privileged/preinstalled apps. If the provided uid does not match the
11136 * callingPackage, a negative result will be returned.
11139 public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
11140 String callingPackage, boolean throwException) {
11141 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
11142 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
11143 PM_WRITE_SETTINGS, false);
11147 * Performs a strict and comprehensive check of whether a calling package is allowed to
11148 * write/modify system settings, as the condition differs for pre-M, M+, and
11149 * privileged/preinstalled apps. If the provided uid does not match the
11150 * callingPackage, a negative result will be returned. The caller is expected to have
11151 * the WRITE_SETTINGS permission declared.
11153 * Note: if the check is successful, the operation of this app will be updated to the
11157 public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
11158 String callingPackage, boolean throwException) {
11159 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
11160 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
11161 PM_WRITE_SETTINGS, true);
11165 * Performs a strict and comprehensive check of whether a calling package is allowed to
11166 * change the state of network, as the condition differs for pre-M, M+, and
11167 * privileged/preinstalled apps. The caller is expected to have either the
11168 * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
11169 * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
11170 * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
11171 * permission and cannot be revoked. See http://b/23597341
11173 * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
11174 * of this app will be updated to the current time.
11177 public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
11178 String callingPackage, boolean throwException) {
11179 if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
11180 == PackageManager.PERMISSION_GRANTED) {
11183 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
11184 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
11185 PM_CHANGE_NETWORK_STATE, true);
11189 * Performs a strict and comprehensive check of whether a calling package is allowed to
11190 * draw on top of other apps, as the conditions differs for pre-M, M+, and
11191 * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
11192 * a negative result will be returned.
11195 public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
11196 String callingPackage, boolean throwException) {
11197 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
11198 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
11199 PM_SYSTEM_ALERT_WINDOW, false);
11203 * Performs a strict and comprehensive check of whether a calling package is allowed to
11204 * draw on top of other apps, as the conditions differs for pre-M, M+, and
11205 * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
11206 * a negative result will be returned.
11208 * Note: if the check is successful, the operation of this app will be updated to the
11212 public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
11213 callingPackage, boolean throwException) {
11214 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
11215 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
11216 PM_SYSTEM_ALERT_WINDOW, true);
11220 * Helper method to perform a general and comprehensive check of whether an operation that is
11221 * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
11222 * OP_WRITE_SETTINGS
11225 public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
11226 int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
11227 permissions, boolean makeNote) {
11228 if (callingPackage == null) {
11232 AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
11233 int mode = AppOpsManager.MODE_DEFAULT;
11235 mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
11237 mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
11241 case AppOpsManager.MODE_ALLOWED:
11244 case AppOpsManager.MODE_DEFAULT:
11245 // this is the default operating mode after an app's installation
11246 // In this case we will check all associated static permission to see
11247 // if it is granted during install time.
11248 for (String permission : permissions) {
11249 if (context.checkCallingOrSelfPermission(permission) == PackageManager
11250 .PERMISSION_GRANTED) {
11251 // if either of the permissions are granted, we will allow it
11257 // this is for all other cases trickled down here...
11258 if (!throwException) {
11263 // prepare string to throw SecurityException
11264 StringBuilder exceptionMessage = new StringBuilder();
11265 exceptionMessage.append(callingPackage);
11266 exceptionMessage.append(" was not granted ");
11267 if (permissions.length > 1) {
11268 exceptionMessage.append(" either of these permissions: ");
11270 exceptionMessage.append(" this permission: ");
11272 for (int i = 0; i < permissions.length; i++) {
11273 exceptionMessage.append(permissions[i]);
11274 exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
11277 throw new SecurityException(exceptionMessage.toString());
11281 * Retrieves a correponding package name for a given uid. It will query all
11282 * packages that are associated with the given uid, but it will return only
11283 * the zeroth result.
11284 * Note: If package could not be found, a null is returned.
11287 public static String getPackageNameForUid(Context context, int uid) {
11288 String[] packages = context.getPackageManager().getPackagesForUid(uid);
11289 if (packages == null) {
11292 return packages[0];