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