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