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