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