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