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.compat.annotation.UnsupportedAppUsage;
49 import android.content.ComponentName;
50 import android.content.ContentResolver;
51 import android.content.ContentValues;
52 import android.content.Context;
53 import android.content.IContentProvider;
54 import android.content.Intent;
55 import android.content.pm.ActivityInfo;
56 import android.content.pm.PackageManager;
57 import android.content.pm.ResolveInfo;
58 import android.content.res.Configuration;
59 import android.content.res.Resources;
60 import android.database.Cursor;
61 import android.database.SQLException;
62 import android.hardware.display.ColorDisplayManager;
63 import android.location.LocationManager;
64 import android.media.AudioFormat;
65 import android.net.ConnectivityManager;
66 import android.net.NetworkScoreManager;
67 import android.net.Uri;
68 import android.net.wifi.WifiManager;
69 import android.os.BatteryManager;
70 import android.os.Binder;
71 import android.os.Build.VERSION_CODES;
72 import android.os.Bundle;
73 import android.os.DropBoxManager;
74 import android.os.IBinder;
75 import android.os.LocaleList;
76 import android.os.PowerManager.AutoPowerSaveModeTriggers;
77 import android.os.Process;
78 import android.os.RemoteException;
79 import android.os.ResultReceiver;
80 import android.os.ServiceManager;
81 import android.os.UserHandle;
82 import android.provider.SettingsValidators.Validator;
83 import android.speech.tts.TextToSpeech;
84 import android.text.TextUtils;
85 import android.util.AndroidException;
86 import android.util.ArrayMap;
87 import android.util.ArraySet;
88 import android.util.Log;
89 import android.util.MemoryIntArray;
90 import android.view.Display;
91 import android.view.inputmethod.InputMethodSystemProperty;
92 
93 import com.android.internal.annotations.GuardedBy;
94 import com.android.internal.widget.ILockSettings;
95 
96 import java.io.IOException;
97 import java.lang.annotation.Retention;
98 import java.lang.annotation.RetentionPolicy;
99 import java.net.URISyntaxException;
100 import java.text.SimpleDateFormat;
101 import java.util.HashMap;
102 import java.util.HashSet;
103 import java.util.Map;
104 import java.util.Set;
105 
106 /**
107  * The Settings provider contains global system-level device preferences.
108  */
109 public final class Settings {
110 
111     // Intent actions for Settings
112 
113     /**
114      * Activity Action: Show system settings.
115      * <p>
116      * Input: Nothing.
117      * <p>
118      * Output: Nothing.
119      */
120     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
121     public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
122 
123     /**
124      * Activity Action: Show settings to allow configuration of APNs.
125      * <p>
126      * Input: Nothing.
127      * <p>
128      * Output: Nothing.
129      *
130      * <p class="note">
131      * In some cases, a matching Activity may not exist, so ensure you
132      * safeguard against this.
133      */
134     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
135     public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
136 
137     /**
138      * Activity Action: Show settings to allow configuration of current location
139      * sources.
140      * <p>
141      * In some cases, a matching Activity may not exist, so ensure you
142      * safeguard against this.
143      * <p>
144      * Input: Nothing.
145      * <p>
146      * Output: Nothing.
147      */
148     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
149     public static final String ACTION_LOCATION_SOURCE_SETTINGS =
150             "android.settings.LOCATION_SOURCE_SETTINGS";
151 
152     /**
153      * Activity Action: Show settings to allow configuration of location controller extra package.
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      *
162      * @hide
163      */
164     @SystemApi
165     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
166     public static final String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS =
167             "android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS";
168 
169     /**
170      * Activity Action: Show scanning settings to allow configuration of Wi-Fi
171      * and Bluetooth scanning settings.
172      * <p>
173      * In some cases, a matching Activity may not exist, so ensure you
174      * safeguard against this.
175      * <p>
176      * Input: Nothing.
177      * <p>
178      * Output: Nothing.
179      * @hide
180      */
181     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
182     public static final String ACTION_LOCATION_SCANNING_SETTINGS =
183             "android.settings.LOCATION_SCANNING_SETTINGS";
184 
185     /**
186      * Activity Action: Show settings to allow configuration of users.
187      * <p>
188      * In some cases, a matching Activity may not exist, so ensure you
189      * safeguard against this.
190      * <p>
191      * Input: Nothing.
192      * <p>
193      * Output: Nothing.
194      * @hide
195      */
196     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
197     public static final String ACTION_USER_SETTINGS =
198             "android.settings.USER_SETTINGS";
199 
200     /**
201      * Activity Action: Show settings to allow configuration of wireless controls
202      * such as Wi-Fi, Bluetooth and Mobile networks.
203      * <p>
204      * In some cases, a matching Activity may not exist, so ensure you
205      * safeguard against this.
206      * <p>
207      * Input: Nothing.
208      * <p>
209      * Output: Nothing.
210      */
211     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
212     public static final String ACTION_WIRELESS_SETTINGS =
213             "android.settings.WIRELESS_SETTINGS";
214 
215     /**
216      * Activity Action: Show tether provisioning activity.
217      *
218      * <p>
219      * In some cases, a matching Activity may not exist, so ensure you
220      * safeguard against this.
221      * <p>
222      * Input: {@link ConnectivityManager#EXTRA_TETHER_TYPE} should be included to specify which type
223      * of tethering should be checked. {@link ConnectivityManager#EXTRA_PROVISION_CALLBACK} should
224      * contain a {@link ResultReceiver} which will be called back with a tether result code.
225      * <p>
226      * Output: The result of the provisioning check.
227      * {@link ConnectivityManager#TETHER_ERROR_NO_ERROR} if successful,
228      * {@link ConnectivityManager#TETHER_ERROR_PROVISION_FAILED} for failure.
229      *
230      * @hide
231      */
232     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
233     @SystemApi
234     @TestApi
235     public static final String ACTION_TETHER_PROVISIONING_UI =
236             "android.settings.TETHER_PROVISIONING_UI";
237 
238     /**
239      * Activity Action: Show settings to allow entering/exiting airplane mode.
240      * <p>
241      * In some cases, a matching Activity may not exist, so ensure you
242      * safeguard against this.
243      * <p>
244      * Input: Nothing.
245      * <p>
246      * Output: Nothing.
247      */
248     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
249     public static final String ACTION_AIRPLANE_MODE_SETTINGS =
250             "android.settings.AIRPLANE_MODE_SETTINGS";
251 
252     /**
253      * Activity Action: Show mobile data usage list.
254      * <p>
255      * Input: {@link EXTRA_NETWORK_TEMPLATE} and {@link EXTRA_SUB_ID} should be included to specify
256      * how and what mobile data statistics should be collected.
257      * <p>
258      * Output: Nothing
259      * @hide
260      */
261     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
262     public static final String ACTION_MOBILE_DATA_USAGE =
263             "android.settings.MOBILE_DATA_USAGE";
264 
265     /** @hide */
266     public static final String EXTRA_NETWORK_TEMPLATE = "network_template";
267 
268     /**
269      * An int extra specifying a subscription ID.
270      *
271      * @see android.telephony.SubscriptionInfo#getSubscriptionId
272      */
273     public static final String EXTRA_SUB_ID = "android.provider.extra.SUB_ID";
274 
275     /**
276      * Activity Action: Modify Airplane mode settings using a voice command.
277      * <p>
278      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
279      * <p>
280      * This intent MUST be started using
281      * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
282      * startVoiceActivity}.
283      * <p>
284      * Note: The activity implementing this intent MUST verify that
285      * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
286      * modifying the setting.
287      * <p>
288      * Input: To tell which state airplane mode should be set to, add the
289      * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified.
290      * If the extra is not included, no changes will be made.
291      * <p>
292      * Output: Nothing.
293      */
294     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
295     public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE =
296             "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
297 
298     /**
299      * Activity Action: Show settings for accessibility modules.
300      * <p>
301      * In some cases, a matching Activity may not exist, so ensure you
302      * safeguard against this.
303      * <p>
304      * Input: Nothing.
305      * <p>
306      * Output: Nothing.
307      */
308     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
309     public static final String ACTION_ACCESSIBILITY_SETTINGS =
310             "android.settings.ACCESSIBILITY_SETTINGS";
311 
312     /**
313      * Activity Action: Show detail settings of a particular accessibility service.
314      * <p>
315      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
316      * <p>
317      * Input: {@link Intent#EXTRA_COMPONENT_NAME} must specify the accessibility service component
318      * name to be shown.
319      * <p>
320      * Output: Nothing.
321      * @hide
322      **/
323     @SystemApi
324     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
325     public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS =
326             "android.settings.ACCESSIBILITY_DETAILS_SETTINGS";
327 
328     /**
329      * Activity Action: Show settings to control access to usage information.
330      * <p>
331      * In some cases, a matching Activity may not exist, so ensure you
332      * safeguard against this.
333      * <p>
334      * Input: Nothing.
335      * <p>
336      * Output: Nothing.
337      */
338     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
339     public static final String ACTION_USAGE_ACCESS_SETTINGS =
340             "android.settings.USAGE_ACCESS_SETTINGS";
341 
342     /**
343      * Activity Category: Show application settings related to usage access.
344      * <p>
345      * An activity that provides a user interface for adjusting usage access related
346      * preferences for its containing application. Optional but recommended for apps that
347      * use {@link android.Manifest.permission#PACKAGE_USAGE_STATS}.
348      * <p>
349      * The activity may define meta-data to describe what usage access is
350      * used for within their app with {@link #METADATA_USAGE_ACCESS_REASON}, which
351      * will be displayed in Settings.
352      * <p>
353      * Input: Nothing.
354      * <p>
355      * Output: Nothing.
356      */
357     @SdkConstant(SdkConstantType.INTENT_CATEGORY)
358     public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG =
359             "android.intent.category.USAGE_ACCESS_CONFIG";
360 
361     /**
362      * Metadata key: Reason for needing usage access.
363      * <p>
364      * A key for metadata attached to an activity that receives action
365      * {@link #INTENT_CATEGORY_USAGE_ACCESS_CONFIG}, shown to the
366      * user as description of how the app uses usage access.
367      * <p>
368      */
369     public static final String METADATA_USAGE_ACCESS_REASON =
370             "android.settings.metadata.USAGE_ACCESS_REASON";
371 
372     /**
373      * Activity Action: Show settings to allow configuration of security and
374      * location privacy.
375      * <p>
376      * In some cases, a matching Activity may not exist, so ensure you
377      * safeguard against this.
378      * <p>
379      * Input: Nothing.
380      * <p>
381      * Output: Nothing.
382      */
383     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
384     public static final String ACTION_SECURITY_SETTINGS =
385             "android.settings.SECURITY_SETTINGS";
386 
387     /**
388      * Activity Action: Show settings to allow configuration of trusted external sources
389      *
390      * Input: Optionally, the Intent's data URI can specify the application package name to
391      * directly invoke the management GUI specific to the package name. For example
392      * "package:com.my.app".
393      * <p>
394      * Output: Nothing.
395      */
396     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
397     public static final String ACTION_MANAGE_UNKNOWN_APP_SOURCES =
398             "android.settings.MANAGE_UNKNOWN_APP_SOURCES";
399 
400     /**
401      * Activity Action: Show the "Open by Default" page in a particular application's details page.
402      * <p>
403      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
404      * <p>
405      * Input: The Intent's data URI specifies the application package name
406      * to be shown, with the "package" scheme. That is "package:com.my.app".
407      * <p>
408      * Output: Nothing.
409      * @hide
410      */
411     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
412     public static final String ACTION_APP_OPEN_BY_DEFAULT_SETTINGS =
413             "com.android.settings.APP_OPEN_BY_DEFAULT_SETTINGS";
414 
415     /**
416      * Activity Action: Show trusted credentials settings, opening to the user tab,
417      * to allow management of installed credentials.
418      * <p>
419      * In some cases, a matching Activity may not exist, so ensure you
420      * safeguard against this.
421      * <p>
422      * Input: Nothing.
423      * <p>
424      * Output: Nothing.
425      * @hide
426      */
427     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
428     @UnsupportedAppUsage
429     public static final String ACTION_TRUSTED_CREDENTIALS_USER =
430             "com.android.settings.TRUSTED_CREDENTIALS_USER";
431 
432     /**
433      * Activity Action: Show dialog explaining that an installed CA cert may enable
434      * monitoring of encrypted network traffic.
435      * <p>
436      * In some cases, a matching Activity may not exist, so ensure you
437      * safeguard against this. Add {@link #EXTRA_NUMBER_OF_CERTIFICATES} extra to indicate the
438      * number of certificates.
439      * <p>
440      * Input: Nothing.
441      * <p>
442      * Output: Nothing.
443      * @hide
444      */
445     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
446     public static final String ACTION_MONITORING_CERT_INFO =
447             "com.android.settings.MONITORING_CERT_INFO";
448 
449     /**
450      * Activity Action: Show settings to allow configuration of privacy options.
451      * <p>
452      * In some cases, a matching Activity may not exist, so ensure you
453      * safeguard against this.
454      * <p>
455      * Input: Nothing.
456      * <p>
457      * Output: Nothing.
458      */
459     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
460     public static final String ACTION_PRIVACY_SETTINGS =
461             "android.settings.PRIVACY_SETTINGS";
462 
463     /**
464      * Activity Action: Show settings to allow configuration of VPN.
465      * <p>
466      * In some cases, a matching Activity may not exist, so ensure you
467      * safeguard against this.
468      * <p>
469      * Input: Nothing.
470      * <p>
471      * Output: Nothing.
472      */
473     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
474     public static final String ACTION_VPN_SETTINGS =
475             "android.settings.VPN_SETTINGS";
476 
477     /**
478      * Activity Action: Show settings to allow configuration of Wi-Fi.
479      * <p>
480      * In some cases, a matching Activity may not exist, so ensure you
481      * safeguard against this.
482      * <p>
483      * Input: Nothing.
484      * <p>
485      * Output: Nothing.
486      */
487     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
488     public static final String ACTION_WIFI_SETTINGS =
489             "android.settings.WIFI_SETTINGS";
490 
491     /**
492      * Activity Action: Show settings to allow configuration of a static IP
493      * address for Wi-Fi.
494      * <p>
495      * In some cases, a matching Activity may not exist, so ensure you safeguard
496      * against this.
497      * <p>
498      * Input: Nothing.
499      * <p>
500      * Output: Nothing.
501      */
502     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
503     public static final String ACTION_WIFI_IP_SETTINGS =
504             "android.settings.WIFI_IP_SETTINGS";
505 
506     /**
507      * Activity Action: Show setting page to process an Easy Connect (Wi-Fi DPP) QR code and start
508      * configuration. This intent should be used when you want to use this device to take on the
509      * configurator role for an IoT/other device. When provided with a valid DPP URI string Settings
510      * will open a wifi selection screen for the user to indicate which network they would like
511      * to configure the device specified in the DPP URI string for and carry them through the rest
512      * of the flow for provisioning the device.
513      * <p>
514      * In some cases, a matching Activity may not exist, so ensure you safeguard
515      * against this by checking WifiManager.isEasyConnectSupported();
516      * <p>
517      * Input: The Intent's data URI specifies bootstrapping information for authenticating and
518      * provisioning the peer, with the "DPP" scheme.
519      * <p>
520      * Output: After {@code startActivityForResult}, the callback {@code onActivityResult} will have
521      *         resultCode {@link android.app.Activity#RESULT_OK} if Wi-Fi Easy Connect configuration
522      *         success and the user clicks 'Done' button.
523      */
524     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
525     public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_URI =
526             "android.settings.PROCESS_WIFI_EASY_CONNECT_URI";
527 
528     /**
529      * Activity Action: Show settings to allow configuration of data and view data usage.
530      * <p>
531      * In some cases, a matching Activity may not exist, so ensure you
532      * safeguard against this.
533      * <p>
534      * Input: Nothing.
535      * <p>
536      * Output: Nothing.
537      */
538     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
539     public static final String ACTION_DATA_USAGE_SETTINGS =
540             "android.settings.DATA_USAGE_SETTINGS";
541 
542     /**
543      * Activity Action: Show settings to allow configuration of Bluetooth.
544      * <p>
545      * In some cases, a matching Activity may not exist, so ensure you
546      * safeguard against this.
547      * <p>
548      * Input: Nothing.
549      * <p>
550      * Output: Nothing.
551      */
552     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
553     public static final String ACTION_BLUETOOTH_SETTINGS =
554             "android.settings.BLUETOOTH_SETTINGS";
555 
556     /**
557      * Activity action: Show Settings app search UI when this action is available for device.
558      * <p>
559      * Input: Nothing.
560      * <p>
561      * Output: Nothing.
562      */
563     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
564     public static final String ACTION_APP_SEARCH_SETTINGS = "android.settings.APP_SEARCH_SETTINGS";
565 
566     /**
567      * Activity Action: Show settings to allow configuration of Assist Gesture.
568      * <p>
569      * In some cases, a matching Activity may not exist, so ensure you
570      * safeguard against this.
571      * <p>
572      * Input: Nothing.
573      * <p>
574      * Output: Nothing.
575      * @hide
576      */
577     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
578     public static final String ACTION_ASSIST_GESTURE_SETTINGS =
579             "android.settings.ASSIST_GESTURE_SETTINGS";
580 
581     /**
582      * Activity Action: Show settings to enroll fingerprints, and setup PIN/Pattern/Pass if
583      * necessary.
584      * <p>
585      * Input: Nothing.
586      * <p>
587      * Output: Nothing.
588      */
589     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
590     public static final String ACTION_FINGERPRINT_ENROLL =
591             "android.settings.FINGERPRINT_ENROLL";
592 
593     /**
594      * Activity Action: Show settings to allow configuration of cast endpoints.
595      * <p>
596      * In some cases, a matching Activity may not exist, so ensure you
597      * safeguard against this.
598      * <p>
599      * Input: Nothing.
600      * <p>
601      * Output: Nothing.
602      */
603     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
604     public static final String ACTION_CAST_SETTINGS =
605             "android.settings.CAST_SETTINGS";
606 
607     /**
608      * Activity Action: Show settings to allow configuration of date and time.
609      * <p>
610      * In some cases, a matching Activity may not exist, so ensure you
611      * safeguard against this.
612      * <p>
613      * Input: Nothing.
614      * <p>
615      * Output: Nothing.
616      */
617     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
618     public static final String ACTION_DATE_SETTINGS =
619             "android.settings.DATE_SETTINGS";
620 
621     /**
622      * Activity Action: Show settings to allow configuration of sound and volume.
623      * <p>
624      * In some cases, a matching Activity may not exist, so ensure you
625      * safeguard against this.
626      * <p>
627      * Input: Nothing.
628      * <p>
629      * Output: Nothing.
630      */
631     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
632     public static final String ACTION_SOUND_SETTINGS =
633             "android.settings.SOUND_SETTINGS";
634 
635     /**
636      * Activity Action: Show settings to allow configuration of display.
637      * <p>
638      * In some cases, a matching Activity may not exist, so ensure you
639      * safeguard against this.
640      * <p>
641      * Input: Nothing.
642      * <p>
643      * Output: Nothing.
644      */
645     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
646     public static final String ACTION_DISPLAY_SETTINGS =
647             "android.settings.DISPLAY_SETTINGS";
648 
649     /**
650      * Activity Action: Show settings to allow configuration of Night display.
651      * <p>
652      * In some cases, a matching Activity may not exist, so ensure you
653      * safeguard against this.
654      * <p>
655      * Input: Nothing.
656      * <p>
657      * Output: Nothing.
658      */
659     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
660     public static final String ACTION_NIGHT_DISPLAY_SETTINGS =
661             "android.settings.NIGHT_DISPLAY_SETTINGS";
662 
663     /**
664      * Activity Action: Show settings to allow configuration of Dark theme.
665      * <p>
666      * In some cases, a matching Activity may not exist, so ensure you
667      * safeguard against this.
668      * <p>
669      * Input: Nothing.
670      * <p>
671      * Output: Nothing.
672      *
673      * @hide
674      */
675     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
676     public static final String ACTION_DARK_THEME_SETTINGS =
677             "android.settings.DARK_THEME_SETTINGS";
678 
679     /**
680      * Activity Action: Show settings to allow configuration of locale.
681      * <p>
682      * In some cases, a matching Activity may not exist, so ensure you
683      * safeguard against this.
684      * <p>
685      * Input: Nothing.
686      * <p>
687      * Output: Nothing.
688      */
689     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
690     public static final String ACTION_LOCALE_SETTINGS =
691             "android.settings.LOCALE_SETTINGS";
692 
693     /**
694      * Activity Action: Show settings to configure input methods, in particular
695      * allowing the user to enable input methods.
696      * <p>
697      * In some cases, a matching Activity may not exist, so ensure you
698      * safeguard against this.
699      * <p>
700      * Input: Nothing.
701      * <p>
702      * Output: Nothing.
703      */
704     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
705     public static final String ACTION_VOICE_INPUT_SETTINGS =
706             "android.settings.VOICE_INPUT_SETTINGS";
707 
708     /**
709      * Activity Action: Show settings to configure input methods, in particular
710      * allowing the user to enable input methods.
711      * <p>
712      * In some cases, a matching Activity may not exist, so ensure you
713      * safeguard against this.
714      * <p>
715      * Input: Nothing.
716      * <p>
717      * Output: Nothing.
718      */
719     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
720     public static final String ACTION_INPUT_METHOD_SETTINGS =
721             "android.settings.INPUT_METHOD_SETTINGS";
722 
723     /**
724      * Activity Action: Show settings to enable/disable input method subtypes.
725      * <p>
726      * In some cases, a matching Activity may not exist, so ensure you
727      * safeguard against this.
728      * <p>
729      * To tell which input method's subtypes are displayed in the settings, add
730      * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
731      * If there is no extra in this Intent, subtypes from all installed input methods
732      * will be displayed in the settings.
733      *
734      * @see android.view.inputmethod.InputMethodInfo#getId
735      * <p>
736      * Input: Nothing.
737      * <p>
738      * Output: Nothing.
739      */
740     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
741     public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
742             "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
743 
744     /**
745      * Activity Action: Show settings to manage the user input dictionary.
746      * <p>
747      * Starting with {@link android.os.Build.VERSION_CODES#KITKAT},
748      * it is guaranteed there will always be an appropriate implementation for this Intent action.
749      * In prior releases of the platform this was optional, so ensure you safeguard against it.
750      * <p>
751      * Input: Nothing.
752      * <p>
753      * Output: Nothing.
754      */
755     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
756     public static final String ACTION_USER_DICTIONARY_SETTINGS =
757             "android.settings.USER_DICTIONARY_SETTINGS";
758 
759     /**
760      * Activity Action: Show settings to configure the hardware keyboard.
761      * <p>
762      * In some cases, a matching Activity may not exist, so ensure you
763      * safeguard against this.
764      * <p>
765      * Input: Nothing.
766      * <p>
767      * Output: Nothing.
768      */
769     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
770     public static final String ACTION_HARD_KEYBOARD_SETTINGS =
771             "android.settings.HARD_KEYBOARD_SETTINGS";
772 
773     /**
774      * Activity Action: Adds a word to the user dictionary.
775      * <p>
776      * In some cases, a matching Activity may not exist, so ensure you
777      * safeguard against this.
778      * <p>
779      * Input: An extra with key <code>word</code> that contains the word
780      * that should be added to the dictionary.
781      * <p>
782      * Output: Nothing.
783      *
784      * @hide
785      */
786     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
787     @UnsupportedAppUsage
788     public static final String ACTION_USER_DICTIONARY_INSERT =
789             "com.android.settings.USER_DICTIONARY_INSERT";
790 
791     /**
792      * Activity Action: Show settings to allow configuration of application-related settings.
793      * <p>
794      * In some cases, a matching Activity may not exist, so ensure you
795      * safeguard against this.
796      * <p>
797      * Input: Nothing.
798      * <p>
799      * Output: Nothing.
800      */
801     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
802     public static final String ACTION_APPLICATION_SETTINGS =
803             "android.settings.APPLICATION_SETTINGS";
804 
805     /**
806      * Activity Action: Show settings to allow configuration of application
807      * development-related settings.  As of
808      * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
809      * a required part of the platform.
810      * <p>
811      * Input: Nothing.
812      * <p>
813      * Output: Nothing.
814      */
815     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
816     public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
817             "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
818 
819     /**
820      * Activity Action: Show settings to allow configuration of quick launch shortcuts.
821      * <p>
822      * In some cases, a matching Activity may not exist, so ensure you
823      * safeguard against this.
824      * <p>
825      * Input: Nothing.
826      * <p>
827      * Output: Nothing.
828      */
829     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
830     public static final String ACTION_QUICK_LAUNCH_SETTINGS =
831             "android.settings.QUICK_LAUNCH_SETTINGS";
832 
833     /**
834      * Activity Action: Show settings to manage installed applications.
835      * <p>
836      * In some cases, a matching Activity may not exist, so ensure you
837      * safeguard against this.
838      * <p>
839      * Input: Nothing.
840      * <p>
841      * Output: Nothing.
842      */
843     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
844     public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
845             "android.settings.MANAGE_APPLICATIONS_SETTINGS";
846 
847     /**
848      * Activity Action: Show settings to manage all applications.
849      * <p>
850      * In some cases, a matching Activity may not exist, so ensure you
851      * safeguard against this.
852      * <p>
853      * Input: Nothing.
854      * <p>
855      * Output: Nothing.
856      */
857     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
858     public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
859             "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
860 
861     /**
862      * Activity Action: Show screen for controlling which apps can draw on top of other apps.
863      * <p>
864      * In some cases, a matching Activity may not exist, so ensure you
865      * safeguard against this.
866      * <p>
867      * Input: Optionally, the Intent's data URI can specify the application package name to
868      * directly invoke the management GUI specific to the package name. For example
869      * "package:com.my.app".
870      * <p>
871      * Output: Nothing.
872      */
873     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
874     public static final String ACTION_MANAGE_OVERLAY_PERMISSION =
875             "android.settings.action.MANAGE_OVERLAY_PERMISSION";
876 
877     /**
878      * Activity Action: Show screen for controlling which apps are allowed to write/modify
879      * system settings.
880      * <p>
881      * In some cases, a matching Activity may not exist, so ensure you
882      * safeguard against this.
883      * <p>
884      * Input: Optionally, the Intent's data URI can specify the application package name to
885      * directly invoke the management GUI specific to the package name. For example
886      * "package:com.my.app".
887      * <p>
888      * Output: Nothing.
889      */
890     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
891     public static final String ACTION_MANAGE_WRITE_SETTINGS =
892             "android.settings.action.MANAGE_WRITE_SETTINGS";
893 
894     /**
895      * Activity Action: Show screen for controlling app usage properties for an app.
896      * Input: Intent's extra {@link android.content.Intent#EXTRA_PACKAGE_NAME} must specify the
897      * application package name.
898      * Output: Nothing.
899      */
900     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
901     public static final String ACTION_APP_USAGE_SETTINGS =
902             "android.settings.action.APP_USAGE_SETTINGS";
903 
904     /**
905      * Activity Action: Show screen of details about a particular application.
906      * <p>
907      * In some cases, a matching Activity may not exist, so ensure you
908      * safeguard against this.
909      * <p>
910      * Input: The Intent's data URI specifies the application package name
911      * to be shown, with the "package" scheme.  That is "package:com.my.app".
912      * <p>
913      * Output: Nothing.
914      */
915     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
916     public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
917             "android.settings.APPLICATION_DETAILS_SETTINGS";
918 
919     /**
920      * Activity Action: Show list of applications that have been running
921      * foreground services (to the user "running in the background").
922      * <p>
923      * Input: Extras "packages" is a string array of package names.
924      * <p>
925      * Output: Nothing.
926      * @hide
927      */
928     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
929     public static final String ACTION_FOREGROUND_SERVICES_SETTINGS =
930             "android.settings.FOREGROUND_SERVICES_SETTINGS";
931 
932     /**
933      * Activity Action: Show screen for controlling which apps can ignore battery optimizations.
934      * <p>
935      * Input: Nothing.
936      * <p>
937      * Output: Nothing.
938      * <p>
939      * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
940      * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
941      * already ignoring optimizations.  You can use
942      * {@link #ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} to ask the user to put you
943      * on this list.
944      */
945     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
946     public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS =
947             "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS";
948 
949     /**
950      * Activity Action: Ask the user to allow an app to ignore battery optimizations (that is,
951      * put them on the whitelist of apps shown by
952      * {@link #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}).  For an app to use this, it also
953      * must hold the {@link android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}
954      * permission.
955      * <p><b>Note:</b> most applications should <em>not</em> use this; there are many facilities
956      * provided by the platform for applications to operate correctly in the various power
957      * saving modes.  This is only for unusual applications that need to deeply control their own
958      * execution, at the potential expense of the user's battery life.  Note that these applications
959      * greatly run the risk of showing to the user as high power consumers on their device.</p>
960      * <p>
961      * Input: The Intent's data URI must specify the application package name
962      * to be shown, with the "package" scheme.  That is "package:com.my.app".
963      * <p>
964      * Output: Nothing.
965      * <p>
966      * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
967      * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
968      * already ignoring optimizations.
969      */
970     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
971     public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS =
972             "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
973 
974     /**
975      * Activity Action: Open the advanced power usage details page of an associated app.
976      * <p>
977      * Input: Intent's data URI set with an application name, using the
978      * "package" schema (like "package:com.my.app")
979      * <p>
980      * Output: Nothing.
981      *
982      * @hide
983      */
984     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
985     public static final String ACTION_VIEW_ADVANCED_POWER_USAGE_DETAIL =
986             "android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL";
987 
988     /**
989      * Activity Action: Show screen for controlling background data
990      * restrictions for a particular application.
991      * <p>
992      * Input: Intent's data URI set with an application name, using the
993      * "package" schema (like "package:com.my.app").
994      *
995      * <p>
996      * Output: Nothing.
997      * <p>
998      * Applications can also use {@link android.net.ConnectivityManager#getRestrictBackgroundStatus
999      * ConnectivityManager#getRestrictBackgroundStatus()} to determine the
1000      * status of the background data restrictions for them.
1001      *
1002      * <p class="note">
1003      * In some cases, a matching Activity may not exist, so ensure you
1004      * safeguard against this.
1005      */
1006     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1007     public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS =
1008             "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS";
1009 
1010     /**
1011      * @hide
1012      * Activity Action: Show the "app ops" settings screen.
1013      * <p>
1014      * Input: Nothing.
1015      * <p>
1016      * Output: Nothing.
1017      */
1018     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1019     public static final String ACTION_APP_OPS_SETTINGS =
1020             "android.settings.APP_OPS_SETTINGS";
1021 
1022     /**
1023      * Activity Action: Show settings for system update functionality.
1024      * <p>
1025      * In some cases, a matching Activity may not exist, so ensure you
1026      * safeguard against this.
1027      * <p>
1028      * Input: Nothing.
1029      * <p>
1030      * Output: Nothing.
1031      *
1032      * @hide
1033      */
1034     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1035     public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
1036             "android.settings.SYSTEM_UPDATE_SETTINGS";
1037 
1038     /**
1039      * Activity Action: Show settings for managed profile settings.
1040      * <p>
1041      * In some cases, a matching Activity may not exist, so ensure you
1042      * safeguard against this.
1043      * <p>
1044      * Input: Nothing.
1045      * <p>
1046      * Output: Nothing.
1047      *
1048      * @hide
1049      */
1050     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1051     public static final String ACTION_MANAGED_PROFILE_SETTINGS =
1052             "android.settings.MANAGED_PROFILE_SETTINGS";
1053 
1054     /**
1055      * Activity Action: Show settings to allow configuration of sync settings.
1056      * <p>
1057      * In some cases, a matching Activity may not exist, so ensure you
1058      * safeguard against this.
1059      * <p>
1060      * The account types available to add via the add account button may be restricted by adding an
1061      * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
1062      * authorities. Only account types which can sync with that content provider will be offered to
1063      * the user.
1064      * <p>
1065      * Input: Nothing.
1066      * <p>
1067      * Output: Nothing.
1068      */
1069     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1070     public static final String ACTION_SYNC_SETTINGS =
1071             "android.settings.SYNC_SETTINGS";
1072 
1073     /**
1074      * Activity Action: Show add account screen for creating a new account.
1075      * <p>
1076      * In some cases, a matching Activity may not exist, so ensure you
1077      * safeguard against this.
1078      * <p>
1079      * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
1080      * extra to the Intent with one or more syncable content provider's authorities.  Only account
1081      * types which can sync with that content provider will be offered to the user.
1082      * <p>
1083      * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the
1084      * Intent with one or more account types.
1085      * <p>
1086      * Input: Nothing.
1087      * <p>
1088      * Output: Nothing.
1089      */
1090     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1091     public static final String ACTION_ADD_ACCOUNT =
1092             "android.settings.ADD_ACCOUNT_SETTINGS";
1093 
1094     /**
1095      * Activity Action: Show settings for enabling or disabling data saver
1096      * <p></p>
1097      * In some cases, a matching Activity may not exist, so ensure you
1098      * safeguard against this.
1099      * <p>
1100      * Input: Nothing.
1101      * <p>
1102      * Output: Nothing.
1103      *
1104      * @hide
1105      */
1106     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1107     public static final String ACTION_DATA_SAVER_SETTINGS =
1108             "android.settings.DATA_SAVER_SETTINGS";
1109 
1110     /**
1111      * Activity Action: Show settings for selecting the network operator.
1112      * <p>
1113      * In some cases, a matching Activity may not exist, so ensure you
1114      * safeguard against this.
1115      * <p>
1116      * The subscription ID of the subscription for which available network operators should be
1117      * displayed may be optionally specified with {@link #EXTRA_SUB_ID}.
1118      * <p>
1119      * Input: Nothing.
1120      * <p>
1121      * Output: Nothing.
1122      */
1123     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1124     public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
1125             "android.settings.NETWORK_OPERATOR_SETTINGS";
1126 
1127     /**
1128      * Activity Action: Show settings for selection of 2G/3G.
1129      * <p>
1130      * In some cases, a matching Activity may not exist, so ensure you
1131      * safeguard against this.
1132      * <p>
1133      * Input: Nothing.
1134      * <p>
1135      * Output: Nothing.
1136      */
1137     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1138     public static final String ACTION_DATA_ROAMING_SETTINGS =
1139             "android.settings.DATA_ROAMING_SETTINGS";
1140 
1141     /**
1142      * Activity Action: Show settings for internal storage.
1143      * <p>
1144      * In some cases, a matching Activity may not exist, so ensure you
1145      * safeguard against this.
1146      * <p>
1147      * Input: Nothing.
1148      * <p>
1149      * Output: Nothing.
1150      */
1151     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1152     public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
1153             "android.settings.INTERNAL_STORAGE_SETTINGS";
1154     /**
1155      * Activity Action: Show settings for memory card storage.
1156      * <p>
1157      * In some cases, a matching Activity may not exist, so ensure you
1158      * safeguard against this.
1159      * <p>
1160      * Input: Nothing.
1161      * <p>
1162      * Output: Nothing.
1163      */
1164     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1165     public static final String ACTION_MEMORY_CARD_SETTINGS =
1166             "android.settings.MEMORY_CARD_SETTINGS";
1167 
1168     /**
1169      * Activity Action: Show settings for global search.
1170      * <p>
1171      * In some cases, a matching Activity may not exist, so ensure you
1172      * safeguard against this.
1173      * <p>
1174      * Input: Nothing.
1175      * <p>
1176      * Output: Nothing
1177      */
1178     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1179     public static final String ACTION_SEARCH_SETTINGS =
1180         "android.search.action.SEARCH_SETTINGS";
1181 
1182     /**
1183      * Activity Action: Show general device information settings (serial
1184      * number, software version, phone number, etc.).
1185      * <p>
1186      * In some cases, a matching Activity may not exist, so ensure you
1187      * safeguard against this.
1188      * <p>
1189      * Input: Nothing.
1190      * <p>
1191      * Output: Nothing
1192      */
1193     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1194     public static final String ACTION_DEVICE_INFO_SETTINGS =
1195         "android.settings.DEVICE_INFO_SETTINGS";
1196 
1197     /**
1198      * Activity Action: Show NFC settings.
1199      * <p>
1200      * This shows UI that allows NFC to be turned on or off.
1201      * <p>
1202      * In some cases, a matching Activity may not exist, so ensure you
1203      * safeguard against this.
1204      * <p>
1205      * Input: Nothing.
1206      * <p>
1207      * Output: Nothing
1208      * @see android.nfc.NfcAdapter#isEnabled()
1209      */
1210     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1211     public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
1212 
1213     /**
1214      * Activity Action: Show NFC Sharing settings.
1215      * <p>
1216      * This shows UI that allows NDEF Push (Android Beam) to be turned on or
1217      * off.
1218      * <p>
1219      * In some cases, a matching Activity may not exist, so ensure you
1220      * safeguard against this.
1221      * <p>
1222      * Input: Nothing.
1223      * <p>
1224      * Output: Nothing
1225      * @see android.nfc.NfcAdapter#isNdefPushEnabled()
1226      */
1227     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1228     public static final String ACTION_NFCSHARING_SETTINGS =
1229         "android.settings.NFCSHARING_SETTINGS";
1230 
1231     /**
1232      * Activity Action: Show NFC Tap & Pay settings
1233      * <p>
1234      * This shows UI that allows the user to configure Tap&Pay
1235      * settings.
1236      * <p>
1237      * In some cases, a matching Activity may not exist, so ensure you
1238      * safeguard against this.
1239      * <p>
1240      * Input: Nothing.
1241      * <p>
1242      * Output: Nothing
1243      */
1244     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1245     public static final String ACTION_NFC_PAYMENT_SETTINGS =
1246         "android.settings.NFC_PAYMENT_SETTINGS";
1247 
1248     /**
1249      * Activity Action: Show Daydream settings.
1250      * <p>
1251      * In some cases, a matching Activity may not exist, so ensure you
1252      * safeguard against this.
1253      * <p>
1254      * Input: Nothing.
1255      * <p>
1256      * Output: Nothing.
1257      * @see android.service.dreams.DreamService
1258      */
1259     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1260     public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
1261 
1262     /**
1263      * Activity Action: Show Notification assistant settings.
1264      * <p>
1265      * In some cases, a matching Activity may not exist, so ensure you
1266      * safeguard against this.
1267      * <p>
1268      * Input: Nothing.
1269      * <p>
1270      * Output: Nothing.
1271      * @see android.service.notification.NotificationAssistantService
1272      */
1273     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1274     public static final String ACTION_NOTIFICATION_ASSISTANT_SETTINGS =
1275             "android.settings.NOTIFICATION_ASSISTANT_SETTINGS";
1276 
1277     /**
1278      * Activity Action: Show Notification listener settings.
1279      * <p>
1280      * In some cases, a matching Activity may not exist, so ensure you
1281      * safeguard against this.
1282      * <p>
1283      * Input: Nothing.
1284      * <p>
1285      * Output: Nothing.
1286      * @see android.service.notification.NotificationListenerService
1287      */
1288     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1289     public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS
1290             = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
1291 
1292     /**
1293      * Activity Action: Show Do Not Disturb access settings.
1294      * <p>
1295      * Users can grant and deny access to Do Not Disturb configuration from here. Managed
1296      * profiles cannot grant Do Not Disturb access.
1297      * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more
1298      * details.
1299      * <p>
1300      * Input: Nothing.
1301      * <p>
1302      * Output: Nothing.
1303      *
1304      * <p class="note">
1305      * In some cases, a matching Activity may not exist, so ensure you
1306      * safeguard against this.
1307      */
1308     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1309     public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS
1310             = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
1311 
1312     /**
1313      * Activity Action: Show do not disturb setting page for app.
1314      * <p>
1315      * Users can grant and deny access to Do Not Disturb configuration for an app from here.
1316      * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more
1317      * details.
1318      * <p>
1319      * Input: Intent's data URI set with an application name, using the
1320      * "package" schema (like "package:com.my.app").
1321      * <p>
1322      * Output: Nothing.
1323      *
1324      * @hide
1325      */
1326     @SystemApi
1327     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1328     public static final String ACTION_NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS =
1329             "android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS";
1330 
1331     /**
1332      * @hide
1333      */
1334     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1335     public static final String ACTION_CONDITION_PROVIDER_SETTINGS
1336             = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
1337 
1338     /**
1339      * Activity Action: Show settings for video captioning.
1340      * <p>
1341      * In some cases, a matching Activity may not exist, so ensure you safeguard
1342      * against this.
1343      * <p>
1344      * Input: Nothing.
1345      * <p>
1346      * Output: Nothing.
1347      */
1348     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1349     public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
1350 
1351     /**
1352      * Activity Action: Show the top level print settings.
1353      * <p>
1354      * In some cases, a matching Activity may not exist, so ensure you
1355      * safeguard against this.
1356      * <p>
1357      * Input: Nothing.
1358      * <p>
1359      * Output: Nothing.
1360      */
1361     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1362     public static final String ACTION_PRINT_SETTINGS =
1363             "android.settings.ACTION_PRINT_SETTINGS";
1364 
1365     /**
1366      * Activity Action: Show Zen Mode configuration settings.
1367      *
1368      * @hide
1369      */
1370     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1371     public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS";
1372 
1373     /**
1374      * Activity Action: Show Zen Mode visual effects configuration settings.
1375      *
1376      * @hide
1377      */
1378     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1379     public static final String ZEN_MODE_BLOCKED_EFFECTS_SETTINGS =
1380             "android.settings.ZEN_MODE_BLOCKED_EFFECTS_SETTINGS";
1381 
1382     /**
1383      * Activity Action: Show Zen Mode onboarding activity.
1384      *
1385      * @hide
1386      */
1387     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1388     public static final String ZEN_MODE_ONBOARDING = "android.settings.ZEN_MODE_ONBOARDING";
1389 
1390     /**
1391      * Activity Action: Show Zen Mode (aka Do Not Disturb) priority configuration settings.
1392      */
1393     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1394     public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS
1395             = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
1396 
1397     /**
1398      * Activity Action: Show Zen Mode automation configuration settings.
1399      *
1400      * @hide
1401      */
1402     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1403     public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS
1404             = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS";
1405 
1406     /**
1407      * Activity Action: Modify do not disturb mode settings.
1408      * <p>
1409      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
1410      * <p>
1411      * This intent MUST be started using
1412      * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
1413      * startVoiceActivity}.
1414      * <p>
1415      * Note: The Activity implementing this intent MUST verify that
1416      * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}.
1417      * returns true before modifying the setting.
1418      * <p>
1419      * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate
1420      * how long the user wishes to avoid interruptions for. The optional
1421      * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is
1422      * enabling or disabling do not disturb mode. If either extra is not included, the
1423      * user maybe asked to provide the value.
1424      * <p>
1425      * Output: Nothing.
1426      */
1427     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1428     public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE =
1429             "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE";
1430 
1431     /**
1432      * Activity Action: Show Zen Mode schedule rule configuration settings.
1433      *
1434      * @hide
1435      */
1436     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1437     public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS
1438             = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS";
1439 
1440     /**
1441      * Activity Action: Show Zen Mode event rule configuration settings.
1442      *
1443      * @hide
1444      */
1445     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1446     public static final String ACTION_ZEN_MODE_EVENT_RULE_SETTINGS
1447             = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS";
1448 
1449     /**
1450      * Activity Action: Show Zen Mode external rule configuration settings.
1451      *
1452      * @hide
1453      */
1454     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1455     public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS
1456             = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS";
1457 
1458     /**
1459      * Activity Action: Show the regulatory information screen for the device.
1460      * <p>
1461      * In some cases, a matching Activity may not exist, so ensure you safeguard
1462      * against this.
1463      * <p>
1464      * Input: Nothing.
1465      * <p>
1466      * Output: Nothing.
1467      */
1468     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1469     public static final String
1470             ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
1471 
1472     /**
1473      * Activity Action: Show Device Name Settings.
1474      * <p>
1475      * In some cases, a matching Activity may not exist, so ensure you safeguard
1476      * against this.
1477      *
1478      * @hide
1479      */
1480     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1481     public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME";
1482 
1483     /**
1484      * Activity Action: Show pairing settings.
1485      * <p>
1486      * In some cases, a matching Activity may not exist, so ensure you safeguard
1487      * against this.
1488      *
1489      * @hide
1490      */
1491     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1492     public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
1493 
1494     /**
1495      * Activity Action: Show battery saver settings.
1496      * <p>
1497      * In some cases, a matching Activity may not exist, so ensure you safeguard
1498      * against this.
1499      */
1500     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1501     public static final String ACTION_BATTERY_SAVER_SETTINGS
1502             = "android.settings.BATTERY_SAVER_SETTINGS";
1503 
1504     /**
1505      * Activity Action: Modify Battery Saver mode setting using a voice command.
1506      * <p>
1507      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
1508      * <p>
1509      * This intent MUST be started using
1510      * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
1511      * startVoiceActivity}.
1512      * <p>
1513      * Note: The activity implementing this intent MUST verify that
1514      * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
1515      * modifying the setting.
1516      * <p>
1517      * Input: To tell which state batter saver mode should be set to, add the
1518      * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified.
1519      * If the extra is not included, no changes will be made.
1520      * <p>
1521      * Output: Nothing.
1522      */
1523     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1524     public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE =
1525             "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE";
1526 
1527     /**
1528      * Activity Action: Show Home selection settings. If there are multiple activities
1529      * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you
1530      * to pick your preferred activity.
1531      */
1532     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1533     public static final String ACTION_HOME_SETTINGS
1534             = "android.settings.HOME_SETTINGS";
1535 
1536     /**
1537      * Activity Action: Show Default apps settings.
1538      * <p>
1539      * In some cases, a matching Activity may not exist, so ensure you
1540      * safeguard against this.
1541      * <p>
1542      * Input: Nothing.
1543      * <p>
1544      * Output: Nothing.
1545      */
1546     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1547     public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS
1548             = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS";
1549 
1550     /**
1551      * Activity Action: Show More default apps settings.
1552      * <p>
1553      * If a Settings activity handles this intent action, a "More defaults" entry will be shown in
1554      * the Default apps settings, and clicking it will launch that activity.
1555      * <p>
1556      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
1557      * <p>
1558      * Input: Nothing.
1559      * <p>
1560      * Output: Nothing.
1561      *
1562      * @hide
1563      */
1564     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1565     @SystemApi
1566     public static final String ACTION_MANAGE_MORE_DEFAULT_APPS_SETTINGS =
1567             "android.settings.MANAGE_MORE_DEFAULT_APPS_SETTINGS";
1568 
1569     /**
1570      * Activity Action: Show notification settings.
1571      *
1572      * @hide
1573      */
1574     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1575     public static final String ACTION_NOTIFICATION_SETTINGS
1576             = "android.settings.NOTIFICATION_SETTINGS";
1577 
1578     /**
1579      * Activity Action: Show app listing settings, filtered by those that send notifications.
1580      *
1581      * @hide
1582      */
1583     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1584     public static final String ACTION_ALL_APPS_NOTIFICATION_SETTINGS =
1585             "android.settings.ALL_APPS_NOTIFICATION_SETTINGS";
1586 
1587     /**
1588      * Activity Action: Show notification settings for a single app.
1589      * <p>
1590      *     Input: {@link #EXTRA_APP_PACKAGE}, the package to display.
1591      * <p>
1592      * Output: Nothing.
1593      */
1594     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1595     public static final String ACTION_APP_NOTIFICATION_SETTINGS
1596             = "android.settings.APP_NOTIFICATION_SETTINGS";
1597 
1598     /**
1599      * Activity Action: Show notification settings for a single {@link NotificationChannel}.
1600      * <p>
1601      *     Input: {@link #EXTRA_APP_PACKAGE}, the package containing the channel to display.
1602      *     Input: {@link #EXTRA_CHANNEL_ID}, the id of the channel to display.
1603      * <p>
1604      * Output: Nothing.
1605      */
1606     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1607     public static final String ACTION_CHANNEL_NOTIFICATION_SETTINGS
1608             = "android.settings.CHANNEL_NOTIFICATION_SETTINGS";
1609 
1610     /**
1611      * Activity Action: Show notification bubble settings for a single app.
1612      * See {@link NotificationManager#areBubblesAllowed()}.
1613      * <p>
1614      *     Input: {@link #EXTRA_APP_PACKAGE}, the package to display.
1615      * <p>
1616      * Output: Nothing.
1617      */
1618     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1619     public static final String ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS
1620             = "android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS";
1621 
1622     /**
1623      * Activity Extra: The package owner of the notification channel settings to display.
1624      * <p>
1625      * This must be passed as an extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}.
1626      */
1627     public static final String EXTRA_APP_PACKAGE = "android.provider.extra.APP_PACKAGE";
1628 
1629     /**
1630      * Activity Extra: The {@link NotificationChannel#getId()} of the notification channel settings
1631      * to display.
1632      * <p>
1633      * This must be passed as an extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}.
1634      */
1635     public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID";
1636 
1637     /**
1638      * Activity Action: Show notification redaction settings.
1639      *
1640      * @hide
1641      */
1642     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1643     public static final String ACTION_APP_NOTIFICATION_REDACTION
1644             = "android.settings.ACTION_APP_NOTIFICATION_REDACTION";
1645 
1646     /** @hide */
1647     @UnsupportedAppUsage
1648     public static final String EXTRA_APP_UID = "app_uid";
1649 
1650     /**
1651      * Activity Action: Show a dialog with disabled by policy message.
1652      * <p> If an user action is disabled by policy, this dialog can be triggered to let
1653      * the user know about this.
1654      * <p>
1655      * Input: {@link Intent#EXTRA_USER}: The user of the admin.
1656      * <p>
1657      * Output: Nothing.
1658      *
1659      * @hide
1660      */
1661     // Intent#EXTRA_USER_ID can also be used
1662     @SystemApi
1663     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1664     public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS
1665             = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
1666 
1667     /**
1668      * Activity Action: Show a dialog for remote bugreport flow.
1669      * <p>
1670      * Input: Nothing.
1671      * <p>
1672      * Output: Nothing.
1673      *
1674      * @hide
1675      */
1676     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1677     public static final String ACTION_SHOW_REMOTE_BUGREPORT_DIALOG
1678             = "android.settings.SHOW_REMOTE_BUGREPORT_DIALOG";
1679 
1680     /**
1681      * Activity Action: Show VR listener settings.
1682      * <p>
1683      * Input: Nothing.
1684      * <p>
1685      * Output: Nothing.
1686      *
1687      * @see android.service.vr.VrListenerService
1688      */
1689     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1690     public static final String ACTION_VR_LISTENER_SETTINGS
1691             = "android.settings.VR_LISTENER_SETTINGS";
1692 
1693     /**
1694      * Activity Action: Show Picture-in-picture settings.
1695      * <p>
1696      * Input: Nothing.
1697      * <p>
1698      * Output: Nothing.
1699      *
1700      * @hide
1701      */
1702     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1703     public static final String ACTION_PICTURE_IN_PICTURE_SETTINGS
1704             = "android.settings.PICTURE_IN_PICTURE_SETTINGS";
1705 
1706     /**
1707      * Activity Action: Show Storage Manager settings.
1708      * <p>
1709      * Input: Nothing.
1710      * <p>
1711      * Output: Nothing.
1712      *
1713      * @hide
1714      */
1715     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1716     public static final String ACTION_STORAGE_MANAGER_SETTINGS
1717             = "android.settings.STORAGE_MANAGER_SETTINGS";
1718 
1719     /**
1720      * Activity Action: Allows user to select current webview implementation.
1721      * <p>
1722      * Input: Nothing.
1723      * <p>
1724      * Output: Nothing.
1725      */
1726     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1727     public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
1728 
1729     /**
1730      * Activity Action: Show enterprise privacy section.
1731      * <p>
1732      * Input: Nothing.
1733      * <p>
1734      * Output: Nothing.
1735      * @hide
1736      */
1737     @SystemApi
1738     @TestApi
1739     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1740     public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS
1741             = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
1742 
1743     /**
1744      * Activity Action: Show screen that let user select its Autofill Service.
1745      * <p>
1746      * Input: Intent's data URI set with an application name, using the
1747      * "package" schema (like "package:com.my.app").
1748      *
1749      * <p>
1750      * Output: {@link android.app.Activity#RESULT_OK} if user selected an Autofill Service belonging
1751      * to the caller package.
1752      *
1753      * <p>
1754      * <b>NOTE: </b> Applications should call
1755      * {@link android.view.autofill.AutofillManager#hasEnabledAutofillServices()} and
1756      * {@link android.view.autofill.AutofillManager#isAutofillSupported()}, and only use this action
1757      * to start an activity if they return {@code false} and {@code true} respectively.
1758      */
1759     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1760     public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE =
1761             "android.settings.REQUEST_SET_AUTOFILL_SERVICE";
1762 
1763     /**
1764      * Activity Action: Show screen for controlling which apps have access on volume directories.
1765      * <p>
1766      * Input: Nothing.
1767      * <p>
1768      * Output: Nothing.
1769      * <p>
1770      * Applications typically use this action to ask the user to revert the "Do not ask again"
1771      * status of directory access requests made by
1772      * {@link android.os.storage.StorageVolume#createAccessIntent(String)}.
1773      * @deprecated use {@link #ACTION_APPLICATION_DETAILS_SETTINGS} to manage storage permissions
1774      *             for a specific application
1775      */
1776     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1777     @Deprecated
1778     public static final String ACTION_STORAGE_VOLUME_ACCESS_SETTINGS =
1779             "android.settings.STORAGE_VOLUME_ACCESS_SETTINGS";
1780 
1781 
1782     /**
1783      * Activity Action: Show screen that let user select enable (or disable) Content Capture.
1784      * <p>
1785      * Input: Nothing.
1786      *
1787      * <p>
1788      * Output: Nothing
1789      *
1790      * @hide
1791      */
1792     @SystemApi
1793     @TestApi
1794     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1795     public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE =
1796             "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
1797 
1798     /**
1799      * Activity Action: Show screen that let user manage how Android handles URL resolution.
1800      * <p>
1801      * Input: Nothing.
1802      * <p>
1803      * Output: Nothing
1804      *
1805      * @hide
1806      */
1807     @SystemApi
1808     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1809     public static final String ACTION_MANAGE_DOMAIN_URLS = "android.settings.MANAGE_DOMAIN_URLS";
1810 
1811     /**
1812      * Activity Action: Show screen that let user select enable (or disable) tethering.
1813      * <p>
1814      * Input: Nothing.
1815      * <p>
1816      * Output: Nothing
1817      *
1818      * @hide
1819      */
1820     @SystemApi
1821     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1822     public static final String ACTION_TETHER_SETTINGS = "android.settings.TETHER_SETTINGS";
1823 
1824     /**
1825      * Broadcast to trigger notification of asking user to enable MMS.
1826      * Need to specify {@link #EXTRA_ENABLE_MMS_DATA_REQUEST_REASON} and {@link #EXTRA_SUB_ID}.
1827      *
1828      * @hide
1829      */
1830     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1831     public static final String ACTION_ENABLE_MMS_DATA_REQUEST =
1832             "android.settings.ENABLE_MMS_DATA_REQUEST";
1833 
1834     /**
1835      * Integer value that specifies the reason triggering enable MMS data notification.
1836      * This must be passed as an extra field to the {@link #ACTION_ENABLE_MMS_DATA_REQUEST}.
1837      * Extra with value of EnableMmsDataReason interface.
1838      * @hide
1839      */
1840     public static final String EXTRA_ENABLE_MMS_DATA_REQUEST_REASON =
1841             "android.settings.extra.ENABLE_MMS_DATA_REQUEST_REASON";
1842 
1843     /** @hide */
1844     @Retention(RetentionPolicy.SOURCE)
1845     @IntDef(prefix = { "ENABLE_MMS_DATA_REQUEST_REASON_" }, value = {
1846             ENABLE_MMS_DATA_REQUEST_REASON_INCOMING_MMS,
1847             ENABLE_MMS_DATA_REQUEST_REASON_OUTGOING_MMS,
1848     })
1849     public @interface EnableMmsDataReason{}
1850 
1851     /**
1852      * Requesting to enable MMS data because there's an incoming MMS.
1853      * @hide
1854      */
1855     public static final int ENABLE_MMS_DATA_REQUEST_REASON_INCOMING_MMS = 0;
1856 
1857     /**
1858      * Requesting to enable MMS data because user is sending MMS.
1859      * @hide
1860      */
1861     public static final int ENABLE_MMS_DATA_REQUEST_REASON_OUTGOING_MMS = 1;
1862 
1863     /**
1864      * Activity Action: Show screen of a cellular subscription and highlight the
1865      * "enable MMS" toggle.
1866      * <p>
1867      * Input: {@link #EXTRA_SUB_ID}: Sub ID of the subscription.
1868      * <p>
1869      * Output: Nothing
1870      *
1871      * @hide
1872      */
1873     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1874     public static final String ACTION_MMS_MESSAGE_SETTING = "android.settings.MMS_MESSAGE_SETTING";
1875 
1876     // End of Intent actions for Settings
1877 
1878     /**
1879      * @hide - Private call() method on SettingsProvider to read from 'system' table.
1880      */
1881     public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
1882 
1883     /**
1884      * @hide - Private call() method on SettingsProvider to read from 'secure' table.
1885      */
1886     public static final String CALL_METHOD_GET_SECURE = "GET_secure";
1887 
1888     /**
1889      * @hide - Private call() method on SettingsProvider to read from 'global' table.
1890      */
1891     public static final String CALL_METHOD_GET_GLOBAL = "GET_global";
1892 
1893     /**
1894      * @hide - Private call() method on SettingsProvider to read from 'config' table.
1895      */
1896     public static final String CALL_METHOD_GET_CONFIG = "GET_config";
1897 
1898     /**
1899      * @hide - Specifies that the caller of the fast-path call()-based flow tracks
1900      * the settings generation in order to cache values locally. If this key is
1901      * mapped to a <code>null</code> string extra in the request bundle, the response
1902      * bundle will contain the same key mapped to a parcelable extra which would be
1903      * an {@link android.util.MemoryIntArray}. The response will also contain an
1904      * integer mapped to the {@link #CALL_METHOD_GENERATION_INDEX_KEY} which is the
1905      * index in the array clients should use to lookup the generation. For efficiency
1906      * the caller should request the generation tracking memory array only if it
1907      * doesn't already have it.
1908      *
1909      * @see #CALL_METHOD_GENERATION_INDEX_KEY
1910      */
1911     public static final String CALL_METHOD_TRACK_GENERATION_KEY = "_track_generation";
1912 
1913     /**
1914      * @hide Key with the location in the {@link android.util.MemoryIntArray} where
1915      * to look up the generation id of the backing table. The value is an integer.
1916      *
1917      * @see #CALL_METHOD_TRACK_GENERATION_KEY
1918      */
1919     public static final String CALL_METHOD_GENERATION_INDEX_KEY = "_generation_index";
1920 
1921     /**
1922      * @hide Key with the settings table generation. The value is an integer.
1923      *
1924      * @see #CALL_METHOD_TRACK_GENERATION_KEY
1925      */
1926     public static final String CALL_METHOD_GENERATION_KEY = "_generation";
1927 
1928     /**
1929      * @hide - User handle argument extra to the fast-path call()-based requests
1930      */
1931     public static final String CALL_METHOD_USER_KEY = "_user";
1932 
1933     /**
1934      * @hide - Boolean argument extra to the fast-path call()-based requests
1935      */
1936     public static final String CALL_METHOD_MAKE_DEFAULT_KEY = "_make_default";
1937 
1938     /**
1939      * @hide - User handle argument extra to the fast-path call()-based requests
1940      */
1941     public static final String CALL_METHOD_RESET_MODE_KEY = "_reset_mode";
1942 
1943     /**
1944      * @hide - String argument extra to the fast-path call()-based requests
1945      */
1946     public static final String CALL_METHOD_TAG_KEY = "_tag";
1947 
1948     /**
1949      * @hide - String argument extra to the fast-path call()-based requests
1950      */
1951     public static final String CALL_METHOD_PREFIX_KEY = "_prefix";
1952 
1953     /** @hide - Private call() method to write to 'system' table */
1954     public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
1955 
1956     /** @hide - Private call() method to write to 'secure' table */
1957     public static final String CALL_METHOD_PUT_SECURE = "PUT_secure";
1958 
1959     /** @hide - Private call() method to write to 'global' table */
1960     public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global";
1961 
1962     /** @hide - Private call() method to write to 'configuration' table */
1963     public static final String CALL_METHOD_PUT_CONFIG = "PUT_config";
1964 
1965     /** @hide - Private call() method to delete from the 'system' table */
1966     public static final String CALL_METHOD_DELETE_SYSTEM = "DELETE_system";
1967 
1968     /** @hide - Private call() method to delete from the 'secure' table */
1969     public static final String CALL_METHOD_DELETE_SECURE = "DELETE_secure";
1970 
1971     /** @hide - Private call() method to delete from the 'global' table */
1972     public static final String CALL_METHOD_DELETE_GLOBAL = "DELETE_global";
1973 
1974     /** @hide - Private call() method to reset to defaults the 'configuration' table */
1975     public static final String CALL_METHOD_DELETE_CONFIG = "DELETE_config";
1976 
1977     /** @hide - Private call() method to reset to defaults the 'secure' table */
1978     public static final String CALL_METHOD_RESET_SECURE = "RESET_secure";
1979 
1980     /** @hide - Private call() method to reset to defaults the 'global' table */
1981     public static final String CALL_METHOD_RESET_GLOBAL = "RESET_global";
1982 
1983     /** @hide - Private call() method to reset to defaults the 'configuration' table */
1984     public static final String CALL_METHOD_RESET_CONFIG = "RESET_config";
1985 
1986     /** @hide - Private call() method to query the 'system' table */
1987     public static final String CALL_METHOD_LIST_SYSTEM = "LIST_system";
1988 
1989     /** @hide - Private call() method to query the 'secure' table */
1990     public static final String CALL_METHOD_LIST_SECURE = "LIST_secure";
1991 
1992     /** @hide - Private call() method to query the 'global' table */
1993     public static final String CALL_METHOD_LIST_GLOBAL = "LIST_global";
1994 
1995     /** @hide - Private call() method to reset to defaults the 'configuration' table */
1996     public static final String CALL_METHOD_LIST_CONFIG = "LIST_config";
1997 
1998     /**
1999      * Activity Extra: Limit available options in launched activity based on the given authority.
2000      * <p>
2001      * This can be passed as an extra field in an Activity Intent with one or more syncable content
2002      * provider's authorities as a String[]. This field is used by some intents to alter the
2003      * behavior of the called activity.
2004      * <p>
2005      * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
2006      * on the authority given.
2007      */
2008     public static final String EXTRA_AUTHORITIES = "authorities";
2009 
2010     /**
2011      * Activity Extra: Limit available options in launched activity based on the given account
2012      * types.
2013      * <p>
2014      * This can be passed as an extra field in an Activity Intent with one or more account types
2015      * as a String[]. This field is used by some intents to alter the behavior of the called
2016      * activity.
2017      * <p>
2018      * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified
2019      * list.
2020      */
2021     public static final String EXTRA_ACCOUNT_TYPES = "account_types";
2022 
2023     public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
2024 
2025     /**
2026      * Activity Extra: The device identifier to act upon.
2027      * <p>
2028      * This can be passed as an extra field in an Activity Intent with a single
2029      * InputDeviceIdentifier. This field is used by some activities to jump straight into the
2030      * settings for the given device.
2031      * <p>
2032      * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout
2033      * dialog for the given device.
2034      * @hide
2035      */
2036     public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
2037 
2038     /**
2039      * Activity Extra: Enable or disable Airplane Mode.
2040      * <p>
2041      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE}
2042      * intent as a boolean to indicate if it should be enabled.
2043      */
2044     public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
2045 
2046     /**
2047      * Activity Extra: Enable or disable Battery saver mode.
2048      * <p>
2049      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE}
2050      * intent as a boolean to indicate if it should be enabled.
2051      */
2052     public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED =
2053             "android.settings.extra.battery_saver_mode_enabled";
2054 
2055     /**
2056      * Activity Extra: Enable or disable Do Not Disturb mode.
2057      * <p>
2058      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
2059      * intent as a boolean to indicate if it should be enabled.
2060      */
2061     public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED =
2062             "android.settings.extra.do_not_disturb_mode_enabled";
2063 
2064     /**
2065      * Activity Extra: How many minutes to enable do not disturb mode for.
2066      * <p>
2067      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
2068      * intent to indicate how long do not disturb mode should be enabled for.
2069      */
2070     public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES =
2071             "android.settings.extra.do_not_disturb_mode_minutes";
2072 
2073     /**
2074      * Reset mode: reset to defaults only settings changed by the
2075      * calling package. If there is a default set the setting
2076      * will be set to it, otherwise the setting will be deleted.
2077      * This is the only type of reset available to non-system clients.
2078      * @hide
2079      */
2080     @UnsupportedAppUsage
2081     @TestApi
2082     public static final int RESET_MODE_PACKAGE_DEFAULTS = 1;
2083 
2084     /**
2085      * Reset mode: reset all settings set by untrusted packages, which is
2086      * packages that aren't a part of the system, to the current defaults.
2087      * If there is a default set the setting will be set to it, otherwise
2088      * the setting will be deleted. This mode is only available to the system.
2089      * @hide
2090      */
2091     public static final int RESET_MODE_UNTRUSTED_DEFAULTS = 2;
2092 
2093     /**
2094      * Reset mode: delete all settings set by untrusted packages, which is
2095      * packages that aren't a part of the system. If a setting is set by an
2096      * untrusted package it will be deleted if its default is not provided
2097      * by the system, otherwise the setting will be set to its default.
2098      * This mode is only available to the system.
2099      * @hide
2100      */
2101     public static final int RESET_MODE_UNTRUSTED_CHANGES = 3;
2102 
2103     /**
2104      * Reset mode: reset all settings to defaults specified by trusted
2105      * packages, which is packages that are a part of the system, and
2106      * delete all settings set by untrusted packages. If a setting has
2107      * a default set by a system package it will be set to the default,
2108      * otherwise the setting will be deleted. This mode is only available
2109      * to the system.
2110      * @hide
2111      */
2112     public static final int RESET_MODE_TRUSTED_DEFAULTS = 4;
2113 
2114     /** @hide */
2115     @Retention(RetentionPolicy.SOURCE)
2116     @IntDef(prefix = { "RESET_MODE_" }, value = {
2117             RESET_MODE_PACKAGE_DEFAULTS,
2118             RESET_MODE_UNTRUSTED_DEFAULTS,
2119             RESET_MODE_UNTRUSTED_CHANGES,
2120             RESET_MODE_TRUSTED_DEFAULTS
2121     })
2122     public @interface ResetMode{}
2123 
2124     /**
2125      * Activity Extra: Number of certificates
2126      * <p>
2127      * This can be passed as an extra field to the {@link #ACTION_MONITORING_CERT_INFO}
2128      * intent to indicate the number of certificates
2129      * @hide
2130      */
2131     public static final String EXTRA_NUMBER_OF_CERTIFICATES =
2132             "android.settings.extra.number_of_certificates";
2133 
2134     private static final String JID_RESOURCE_PREFIX = "android";
2135 
2136     public static final String AUTHORITY = "settings";
2137 
2138     private static final String TAG = "Settings";
2139     private static final boolean LOCAL_LOGV = false;
2140 
2141     // Lock ensures that when enabling/disabling the master location switch, we don't end up
2142     // with a partial enable/disable state in multi-threaded situations.
2143     private static final Object mLocationSettingsLock = new Object();
2144 
2145     // Used in system server calling uid workaround in call()
2146     private static boolean sInSystemServer = false;
2147     private static final Object sInSystemServerLock = new Object();
2148 
2149     /** @hide */
setInSystemServer()2150     public static void setInSystemServer() {
2151         synchronized (sInSystemServerLock) {
2152             sInSystemServer = true;
2153         }
2154     }
2155 
2156     /** @hide */
isInSystemServer()2157     public static boolean isInSystemServer() {
2158         synchronized (sInSystemServerLock) {
2159             return sInSystemServer;
2160         }
2161     }
2162 
2163     public static class SettingNotFoundException extends AndroidException {
SettingNotFoundException(String msg)2164         public SettingNotFoundException(String msg) {
2165             super(msg);
2166         }
2167     }
2168 
2169     /**
2170      * Common base for tables of name/value settings.
2171      */
2172     public static class NameValueTable implements BaseColumns {
2173         public static final String NAME = "name";
2174         public static final String VALUE = "value";
2175 
putString(ContentResolver resolver, Uri uri, String name, String value)2176         protected static boolean putString(ContentResolver resolver, Uri uri,
2177                 String name, String value) {
2178             // The database will take care of replacing duplicates.
2179             try {
2180                 ContentValues values = new ContentValues();
2181                 values.put(NAME, name);
2182                 values.put(VALUE, value);
2183                 resolver.insert(uri, values);
2184                 return true;
2185             } catch (SQLException e) {
2186                 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
2187                 return false;
2188             }
2189         }
2190 
getUriFor(Uri uri, String name)2191         public static Uri getUriFor(Uri uri, String name) {
2192             return Uri.withAppendedPath(uri, name);
2193         }
2194     }
2195 
2196     private static final class GenerationTracker {
2197         private final MemoryIntArray mArray;
2198         private final Runnable mErrorHandler;
2199         private final int mIndex;
2200         private int mCurrentGeneration;
2201 
GenerationTracker(@onNull MemoryIntArray array, int index, int generation, Runnable errorHandler)2202         public GenerationTracker(@NonNull MemoryIntArray array, int index,
2203                 int generation, Runnable errorHandler) {
2204             mArray = array;
2205             mIndex = index;
2206             mErrorHandler = errorHandler;
2207             mCurrentGeneration = generation;
2208         }
2209 
isGenerationChanged()2210         public boolean isGenerationChanged() {
2211             final int currentGeneration = readCurrentGeneration();
2212             if (currentGeneration >= 0) {
2213                 if (currentGeneration == mCurrentGeneration) {
2214                     return false;
2215                 }
2216                 mCurrentGeneration = currentGeneration;
2217             }
2218             return true;
2219         }
2220 
getCurrentGeneration()2221         public int getCurrentGeneration() {
2222             return mCurrentGeneration;
2223         }
2224 
readCurrentGeneration()2225         private int readCurrentGeneration() {
2226             try {
2227                 return mArray.get(mIndex);
2228             } catch (IOException e) {
2229                 Log.e(TAG, "Error getting current generation", e);
2230                 if (mErrorHandler != null) {
2231                     mErrorHandler.run();
2232                 }
2233             }
2234             return -1;
2235         }
2236 
destroy()2237         public void destroy() {
2238             try {
2239                 mArray.close();
2240             } catch (IOException e) {
2241                 Log.e(TAG, "Error closing backing array", e);
2242                 if (mErrorHandler != null) {
2243                     mErrorHandler.run();
2244                 }
2245             }
2246         }
2247     }
2248 
2249     private static final class ContentProviderHolder {
2250         private final Object mLock = new Object();
2251 
2252         @GuardedBy("mLock")
2253         private final Uri mUri;
2254         @GuardedBy("mLock")
2255         @UnsupportedAppUsage
2256         private IContentProvider mContentProvider;
2257 
ContentProviderHolder(Uri uri)2258         public ContentProviderHolder(Uri uri) {
2259             mUri = uri;
2260         }
2261 
getProvider(ContentResolver contentResolver)2262         public IContentProvider getProvider(ContentResolver contentResolver) {
2263             synchronized (mLock) {
2264                 if (mContentProvider == null) {
2265                     mContentProvider = contentResolver
2266                             .acquireProvider(mUri.getAuthority());
2267                 }
2268                 return mContentProvider;
2269             }
2270         }
2271 
clearProviderForTest()2272         public void clearProviderForTest() {
2273             synchronized (mLock) {
2274                 mContentProvider = null;
2275             }
2276         }
2277     }
2278 
2279     // Thread-safe.
2280     private static class NameValueCache {
2281         private static final boolean DEBUG = false;
2282 
2283         private static final String[] SELECT_VALUE_PROJECTION = new String[] {
2284                 Settings.NameValueTable.VALUE
2285         };
2286 
2287         private static final String NAME_EQ_PLACEHOLDER = "name=?";
2288 
2289         // Must synchronize on 'this' to access mValues and mValuesVersion.
2290         private final HashMap<String, String> mValues = new HashMap<>();
2291 
2292         private final Uri mUri;
2293         @UnsupportedAppUsage
2294         private final ContentProviderHolder mProviderHolder;
2295 
2296         // The method we'll call (or null, to not use) on the provider
2297         // for the fast path of retrieving settings.
2298         private final String mCallGetCommand;
2299         private final String mCallSetCommand;
2300 
2301         @GuardedBy("this")
2302         private GenerationTracker mGenerationTracker;
2303 
NameValueCache(Uri uri, String getCommand, String setCommand, ContentProviderHolder providerHolder)2304         public NameValueCache(Uri uri, String getCommand, String setCommand,
2305                 ContentProviderHolder providerHolder) {
2306             mUri = uri;
2307             mCallGetCommand = getCommand;
2308             mCallSetCommand = setCommand;
2309             mProviderHolder = providerHolder;
2310         }
2311 
putStringForUser(ContentResolver cr, String name, String value, String tag, boolean makeDefault, final int userHandle)2312         public boolean putStringForUser(ContentResolver cr, String name, String value,
2313                 String tag, boolean makeDefault, final int userHandle) {
2314             try {
2315                 Bundle arg = new Bundle();
2316                 arg.putString(Settings.NameValueTable.VALUE, value);
2317                 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
2318                 if (tag != null) {
2319                     arg.putString(CALL_METHOD_TAG_KEY, tag);
2320                 }
2321                 if (makeDefault) {
2322                     arg.putBoolean(CALL_METHOD_MAKE_DEFAULT_KEY, true);
2323                 }
2324                 IContentProvider cp = mProviderHolder.getProvider(cr);
2325                 cp.call(cr.getPackageName(), mProviderHolder.mUri.getAuthority(),
2326                         mCallSetCommand, name, arg);
2327             } catch (RemoteException e) {
2328                 Log.w(TAG, "Can't set key " + name + " in " + mUri, e);
2329                 return false;
2330             }
2331             return true;
2332         }
2333 
2334         @UnsupportedAppUsage
getStringForUser(ContentResolver cr, String name, final int userHandle)2335         public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
2336             final boolean isSelf = (userHandle == UserHandle.myUserId());
2337             int currentGeneration = -1;
2338             if (isSelf) {
2339                 synchronized (NameValueCache.this) {
2340                     if (mGenerationTracker != null) {
2341                         if (mGenerationTracker.isGenerationChanged()) {
2342                             if (DEBUG) {
2343                                 Log.i(TAG, "Generation changed for type:"
2344                                         + mUri.getPath() + " in package:"
2345                                         + cr.getPackageName() +" and user:" + userHandle);
2346                             }
2347                             mValues.clear();
2348                         } else if (mValues.containsKey(name)) {
2349                             return mValues.get(name);
2350                         }
2351                         if (mGenerationTracker != null) {
2352                             currentGeneration = mGenerationTracker.getCurrentGeneration();
2353                         }
2354                     }
2355                 }
2356             } else {
2357                 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle
2358                         + " by user " + UserHandle.myUserId() + " so skipping cache");
2359             }
2360 
2361             IContentProvider cp = mProviderHolder.getProvider(cr);
2362 
2363             // Try the fast path first, not using query().  If this
2364             // fails (alternate Settings provider that doesn't support
2365             // this interface?) then we fall back to the query/table
2366             // interface.
2367             if (mCallGetCommand != null) {
2368                 try {
2369                     Bundle args = null;
2370                     if (!isSelf) {
2371                         args = new Bundle();
2372                         args.putInt(CALL_METHOD_USER_KEY, userHandle);
2373                     }
2374                     boolean needsGenerationTracker = false;
2375                     synchronized (NameValueCache.this) {
2376                         if (isSelf && mGenerationTracker == null) {
2377                             needsGenerationTracker = true;
2378                             if (args == null) {
2379                                 args = new Bundle();
2380                             }
2381                             args.putString(CALL_METHOD_TRACK_GENERATION_KEY, null);
2382                             if (DEBUG) {
2383                                 Log.i(TAG, "Requested generation tracker for type: "+ mUri.getPath()
2384                                         + " in package:" + cr.getPackageName() +" and user:"
2385                                         + userHandle);
2386                             }
2387                         }
2388                     }
2389                     Bundle b;
2390                     // If we're in system server and in a binder transaction we need to clear the
2391                     // calling uid. This works around code in system server that did not call
2392                     // clearCallingIdentity, previously this wasn't needed because reading settings
2393                     // did not do permission checking but thats no longer the case.
2394                     // Long term this should be removed and callers should properly call
2395                     // clearCallingIdentity or use a ContentResolver from the caller as needed.
2396                     if (Settings.isInSystemServer() && Binder.getCallingUid() != Process.myUid()) {
2397                         final long token = Binder.clearCallingIdentity();
2398                         try {
2399                             b = cp.call(cr.getPackageName(), mProviderHolder.mUri.getAuthority(),
2400                                     mCallGetCommand, name, args);
2401                         } finally {
2402                             Binder.restoreCallingIdentity(token);
2403                         }
2404                     } else {
2405                         b = cp.call(cr.getPackageName(), mProviderHolder.mUri.getAuthority(),
2406                                 mCallGetCommand, name, args);
2407                     }
2408                     if (b != null) {
2409                         String value = b.getString(Settings.NameValueTable.VALUE);
2410                         // Don't update our cache for reads of other users' data
2411                         if (isSelf) {
2412                             synchronized (NameValueCache.this) {
2413                                 if (needsGenerationTracker) {
2414                                     MemoryIntArray array = b.getParcelable(
2415                                             CALL_METHOD_TRACK_GENERATION_KEY);
2416                                     final int index = b.getInt(
2417                                             CALL_METHOD_GENERATION_INDEX_KEY, -1);
2418                                     if (array != null && index >= 0) {
2419                                         final int generation = b.getInt(
2420                                                 CALL_METHOD_GENERATION_KEY, 0);
2421                                         if (DEBUG) {
2422                                             Log.i(TAG, "Received generation tracker for type:"
2423                                                     + mUri.getPath() + " in package:"
2424                                                     + cr.getPackageName() + " and user:"
2425                                                     + userHandle + " with index:" + index);
2426                                         }
2427                                         if (mGenerationTracker != null) {
2428                                             mGenerationTracker.destroy();
2429                                         }
2430                                         mGenerationTracker = new GenerationTracker(array, index,
2431                                                 generation, () -> {
2432                                             synchronized (NameValueCache.this) {
2433                                                 Log.e(TAG, "Error accessing generation"
2434                                                         + " tracker - removing");
2435                                                 if (mGenerationTracker != null) {
2436                                                     GenerationTracker generationTracker =
2437                                                             mGenerationTracker;
2438                                                     mGenerationTracker = null;
2439                                                     generationTracker.destroy();
2440                                                     mValues.clear();
2441                                                 }
2442                                             }
2443                                         });
2444                                     }
2445                                 }
2446                                 if (mGenerationTracker != null && currentGeneration ==
2447                                         mGenerationTracker.getCurrentGeneration()) {
2448                                     mValues.put(name, value);
2449                                 }
2450                             }
2451                         } else {
2452                             if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
2453                                     + " by " + UserHandle.myUserId()
2454                                     + " so not updating cache");
2455                         }
2456                         return value;
2457                     }
2458                     // If the response Bundle is null, we fall through
2459                     // to the query interface below.
2460                 } catch (RemoteException e) {
2461                     // Not supported by the remote side?  Fall through
2462                     // to query().
2463                 }
2464             }
2465 
2466             Cursor c = null;
2467             try {
2468                 Bundle queryArgs = ContentResolver.createSqlQueryBundle(
2469                         NAME_EQ_PLACEHOLDER, new String[]{name}, null);
2470                 // Same workaround as above.
2471                 if (Settings.isInSystemServer() && Binder.getCallingUid() != Process.myUid()) {
2472                     final long token = Binder.clearCallingIdentity();
2473                     try {
2474                         c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs,
2475                                 null);
2476                     } finally {
2477                         Binder.restoreCallingIdentity(token);
2478                     }
2479                 } else {
2480                     c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs,
2481                             null);
2482                 }
2483                 if (c == null) {
2484                     Log.w(TAG, "Can't get key " + name + " from " + mUri);
2485                     return null;
2486                 }
2487 
2488                 String value = c.moveToNext() ? c.getString(0) : null;
2489                 synchronized (NameValueCache.this) {
2490                     if(mGenerationTracker != null &&
2491                             currentGeneration == mGenerationTracker.getCurrentGeneration()) {
2492                         mValues.put(name, value);
2493                     }
2494                 }
2495                 if (LOCAL_LOGV) {
2496                     Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
2497                             name + " = " + (value == null ? "(null)" : value));
2498                 }
2499                 return value;
2500             } catch (RemoteException e) {
2501                 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
2502                 return null;  // Return null, but don't cache it.
2503             } finally {
2504                 if (c != null) c.close();
2505             }
2506         }
2507 
clearGenerationTrackerForTest()2508         public void clearGenerationTrackerForTest() {
2509             synchronized (NameValueCache.this) {
2510                 if (mGenerationTracker != null) {
2511                     mGenerationTracker.destroy();
2512                 }
2513                 mValues.clear();
2514                 mGenerationTracker = null;
2515             }
2516         }
2517     }
2518 
2519     /**
2520      * Checks if the specified context can draw on top of other apps. As of API
2521      * level 23, an app cannot draw on top of other apps unless it declares the
2522      * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its
2523      * manifest, <em>and</em> the user specifically grants the app this
2524      * capability. To prompt the user to grant this approval, the app must send an
2525      * intent with the action
2526      * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}, which
2527      * causes the system to display a permission management screen.
2528      *
2529      * @param context App context.
2530      * @return true if the specified context can draw on top of other apps, false otherwise
2531      */
canDrawOverlays(Context context)2532     public static boolean canDrawOverlays(Context context) {
2533         return Settings.isCallingPackageAllowedToDrawOverlays(context, Process.myUid(),
2534                 context.getOpPackageName(), false);
2535     }
2536 
2537     /**
2538      * System settings, containing miscellaneous system preferences.  This
2539      * table holds simple name/value pairs.  There are convenience
2540      * functions for accessing individual settings entries.
2541      */
2542     public static final class System extends NameValueTable {
2543         // NOTE: If you add new settings here, be sure to add them to
2544         // com.android.providers.settings.SettingsProtoDumpUtil#dumpProtoSystemSettingsLocked.
2545 
2546         private static final float DEFAULT_FONT_SCALE = 1.0f;
2547 
2548         /**
2549          * The content:// style URL for this table
2550          */
2551         public static final Uri CONTENT_URI =
2552             Uri.parse("content://" + AUTHORITY + "/system");
2553 
2554         @UnsupportedAppUsage
2555         private static final ContentProviderHolder sProviderHolder =
2556                 new ContentProviderHolder(CONTENT_URI);
2557 
2558         @UnsupportedAppUsage
2559         private static final NameValueCache sNameValueCache = new NameValueCache(
2560                 CONTENT_URI,
2561                 CALL_METHOD_GET_SYSTEM,
2562                 CALL_METHOD_PUT_SYSTEM,
2563                 sProviderHolder);
2564 
2565         @UnsupportedAppUsage
2566         private static final HashSet<String> MOVED_TO_SECURE;
2567         static {
2568             MOVED_TO_SECURE = new HashSet<>(30);
2569             MOVED_TO_SECURE.add(Secure.ANDROID_ID);
2570             MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
2571             MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
2572             MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
2573             MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
2574             MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
2575             MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
2576             MOVED_TO_SECURE.add(Secure.LOGGING_ID);
2577             MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
2578             MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
2579             MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
2580             MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
2581             MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
2582             MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
2583             MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
2584             MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
2585             MOVED_TO_SECURE.add(Secure.WIFI_ON);
2586             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
2587             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
2588             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
2589             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
2590             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
2591             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
2592             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
2593             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
2594             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
2595             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
2596             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
2597 
2598             // At one time in System, then Global, but now back in Secure
2599             MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
2600         }
2601 
2602         @UnsupportedAppUsage
2603         private static final HashSet<String> MOVED_TO_GLOBAL;
2604         @UnsupportedAppUsage
2605         private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL;
2606         static {
2607             MOVED_TO_GLOBAL = new HashSet<>();
2608             MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<>();
2609 
2610             // these were originally in system but migrated to secure in the past,
2611             // so are duplicated in the Secure.* namespace
2612             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED);
2613             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON);
2614             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING);
2615             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED);
2616             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED);
2617             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY);
2618 
2619             // these are moving directly from system to global
2620             MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON);
2621             MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS);
2622             MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
2623             MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME);
2624             MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE);
2625             MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND);
2626             MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND);
2627             MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND);
2628             MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND);
2629             MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED);
2630             MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND);
2631             MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND);
2632             MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND);
2633             MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED);
2634             MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
2635             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY);
2636             MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
2637             MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE);
2638             MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE);
2639             MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE);
2640             MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS);
2641             MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE);
2642             MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE);
2643             MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY);
2644             MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP);
2645             MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER);
2646             MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES);
2647             MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL);
2648             MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL);
2649             MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL);
2650             MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL);
2651             MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL);
2652             MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL);
2653             MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL);
2654             MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL);
2655         }
2656 
2657         /** @hide */
getMovedToGlobalSettings(Set<String> outKeySet)2658         public static void getMovedToGlobalSettings(Set<String> outKeySet) {
2659             outKeySet.addAll(MOVED_TO_GLOBAL);
2660             outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL);
2661         }
2662 
2663         /** @hide */
getMovedToSecureSettings(Set<String> outKeySet)2664         public static void getMovedToSecureSettings(Set<String> outKeySet) {
2665             outKeySet.addAll(MOVED_TO_SECURE);
2666         }
2667 
2668         /** @hide */
getNonLegacyMovedKeys(HashSet<String> outKeySet)2669         public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) {
2670             outKeySet.addAll(MOVED_TO_GLOBAL);
2671         }
2672 
2673         /** @hide */
clearProviderForTest()2674         public static void clearProviderForTest() {
2675             sProviderHolder.clearProviderForTest();
2676             sNameValueCache.clearGenerationTrackerForTest();
2677         }
2678 
2679         /**
2680          * Look up a name in the database.
2681          * @param resolver to access the database with
2682          * @param name to look up in the table
2683          * @return the corresponding value, or null if not present
2684          */
getString(ContentResolver resolver, String name)2685         public static String getString(ContentResolver resolver, String name) {
2686             return getStringForUser(resolver, name, resolver.getUserId());
2687         }
2688 
2689         /** @hide */
2690         @UnsupportedAppUsage
getStringForUser(ContentResolver resolver, String name, int userHandle)2691         public static String getStringForUser(ContentResolver resolver, String name,
2692                 int userHandle) {
2693             if (MOVED_TO_SECURE.contains(name)) {
2694                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2695                         + " to android.provider.Settings.Secure, returning read-only value.");
2696                 return Secure.getStringForUser(resolver, name, userHandle);
2697             }
2698             if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
2699                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2700                         + " to android.provider.Settings.Global, returning read-only value.");
2701                 return Global.getStringForUser(resolver, name, userHandle);
2702             }
2703             return sNameValueCache.getStringForUser(resolver, name, userHandle);
2704         }
2705 
2706         /**
2707          * Store a name/value pair into the database.
2708          * @param resolver to access the database with
2709          * @param name to store
2710          * @param value to associate with the name
2711          * @return true if the value was set, false on database errors
2712          */
putString(ContentResolver resolver, String name, String value)2713         public static boolean putString(ContentResolver resolver, String name, String value) {
2714             return putStringForUser(resolver, name, value, resolver.getUserId());
2715         }
2716 
2717         /** @hide */
2718         @UnsupportedAppUsage
putStringForUser(ContentResolver resolver, String name, String value, int userHandle)2719         public static boolean putStringForUser(ContentResolver resolver, String name, String value,
2720                 int userHandle) {
2721             if (MOVED_TO_SECURE.contains(name)) {
2722                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2723                         + " to android.provider.Settings.Secure, value is unchanged.");
2724                 return false;
2725             }
2726             if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
2727                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2728                         + " to android.provider.Settings.Global, value is unchanged.");
2729                 return false;
2730             }
2731             return sNameValueCache.putStringForUser(resolver, name, value, null, false, userHandle);
2732         }
2733 
2734         /**
2735          * Construct the content URI for a particular name/value pair,
2736          * useful for monitoring changes with a ContentObserver.
2737          * @param name to look up in the table
2738          * @return the corresponding content URI, or null if not present
2739          */
getUriFor(String name)2740         public static Uri getUriFor(String name) {
2741             if (MOVED_TO_SECURE.contains(name)) {
2742                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2743                     + " to android.provider.Settings.Secure, returning Secure URI.");
2744                 return Secure.getUriFor(Secure.CONTENT_URI, name);
2745             }
2746             if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
2747                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2748                         + " to android.provider.Settings.Global, returning read-only global URI.");
2749                 return Global.getUriFor(Global.CONTENT_URI, name);
2750             }
2751             return getUriFor(CONTENT_URI, name);
2752         }
2753 
2754         /**
2755          * Convenience function for retrieving a single system settings value
2756          * as an integer.  Note that internally setting values are always
2757          * stored as strings; this function converts the string to an integer
2758          * for you.  The default value will be returned if the setting is
2759          * not defined or not an integer.
2760          *
2761          * @param cr The ContentResolver to access.
2762          * @param name The name of the setting to retrieve.
2763          * @param def Value to return if the setting is not defined.
2764          *
2765          * @return The setting's current value, or 'def' if it is not defined
2766          * or not a valid integer.
2767          */
getInt(ContentResolver cr, String name, int def)2768         public static int getInt(ContentResolver cr, String name, int def) {
2769             return getIntForUser(cr, name, def, cr.getUserId());
2770         }
2771 
2772         /** @hide */
2773         @UnsupportedAppUsage
getIntForUser(ContentResolver cr, String name, int def, int userHandle)2774         public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
2775             String v = getStringForUser(cr, name, userHandle);
2776             try {
2777                 return v != null ? Integer.parseInt(v) : def;
2778             } catch (NumberFormatException e) {
2779                 return def;
2780             }
2781         }
2782 
2783         /**
2784          * Convenience function for retrieving a single system settings value
2785          * as an integer.  Note that internally setting values are always
2786          * stored as strings; this function converts the string to an integer
2787          * for you.
2788          * <p>
2789          * This version does not take a default value.  If the setting has not
2790          * been set, or the string value is not a number,
2791          * it throws {@link SettingNotFoundException}.
2792          *
2793          * @param cr The ContentResolver to access.
2794          * @param name The name of the setting to retrieve.
2795          *
2796          * @throws SettingNotFoundException Thrown if a setting by the given
2797          * name can't be found or the setting value is not an integer.
2798          *
2799          * @return The setting's current value.
2800          */
getInt(ContentResolver cr, String name)2801         public static int getInt(ContentResolver cr, String name)
2802                 throws SettingNotFoundException {
2803             return getIntForUser(cr, name, cr.getUserId());
2804         }
2805 
2806         /** @hide */
2807         @UnsupportedAppUsage
getIntForUser(ContentResolver cr, String name, int userHandle)2808         public static int getIntForUser(ContentResolver cr, String name, int userHandle)
2809                 throws SettingNotFoundException {
2810             String v = getStringForUser(cr, name, userHandle);
2811             try {
2812                 return Integer.parseInt(v);
2813             } catch (NumberFormatException e) {
2814                 throw new SettingNotFoundException(name);
2815             }
2816         }
2817 
2818         /**
2819          * Convenience function for updating a single settings value as an
2820          * integer. This will either create a new entry in the table if the
2821          * given name does not exist, or modify the value of the existing row
2822          * with that name.  Note that internally setting values are always
2823          * stored as strings, so this function converts the given value to a
2824          * string before storing it.
2825          *
2826          * @param cr The ContentResolver to access.
2827          * @param name The name of the setting to modify.
2828          * @param value The new value for the setting.
2829          * @return true if the value was set, false on database errors
2830          */
putInt(ContentResolver cr, String name, int value)2831         public static boolean putInt(ContentResolver cr, String name, int value) {
2832             return putIntForUser(cr, name, value, cr.getUserId());
2833         }
2834 
2835         /** @hide */
2836         @UnsupportedAppUsage
putIntForUser(ContentResolver cr, String name, int value, int userHandle)2837         public static boolean putIntForUser(ContentResolver cr, String name, int value,
2838                 int userHandle) {
2839             return putStringForUser(cr, name, Integer.toString(value), userHandle);
2840         }
2841 
2842         /**
2843          * Convenience function for retrieving a single system settings value
2844          * as a {@code long}.  Note that internally setting values are always
2845          * stored as strings; this function converts the string to a {@code long}
2846          * for you.  The default value will be returned if the setting is
2847          * not defined or not a {@code long}.
2848          *
2849          * @param cr The ContentResolver to access.
2850          * @param name The name of the setting to retrieve.
2851          * @param def Value to return if the setting is not defined.
2852          *
2853          * @return The setting's current value, or 'def' if it is not defined
2854          * or not a valid {@code long}.
2855          */
getLong(ContentResolver cr, String name, long def)2856         public static long getLong(ContentResolver cr, String name, long def) {
2857             return getLongForUser(cr, name, def, cr.getUserId());
2858         }
2859 
2860         /** @hide */
getLongForUser(ContentResolver cr, String name, long def, int userHandle)2861         public static long getLongForUser(ContentResolver cr, String name, long def,
2862                 int userHandle) {
2863             String valString = getStringForUser(cr, name, userHandle);
2864             long value;
2865             try {
2866                 value = valString != null ? Long.parseLong(valString) : def;
2867             } catch (NumberFormatException e) {
2868                 value = def;
2869             }
2870             return value;
2871         }
2872 
2873         /**
2874          * Convenience function for retrieving a single system settings value
2875          * as a {@code long}.  Note that internally setting values are always
2876          * stored as strings; this function converts the string to a {@code long}
2877          * for you.
2878          * <p>
2879          * This version does not take a default value.  If the setting has not
2880          * been set, or the string value is not a number,
2881          * it throws {@link SettingNotFoundException}.
2882          *
2883          * @param cr The ContentResolver to access.
2884          * @param name The name of the setting to retrieve.
2885          *
2886          * @return The setting's current value.
2887          * @throws SettingNotFoundException Thrown if a setting by the given
2888          * name can't be found or the setting value is not an integer.
2889          */
getLong(ContentResolver cr, String name)2890         public static long getLong(ContentResolver cr, String name)
2891                 throws SettingNotFoundException {
2892             return getLongForUser(cr, name, cr.getUserId());
2893         }
2894 
2895         /** @hide */
getLongForUser(ContentResolver cr, String name, int userHandle)2896         public static long getLongForUser(ContentResolver cr, String name, int userHandle)
2897                 throws SettingNotFoundException {
2898             String valString = getStringForUser(cr, name, userHandle);
2899             try {
2900                 return Long.parseLong(valString);
2901             } catch (NumberFormatException e) {
2902                 throw new SettingNotFoundException(name);
2903             }
2904         }
2905 
2906         /**
2907          * Convenience function for updating a single settings value as a long
2908          * integer. This will either create a new entry in the table if the
2909          * given name does not exist, or modify the value of the existing row
2910          * with that name.  Note that internally setting values are always
2911          * stored as strings, so this function converts the given value to a
2912          * string before storing it.
2913          *
2914          * @param cr The ContentResolver to access.
2915          * @param name The name of the setting to modify.
2916          * @param value The new value for the setting.
2917          * @return true if the value was set, false on database errors
2918          */
putLong(ContentResolver cr, String name, long value)2919         public static boolean putLong(ContentResolver cr, String name, long value) {
2920             return putLongForUser(cr, name, value, cr.getUserId());
2921         }
2922 
2923         /** @hide */
putLongForUser(ContentResolver cr, String name, long value, int userHandle)2924         public static boolean putLongForUser(ContentResolver cr, String name, long value,
2925                 int userHandle) {
2926             return putStringForUser(cr, name, Long.toString(value), userHandle);
2927         }
2928 
2929         /**
2930          * Convenience function for retrieving a single system settings value
2931          * as a floating point number.  Note that internally setting values are
2932          * always stored as strings; this function converts the string to an
2933          * float for you. The default value will be returned if the setting
2934          * is not defined or not a valid float.
2935          *
2936          * @param cr The ContentResolver to access.
2937          * @param name The name of the setting to retrieve.
2938          * @param def Value to return if the setting is not defined.
2939          *
2940          * @return The setting's current value, or 'def' if it is not defined
2941          * or not a valid float.
2942          */
getFloat(ContentResolver cr, String name, float def)2943         public static float getFloat(ContentResolver cr, String name, float def) {
2944             return getFloatForUser(cr, name, def, cr.getUserId());
2945         }
2946 
2947         /** @hide */
getFloatForUser(ContentResolver cr, String name, float def, int userHandle)2948         public static float getFloatForUser(ContentResolver cr, String name, float def,
2949                 int userHandle) {
2950             String v = getStringForUser(cr, name, userHandle);
2951             try {
2952                 return v != null ? Float.parseFloat(v) : def;
2953             } catch (NumberFormatException e) {
2954                 return def;
2955             }
2956         }
2957 
2958         /**
2959          * Convenience function for retrieving a single system settings value
2960          * as a float.  Note that internally setting values are always
2961          * stored as strings; this function converts the string to a float
2962          * for you.
2963          * <p>
2964          * This version does not take a default value.  If the setting has not
2965          * been set, or the string value is not a number,
2966          * it throws {@link SettingNotFoundException}.
2967          *
2968          * @param cr The ContentResolver to access.
2969          * @param name The name of the setting to retrieve.
2970          *
2971          * @throws SettingNotFoundException Thrown if a setting by the given
2972          * name can't be found or the setting value is not a float.
2973          *
2974          * @return The setting's current value.
2975          */
getFloat(ContentResolver cr, String name)2976         public static float getFloat(ContentResolver cr, String name)
2977                 throws SettingNotFoundException {
2978             return getFloatForUser(cr, name, cr.getUserId());
2979         }
2980 
2981         /** @hide */
getFloatForUser(ContentResolver cr, String name, int userHandle)2982         public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
2983                 throws SettingNotFoundException {
2984             String v = getStringForUser(cr, name, userHandle);
2985             if (v == null) {
2986                 throw new SettingNotFoundException(name);
2987             }
2988             try {
2989                 return Float.parseFloat(v);
2990             } catch (NumberFormatException e) {
2991                 throw new SettingNotFoundException(name);
2992             }
2993         }
2994 
2995         /**
2996          * Convenience function for updating a single settings value as a
2997          * floating point number. This will either create a new entry in the
2998          * table if the given name does not exist, or modify the value of the
2999          * existing row with that name.  Note that internally setting values
3000          * are always stored as strings, so this function converts the given
3001          * value to a string before storing it.
3002          *
3003          * @param cr The ContentResolver to access.
3004          * @param name The name of the setting to modify.
3005          * @param value The new value for the setting.
3006          * @return true if the value was set, false on database errors
3007          */
putFloat(ContentResolver cr, String name, float value)3008         public static boolean putFloat(ContentResolver cr, String name, float value) {
3009             return putFloatForUser(cr, name, value, cr.getUserId());
3010         }
3011 
3012         /** @hide */
putFloatForUser(ContentResolver cr, String name, float value, int userHandle)3013         public static boolean putFloatForUser(ContentResolver cr, String name, float value,
3014                 int userHandle) {
3015             return putStringForUser(cr, name, Float.toString(value), userHandle);
3016         }
3017 
3018         /**
3019          * Convenience function to read all of the current
3020          * configuration-related settings into a
3021          * {@link Configuration} object.
3022          *
3023          * @param cr The ContentResolver to access.
3024          * @param outConfig Where to place the configuration settings.
3025          */
getConfiguration(ContentResolver cr, Configuration outConfig)3026         public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
3027             adjustConfigurationForUser(cr, outConfig, cr.getUserId(),
3028                     false /* updateSettingsIfEmpty */);
3029         }
3030 
3031         /** @hide */
adjustConfigurationForUser(ContentResolver cr, Configuration outConfig, int userHandle, boolean updateSettingsIfEmpty)3032         public static void adjustConfigurationForUser(ContentResolver cr, Configuration outConfig,
3033                 int userHandle, boolean updateSettingsIfEmpty) {
3034             outConfig.fontScale = Settings.System.getFloatForUser(
3035                     cr, FONT_SCALE, DEFAULT_FONT_SCALE, userHandle);
3036             if (outConfig.fontScale < 0) {
3037                 outConfig.fontScale = DEFAULT_FONT_SCALE;
3038             }
3039 
3040             final String localeValue =
3041                     Settings.System.getStringForUser(cr, SYSTEM_LOCALES, userHandle);
3042             if (localeValue != null) {
3043                 outConfig.setLocales(LocaleList.forLanguageTags(localeValue));
3044             } else {
3045                 // Do not update configuration with emtpy settings since we need to take over the
3046                 // locale list of previous user if the settings value is empty. This happens when a
3047                 // new user is created.
3048 
3049                 if (updateSettingsIfEmpty) {
3050                     // Make current configuration persistent. This is necessary the first time a
3051                     // user log in. At the first login, the configuration settings are empty, so we
3052                     // need to store the adjusted configuration as the initial settings.
3053                     Settings.System.putStringForUser(
3054                             cr, SYSTEM_LOCALES, outConfig.getLocales().toLanguageTags(),
3055                             userHandle);
3056                 }
3057             }
3058         }
3059 
3060         /**
3061          * @hide Erase the fields in the Configuration that should be applied
3062          * by the settings.
3063          */
clearConfiguration(Configuration inoutConfig)3064         public static void clearConfiguration(Configuration inoutConfig) {
3065             inoutConfig.fontScale = 0;
3066             if (!inoutConfig.userSetLocale && !inoutConfig.getLocales().isEmpty()) {
3067                 inoutConfig.clearLocales();
3068             }
3069         }
3070 
3071         /**
3072          * Convenience function to write a batch of configuration-related
3073          * settings from a {@link Configuration} object.
3074          *
3075          * @param cr The ContentResolver to access.
3076          * @param config The settings to write.
3077          * @return true if the values were set, false on database errors
3078          */
putConfiguration(ContentResolver cr, Configuration config)3079         public static boolean putConfiguration(ContentResolver cr, Configuration config) {
3080             return putConfigurationForUser(cr, config, cr.getUserId());
3081         }
3082 
3083         /** @hide */
putConfigurationForUser(ContentResolver cr, Configuration config, int userHandle)3084         public static boolean putConfigurationForUser(ContentResolver cr, Configuration config,
3085                 int userHandle) {
3086             return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle) &&
3087                     Settings.System.putStringForUser(
3088                             cr, SYSTEM_LOCALES, config.getLocales().toLanguageTags(), userHandle);
3089         }
3090 
3091         /** @hide */
hasInterestingConfigurationChanges(int changes)3092         public static boolean hasInterestingConfigurationChanges(int changes) {
3093             return (changes & ActivityInfo.CONFIG_FONT_SCALE) != 0 ||
3094                     (changes & ActivityInfo.CONFIG_LOCALE) != 0;
3095         }
3096 
3097         /** @deprecated - Do not use */
3098         @Deprecated
getShowGTalkServiceStatus(ContentResolver cr)3099         public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
3100             return getShowGTalkServiceStatusForUser(cr, cr.getUserId());
3101         }
3102 
3103         /**
3104          * @hide
3105          * @deprecated - Do not use
3106          */
3107         @Deprecated
getShowGTalkServiceStatusForUser(ContentResolver cr, int userHandle)3108         public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr,
3109                 int userHandle) {
3110             return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0;
3111         }
3112 
3113         /** @deprecated - Do not use */
3114         @Deprecated
setShowGTalkServiceStatus(ContentResolver cr, boolean flag)3115         public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
3116             setShowGTalkServiceStatusForUser(cr, flag, cr.getUserId());
3117         }
3118 
3119         /**
3120          * @hide
3121          * @deprecated - Do not use
3122          */
3123         @Deprecated
setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag, int userHandle)3124         public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag,
3125                 int userHandle) {
3126             putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
3127         }
3128 
3129         /**
3130          * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
3131          */
3132         @Deprecated
3133         public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN;
3134 
3135         private static final Validator STAY_ON_WHILE_PLUGGED_IN_VALIDATOR = new Validator() {
3136             @Override
3137             public boolean validate(String value) {
3138                 try {
3139                     int val = Integer.parseInt(value);
3140                     return (val == 0)
3141                             || (val == BatteryManager.BATTERY_PLUGGED_AC)
3142                             || (val == BatteryManager.BATTERY_PLUGGED_USB)
3143                             || (val == BatteryManager.BATTERY_PLUGGED_WIRELESS)
3144                             || (val == (BatteryManager.BATTERY_PLUGGED_AC
3145                                     | BatteryManager.BATTERY_PLUGGED_USB))
3146                             || (val == (BatteryManager.BATTERY_PLUGGED_AC
3147                                     | BatteryManager.BATTERY_PLUGGED_WIRELESS))
3148                             || (val == (BatteryManager.BATTERY_PLUGGED_USB
3149                                     | BatteryManager.BATTERY_PLUGGED_WIRELESS))
3150                             || (val == (BatteryManager.BATTERY_PLUGGED_AC
3151                                     | BatteryManager.BATTERY_PLUGGED_USB
3152                                     | BatteryManager.BATTERY_PLUGGED_WIRELESS));
3153                 } catch (NumberFormatException e) {
3154                     return false;
3155                 }
3156             }
3157         };
3158 
3159         /**
3160          * What happens when the user presses the end call button if they're not
3161          * on a call.<br/>
3162          * <b>Values:</b><br/>
3163          * 0 - The end button does nothing.<br/>
3164          * 1 - The end button goes to the home screen.<br/>
3165          * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
3166          * 3 - The end button goes to the home screen.  If the user is already on the
3167          * home screen, it puts the device to sleep.
3168          */
3169         public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
3170 
3171         private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR =
3172                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 3);
3173 
3174         /**
3175          * END_BUTTON_BEHAVIOR value for "go home".
3176          * @hide
3177          */
3178         public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
3179 
3180         /**
3181          * END_BUTTON_BEHAVIOR value for "go to sleep".
3182          * @hide
3183          */
3184         public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
3185 
3186         /**
3187          * END_BUTTON_BEHAVIOR default value.
3188          * @hide
3189          */
3190         public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
3191 
3192         /**
3193          * Is advanced settings mode turned on. 0 == no, 1 == yes
3194          * @hide
3195          */
3196         public static final String ADVANCED_SETTINGS = "advanced_settings";
3197 
3198         private static final Validator ADVANCED_SETTINGS_VALIDATOR = BOOLEAN_VALIDATOR;
3199 
3200         /**
3201          * ADVANCED_SETTINGS default value.
3202          * @hide
3203          */
3204         public static final int ADVANCED_SETTINGS_DEFAULT = 0;
3205 
3206         /**
3207          * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
3208          */
3209         @Deprecated
3210         public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON;
3211 
3212         /**
3213          * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead
3214          */
3215         @Deprecated
3216         public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH;
3217 
3218         /**
3219          * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead
3220          */
3221         @Deprecated
3222         public static final String RADIO_WIFI = Global.RADIO_WIFI;
3223 
3224         /**
3225          * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead
3226          * {@hide}
3227          */
3228         @Deprecated
3229         public static final String RADIO_WIMAX = Global.RADIO_WIMAX;
3230 
3231         /**
3232          * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead
3233          */
3234         @Deprecated
3235         public static final String RADIO_CELL = Global.RADIO_CELL;
3236 
3237         /**
3238          * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead
3239          */
3240         @Deprecated
3241         public static final String RADIO_NFC = Global.RADIO_NFC;
3242 
3243         /**
3244          * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead
3245          */
3246         @Deprecated
3247         public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS;
3248 
3249         /**
3250          * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead
3251          *
3252          * {@hide}
3253          */
3254         @Deprecated
3255         @UnsupportedAppUsage
3256         public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS =
3257                 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS;
3258 
3259         /**
3260          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead
3261          */
3262         @Deprecated
3263         public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY;
3264 
3265         /**
3266          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead
3267          */
3268         @Deprecated
3269         public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT;
3270 
3271         /**
3272          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead
3273          */
3274         @Deprecated
3275         public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED =
3276                 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
3277 
3278         /**
3279          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead
3280          */
3281         @Deprecated
3282         public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER;
3283 
3284         /**
3285          * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead
3286          */
3287         @Deprecated
3288         public static final String MODE_RINGER = Global.MODE_RINGER;
3289 
3290         /**
3291          * Whether to use static IP and other static network attributes.
3292          * <p>
3293          * Set to 1 for true and 0 for false.
3294          *
3295          * @deprecated Use {@link WifiManager} instead
3296          */
3297         @Deprecated
3298         public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
3299 
3300         private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = BOOLEAN_VALIDATOR;
3301 
3302         /**
3303          * The static IP address.
3304          * <p>
3305          * Example: "192.168.1.51"
3306          *
3307          * @deprecated Use {@link WifiManager} instead
3308          */
3309         @Deprecated
3310         public static final String WIFI_STATIC_IP = "wifi_static_ip";
3311 
3312         private static final Validator WIFI_STATIC_IP_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR;
3313 
3314         /**
3315          * If using static IP, the gateway's IP address.
3316          * <p>
3317          * Example: "192.168.1.1"
3318          *
3319          * @deprecated Use {@link WifiManager} instead
3320          */
3321         @Deprecated
3322         public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
3323 
3324         private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR;
3325 
3326         /**
3327          * If using static IP, the net mask.
3328          * <p>
3329          * Example: "255.255.255.0"
3330          *
3331          * @deprecated Use {@link WifiManager} instead
3332          */
3333         @Deprecated
3334         public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
3335 
3336         private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR;
3337 
3338         /**
3339          * If using static IP, the primary DNS's IP address.
3340          * <p>
3341          * Example: "192.168.1.1"
3342          *
3343          * @deprecated Use {@link WifiManager} instead
3344          */
3345         @Deprecated
3346         public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
3347 
3348         private static final Validator WIFI_STATIC_DNS1_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR;
3349 
3350         /**
3351          * If using static IP, the secondary DNS's IP address.
3352          * <p>
3353          * Example: "192.168.1.2"
3354          *
3355          * @deprecated Use {@link WifiManager} instead
3356          */
3357         @Deprecated
3358         public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
3359 
3360         private static final Validator WIFI_STATIC_DNS2_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR;
3361 
3362         /**
3363          * Determines whether remote devices may discover and/or connect to
3364          * this device.
3365          * <P>Type: INT</P>
3366          * 2 -- discoverable and connectable
3367          * 1 -- connectable but not discoverable
3368          * 0 -- neither connectable nor discoverable
3369          */
3370         public static final String BLUETOOTH_DISCOVERABILITY =
3371             "bluetooth_discoverability";
3372 
3373         private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR =
3374                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 2);
3375 
3376         /**
3377          * Bluetooth discoverability timeout.  If this value is nonzero, then
3378          * Bluetooth becomes discoverable for a certain number of seconds,
3379          * after which is becomes simply connectable.  The value is in seconds.
3380          */
3381         public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
3382             "bluetooth_discoverability_timeout";
3383 
3384         private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR =
3385                 NON_NEGATIVE_INTEGER_VALIDATOR;
3386 
3387         /**
3388          * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
3389          * instead
3390          */
3391         @Deprecated
3392         public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
3393 
3394         /**
3395          * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
3396          * instead
3397          */
3398         @Deprecated
3399         public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
3400 
3401         /**
3402          * @deprecated Use
3403          * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
3404          * instead
3405          */
3406         @Deprecated
3407         public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
3408             "lock_pattern_tactile_feedback_enabled";
3409 
3410         /**
3411          * A formatted string of the next alarm that is set, or the empty string
3412          * if there is no alarm set.
3413          *
3414          * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}.
3415          */
3416         @Deprecated
3417         public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
3418 
3419         private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() {
3420             private static final int MAX_LENGTH = 1000;
3421 
3422             @Override
3423             public boolean validate(String value) {
3424                 // TODO: No idea what the correct format is.
3425                 return value == null || value.length() < MAX_LENGTH;
3426             }
3427         };
3428 
3429         /**
3430          * Scaling factor for fonts, float.
3431          */
3432         public static final String FONT_SCALE = "font_scale";
3433 
3434         private static final Validator FONT_SCALE_VALIDATOR = new Validator() {
3435             @Override
3436             public boolean validate(@Nullable String value) {
3437                 try {
3438                     return Float.parseFloat(value) >= 0;
3439                 } catch (NumberFormatException | NullPointerException e) {
3440                     return false;
3441                 }
3442             }
3443         };
3444 
3445         /**
3446          * The serialized system locale value.
3447          *
3448          * Do not use this value directory.
3449          * To get system locale, use {@link LocaleList#getDefault} instead.
3450          * To update system locale, use {@link com.android.internal.app.LocalePicker#updateLocales}
3451          * instead.
3452          * @hide
3453          */
3454         public static final String SYSTEM_LOCALES = "system_locales";
3455 
3456 
3457         /**
3458          * Name of an application package to be debugged.
3459          *
3460          * @deprecated Use {@link Global#DEBUG_APP} instead
3461          */
3462         @Deprecated
3463         public static final String DEBUG_APP = Global.DEBUG_APP;
3464 
3465         /**
3466          * If 1, when launching DEBUG_APP it will wait for the debugger before
3467          * starting user code.  If 0, it will run normally.
3468          *
3469          * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead
3470          */
3471         @Deprecated
3472         public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER;
3473 
3474         /**
3475          * Whether or not to dim the screen. 0=no  1=yes
3476          * @deprecated This setting is no longer used.
3477          */
3478         @Deprecated
3479         public static final String DIM_SCREEN = "dim_screen";
3480 
3481         private static final Validator DIM_SCREEN_VALIDATOR = BOOLEAN_VALIDATOR;
3482 
3483         /**
3484          * The display color mode.
3485          * @hide
3486          */
3487         public static final String DISPLAY_COLOR_MODE = "display_color_mode";
3488 
3489         private static final Validator DISPLAY_COLOR_MODE_VALIDATOR = new Validator() {
3490             @Override
3491             public boolean validate(@Nullable String value) {
3492                 // Assume the actual validation that this device can properly handle this kind of
3493                 // color mode further down in ColorDisplayManager / ColorDisplayService.
3494                 try {
3495                     final int setting = Integer.parseInt(value);
3496                     final boolean isInFrameworkRange =
3497                             setting >= ColorDisplayManager.COLOR_MODE_NATURAL
3498                                     && setting <= ColorDisplayManager.COLOR_MODE_AUTOMATIC;
3499                     final boolean isInVendorRange =
3500                             setting >= ColorDisplayManager.VENDOR_COLOR_MODE_RANGE_MIN
3501                                     && setting <= ColorDisplayManager.VENDOR_COLOR_MODE_RANGE_MAX;
3502                     return isInFrameworkRange || isInVendorRange;
3503                 } catch (NumberFormatException | NullPointerException e) {
3504                     return false;
3505                 }
3506             }
3507         };
3508 
3509         /**
3510          * The user selected min refresh rate in frames per second.
3511          *
3512          * If this isn't set, 0 will be used.
3513          * @hide
3514          */
3515         public static final String MIN_REFRESH_RATE = "min_refresh_rate";
3516 
3517         /**
3518          * The user selected peak refresh rate in frames per second.
3519          *
3520          * If this isn't set, the system falls back to a device specific default.
3521          * @hide
3522          */
3523         public static final String PEAK_REFRESH_RATE = "peak_refresh_rate";
3524 
3525         private static final Validator PEAK_REFRESH_RATE_VALIDATOR =
3526                 new SettingsValidators.InclusiveFloatRangeValidator(24f, Float.MAX_VALUE);
3527 
3528         /**
3529          * The amount of time in milliseconds before the device goes to sleep or begins
3530          * to dream after a period of inactivity.  This value is also known as the
3531          * user activity timeout period since the screen isn't necessarily turned off
3532          * when it expires.
3533          *
3534          * <p>
3535          * This value is bounded by maximum timeout set by
3536          * {@link android.app.admin.DevicePolicyManager#setMaximumTimeToLock(ComponentName, long)}.
3537          */
3538         public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
3539 
3540         private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR =
3541                 NON_NEGATIVE_INTEGER_VALIDATOR;
3542 
3543         /**
3544          * The screen backlight brightness between 0 and 255.
3545          */
3546         public static final String SCREEN_BRIGHTNESS = "screen_brightness";
3547 
3548         /**
3549          * The screen backlight brightness between 0 and 255.
3550          * @hide
3551          */
3552         public static final String SCREEN_BRIGHTNESS_FOR_VR = "screen_brightness_for_vr";
3553 
3554         private static final Validator SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR =
3555                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 255);
3556 
3557         /**
3558          * Control whether to enable automatic brightness mode.
3559          */
3560         public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
3561 
3562         private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = BOOLEAN_VALIDATOR;
3563 
3564         /**
3565          * Adjustment to auto-brightness to make it generally more (>0.0 <1.0)
3566          * or less (<0.0 >-1.0) bright.
3567          * @hide
3568          */
3569         @UnsupportedAppUsage
3570         public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj";
3571 
3572         private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR =
3573                 new SettingsValidators.InclusiveFloatRangeValidator(-1, 1);
3574 
3575         /**
3576          * SCREEN_BRIGHTNESS_MODE value for manual mode.
3577          */
3578         public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
3579 
3580         /**
3581          * SCREEN_BRIGHTNESS_MODE value for automatic mode.
3582          */
3583         public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
3584 
3585         /**
3586          * Control whether to enable adaptive sleep mode.
3587          * @hide
3588          */
3589         public static final String ADAPTIVE_SLEEP = "adaptive_sleep";
3590 
3591         private static final Validator ADAPTIVE_SLEEP_VALIDATOR = BOOLEAN_VALIDATOR;
3592 
3593         /**
3594          * Control whether the process CPU usage meter should be shown.
3595          *
3596          * @deprecated This functionality is no longer available as of
3597          * {@link android.os.Build.VERSION_CODES#N_MR1}.
3598          */
3599         @Deprecated
3600         public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES;
3601 
3602         /**
3603          * If 1, the activity manager will aggressively finish activities and
3604          * processes as soon as they are no longer needed.  If 0, the normal
3605          * extended lifetime is used.
3606          *
3607          * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead
3608          */
3609         @Deprecated
3610         public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;
3611 
3612         /**
3613          * Determines which streams are affected by ringer and zen mode changes. The
3614          * stream type's bit should be set to 1 if it should be muted when going
3615          * into an inaudible ringer mode.
3616          */
3617         public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
3618 
3619         private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR =
3620                 NON_NEGATIVE_INTEGER_VALIDATOR;
3621 
3622         /**
3623           * Determines which streams are affected by mute. The
3624           * stream type's bit should be set to 1 if it should be muted when a mute request
3625           * is received.
3626           */
3627         public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
3628 
3629         private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR =
3630                 NON_NEGATIVE_INTEGER_VALIDATOR;
3631 
3632         /**
3633          * Whether vibrate is on for different events. This is used internally,
3634          * changing this value will not change the vibrate. See AudioManager.
3635          */
3636         public static final String VIBRATE_ON = "vibrate_on";
3637 
3638         private static final Validator VIBRATE_ON_VALIDATOR = BOOLEAN_VALIDATOR;
3639 
3640         /**
3641          * If 1, redirects the system vibrator to all currently attached input devices
3642          * that support vibration.  If there are no such input devices, then the system
3643          * vibrator is used instead.
3644          * If 0, does not register the system vibrator.
3645          *
3646          * This setting is mainly intended to provide a compatibility mechanism for
3647          * applications that only know about the system vibrator and do not use the
3648          * input device vibrator API.
3649          *
3650          * @hide
3651          */
3652         public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices";
3653 
3654         private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = BOOLEAN_VALIDATOR;
3655 
3656         /**
3657          * The intensity of notification vibrations, if configurable.
3658          *
3659          * Not all devices are capable of changing their vibration intensity; on these devices
3660          * there will likely be no difference between the various vibration intensities except for
3661          * intensity 0 (off) and the rest.
3662          *
3663          * <b>Values:</b><br/>
3664          * 0 - Vibration is disabled<br/>
3665          * 1 - Weak vibrations<br/>
3666          * 2 - Medium vibrations<br/>
3667          * 3 - Strong vibrations
3668          * @hide
3669          */
3670         public static final String NOTIFICATION_VIBRATION_INTENSITY =
3671                 "notification_vibration_intensity";
3672         /**
3673          * The intensity of ringtone vibrations, if configurable.
3674          *
3675          * Not all devices are capable of changing their vibration intensity; on these devices
3676          * there will likely be no difference between the various vibration intensities except for
3677          * intensity 0 (off) and the rest.
3678          *
3679          * <b>Values:</b><br/>
3680          * 0 - Vibration is disabled<br/>
3681          * 1 - Weak vibrations<br/>
3682          * 2 - Medium vibrations<br/>
3683          * 3 - Strong vibrations
3684          * @hide
3685          */
3686         public static final String RING_VIBRATION_INTENSITY =
3687                 "ring_vibration_intensity";
3688 
3689         /**
3690          * The intensity of haptic feedback vibrations, if configurable.
3691          *
3692          * Not all devices are capable of changing their feedback intensity; on these devices
3693          * there will likely be no difference between the various vibration intensities except for
3694          * intensity 0 (off) and the rest.
3695          *
3696          * <b>Values:</b><br/>
3697          * 0 - Vibration is disabled<br/>
3698          * 1 - Weak vibrations<br/>
3699          * 2 - Medium vibrations<br/>
3700          * 3 - Strong vibrations
3701          * @hide
3702          */
3703         public static final String HAPTIC_FEEDBACK_INTENSITY =
3704                 "haptic_feedback_intensity";
3705 
3706         private static final Validator VIBRATION_INTENSITY_VALIDATOR =
3707                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 3);
3708 
3709         /**
3710          * Ringer volume. This is used internally, changing this value will not
3711          * change the volume. See AudioManager.
3712          *
3713          * @removed Not used by anything since API 2.
3714          */
3715         public static final String VOLUME_RING = "volume_ring";
3716 
3717         /**
3718          * System/notifications volume. This is used internally, changing this
3719          * value will not change the volume. See AudioManager.
3720          *
3721          * @removed Not used by anything since API 2.
3722          */
3723         public static final String VOLUME_SYSTEM = "volume_system";
3724 
3725         /**
3726          * Voice call volume. This is used internally, changing this value will
3727          * not change the volume. See AudioManager.
3728          *
3729          * @removed Not used by anything since API 2.
3730          */
3731         public static final String VOLUME_VOICE = "volume_voice";
3732 
3733         /**
3734          * Music/media/gaming volume. This is used internally, changing this
3735          * value will not change the volume. See AudioManager.
3736          *
3737          * @removed Not used by anything since API 2.
3738          */
3739         public static final String VOLUME_MUSIC = "volume_music";
3740 
3741         /**
3742          * Alarm volume. This is used internally, changing this
3743          * value will not change the volume. See AudioManager.
3744          *
3745          * @removed Not used by anything since API 2.
3746          */
3747         public static final String VOLUME_ALARM = "volume_alarm";
3748 
3749         /**
3750          * Notification volume. This is used internally, changing this
3751          * value will not change the volume. See AudioManager.
3752          *
3753          * @removed Not used by anything since API 2.
3754          */
3755         public static final String VOLUME_NOTIFICATION = "volume_notification";
3756 
3757         /**
3758          * Bluetooth Headset volume. This is used internally, changing this value will
3759          * not change the volume. See AudioManager.
3760          *
3761          * @removed Not used by anything since API 2.
3762          */
3763         public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
3764 
3765         /**
3766          * @hide
3767          * Acessibility volume. This is used internally, changing this
3768          * value will not change the volume.
3769          */
3770         public static final String VOLUME_ACCESSIBILITY = "volume_a11y";
3771 
3772         /**
3773          * Master volume (float in the range 0.0f to 1.0f).
3774          *
3775          * @hide
3776          */
3777         public static final String VOLUME_MASTER = "volume_master";
3778 
3779         /**
3780          * Master mono (int 1 = mono, 0 = normal).
3781          *
3782          * @hide
3783          */
3784         @UnsupportedAppUsage
3785         public static final String MASTER_MONO = "master_mono";
3786 
3787         private static final Validator MASTER_MONO_VALIDATOR = BOOLEAN_VALIDATOR;
3788 
3789         /**
3790          * Master balance (float -1.f = 100% left, 0.f = dead center, 1.f = 100% right).
3791          *
3792          * @hide
3793          */
3794         public static final String MASTER_BALANCE = "master_balance";
3795 
3796         private static final Validator MASTER_BALANCE_VALIDATOR =
3797                 new SettingsValidators.InclusiveFloatRangeValidator(-1.f, 1.f);
3798 
3799         /**
3800          * Whether the notifications should use the ring volume (value of 1) or
3801          * a separate notification volume (value of 0). In most cases, users
3802          * will have this enabled so the notification and ringer volumes will be
3803          * the same. However, power users can disable this and use the separate
3804          * notification volume control.
3805          * <p>
3806          * Note: This is a one-off setting that will be removed in the future
3807          * when there is profile support. For this reason, it is kept hidden
3808          * from the public APIs.
3809          *
3810          * @hide
3811          * @deprecated
3812          */
3813         @Deprecated
3814         public static final String NOTIFICATIONS_USE_RING_VOLUME =
3815             "notifications_use_ring_volume";
3816 
3817         private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = BOOLEAN_VALIDATOR;
3818 
3819         /**
3820          * Whether silent mode should allow vibration feedback. This is used
3821          * internally in AudioService and the Sound settings activity to
3822          * coordinate decoupling of vibrate and silent modes. This setting
3823          * will likely be removed in a future release with support for
3824          * audio/vibe feedback profiles.
3825          *
3826          * Not used anymore. On devices with vibrator, the user explicitly selects
3827          * silent or vibrate mode.
3828          * Kept for use by legacy database upgrade code in DatabaseHelper.
3829          * @hide
3830          */
3831         @UnsupportedAppUsage
3832         public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
3833 
3834         private static final Validator VIBRATE_IN_SILENT_VALIDATOR = BOOLEAN_VALIDATOR;
3835 
3836         /**
3837          * The mapping of stream type (integer) to its setting.
3838          *
3839          * @removed  Not used by anything since API 2.
3840          */
3841         public static final String[] VOLUME_SETTINGS = {
3842             VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
3843             VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
3844         };
3845 
3846         /**
3847          * @hide
3848          * The mapping of stream type (integer) to its setting.
3849          * Unlike the VOLUME_SETTINGS array, this one contains as many entries as
3850          * AudioSystem.NUM_STREAM_TYPES, and has empty strings for stream types whose volumes
3851          * are never persisted.
3852          */
3853         public static final String[] VOLUME_SETTINGS_INT = {
3854                 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
3855                 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO,
3856                 "" /*STREAM_SYSTEM_ENFORCED, no setting for this stream*/,
3857                 "" /*STREAM_DTMF, no setting for this stream*/,
3858                 "" /*STREAM_TTS, no setting for this stream*/,
3859                 VOLUME_ACCESSIBILITY
3860             };
3861 
3862         /**
3863          * Appended to various volume related settings to record the previous
3864          * values before they the settings were affected by a silent/vibrate
3865          * ringer mode change.
3866          *
3867          * @removed  Not used by anything since API 2.
3868          */
3869         public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
3870 
3871         /**
3872          * Persistent store for the system-wide default ringtone URI.
3873          * <p>
3874          * If you need to play the default ringtone at any given time, it is recommended
3875          * you give {@link #DEFAULT_RINGTONE_URI} to the media player.  It will resolve
3876          * to the set default ringtone at the time of playing.
3877          *
3878          * @see #DEFAULT_RINGTONE_URI
3879          */
3880         public static final String RINGTONE = "ringtone";
3881 
3882         private static final Validator RINGTONE_VALIDATOR = URI_VALIDATOR;
3883 
3884         /**
3885          * A {@link Uri} that will point to the current default ringtone at any
3886          * given time.
3887          * <p>
3888          * If the current default ringtone is in the DRM provider and the caller
3889          * does not have permission, the exception will be a
3890          * FileNotFoundException.
3891          */
3892         public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
3893 
3894         /** {@hide} */
3895         public static final String RINGTONE_CACHE = "ringtone_cache";
3896         /** {@hide} */
3897         public static final Uri RINGTONE_CACHE_URI = getUriFor(RINGTONE_CACHE);
3898 
3899         /**
3900          * Persistent store for the system-wide default notification sound.
3901          *
3902          * @see #RINGTONE
3903          * @see #DEFAULT_NOTIFICATION_URI
3904          */
3905         public static final String NOTIFICATION_SOUND = "notification_sound";
3906 
3907         private static final Validator NOTIFICATION_SOUND_VALIDATOR = URI_VALIDATOR;
3908 
3909         /**
3910          * A {@link Uri} that will point to the current default notification
3911          * sound at any given time.
3912          *
3913          * @see #DEFAULT_RINGTONE_URI
3914          */
3915         public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
3916 
3917         /** {@hide} */
3918         public static final String NOTIFICATION_SOUND_CACHE = "notification_sound_cache";
3919         /** {@hide} */
3920         public static final Uri NOTIFICATION_SOUND_CACHE_URI = getUriFor(NOTIFICATION_SOUND_CACHE);
3921 
3922         /**
3923          * Persistent store for the system-wide default alarm alert.
3924          *
3925          * @see #RINGTONE
3926          * @see #DEFAULT_ALARM_ALERT_URI
3927          */
3928         public static final String ALARM_ALERT = "alarm_alert";
3929 
3930         private static final Validator ALARM_ALERT_VALIDATOR = URI_VALIDATOR;
3931 
3932         /**
3933          * A {@link Uri} that will point to the current default alarm alert at
3934          * any given time.
3935          *
3936          * @see #DEFAULT_ALARM_ALERT_URI
3937          */
3938         public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
3939 
3940         /** {@hide} */
3941         public static final String ALARM_ALERT_CACHE = "alarm_alert_cache";
3942         /** {@hide} */
3943         public static final Uri ALARM_ALERT_CACHE_URI = getUriFor(ALARM_ALERT_CACHE);
3944 
3945         /**
3946          * Persistent store for the system default media button event receiver.
3947          *
3948          * @hide
3949          */
3950         public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
3951 
3952         private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = COMPONENT_NAME_VALIDATOR;
3953 
3954         /**
3955          * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
3956          */
3957         public static final String TEXT_AUTO_REPLACE = "auto_replace";
3958 
3959         private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = BOOLEAN_VALIDATOR;
3960 
3961         /**
3962          * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
3963          */
3964         public static final String TEXT_AUTO_CAPS = "auto_caps";
3965 
3966         private static final Validator TEXT_AUTO_CAPS_VALIDATOR = BOOLEAN_VALIDATOR;
3967 
3968         /**
3969          * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
3970          * feature converts two spaces to a "." and space.
3971          */
3972         public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
3973 
3974         private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = BOOLEAN_VALIDATOR;
3975 
3976         /**
3977          * Setting to showing password characters in text editors. 1 = On, 0 = Off
3978          */
3979         public static final String TEXT_SHOW_PASSWORD = "show_password";
3980 
3981         private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = BOOLEAN_VALIDATOR;
3982 
3983         public static final String SHOW_GTALK_SERVICE_STATUS =
3984                 "SHOW_GTALK_SERVICE_STATUS";
3985 
3986         private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = BOOLEAN_VALIDATOR;
3987 
3988         /**
3989          * Name of activity to use for wallpaper on the home screen.
3990          *
3991          * @deprecated Use {@link WallpaperManager} instead.
3992          */
3993         @Deprecated
3994         public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
3995 
3996         private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() {
3997             private static final int MAX_LENGTH = 1000;
3998 
3999             @Override
4000             public boolean validate(String value) {
4001                 if (value != null && value.length() > MAX_LENGTH) {
4002                     return false;
4003                 }
4004                 return ComponentName.unflattenFromString(value) != null;
4005             }
4006         };
4007 
4008         /**
4009          * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME}
4010          * instead
4011          */
4012         @Deprecated
4013         public static final String AUTO_TIME = Global.AUTO_TIME;
4014 
4015         private static final Validator AUTO_TIME_VALIDATOR = BOOLEAN_VALIDATOR;
4016 
4017         /**
4018          * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE}
4019          * instead
4020          */
4021         @Deprecated
4022         public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE;
4023 
4024         private static final Validator AUTO_TIME_ZONE_VALIDATOR = BOOLEAN_VALIDATOR;
4025 
4026         /**
4027          * Display times as 12 or 24 hours
4028          *   12
4029          *   24
4030          */
4031         public static final String TIME_12_24 = "time_12_24";
4032 
4033         /** @hide */
4034         public static final Validator TIME_12_24_VALIDATOR =
4035                 new SettingsValidators.DiscreteValueValidator(new String[] {"12", "24", null});
4036 
4037         /**
4038          * Date format string
4039          *   mm/dd/yyyy
4040          *   dd/mm/yyyy
4041          *   yyyy/mm/dd
4042          */
4043         public static final String DATE_FORMAT = "date_format";
4044 
4045         /** @hide */
4046         public static final Validator DATE_FORMAT_VALIDATOR = new Validator() {
4047             @Override
4048             public boolean validate(@Nullable String value) {
4049                 try {
4050                     new SimpleDateFormat(value);
4051                     return true;
4052                 } catch (IllegalArgumentException | NullPointerException e) {
4053                     return false;
4054                 }
4055             }
4056         };
4057 
4058         /**
4059          * Whether the setup wizard has been run before (on first boot), or if
4060          * it still needs to be run.
4061          *
4062          * nonzero = it has been run in the past
4063          * 0 = it has not been run in the past
4064          */
4065         public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
4066 
4067         /** @hide */
4068         public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = BOOLEAN_VALIDATOR;
4069 
4070         /**
4071          * Scaling factor for normal window animations. Setting to 0 will disable window
4072          * animations.
4073          *
4074          * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead
4075          */
4076         @Deprecated
4077         public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE;
4078 
4079         /**
4080          * Scaling factor for activity transition animations. Setting to 0 will disable window
4081          * animations.
4082          *
4083          * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead
4084          */
4085         @Deprecated
4086         public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE;
4087 
4088         /**
4089          * Scaling factor for Animator-based animations. This affects both the start delay and
4090          * duration of all such animations. Setting to 0 will cause animations to end immediately.
4091          * The default value is 1.
4092          *
4093          * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead
4094          */
4095         @Deprecated
4096         public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
4097 
4098         /**
4099          * Control whether the accelerometer will be used to change screen
4100          * orientation.  If 0, it will not be used unless explicitly requested
4101          * by the application; if 1, it will be used by default unless explicitly
4102          * disabled by the application.
4103          */
4104         public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
4105 
4106         /** @hide */
4107         public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = BOOLEAN_VALIDATOR;
4108 
4109         /**
4110          * Default screen rotation when no other policy applies.
4111          * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
4112          * preference, this rotation value will be used. Must be one of the
4113          * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
4114          *
4115          * @see Display#getRotation
4116          */
4117         public static final String USER_ROTATION = "user_rotation";
4118 
4119         /** @hide */
4120         public static final Validator USER_ROTATION_VALIDATOR =
4121                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 3);
4122 
4123         /**
4124          * Control whether the rotation lock toggle in the System UI should be hidden.
4125          * Typically this is done for accessibility purposes to make it harder for
4126          * the user to accidentally toggle the rotation lock while the display rotation
4127          * has been locked for accessibility.
4128          *
4129          * If 0, then rotation lock toggle is not hidden for accessibility (although it may be
4130          * unavailable for other reasons).  If 1, then the rotation lock toggle is hidden.
4131          *
4132          * @hide
4133          */
4134         @UnsupportedAppUsage
4135         public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY =
4136                 "hide_rotation_lock_toggle_for_accessibility";
4137 
4138         /** @hide */
4139         public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR =
4140                 BOOLEAN_VALIDATOR;
4141 
4142         /**
4143          * Whether the phone vibrates when it is ringing due to an incoming call. This will
4144          * be used by Phone and Setting apps; it shouldn't affect other apps.
4145          * The value is boolean (1 or 0).
4146          *
4147          * Note: this is not same as "vibrate on ring", which had been available until ICS.
4148          * It was about AudioManager's setting and thus affected all the applications which
4149          * relied on the setting, while this is purely about the vibration setting for incoming
4150          * calls.
4151          */
4152         public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
4153 
4154         /** @hide */
4155         public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = BOOLEAN_VALIDATOR;
4156 
4157         /**
4158          * When {@code 1}, Telecom enhanced call blocking functionality is enabled.  When
4159          * {@code 0}, enhanced call blocking functionality is disabled.
4160          * @hide
4161          */
4162         public static final String DEBUG_ENABLE_ENHANCED_CALL_BLOCKING =
4163                 "debug.enable_enhanced_calling";
4164 
4165         /**
4166          * Whether the audible DTMF tones are played by the dialer when dialing. The value is
4167          * boolean (1 or 0).
4168          */
4169         public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
4170 
4171         /** @hide */
4172         public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = BOOLEAN_VALIDATOR;
4173 
4174         /**
4175          * CDMA only settings
4176          * DTMF tone type played by the dialer when dialing.
4177          *                 0 = Normal
4178          *                 1 = Long
4179          */
4180         public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
4181 
4182         /** @hide */
4183         public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = BOOLEAN_VALIDATOR;
4184 
4185         /**
4186          * Whether the hearing aid is enabled. The value is
4187          * boolean (1 or 0).
4188          * @hide
4189          */
4190         @UnsupportedAppUsage
4191         public static final String HEARING_AID = "hearing_aid";
4192 
4193         /** @hide */
4194         public static final Validator HEARING_AID_VALIDATOR = BOOLEAN_VALIDATOR;
4195 
4196         /**
4197          * CDMA only settings
4198          * TTY Mode
4199          * 0 = OFF
4200          * 1 = FULL
4201          * 2 = VCO
4202          * 3 = HCO
4203          * @hide
4204          */
4205         @UnsupportedAppUsage
4206         public static final String TTY_MODE = "tty_mode";
4207 
4208         /** @hide */
4209         public static final Validator TTY_MODE_VALIDATOR =
4210                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 3);
4211 
4212         /**
4213          * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
4214          * boolean (1 or 0).
4215          */
4216         public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
4217 
4218         /** @hide */
4219         public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4220 
4221         /**
4222          * Whether haptic feedback (Vibrate on tap) is enabled. The value is
4223          * boolean (1 or 0).
4224          */
4225         public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
4226 
4227         /** @hide */
4228         public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4229 
4230         /**
4231          * @deprecated Each application that shows web suggestions should have its own
4232          * setting for this.
4233          */
4234         @Deprecated
4235         public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
4236 
4237         /** @hide */
4238         public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = BOOLEAN_VALIDATOR;
4239 
4240         /**
4241          * Whether the notification LED should repeatedly flash when a notification is
4242          * pending. The value is boolean (1 or 0).
4243          * @hide
4244          */
4245         @UnsupportedAppUsage
4246         public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
4247 
4248         /** @hide */
4249         public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = BOOLEAN_VALIDATOR;
4250 
4251         /**
4252          * Show pointer location on screen?
4253          * 0 = no
4254          * 1 = yes
4255          * @hide
4256          */
4257         @UnsupportedAppUsage
4258         public static final String POINTER_LOCATION = "pointer_location";
4259 
4260         /** @hide */
4261         public static final Validator POINTER_LOCATION_VALIDATOR = BOOLEAN_VALIDATOR;
4262 
4263         /**
4264          * Show touch positions on screen?
4265          * 0 = no
4266          * 1 = yes
4267          * @hide
4268          */
4269         @UnsupportedAppUsage
4270         public static final String SHOW_TOUCHES = "show_touches";
4271 
4272         /** @hide */
4273         public static final Validator SHOW_TOUCHES_VALIDATOR = BOOLEAN_VALIDATOR;
4274 
4275         /**
4276          * Log raw orientation data from
4277          * {@link com.android.server.policy.WindowOrientationListener} for use with the
4278          * orientationplot.py tool.
4279          * 0 = no
4280          * 1 = yes
4281          * @hide
4282          */
4283         public static final String WINDOW_ORIENTATION_LISTENER_LOG =
4284                 "window_orientation_listener_log";
4285 
4286         /** @hide */
4287         public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = BOOLEAN_VALIDATOR;
4288 
4289         /**
4290          * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED}
4291          * instead
4292          * @hide
4293          */
4294         @Deprecated
4295         public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED;
4296 
4297         private static final Validator POWER_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4298 
4299         /**
4300          * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED}
4301          * instead
4302          * @hide
4303          */
4304         @Deprecated
4305         @UnsupportedAppUsage
4306         public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED;
4307 
4308         private static final Validator DOCK_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4309 
4310         /**
4311          * Whether to play sounds when the keyguard is shown and dismissed.
4312          * @hide
4313          */
4314         @UnsupportedAppUsage
4315         public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
4316 
4317         /** @hide */
4318         public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4319 
4320         /**
4321          * Whether the lockscreen should be completely disabled.
4322          * @hide
4323          */
4324         public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
4325 
4326         /** @hide */
4327         public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4328 
4329         /**
4330          * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
4331          * instead
4332          * @hide
4333          */
4334         @Deprecated
4335         public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND;
4336 
4337         /**
4338          * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND}
4339          * instead
4340          * @hide
4341          */
4342         @Deprecated
4343         @UnsupportedAppUsage
4344         public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND;
4345 
4346         /**
4347          * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND}
4348          * instead
4349          * @hide
4350          */
4351         @Deprecated
4352         @UnsupportedAppUsage
4353         public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND;
4354 
4355         /**
4356          * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND}
4357          * instead
4358          * @hide
4359          */
4360         @Deprecated
4361         @UnsupportedAppUsage
4362         public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND;
4363 
4364         /**
4365          * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND}
4366          * instead
4367          * @hide
4368          */
4369         @Deprecated
4370         @UnsupportedAppUsage
4371         public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND;
4372 
4373         /**
4374          * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND}
4375          * instead
4376          * @hide
4377          */
4378         @Deprecated
4379         @UnsupportedAppUsage
4380         public static final String LOCK_SOUND = Global.LOCK_SOUND;
4381 
4382         /**
4383          * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND}
4384          * instead
4385          * @hide
4386          */
4387         @Deprecated
4388         @UnsupportedAppUsage
4389         public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND;
4390 
4391         /**
4392          * Receive incoming SIP calls?
4393          * 0 = no
4394          * 1 = yes
4395          * @hide
4396          */
4397         public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
4398 
4399         /** @hide */
4400         public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = BOOLEAN_VALIDATOR;
4401 
4402         /**
4403          * Call Preference String.
4404          * "SIP_ALWAYS" : Always use SIP with network access
4405          * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
4406          * @hide
4407          */
4408         public static final String SIP_CALL_OPTIONS = "sip_call_options";
4409 
4410         /** @hide */
4411         public static final Validator SIP_CALL_OPTIONS_VALIDATOR =
4412                 new SettingsValidators.DiscreteValueValidator(
4413                         new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"});
4414 
4415         /**
4416          * One of the sip call options: Always use SIP with network access.
4417          * @hide
4418          */
4419         public static final String SIP_ALWAYS = "SIP_ALWAYS";
4420 
4421         /** @hide */
4422         public static final Validator SIP_ALWAYS_VALIDATOR = BOOLEAN_VALIDATOR;
4423 
4424         /**
4425          * One of the sip call options: Only if destination is a SIP address.
4426          * @hide
4427          */
4428         public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
4429 
4430         /** @hide */
4431         public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = BOOLEAN_VALIDATOR;
4432 
4433         /**
4434          * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead.  Formerly used to indicate that
4435          * the user should be prompted each time a call is made whether it should be placed using
4436          * SIP.  The {@link com.android.providers.settings.DatabaseHelper} replaces this with
4437          * SIP_ADDRESS_ONLY.
4438          * @hide
4439          */
4440         @Deprecated
4441         public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
4442 
4443         /** @hide */
4444         public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = BOOLEAN_VALIDATOR;
4445 
4446         /**
4447          * Pointer speed setting.
4448          * This is an integer value in a range between -7 and +7, so there are 15 possible values.
4449          *   -7 = slowest
4450          *    0 = default speed
4451          *   +7 = fastest
4452          * @hide
4453          */
4454         @UnsupportedAppUsage
4455         public static final String POINTER_SPEED = "pointer_speed";
4456 
4457         /** @hide */
4458         public static final Validator POINTER_SPEED_VALIDATOR =
4459                 new SettingsValidators.InclusiveFloatRangeValidator(-7, 7);
4460 
4461         /**
4462          * Whether lock-to-app will be triggered by long-press on recents.
4463          * @hide
4464          */
4465         public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled";
4466 
4467         /** @hide */
4468         public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4469 
4470         /**
4471          * I am the lolrus.
4472          * <p>
4473          * Nonzero values indicate that the user has a bukkit.
4474          * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>.
4475          * @hide
4476          */
4477         public static final String EGG_MODE = "egg_mode";
4478 
4479         /** @hide */
4480         public static final Validator EGG_MODE_VALIDATOR = new Validator() {
4481             @Override
4482             public boolean validate(@Nullable String value) {
4483                 try {
4484                     return Long.parseLong(value) >= 0;
4485                 } catch (NumberFormatException e) {
4486                     return false;
4487                 }
4488             }
4489         };
4490 
4491         /**
4492          * Setting to determine whether or not to show the battery percentage in the status bar.
4493          *    0 - Don't show percentage
4494          *    1 - Show percentage
4495          * @hide
4496          */
4497         public static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
4498 
4499         /** @hide */
4500         private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = BOOLEAN_VALIDATOR;
4501 
4502         /**
4503          * IMPORTANT: If you add a new public settings you also have to add it to
4504          * PUBLIC_SETTINGS below. If the new setting is hidden you have to add
4505          * it to PRIVATE_SETTINGS below. Also add a validator that can validate
4506          * the setting value. See an example above.
4507          */
4508 
4509         /**
4510          * Settings to backup. This is here so that it's in the same place as the settings
4511          * keys and easy to update.
4512          *
4513          * NOTE: Settings are backed up and restored in the order they appear
4514          *       in this array. If you have one setting depending on another,
4515          *       make sure that they are ordered appropriately.
4516          *
4517          * @hide
4518          */
4519         @UnsupportedAppUsage
4520         public static final String[] SETTINGS_TO_BACKUP = {
4521             STAY_ON_WHILE_PLUGGED_IN,   // moved to global
4522             WIFI_USE_STATIC_IP,
4523             WIFI_STATIC_IP,
4524             WIFI_STATIC_GATEWAY,
4525             WIFI_STATIC_NETMASK,
4526             WIFI_STATIC_DNS1,
4527             WIFI_STATIC_DNS2,
4528             BLUETOOTH_DISCOVERABILITY,
4529             BLUETOOTH_DISCOVERABILITY_TIMEOUT,
4530             FONT_SCALE,
4531             DIM_SCREEN,
4532             SCREEN_OFF_TIMEOUT,
4533             SCREEN_BRIGHTNESS_MODE,
4534             SCREEN_AUTO_BRIGHTNESS_ADJ,
4535             SCREEN_BRIGHTNESS_FOR_VR,
4536             ADAPTIVE_SLEEP,
4537             VIBRATE_INPUT_DEVICES,
4538             MODE_RINGER_STREAMS_AFFECTED,
4539             TEXT_AUTO_REPLACE,
4540             TEXT_AUTO_CAPS,
4541             TEXT_AUTO_PUNCTUATE,
4542             TEXT_SHOW_PASSWORD,
4543             AUTO_TIME,                  // moved to global
4544             AUTO_TIME_ZONE,             // moved to global
4545             TIME_12_24,
4546             DATE_FORMAT,
4547             DTMF_TONE_WHEN_DIALING,
4548             DTMF_TONE_TYPE_WHEN_DIALING,
4549             HEARING_AID,
4550             TTY_MODE,
4551             MASTER_MONO,
4552             MASTER_BALANCE,
4553             SOUND_EFFECTS_ENABLED,
4554             HAPTIC_FEEDBACK_ENABLED,
4555             POWER_SOUNDS_ENABLED,       // moved to global
4556             DOCK_SOUNDS_ENABLED,        // moved to global
4557             LOCKSCREEN_SOUNDS_ENABLED,
4558             SHOW_WEB_SUGGESTIONS,
4559             SIP_CALL_OPTIONS,
4560             SIP_RECEIVE_CALLS,
4561             POINTER_SPEED,
4562             VIBRATE_WHEN_RINGING,
4563             RINGTONE,
4564             LOCK_TO_APP_ENABLED,
4565             NOTIFICATION_SOUND,
4566             ACCELEROMETER_ROTATION,
4567             SHOW_BATTERY_PERCENT,
4568             NOTIFICATION_VIBRATION_INTENSITY,
4569             RING_VIBRATION_INTENSITY,
4570             HAPTIC_FEEDBACK_INTENSITY,
4571             DISPLAY_COLOR_MODE,
4572             ALARM_ALERT,
4573             NOTIFICATION_LIGHT_PULSE,
4574         };
4575 
4576         /**
4577          * Keys we no longer back up under the current schema, but want to continue to
4578          * process when restoring historical backup datasets.
4579          *
4580          * All settings in {@link LEGACY_RESTORE_SETTINGS} array *must* have a non-null validator,
4581          * otherwise they won't be restored.
4582          *
4583          * @hide
4584          */
4585         public static final String[] LEGACY_RESTORE_SETTINGS = {
4586         };
4587 
4588         /**
4589          * These are all public system settings
4590          *
4591          * @hide
4592          */
4593         @UnsupportedAppUsage
4594         public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>();
4595         static {
4596             PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR);
4597             PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP);
4598             PUBLIC_SETTINGS.add(WIFI_STATIC_IP);
4599             PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY);
4600             PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK);
4601             PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1);
4602             PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2);
4603             PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY);
4604             PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT);
4605             PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED);
4606             PUBLIC_SETTINGS.add(FONT_SCALE);
4607             PUBLIC_SETTINGS.add(SYSTEM_LOCALES);
4608             PUBLIC_SETTINGS.add(DIM_SCREEN);
4609             PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT);
4610             PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS);
4611             PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_FOR_VR);
4612             PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE);
4613             PUBLIC_SETTINGS.add(ADAPTIVE_SLEEP);
4614             PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED);
4615             PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED);
4616             PUBLIC_SETTINGS.add(VIBRATE_ON);
4617             PUBLIC_SETTINGS.add(VOLUME_RING);
4618             PUBLIC_SETTINGS.add(VOLUME_SYSTEM);
4619             PUBLIC_SETTINGS.add(VOLUME_VOICE);
4620             PUBLIC_SETTINGS.add(VOLUME_MUSIC);
4621             PUBLIC_SETTINGS.add(VOLUME_ALARM);
4622             PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION);
4623             PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO);
4624             PUBLIC_SETTINGS.add(RINGTONE);
4625             PUBLIC_SETTINGS.add(NOTIFICATION_SOUND);
4626             PUBLIC_SETTINGS.add(ALARM_ALERT);
4627             PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE);
4628             PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS);
4629             PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
4630             PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD);
4631             PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS);
4632             PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY);
4633             PUBLIC_SETTINGS.add(TIME_12_24);
4634             PUBLIC_SETTINGS.add(DATE_FORMAT);
4635             PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN);
4636             PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION);
4637             PUBLIC_SETTINGS.add(USER_ROTATION);
4638             PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING);
4639             PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED);
4640             PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
4641             PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS);
4642             PUBLIC_SETTINGS.add(VIBRATE_WHEN_RINGING);
4643         }
4644 
4645         /**
4646          * These are all hidden system settings.
4647          *
4648          * @hide
4649          */
4650         @UnsupportedAppUsage
4651         public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>();
4652         static {
4653             PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP);
4654             PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR);
4655             PRIVATE_SETTINGS.add(ADVANCED_SETTINGS);
4656             PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ);
4657             PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES);
4658             PRIVATE_SETTINGS.add(VOLUME_MASTER);
4659             PRIVATE_SETTINGS.add(MASTER_MONO);
4660             PRIVATE_SETTINGS.add(MASTER_BALANCE);
4661             PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME);
4662             PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT);
4663             PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER);
4664             PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY);
4665             PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING);
4666             PRIVATE_SETTINGS.add(HEARING_AID);
4667             PRIVATE_SETTINGS.add(TTY_MODE);
4668             PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
4669             PRIVATE_SETTINGS.add(POINTER_LOCATION);
4670             PRIVATE_SETTINGS.add(SHOW_TOUCHES);
4671             PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
4672             PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
4673             PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
4674             PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED);
4675             PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED);
4676             PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND);
4677             PRIVATE_SETTINGS.add(DESK_DOCK_SOUND);
4678             PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND);
4679             PRIVATE_SETTINGS.add(CAR_DOCK_SOUND);
4680             PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND);
4681             PRIVATE_SETTINGS.add(LOCK_SOUND);
4682             PRIVATE_SETTINGS.add(UNLOCK_SOUND);
4683             PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS);
4684             PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS);
4685             PRIVATE_SETTINGS.add(SIP_ALWAYS);
4686             PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY);
4687             PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME);
4688             PRIVATE_SETTINGS.add(POINTER_SPEED);
4689             PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED);
4690             PRIVATE_SETTINGS.add(EGG_MODE);
4691             PRIVATE_SETTINGS.add(SHOW_BATTERY_PERCENT);
4692             PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE);
4693         }
4694 
4695         /**
4696          * These are all public system settings
4697          *
4698          * All settings in {@link SETTINGS_TO_BACKUP} array *must* have a non-null validator,
4699          * otherwise they won't be restored.
4700          *
4701          * @hide
4702          */
4703         @UnsupportedAppUsage
4704         public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
4705         static {
VALIDATORS.put(STAY_ON_WHILE_PLUGGED_IN, STAY_ON_WHILE_PLUGGED_IN_VALIDATOR)4706             VALIDATORS.put(STAY_ON_WHILE_PLUGGED_IN, STAY_ON_WHILE_PLUGGED_IN_VALIDATOR);
VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR)4707             VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR);
VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR)4708             VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR)4709             VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR);
VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT, BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR)4710             VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT,
4711                     BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR);
VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR)4712             VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR);
VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR)4713             VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR);
VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR)4714             VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR);
VALIDATORS.put(DISPLAY_COLOR_MODE, DISPLAY_COLOR_MODE_VALIDATOR)4715             VALIDATORS.put(DISPLAY_COLOR_MODE, DISPLAY_COLOR_MODE_VALIDATOR);
VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR)4716             VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR);
VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR)4717             VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR);
VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR)4718             VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR);
VALIDATORS.put(ADAPTIVE_SLEEP, ADAPTIVE_SLEEP_VALIDATOR)4719             VALIDATORS.put(ADAPTIVE_SLEEP, ADAPTIVE_SLEEP_VALIDATOR);
VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR)4720             VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR);
VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR)4721             VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR);
VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR)4722             VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR);
VALIDATORS.put(NOTIFICATION_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR)4723             VALIDATORS.put(NOTIFICATION_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR);
VALIDATORS.put(RING_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR)4724             VALIDATORS.put(RING_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR);
VALIDATORS.put(HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_VALIDATOR)4725             VALIDATORS.put(HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_VALIDATOR);
VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR)4726             VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR);
VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR)4727             VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR);
VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR)4728             VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR);
VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR)4729             VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR);
VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR)4730             VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR);
VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR)4731             VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR);
VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR)4732             VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR);
VALIDATORS.put(AUTO_TIME, AUTO_TIME_VALIDATOR)4733             VALIDATORS.put(AUTO_TIME, AUTO_TIME_VALIDATOR);
VALIDATORS.put(AUTO_TIME_ZONE, AUTO_TIME_ZONE_VALIDATOR)4734             VALIDATORS.put(AUTO_TIME_ZONE, AUTO_TIME_ZONE_VALIDATOR);
VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR)4735             VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR);
VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR)4736             VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR);
VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR)4737             VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR);
VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR)4738             VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR);
VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR)4739             VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR);
VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR)4740             VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR);
VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR)4741             VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR);
VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR)4742             VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR);
VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR)4743             VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR);
VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR)4744             VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR);
VALIDATORS.put(POWER_SOUNDS_ENABLED, POWER_SOUNDS_ENABLED_VALIDATOR)4745             VALIDATORS.put(POWER_SOUNDS_ENABLED, POWER_SOUNDS_ENABLED_VALIDATOR);
VALIDATORS.put(DOCK_SOUNDS_ENABLED, DOCK_SOUNDS_ENABLED_VALIDATOR)4746             VALIDATORS.put(DOCK_SOUNDS_ENABLED, DOCK_SOUNDS_ENABLED_VALIDATOR);
VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR)4747             VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR);
VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR)4748             VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR)4749             VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR);
VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR)4750             VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR);
VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR)4751             VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR);
VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR)4752             VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR);
VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR)4753             VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR);
VALIDATORS.put(MASTER_BALANCE, MASTER_BALANCE_VALIDATOR)4754             VALIDATORS.put(MASTER_BALANCE, MASTER_BALANCE_VALIDATOR);
VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR)4755             VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR);
VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR)4756             VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR);
VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR)4757             VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR);
VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR)4758             VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY,
4759                     HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR);
VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR)4760             VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR);
VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR)4761             VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR);
VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR)4762             VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR);
VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR)4763             VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR);
VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR)4764             VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR);
VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR)4765             VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR);
VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR)4766             VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR);
VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG, WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR)4767             VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG,
4768                     WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR);
VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR)4769             VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR);
VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR)4770             VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR);
VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR)4771             VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR);
VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR)4772             VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR);
VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR)4773             VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR);
VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR)4774             VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR);
VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR)4775             VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR);
VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR)4776             VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR);
VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR)4777             VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR);
VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR)4778             VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR);
VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR)4779             VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR);
VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR)4780             VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR);
VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR)4781             VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR);
VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR)4782             VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR)4783             VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR)4784             VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR);
VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR)4785             VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
4786         }
4787 
4788         /**
4789          * These entries are considered common between the personal and the managed profile,
4790          * since the managed profile doesn't get to change them.
4791          */
4792         @UnsupportedAppUsage
4793         private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
4794         static {
4795             CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT);
4796             CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED);
4797             CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED);
4798             CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD);
4799             CLONE_TO_MANAGED_PROFILE.add(TIME_12_24);
4800         }
4801 
4802         /** @hide */
getCloneToManagedProfileSettings(Set<String> outKeySet)4803         public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
4804             outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
4805         }
4806 
4807         /**
4808          * These entries should be cloned from this profile's parent only if the dependency's
4809          * value is true ("1")
4810          *
4811          * Note: the dependencies must be Secure settings
4812          *
4813          * @hide
4814          */
4815         public static final Map<String, String> CLONE_FROM_PARENT_ON_VALUE = new ArrayMap<>();
4816         static {
CLONE_FROM_PARENT_ON_VALUE.put(RINGTONE, Secure.SYNC_PARENT_SOUNDS)4817             CLONE_FROM_PARENT_ON_VALUE.put(RINGTONE, Secure.SYNC_PARENT_SOUNDS);
CLONE_FROM_PARENT_ON_VALUE.put(NOTIFICATION_SOUND, Secure.SYNC_PARENT_SOUNDS)4818             CLONE_FROM_PARENT_ON_VALUE.put(NOTIFICATION_SOUND, Secure.SYNC_PARENT_SOUNDS);
CLONE_FROM_PARENT_ON_VALUE.put(ALARM_ALERT, Secure.SYNC_PARENT_SOUNDS)4819             CLONE_FROM_PARENT_ON_VALUE.put(ALARM_ALERT, Secure.SYNC_PARENT_SOUNDS);
4820         }
4821 
4822         /** @hide */
getCloneFromParentOnValueSettings(Map<String, String> outMap)4823         public static void getCloneFromParentOnValueSettings(Map<String, String> outMap) {
4824             outMap.putAll(CLONE_FROM_PARENT_ON_VALUE);
4825         }
4826 
4827         /**
4828          * System settings which can be accessed by instant apps.
4829          * @hide
4830          */
4831         public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
4832         static {
4833             INSTANT_APP_SETTINGS.add(TEXT_AUTO_REPLACE);
4834             INSTANT_APP_SETTINGS.add(TEXT_AUTO_CAPS);
4835             INSTANT_APP_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
4836             INSTANT_APP_SETTINGS.add(TEXT_SHOW_PASSWORD);
4837             INSTANT_APP_SETTINGS.add(DATE_FORMAT);
4838             INSTANT_APP_SETTINGS.add(FONT_SCALE);
4839             INSTANT_APP_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
4840             INSTANT_APP_SETTINGS.add(TIME_12_24);
4841             INSTANT_APP_SETTINGS.add(SOUND_EFFECTS_ENABLED);
4842             INSTANT_APP_SETTINGS.add(ACCELEROMETER_ROTATION);
4843         }
4844 
4845         /**
4846          * When to use Wi-Fi calling
4847          *
4848          * @see android.telephony.TelephonyManager.WifiCallingChoices
4849          * @hide
4850          */
4851         public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
4852 
4853         // Settings moved to Settings.Secure
4854 
4855         /**
4856          * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
4857          * instead
4858          */
4859         @Deprecated
4860         public static final String ADB_ENABLED = Global.ADB_ENABLED;
4861 
4862         /**
4863          * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
4864          */
4865         @Deprecated
4866         public static final String ANDROID_ID = Secure.ANDROID_ID;
4867 
4868         /**
4869          * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
4870          */
4871         @Deprecated
4872         public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
4873 
4874         private static final Validator BLUETOOTH_ON_VALIDATOR = BOOLEAN_VALIDATOR;
4875 
4876         /**
4877          * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
4878          */
4879         @Deprecated
4880         public static final String DATA_ROAMING = Global.DATA_ROAMING;
4881 
4882         /**
4883          * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
4884          */
4885         @Deprecated
4886         public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
4887 
4888         /**
4889          * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
4890          */
4891         @Deprecated
4892         public static final String HTTP_PROXY = Global.HTTP_PROXY;
4893 
4894         /**
4895          * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
4896          */
4897         @Deprecated
4898         public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
4899 
4900         /**
4901          * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
4902          * instead
4903          */
4904         @Deprecated
4905         public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
4906 
4907         /**
4908          * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
4909          */
4910         @Deprecated
4911         public static final String LOGGING_ID = Secure.LOGGING_ID;
4912 
4913         /**
4914          * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
4915          */
4916         @Deprecated
4917         public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
4918 
4919         /**
4920          * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
4921          * instead
4922          */
4923         @Deprecated
4924         public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
4925 
4926         /**
4927          * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
4928          * instead
4929          */
4930         @Deprecated
4931         public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
4932 
4933         /**
4934          * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
4935          * instead
4936          */
4937         @Deprecated
4938         public static final String PARENTAL_CONTROL_REDIRECT_URL =
4939             Secure.PARENTAL_CONTROL_REDIRECT_URL;
4940 
4941         /**
4942          * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
4943          */
4944         @Deprecated
4945         public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
4946 
4947         /**
4948          * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
4949          */
4950         @Deprecated
4951         public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
4952 
4953         private static final Validator USB_MASS_STORAGE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
4954 
4955         /**
4956          * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
4957          */
4958         @Deprecated
4959         public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
4960 
4961        /**
4962          * @deprecated Use
4963          * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
4964          */
4965         @Deprecated
4966         public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
4967 
4968         /**
4969          * @deprecated Use
4970          * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
4971          */
4972         @Deprecated
4973         public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
4974                 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
4975 
4976         /**
4977          * @deprecated Use
4978          * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
4979          */
4980         @Deprecated
4981         public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
4982                 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
4983 
4984         private static final Validator WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR =
4985                 BOOLEAN_VALIDATOR;
4986 
4987         /**
4988          * @deprecated Use
4989          * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
4990          */
4991         @Deprecated
4992         public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
4993                 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
4994 
4995         private static final Validator WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY_VALIDATOR =
4996                 NON_NEGATIVE_INTEGER_VALIDATOR;
4997 
4998         /**
4999          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
5000          * instead
5001          */
5002         @Deprecated
5003         public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
5004 
5005         private static final Validator WIFI_NUM_OPEN_NETWORKS_KEPT_VALIDATOR =
5006                 NON_NEGATIVE_INTEGER_VALIDATOR;
5007 
5008         /**
5009          * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
5010          */
5011         @Deprecated
5012         public static final String WIFI_ON = Global.WIFI_ON;
5013 
5014         /**
5015          * @deprecated Use
5016          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
5017          * instead
5018          */
5019         @Deprecated
5020         public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
5021                 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
5022 
5023         /**
5024          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
5025          */
5026         @Deprecated
5027         public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
5028 
5029         /**
5030          * @deprecated Use
5031          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
5032          */
5033         @Deprecated
5034         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
5035                 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
5036 
5037         /**
5038          * @deprecated Use
5039          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
5040          */
5041         @Deprecated
5042         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
5043                 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
5044 
5045         /**
5046          * @deprecated Use
5047          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
5048          * instead
5049          */
5050         @Deprecated
5051         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
5052                 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
5053 
5054         /**
5055          * @deprecated Use
5056          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
5057          */
5058         @Deprecated
5059         public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
5060             Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
5061 
5062         /**
5063          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
5064          * instead
5065          */
5066         @Deprecated
5067         public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
5068 
5069         /**
5070          * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
5071          */
5072         @Deprecated
5073         public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
5074 
5075         /**
5076          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
5077          */
5078         @Deprecated
5079         public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
5080 
5081         /**
5082          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
5083          * instead
5084          */
5085         @Deprecated
5086         public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
5087 
5088         /**
5089          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
5090          * instead
5091          */
5092         @Deprecated
5093         public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
5094             Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
5095 
5096         /**
5097          * Checks if the specified app can modify system settings. As of API
5098          * level 23, an app cannot modify system settings unless it declares the
5099          * {@link android.Manifest.permission#WRITE_SETTINGS}
5100          * permission in its manifest, <em>and</em> the user specifically grants
5101          * the app this capability. To prompt the user to grant this approval,
5102          * the app must send an intent with the action {@link
5103          * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes
5104          * the system to display a permission management screen.
5105          *
5106          * @param context App context.
5107          * @return true if the calling app can write to system settings, false otherwise
5108          */
canWrite(Context context)5109         public static boolean canWrite(Context context) {
5110             return isCallingPackageAllowedToWriteSettings(context, Process.myUid(),
5111                     context.getOpPackageName(), false);
5112         }
5113     }
5114 
5115     /**
5116      * Secure system settings, containing system preferences that applications
5117      * can read but are not allowed to write.  These are for preferences that
5118      * the user must explicitly modify through the system UI or specialized
5119      * APIs for those values, not modified directly by applications.
5120      */
5121     public static final class Secure extends NameValueTable {
5122         // NOTE: If you add new settings here, be sure to add them to
5123         // com.android.providers.settings.SettingsProtoDumpUtil#dumpProtoSecureSettingsLocked.
5124 
5125         /**
5126          * The content:// style URL for this table
5127          */
5128         public static final Uri CONTENT_URI =
5129             Uri.parse("content://" + AUTHORITY + "/secure");
5130 
5131         @UnsupportedAppUsage
5132         private static final ContentProviderHolder sProviderHolder =
5133                 new ContentProviderHolder(CONTENT_URI);
5134 
5135         // Populated lazily, guarded by class object:
5136         @UnsupportedAppUsage
5137         private static final NameValueCache sNameValueCache = new NameValueCache(
5138                 CONTENT_URI,
5139                 CALL_METHOD_GET_SECURE,
5140                 CALL_METHOD_PUT_SECURE,
5141                 sProviderHolder);
5142 
5143         private static ILockSettings sLockSettings = null;
5144 
5145         private static boolean sIsSystemProcess;
5146         @UnsupportedAppUsage
5147         private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
5148         @UnsupportedAppUsage
5149         private static final HashSet<String> MOVED_TO_GLOBAL;
5150         static {
5151             MOVED_TO_LOCK_SETTINGS = new HashSet<>(3);
5152             MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
5153             MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
5154             MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
5155 
5156             MOVED_TO_GLOBAL = new HashSet<>();
5157             MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
5158             MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
5159             MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
5160             MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
5161             MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
5162             MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
5163             MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
5164             MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
5165             MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
5166             MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
5167             MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
5168             MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
5169             MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
5170             MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
5171             MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
5172             MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
5173             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
5174             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
5175             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
5176             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
5177             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
5178             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
5179             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
5180             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
5181             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
5182             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
5183             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
5184             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
5185             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
5186             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
5187             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
5188             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
5189             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
5190             MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
5191             MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
5192             MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
5193             MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
5194             MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
5195             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
5196             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
5197             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
5198             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
5199             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
5200             MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
5201             MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
5202             MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
5203             MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
5204             MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
5205             MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
5206             MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
5207             MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
5208             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
5209             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
5210             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
5211             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
5212             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
5213             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
5214             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
5215             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
5216             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
5217             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
5218             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
5219             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
5220             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
5221             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
5222             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED);
5223             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN);
5224             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI);
5225             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
5226             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
5227             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_PENDING_FACTORY_RESET);
5228             MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
5229             MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
5230             MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
5231             MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
5232             MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
5233             MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
5234             MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
5235             MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
5236             MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
5237             MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
5238             MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
5239             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
5240             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
5241             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
5242             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
5243             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
5244             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
5245             MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
5246             MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
5247             MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
5248             MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
5249             MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
5250             MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
5251             MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
5252             MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
5253             MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
5254             MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
5255             MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
5256             MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
5257             MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
5258             MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
5259             MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
5260             MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
5261             MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
5262             MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
5263             MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
5264             MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
5265             MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
5266             MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
5267             MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
5268             MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
5269         }
5270 
5271         /** @hide */
getMovedToGlobalSettings(Set<String> outKeySet)5272         public static void getMovedToGlobalSettings(Set<String> outKeySet) {
5273             outKeySet.addAll(MOVED_TO_GLOBAL);
5274         }
5275 
5276         /** @hide */
clearProviderForTest()5277         public static void clearProviderForTest() {
5278             sProviderHolder.clearProviderForTest();
5279             sNameValueCache.clearGenerationTrackerForTest();
5280         }
5281 
5282         /**
5283          * Look up a name in the database.
5284          * @param resolver to access the database with
5285          * @param name to look up in the table
5286          * @return the corresponding value, or null if not present
5287          */
getString(ContentResolver resolver, String name)5288         public static String getString(ContentResolver resolver, String name) {
5289             return getStringForUser(resolver, name, resolver.getUserId());
5290         }
5291 
5292         /** @hide */
5293         @UnsupportedAppUsage
getStringForUser(ContentResolver resolver, String name, int userHandle)5294         public static String getStringForUser(ContentResolver resolver, String name,
5295                 int userHandle) {
5296             if (MOVED_TO_GLOBAL.contains(name)) {
5297                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
5298                         + " to android.provider.Settings.Global.");
5299                 return Global.getStringForUser(resolver, name, userHandle);
5300             }
5301 
5302             if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
5303                 synchronized (Secure.class) {
5304                     if (sLockSettings == null) {
5305                         sLockSettings = ILockSettings.Stub.asInterface(
5306                                 (IBinder) ServiceManager.getService("lock_settings"));
5307                         sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
5308                     }
5309                 }
5310                 if (sLockSettings != null && !sIsSystemProcess) {
5311                     // No context; use the ActivityThread's context as an approximation for
5312                     // determining the target API level.
5313                     Application application = ActivityThread.currentApplication();
5314 
5315                     boolean isPreMnc = application != null
5316                             && application.getApplicationInfo() != null
5317                             && application.getApplicationInfo().targetSdkVersion
5318                             <= VERSION_CODES.LOLLIPOP_MR1;
5319                     if (isPreMnc) {
5320                         try {
5321                             return sLockSettings.getString(name, "0", userHandle);
5322                         } catch (RemoteException re) {
5323                             // Fall through
5324                         }
5325                     } else {
5326                         throw new SecurityException("Settings.Secure." + name
5327                                 + " is deprecated and no longer accessible."
5328                                 + " See API documentation for potential replacements.");
5329                     }
5330                 }
5331             }
5332 
5333             return sNameValueCache.getStringForUser(resolver, name, userHandle);
5334         }
5335 
5336         /**
5337          * Store a name/value pair into the database.
5338          * @param resolver to access the database with
5339          * @param name to store
5340          * @param value to associate with the name
5341          * @return true if the value was set, false on database errors
5342          */
putString(ContentResolver resolver, String name, String value)5343         public static boolean putString(ContentResolver resolver, String name, String value) {
5344             return putStringForUser(resolver, name, value, resolver.getUserId());
5345         }
5346 
5347         /** @hide */
5348         @UnsupportedAppUsage
putStringForUser(ContentResolver resolver, String name, String value, int userHandle)5349         public static boolean putStringForUser(ContentResolver resolver, String name, String value,
5350                 int userHandle) {
5351             return putStringForUser(resolver, name, value, null, false, userHandle);
5352         }
5353 
5354         /** @hide */
5355         @UnsupportedAppUsage
putStringForUser(@onNull ContentResolver resolver, @NonNull String name, @Nullable String value, @Nullable String tag, boolean makeDefault, @UserIdInt int userHandle)5356         public static boolean putStringForUser(@NonNull ContentResolver resolver,
5357                 @NonNull String name, @Nullable String value, @Nullable String tag,
5358                 boolean makeDefault, @UserIdInt int userHandle) {
5359             if (MOVED_TO_GLOBAL.contains(name)) {
5360                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
5361                         + " to android.provider.Settings.Global");
5362                 return Global.putStringForUser(resolver, name, value,
5363                         tag, makeDefault, userHandle);
5364             }
5365             return sNameValueCache.putStringForUser(resolver, name, value, tag,
5366                     makeDefault, userHandle);
5367         }
5368 
5369         /**
5370          * Store a name/value pair into the database.
5371          * <p>
5372          * The method takes an optional tag to associate with the setting
5373          * which can be used to clear only settings made by your package and
5374          * associated with this tag by passing the tag to {@link
5375          * #resetToDefaults(ContentResolver, String)}. Anyone can override
5376          * the current tag. Also if another package changes the setting
5377          * then the tag will be set to the one specified in the set call
5378          * which can be null. Also any of the settings setters that do not
5379          * take a tag as an argument effectively clears the tag.
5380          * </p><p>
5381          * For example, if you set settings A and B with tags T1 and T2 and
5382          * another app changes setting A (potentially to the same value), it
5383          * can assign to it a tag T3 (note that now the package that changed
5384          * the setting is not yours). Now if you reset your changes for T1 and
5385          * T2 only setting B will be reset and A not (as it was changed by
5386          * another package) but since A did not change you are in the desired
5387          * initial state. Now if the other app changes the value of A (assuming
5388          * you registered an observer in the beginning) you would detect that
5389          * the setting was changed by another app and handle this appropriately
5390          * (ignore, set back to some value, etc).
5391          * </p><p>
5392          * Also the method takes an argument whether to make the value the
5393          * default for this setting. If the system already specified a default
5394          * value, then the one passed in here will <strong>not</strong>
5395          * be set as the default.
5396          * </p>
5397          *
5398          * @param resolver to access the database with.
5399          * @param name to store.
5400          * @param value to associate with the name.
5401          * @param tag to associate with the setting.
5402          * @param makeDefault whether to make the value the default one.
5403          * @return true if the value was set, false on database errors.
5404          *
5405          * @see #resetToDefaults(ContentResolver, String)
5406          *
5407          * @hide
5408          */
5409         @SystemApi
5410         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
putString(@onNull ContentResolver resolver, @NonNull String name, @Nullable String value, @Nullable String tag, boolean makeDefault)5411         public static boolean putString(@NonNull ContentResolver resolver,
5412                 @NonNull String name, @Nullable String value, @Nullable String tag,
5413                 boolean makeDefault) {
5414             return putStringForUser(resolver, name, value, tag, makeDefault,
5415                     resolver.getUserId());
5416         }
5417 
5418         /**
5419          * Reset the settings to their defaults. This would reset <strong>only</strong>
5420          * settings set by the caller's package. Think of it of a way to undo your own
5421          * changes to the global settings. Passing in the optional tag will reset only
5422          * settings changed by your package and associated with this tag.
5423          *
5424          * @param resolver Handle to the content resolver.
5425          * @param tag Optional tag which should be associated with the settings to reset.
5426          *
5427          * @see #putString(ContentResolver, String, String, String, boolean)
5428          *
5429          * @hide
5430          */
5431         @SystemApi
5432         @TestApi
5433         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
resetToDefaults(@onNull ContentResolver resolver, @Nullable String tag)5434         public static void resetToDefaults(@NonNull ContentResolver resolver,
5435                 @Nullable String tag) {
5436             resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
5437                     resolver.getUserId());
5438         }
5439 
5440         /**
5441          *
5442          * Reset the settings to their defaults for a given user with a specific mode. The
5443          * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
5444          * allowing resetting the settings made by a package and associated with the tag.
5445          *
5446          * @param resolver Handle to the content resolver.
5447          * @param tag Optional tag which should be associated with the settings to reset.
5448          * @param mode The reset mode.
5449          * @param userHandle The user for which to reset to defaults.
5450          *
5451          * @see #RESET_MODE_PACKAGE_DEFAULTS
5452          * @see #RESET_MODE_UNTRUSTED_DEFAULTS
5453          * @see #RESET_MODE_UNTRUSTED_CHANGES
5454          * @see #RESET_MODE_TRUSTED_DEFAULTS
5455          *
5456          * @hide
5457          */
resetToDefaultsAsUser(@onNull ContentResolver resolver, @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle)5458         public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
5459                 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
5460             try {
5461                 Bundle arg = new Bundle();
5462                 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
5463                 if (tag != null) {
5464                     arg.putString(CALL_METHOD_TAG_KEY, tag);
5465                 }
5466                 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
5467                 IContentProvider cp = sProviderHolder.getProvider(resolver);
5468                 cp.call(resolver.getPackageName(), sProviderHolder.mUri.getAuthority(),
5469                         CALL_METHOD_RESET_SECURE, null, arg);
5470             } catch (RemoteException e) {
5471                 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
5472             }
5473         }
5474 
5475         /**
5476          * Construct the content URI for a particular name/value pair,
5477          * useful for monitoring changes with a ContentObserver.
5478          * @param name to look up in the table
5479          * @return the corresponding content URI, or null if not present
5480          */
getUriFor(String name)5481         public static Uri getUriFor(String name) {
5482             if (MOVED_TO_GLOBAL.contains(name)) {
5483                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
5484                         + " to android.provider.Settings.Global, returning global URI.");
5485                 return Global.getUriFor(Global.CONTENT_URI, name);
5486             }
5487             return getUriFor(CONTENT_URI, name);
5488         }
5489 
5490         /**
5491          * Convenience function for retrieving a single secure settings value
5492          * as an integer.  Note that internally setting values are always
5493          * stored as strings; this function converts the string to an integer
5494          * for you.  The default value will be returned if the setting is
5495          * not defined or not an integer.
5496          *
5497          * @param cr The ContentResolver to access.
5498          * @param name The name of the setting to retrieve.
5499          * @param def Value to return if the setting is not defined.
5500          *
5501          * @return The setting's current value, or 'def' if it is not defined
5502          * or not a valid integer.
5503          */
getInt(ContentResolver cr, String name, int def)5504         public static int getInt(ContentResolver cr, String name, int def) {
5505             return getIntForUser(cr, name, def, cr.getUserId());
5506         }
5507 
5508         /** @hide */
5509         @UnsupportedAppUsage
getIntForUser(ContentResolver cr, String name, int def, int userHandle)5510         public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
5511             String v = getStringForUser(cr, name, userHandle);
5512             try {
5513                 return v != null ? Integer.parseInt(v) : def;
5514             } catch (NumberFormatException e) {
5515                 return def;
5516             }
5517         }
5518 
5519         /**
5520          * Convenience function for retrieving a single secure settings value
5521          * as an integer.  Note that internally setting values are always
5522          * stored as strings; this function converts the string to an integer
5523          * for you.
5524          * <p>
5525          * This version does not take a default value.  If the setting has not
5526          * been set, or the string value is not a number,
5527          * it throws {@link SettingNotFoundException}.
5528          *
5529          * @param cr The ContentResolver to access.
5530          * @param name The name of the setting to retrieve.
5531          *
5532          * @throws SettingNotFoundException Thrown if a setting by the given
5533          * name can't be found or the setting value is not an integer.
5534          *
5535          * @return The setting's current value.
5536          */
getInt(ContentResolver cr, String name)5537         public static int getInt(ContentResolver cr, String name)
5538                 throws SettingNotFoundException {
5539             return getIntForUser(cr, name, cr.getUserId());
5540         }
5541 
5542         /** @hide */
getIntForUser(ContentResolver cr, String name, int userHandle)5543         public static int getIntForUser(ContentResolver cr, String name, int userHandle)
5544                 throws SettingNotFoundException {
5545             String v = getStringForUser(cr, name, userHandle);
5546             try {
5547                 return Integer.parseInt(v);
5548             } catch (NumberFormatException e) {
5549                 throw new SettingNotFoundException(name);
5550             }
5551         }
5552 
5553         /**
5554          * Convenience function for updating a single settings value as an
5555          * integer. This will either create a new entry in the table if the
5556          * given name does not exist, or modify the value of the existing row
5557          * with that name.  Note that internally setting values are always
5558          * stored as strings, so this function converts the given value to a
5559          * string before storing it.
5560          *
5561          * @param cr The ContentResolver to access.
5562          * @param name The name of the setting to modify.
5563          * @param value The new value for the setting.
5564          * @return true if the value was set, false on database errors
5565          */
putInt(ContentResolver cr, String name, int value)5566         public static boolean putInt(ContentResolver cr, String name, int value) {
5567             return putIntForUser(cr, name, value, cr.getUserId());
5568         }
5569 
5570         /** @hide */
5571         @UnsupportedAppUsage
putIntForUser(ContentResolver cr, String name, int value, int userHandle)5572         public static boolean putIntForUser(ContentResolver cr, String name, int value,
5573                 int userHandle) {
5574             return putStringForUser(cr, name, Integer.toString(value), userHandle);
5575         }
5576 
5577         /**
5578          * Convenience function for retrieving a single secure settings value
5579          * as a {@code long}.  Note that internally setting values are always
5580          * stored as strings; this function converts the string to a {@code long}
5581          * for you.  The default value will be returned if the setting is
5582          * not defined or not a {@code long}.
5583          *
5584          * @param cr The ContentResolver to access.
5585          * @param name The name of the setting to retrieve.
5586          * @param def Value to return if the setting is not defined.
5587          *
5588          * @return The setting's current value, or 'def' if it is not defined
5589          * or not a valid {@code long}.
5590          */
getLong(ContentResolver cr, String name, long def)5591         public static long getLong(ContentResolver cr, String name, long def) {
5592             return getLongForUser(cr, name, def, cr.getUserId());
5593         }
5594 
5595         /** @hide */
5596         @UnsupportedAppUsage
getLongForUser(ContentResolver cr, String name, long def, int userHandle)5597         public static long getLongForUser(ContentResolver cr, String name, long def,
5598                 int userHandle) {
5599             String valString = getStringForUser(cr, name, userHandle);
5600             long value;
5601             try {
5602                 value = valString != null ? Long.parseLong(valString) : def;
5603             } catch (NumberFormatException e) {
5604                 value = def;
5605             }
5606             return value;
5607         }
5608 
5609         /**
5610          * Convenience function for retrieving a single secure settings value
5611          * as a {@code long}.  Note that internally setting values are always
5612          * stored as strings; this function converts the string to a {@code long}
5613          * for you.
5614          * <p>
5615          * This version does not take a default value.  If the setting has not
5616          * been set, or the string value is not a number,
5617          * it throws {@link SettingNotFoundException}.
5618          *
5619          * @param cr The ContentResolver to access.
5620          * @param name The name of the setting to retrieve.
5621          *
5622          * @return The setting's current value.
5623          * @throws SettingNotFoundException Thrown if a setting by the given
5624          * name can't be found or the setting value is not an integer.
5625          */
getLong(ContentResolver cr, String name)5626         public static long getLong(ContentResolver cr, String name)
5627                 throws SettingNotFoundException {
5628             return getLongForUser(cr, name, cr.getUserId());
5629         }
5630 
5631         /** @hide */
getLongForUser(ContentResolver cr, String name, int userHandle)5632         public static long getLongForUser(ContentResolver cr, String name, int userHandle)
5633                 throws SettingNotFoundException {
5634             String valString = getStringForUser(cr, name, userHandle);
5635             try {
5636                 return Long.parseLong(valString);
5637             } catch (NumberFormatException e) {
5638                 throw new SettingNotFoundException(name);
5639             }
5640         }
5641 
5642         /**
5643          * Convenience function for updating a secure settings value as a long
5644          * integer. This will either create a new entry in the table if the
5645          * given name does not exist, or modify the value of the existing row
5646          * with that name.  Note that internally setting values are always
5647          * stored as strings, so this function converts the given value to a
5648          * string before storing it.
5649          *
5650          * @param cr The ContentResolver to access.
5651          * @param name The name of the setting to modify.
5652          * @param value The new value for the setting.
5653          * @return true if the value was set, false on database errors
5654          */
putLong(ContentResolver cr, String name, long value)5655         public static boolean putLong(ContentResolver cr, String name, long value) {
5656             return putLongForUser(cr, name, value, cr.getUserId());
5657         }
5658 
5659         /** @hide */
5660         @UnsupportedAppUsage
putLongForUser(ContentResolver cr, String name, long value, int userHandle)5661         public static boolean putLongForUser(ContentResolver cr, String name, long value,
5662                 int userHandle) {
5663             return putStringForUser(cr, name, Long.toString(value), userHandle);
5664         }
5665 
5666         /**
5667          * Convenience function for retrieving a single secure settings value
5668          * as a floating point number.  Note that internally setting values are
5669          * always stored as strings; this function converts the string to an
5670          * float for you. The default value will be returned if the setting
5671          * is not defined or not a valid float.
5672          *
5673          * @param cr The ContentResolver to access.
5674          * @param name The name of the setting to retrieve.
5675          * @param def Value to return if the setting is not defined.
5676          *
5677          * @return The setting's current value, or 'def' if it is not defined
5678          * or not a valid float.
5679          */
getFloat(ContentResolver cr, String name, float def)5680         public static float getFloat(ContentResolver cr, String name, float def) {
5681             return getFloatForUser(cr, name, def, cr.getUserId());
5682         }
5683 
5684         /** @hide */
getFloatForUser(ContentResolver cr, String name, float def, int userHandle)5685         public static float getFloatForUser(ContentResolver cr, String name, float def,
5686                 int userHandle) {
5687             String v = getStringForUser(cr, name, userHandle);
5688             try {
5689                 return v != null ? Float.parseFloat(v) : def;
5690             } catch (NumberFormatException e) {
5691                 return def;
5692             }
5693         }
5694 
5695         /**
5696          * Convenience function for retrieving a single secure settings value
5697          * as a float.  Note that internally setting values are always
5698          * stored as strings; this function converts the string to a float
5699          * for you.
5700          * <p>
5701          * This version does not take a default value.  If the setting has not
5702          * been set, or the string value is not a number,
5703          * it throws {@link SettingNotFoundException}.
5704          *
5705          * @param cr The ContentResolver to access.
5706          * @param name The name of the setting to retrieve.
5707          *
5708          * @throws SettingNotFoundException Thrown if a setting by the given
5709          * name can't be found or the setting value is not a float.
5710          *
5711          * @return The setting's current value.
5712          */
getFloat(ContentResolver cr, String name)5713         public static float getFloat(ContentResolver cr, String name)
5714                 throws SettingNotFoundException {
5715             return getFloatForUser(cr, name, cr.getUserId());
5716         }
5717 
5718         /** @hide */
getFloatForUser(ContentResolver cr, String name, int userHandle)5719         public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
5720                 throws SettingNotFoundException {
5721             String v = getStringForUser(cr, name, userHandle);
5722             if (v == null) {
5723                 throw new SettingNotFoundException(name);
5724             }
5725             try {
5726                 return Float.parseFloat(v);
5727             } catch (NumberFormatException e) {
5728                 throw new SettingNotFoundException(name);
5729             }
5730         }
5731 
5732         /**
5733          * Convenience function for updating a single settings value as a
5734          * floating point number. This will either create a new entry in the
5735          * table if the given name does not exist, or modify the value of the
5736          * existing row with that name.  Note that internally setting values
5737          * are always stored as strings, so this function converts the given
5738          * value to a string before storing it.
5739          *
5740          * @param cr The ContentResolver to access.
5741          * @param name The name of the setting to modify.
5742          * @param value The new value for the setting.
5743          * @return true if the value was set, false on database errors
5744          */
putFloat(ContentResolver cr, String name, float value)5745         public static boolean putFloat(ContentResolver cr, String name, float value) {
5746             return putFloatForUser(cr, name, value, cr.getUserId());
5747         }
5748 
5749         /** @hide */
putFloatForUser(ContentResolver cr, String name, float value, int userHandle)5750         public static boolean putFloatForUser(ContentResolver cr, String name, float value,
5751                 int userHandle) {
5752             return putStringForUser(cr, name, Float.toString(value), userHandle);
5753         }
5754 
5755         /**
5756          * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
5757          * instead
5758          */
5759         @Deprecated
5760         public static final String DEVELOPMENT_SETTINGS_ENABLED =
5761                 Global.DEVELOPMENT_SETTINGS_ENABLED;
5762 
5763         /**
5764          * When the user has enable the option to have a "bug report" command
5765          * in the power menu.
5766          * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
5767          * @hide
5768          */
5769         @Deprecated
5770         public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
5771 
5772         private static final Validator BUGREPORT_IN_POWER_MENU_VALIDATOR = BOOLEAN_VALIDATOR;
5773 
5774         /**
5775          * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
5776          */
5777         @Deprecated
5778         public static final String ADB_ENABLED = Global.ADB_ENABLED;
5779 
5780         /**
5781          * Setting to allow mock locations and location provider status to be injected into the
5782          * LocationManager service for testing purposes during application development.  These
5783          * locations and status values  override actual location and status information generated
5784          * by network, gps, or other location providers.
5785          *
5786          * @deprecated This settings is not used anymore.
5787          */
5788         @Deprecated
5789         public static final String ALLOW_MOCK_LOCATION = "mock_location";
5790 
5791         private static final Validator ALLOW_MOCK_LOCATION_VALIDATOR = BOOLEAN_VALIDATOR;
5792 
5793         /**
5794          * Setting to indicate that on device captions are enabled.
5795          *
5796          * @hide
5797          */
5798         @SystemApi
5799         public static final String ODI_CAPTIONS_ENABLED = "odi_captions_enabled";
5800 
5801         private static final Validator ODI_CAPTIONS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
5802 
5803         /**
5804          * On Android 8.0 (API level 26) and higher versions of the platform,
5805          * a 64-bit number (expressed as a hexadecimal string), unique to
5806          * each combination of app-signing key, user, and device.
5807          * Values of {@code ANDROID_ID} are scoped by signing key and user.
5808          * The value may change if a factory reset is performed on the
5809          * device or if an APK signing key changes.
5810          *
5811          * For more information about how the platform handles {@code ANDROID_ID}
5812          * in Android 8.0 (API level 26) and higher, see <a
5813          * href="{@docRoot}about/versions/oreo/android-8.0-changes.html#privacy-all">
5814          * Android 8.0 Behavior Changes</a>.
5815          *
5816          * <p class="note"><strong>Note:</strong> For apps that were installed
5817          * prior to updating the device to a version of Android 8.0
5818          * (API level 26) or higher, the value of {@code ANDROID_ID} changes
5819          * if the app is uninstalled and then reinstalled after the OTA.
5820          * To preserve values across uninstalls after an OTA to Android 8.0
5821          * or higher, developers can use
5822          * <a href="{@docRoot}guide/topics/data/keyvaluebackup.html">
5823          * Key/Value Backup</a>.</p>
5824          *
5825          * <p>In versions of the platform lower than Android 8.0 (API level 26),
5826          * a 64-bit number (expressed as a hexadecimal string) that is randomly
5827          * generated when the user first sets up the device and should remain
5828          * constant for the lifetime of the user's device.
5829          *
5830          * On devices that have
5831          * <a href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">
5832          * multiple users</a>, each user appears as a
5833          * completely separate device, so the {@code ANDROID_ID} value is
5834          * unique to each user.</p>
5835          *
5836          * <p class="note"><strong>Note:</strong> If the caller is an Instant App the ID is scoped
5837          * to the Instant App, it is generated when the Instant App is first installed and reset if
5838          * the user clears the Instant App.
5839          */
5840         public static final String ANDROID_ID = "android_id";
5841 
5842         /**
5843          * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
5844          */
5845         @Deprecated
5846         public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
5847 
5848         private static final Validator BLUETOOTH_ON_VALIDATOR = BOOLEAN_VALIDATOR;
5849 
5850         /**
5851          * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
5852          */
5853         @Deprecated
5854         public static final String DATA_ROAMING = Global.DATA_ROAMING;
5855 
5856         /**
5857          * Setting to record the input method used by default, holding the ID
5858          * of the desired method.
5859          */
5860         public static final String DEFAULT_INPUT_METHOD = "default_input_method";
5861 
5862         /**
5863          * Setting to record the input method subtype used by default, holding the ID
5864          * of the desired method.
5865          */
5866         public static final String SELECTED_INPUT_METHOD_SUBTYPE =
5867                 "selected_input_method_subtype";
5868 
5869         /**
5870          * Setting to record the history of input method subtype, holding the pair of ID of IME
5871          * and its last used subtype.
5872          * @hide
5873          */
5874         public static final String INPUT_METHODS_SUBTYPE_HISTORY =
5875                 "input_methods_subtype_history";
5876 
5877         /**
5878          * Setting to record the visibility of input method selector
5879          */
5880         public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
5881                 "input_method_selector_visibility";
5882 
5883         /**
5884          * The currently selected voice interaction service flattened ComponentName.
5885          * @hide
5886          */
5887         @TestApi
5888         public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
5889 
5890         /**
5891          * The currently selected autofill service flattened ComponentName.
5892          * @hide
5893          */
5894         @TestApi
5895         public static final String AUTOFILL_SERVICE = "autofill_service";
5896 
5897         private static final Validator AUTOFILL_SERVICE_VALIDATOR =
5898                 NULLABLE_COMPONENT_NAME_VALIDATOR;
5899 
5900         /**
5901          * Boolean indicating if Autofill supports field classification.
5902          *
5903          * @see android.service.autofill.AutofillService
5904          *
5905          * @hide
5906          */
5907         @SystemApi
5908         @TestApi
5909         public static final String AUTOFILL_FEATURE_FIELD_CLASSIFICATION =
5910                 "autofill_field_classification";
5911 
5912         /**
5913          * Boolean indicating if the dark mode dialog shown on first toggle has been seen.
5914          *
5915          * @hide
5916          */
5917         public static final String DARK_MODE_DIALOG_SEEN =
5918                 "dark_mode_dialog_seen";
5919 
5920         /**
5921          * Defines value returned by {@link android.service.autofill.UserData#getMaxUserDataSize()}.
5922          *
5923          * @hide
5924          */
5925         @SystemApi
5926         @TestApi
5927         public static final String AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE =
5928                 "autofill_user_data_max_user_data_size";
5929 
5930         /**
5931          * Defines value returned by
5932          * {@link android.service.autofill.UserData#getMaxFieldClassificationIdsSize()}.
5933          *
5934          * @hide
5935          */
5936         @SystemApi
5937         @TestApi
5938         public static final String AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE =
5939                 "autofill_user_data_max_field_classification_size";
5940 
5941         /**
5942          * Defines value returned by
5943          * {@link android.service.autofill.UserData#getMaxCategoryCount()}.
5944          *
5945          * @hide
5946          */
5947         @SystemApi
5948         @TestApi
5949         public static final String AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT =
5950                 "autofill_user_data_max_category_count";
5951 
5952         /**
5953          * Defines value returned by {@link android.service.autofill.UserData#getMaxValueLength()}.
5954          *
5955          * @hide
5956          */
5957         @SystemApi
5958         @TestApi
5959         public static final String AUTOFILL_USER_DATA_MAX_VALUE_LENGTH =
5960                 "autofill_user_data_max_value_length";
5961 
5962         /**
5963          * Defines value returned by {@link android.service.autofill.UserData#getMinValueLength()}.
5964          *
5965          * @hide
5966          */
5967         @SystemApi
5968         @TestApi
5969         public static final String AUTOFILL_USER_DATA_MIN_VALUE_LENGTH =
5970                 "autofill_user_data_min_value_length";
5971 
5972         /**
5973          * Defines whether Content Capture is enabled for the user.
5974          *
5975          * <p>Type: {@code int} ({@code 0} for disabled, {@code 1} for enabled).
5976          * <p>Default: enabled
5977          *
5978          * @hide
5979          */
5980         @TestApi
5981         public static final String CONTENT_CAPTURE_ENABLED = "content_capture_enabled";
5982 
5983         /**
5984          * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
5985          */
5986         @Deprecated
5987         public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
5988 
5989         /**
5990          * Indicates whether a DPC has been downloaded during provisioning.
5991          *
5992          * <p>Type: int (0 for false, 1 for true)
5993          *
5994          * <p>If this is true, then any attempts to begin setup again should result in factory reset
5995          *
5996          * @hide
5997          */
5998         public static final String MANAGED_PROVISIONING_DPC_DOWNLOADED =
5999                 "managed_provisioning_dpc_downloaded";
6000 
6001         /**
6002          * Indicates whether the current user has completed setup via the setup wizard.
6003          * <p>
6004          * Type: int (0 for false, 1 for true)
6005          *
6006          * @hide
6007          */
6008         @SystemApi
6009         @TestApi
6010         public static final String USER_SETUP_COMPLETE = "user_setup_complete";
6011 
6012         /**
6013          * Indicates that the user has not started setup personalization.
6014          * One of the possible states for {@link #USER_SETUP_PERSONALIZATION_STATE}.
6015          *
6016          * @hide
6017          */
6018         @SystemApi
6019         public static final int USER_SETUP_PERSONALIZATION_NOT_STARTED = 0;
6020 
6021         /**
6022          * Indicates that the user has not yet completed setup personalization.
6023          * One of the possible states for {@link #USER_SETUP_PERSONALIZATION_STATE}.
6024          *
6025          * @hide
6026          */
6027         @SystemApi
6028         public static final int USER_SETUP_PERSONALIZATION_STARTED = 1;
6029 
6030         /**
6031          * Indicates that the user has snoozed personalization and will complete it later.
6032          * One of the possible states for {@link #USER_SETUP_PERSONALIZATION_STATE}.
6033          *
6034          * @hide
6035          */
6036         @SystemApi
6037         public static final int USER_SETUP_PERSONALIZATION_PAUSED = 2;
6038 
6039         /**
6040          * Indicates that the user has completed setup personalization.
6041          * One of the possible states for {@link #USER_SETUP_PERSONALIZATION_STATE}.
6042          *
6043          * @hide
6044          */
6045         @SystemApi
6046         public static final int USER_SETUP_PERSONALIZATION_COMPLETE = 10;
6047 
6048         /** @hide */
6049         @Retention(RetentionPolicy.SOURCE)
6050         @IntDef({
6051                 USER_SETUP_PERSONALIZATION_NOT_STARTED,
6052                 USER_SETUP_PERSONALIZATION_STARTED,
6053                 USER_SETUP_PERSONALIZATION_PAUSED,
6054                 USER_SETUP_PERSONALIZATION_COMPLETE
6055         })
6056         public @interface UserSetupPersonalization {}
6057 
6058         /**
6059          * Defines the user's current state of device personalization.
6060          * The possible states are defined in {@link UserSetupPersonalization}.
6061          *
6062          * @hide
6063          */
6064         @SystemApi
6065         public static final String USER_SETUP_PERSONALIZATION_STATE =
6066                 "user_setup_personalization_state";
6067 
6068         /**
6069          * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
6070          * This value differs from USER_SETUP_COMPLETE in that it can be reset back to 0
6071          * in case SetupWizard has been re-enabled on TV devices.
6072          *
6073          * @hide
6074          */
6075         public static final String TV_USER_SETUP_COMPLETE = "tv_user_setup_complete";
6076 
6077         /**
6078          * The prefix for a category name that indicates whether a suggested action from that
6079          * category was marked as completed.
6080          * <p>
6081          * Type: int (0 for false, 1 for true)
6082          *
6083          * @hide
6084          */
6085         @SystemApi
6086         public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category.";
6087 
6088         /**
6089          * List of input methods that are currently enabled.  This is a string
6090          * containing the IDs of all enabled input methods, each ID separated
6091          * by ':'.
6092          *
6093          * Format like "ime0;subtype0;subtype1;subtype2:ime1:ime2;subtype0"
6094          * where imeId is ComponentName and subtype is int32.
6095          */
6096         public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
6097 
6098         /**
6099          * List of system input methods that are currently disabled.  This is a string
6100          * containing the IDs of all disabled input methods, each ID separated
6101          * by ':'.
6102          * @hide
6103          */
6104         public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
6105 
6106         /**
6107          * Whether to show the IME when a hard keyboard is connected. This is a boolean that
6108          * determines if the IME should be shown when a hard keyboard is attached.
6109          * @hide
6110          */
6111         public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
6112 
6113         private static final Validator SHOW_IME_WITH_HARD_KEYBOARD_VALIDATOR = BOOLEAN_VALIDATOR;
6114 
6115         /**
6116          * Host name and port for global http proxy. Uses ':' seperator for
6117          * between host and port.
6118          *
6119          * @deprecated Use {@link Global#HTTP_PROXY}
6120          */
6121         @Deprecated
6122         public static final String HTTP_PROXY = Global.HTTP_PROXY;
6123 
6124         /**
6125          * Package designated as always-on VPN provider.
6126          *
6127          * @hide
6128          */
6129         public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app";
6130 
6131         /**
6132          * Whether to block networking outside of VPN connections while always-on is set.
6133          * @see #ALWAYS_ON_VPN_APP
6134          *
6135          * @hide
6136          */
6137         public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown";
6138 
6139         /**
6140          * Comma separated list of packages that are allowed to access the network when VPN is in
6141          * lockdown mode but not running.
6142          * @see #ALWAYS_ON_VPN_LOCKDOWN
6143          *
6144          * @hide
6145          */
6146         public static final String ALWAYS_ON_VPN_LOCKDOWN_WHITELIST =
6147                 "always_on_vpn_lockdown_whitelist";
6148 
6149         /**
6150          * Whether applications can be installed for this user via the system's
6151          * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
6152          *
6153          * <p>1 = permit app installation via the system package installer intent
6154          * <p>0 = do not allow use of the package installer
6155          * @deprecated Starting from {@link android.os.Build.VERSION_CODES#O}, apps should use
6156          * {@link PackageManager#canRequestPackageInstalls()}
6157          * @see PackageManager#canRequestPackageInstalls()
6158          */
6159         public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
6160 
6161         /**
6162          * A flag to tell {@link com.android.server.devicepolicy.DevicePolicyManagerService} that
6163          * the default for {@link #INSTALL_NON_MARKET_APPS} is reversed for this user on OTA. So it
6164          * can set the restriction {@link android.os.UserManager#DISALLOW_INSTALL_UNKNOWN_SOURCES}
6165          * on behalf of the profile owner if needed to make the change transparent for profile
6166          * owners.
6167          *
6168          * @hide
6169          */
6170         public static final String UNKNOWN_SOURCES_DEFAULT_REVERSED =
6171                 "unknown_sources_default_reversed";
6172 
6173         /**
6174          * Comma-separated list of location providers that are enabled. Do not rely on this value
6175          * being present or correct, or on ContentObserver notifications on the corresponding Uri.
6176          *
6177          * @deprecated The preferred methods for checking provider status and listening for changes
6178          * are via {@link LocationManager#isProviderEnabled(String)} and
6179          * {@link LocationManager#PROVIDERS_CHANGED_ACTION}.
6180          */
6181         @Deprecated
6182         public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
6183 
6184         /**
6185          * The current location mode of the device. Do not rely on this value being present or on
6186          * ContentObserver notifications on the corresponding Uri.
6187          *
6188          * @deprecated The preferred methods for checking location mode and listening for changes
6189          * are via {@link LocationManager#isLocationEnabled()} and
6190          * {@link LocationManager#MODE_CHANGED_ACTION}.
6191          */
6192         @Deprecated
6193         public static final String LOCATION_MODE = "location_mode";
6194 
6195         /**
6196          * The App or module that changes the location mode.
6197          * @hide
6198          */
6199         public static final String LOCATION_CHANGER = "location_changer";
6200         /**
6201          * The location changer is unknown or unable to detect.
6202          * @hide
6203          */
6204         public static final int LOCATION_CHANGER_UNKNOWN = 0;
6205         /**
6206          * Location settings in system settings.
6207          * @hide
6208          */
6209         public static final int LOCATION_CHANGER_SYSTEM_SETTINGS = 1;
6210         /**
6211          * The location icon in drop down notification drawer.
6212          * @hide
6213          */
6214         public static final int LOCATION_CHANGER_QUICK_SETTINGS = 2;
6215 
6216         /**
6217          * Location mode is off.
6218          */
6219         public static final int LOCATION_MODE_OFF = 0;
6220 
6221         /**
6222          * This mode no longer has any distinct meaning, but is interpreted as the location mode is
6223          * on.
6224          *
6225          * @deprecated See {@link #LOCATION_MODE}.
6226          */
6227         @Deprecated
6228         public static final int LOCATION_MODE_SENSORS_ONLY = 1;
6229 
6230         /**
6231          * This mode no longer has any distinct meaning, but is interpreted as the location mode is
6232          * on.
6233          *
6234          * @deprecated See {@link #LOCATION_MODE}.
6235          */
6236         @Deprecated
6237         public static final int LOCATION_MODE_BATTERY_SAVING = 2;
6238 
6239         /**
6240          * This mode no longer has any distinct meaning, but is interpreted as the location mode is
6241          * on.
6242          *
6243          * @deprecated See {@link #LOCATION_MODE}.
6244          */
6245         @Deprecated
6246         public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
6247 
6248         /**
6249          * Location mode is on.
6250          *
6251          * @hide
6252          */
6253         @SystemApi
6254         public static final int LOCATION_MODE_ON = LOCATION_MODE_HIGH_ACCURACY;
6255 
6256         /**
6257          * A flag containing settings used for biometric weak
6258          * @hide
6259          */
6260         @Deprecated
6261         public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
6262                 "lock_biometric_weak_flags";
6263 
6264         /**
6265          * Whether lock-to-app will lock the keyguard when exiting.
6266          * @hide
6267          */
6268         public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
6269 
6270         /**
6271          * Whether autolock is enabled (0 = false, 1 = true)
6272          *
6273          * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
6274          *             level of the keyguard. Accessing this setting from an app that is targeting
6275          *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
6276          */
6277         @Deprecated
6278         public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
6279 
6280         /**
6281          * Whether lock pattern is visible as user enters (0 = false, 1 = true)
6282          *
6283          * @deprecated Accessing this setting from an app that is targeting
6284          *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
6285          */
6286         @Deprecated
6287         public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
6288 
6289         /**
6290          * Whether lock pattern will vibrate as user enters (0 = false, 1 =
6291          * true)
6292          *
6293          * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
6294          *             lockscreen uses
6295          *             {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
6296          *             Accessing this setting from an app that is targeting
6297          *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
6298          */
6299         @Deprecated
6300         public static final String
6301                 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
6302 
6303         /**
6304          * This preference allows the device to be locked given time after screen goes off,
6305          * subject to current DeviceAdmin policy limits.
6306          * @hide
6307          */
6308         @UnsupportedAppUsage
6309         public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
6310 
6311 
6312         /**
6313          * This preference contains the string that shows for owner info on LockScreen.
6314          * @hide
6315          * @deprecated
6316          */
6317         @Deprecated
6318         public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
6319 
6320         /**
6321          * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
6322          * @hide
6323          */
6324         @Deprecated
6325         public static final String LOCK_SCREEN_APPWIDGET_IDS =
6326             "lock_screen_appwidget_ids";
6327 
6328         /**
6329          * Id of the appwidget shown on the lock screen when appwidgets are disabled.
6330          * @hide
6331          */
6332         @Deprecated
6333         public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
6334             "lock_screen_fallback_appwidget_id";
6335 
6336         /**
6337          * Index of the lockscreen appwidget to restore, -1 if none.
6338          * @hide
6339          */
6340         @Deprecated
6341         public static final String LOCK_SCREEN_STICKY_APPWIDGET =
6342             "lock_screen_sticky_appwidget";
6343 
6344         /**
6345          * This preference enables showing the owner info on LockScreen.
6346          * @hide
6347          * @deprecated
6348          */
6349         @Deprecated
6350         @UnsupportedAppUsage
6351         public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
6352             "lock_screen_owner_info_enabled";
6353 
6354         /**
6355          * Indicates whether the user has allowed notifications to be shown atop a securely locked
6356          * screen in their full "private" form (same as when the device is unlocked).
6357          * <p>
6358          * Type: int (0 for false, 1 for true)
6359          *
6360          * @hide
6361          */
6362         @SystemApi
6363         public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
6364                 "lock_screen_allow_private_notifications";
6365 
6366         /**
6367          * When set by a user, allows notification remote input atop a securely locked screen
6368          * without having to unlock
6369          * @hide
6370          */
6371         public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT =
6372                 "lock_screen_allow_remote_input";
6373 
6374         /**
6375          * Indicates which clock face to show on lock screen and AOD formatted as a serialized
6376          * {@link org.json.JSONObject} with the format:
6377          *     {"clock": id, "_applied_timestamp": timestamp}
6378          * @hide
6379          */
6380         public static final String LOCK_SCREEN_CUSTOM_CLOCK_FACE = "lock_screen_custom_clock_face";
6381 
6382         private static final Validator LOCK_SCREEN_CUSTOM_CLOCK_FACE_VALIDATOR =
6383                 SettingsValidators.JSON_OBJECT_VALIDATOR;
6384 
6385         /**
6386          * Indicates which clock face to show on lock screen and AOD while docked.
6387          * @hide
6388          */
6389         public static final String DOCKED_CLOCK_FACE = "docked_clock_face";
6390 
6391         /**
6392          * Set by the system to track if the user needs to see the call to action for
6393          * the lockscreen notification policy.
6394          * @hide
6395          */
6396         public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
6397                 "show_note_about_notification_hiding";
6398 
6399         /**
6400          * Set to 1 by the system after trust agents have been initialized.
6401          * @hide
6402          */
6403         public static final String TRUST_AGENTS_INITIALIZED =
6404                 "trust_agents_initialized";
6405 
6406         /**
6407          * The Logging ID (a unique 64-bit value) as a hex string.
6408          * Used as a pseudonymous identifier for logging.
6409          * @deprecated This identifier is poorly initialized and has
6410          * many collisions.  It should not be used.
6411          */
6412         @Deprecated
6413         public static final String LOGGING_ID = "logging_id";
6414 
6415         /**
6416          * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
6417          */
6418         @Deprecated
6419         public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
6420 
6421         /**
6422          * No longer supported.
6423          */
6424         public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
6425 
6426         /**
6427          * No longer supported.
6428          */
6429         public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
6430 
6431         /**
6432          * No longer supported.
6433          */
6434         public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
6435 
6436         /**
6437          * Settings classname to launch when Settings is clicked from All
6438          * Applications.  Needed because of user testing between the old
6439          * and new Settings apps.
6440          */
6441         // TODO: 881807
6442         public static final String SETTINGS_CLASSNAME = "settings_classname";
6443 
6444         /**
6445          * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
6446          */
6447         @Deprecated
6448         public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
6449 
6450         private static final Validator USB_MASS_STORAGE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
6451 
6452         /**
6453          * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
6454          */
6455         @Deprecated
6456         public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
6457 
6458         /**
6459          * If accessibility is enabled.
6460          */
6461         public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
6462 
6463         private static final Validator ACCESSIBILITY_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
6464 
6465         /**
6466          * Setting specifying if the accessibility shortcut is enabled.
6467          * @hide
6468          */
6469         public static final String ACCESSIBILITY_SHORTCUT_ENABLED =
6470                 "accessibility_shortcut_enabled";
6471 
6472         private static final Validator ACCESSIBILITY_SHORTCUT_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
6473 
6474         /**
6475          * Setting specifying if the accessibility shortcut is enabled.
6476          * @hide
6477          */
6478         public static final String ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN =
6479                 "accessibility_shortcut_on_lock_screen";
6480 
6481         private static final Validator ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN_VALIDATOR =
6482                 BOOLEAN_VALIDATOR;
6483 
6484         /**
6485          * Setting specifying if the accessibility shortcut dialog has been shown to this user.
6486          * @hide
6487          */
6488         public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN =
6489                 "accessibility_shortcut_dialog_shown";
6490 
6491         private static final Validator ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN_VALIDATOR =
6492                 BOOLEAN_VALIDATOR;
6493 
6494         /**
6495          * Setting specifying the accessibility service to be toggled via the accessibility
6496          * shortcut. Must be its flattened {@link ComponentName}.
6497          * @hide
6498          */
6499         @UnsupportedAppUsage
6500         @TestApi
6501         public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE =
6502                 "accessibility_shortcut_target_service";
6503 
6504         private static final Validator ACCESSIBILITY_SHORTCUT_TARGET_SERVICE_VALIDATOR =
6505                 NULLABLE_COMPONENT_NAME_VALIDATOR;
6506 
6507         /**
6508          * Setting specifying the accessibility service or feature to be toggled via the
6509          * accessibility button in the navigation bar. This is either a flattened
6510          * {@link ComponentName} or the class name of a system class implementing a supported
6511          * accessibility feature.
6512          * @hide
6513          */
6514         public static final String ACCESSIBILITY_BUTTON_TARGET_COMPONENT =
6515                 "accessibility_button_target_component";
6516 
6517         private static final Validator ACCESSIBILITY_BUTTON_TARGET_COMPONENT_VALIDATOR =
6518                 new Validator() {
6519                     @Override
6520                     public boolean validate(@Nullable String value) {
6521                         // technically either ComponentName or class name, but there's proper value
6522                         // validation at callsites, so allow any non-null string
6523                         return value != null;
6524                     }
6525                 };
6526 
6527         /**
6528          * If touch exploration is enabled.
6529          */
6530         public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
6531 
6532         private static final Validator TOUCH_EXPLORATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
6533 
6534         /**
6535          * List of the enabled accessibility providers.
6536          */
6537         public static final String ENABLED_ACCESSIBILITY_SERVICES =
6538             "enabled_accessibility_services";
6539 
6540         private static final Validator ENABLED_ACCESSIBILITY_SERVICES_VALIDATOR =
6541                 new SettingsValidators.ComponentNameListValidator(":");
6542 
6543         /**
6544          * List of the accessibility services to which the user has granted
6545          * permission to put the device into touch exploration mode.
6546          *
6547          * @hide
6548          */
6549         public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
6550             "touch_exploration_granted_accessibility_services";
6551 
6552         private static final Validator TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES_VALIDATOR =
6553                 new SettingsValidators.ComponentNameListValidator(":");
6554 
6555         /**
6556          * Whether the Global Actions Panel is enabled.
6557          * @hide
6558          */
6559         public static final String GLOBAL_ACTIONS_PANEL_ENABLED = "global_actions_panel_enabled";
6560 
6561         private static final Validator GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
6562 
6563         /**
6564          * Whether the Global Actions Panel can be toggled on or off in Settings.
6565          * @hide
6566          */
6567         public static final String GLOBAL_ACTIONS_PANEL_AVAILABLE =
6568                 "global_actions_panel_available";
6569 
6570         /**
6571          * Enables debug mode for the Global Actions Panel.
6572          * @hide
6573          */
6574         public static final String GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED =
6575                 "global_actions_panel_debug_enabled";
6576 
6577         /**
6578          * Whether the hush gesture has ever been used
6579          * @hide
6580          */
6581         @SystemApi
6582         public static final String HUSH_GESTURE_USED = "hush_gesture_used";
6583 
6584         private static final Validator HUSH_GESTURE_USED_VALIDATOR = BOOLEAN_VALIDATOR;
6585 
6586         /**
6587          * Number of times the user has manually clicked the ringer toggle
6588          * @hide
6589          */
6590         public static final String MANUAL_RINGER_TOGGLE_COUNT = "manual_ringer_toggle_count";
6591 
6592         private static final Validator MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR =
6593                 NON_NEGATIVE_INTEGER_VALIDATOR;
6594 
6595         /**
6596          * Whether to play a sound for charging events.
6597          * @hide
6598          */
6599         public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
6600 
6601         /**
6602          * Whether to vibrate for charging events.
6603          * @hide
6604          */
6605         public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled";
6606 
6607         /**
6608          * If 0, turning on dnd manually will last indefinitely.
6609          * Else if non-negative, turning on dnd manually will last for this many minutes.
6610          * Else (if negative), turning on dnd manually will surface a dialog that prompts
6611          * user to specify a duration.
6612          * @hide
6613          */
6614         public static final String ZEN_DURATION = "zen_duration";
6615 
6616         private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR;
6617 
6618         /** @hide */ public static final int ZEN_DURATION_PROMPT = -1;
6619         /** @hide */ public static final int ZEN_DURATION_FOREVER = 0;
6620 
6621         /**
6622          * If nonzero, will show the zen upgrade notification when the user toggles DND on/off.
6623          * @hide
6624          */
6625         public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification";
6626 
6627         /**
6628          * If nonzero, will show the zen update settings suggestion.
6629          * @hide
6630          */
6631         public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion";
6632 
6633         /**
6634          * If nonzero, zen has not been updated to reflect new changes.
6635          * @hide
6636          */
6637         public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated";
6638 
6639         /**
6640          * If nonzero, zen setting suggestion has been viewed by user
6641          * @hide
6642          */
6643         public static final String ZEN_SETTINGS_SUGGESTION_VIEWED =
6644                 "zen_settings_suggestion_viewed";
6645 
6646         /**
6647          * Whether the in call notification is enabled to play sound during calls.  The value is
6648          * boolean (1 or 0).
6649          * @hide
6650          */
6651         public static final String IN_CALL_NOTIFICATION_ENABLED = "in_call_notification_enabled";
6652 
6653         private static final Validator IN_CALL_NOTIFICATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
6654 
6655         /**
6656          * Uri of the slice that's presented on the keyguard.
6657          * Defaults to a slice with the date and next alarm.
6658          *
6659          * @hide
6660          */
6661         public static final String KEYGUARD_SLICE_URI = "keyguard_slice_uri";
6662 
6663         /**
6664          * Whether to speak passwords while in accessibility mode.
6665          *
6666          * @deprecated The speaking of passwords is controlled by individual accessibility services.
6667          * Apps should ignore this setting and provide complete information to accessibility
6668          * at all times, which was the behavior when this value was {@code true}.
6669          */
6670         @Deprecated
6671         public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
6672 
6673         /**
6674          * Whether to draw text with high contrast while in accessibility mode.
6675          *
6676          * @hide
6677          */
6678         public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
6679                 "high_text_contrast_enabled";
6680 
6681         private static final Validator ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED_VALIDATOR =
6682                 BOOLEAN_VALIDATOR;
6683 
6684         /**
6685          * Setting that specifies whether the display magnification is enabled via a system-wide
6686          * triple tap gesture. Display magnifications allows the user to zoom in the display content
6687          * and is targeted to low vision users. The current magnification scale is controlled by
6688          * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
6689          *
6690          * @hide
6691          */
6692         @UnsupportedAppUsage
6693         @TestApi
6694         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
6695                 "accessibility_display_magnification_enabled";
6696 
6697         private static final Validator ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED_VALIDATOR =
6698                 BOOLEAN_VALIDATOR;
6699 
6700         /**
6701          * Setting that specifies whether the display magnification is enabled via a shortcut
6702          * affordance within the system's navigation area. Display magnifications allows the user to
6703          * zoom in the display content and is targeted to low vision users. The current
6704          * magnification scale is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
6705          *
6706          * @hide
6707          */
6708         @SystemApi
6709         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED =
6710                 "accessibility_display_magnification_navbar_enabled";
6711 
6712         private static final Validator ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED_VALIDATOR
6713                 = BOOLEAN_VALIDATOR;
6714 
6715         /**
6716          * Setting that specifies what the display magnification scale is.
6717          * Display magnifications allows the user to zoom in the display
6718          * content and is targeted to low vision users. Whether a display
6719          * magnification is performed is controlled by
6720          * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} and
6721          * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED}
6722          *
6723          * @hide
6724          */
6725         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
6726                 "accessibility_display_magnification_scale";
6727 
6728         private static final Validator ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE_VALIDATOR =
6729                 new SettingsValidators.InclusiveFloatRangeValidator(1.0f, Float.MAX_VALUE);
6730 
6731         /**
6732          * Unused mangnification setting
6733          *
6734          * @hide
6735          * @deprecated
6736          */
6737         @Deprecated
6738         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
6739                 "accessibility_display_magnification_auto_update";
6740 
6741         /**
6742          * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be
6743          * modified from an AccessibilityService using the SoftKeyboardController.
6744          *
6745          * @hide
6746          */
6747         public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE =
6748                 "accessibility_soft_keyboard_mode";
6749 
6750         /**
6751          * Default soft keyboard behavior.
6752          *
6753          * @hide
6754          */
6755         public static final int SHOW_MODE_AUTO = 0;
6756 
6757         /**
6758          * Soft keyboard is never shown.
6759          *
6760          * @hide
6761          */
6762         public static final int SHOW_MODE_HIDDEN = 1;
6763 
6764         /**
6765          * Setting that specifies whether timed text (captions) should be
6766          * displayed in video content. Text display properties are controlled by
6767          * the following settings:
6768          * <ul>
6769          * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
6770          * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
6771          * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
6772          * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
6773          * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
6774          * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
6775          * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
6776          * </ul>
6777          *
6778          * @hide
6779          */
6780         public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
6781                 "accessibility_captioning_enabled";
6782 
6783         private static final Validator ACCESSIBILITY_CAPTIONING_ENABLED_VALIDATOR =
6784                 BOOLEAN_VALIDATOR;
6785 
6786         /**
6787          * Setting that specifies the language for captions as a locale string,
6788          * e.g. en_US.
6789          *
6790          * @see java.util.Locale#toString
6791          * @hide
6792          */
6793         public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
6794                 "accessibility_captioning_locale";
6795 
6796         private static final Validator ACCESSIBILITY_CAPTIONING_LOCALE_VALIDATOR = LOCALE_VALIDATOR;
6797 
6798         /**
6799          * Integer property that specifies the preset style for captions, one
6800          * of:
6801          * <ul>
6802          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
6803          * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
6804          * </ul>
6805          *
6806          * @see java.util.Locale#toString
6807          * @hide
6808          */
6809         public static final String ACCESSIBILITY_CAPTIONING_PRESET =
6810                 "accessibility_captioning_preset";
6811 
6812         private static final Validator ACCESSIBILITY_CAPTIONING_PRESET_VALIDATOR =
6813                 new SettingsValidators.DiscreteValueValidator(new String[]{"-1", "0", "1", "2",
6814                         "3", "4"});
6815 
6816         /**
6817          * Integer property that specifes the background color for captions as a
6818          * packed 32-bit color.
6819          *
6820          * @see android.graphics.Color#argb
6821          * @hide
6822          */
6823         public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
6824                 "accessibility_captioning_background_color";
6825 
6826         private static final Validator ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR_VALIDATOR =
6827                 ANY_INTEGER_VALIDATOR;
6828 
6829         /**
6830          * Integer property that specifes the foreground color for captions as a
6831          * packed 32-bit color.
6832          *
6833          * @see android.graphics.Color#argb
6834          * @hide
6835          */
6836         public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
6837                 "accessibility_captioning_foreground_color";
6838 
6839         private static final Validator ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR_VALIDATOR =
6840                 ANY_INTEGER_VALIDATOR;
6841 
6842         /**
6843          * Integer property that specifes the edge type for captions, one of:
6844          * <ul>
6845          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
6846          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
6847          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
6848          * </ul>
6849          *
6850          * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
6851          * @hide
6852          */
6853         public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
6854                 "accessibility_captioning_edge_type";
6855 
6856         private static final Validator ACCESSIBILITY_CAPTIONING_EDGE_TYPE_VALIDATOR =
6857                 new SettingsValidators.DiscreteValueValidator(new String[]{"0", "1", "2"});
6858 
6859         /**
6860          * Integer property that specifes the edge color for captions as a
6861          * packed 32-bit color.
6862          *
6863          * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
6864          * @see android.graphics.Color#argb
6865          * @hide
6866          */
6867         public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
6868                 "accessibility_captioning_edge_color";
6869 
6870         private static final Validator ACCESSIBILITY_CAPTIONING_EDGE_COLOR_VALIDATOR =
6871                 ANY_INTEGER_VALIDATOR;
6872 
6873         /**
6874          * Integer property that specifes the window color for captions as a
6875          * packed 32-bit color.
6876          *
6877          * @see android.graphics.Color#argb
6878          * @hide
6879          */
6880         public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
6881                 "accessibility_captioning_window_color";
6882 
6883         private static final Validator ACCESSIBILITY_CAPTIONING_WINDOW_COLOR_VALIDATOR =
6884                 ANY_INTEGER_VALIDATOR;
6885 
6886         /**
6887          * String property that specifies the typeface for captions, one of:
6888          * <ul>
6889          * <li>DEFAULT
6890          * <li>MONOSPACE
6891          * <li>SANS_SERIF
6892          * <li>SERIF
6893          * </ul>
6894          *
6895          * @see android.graphics.Typeface
6896          * @hide
6897          */
6898         @UnsupportedAppUsage
6899         public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
6900                 "accessibility_captioning_typeface";
6901 
6902         private static final Validator ACCESSIBILITY_CAPTIONING_TYPEFACE_VALIDATOR =
6903                 new SettingsValidators.DiscreteValueValidator(new String[]{"DEFAULT",
6904                         "MONOSPACE", "SANS_SERIF", "SERIF"});
6905 
6906         /**
6907          * Floating point property that specifies font scaling for captions.
6908          *
6909          * @hide
6910          */
6911         public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
6912                 "accessibility_captioning_font_scale";
6913 
6914         private static final Validator ACCESSIBILITY_CAPTIONING_FONT_SCALE_VALIDATOR =
6915                 new SettingsValidators.InclusiveFloatRangeValidator(0.5f, 2.0f);
6916 
6917         /**
6918          * Setting that specifies whether display color inversion is enabled.
6919          */
6920         public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
6921                 "accessibility_display_inversion_enabled";
6922 
6923         private static final Validator ACCESSIBILITY_DISPLAY_INVERSION_ENABLED_VALIDATOR =
6924                 BOOLEAN_VALIDATOR;
6925 
6926         /**
6927          * Setting that specifies whether display color space adjustment is
6928          * enabled.
6929          *
6930          * @hide
6931          */
6932         @UnsupportedAppUsage
6933         public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
6934                 "accessibility_display_daltonizer_enabled";
6935 
6936         private static final Validator ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED_VALIDATOR =
6937                 BOOLEAN_VALIDATOR;
6938 
6939         /**
6940          * Integer property that specifies the type of color space adjustment to
6941          * perform. Valid values are defined in AccessibilityManager and Settings arrays.xml:
6942          * - AccessibilityManager.DALTONIZER_DISABLED = -1
6943          * - AccessibilityManager.DALTONIZER_SIMULATE_MONOCHROMACY = 0
6944          * - <item>@string/daltonizer_mode_protanomaly</item> = 11
6945          * - AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY and
6946          *       <item>@string/daltonizer_mode_deuteranomaly</item> = 12
6947          * - <item>@string/daltonizer_mode_tritanomaly</item> = 13
6948          *
6949          * @hide
6950          */
6951         @UnsupportedAppUsage
6952         public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
6953                 "accessibility_display_daltonizer";
6954 
6955         private static final Validator ACCESSIBILITY_DISPLAY_DALTONIZER_VALIDATOR =
6956                 new SettingsValidators.DiscreteValueValidator(
6957                         new String[] {"-1", "0", "11", "12", "13"});
6958 
6959         /**
6960          * Setting that specifies whether automatic click when the mouse pointer stops moving is
6961          * enabled.
6962          *
6963          * @hide
6964          */
6965         @UnsupportedAppUsage
6966         public static final String ACCESSIBILITY_AUTOCLICK_ENABLED =
6967                 "accessibility_autoclick_enabled";
6968 
6969         private static final Validator ACCESSIBILITY_AUTOCLICK_ENABLED_VALIDATOR =
6970                 BOOLEAN_VALIDATOR;
6971 
6972         /**
6973          * Integer setting specifying amount of time in ms the mouse pointer has to stay still
6974          * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set.
6975          *
6976          * @see #ACCESSIBILITY_AUTOCLICK_ENABLED
6977          * @hide
6978          */
6979         public static final String ACCESSIBILITY_AUTOCLICK_DELAY =
6980                 "accessibility_autoclick_delay";
6981 
6982         private static final Validator ACCESSIBILITY_AUTOCLICK_DELAY_VALIDATOR =
6983                 NON_NEGATIVE_INTEGER_VALIDATOR;
6984 
6985         /**
6986          * Whether or not larger size icons are used for the pointer of mouse/trackpad for
6987          * accessibility.
6988          * (0 = false, 1 = true)
6989          * @hide
6990          */
6991         @UnsupportedAppUsage
6992         public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
6993                 "accessibility_large_pointer_icon";
6994 
6995         private static final Validator ACCESSIBILITY_LARGE_POINTER_ICON_VALIDATOR =
6996                 BOOLEAN_VALIDATOR;
6997 
6998         /**
6999          * The timeout for considering a press to be a long press in milliseconds.
7000          * @hide
7001          */
7002         @UnsupportedAppUsage
7003         public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
7004 
7005         private static final Validator LONG_PRESS_TIMEOUT_VALIDATOR =
7006                 NON_NEGATIVE_INTEGER_VALIDATOR;
7007 
7008         /**
7009          * The duration in milliseconds between the first tap's up event and the second tap's
7010          * down event for an interaction to be considered part of the same multi-press.
7011          * @hide
7012          */
7013         public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout";
7014 
7015         /**
7016          * Setting that specifies recommended timeout in milliseconds for controls
7017          * which don't need user's interactions.
7018          *
7019          * @hide
7020          */
7021         public static final String ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS =
7022                 "accessibility_non_interactive_ui_timeout_ms";
7023 
7024         /**
7025          * Setting that specifies recommended timeout in milliseconds for controls
7026          * which need user's interactions.
7027          *
7028          * @hide
7029          */
7030         public static final String ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS =
7031                 "accessibility_interactive_ui_timeout_ms";
7032 
7033         /**
7034          * List of the enabled print services.
7035          *
7036          * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade
7037          * from pre-N.
7038          *
7039          * @hide
7040          */
7041         @UnsupportedAppUsage
7042         public static final String ENABLED_PRINT_SERVICES =
7043             "enabled_print_services";
7044 
7045         /**
7046          * List of the disabled print services.
7047          *
7048          * @hide
7049          */
7050         @TestApi
7051         public static final String DISABLED_PRINT_SERVICES =
7052             "disabled_print_services";
7053 
7054         /**
7055          * The saved value for WindowManagerService.setForcedDisplayDensity()
7056          * formatted as a single integer representing DPI. If unset, then use
7057          * the real display density.
7058          *
7059          * @hide
7060          */
7061         public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
7062 
7063         /**
7064          * Setting to always use the default text-to-speech settings regardless
7065          * of the application settings.
7066          * 1 = override application settings,
7067          * 0 = use application settings (if specified).
7068          *
7069          * @deprecated  The value of this setting is no longer respected by
7070          * the framework text to speech APIs as of the Ice Cream Sandwich release.
7071          */
7072         @Deprecated
7073         public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
7074 
7075         /**
7076          * Default text-to-speech engine speech rate. 100 = 1x
7077          */
7078         public static final String TTS_DEFAULT_RATE = "tts_default_rate";
7079 
7080         private static final Validator TTS_DEFAULT_RATE_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR;
7081 
7082         /**
7083          * Default text-to-speech engine pitch. 100 = 1x
7084          */
7085         public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
7086 
7087         private static final Validator TTS_DEFAULT_PITCH_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR;
7088 
7089         /**
7090          * Default text-to-speech engine.
7091          */
7092         public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
7093 
7094         private static final Validator TTS_DEFAULT_SYNTH_VALIDATOR = PACKAGE_NAME_VALIDATOR;
7095 
7096         /**
7097          * Default text-to-speech language.
7098          *
7099          * @deprecated this setting is no longer in use, as of the Ice Cream
7100          * Sandwich release. Apps should never need to read this setting directly,
7101          * instead can query the TextToSpeech framework classes for the default
7102          * locale. {@link TextToSpeech#getLanguage()}.
7103          */
7104         @Deprecated
7105         public static final String TTS_DEFAULT_LANG = "tts_default_lang";
7106 
7107         /**
7108          * Default text-to-speech country.
7109          *
7110          * @deprecated this setting is no longer in use, as of the Ice Cream
7111          * Sandwich release. Apps should never need to read this setting directly,
7112          * instead can query the TextToSpeech framework classes for the default
7113          * locale. {@link TextToSpeech#getLanguage()}.
7114          */
7115         @Deprecated
7116         public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
7117 
7118         /**
7119          * Default text-to-speech locale variant.
7120          *
7121          * @deprecated this setting is no longer in use, as of the Ice Cream
7122          * Sandwich release. Apps should never need to read this setting directly,
7123          * instead can query the TextToSpeech framework classes for the
7124          * locale that is in use {@link TextToSpeech#getLanguage()}.
7125          */
7126         @Deprecated
7127         public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
7128 
7129         /**
7130          * Stores the default tts locales on a per engine basis. Stored as
7131          * a comma seperated list of values, each value being of the form
7132          * {@code engine_name:locale} for example,
7133          * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
7134          * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
7135          * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
7136          * setting directly, and can query the TextToSpeech framework classes
7137          * for the locale that is in use.
7138          *
7139          * @hide
7140          */
7141         public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
7142 
7143         private static final Validator TTS_DEFAULT_LOCALE_VALIDATOR = new Validator() {
7144             @Override
7145             public boolean validate(@Nullable String value) {
7146                 if (value == null || value.length() == 0) {
7147                     return false;
7148                 }
7149                 String[] ttsLocales = value.split(",");
7150                 boolean valid = true;
7151                 for (String ttsLocale : ttsLocales) {
7152                     String[] parts = ttsLocale.split(":");
7153                     valid |= ((parts.length == 2)
7154                             && (parts[0].length() > 0)
7155                             && ANY_STRING_VALIDATOR.validate(parts[0])
7156                             && LOCALE_VALIDATOR.validate(parts[1]));
7157                 }
7158                 return valid;
7159             }
7160         };
7161 
7162         /**
7163          * Space delimited list of plugin packages that are enabled.
7164          */
7165         public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
7166 
7167         private static final Validator TTS_ENABLED_PLUGINS_VALIDATOR =
7168                 new SettingsValidators.PackageNameListValidator(" ");
7169 
7170         /**
7171          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
7172          * instead.
7173          */
7174         @Deprecated
7175         public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
7176                 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
7177 
7178         private static final Validator WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR =
7179                 BOOLEAN_VALIDATOR;
7180 
7181         /**
7182          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
7183          * instead.
7184          */
7185         @Deprecated
7186         public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
7187                 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
7188 
7189         private static final Validator WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY_VALIDATOR =
7190                 NON_NEGATIVE_INTEGER_VALIDATOR;
7191 
7192         /**
7193          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
7194          * instead.
7195          */
7196         @Deprecated
7197         public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
7198                 Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
7199 
7200         private static final Validator WIFI_NUM_OPEN_NETWORKS_KEPT_VALIDATOR =
7201                 NON_NEGATIVE_INTEGER_VALIDATOR;
7202 
7203         /**
7204          * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
7205          * instead.
7206          */
7207         @Deprecated
7208         public static final String WIFI_ON = Global.WIFI_ON;
7209 
7210         /**
7211          * The acceptable packet loss percentage (range 0 - 100) before trying
7212          * another AP on the same network.
7213          * @deprecated This setting is not used.
7214          */
7215         @Deprecated
7216         public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
7217                 "wifi_watchdog_acceptable_packet_loss_percentage";
7218 
7219         /**
7220          * The number of access points required for a network in order for the
7221          * watchdog to monitor it.
7222          * @deprecated This setting is not used.
7223          */
7224         @Deprecated
7225         public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
7226 
7227         /**
7228          * The delay between background checks.
7229          * @deprecated This setting is not used.
7230          */
7231         @Deprecated
7232         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
7233                 "wifi_watchdog_background_check_delay_ms";
7234 
7235         /**
7236          * Whether the Wi-Fi watchdog is enabled for background checking even
7237          * after it thinks the user has connected to a good access point.
7238          * @deprecated This setting is not used.
7239          */
7240         @Deprecated
7241         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
7242                 "wifi_watchdog_background_check_enabled";
7243 
7244         /**
7245          * The timeout for a background ping
7246          * @deprecated This setting is not used.
7247          */
7248         @Deprecated
7249         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
7250                 "wifi_watchdog_background_check_timeout_ms";
7251 
7252         /**
7253          * The number of initial pings to perform that *may* be ignored if they
7254          * fail. Again, if these fail, they will *not* be used in packet loss
7255          * calculation. For example, one network always seemed to time out for
7256          * the first couple pings, so this is set to 3 by default.
7257          * @deprecated This setting is not used.
7258          */
7259         @Deprecated
7260         public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
7261             "wifi_watchdog_initial_ignored_ping_count";
7262 
7263         /**
7264          * The maximum number of access points (per network) to attempt to test.
7265          * If this number is reached, the watchdog will no longer monitor the
7266          * initial connection state for the network. This is a safeguard for
7267          * networks containing multiple APs whose DNS does not respond to pings.
7268          * @deprecated This setting is not used.
7269          */
7270         @Deprecated
7271         public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
7272 
7273         /**
7274          * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
7275          */
7276         @Deprecated
7277         public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
7278 
7279         /**
7280          * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
7281          * @deprecated This setting is not used.
7282          */
7283         @Deprecated
7284         public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
7285 
7286         /**
7287          * The number of pings to test if an access point is a good connection.
7288          * @deprecated This setting is not used.
7289          */
7290         @Deprecated
7291         public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
7292 
7293         /**
7294          * The delay between pings.
7295          * @deprecated This setting is not used.
7296          */
7297         @Deprecated
7298         public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
7299 
7300         /**
7301          * The timeout per ping.
7302          * @deprecated This setting is not used.
7303          */
7304         @Deprecated
7305         public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
7306 
7307         /**
7308          * @deprecated Use
7309          * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
7310          */
7311         @Deprecated
7312         public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
7313 
7314         /**
7315          * @deprecated Use
7316          * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
7317          */
7318         @Deprecated
7319         public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
7320                 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
7321 
7322         /**
7323          * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
7324          * the receivers of the PendingIntent an opportunity to make a new network request before
7325          * the Network satisfying the request is potentially removed.
7326          *
7327          * @hide
7328          */
7329         public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
7330                 "connectivity_release_pending_intent_delay_ms";
7331 
7332         /**
7333          * Whether background data usage is allowed.
7334          *
7335          * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
7336          *             availability of background data depends on several
7337          *             combined factors. When background data is unavailable,
7338          *             {@link ConnectivityManager#getActiveNetworkInfo()} will
7339          *             now appear disconnected.
7340          */
7341         @Deprecated
7342         public static final String BACKGROUND_DATA = "background_data";
7343 
7344         /**
7345          * Origins for which browsers should allow geolocation by default.
7346          * The value is a space-separated list of origins.
7347          */
7348         public static final String ALLOWED_GEOLOCATION_ORIGINS
7349                 = "allowed_geolocation_origins";
7350 
7351         /**
7352          * The preferred TTY mode     0 = TTy Off, CDMA default
7353          *                            1 = TTY Full
7354          *                            2 = TTY HCO
7355          *                            3 = TTY VCO
7356          * @hide
7357          */
7358         public static final String PREFERRED_TTY_MODE =
7359                 "preferred_tty_mode";
7360 
7361         private static final Validator PREFERRED_TTY_MODE_VALIDATOR =
7362                 new SettingsValidators.DiscreteValueValidator(new String[]{"0", "1", "2", "3"});
7363 
7364         /**
7365          * Whether the enhanced voice privacy mode is enabled.
7366          * 0 = normal voice privacy
7367          * 1 = enhanced voice privacy
7368          * @hide
7369          */
7370         public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
7371 
7372         private static final Validator ENHANCED_VOICE_PRIVACY_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
7373 
7374         /**
7375          * Whether the TTY mode mode is enabled.
7376          * 0 = disabled
7377          * 1 = enabled
7378          * @hide
7379          */
7380         public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
7381 
7382         private static final Validator TTY_MODE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
7383 
7384         /**
7385          * User-selected RTT mode. When on, outgoing and incoming calls will be answered as RTT
7386          * calls when supported by the device and carrier. Boolean value.
7387          * 0 = OFF
7388          * 1 = ON
7389          */
7390         public static final String RTT_CALLING_MODE = "rtt_calling_mode";
7391 
7392         private static final Validator RTT_CALLING_MODE_VALIDATOR = BOOLEAN_VALIDATOR;
7393 
7394         /**
7395         /**
7396          * Controls whether settings backup is enabled.
7397          * Type: int ( 0 = disabled, 1 = enabled )
7398          * @hide
7399          */
7400         @UnsupportedAppUsage
7401         public static final String BACKUP_ENABLED = "backup_enabled";
7402 
7403         /**
7404          * Controls whether application data is automatically restored from backup
7405          * at install time.
7406          * Type: int ( 0 = disabled, 1 = enabled )
7407          * @hide
7408          */
7409         @UnsupportedAppUsage
7410         public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
7411 
7412         /**
7413          * Indicates whether settings backup has been fully provisioned.
7414          * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
7415          * @hide
7416          */
7417         @UnsupportedAppUsage
7418         public static final String BACKUP_PROVISIONED = "backup_provisioned";
7419 
7420         /**
7421          * Component of the transport to use for backup/restore.
7422          * @hide
7423          */
7424         @UnsupportedAppUsage
7425         public static final String BACKUP_TRANSPORT = "backup_transport";
7426 
7427         /**
7428          * Indicates the version for which the setup wizard was last shown. The version gets
7429          * bumped for each release when there is new setup information to show.
7430          *
7431          * @hide
7432          */
7433         @SystemApi
7434         public static final String LAST_SETUP_SHOWN = "last_setup_shown";
7435 
7436         /**
7437          * The interval in milliseconds after which Wi-Fi is considered idle.
7438          * When idle, it is possible for the device to be switched from Wi-Fi to
7439          * the mobile data network.
7440          * @hide
7441          * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
7442          * instead.
7443          */
7444         @Deprecated
7445         public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
7446 
7447         /**
7448          * The global search provider chosen by the user (if multiple global
7449          * search providers are installed). This will be the provider returned
7450          * by {@link SearchManager#getGlobalSearchActivity()} if it's still
7451          * installed. This setting is stored as a flattened component name as
7452          * per {@link ComponentName#flattenToString()}.
7453          *
7454          * @hide
7455          */
7456         public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
7457                 "search_global_search_activity";
7458 
7459         /**
7460          * The number of promoted sources in GlobalSearch.
7461          * @hide
7462          */
7463         public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
7464         /**
7465          * The maximum number of suggestions returned by GlobalSearch.
7466          * @hide
7467          */
7468         public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
7469         /**
7470          * The number of suggestions GlobalSearch will ask each non-web search source for.
7471          * @hide
7472          */
7473         public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
7474         /**
7475          * The number of suggestions the GlobalSearch will ask the web search source for.
7476          * @hide
7477          */
7478         public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
7479                 "search_web_results_override_limit";
7480         /**
7481          * The number of milliseconds that GlobalSearch will wait for suggestions from
7482          * promoted sources before continuing with all other sources.
7483          * @hide
7484          */
7485         public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
7486                 "search_promoted_source_deadline_millis";
7487         /**
7488          * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
7489          * @hide
7490          */
7491         public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
7492         /**
7493          * The maximum number of milliseconds that GlobalSearch shows the previous results
7494          * after receiving a new query.
7495          * @hide
7496          */
7497         public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
7498         /**
7499          * The maximum age of log data used for shortcuts in GlobalSearch.
7500          * @hide
7501          */
7502         public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
7503         /**
7504          * The maximum age of log data used for source ranking in GlobalSearch.
7505          * @hide
7506          */
7507         public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
7508                 "search_max_source_event_age_millis";
7509         /**
7510          * The minimum number of impressions needed to rank a source in GlobalSearch.
7511          * @hide
7512          */
7513         public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
7514                 "search_min_impressions_for_source_ranking";
7515         /**
7516          * The minimum number of clicks needed to rank a source in GlobalSearch.
7517          * @hide
7518          */
7519         public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
7520                 "search_min_clicks_for_source_ranking";
7521         /**
7522          * The maximum number of shortcuts shown by GlobalSearch.
7523          * @hide
7524          */
7525         public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
7526         /**
7527          * The size of the core thread pool for suggestion queries in GlobalSearch.
7528          * @hide
7529          */
7530         public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
7531                 "search_query_thread_core_pool_size";
7532         /**
7533          * The maximum size of the thread pool for suggestion queries in GlobalSearch.
7534          * @hide
7535          */
7536         public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
7537                 "search_query_thread_max_pool_size";
7538         /**
7539          * The size of the core thread pool for shortcut refreshing in GlobalSearch.
7540          * @hide
7541          */
7542         public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
7543                 "search_shortcut_refresh_core_pool_size";
7544         /**
7545          * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
7546          * @hide
7547          */
7548         public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
7549                 "search_shortcut_refresh_max_pool_size";
7550         /**
7551          * The maximun time that excess threads in the GlobalSeach thread pools will
7552          * wait before terminating.
7553          * @hide
7554          */
7555         public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
7556                 "search_thread_keepalive_seconds";
7557         /**
7558          * The maximum number of concurrent suggestion queries to each source.
7559          * @hide
7560          */
7561         public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
7562                 "search_per_source_concurrent_query_limit";
7563 
7564         /**
7565          * Whether or not alert sounds are played on StorageManagerService events.
7566          * (0 = false, 1 = true)
7567          * @hide
7568          */
7569         public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
7570 
7571         private static final Validator MOUNT_PLAY_NOTIFICATION_SND_VALIDATOR = BOOLEAN_VALIDATOR;
7572 
7573         /**
7574          * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
7575          * @hide
7576          */
7577         public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
7578 
7579         private static final Validator MOUNT_UMS_AUTOSTART_VALIDATOR = BOOLEAN_VALIDATOR;
7580 
7581         /**
7582          * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
7583          * @hide
7584          */
7585         public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
7586 
7587         private static final Validator MOUNT_UMS_PROMPT_VALIDATOR = BOOLEAN_VALIDATOR;
7588 
7589         /**
7590          * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
7591          * @hide
7592          */
7593         public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
7594 
7595         private static final Validator MOUNT_UMS_NOTIFY_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
7596 
7597         /**
7598          * If nonzero, ANRs in invisible background processes bring up a dialog.
7599          * Otherwise, the process will be silently killed.
7600          *
7601          * Also prevents ANRs and crash dialogs from being suppressed.
7602          * @hide
7603          */
7604         @UnsupportedAppUsage
7605         public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
7606 
7607         /**
7608          * If nonzero, crashes in foreground processes will bring up a dialog.
7609          * Otherwise, the process will be silently killed.
7610          * @hide
7611          */
7612         public static final String SHOW_FIRST_CRASH_DIALOG_DEV_OPTION =
7613                 "show_first_crash_dialog_dev_option";
7614 
7615         private static final Validator SHOW_FIRST_CRASH_DIALOG_DEV_OPTION_VALIDATOR =
7616                 BOOLEAN_VALIDATOR;
7617 
7618         /**
7619          * The {@link ComponentName} string of the service to be used as the voice recognition
7620          * service.
7621          *
7622          * @hide
7623          */
7624         @UnsupportedAppUsage
7625         public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
7626 
7627         /**
7628          * Stores whether an user has consented to have apps verified through PAM.
7629          * The value is boolean (1 or 0).
7630          *
7631          * @hide
7632          */
7633         @UnsupportedAppUsage
7634         public static final String PACKAGE_VERIFIER_USER_CONSENT =
7635             "package_verifier_user_consent";
7636 
7637         /**
7638          * The {@link ComponentName} string of the selected spell checker service which is
7639          * one of the services managed by the text service manager.
7640          *
7641          * @hide
7642          */
7643         @UnsupportedAppUsage
7644         public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
7645 
7646         /**
7647          * {@link android.view.textservice.SpellCheckerSubtype#hashCode()} of the selected subtype
7648          * of the selected spell checker service which is one of the services managed by the text
7649          * service manager.
7650          *
7651          * @hide
7652          */
7653         @UnsupportedAppUsage
7654         public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
7655                 "selected_spell_checker_subtype";
7656 
7657         /**
7658          * Whether spell checker is enabled or not.
7659          *
7660          * @hide
7661          */
7662         public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
7663 
7664         /**
7665          * What happens when the user presses the Power button while in-call
7666          * and the screen is on.<br/>
7667          * <b>Values:</b><br/>
7668          * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
7669          * 2 - The Power button hangs up the current call.<br/>
7670          *
7671          * @hide
7672          */
7673         @UnsupportedAppUsage
7674         public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
7675 
7676         private static final Validator INCALL_POWER_BUTTON_BEHAVIOR_VALIDATOR =
7677                 new SettingsValidators.DiscreteValueValidator(new String[]{"1", "2"});
7678 
7679         /**
7680          * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
7681          * @hide
7682          */
7683         public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
7684 
7685         /**
7686          * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
7687          * @hide
7688          */
7689         public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
7690 
7691         /**
7692          * INCALL_POWER_BUTTON_BEHAVIOR default value.
7693          * @hide
7694          */
7695         public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
7696                 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
7697 
7698         /**
7699          * What happens when the user presses the Back button while in-call
7700          * and the screen is on.<br/>
7701          * <b>Values:</b><br/>
7702          * 0 - The Back buttons does nothing different.<br/>
7703          * 1 - The Back button hangs up the current call.<br/>
7704          *
7705          * @hide
7706          */
7707         public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior";
7708 
7709         /**
7710          * INCALL_BACK_BUTTON_BEHAVIOR value for no action.
7711          * @hide
7712          */
7713         public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0;
7714 
7715         /**
7716          * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up".
7717          * @hide
7718          */
7719         public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1;
7720 
7721         /**
7722          * INCALL_POWER_BUTTON_BEHAVIOR default value.
7723          * @hide
7724          */
7725         public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT =
7726                 INCALL_BACK_BUTTON_BEHAVIOR_NONE;
7727 
7728         /**
7729          * Whether the device should wake when the wake gesture sensor detects motion.
7730          * @hide
7731          */
7732         public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
7733 
7734         private static final Validator WAKE_GESTURE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
7735 
7736         /**
7737          * Whether the device should doze if configured.
7738          * @hide
7739          */
7740         @UnsupportedAppUsage
7741         public static final String DOZE_ENABLED = "doze_enabled";
7742 
7743         private static final Validator DOZE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
7744 
7745         /**
7746          * Indicates whether doze should be always on.
7747          * <p>
7748          * Type: int (0 for false, 1 for true)
7749          *
7750          * @hide
7751          */
7752         @SystemApi
7753         @TestApi
7754         public static final String DOZE_ALWAYS_ON = "doze_always_on";
7755 
7756         private static final Validator DOZE_ALWAYS_ON_VALIDATOR = BOOLEAN_VALIDATOR;
7757 
7758         /**
7759          * Whether the device should pulse on pick up gesture.
7760          * @hide
7761          */
7762         public static final String DOZE_PICK_UP_GESTURE = "doze_pulse_on_pick_up";
7763 
7764         private static final Validator DOZE_PICK_UP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7765 
7766         /**
7767          * Whether the device should pulse on long press gesture.
7768          * @hide
7769          */
7770         public static final String DOZE_PULSE_ON_LONG_PRESS = "doze_pulse_on_long_press";
7771 
7772         /**
7773          * Whether the device should pulse on double tap gesture.
7774          * @hide
7775          */
7776         public static final String DOZE_DOUBLE_TAP_GESTURE = "doze_pulse_on_double_tap";
7777 
7778         private static final Validator DOZE_DOUBLE_TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7779 
7780         /**
7781          * Whether the device should respond to the SLPI tap gesture.
7782          * @hide
7783          */
7784         public static final String DOZE_TAP_SCREEN_GESTURE = "doze_tap_gesture";
7785 
7786         private static final Validator DOZE_TAP_SCREEN_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7787 
7788         /**
7789          * Gesture that wakes up the display, showing some version of the lock screen.
7790          * @hide
7791          */
7792         public static final String DOZE_WAKE_LOCK_SCREEN_GESTURE = "doze_wake_screen_gesture";
7793 
7794         private static final Validator DOZE_WAKE_LOCK_SCREEN_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7795 
7796         /**
7797          * Gesture that wakes up the display, toggling between {@link Display.STATE_OFF} and
7798          * {@link Display.STATE_DOZE}.
7799          * @hide
7800          */
7801         public static final String DOZE_WAKE_DISPLAY_GESTURE = "doze_wake_display_gesture";
7802 
7803         private static final Validator DOZE_WAKE_DISPLAY_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7804 
7805         /**
7806          * Gesture that skips media.
7807          * @hide
7808          */
7809         public static final String SKIP_GESTURE = "skip_gesture";
7810 
7811         private static final Validator SKIP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7812 
7813         /**
7814          * Count of successful gestures.
7815          * @hide
7816          */
7817         public static final String SKIP_GESTURE_COUNT = "skip_gesture_count";
7818 
7819         /**
7820          * Count of non-gesture interaction.
7821          * @hide
7822          */
7823         public static final String SKIP_TOUCH_COUNT = "skip_touch_count";
7824 
7825         private static final Validator SKIP_GESTURE_COUNT_VALIDATOR =
7826                 NON_NEGATIVE_INTEGER_VALIDATOR;
7827 
7828         /**
7829          * Direction to advance media for skip gesture
7830          * @hide
7831          */
7832         public static final String SKIP_DIRECTION = "skip_gesture_direction";
7833 
7834         /**
7835          * Only used if FeatureFlag "settings_skip_direction_mutable" is enabled.
7836          * If feature flag is disabled, should assume SKIP_DIRECTION = 0.
7837          *      0 / false = right to left to advance to next
7838          *      1 / true = left to right to advance to next
7839          */
7840         private static final Validator SKIP_DIRECTION_VALIDATOR = BOOLEAN_VALIDATOR;
7841 
7842         /**
7843          * Gesture that silences sound (alarms, notification, calls).
7844          * @hide
7845          */
7846         public static final String SILENCE_GESTURE = "silence_gesture";
7847 
7848         private static final Validator SILENCE_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
7849 
7850         /**
7851          * Count of successful silence alarms gestures.
7852          * @hide
7853          */
7854         public static final String SILENCE_ALARMS_GESTURE_COUNT = "silence_alarms_gesture_count";
7855 
7856         /**
7857          * Count of successful silence timer gestures.
7858          * @hide
7859          */
7860         public static final String SILENCE_TIMER_GESTURE_COUNT = "silence_timer_gesture_count";
7861 
7862         /**
7863          * Count of successful silence call gestures.
7864          * @hide
7865          */
7866         public static final String SILENCE_CALL_GESTURE_COUNT = "silence_call_gesture_count";
7867 
7868         /**
7869          * Count of non-gesture interaction.
7870          * @hide
7871          */
7872         public static final String SILENCE_ALARMS_TOUCH_COUNT = "silence_alarms_touch_count";
7873 
7874         /**
7875          * Count of non-gesture interaction.
7876          * @hide
7877          */
7878         public static final String SILENCE_TIMER_TOUCH_COUNT = "silence_timer_touch_count";
7879 
7880         /**
7881          * Count of non-gesture interaction.
7882          * @hide
7883          */
7884         public static final String SILENCE_CALL_TOUCH_COUNT = "silence_call_touch_count";
7885 
7886         private static final Validator SILENCE_GESTURE_COUNT_VALIDATOR =
7887                 NON_NEGATIVE_INTEGER_VALIDATOR;
7888 
7889         /**
7890          * Number of successful "Motion Sense" tap gestures to pause media.
7891          * @hide
7892          */
7893         public static final String AWARE_TAP_PAUSE_GESTURE_COUNT = "aware_tap_pause_gesture_count";
7894 
7895         /**
7896          * Number of touch interactions to pause media when a "Motion Sense" gesture could
7897          * have been used.
7898          * @hide
7899          */
7900         public static final String AWARE_TAP_PAUSE_TOUCH_COUNT = "aware_tap_pause_touch_count";
7901 
7902         /**
7903          * The current night mode that has been selected by the user.  Owned
7904          * and controlled by UiModeManagerService.  Constants are as per
7905          * UiModeManager.
7906          * @hide
7907          */
7908         public static final String UI_NIGHT_MODE = "ui_night_mode";
7909 
7910         private static final Validator UI_NIGHT_MODE_VALIDATOR =
7911                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 2);
7912 
7913         /**
7914          * Whether screensavers are enabled.
7915          * @hide
7916          */
7917         public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
7918 
7919         private static final Validator SCREENSAVER_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
7920 
7921         /**
7922          * The user's chosen screensaver components.
7923          *
7924          * These will be launched by the PhoneWindowManager after a timeout when not on
7925          * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
7926          * @hide
7927          */
7928         public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
7929 
7930         private static final Validator SCREENSAVER_COMPONENTS_VALIDATOR =
7931                 new SettingsValidators.ComponentNameListValidator(",");
7932 
7933         /**
7934          * If screensavers are enabled, whether the screensaver should be automatically launched
7935          * when the device is inserted into a (desk) dock.
7936          * @hide
7937          */
7938         public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
7939 
7940         private static final Validator SCREENSAVER_ACTIVATE_ON_DOCK_VALIDATOR = BOOLEAN_VALIDATOR;
7941 
7942         /**
7943          * If screensavers are enabled, whether the screensaver should be automatically launched
7944          * when the screen times out when not on battery.
7945          * @hide
7946          */
7947         public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
7948 
7949         private static final Validator SCREENSAVER_ACTIVATE_ON_SLEEP_VALIDATOR = BOOLEAN_VALIDATOR;
7950 
7951         /**
7952          * If screensavers are enabled, the default screensaver component.
7953          * @hide
7954          */
7955         public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
7956 
7957         /**
7958          * The default NFC payment component
7959          * @hide
7960          */
7961         @UnsupportedAppUsage
7962         public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
7963 
7964         private static final Validator NFC_PAYMENT_DEFAULT_COMPONENT_VALIDATOR =
7965                 COMPONENT_NAME_VALIDATOR;
7966 
7967         /**
7968          * Whether NFC payment is handled by the foreground application or a default.
7969          * @hide
7970          */
7971         public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
7972 
7973         /**
7974          * Specifies the package name currently configured to be the primary sms application
7975          * @hide
7976          */
7977         @UnsupportedAppUsage
7978         public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
7979 
7980         /**
7981          * Specifies the package name currently configured to be the default dialer application
7982          * @hide
7983          */
7984         @UnsupportedAppUsage
7985         public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application";
7986 
7987         /**
7988          * Specifies the component name currently configured to be the default call screening
7989          * application
7990          * @hide
7991          */
7992         public static final String CALL_SCREENING_DEFAULT_COMPONENT =
7993                 "call_screening_default_component";
7994 
7995         /**
7996          * Specifies the package name currently configured to be the emergency assistance application
7997          *
7998          * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
7999          *
8000          * @hide
8001          */
8002         public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
8003 
8004         /**
8005          * Specifies whether the current app context on scren (assist data) will be sent to the
8006          * assist application (active voice interaction service).
8007          *
8008          * @hide
8009          */
8010         public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
8011 
8012         /**
8013          * Specifies whether a screenshot of the screen contents will be sent to the assist
8014          * application (active voice interaction service).
8015          *
8016          * @hide
8017          */
8018         public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled";
8019 
8020         /**
8021          * Specifies whether the screen will show an animation if screen contents are sent to the
8022          * assist application (active voice interaction service).
8023          *
8024          * Note that the disclosure will be forced for third-party assistants or if the device
8025          * does not support disabling it.
8026          *
8027          * @hide
8028          */
8029         public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled";
8030 
8031         /**
8032          * Control if rotation suggestions are sent to System UI when in rotation locked mode.
8033          * Done to enable screen rotation while the the screen rotation is locked. Enabling will
8034          * poll the accelerometer in rotation locked mode.
8035          *
8036          * If 0, then rotation suggestions are not sent to System UI. If 1, suggestions are sent.
8037          *
8038          * @hide
8039          */
8040 
8041         public static final String SHOW_ROTATION_SUGGESTIONS = "show_rotation_suggestions";
8042 
8043         /**
8044          * The disabled state of SHOW_ROTATION_SUGGESTIONS.
8045          * @hide
8046          */
8047         public static final int SHOW_ROTATION_SUGGESTIONS_DISABLED = 0x0;
8048 
8049         /**
8050          * The enabled state of SHOW_ROTATION_SUGGESTIONS.
8051          * @hide
8052          */
8053         public static final int SHOW_ROTATION_SUGGESTIONS_ENABLED = 0x1;
8054 
8055         /**
8056          * The default state of SHOW_ROTATION_SUGGESTIONS.
8057          * @hide
8058          */
8059         public static final int SHOW_ROTATION_SUGGESTIONS_DEFAULT =
8060                 SHOW_ROTATION_SUGGESTIONS_ENABLED;
8061 
8062         /**
8063          * The number of accepted rotation suggestions. Used to determine if the user has been
8064          * introduced to rotation suggestions.
8065          * @hide
8066          */
8067         public static final String NUM_ROTATION_SUGGESTIONS_ACCEPTED =
8068                 "num_rotation_suggestions_accepted";
8069 
8070         /**
8071          * Read only list of the service components that the current user has explicitly allowed to
8072          * see and assist with all of the user's notifications.
8073          *
8074          * @deprecated Use
8075          * {@link NotificationManager#isNotificationAssistantAccessGranted(ComponentName)}.
8076          * @hide
8077          */
8078         @Deprecated
8079         public static final String ENABLED_NOTIFICATION_ASSISTANT =
8080                 "enabled_notification_assistant";
8081 
8082         private static final Validator ENABLED_NOTIFICATION_ASSISTANT_VALIDATOR =
8083                 new SettingsValidators.ComponentNameListValidator(":");
8084 
8085         /**
8086          * Read only list of the service components that the current user has explicitly allowed to
8087          * see all of the user's notifications, separated by ':'.
8088          *
8089          * @hide
8090          * @deprecated Use
8091          * {@link NotificationManager#isNotificationListenerAccessGranted(ComponentName)}.
8092          */
8093         @Deprecated
8094         @UnsupportedAppUsage
8095         public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
8096 
8097         private static final Validator ENABLED_NOTIFICATION_LISTENERS_VALIDATOR =
8098                 new SettingsValidators.ComponentNameListValidator(":");
8099 
8100         /**
8101          * Read only list of the packages that the current user has explicitly allowed to
8102          * manage do not disturb, separated by ':'.
8103          *
8104          * @deprecated Use {@link NotificationManager#isNotificationPolicyAccessGranted()}.
8105          * @hide
8106          */
8107         @Deprecated
8108         @TestApi
8109         public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES =
8110                 "enabled_notification_policy_access_packages";
8111 
8112         private static final Validator ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES_VALIDATOR =
8113                 new SettingsValidators.PackageNameListValidator(":");
8114 
8115         /**
8116          * Defines whether managed profile ringtones should be synced from it's parent profile
8117          * <p>
8118          * 0 = ringtones are not synced
8119          * 1 = ringtones are synced from the profile's parent (default)
8120          * <p>
8121          * This value is only used for managed profiles.
8122          * @hide
8123          */
8124         @TestApi
8125         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
8126         public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
8127 
8128         private static final Validator SYNC_PARENT_SOUNDS_VALIDATOR = BOOLEAN_VALIDATOR;
8129 
8130         /** @hide */
8131         @UnsupportedAppUsage
8132         public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
8133 
8134         /**
8135          * This is the query URI for finding a print service to install.
8136          *
8137          * @hide
8138          */
8139         public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
8140 
8141         /**
8142          * This is the query URI for finding a NFC payment service to install.
8143          *
8144          * @hide
8145          */
8146         public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
8147 
8148         /**
8149          * This is the query URI for finding a auto fill service to install.
8150          *
8151          * @hide
8152          */
8153         public static final String AUTOFILL_SERVICE_SEARCH_URI = "autofill_service_search_uri";
8154 
8155         /**
8156          * If enabled, apps should try to skip any introductory hints on first launch. This might
8157          * apply to users that are already familiar with the environment or temporary users.
8158          * <p>
8159          * Type : int (0 to show hints, 1 to skip showing hints)
8160          */
8161         public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
8162 
8163         /**
8164          * Persisted playback time after a user confirmation of an unsafe volume level.
8165          *
8166          * @hide
8167          */
8168         public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
8169 
8170         /**
8171          * Indicates whether notification display on the lock screen is enabled.
8172          * <p>
8173          * Type: int (0 for false, 1 for true)
8174          *
8175          * @hide
8176          */
8177         @SystemApi
8178         public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
8179                 "lock_screen_show_notifications";
8180 
8181         /**
8182          * Indicates whether the lock screen should display silent notifications.
8183          * <p>
8184          * Type: int (0 for false, 1 for true)
8185          *
8186          * @hide
8187          */
8188         public static final String LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS =
8189                 "lock_screen_show_silent_notifications";
8190 
8191         /**
8192          * Indicates whether snooze options should be shown on notifications
8193          * <p>
8194          * Type: int (0 for false, 1 for true)
8195          *
8196          * @hide
8197          */
8198         public static final String SHOW_NOTIFICATION_SNOOZE = "show_notification_snooze";
8199 
8200         /**
8201          * List of TV inputs that are currently hidden. This is a string
8202          * containing the IDs of all hidden TV inputs. Each ID is encoded by
8203          * {@link android.net.Uri#encode(String)} and separated by ':'.
8204          * @hide
8205          */
8206         public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
8207 
8208         /**
8209          * List of custom TV input labels. This is a string containing <TV input id, custom name>
8210          * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
8211          * and separated by ','. Each pair is separated by ':'.
8212          * @hide
8213          */
8214         public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
8215 
8216         /**
8217          * Whether TV app uses non-system inputs.
8218          *
8219          * <p>
8220          * The value is boolean (1 or 0), where 1 means non-system TV inputs are allowed,
8221          * and 0 means non-system TV inputs are not allowed.
8222          *
8223          * <p>
8224          * Devices such as sound bars may have changed the system property allow_third_party_inputs
8225          * to false so the TV Application only uses HDMI and other built in inputs. This setting
8226          * allows user to override the default and have the TV Application use third party TV inputs
8227          * available on play store.
8228          *
8229          * @hide
8230          */
8231         public static final String TV_APP_USES_NON_SYSTEM_INPUTS = "tv_app_uses_non_system_inputs";
8232 
8233         /**
8234          * Whether automatic routing of system audio to USB audio peripheral is disabled.
8235          * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
8236          * and 0 means automatic routing is enabled.
8237          *
8238          * @hide
8239          */
8240         public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
8241                 "usb_audio_automatic_routing_disabled";
8242 
8243         /**
8244          * The timeout in milliseconds before the device fully goes to sleep after
8245          * a period of inactivity.  This value sets an upper bound on how long the device
8246          * will stay awake or dreaming without user activity.  It should generally
8247          * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
8248          * will sleep before it ever has a chance to dream.
8249          * <p>
8250          * Use -1 to disable this timeout.
8251          * </p>
8252          *
8253          * @hide
8254          */
8255         public static final String SLEEP_TIMEOUT = "sleep_timeout";
8256 
8257         /**
8258          * Controls whether double tap to wake is enabled.
8259          * @hide
8260          */
8261         public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
8262 
8263         private static final Validator DOUBLE_TAP_TO_WAKE_VALIDATOR = BOOLEAN_VALIDATOR;
8264 
8265         /**
8266          * The current assistant component. It could be a voice interaction service,
8267          * or an activity that handles ACTION_ASSIST, or empty which means using the default
8268          * handling.
8269          *
8270          * <p>This should be set indirectly by setting the {@link
8271          * android.app.role.RoleManager#ROLE_ASSISTANT assistant role}.
8272          *
8273          * @hide
8274          */
8275         @UnsupportedAppUsage
8276         public static final String ASSISTANT = "assistant";
8277 
8278         /**
8279          * Whether the camera launch gesture should be disabled.
8280          *
8281          * @hide
8282          */
8283         public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled";
8284 
8285         private static final Validator CAMERA_GESTURE_DISABLED_VALIDATOR = BOOLEAN_VALIDATOR;
8286 
8287         /**
8288          * Whether the camera launch gesture to double tap the power button when the screen is off
8289          * should be disabled.
8290          *
8291          * @hide
8292          */
8293         public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED =
8294                 "camera_double_tap_power_gesture_disabled";
8295 
8296         private static final Validator CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED_VALIDATOR =
8297                 BOOLEAN_VALIDATOR;
8298 
8299         /**
8300          * Whether the camera double twist gesture to flip between front and back mode should be
8301          * enabled.
8302          *
8303          * @hide
8304          */
8305         public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED =
8306                 "camera_double_twist_to_flip_enabled";
8307 
8308         private static final Validator CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED_VALIDATOR =
8309                 BOOLEAN_VALIDATOR;
8310 
8311         /**
8312          * Whether or not the smart camera lift trigger that launches the camera when the user moves
8313          * the phone into a position for taking photos should be enabled.
8314          *
8315          * @hide
8316          */
8317         public static final String CAMERA_LIFT_TRIGGER_ENABLED = "camera_lift_trigger_enabled";
8318 
8319         /**
8320          * The default enable state of the camera lift trigger.
8321          *
8322          * @hide
8323          */
8324         public static final int CAMERA_LIFT_TRIGGER_ENABLED_DEFAULT = 1;
8325 
8326         /**
8327          * Whether or not the flashlight (camera torch mode) is available required to turn
8328          * on flashlight.
8329          *
8330          * @hide
8331          */
8332         public static final String FLASHLIGHT_AVAILABLE = "flashlight_available";
8333 
8334         /**
8335          * Whether or not flashlight is enabled.
8336          *
8337          * @hide
8338          */
8339         public static final String FLASHLIGHT_ENABLED = "flashlight_enabled";
8340 
8341         /**
8342          * Whether or not face unlock is allowed on Keyguard.
8343          * @hide
8344          */
8345         public static final String FACE_UNLOCK_KEYGUARD_ENABLED = "face_unlock_keyguard_enabled";
8346 
8347         private static final Validator FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR =
8348                 BOOLEAN_VALIDATOR;
8349 
8350         /**
8351          * Whether or not face unlock dismisses the keyguard.
8352          * @hide
8353          */
8354         public static final String FACE_UNLOCK_DISMISSES_KEYGUARD =
8355                 "face_unlock_dismisses_keyguard";
8356 
8357         private static final Validator FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR =
8358                 BOOLEAN_VALIDATOR;
8359 
8360         /**
8361          * Whether or not media is shown automatically when bypassing as a heads up.
8362          * @hide
8363          */
8364         public static final String SHOW_MEDIA_WHEN_BYPASSING =
8365                 "show_media_when_bypassing";
8366 
8367         private static final Validator SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR =
8368                 BOOLEAN_VALIDATOR;
8369 
8370         /**
8371          * Whether or not face unlock requires attention. This is a cached value, the source of
8372          * truth is obtained through the HAL.
8373          * @hide
8374          */
8375         public static final String FACE_UNLOCK_ATTENTION_REQUIRED =
8376                 "face_unlock_attention_required";
8377 
8378         /**
8379          * Whether or not face unlock requires a diverse set of poses during enrollment. This is a
8380          * cached value, the source of truth is obtained through the HAL.
8381          * @hide
8382          */
8383         public static final String FACE_UNLOCK_DIVERSITY_REQUIRED =
8384                 "face_unlock_diversity_required";
8385 
8386 
8387         /**
8388          * Whether or not face unlock is allowed for apps (through BiometricPrompt).
8389          * @hide
8390          */
8391         public static final String FACE_UNLOCK_APP_ENABLED = "face_unlock_app_enabled";
8392 
8393         private static final Validator FACE_UNLOCK_APP_ENABLED_VALIDATOR =
8394                 BOOLEAN_VALIDATOR;
8395 
8396         /**
8397          * Whether or not face unlock always requires user confirmation, meaning {@link
8398          * android.hardware.biometrics.BiometricPrompt.Builder#setConfirmationRequired(boolean)}
8399          * is always 'true'. This overrides the behavior that apps choose in the
8400          * setConfirmationRequired API.
8401          * @hide
8402          */
8403         public static final String FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION =
8404                 "face_unlock_always_require_confirmation";
8405 
8406         private static final Validator FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR =
8407                 BOOLEAN_VALIDATOR;
8408 
8409         /**
8410          * Whether or not a user should re enroll their face.
8411          *
8412          * Face unlock re enroll.
8413          *  0 = No re enrollment.
8414          *  1 = Re enrollment is suggested.
8415          *  2 = Re enrollment is required after a set time period.
8416          *  3 = Re enrollment is required immediately.
8417          *
8418          * @hide
8419          */
8420         public static final String FACE_UNLOCK_RE_ENROLL = "face_unlock_re_enroll";
8421 
8422         /**
8423          * Whether or not debugging is enabled.
8424          * @hide
8425          */
8426         public static final String BIOMETRIC_DEBUG_ENABLED =
8427                 "biometric_debug_enabled";
8428 
8429         /**
8430          * Whether the assist gesture should be enabled.
8431          *
8432          * @hide
8433          */
8434         public static final String ASSIST_GESTURE_ENABLED = "assist_gesture_enabled";
8435 
8436         private static final Validator ASSIST_GESTURE_ENABLED_VALIDATOR =
8437                 BOOLEAN_VALIDATOR;
8438 
8439         /**
8440          * Sensitivity control for the assist gesture.
8441          *
8442          * @hide
8443          */
8444         public static final String ASSIST_GESTURE_SENSITIVITY = "assist_gesture_sensitivity";
8445 
8446         /**
8447          * Whether the assist gesture should silence alerts.
8448          *
8449          * @hide
8450          */
8451         public static final String ASSIST_GESTURE_SILENCE_ALERTS_ENABLED =
8452                 "assist_gesture_silence_alerts_enabled";
8453 
8454         private static final Validator ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR =
8455                 BOOLEAN_VALIDATOR;
8456 
8457         /**
8458          * Whether the assist gesture should wake the phone.
8459          *
8460          * @hide
8461          */
8462         public static final String ASSIST_GESTURE_WAKE_ENABLED =
8463                 "assist_gesture_wake_enabled";
8464 
8465         private static final Validator ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR =
8466                 BOOLEAN_VALIDATOR;
8467 
8468         /**
8469          * Indicates whether the Assist Gesture Deferred Setup has been completed.
8470          * <p>
8471          * Type: int (0 for false, 1 for true)
8472          *
8473          * @hide
8474          */
8475         @SystemApi
8476         public static final String ASSIST_GESTURE_SETUP_COMPLETE = "assist_gesture_setup_complete";
8477 
8478         /**
8479          * Control whether Trust Agents are in active unlock or extend unlock mode.
8480          * @hide
8481          */
8482         public static final String TRUST_AGENTS_EXTEND_UNLOCK = "trust_agents_extend_unlock";
8483 
8484         private static final Validator TRUST_AGENTS_EXTEND_UNLOCK_VALIDATOR =
8485                 BOOLEAN_VALIDATOR;
8486 
8487         /**
8488          * Control whether the screen locks when trust is lost.
8489          * @hide
8490          */
8491         public static final String LOCK_SCREEN_WHEN_TRUST_LOST = "lock_screen_when_trust_lost";
8492 
8493         private static final Validator LOCK_SCREEN_WHEN_TRUST_LOST_VALIDATOR =
8494                 BOOLEAN_VALIDATOR;
8495 
8496         /**
8497          * Control whether Night display is currently activated.
8498          * @hide
8499          */
8500         public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated";
8501 
8502         /**
8503          * Control whether Night display will automatically activate/deactivate.
8504          * @hide
8505          */
8506         public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode";
8507 
8508         private static final Validator NIGHT_DISPLAY_AUTO_MODE_VALIDATOR =
8509                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 2);
8510 
8511         /**
8512          * Control the color temperature of Night Display, represented in Kelvin.
8513          * @hide
8514          */
8515         public static final String NIGHT_DISPLAY_COLOR_TEMPERATURE =
8516                 "night_display_color_temperature";
8517 
8518         private static final Validator NIGHT_DISPLAY_COLOR_TEMPERATURE_VALIDATOR =
8519                 NON_NEGATIVE_INTEGER_VALIDATOR;
8520 
8521         /**
8522          * Custom time when Night display is scheduled to activate.
8523          * Represented as milliseconds from midnight (e.g. 79200000 == 10pm).
8524          * @hide
8525          */
8526         public static final String NIGHT_DISPLAY_CUSTOM_START_TIME =
8527                 "night_display_custom_start_time";
8528 
8529         private static final Validator NIGHT_DISPLAY_CUSTOM_START_TIME_VALIDATOR =
8530                 NON_NEGATIVE_INTEGER_VALIDATOR;
8531 
8532         /**
8533          * Custom time when Night display is scheduled to deactivate.
8534          * Represented as milliseconds from midnight (e.g. 21600000 == 6am).
8535          * @hide
8536          */
8537         public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time";
8538 
8539         private static final Validator NIGHT_DISPLAY_CUSTOM_END_TIME_VALIDATOR =
8540                 NON_NEGATIVE_INTEGER_VALIDATOR;
8541 
8542         /**
8543          * A String representing the LocalDateTime when Night display was last activated. Use to
8544          * decide whether to apply the current activated state after a reboot or user change. In
8545          * legacy cases, this is represented by the time in milliseconds (since epoch).
8546          * @hide
8547          */
8548         public static final String NIGHT_DISPLAY_LAST_ACTIVATED_TIME =
8549                 "night_display_last_activated_time";
8550 
8551         /**
8552          * Control whether display white balance is currently enabled.
8553          * @hide
8554          */
8555         public static final String DISPLAY_WHITE_BALANCE_ENABLED = "display_white_balance_enabled";
8556 
8557         private static final Validator DISPLAY_WHITE_BALANCE_ENABLED_VALIDATOR =
8558                 BOOLEAN_VALIDATOR;
8559 
8560         /**
8561          * Names of the service components that the current user has explicitly allowed to
8562          * be a VR mode listener, separated by ':'.
8563          *
8564          * @hide
8565          */
8566         @UnsupportedAppUsage
8567         @TestApi
8568         public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
8569 
8570         private static final Validator ENABLED_VR_LISTENERS_VALIDATOR =
8571                 new SettingsValidators.ComponentNameListValidator(":");
8572 
8573         /**
8574          * Behavior of the display while in VR mode.
8575          *
8576          * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}.
8577          *
8578          * @hide
8579          */
8580         public static final String VR_DISPLAY_MODE = "vr_display_mode";
8581 
8582         private static final Validator VR_DISPLAY_MODE_VALIDATOR =
8583                 new SettingsValidators.DiscreteValueValidator(new String[]{"0", "1"});
8584 
8585         /**
8586          * Lower the display persistence while the system is in VR mode.
8587          *
8588          * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
8589          *
8590          * @hide.
8591          */
8592         public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0;
8593 
8594         /**
8595          * Do not alter the display persistence while the system is in VR mode.
8596          *
8597          * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
8598          *
8599          * @hide.
8600          */
8601         public static final int VR_DISPLAY_MODE_OFF = 1;
8602 
8603         /**
8604          * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least
8605          * once.
8606          *
8607          * <p>This is used to ensure that we only take one pass which will disable apps that are not
8608          * privileged (if any). From then on, we only want to enable apps (when a matching SIM is
8609          * inserted), to avoid disabling an app that the user might actively be using.
8610          *
8611          * <p>Will be set to 1 once executed.
8612          *
8613          * @hide
8614          */
8615         public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
8616 
8617         /**
8618          * Whether parent user can access remote contact in managed profile.
8619          *
8620          * @hide
8621          */
8622         public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH =
8623                 "managed_profile_contact_remote_search";
8624 
8625         /**
8626          * Whether parent profile can access remote calendar data in managed profile.
8627          *
8628          * @hide
8629          */
8630         public static final String CROSS_PROFILE_CALENDAR_ENABLED =
8631                 "cross_profile_calendar_enabled";
8632 
8633         /**
8634          * Whether or not the automatic storage manager is enabled and should run on the device.
8635          *
8636          * @hide
8637          */
8638         public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED =
8639                 "automatic_storage_manager_enabled";
8640 
8641         /**
8642          * How many days of information for the automatic storage manager to retain on the device.
8643          *
8644          * @hide
8645          */
8646         public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN =
8647                 "automatic_storage_manager_days_to_retain";
8648 
8649         private static final Validator AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR =
8650                 NON_NEGATIVE_INTEGER_VALIDATOR;
8651 
8652         /**
8653          * Default number of days of information for the automatic storage manager to retain.
8654          *
8655          * @hide
8656          */
8657         public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90;
8658 
8659         /**
8660          * How many bytes the automatic storage manager has cleared out.
8661          *
8662          * @hide
8663          */
8664         public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED =
8665                 "automatic_storage_manager_bytes_cleared";
8666 
8667 
8668         /**
8669          * Last run time for the automatic storage manager.
8670          *
8671          * @hide
8672          */
8673         public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN =
8674                 "automatic_storage_manager_last_run";
8675 
8676         /**
8677          * If the automatic storage manager has been disabled by policy. Note that this doesn't
8678          * mean that the automatic storage manager is prevented from being re-enabled -- this only
8679          * means that it was turned off by policy at least once.
8680          *
8681          * @hide
8682          */
8683         public static final String AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY =
8684                 "automatic_storage_manager_turned_off_by_policy";
8685 
8686         /**
8687          * Whether SystemUI navigation keys is enabled.
8688          * @hide
8689          */
8690         public static final String SYSTEM_NAVIGATION_KEYS_ENABLED =
8691                 "system_navigation_keys_enabled";
8692 
8693         private static final Validator SYSTEM_NAVIGATION_KEYS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
8694 
8695         /**
8696          * Holds comma separated list of ordering of QS tiles.
8697          * @hide
8698          */
8699         public static final String QS_TILES = "sysui_qs_tiles";
8700 
8701         private static final Validator QS_TILES_VALIDATOR = new Validator() {
8702             @Override
8703             public boolean validate(@Nullable String value) {
8704                 if (value == null) {
8705                     return false;
8706                 }
8707                 String[] tiles = value.split(",");
8708                 boolean valid = true;
8709                 for (String tile : tiles) {
8710                     // tile can be any non-empty string as specified by OEM
8711                     valid |= ((tile.length() > 0) && ANY_STRING_VALIDATOR.validate(tile));
8712                 }
8713                 return valid;
8714             }
8715         };
8716 
8717         /**
8718          * Specifies whether the web action API is enabled.
8719          *
8720          * @hide
8721          */
8722         @SystemApi
8723         public static final String INSTANT_APPS_ENABLED = "instant_apps_enabled";
8724 
8725         /**
8726          * Has this pairable device been paired or upgraded from a previously paired system.
8727          * @hide
8728          */
8729         public static final String DEVICE_PAIRED = "device_paired";
8730 
8731         /**
8732          * Integer state indicating whether package verifier is enabled.
8733          * TODO(b/34259924): Remove this setting.
8734          *
8735          * @hide
8736          */
8737         public static final String PACKAGE_VERIFIER_STATE = "package_verifier_state";
8738 
8739         /**
8740          * Specifies additional package name for broadcasting the CMAS messages.
8741          * @hide
8742          */
8743         public static final String CMAS_ADDITIONAL_BROADCAST_PKG = "cmas_additional_broadcast_pkg";
8744 
8745         /**
8746          * Whether the launcher should show any notification badges.
8747          * The value is boolean (1 or 0).
8748          * @hide
8749          */
8750         @UnsupportedAppUsage
8751         @TestApi
8752         public static final String NOTIFICATION_BADGING = "notification_badging";
8753 
8754         private static final Validator NOTIFICATION_BADGING_VALIDATOR = BOOLEAN_VALIDATOR;
8755 
8756         /**
8757          * Whether the notification bubbles are globally enabled
8758          * The value is boolean (1 or 0).
8759          * @hide
8760          * @deprecated use {@link Global#NOTIFICATION_BUBBLES} instead.
8761          */
8762         @TestApi
8763         @Deprecated
8764         public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
8765 
8766         /**
8767          * @deprecated use {@link Global#NOTIFICATION_BUBBLES_VALIDATOR} instead.
8768          */
8769         @Deprecated
8770         private static final Validator NOTIFICATION_BUBBLES_VALIDATOR = BOOLEAN_VALIDATOR;
8771 
8772         /**
8773          * Whether notifications are dismissed by a right-to-left swipe (instead of a left-to-right
8774          * swipe).
8775          *
8776          * @hide
8777          */
8778         public static final String NOTIFICATION_DISMISS_RTL = "notification_dismiss_rtl";
8779 
8780         private static final Validator NOTIFICATION_DISMISS_RTL_VALIDATOR = BOOLEAN_VALIDATOR;
8781 
8782         /**
8783          * Comma separated list of QS tiles that have been auto-added already.
8784          * @hide
8785          */
8786         public static final String QS_AUTO_ADDED_TILES = "qs_auto_tiles";
8787 
8788         private static final Validator QS_AUTO_ADDED_TILES_VALIDATOR = new Validator() {
8789             @Override
8790             public boolean validate(@Nullable String value) {
8791                 if (value == null) {
8792                     return false;
8793                 }
8794                 String[] tiles = value.split(",");
8795                 boolean valid = true;
8796                 for (String tile : tiles) {
8797                     // tile can be any non-empty string as specified by OEM
8798                     valid |= ((tile.length() > 0) && ANY_STRING_VALIDATOR.validate(tile));
8799                 }
8800                 return valid;
8801             }
8802         };
8803 
8804         /**
8805          * Whether the Lockdown button should be shown in the power menu.
8806          * @hide
8807          */
8808         public static final String LOCKDOWN_IN_POWER_MENU = "lockdown_in_power_menu";
8809 
8810         private static final Validator LOCKDOWN_IN_POWER_MENU_VALIDATOR = BOOLEAN_VALIDATOR;
8811 
8812         /**
8813          * Backup manager behavioral parameters.
8814          * This is encoded as a key=value list, separated by commas. Ex:
8815          *
8816          * "key_value_backup_interval_milliseconds=14400000,key_value_backup_require_charging=true"
8817          *
8818          * The following keys are supported:
8819          *
8820          * <pre>
8821          * key_value_backup_interval_milliseconds  (long)
8822          * key_value_backup_fuzz_milliseconds      (long)
8823          * key_value_backup_require_charging       (boolean)
8824          * key_value_backup_required_network_type  (int)
8825          * full_backup_interval_milliseconds       (long)
8826          * full_backup_require_charging            (boolean)
8827          * full_backup_required_network_type       (int)
8828          * backup_finished_notification_receivers  (String[])
8829          * </pre>
8830          *
8831          * backup_finished_notification_receivers uses ":" as delimeter for values.
8832          *
8833          * <p>
8834          * Type: string
8835          * @hide
8836          */
8837         public static final String BACKUP_MANAGER_CONSTANTS = "backup_manager_constants";
8838 
8839 
8840         /**
8841          * Local transport parameters so we can configure it for tests.
8842          * This is encoded as a key=value list, separated by commas.
8843          *
8844          * The following keys are supported:
8845          *
8846          * <pre>
8847          * fake_encryption_flag  (boolean)
8848          * </pre>
8849          *
8850          * <p>
8851          * Type: string
8852          * @hide
8853          */
8854         public static final String BACKUP_LOCAL_TRANSPORT_PARAMETERS =
8855                 "backup_local_transport_parameters";
8856 
8857         /**
8858          * Flag to set if the system should predictively attempt to re-enable Bluetooth while
8859          * the user is driving.
8860          * @hide
8861          */
8862         public static final String BLUETOOTH_ON_WHILE_DRIVING = "bluetooth_on_while_driving";
8863 
8864         /**
8865          * What behavior should be invoked when the volume hush gesture is triggered
8866          * One of VOLUME_HUSH_OFF, VOLUME_HUSH_VIBRATE, VOLUME_HUSH_MUTE.
8867          *
8868          * @hide
8869          */
8870         @SystemApi
8871         public static final String VOLUME_HUSH_GESTURE = "volume_hush_gesture";
8872 
8873         /** @hide */
8874         @SystemApi
8875         public static final int VOLUME_HUSH_OFF = 0;
8876         /** @hide */
8877         @SystemApi
8878         public static final int VOLUME_HUSH_VIBRATE = 1;
8879         /** @hide */
8880         @SystemApi
8881         public static final int VOLUME_HUSH_MUTE = 2;
8882 
8883         private static final Validator VOLUME_HUSH_GESTURE_VALIDATOR =
8884                 NON_NEGATIVE_INTEGER_VALIDATOR;
8885 
8886         /**
8887          * The number of times (integer) the user has manually enabled battery saver.
8888          * @hide
8889          */
8890         public static final String LOW_POWER_MANUAL_ACTIVATION_COUNT =
8891                 "low_power_manual_activation_count";
8892 
8893         /**
8894          * Whether the "first time battery saver warning" dialog needs to be shown (0: default)
8895          * or not (1).
8896          *
8897          * @hide
8898          */
8899         public static final String LOW_POWER_WARNING_ACKNOWLEDGED =
8900                 "low_power_warning_acknowledged";
8901 
8902         /**
8903          * 0 (default) Auto battery saver suggestion has not been suppressed. 1) it has been
8904          * suppressed.
8905          * @hide
8906          */
8907         public static final String SUPPRESS_AUTO_BATTERY_SAVER_SUGGESTION =
8908                 "suppress_auto_battery_saver_suggestion";
8909 
8910         /**
8911          * List of packages, which data need to be unconditionally cleared before full restore.
8912          * Type: string
8913          * @hide
8914          */
8915         public static final String PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE =
8916                 "packages_to_clear_data_before_full_restore";
8917 
8918         /**
8919          * Setting to determine whether to use the new notification priority handling features.
8920          * @hide
8921          */
8922         public static final String NOTIFICATION_NEW_INTERRUPTION_MODEL = "new_interruption_model";
8923 
8924         /**
8925          * How often to check for location access.
8926          * @hide
8927          */
8928         @SystemApi
8929         @TestApi
8930         public static final String LOCATION_ACCESS_CHECK_INTERVAL_MILLIS =
8931                 "location_access_check_interval_millis";
8932 
8933         /**
8934          * Delay between granting location access and checking it.
8935          * @hide
8936          */
8937         @SystemApi
8938         @TestApi
8939         public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS =
8940                 "location_access_check_delay_millis";
8941 
8942         /**
8943          * What should happen to the location permissions when upgraded to Android Q.
8944          *
8945          * <ul>
8946          *     <li>0/unset == revoke permissions</li>
8947          *     <li>anything else == Don't do anything</li>
8948          * </ul>
8949          *
8950          * @hide
8951          */
8952         @SystemApi
8953         public static final String LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE =
8954                 "location_permissions_upgrade_to_q_mode";
8955 
8956         /**
8957          * Map of android.theme.customization.* categories to the enabled overlay package for that
8958          * category, formatted as a serialized {@link org.json.JSONObject}. If there is no
8959          * corresponding package included for a category, then all overlay packages in that
8960          * category must be disabled.
8961          * @hide
8962          */
8963         @SystemApi
8964         public static final String THEME_CUSTOMIZATION_OVERLAY_PACKAGES =
8965                 "theme_customization_overlay_packages";
8966 
8967         private static final Validator THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR =
8968                 SettingsValidators.JSON_OBJECT_VALIDATOR;
8969 
8970         /**
8971          * Navigation bar mode.
8972          *  0 = 3 button
8973          *  1 = 2 button
8974          *  2 = fully gestural
8975          * @hide
8976          */
8977         public static final String NAVIGATION_MODE =
8978                 "navigation_mode";
8979         private static final Validator NAVIGATION_MODE_VALIDATOR =
8980                 new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1", "2"});
8981 
8982         /**
8983          * Current provider of proximity-based sharing services.
8984          * Default value in @string/config_defaultNearbySharingComponent.
8985          * No VALIDATOR as this setting will not be backed up.
8986          * @hide
8987          */
8988         public static final String NEARBY_SHARING_COMPONENT = "nearby_sharing_component";
8989 
8990         /**
8991          * Controls whether aware is enabled.
8992          * @hide
8993          */
8994         public static final String AWARE_ENABLED = "aware_enabled";
8995 
8996         private static final Validator AWARE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
8997 
8998         /**
8999          * Controls whether aware_lock is enabled.
9000          * @hide
9001          */
9002         public static final String AWARE_LOCK_ENABLED = "aware_lock_enabled";
9003 
9004         private static final Validator AWARE_LOCK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
9005 
9006         /**
9007          * Controls whether tap gesture is enabled.
9008          * @hide
9009          */
9010         public static final String TAP_GESTURE = "tap_gesture";
9011 
9012         private static final Validator TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
9013 
9014         /**
9015          * This are the settings to be backed up.
9016          *
9017          * NOTE: Settings are backed up and restored in the order they appear
9018          *       in this array. If you have one setting depending on another,
9019          *       make sure that they are ordered appropriately.
9020          *
9021          * @hide
9022          */
9023         @UnsupportedAppUsage
9024         public static final String[] SETTINGS_TO_BACKUP = {
9025             BUGREPORT_IN_POWER_MENU,                            // moved to global
9026             ALLOW_MOCK_LOCATION,
9027             USB_MASS_STORAGE_ENABLED,                           // moved to global
9028             ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
9029             ACCESSIBILITY_DISPLAY_DALTONIZER,
9030             ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
9031             ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
9032             ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
9033             AUTOFILL_SERVICE,
9034             ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
9035             ENABLED_ACCESSIBILITY_SERVICES,
9036             ENABLED_VR_LISTENERS,
9037             TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
9038             TOUCH_EXPLORATION_ENABLED,
9039             ACCESSIBILITY_ENABLED,
9040             ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
9041             ACCESSIBILITY_BUTTON_TARGET_COMPONENT,
9042             ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
9043             ACCESSIBILITY_SHORTCUT_ENABLED,
9044             ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN,
9045             ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
9046             ACCESSIBILITY_CAPTIONING_PRESET,
9047             ACCESSIBILITY_CAPTIONING_ENABLED,
9048             ACCESSIBILITY_CAPTIONING_LOCALE,
9049             ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
9050             ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
9051             ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
9052             ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
9053             ACCESSIBILITY_CAPTIONING_TYPEFACE,
9054             ACCESSIBILITY_CAPTIONING_FONT_SCALE,
9055             ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
9056             TTS_DEFAULT_RATE,
9057             TTS_DEFAULT_PITCH,
9058             TTS_DEFAULT_SYNTH,
9059             TTS_ENABLED_PLUGINS,
9060             TTS_DEFAULT_LOCALE,
9061             SHOW_IME_WITH_HARD_KEYBOARD,
9062             WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
9063             WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
9064             WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
9065             MOUNT_PLAY_NOTIFICATION_SND,
9066             MOUNT_UMS_AUTOSTART,
9067             MOUNT_UMS_PROMPT,
9068             MOUNT_UMS_NOTIFY_ENABLED,
9069             DOUBLE_TAP_TO_WAKE,
9070             WAKE_GESTURE_ENABLED,
9071             LONG_PRESS_TIMEOUT,
9072             CAMERA_GESTURE_DISABLED,
9073             ACCESSIBILITY_AUTOCLICK_ENABLED,
9074             ACCESSIBILITY_AUTOCLICK_DELAY,
9075             ACCESSIBILITY_LARGE_POINTER_ICON,
9076             PREFERRED_TTY_MODE,
9077             ENHANCED_VOICE_PRIVACY_ENABLED,
9078             TTY_MODE_ENABLED,
9079             RTT_CALLING_MODE,
9080             INCALL_POWER_BUTTON_BEHAVIOR,
9081             NIGHT_DISPLAY_CUSTOM_START_TIME,
9082             NIGHT_DISPLAY_CUSTOM_END_TIME,
9083             NIGHT_DISPLAY_COLOR_TEMPERATURE,
9084             NIGHT_DISPLAY_AUTO_MODE,
9085             DISPLAY_WHITE_BALANCE_ENABLED,
9086             SYNC_PARENT_SOUNDS,
9087             CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
9088             CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
9089             SYSTEM_NAVIGATION_KEYS_ENABLED,
9090             QS_TILES,
9091             DOZE_ENABLED,
9092             DOZE_ALWAYS_ON,
9093             DOZE_PICK_UP_GESTURE,
9094             DOZE_DOUBLE_TAP_GESTURE,
9095             DOZE_TAP_SCREEN_GESTURE,
9096             NFC_PAYMENT_DEFAULT_COMPONENT,
9097             AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
9098             FACE_UNLOCK_KEYGUARD_ENABLED,
9099             SHOW_MEDIA_WHEN_BYPASSING,
9100             FACE_UNLOCK_DISMISSES_KEYGUARD,
9101             FACE_UNLOCK_APP_ENABLED,
9102             FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
9103             VR_DISPLAY_MODE,
9104             NOTIFICATION_BADGING,
9105             NOTIFICATION_DISMISS_RTL,
9106             QS_AUTO_ADDED_TILES,
9107             SCREENSAVER_ENABLED,
9108             SCREENSAVER_COMPONENTS,
9109             SCREENSAVER_ACTIVATE_ON_DOCK,
9110             SCREENSAVER_ACTIVATE_ON_SLEEP,
9111             LOCKDOWN_IN_POWER_MENU,
9112             SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
9113             VOLUME_HUSH_GESTURE,
9114             MANUAL_RINGER_TOGGLE_COUNT,
9115             HUSH_GESTURE_USED,
9116             IN_CALL_NOTIFICATION_ENABLED,
9117             LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
9118             LOCK_SCREEN_CUSTOM_CLOCK_FACE,
9119             LOCK_SCREEN_SHOW_NOTIFICATIONS,
9120             LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS,
9121             SHOW_NOTIFICATION_SNOOZE,
9122             ZEN_DURATION,
9123             SHOW_ZEN_UPGRADE_NOTIFICATION,
9124             SHOW_ZEN_SETTINGS_SUGGESTION,
9125             ZEN_SETTINGS_UPDATED,
9126             ZEN_SETTINGS_SUGGESTION_VIEWED,
9127             CHARGING_SOUNDS_ENABLED,
9128             CHARGING_VIBRATION_ENABLED,
9129             ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS,
9130             ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS,
9131             NOTIFICATION_NEW_INTERRUPTION_MODEL,
9132             TRUST_AGENTS_EXTEND_UNLOCK,
9133             UI_NIGHT_MODE,
9134             LOCK_SCREEN_WHEN_TRUST_LOST,
9135             SKIP_DIRECTION,
9136             THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
9137             NAVIGATION_MODE,
9138             SKIP_GESTURE_COUNT,
9139             SKIP_TOUCH_COUNT,
9140             SILENCE_ALARMS_GESTURE_COUNT,
9141             SILENCE_CALL_GESTURE_COUNT,
9142             SILENCE_TIMER_GESTURE_COUNT,
9143             SILENCE_ALARMS_TOUCH_COUNT,
9144             SILENCE_CALL_TOUCH_COUNT,
9145             SILENCE_TIMER_TOUCH_COUNT,
9146             DARK_MODE_DIALOG_SEEN,
9147             GLOBAL_ACTIONS_PANEL_ENABLED,
9148             AWARE_LOCK_ENABLED,
9149             AWARE_TAP_PAUSE_GESTURE_COUNT,
9150             AWARE_TAP_PAUSE_TOUCH_COUNT
9151         };
9152 
9153         /**
9154          * All settings in {@link SETTINGS_TO_BACKUP} array *must* have a non-null validator,
9155          * otherwise they won't be restored.
9156          *
9157          * @hide
9158          */
9159         public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
9160         static {
VALIDATORS.put(BUGREPORT_IN_POWER_MENU, BUGREPORT_IN_POWER_MENU_VALIDATOR)9161             VALIDATORS.put(BUGREPORT_IN_POWER_MENU, BUGREPORT_IN_POWER_MENU_VALIDATOR);
VALIDATORS.put(ALLOW_MOCK_LOCATION, ALLOW_MOCK_LOCATION_VALIDATOR)9162             VALIDATORS.put(ALLOW_MOCK_LOCATION, ALLOW_MOCK_LOCATION_VALIDATOR);
VALIDATORS.put(USB_MASS_STORAGE_ENABLED, USB_MASS_STORAGE_ENABLED_VALIDATOR)9163             VALIDATORS.put(USB_MASS_STORAGE_ENABLED, USB_MASS_STORAGE_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, ACCESSIBILITY_DISPLAY_INVERSION_ENABLED_VALIDATOR)9164             VALIDATORS.put(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
9165                     ACCESSIBILITY_DISPLAY_INVERSION_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_DISPLAY_DALTONIZER, ACCESSIBILITY_DISPLAY_DALTONIZER_VALIDATOR)9166             VALIDATORS.put(ACCESSIBILITY_DISPLAY_DALTONIZER,
9167                     ACCESSIBILITY_DISPLAY_DALTONIZER_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED_VALIDATOR)9168             VALIDATORS.put(ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
9169                     ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED_VALIDATOR)9170             VALIDATORS.put(ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
9171                     ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED_VALIDATOR)9172             VALIDATORS.put(ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
9173                     ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED_VALIDATOR);
VALIDATORS.put(AUTOFILL_SERVICE, AUTOFILL_SERVICE_VALIDATOR)9174             VALIDATORS.put(AUTOFILL_SERVICE, AUTOFILL_SERVICE_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE_VALIDATOR)9175             VALIDATORS.put(ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
9176                     ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE_VALIDATOR);
VALIDATORS.put(ENABLED_ACCESSIBILITY_SERVICES, ENABLED_ACCESSIBILITY_SERVICES_VALIDATOR)9177             VALIDATORS.put(ENABLED_ACCESSIBILITY_SERVICES,
9178                     ENABLED_ACCESSIBILITY_SERVICES_VALIDATOR);
VALIDATORS.put(ENABLED_VR_LISTENERS, ENABLED_VR_LISTENERS_VALIDATOR)9179             VALIDATORS.put(ENABLED_VR_LISTENERS, ENABLED_VR_LISTENERS_VALIDATOR);
VALIDATORS.put(TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES_VALIDATOR)9180             VALIDATORS.put(TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
9181                     TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES_VALIDATOR);
VALIDATORS.put(TOUCH_EXPLORATION_ENABLED, TOUCH_EXPLORATION_ENABLED_VALIDATOR)9182             VALIDATORS.put(TOUCH_EXPLORATION_ENABLED, TOUCH_EXPLORATION_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_ENABLED, ACCESSIBILITY_ENABLED_VALIDATOR)9183             VALIDATORS.put(ACCESSIBILITY_ENABLED, ACCESSIBILITY_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, ACCESSIBILITY_SHORTCUT_TARGET_SERVICE_VALIDATOR)9184             VALIDATORS.put(ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
9185                     ACCESSIBILITY_SHORTCUT_TARGET_SERVICE_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_BUTTON_TARGET_COMPONENT, ACCESSIBILITY_BUTTON_TARGET_COMPONENT_VALIDATOR)9186             VALIDATORS.put(ACCESSIBILITY_BUTTON_TARGET_COMPONENT,
9187                     ACCESSIBILITY_BUTTON_TARGET_COMPONENT_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN_VALIDATOR)9188             VALIDATORS.put(ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
9189                     ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_SHORTCUT_ENABLED, ACCESSIBILITY_SHORTCUT_ENABLED_VALIDATOR)9190             VALIDATORS.put(ACCESSIBILITY_SHORTCUT_ENABLED,
9191                     ACCESSIBILITY_SHORTCUT_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN_VALIDATOR)9192             VALIDATORS.put(ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN,
9193                     ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED_VALIDATOR)9194             VALIDATORS.put(ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
9195                     ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_PRESET, ACCESSIBILITY_CAPTIONING_PRESET_VALIDATOR)9196             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_PRESET,
9197                     ACCESSIBILITY_CAPTIONING_PRESET_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_ENABLED, ACCESSIBILITY_CAPTIONING_ENABLED_VALIDATOR)9198             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_ENABLED,
9199                     ACCESSIBILITY_CAPTIONING_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_LOCALE, ACCESSIBILITY_CAPTIONING_LOCALE_VALIDATOR)9200             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_LOCALE,
9201                     ACCESSIBILITY_CAPTIONING_LOCALE_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR_VALIDATOR)9202             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
9203                     ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR_VALIDATOR)9204             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
9205                     ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_EDGE_TYPE, ACCESSIBILITY_CAPTIONING_EDGE_TYPE_VALIDATOR)9206             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
9207                     ACCESSIBILITY_CAPTIONING_EDGE_TYPE_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_EDGE_COLOR, ACCESSIBILITY_CAPTIONING_EDGE_COLOR_VALIDATOR)9208             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
9209                     ACCESSIBILITY_CAPTIONING_EDGE_COLOR_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_TYPEFACE, ACCESSIBILITY_CAPTIONING_TYPEFACE_VALIDATOR)9210             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_TYPEFACE,
9211                     ACCESSIBILITY_CAPTIONING_TYPEFACE_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_FONT_SCALE, ACCESSIBILITY_CAPTIONING_FONT_SCALE_VALIDATOR)9212             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_FONT_SCALE,
9213                     ACCESSIBILITY_CAPTIONING_FONT_SCALE_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, ACCESSIBILITY_CAPTIONING_WINDOW_COLOR_VALIDATOR)9214             VALIDATORS.put(ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
9215                     ACCESSIBILITY_CAPTIONING_WINDOW_COLOR_VALIDATOR);
VALIDATORS.put(TTS_DEFAULT_RATE, TTS_DEFAULT_RATE_VALIDATOR)9216             VALIDATORS.put(TTS_DEFAULT_RATE, TTS_DEFAULT_RATE_VALIDATOR);
VALIDATORS.put(TTS_DEFAULT_PITCH, TTS_DEFAULT_PITCH_VALIDATOR)9217             VALIDATORS.put(TTS_DEFAULT_PITCH, TTS_DEFAULT_PITCH_VALIDATOR);
VALIDATORS.put(TTS_DEFAULT_SYNTH, TTS_DEFAULT_SYNTH_VALIDATOR)9218             VALIDATORS.put(TTS_DEFAULT_SYNTH, TTS_DEFAULT_SYNTH_VALIDATOR);
VALIDATORS.put(TTS_ENABLED_PLUGINS, TTS_ENABLED_PLUGINS_VALIDATOR)9219             VALIDATORS.put(TTS_ENABLED_PLUGINS, TTS_ENABLED_PLUGINS_VALIDATOR);
VALIDATORS.put(TTS_DEFAULT_LOCALE, TTS_DEFAULT_LOCALE_VALIDATOR)9220             VALIDATORS.put(TTS_DEFAULT_LOCALE, TTS_DEFAULT_LOCALE_VALIDATOR);
VALIDATORS.put(SHOW_IME_WITH_HARD_KEYBOARD, SHOW_IME_WITH_HARD_KEYBOARD_VALIDATOR)9221             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)9222             VALIDATORS.put(WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
9223                     WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR);
VALIDATORS.put(WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY_VALIDATOR)9224             VALIDATORS.put(WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
9225                     WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY_VALIDATOR);
VALIDATORS.put(WIFI_NUM_OPEN_NETWORKS_KEPT, WIFI_NUM_OPEN_NETWORKS_KEPT_VALIDATOR)9226             VALIDATORS.put(WIFI_NUM_OPEN_NETWORKS_KEPT, WIFI_NUM_OPEN_NETWORKS_KEPT_VALIDATOR);
VALIDATORS.put(MOUNT_PLAY_NOTIFICATION_SND, MOUNT_PLAY_NOTIFICATION_SND_VALIDATOR)9227             VALIDATORS.put(MOUNT_PLAY_NOTIFICATION_SND, MOUNT_PLAY_NOTIFICATION_SND_VALIDATOR);
VALIDATORS.put(MOUNT_UMS_AUTOSTART, MOUNT_UMS_AUTOSTART_VALIDATOR)9228             VALIDATORS.put(MOUNT_UMS_AUTOSTART, MOUNT_UMS_AUTOSTART_VALIDATOR);
VALIDATORS.put(MOUNT_UMS_PROMPT, MOUNT_UMS_PROMPT_VALIDATOR)9229             VALIDATORS.put(MOUNT_UMS_PROMPT, MOUNT_UMS_PROMPT_VALIDATOR);
VALIDATORS.put(MOUNT_UMS_NOTIFY_ENABLED, MOUNT_UMS_NOTIFY_ENABLED_VALIDATOR)9230             VALIDATORS.put(MOUNT_UMS_NOTIFY_ENABLED, MOUNT_UMS_NOTIFY_ENABLED_VALIDATOR);
VALIDATORS.put(DOUBLE_TAP_TO_WAKE, DOUBLE_TAP_TO_WAKE_VALIDATOR)9231             VALIDATORS.put(DOUBLE_TAP_TO_WAKE, DOUBLE_TAP_TO_WAKE_VALIDATOR);
VALIDATORS.put(WAKE_GESTURE_ENABLED, WAKE_GESTURE_ENABLED_VALIDATOR)9232             VALIDATORS.put(WAKE_GESTURE_ENABLED, WAKE_GESTURE_ENABLED_VALIDATOR);
VALIDATORS.put(LONG_PRESS_TIMEOUT, LONG_PRESS_TIMEOUT_VALIDATOR)9233             VALIDATORS.put(LONG_PRESS_TIMEOUT, LONG_PRESS_TIMEOUT_VALIDATOR);
VALIDATORS.put(CAMERA_GESTURE_DISABLED, CAMERA_GESTURE_DISABLED_VALIDATOR)9234             VALIDATORS.put(CAMERA_GESTURE_DISABLED, CAMERA_GESTURE_DISABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_AUTOCLICK_ENABLED, ACCESSIBILITY_AUTOCLICK_ENABLED_VALIDATOR)9235             VALIDATORS.put(ACCESSIBILITY_AUTOCLICK_ENABLED,
9236                     ACCESSIBILITY_AUTOCLICK_ENABLED_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_AUTOCLICK_DELAY, ACCESSIBILITY_AUTOCLICK_DELAY_VALIDATOR)9237             VALIDATORS.put(ACCESSIBILITY_AUTOCLICK_DELAY, ACCESSIBILITY_AUTOCLICK_DELAY_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_LARGE_POINTER_ICON, ACCESSIBILITY_LARGE_POINTER_ICON_VALIDATOR)9238             VALIDATORS.put(ACCESSIBILITY_LARGE_POINTER_ICON,
9239                     ACCESSIBILITY_LARGE_POINTER_ICON_VALIDATOR);
VALIDATORS.put(PREFERRED_TTY_MODE, PREFERRED_TTY_MODE_VALIDATOR)9240             VALIDATORS.put(PREFERRED_TTY_MODE, PREFERRED_TTY_MODE_VALIDATOR);
VALIDATORS.put(ENHANCED_VOICE_PRIVACY_ENABLED, ENHANCED_VOICE_PRIVACY_ENABLED_VALIDATOR)9241             VALIDATORS.put(ENHANCED_VOICE_PRIVACY_ENABLED,
9242                     ENHANCED_VOICE_PRIVACY_ENABLED_VALIDATOR);
VALIDATORS.put(TTY_MODE_ENABLED, TTY_MODE_ENABLED_VALIDATOR)9243             VALIDATORS.put(TTY_MODE_ENABLED, TTY_MODE_ENABLED_VALIDATOR);
VALIDATORS.put(RTT_CALLING_MODE, RTT_CALLING_MODE_VALIDATOR)9244             VALIDATORS.put(RTT_CALLING_MODE, RTT_CALLING_MODE_VALIDATOR);
VALIDATORS.put(INCALL_POWER_BUTTON_BEHAVIOR, INCALL_POWER_BUTTON_BEHAVIOR_VALIDATOR)9245             VALIDATORS.put(INCALL_POWER_BUTTON_BEHAVIOR, INCALL_POWER_BUTTON_BEHAVIOR_VALIDATOR);
VALIDATORS.put(NIGHT_DISPLAY_CUSTOM_START_TIME, NIGHT_DISPLAY_CUSTOM_START_TIME_VALIDATOR)9246             VALIDATORS.put(NIGHT_DISPLAY_CUSTOM_START_TIME,
9247                     NIGHT_DISPLAY_CUSTOM_START_TIME_VALIDATOR);
VALIDATORS.put(NIGHT_DISPLAY_CUSTOM_END_TIME, NIGHT_DISPLAY_CUSTOM_END_TIME_VALIDATOR)9248             VALIDATORS.put(NIGHT_DISPLAY_CUSTOM_END_TIME, NIGHT_DISPLAY_CUSTOM_END_TIME_VALIDATOR);
VALIDATORS.put(NIGHT_DISPLAY_COLOR_TEMPERATURE, NIGHT_DISPLAY_COLOR_TEMPERATURE_VALIDATOR)9249             VALIDATORS.put(NIGHT_DISPLAY_COLOR_TEMPERATURE,
9250                     NIGHT_DISPLAY_COLOR_TEMPERATURE_VALIDATOR);
VALIDATORS.put(NIGHT_DISPLAY_AUTO_MODE, NIGHT_DISPLAY_AUTO_MODE_VALIDATOR)9251             VALIDATORS.put(NIGHT_DISPLAY_AUTO_MODE, NIGHT_DISPLAY_AUTO_MODE_VALIDATOR);
VALIDATORS.put(DISPLAY_WHITE_BALANCE_ENABLED, DISPLAY_WHITE_BALANCE_ENABLED_VALIDATOR)9252             VALIDATORS.put(DISPLAY_WHITE_BALANCE_ENABLED, DISPLAY_WHITE_BALANCE_ENABLED_VALIDATOR);
VALIDATORS.put(SYNC_PARENT_SOUNDS, SYNC_PARENT_SOUNDS_VALIDATOR)9253             VALIDATORS.put(SYNC_PARENT_SOUNDS, SYNC_PARENT_SOUNDS_VALIDATOR);
VALIDATORS.put(CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED_VALIDATOR)9254             VALIDATORS.put(CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
9255                     CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED_VALIDATOR);
VALIDATORS.put(CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED_VALIDATOR)9256             VALIDATORS.put(CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
9257                     CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED_VALIDATOR);
VALIDATORS.put(SYSTEM_NAVIGATION_KEYS_ENABLED, SYSTEM_NAVIGATION_KEYS_ENABLED_VALIDATOR)9258             VALIDATORS.put(SYSTEM_NAVIGATION_KEYS_ENABLED,
9259                     SYSTEM_NAVIGATION_KEYS_ENABLED_VALIDATOR);
VALIDATORS.put(QS_TILES, QS_TILES_VALIDATOR)9260             VALIDATORS.put(QS_TILES, QS_TILES_VALIDATOR);
VALIDATORS.put(DOZE_ENABLED, DOZE_ENABLED_VALIDATOR)9261             VALIDATORS.put(DOZE_ENABLED, DOZE_ENABLED_VALIDATOR);
VALIDATORS.put(DOZE_ALWAYS_ON, DOZE_ALWAYS_ON_VALIDATOR)9262             VALIDATORS.put(DOZE_ALWAYS_ON, DOZE_ALWAYS_ON_VALIDATOR);
VALIDATORS.put(DOZE_PICK_UP_GESTURE, DOZE_PICK_UP_GESTURE_VALIDATOR)9263             VALIDATORS.put(DOZE_PICK_UP_GESTURE, DOZE_PICK_UP_GESTURE_VALIDATOR);
VALIDATORS.put(DOZE_DOUBLE_TAP_GESTURE, DOZE_DOUBLE_TAP_GESTURE_VALIDATOR)9264             VALIDATORS.put(DOZE_DOUBLE_TAP_GESTURE, DOZE_DOUBLE_TAP_GESTURE_VALIDATOR);
VALIDATORS.put(DOZE_TAP_SCREEN_GESTURE, DOZE_TAP_SCREEN_GESTURE_VALIDATOR)9265             VALIDATORS.put(DOZE_TAP_SCREEN_GESTURE, DOZE_TAP_SCREEN_GESTURE_VALIDATOR);
VALIDATORS.put(DOZE_WAKE_LOCK_SCREEN_GESTURE, DOZE_WAKE_LOCK_SCREEN_GESTURE_VALIDATOR)9266             VALIDATORS.put(DOZE_WAKE_LOCK_SCREEN_GESTURE, DOZE_WAKE_LOCK_SCREEN_GESTURE_VALIDATOR);
VALIDATORS.put(DOZE_WAKE_DISPLAY_GESTURE, DOZE_WAKE_DISPLAY_GESTURE_VALIDATOR)9267             VALIDATORS.put(DOZE_WAKE_DISPLAY_GESTURE, DOZE_WAKE_DISPLAY_GESTURE_VALIDATOR);
VALIDATORS.put(NFC_PAYMENT_DEFAULT_COMPONENT, NFC_PAYMENT_DEFAULT_COMPONENT_VALIDATOR)9268             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)9269             VALIDATORS.put(AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
9270                     AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR);
VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR)9271             VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR);
VALIDATORS.put(FACE_UNLOCK_DISMISSES_KEYGUARD, FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR)9272             VALIDATORS.put(FACE_UNLOCK_DISMISSES_KEYGUARD,
9273                     FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR);
VALIDATORS.put(SHOW_MEDIA_WHEN_BYPASSING, SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR)9274             VALIDATORS.put(SHOW_MEDIA_WHEN_BYPASSING, SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR);
VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR)9275             VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR);
VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR)9276             VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
9277                     FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR);
VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR)9278             VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR);
VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR)9279             VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
9280                     ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR);
VALIDATORS.put(ASSIST_GESTURE_WAKE_ENABLED, ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR)9281             VALIDATORS.put(ASSIST_GESTURE_WAKE_ENABLED, ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR);
VALIDATORS.put(VR_DISPLAY_MODE, VR_DISPLAY_MODE_VALIDATOR)9282             VALIDATORS.put(VR_DISPLAY_MODE, VR_DISPLAY_MODE_VALIDATOR);
VALIDATORS.put(NOTIFICATION_BADGING, NOTIFICATION_BADGING_VALIDATOR)9283             VALIDATORS.put(NOTIFICATION_BADGING, NOTIFICATION_BADGING_VALIDATOR);
VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR)9284             VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR);
VALIDATORS.put(NOTIFICATION_DISMISS_RTL, NOTIFICATION_DISMISS_RTL_VALIDATOR)9285             VALIDATORS.put(NOTIFICATION_DISMISS_RTL, NOTIFICATION_DISMISS_RTL_VALIDATOR);
VALIDATORS.put(QS_AUTO_ADDED_TILES, QS_AUTO_ADDED_TILES_VALIDATOR)9286             VALIDATORS.put(QS_AUTO_ADDED_TILES, QS_AUTO_ADDED_TILES_VALIDATOR);
VALIDATORS.put(SCREENSAVER_ENABLED, SCREENSAVER_ENABLED_VALIDATOR)9287             VALIDATORS.put(SCREENSAVER_ENABLED, SCREENSAVER_ENABLED_VALIDATOR);
VALIDATORS.put(SCREENSAVER_COMPONENTS, SCREENSAVER_COMPONENTS_VALIDATOR)9288             VALIDATORS.put(SCREENSAVER_COMPONENTS, SCREENSAVER_COMPONENTS_VALIDATOR);
VALIDATORS.put(SCREENSAVER_ACTIVATE_ON_DOCK, SCREENSAVER_ACTIVATE_ON_DOCK_VALIDATOR)9289             VALIDATORS.put(SCREENSAVER_ACTIVATE_ON_DOCK, SCREENSAVER_ACTIVATE_ON_DOCK_VALIDATOR);
VALIDATORS.put(SCREENSAVER_ACTIVATE_ON_SLEEP, SCREENSAVER_ACTIVATE_ON_SLEEP_VALIDATOR)9290             VALIDATORS.put(SCREENSAVER_ACTIVATE_ON_SLEEP, SCREENSAVER_ACTIVATE_ON_SLEEP_VALIDATOR);
VALIDATORS.put(LOCKDOWN_IN_POWER_MENU, LOCKDOWN_IN_POWER_MENU_VALIDATOR)9291             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)9292             VALIDATORS.put(SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
9293                     SHOW_FIRST_CRASH_DIALOG_DEV_OPTION_VALIDATOR);
VALIDATORS.put(VOLUME_HUSH_GESTURE, VOLUME_HUSH_GESTURE_VALIDATOR)9294             VALIDATORS.put(VOLUME_HUSH_GESTURE, VOLUME_HUSH_GESTURE_VALIDATOR);
VALIDATORS.put(ENABLED_NOTIFICATION_LISTENERS, ENABLED_NOTIFICATION_LISTENERS_VALIDATOR)9295             VALIDATORS.put(ENABLED_NOTIFICATION_LISTENERS,
9296                     ENABLED_NOTIFICATION_LISTENERS_VALIDATOR); //legacy restore setting
VALIDATORS.put(ENABLED_NOTIFICATION_ASSISTANT, ENABLED_NOTIFICATION_ASSISTANT_VALIDATOR)9297             VALIDATORS.put(ENABLED_NOTIFICATION_ASSISTANT,
9298                     ENABLED_NOTIFICATION_ASSISTANT_VALIDATOR); //legacy restore setting
VALIDATORS.put(ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES_VALIDATOR)9299             VALIDATORS.put(ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES,
9300                     ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES_VALIDATOR); //legacy restore setting
VALIDATORS.put(HUSH_GESTURE_USED, HUSH_GESTURE_USED_VALIDATOR)9301             VALIDATORS.put(HUSH_GESTURE_USED, HUSH_GESTURE_USED_VALIDATOR);
VALIDATORS.put(MANUAL_RINGER_TOGGLE_COUNT, MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR)9302             VALIDATORS.put(MANUAL_RINGER_TOGGLE_COUNT, MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR);
VALIDATORS.put(IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED_VALIDATOR)9303             VALIDATORS.put(IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED_VALIDATOR);
VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR)9304             VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR);
VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR)9305             VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR);
VALIDATORS.put(LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, BOOLEAN_VALIDATOR)9306             VALIDATORS.put(LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, BOOLEAN_VALIDATOR);
VALIDATORS.put(SHOW_NOTIFICATION_SNOOZE, BOOLEAN_VALIDATOR)9307             VALIDATORS.put(SHOW_NOTIFICATION_SNOOZE, BOOLEAN_VALIDATOR);
VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR)9308             VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR);
VALIDATORS.put(SHOW_ZEN_UPGRADE_NOTIFICATION, BOOLEAN_VALIDATOR)9309             VALIDATORS.put(SHOW_ZEN_UPGRADE_NOTIFICATION, BOOLEAN_VALIDATOR);
VALIDATORS.put(SHOW_ZEN_SETTINGS_SUGGESTION, BOOLEAN_VALIDATOR)9310             VALIDATORS.put(SHOW_ZEN_SETTINGS_SUGGESTION, BOOLEAN_VALIDATOR);
VALIDATORS.put(ZEN_SETTINGS_UPDATED, BOOLEAN_VALIDATOR)9311             VALIDATORS.put(ZEN_SETTINGS_UPDATED, BOOLEAN_VALIDATOR);
VALIDATORS.put(ZEN_SETTINGS_SUGGESTION_VIEWED, BOOLEAN_VALIDATOR)9312             VALIDATORS.put(ZEN_SETTINGS_SUGGESTION_VIEWED, BOOLEAN_VALIDATOR);
VALIDATORS.put(CHARGING_SOUNDS_ENABLED, BOOLEAN_VALIDATOR)9313             VALIDATORS.put(CHARGING_SOUNDS_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(CHARGING_VIBRATION_ENABLED, BOOLEAN_VALIDATOR)9314             VALIDATORS.put(CHARGING_VIBRATION_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS, NON_NEGATIVE_INTEGER_VALIDATOR)9315             VALIDATORS.put(ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS,
9316                     NON_NEGATIVE_INTEGER_VALIDATOR);
VALIDATORS.put(ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, NON_NEGATIVE_INTEGER_VALIDATOR)9317             VALIDATORS.put(ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS, NON_NEGATIVE_INTEGER_VALIDATOR);
VALIDATORS.put(USER_SETUP_COMPLETE, BOOLEAN_VALIDATOR)9318             VALIDATORS.put(USER_SETUP_COMPLETE, BOOLEAN_VALIDATOR);
VALIDATORS.put(ASSIST_GESTURE_SETUP_COMPLETE, BOOLEAN_VALIDATOR)9319             VALIDATORS.put(ASSIST_GESTURE_SETUP_COMPLETE, BOOLEAN_VALIDATOR);
VALIDATORS.put(NOTIFICATION_NEW_INTERRUPTION_MODEL, BOOLEAN_VALIDATOR)9320             VALIDATORS.put(NOTIFICATION_NEW_INTERRUPTION_MODEL, BOOLEAN_VALIDATOR);
VALIDATORS.put(TRUST_AGENTS_EXTEND_UNLOCK, TRUST_AGENTS_EXTEND_UNLOCK_VALIDATOR)9321             VALIDATORS.put(TRUST_AGENTS_EXTEND_UNLOCK, TRUST_AGENTS_EXTEND_UNLOCK_VALIDATOR);
VALIDATORS.put(LOCK_SCREEN_CUSTOM_CLOCK_FACE, LOCK_SCREEN_CUSTOM_CLOCK_FACE_VALIDATOR)9322             VALIDATORS.put(LOCK_SCREEN_CUSTOM_CLOCK_FACE, LOCK_SCREEN_CUSTOM_CLOCK_FACE_VALIDATOR);
VALIDATORS.put(LOCK_SCREEN_WHEN_TRUST_LOST, LOCK_SCREEN_WHEN_TRUST_LOST_VALIDATOR)9323             VALIDATORS.put(LOCK_SCREEN_WHEN_TRUST_LOST, LOCK_SCREEN_WHEN_TRUST_LOST_VALIDATOR);
VALIDATORS.put(SKIP_GESTURE, SKIP_GESTURE_VALIDATOR)9324             VALIDATORS.put(SKIP_GESTURE, SKIP_GESTURE_VALIDATOR);
VALIDATORS.put(SKIP_DIRECTION, SKIP_DIRECTION_VALIDATOR)9325             VALIDATORS.put(SKIP_DIRECTION, SKIP_DIRECTION_VALIDATOR);
VALIDATORS.put(SKIP_DIRECTION, SKIP_DIRECTION_VALIDATOR)9326             VALIDATORS.put(SKIP_DIRECTION, SKIP_DIRECTION_VALIDATOR);
VALIDATORS.put(SILENCE_GESTURE, SILENCE_GESTURE_VALIDATOR)9327             VALIDATORS.put(SILENCE_GESTURE, SILENCE_GESTURE_VALIDATOR);
VALIDATORS.put(THEME_CUSTOMIZATION_OVERLAY_PACKAGES, THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR)9328             VALIDATORS.put(THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
9329                     THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR);
VALIDATORS.put(NAVIGATION_MODE, NAVIGATION_MODE_VALIDATOR)9330             VALIDATORS.put(NAVIGATION_MODE, NAVIGATION_MODE_VALIDATOR);
VALIDATORS.put(AWARE_ENABLED, AWARE_ENABLED_VALIDATOR)9331             VALIDATORS.put(AWARE_ENABLED, AWARE_ENABLED_VALIDATOR);
VALIDATORS.put(SKIP_GESTURE_COUNT, SKIP_GESTURE_COUNT_VALIDATOR)9332             VALIDATORS.put(SKIP_GESTURE_COUNT, SKIP_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SKIP_TOUCH_COUNT, SKIP_GESTURE_COUNT_VALIDATOR)9333             VALIDATORS.put(SKIP_TOUCH_COUNT, SKIP_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SILENCE_ALARMS_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR)9334             VALIDATORS.put(SILENCE_ALARMS_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SILENCE_TIMER_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR)9335             VALIDATORS.put(SILENCE_TIMER_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SILENCE_CALL_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR)9336             VALIDATORS.put(SILENCE_CALL_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SILENCE_ALARMS_TOUCH_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR)9337             VALIDATORS.put(SILENCE_ALARMS_TOUCH_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SILENCE_TIMER_TOUCH_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR)9338             VALIDATORS.put(SILENCE_TIMER_TOUCH_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(SILENCE_CALL_TOUCH_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR)9339             VALIDATORS.put(SILENCE_CALL_TOUCH_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
VALIDATORS.put(ODI_CAPTIONS_ENABLED, ODI_CAPTIONS_ENABLED_VALIDATOR)9340             VALIDATORS.put(ODI_CAPTIONS_ENABLED, ODI_CAPTIONS_ENABLED_VALIDATOR);
VALIDATORS.put(DARK_MODE_DIALOG_SEEN, BOOLEAN_VALIDATOR)9341             VALIDATORS.put(DARK_MODE_DIALOG_SEEN, BOOLEAN_VALIDATOR);
VALIDATORS.put(UI_NIGHT_MODE, UI_NIGHT_MODE_VALIDATOR)9342             VALIDATORS.put(UI_NIGHT_MODE, UI_NIGHT_MODE_VALIDATOR);
VALIDATORS.put(GLOBAL_ACTIONS_PANEL_ENABLED, GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR)9343             VALIDATORS.put(GLOBAL_ACTIONS_PANEL_ENABLED, GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR);
VALIDATORS.put(AWARE_LOCK_ENABLED, AWARE_LOCK_ENABLED_VALIDATOR)9344             VALIDATORS.put(AWARE_LOCK_ENABLED, AWARE_LOCK_ENABLED_VALIDATOR);
VALIDATORS.put(AWARE_TAP_PAUSE_GESTURE_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR)9345             VALIDATORS.put(AWARE_TAP_PAUSE_GESTURE_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR);
VALIDATORS.put(AWARE_TAP_PAUSE_TOUCH_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR)9346             VALIDATORS.put(AWARE_TAP_PAUSE_TOUCH_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR);
VALIDATORS.put(TAP_GESTURE, TAP_GESTURE_VALIDATOR)9347             VALIDATORS.put(TAP_GESTURE, TAP_GESTURE_VALIDATOR);
9348         }
9349 
9350         /**
9351          * Keys we no longer back up under the current schema, but want to continue to
9352          * process when restoring historical backup datasets.
9353          *
9354          * All settings in {@link LEGACY_RESTORE_SETTINGS} array *must* have a non-null validator,
9355          * otherwise they won't be restored.
9356          *
9357          * @hide
9358          */
9359         public static final String[] LEGACY_RESTORE_SETTINGS = {
9360                 ENABLED_NOTIFICATION_LISTENERS,
9361                 ENABLED_NOTIFICATION_ASSISTANT,
9362                 ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES
9363         };
9364 
9365         /**
9366          * These entries are considered common between the personal and the managed profile,
9367          * since the managed profile doesn't get to change them.
9368          */
9369         private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
9370 
9371         static {
9372             CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
9373             CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
9374             CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
9375             CLONE_TO_MANAGED_PROFILE.add(CONTENT_CAPTURE_ENABLED);
9376             CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
9377             CLONE_TO_MANAGED_PROFILE.add(LOCATION_CHANGER);
9378             CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
9379             CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
9380             CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD);
9381             if (!InputMethodSystemProperty.PER_PROFILE_IME_ENABLED) {
9382                 CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
9383                 CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
9384                 CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
9385                 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
9386                 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
9387             }
9388         }
9389 
9390         /** @hide */
getCloneToManagedProfileSettings(Set<String> outKeySet)9391         public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
9392             outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
9393         }
9394 
9395         /**
9396          * Secure settings which can be accessed by instant apps.
9397          * @hide
9398          */
9399         public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
9400         static {
9401             INSTANT_APP_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES);
9402             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD);
9403             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
9404             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_ENABLED);
9405             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_PRESET);
9406             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_EDGE_TYPE);
9407             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_EDGE_COLOR);
9408             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_LOCALE);
9409             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR);
9410             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR);
9411             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_TYPEFACE);
9412             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_FONT_SCALE);
9413             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_WINDOW_COLOR);
9414             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
9415             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_DALTONIZER);
9416             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_AUTOCLICK_DELAY);
9417             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_AUTOCLICK_ENABLED);
9418             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_LARGE_POINTER_ICON);
9419 
9420             INSTANT_APP_SETTINGS.add(DEFAULT_INPUT_METHOD);
9421             INSTANT_APP_SETTINGS.add(ENABLED_INPUT_METHODS);
9422 
9423             INSTANT_APP_SETTINGS.add(ANDROID_ID);
9424 
9425             INSTANT_APP_SETTINGS.add(PACKAGE_VERIFIER_USER_CONSENT);
9426             INSTANT_APP_SETTINGS.add(ALLOW_MOCK_LOCATION);
9427         }
9428 
9429         /**
9430          * Helper method for determining if a location provider is enabled.
9431          *
9432          * @param cr the content resolver to use
9433          * @param provider the location provider to query
9434          * @return true if the provider is enabled
9435          *
9436          * @deprecated use {@link LocationManager#isProviderEnabled(String)}
9437          */
9438         @Deprecated
isLocationProviderEnabled(ContentResolver cr, String provider)9439         public static boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
9440             String allowedProviders = Settings.Secure.getStringForUser(cr,
9441                     LOCATION_PROVIDERS_ALLOWED, cr.getUserId());
9442             return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
9443         }
9444 
9445         /**
9446          * Thread-safe method for enabling or disabling a single location provider. This will have
9447          * no effect on Android Q and above.
9448          * @param cr the content resolver to use
9449          * @param provider the location provider to enable or disable
9450          * @param enabled true if the provider should be enabled
9451          * @deprecated This API is deprecated
9452          */
9453         @Deprecated
setLocationProviderEnabled(ContentResolver cr, String provider, boolean enabled)9454         public static void setLocationProviderEnabled(ContentResolver cr,
9455                 String provider, boolean enabled) {
9456         }
9457     }
9458 
9459     /**
9460      * Global system settings, containing preferences that always apply identically
9461      * to all defined users.  Applications can read these but are not allowed to write;
9462      * like the "Secure" settings, these are for preferences that the user must
9463      * explicitly modify through the system UI or specialized APIs for those values.
9464      */
9465     public static final class Global extends NameValueTable {
9466         // NOTE: If you add new settings here, be sure to add them to
9467         // com.android.providers.settings.SettingsProtoDumpUtil#dumpProtoGlobalSettingsLocked.
9468 
9469         /**
9470          * The content:// style URL for global secure settings items.  Not public.
9471          */
9472         public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
9473 
9474         /**
9475          * Whether the notification bubbles are globally enabled
9476          * The value is boolean (1 or 0).
9477          * @hide
9478          */
9479         @TestApi
9480         public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
9481 
9482         private static final Validator NOTIFICATION_BUBBLES_VALIDATOR = BOOLEAN_VALIDATOR;
9483 
9484         /**
9485          * Whether users are allowed to add more users or guest from lockscreen.
9486          * <p>
9487          * Type: int
9488          * @hide
9489          */
9490         public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
9491 
9492         /**
9493          * Whether applying ramping ringer on incoming phone call ringtone.
9494          * <p>1 = apply ramping ringer
9495          * <p>0 = do not apply ramping ringer
9496          */
9497         public static final String APPLY_RAMPING_RINGER = "apply_ramping_ringer";
9498 
9499         private static final Validator APPLY_RAMPING_RINGER_VALIDATOR = BOOLEAN_VALIDATOR;
9500 
9501         /**
9502          * Setting whether the global gesture for enabling accessibility is enabled.
9503          * If this gesture is enabled the user will be able to perfrom it to enable
9504          * the accessibility state without visiting the settings app.
9505          *
9506          * @hide
9507          * No longer used. Should be removed once all dependencies have been updated.
9508          */
9509         @UnsupportedAppUsage
9510         public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
9511                 "enable_accessibility_global_gesture_enabled";
9512 
9513         /**
9514          * Whether Airplane Mode is on.
9515          */
9516         public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
9517 
9518         /**
9519          * Whether Theater Mode is on.
9520          * {@hide}
9521          */
9522         @SystemApi
9523         public static final String THEATER_MODE_ON = "theater_mode_on";
9524 
9525         /**
9526          * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
9527          */
9528         public static final String RADIO_BLUETOOTH = "bluetooth";
9529 
9530         /**
9531          * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
9532          */
9533         public static final String RADIO_WIFI = "wifi";
9534 
9535         /**
9536          * {@hide}
9537          */
9538         public static final String RADIO_WIMAX = "wimax";
9539         /**
9540          * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
9541          */
9542         public static final String RADIO_CELL = "cell";
9543 
9544         /**
9545          * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
9546          */
9547         public static final String RADIO_NFC = "nfc";
9548 
9549         /**
9550          * A comma separated list of radios that need to be disabled when airplane mode
9551          * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
9552          * included in the comma separated list.
9553          */
9554         public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
9555 
9556         /**
9557          * A comma separated list of radios that should to be disabled when airplane mode
9558          * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
9559          * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
9560          * will be turned off when entering airplane mode, but the user will be able to reenable
9561          * Wifi in the Settings app.
9562          *
9563          * {@hide}
9564          */
9565         public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
9566 
9567         /**
9568          * An integer representing the Bluetooth Class of Device (CoD).
9569          *
9570          * @hide
9571          */
9572         public static final String BLUETOOTH_CLASS_OF_DEVICE = "bluetooth_class_of_device";
9573 
9574         /**
9575          * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
9576          * See {@link android.bluetooth.BluetoothProfile}.
9577          * {@hide}
9578          */
9579         public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
9580 
9581         /**
9582          * A semi-colon separated list of Bluetooth interoperability workarounds.
9583          * Each entry is a partial Bluetooth device address string and an integer representing
9584          * the feature to be disabled, separated by a comma. The integer must correspond
9585          * to a interoperability feature as defined in "interop.h" in /system/bt.
9586          * <p>
9587          * Example: <br/>
9588          *   "00:11:22,0;01:02:03:04,2"
9589          * @hide
9590          */
9591        public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list";
9592 
9593         /**
9594          * The policy for deciding when Wi-Fi should go to sleep (which will in
9595          * turn switch to using the mobile data as an Internet connection).
9596          * <p>
9597          * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
9598          * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
9599          * {@link #WIFI_SLEEP_POLICY_NEVER}.
9600          */
9601         public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
9602 
9603         /**
9604          * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
9605          * policy, which is to sleep shortly after the turning off
9606          * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
9607          */
9608         public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
9609 
9610         /**
9611          * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
9612          * the device is on battery, and never go to sleep when the device is
9613          * plugged in.
9614          */
9615         public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
9616 
9617         /**
9618          * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
9619          */
9620         public static final int WIFI_SLEEP_POLICY_NEVER = 2;
9621 
9622         /**
9623          * Value to specify if the user prefers the date, time and time zone
9624          * to be automatically fetched from the network (NITZ). 1=yes, 0=no
9625          */
9626         public static final String AUTO_TIME = "auto_time";
9627 
9628         private static final Validator AUTO_TIME_VALIDATOR = BOOLEAN_VALIDATOR;
9629 
9630         /**
9631          * Value to specify if the user prefers the time zone
9632          * to be automatically fetched from the network (NITZ). 1=yes, 0=no
9633          */
9634         public static final String AUTO_TIME_ZONE = "auto_time_zone";
9635 
9636         private static final Validator AUTO_TIME_ZONE_VALIDATOR = BOOLEAN_VALIDATOR;
9637 
9638         /**
9639          * URI for the car dock "in" event sound.
9640          * @hide
9641          */
9642         public static final String CAR_DOCK_SOUND = "car_dock_sound";
9643 
9644         /**
9645          * URI for the car dock "out" event sound.
9646          * @hide
9647          */
9648         public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
9649 
9650         /**
9651          * URI for the desk dock "in" event sound.
9652          * @hide
9653          */
9654         public static final String DESK_DOCK_SOUND = "desk_dock_sound";
9655 
9656         /**
9657          * URI for the desk dock "out" event sound.
9658          * @hide
9659          */
9660         public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
9661 
9662         /**
9663          * Whether to play a sound for dock events.
9664          * @hide
9665          */
9666         public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
9667 
9668         private static final Validator DOCK_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
9669 
9670         /**
9671          * Whether to play a sound for dock events, only when an accessibility service is on.
9672          * @hide
9673          */
9674         public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility";
9675 
9676         /**
9677          * URI for the "device locked" (keyguard shown) sound.
9678          * @hide
9679          */
9680         public static final String LOCK_SOUND = "lock_sound";
9681 
9682         /**
9683          * URI for the "device unlocked" sound.
9684          * @hide
9685          */
9686         public static final String UNLOCK_SOUND = "unlock_sound";
9687 
9688         /**
9689          * URI for the "device is trusted" sound, which is played when the device enters the trusted
9690          * state without unlocking.
9691          * @hide
9692          */
9693         public static final String TRUSTED_SOUND = "trusted_sound";
9694 
9695         /**
9696          * URI for the low battery sound file.
9697          * @hide
9698          */
9699         public static final String LOW_BATTERY_SOUND = "low_battery_sound";
9700 
9701         /**
9702          * Whether to play a sound for low-battery alerts.
9703          * @hide
9704          */
9705         public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
9706 
9707         private static final Validator POWER_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
9708 
9709         /**
9710          * URI for the "wireless charging started" and "wired charging started" sound.
9711          * @hide
9712          */
9713         public static final String CHARGING_STARTED_SOUND =
9714                 "wireless_charging_started_sound";
9715 
9716         /**
9717          * Whether to play a sound for charging events.
9718          * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_SOUNDS_ENABLED} instead
9719          * @hide
9720          */
9721         @Deprecated
9722         public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
9723 
9724         private static final Validator CHARGING_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
9725 
9726         /**
9727          * Whether to vibrate for wireless charging events.
9728          * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_VIBRATION_ENABLED}
9729          * @hide
9730          */
9731         @Deprecated
9732         public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled";
9733 
9734         private static final Validator CHARGING_VIBRATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
9735 
9736         /**
9737          * Whether we keep the device on while the device is plugged in.
9738          * Supported values are:
9739          * <ul>
9740          * <li>{@code 0} to never stay on while plugged in</li>
9741          * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
9742          * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
9743          * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
9744          * </ul>
9745          * These values can be OR-ed together.
9746          */
9747         public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
9748 
9749         private static final Validator STAY_ON_WHILE_PLUGGED_IN_VALIDATOR = new Validator() {
9750             @Override
9751             public boolean validate(@Nullable String value) {
9752                 try {
9753                     int val = Integer.parseInt(value);
9754                     return (val == 0)
9755                             || (val == BatteryManager.BATTERY_PLUGGED_AC)
9756                             || (val == BatteryManager.BATTERY_PLUGGED_USB)
9757                             || (val == BatteryManager.BATTERY_PLUGGED_WIRELESS)
9758                             || (val == (BatteryManager.BATTERY_PLUGGED_AC
9759                                     | BatteryManager.BATTERY_PLUGGED_USB))
9760                             || (val == (BatteryManager.BATTERY_PLUGGED_AC
9761                                     | BatteryManager.BATTERY_PLUGGED_WIRELESS))
9762                             || (val == (BatteryManager.BATTERY_PLUGGED_USB
9763                                     | BatteryManager.BATTERY_PLUGGED_WIRELESS))
9764                             || (val == (BatteryManager.BATTERY_PLUGGED_AC
9765                                     | BatteryManager.BATTERY_PLUGGED_USB
9766                                     | BatteryManager.BATTERY_PLUGGED_WIRELESS));
9767                 } catch (NumberFormatException e) {
9768                     return false;
9769                 }
9770             }
9771         };
9772 
9773         /**
9774          * When the user has enable the option to have a "bug report" command
9775          * in the power menu.
9776          * @hide
9777          */
9778         public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
9779 
9780         private static final Validator BUGREPORT_IN_POWER_MENU_VALIDATOR = BOOLEAN_VALIDATOR;
9781 
9782         /**
9783          * Whether ADB over USB is enabled.
9784          */
9785         public static final String ADB_ENABLED = "adb_enabled";
9786 
9787         /**
9788          * Whether ADB over Wifi is enabled.
9789          * @hide
9790          */
9791         public static final String ADB_WIFI_ENABLED = "adb_wifi_enabled";
9792 
9793         /**
9794          * Whether Views are allowed to save their attribute data.
9795          * @hide
9796          */
9797         public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
9798 
9799         /**
9800          * Which application package is allowed to save View attribute data.
9801          * @hide
9802          */
9803         public static final String DEBUG_VIEW_ATTRIBUTES_APPLICATION_PACKAGE =
9804                 "debug_view_attributes_application_package";
9805 
9806         /**
9807          * Whether assisted GPS should be enabled or not.
9808          * @hide
9809          */
9810         public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
9811 
9812         /**
9813          * Whether bluetooth is enabled/disabled
9814          * 0=disabled. 1=enabled.
9815          */
9816         public static final String BLUETOOTH_ON = "bluetooth_on";
9817 
9818         private static final Validator BLUETOOTH_ON_VALIDATOR = BOOLEAN_VALIDATOR;
9819 
9820         /**
9821          * CDMA Cell Broadcast SMS
9822          *                            0 = CDMA Cell Broadcast SMS disabled
9823          *                            1 = CDMA Cell Broadcast SMS enabled
9824          * @hide
9825          */
9826         public static final String CDMA_CELL_BROADCAST_SMS =
9827                 "cdma_cell_broadcast_sms";
9828 
9829         /**
9830          * The CDMA roaming mode 0 = Home Networks, CDMA default
9831          *                       1 = Roaming on Affiliated networks
9832          *                       2 = Roaming on any networks
9833          * @hide
9834          */
9835         public static final String CDMA_ROAMING_MODE = "roaming_settings";
9836 
9837         /**
9838          * The CDMA subscription mode 0 = RUIM/SIM (default)
9839          *                                1 = NV
9840          * @hide
9841          */
9842         public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
9843 
9844         /**
9845          * The default value for whether background data is enabled or not.
9846          *
9847          * Used by {@code NetworkPolicyManagerService}.
9848          *
9849          * @hide
9850          */
9851         public static final String DEFAULT_RESTRICT_BACKGROUND_DATA =
9852                 "default_restrict_background_data";
9853 
9854         /** Inactivity timeout to track mobile data activity.
9855         *
9856         * If set to a positive integer, it indicates the inactivity timeout value in seconds to
9857         * infer the data activity of mobile network. After a period of no activity on mobile
9858         * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
9859         * intent is fired to indicate a transition of network status from "active" to "idle". Any
9860         * subsequent activity on mobile networks triggers the firing of {@code
9861         * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
9862         *
9863         * Network activity refers to transmitting or receiving data on the network interfaces.
9864         *
9865         * Tracking is disabled if set to zero or negative value.
9866         *
9867         * @hide
9868         */
9869        public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
9870 
9871        /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
9872         * but for Wifi network.
9873         * @hide
9874         */
9875        public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
9876 
9877        /**
9878         * Whether or not data roaming is enabled. (0 = false, 1 = true)
9879         */
9880        public static final String DATA_ROAMING = "data_roaming";
9881 
9882        /**
9883         * The value passed to a Mobile DataConnection via bringUp which defines the
9884         * number of retries to preform when setting up the initial connection. The default
9885         * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
9886         * @hide
9887         */
9888        public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
9889 
9890        /**
9891         * Whether any package can be on external storage. When this is true, any
9892         * package, regardless of manifest values, is a candidate for installing
9893         * or moving onto external storage. (0 = false, 1 = true)
9894         * @hide
9895         */
9896        public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
9897 
9898         /**
9899          * The default SM-DP+ configured for this device.
9900          *
9901          * <p>An SM-DP+ is used by an LPA (see {@link android.service.euicc.EuiccService}) to
9902          * download profiles. If this value is set, the LPA will query this server for any profiles
9903          * available to this device. If any are available, they may be downloaded during device
9904          * provisioning or in settings without needing the user to enter an activation code.
9905          *
9906          * @see android.service.euicc.EuiccService
9907          * @hide
9908          */
9909         @SystemApi
9910         public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
9911 
9912         /**
9913          * Whether any profile has ever been downloaded onto a eUICC on the device.
9914          *
9915          * <p>Used to hide eUICC UI from users who have never made use of it and would only be
9916          * confused by seeing references to it in settings.
9917          * (0 = false, 1 = true)
9918          * @hide
9919          */
9920         @SystemApi
9921         public static final String EUICC_PROVISIONED = "euicc_provisioned";
9922 
9923         /**
9924          * List of ISO country codes in which eUICC UI is shown. Country codes should be separated
9925          * by comma.
9926          *
9927          * Note: if {@link #EUICC_SUPPORTED_COUNTRIES} is empty, then {@link
9928          * #EUICC_UNSUPPORTED_COUNTRIES} is used.
9929          *
9930          * <p>Used to hide eUICC UI from users who are currently in countries where no carriers
9931          * support eUICC.
9932          *
9933          * @hide
9934          */
9935         //TODO(b/77914569) Changes this to System Api.
9936         public static final String EUICC_SUPPORTED_COUNTRIES = "euicc_supported_countries";
9937 
9938         /**
9939          * List of ISO country codes in which eUICC UI is not shown. Country codes should be
9940          * separated by comma.
9941          *
9942          * Note: if {@link #EUICC_SUPPORTED_COUNTRIES} is empty, then {@link
9943          * #EUICC_UNSUPPORTED_COUNTRIES} is used.
9944          *
9945          * <p>Used to hide eUICC UI from users who are currently in countries where no carriers
9946          * support eUICC.
9947          *
9948          * @hide
9949          */
9950         //TODO(b/77914569) Changes this to System Api.
9951         public static final String EUICC_UNSUPPORTED_COUNTRIES = "euicc_unsupported_countries";
9952         private static final Validator EUICC_UNSUPPORTED_COUNTRIES_VALIDATOR =
9953                 new SettingsValidators.ComponentNameListValidator(",");
9954 
9955         /**
9956          * Whether any activity can be resized. When this is true, any
9957          * activity, regardless of manifest values, can be resized for multi-window.
9958          * (0 = false, 1 = true)
9959          * @hide
9960          */
9961         public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
9962                 = "force_resizable_activities";
9963 
9964         /**
9965          * Whether to enable experimental freeform support for windows.
9966          * @hide
9967          */
9968         public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
9969                 = "enable_freeform_support";
9970 
9971         /**
9972          * Whether to enable experimental desktop mode on secondary displays.
9973          * @hide
9974          */
9975         public static final String DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS =
9976                 "force_desktop_mode_on_external_displays";
9977 
9978        /**
9979         * Whether user has enabled development settings.
9980         */
9981        public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
9982 
9983        /**
9984         * Whether the device has been provisioned (0 = false, 1 = true).
9985         * <p>On a multiuser device with a separate system user, the screen may be locked
9986         * as soon as this is set to true and further activities cannot be launched on the
9987         * system user unless they are marked to show over keyguard.
9988         */
9989        public static final String DEVICE_PROVISIONED = "device_provisioned";
9990 
9991         /**
9992          * Indicates whether mobile data should be allowed while the device is being provisioned.
9993          * This allows the provisioning process to turn off mobile data before the user
9994          * has an opportunity to set things up, preventing other processes from burning
9995          * precious bytes before wifi is setup.
9996          * <p>
9997          * Type: int (0 for false, 1 for true)
9998          *
9999          * @hide
10000          */
10001         @SystemApi
10002         public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED =
10003                 "device_provisioning_mobile_data";
10004 
10005        /**
10006         * The saved value for WindowManagerService.setForcedDisplaySize().
10007         * Two integers separated by a comma.  If unset, then use the real display size.
10008         * @hide
10009         */
10010        public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
10011 
10012        /**
10013         * The saved value for WindowManagerService.setForcedDisplayScalingMode().
10014         * 0 or unset if scaling is automatic, 1 if scaling is disabled.
10015         * @hide
10016         */
10017        public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
10018 
10019        /**
10020         * The maximum size, in bytes, of a download that the download manager will transfer over
10021         * a non-wifi connection.
10022         * @hide
10023         */
10024        public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
10025                "download_manager_max_bytes_over_mobile";
10026 
10027        /**
10028         * The recommended maximum size, in bytes, of a download that the download manager should
10029         * transfer over a non-wifi connection. Over this size, the use will be warned, but will
10030         * have the option to start the download over the mobile connection anyway.
10031         * @hide
10032         */
10033        public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
10034                "download_manager_recommended_max_bytes_over_mobile";
10035 
10036        /**
10037         * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
10038         */
10039        @Deprecated
10040        public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
10041 
10042        /**
10043         * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
10044         * sent or processed. (0 = false, 1 = true)
10045         * @hide
10046         */
10047        public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
10048 
10049        /**
10050         * Whether HDMI System Audio Control feature is enabled. If enabled, TV will try to turn on
10051         * system audio mode if there's a connected CEC-enabled AV Receiver. Then audio stream will
10052         * be played on AVR instead of TV spaeker. If disabled, the system audio mode will never be
10053         * activated.
10054         * @hide
10055         */
10056         public static final String HDMI_SYSTEM_AUDIO_CONTROL_ENABLED =
10057                 "hdmi_system_audio_control_enabled";
10058 
10059         /**
10060          * Whether HDMI Routing Control feature is enabled. If enabled, the switch device will
10061          * route to the correct input source on receiving Routing Control related messages. If
10062          * disabled, you can only switch the input via controls on this device.
10063          * @hide
10064          */
10065         public static final String HDMI_CEC_SWITCH_ENABLED =
10066                 "hdmi_cec_switch_enabled";
10067 
10068         /**
10069          * Whether TV will automatically turn on upon reception of the CEC command
10070          * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
10071          *
10072          * @hide
10073          */
10074         public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
10075                 "hdmi_control_auto_wakeup_enabled";
10076 
10077         /**
10078          * Whether TV will also turn off other CEC devices when it goes to standby mode.
10079          * (0 = false, 1 = true)
10080          *
10081          * @hide
10082          */
10083         public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
10084                 "hdmi_control_auto_device_off_enabled";
10085 
10086         /**
10087          * The interval in milliseconds at which location requests will be throttled when they are
10088          * coming from the background.
10089          *
10090          * @hide
10091          */
10092         public static final String LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS =
10093                 "location_background_throttle_interval_ms";
10094 
10095         /**
10096          * Most frequent location update interval in milliseconds that proximity alert is allowed
10097          * to request.
10098          * @hide
10099          */
10100         public static final String LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS =
10101                 "location_background_throttle_proximity_alert_interval_ms";
10102 
10103         /**
10104          * Packages that are whitelisted for background throttling (throttling will not be applied).
10105          * @hide
10106          */
10107         public static final String LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
10108             "location_background_throttle_package_whitelist";
10109 
10110         /**
10111          * Packages that are whitelisted for ignoring location settings (may retrieve location even
10112          * when user location settings are off), for emergency purposes.
10113          * @hide
10114          */
10115         @TestApi
10116         public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST =
10117                 "location_ignore_settings_package_whitelist";
10118 
10119         /**
10120          * Whether to disable location status callbacks in preparation for deprecation.
10121          * @hide
10122          */
10123         public static final String LOCATION_DISABLE_STATUS_CALLBACKS =
10124                 "location_disable_status_callbacks";
10125 
10126         /**
10127          * Maximum staleness allowed for last location when returned to clients with only foreground
10128          * location permissions.
10129          * @hide
10130          */
10131         public static final String LOCATION_LAST_LOCATION_MAX_AGE_MILLIS =
10132                 "location_last_location_max_age_millis";
10133 
10134         /**
10135         * Whether TV will switch to MHL port when a mobile device is plugged in.
10136         * (0 = false, 1 = true)
10137         * @hide
10138         */
10139        public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
10140 
10141        /**
10142         * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
10143         * @hide
10144         */
10145        public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
10146 
10147        /**
10148         * Whether mobile data connections are allowed by the user.  See
10149         * ConnectivityManager for more info.
10150         * @hide
10151         */
10152        @UnsupportedAppUsage
10153        public static final String MOBILE_DATA = "mobile_data";
10154 
10155        /**
10156         * Whether the mobile data connection should remain active even when higher
10157         * priority networks like WiFi are active, to help make network switching faster.
10158         *
10159         * See ConnectivityService for more info.
10160         *
10161         * (0 = disabled, 1 = enabled)
10162         * @hide
10163         */
10164        public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
10165 
10166         /**
10167          * Whether the wifi data connection should remain active even when higher
10168          * priority networks like Ethernet are active, to keep both networks.
10169          * In the case where higher priority networks are connected, wifi will be
10170          * unused unless an application explicitly requests to use it.
10171          *
10172          * See ConnectivityService for more info.
10173          *
10174          * (0 = disabled, 1 = enabled)
10175          * @hide
10176          */
10177         public static final String WIFI_ALWAYS_REQUESTED = "wifi_always_requested";
10178 
10179         /**
10180          * Size of the event buffer for IP connectivity metrics.
10181          * @hide
10182          */
10183         public static final String CONNECTIVITY_METRICS_BUFFER_SIZE =
10184               "connectivity_metrics_buffer_size";
10185 
10186        /** {@hide} */
10187        public static final String NETSTATS_ENABLED = "netstats_enabled";
10188        /** {@hide} */
10189        public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
10190        /** {@hide} */
10191        @Deprecated
10192        public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
10193        /** {@hide} */
10194        public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
10195        /** {@hide} */
10196        public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
10197        /** {@hide} */
10198        public static final String NETSTATS_AUGMENT_ENABLED = "netstats_augment_enabled";
10199        /** {@hide} */
10200        public static final String NETSTATS_COMBINE_SUBTYPE_ENABLED = "netstats_combine_subtype_enabled";
10201 
10202        /** {@hide} */
10203        public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
10204        /** {@hide} */
10205        public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
10206        /** {@hide} */
10207        public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
10208        /** {@hide} */
10209        public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
10210 
10211        /** {@hide} */
10212        public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
10213        /** {@hide} */
10214        public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
10215        /** {@hide} */
10216        public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
10217        /** {@hide} */
10218        public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
10219 
10220        /** {@hide} */
10221        public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
10222        /** {@hide} */
10223        public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
10224        /** {@hide} */
10225        public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
10226        /** {@hide} */
10227        public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
10228 
10229        /** {@hide} */
10230        public static final String NETPOLICY_QUOTA_ENABLED = "netpolicy_quota_enabled";
10231        /** {@hide} */
10232        public static final String NETPOLICY_QUOTA_UNLIMITED = "netpolicy_quota_unlimited";
10233        /** {@hide} */
10234        public static final String NETPOLICY_QUOTA_LIMITED = "netpolicy_quota_limited";
10235        /** {@hide} */
10236        public static final String NETPOLICY_QUOTA_FRAC_JOBS = "netpolicy_quota_frac_jobs";
10237        /** {@hide} */
10238        public static final String NETPOLICY_QUOTA_FRAC_MULTIPATH = "netpolicy_quota_frac_multipath";
10239 
10240        /** {@hide} */
10241        public static final String NETPOLICY_OVERRIDE_ENABLED = "netpolicy_override_enabled";
10242 
10243        /**
10244         * User preference for which network(s) should be used. Only the
10245         * connectivity service should touch this.
10246         */
10247        public static final String NETWORK_PREFERENCE = "network_preference";
10248 
10249        /**
10250         * Which package name to use for network scoring. If null, or if the package is not a valid
10251         * scorer app, external network scores will neither be requested nor accepted.
10252         * @hide
10253         */
10254        @UnsupportedAppUsage
10255        public static final String NETWORK_SCORER_APP = "network_scorer_app";
10256 
10257         /**
10258          * Whether night display forced auto mode is available.
10259          * 0 = unavailable, 1 = available.
10260          * @hide
10261          */
10262         public static final String NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE =
10263                 "night_display_forced_auto_mode_available";
10264 
10265        /**
10266         * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
10267         * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
10268         * exceeded.
10269         * @hide
10270         */
10271        public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
10272 
10273        /**
10274         * The length of time in milli-seconds that automatic small adjustments to
10275         * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
10276         * @hide
10277         */
10278        public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
10279 
10280        /** Preferred NTP server. {@hide} */
10281        public static final String NTP_SERVER = "ntp_server";
10282        /** Timeout in milliseconds to wait for NTP server. {@hide} */
10283        public static final String NTP_TIMEOUT = "ntp_timeout";
10284 
10285        /** {@hide} */
10286        public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
10287 
10288         /**
10289          * Whether or not Settings should enable psd API.
10290          * {@hide}
10291          */
10292         public static final String SETTINGS_USE_PSD_API = "settings_use_psd_api";
10293 
10294         /**
10295          * Whether or not Settings should enable external provider API.
10296          * {@hide}
10297          */
10298         public static final String SETTINGS_USE_EXTERNAL_PROVIDER_API =
10299                 "settings_use_external_provider_api";
10300 
10301        /**
10302         * Sample validity in seconds to configure for the system DNS resolver.
10303         * {@hide}
10304         */
10305        public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS =
10306                "dns_resolver_sample_validity_seconds";
10307 
10308        /**
10309         * Success threshold in percent for use with the system DNS resolver.
10310         * {@hide}
10311         */
10312        public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT =
10313                 "dns_resolver_success_threshold_percent";
10314 
10315        /**
10316         * Minimum number of samples needed for statistics to be considered meaningful in the
10317         * system DNS resolver.
10318         * {@hide}
10319         */
10320        public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples";
10321 
10322        /**
10323         * Maximum number taken into account for statistics purposes in the system DNS resolver.
10324         * {@hide}
10325         */
10326        public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples";
10327 
10328        /**
10329         * Whether to disable the automatic scheduling of system updates.
10330         * 1 = system updates won't be automatically scheduled (will always
10331         * present notification instead).
10332         * 0 = system updates will be automatically scheduled. (default)
10333         * @hide
10334         */
10335        @SystemApi
10336        public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
10337 
10338        /**
10339         * Whether the package manager should send package verification broadcasts for verifiers to
10340         * review apps prior to installation.
10341         * 1 = request apps to be verified prior to installation, if a verifier exists.
10342         * 0 = do not verify apps before installation
10343         * @hide
10344         */
10345        @UnsupportedAppUsage
10346        public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
10347 
10348        /** Timeout for package verification.
10349         * @hide */
10350        public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
10351 
10352        /** Default response code for package verification.
10353         * @hide */
10354        public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
10355 
10356        /**
10357         * Show package verification setting in the Settings app.
10358         * 1 = show (default)
10359         * 0 = hide
10360         * @hide
10361         */
10362        public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
10363 
10364        /**
10365         * Run package verification on apps installed through ADB/ADT/USB
10366         * 1 = perform package verification on ADB installs (default)
10367         * 0 = bypass package verification on ADB installs
10368         * @hide
10369         */
10370        public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
10371 
10372        /**
10373         * Time since last fstrim (milliseconds) after which we force one to happen
10374         * during device startup.  If unset, the default is 3 days.
10375         * @hide
10376         */
10377        public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
10378 
10379        /**
10380         * The interval in milliseconds at which to check packet counts on the
10381         * mobile data interface when screen is on, to detect possible data
10382         * connection problems.
10383         * @hide
10384         */
10385        public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
10386                "pdp_watchdog_poll_interval_ms";
10387 
10388        /**
10389         * The interval in milliseconds at which to check packet counts on the
10390         * mobile data interface when screen is off, to detect possible data
10391         * connection problems.
10392         * @hide
10393         */
10394        public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
10395                "pdp_watchdog_long_poll_interval_ms";
10396 
10397        /**
10398         * The interval in milliseconds at which to check packet counts on the
10399         * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
10400         * outgoing packets has been reached without incoming packets.
10401         * @hide
10402         */
10403        public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
10404                "pdp_watchdog_error_poll_interval_ms";
10405 
10406        /**
10407         * The number of outgoing packets sent without seeing an incoming packet
10408         * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
10409         * device is logged to the event log
10410         * @hide
10411         */
10412        public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
10413                "pdp_watchdog_trigger_packet_count";
10414 
10415        /**
10416         * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
10417         * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
10418         * attempting data connection recovery.
10419         * @hide
10420         */
10421        public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
10422                "pdp_watchdog_error_poll_count";
10423 
10424        /**
10425         * The number of failed PDP reset attempts before moving to something more
10426         * drastic: re-registering to the network.
10427         * @hide
10428         */
10429        public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
10430                "pdp_watchdog_max_pdp_reset_fail_count";
10431 
10432        /**
10433         * URL to open browser on to allow user to manage a prepay account
10434         * @hide
10435         */
10436        public static final String SETUP_PREPAID_DATA_SERVICE_URL =
10437                "setup_prepaid_data_service_url";
10438 
10439        /**
10440         * URL to attempt a GET on to see if this is a prepay device
10441         * @hide
10442         */
10443        public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
10444                "setup_prepaid_detection_target_url";
10445 
10446        /**
10447         * Host to check for a redirect to after an attempt to GET
10448         * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
10449         * this is a prepaid device with zero balance.)
10450         * @hide
10451         */
10452        public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
10453                "setup_prepaid_detection_redir_host";
10454 
10455        /**
10456         * The interval in milliseconds at which to check the number of SMS sent out without asking
10457         * for use permit, to limit the un-authorized SMS usage.
10458         *
10459         * @hide
10460         */
10461        public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
10462                "sms_outgoing_check_interval_ms";
10463 
10464        /**
10465         * The number of outgoing SMS sent without asking for user permit (of {@link
10466         * #SMS_OUTGOING_CHECK_INTERVAL_MS}
10467         *
10468         * @hide
10469         */
10470        public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
10471                "sms_outgoing_check_max_count";
10472 
10473        /**
10474         * Used to disable SMS short code confirmation - defaults to true.
10475         * True indcates we will do the check, etc.  Set to false to disable.
10476         * @see com.android.internal.telephony.SmsUsageMonitor
10477         * @hide
10478         */
10479        public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
10480 
10481         /**
10482          * Used to select which country we use to determine premium sms codes.
10483          * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
10484          * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
10485          * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
10486          * @hide
10487          */
10488         public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
10489 
10490         /**
10491          * Used to select TCP's default initial receiver window size in segments - defaults to a
10492          * build config value.
10493          * @hide
10494          */
10495         public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
10496 
10497         /**
10498          * Used to disable Tethering on a device - defaults to true.
10499          * @hide
10500          */
10501         @SystemApi
10502         public static final String TETHER_SUPPORTED = "tether_supported";
10503 
10504         /**
10505          * Used to require DUN APN on the device or not - defaults to a build config value
10506          * which defaults to false.
10507          * @hide
10508          */
10509         public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
10510 
10511         /**
10512          * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
10513          * corresponding build config values are set it will override the APN DB
10514          * values.
10515          * Consists of a comma separated list of strings:
10516          * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
10517          * note that empty fields can be omitted: "name,apn,,,,,,,,,310,260,,DUN"
10518          * @hide
10519          */
10520         public static final String TETHER_DUN_APN = "tether_dun_apn";
10521 
10522         /**
10523          * Used to disable trying to talk to any available tethering offload HAL.
10524          *
10525          * Integer values are interpreted as boolean, and the absence of an explicit setting
10526          * is interpreted as |false|.
10527          * @hide
10528          */
10529         @SystemApi
10530         @TestApi
10531         public static final String TETHER_OFFLOAD_DISABLED = "tether_offload_disabled";
10532 
10533         /**
10534          * Use the old dnsmasq DHCP server for tethering instead of the framework implementation.
10535          *
10536          * Integer values are interpreted as boolean, and the absence of an explicit setting
10537          * is interpreted as |false|.
10538          * @hide
10539          */
10540         public static final String TETHER_ENABLE_LEGACY_DHCP_SERVER =
10541                 "tether_enable_legacy_dhcp_server";
10542 
10543         /**
10544          * List of certificate (hex string representation of the application's certificate - SHA-1
10545          * or SHA-256) and carrier app package pairs which are whitelisted to prompt the user for
10546          * install when a sim card with matching UICC carrier privilege rules is inserted.  The
10547          * certificate is used as a key, so the certificate encoding here must be the same as the
10548          * certificate encoding used on the SIM.
10549          *
10550          * The value is "cert1:package1;cert2:package2;..."
10551          * @hide
10552          */
10553         @SystemApi
10554         public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
10555 
10556         /**
10557          * Map of package name to application names. The application names cannot and will not be
10558          * localized. App names may not contain colons or semicolons.
10559          *
10560          * The value is "packageName1:appName1;packageName2:appName2;..."
10561          * @hide
10562          */
10563         @SystemApi
10564         public static final String CARRIER_APP_NAMES = "carrier_app_names";
10565 
10566        /**
10567         * USB Mass Storage Enabled
10568         */
10569        public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
10570 
10571        private static final Validator USB_MASS_STORAGE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
10572 
10573        /**
10574         * If this setting is set (to anything), then all references
10575         * to Gmail on the device must change to Google Mail.
10576         */
10577        public static final String USE_GOOGLE_MAIL = "use_google_mail";
10578 
10579         /**
10580          * Whether or not switching/creating users is enabled by user.
10581          * @hide
10582          */
10583         public static final String USER_SWITCHER_ENABLED = "user_switcher_enabled";
10584 
10585         /**
10586          * Webview Data reduction proxy key.
10587          * @hide
10588          */
10589         public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
10590                 "webview_data_reduction_proxy_key";
10591 
10592        /**
10593         * Whether or not the WebView fallback mechanism should be enabled.
10594         * 0=disabled, 1=enabled.
10595         * @hide
10596         */
10597        public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED =
10598                "webview_fallback_logic_enabled";
10599 
10600        /**
10601         * Name of the package used as WebView provider (if unset the provider is instead determined
10602         * by the system).
10603         * @hide
10604         */
10605        @UnsupportedAppUsage
10606        public static final String WEBVIEW_PROVIDER = "webview_provider";
10607 
10608        /**
10609         * Developer setting to enable WebView multiprocess rendering.
10610         * @hide
10611         */
10612        @SystemApi
10613        public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
10614 
10615        /**
10616         * The maximum number of notifications shown in 24 hours when switching networks.
10617         * @hide
10618         */
10619        public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT =
10620               "network_switch_notification_daily_limit";
10621 
10622        /**
10623         * The minimum time in milliseconds between notifications when switching networks.
10624         * @hide
10625         */
10626        public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS =
10627               "network_switch_notification_rate_limit_millis";
10628 
10629        /**
10630         * Whether to automatically switch away from wifi networks that lose Internet access.
10631         * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always
10632         * avoids such networks. Valid values are:
10633         *
10634         * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013.
10635         * null: Ask the user whether to switch away from bad wifi.
10636         * 1: Avoid bad wifi.
10637         *
10638         * @hide
10639         */
10640        public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi";
10641 
10642        /**
10643         * User setting for ConnectivityManager.getMeteredMultipathPreference(). This value may be
10644         * overridden by the system based on device or application state. If null, the value
10645         * specified by config_networkMeteredMultipathPreference is used.
10646         *
10647         * @hide
10648         */
10649        public static final String NETWORK_METERED_MULTIPATH_PREFERENCE =
10650                "network_metered_multipath_preference";
10651 
10652         /**
10653          * Default daily multipath budget used by ConnectivityManager.getMultipathPreference()
10654          * on metered networks. This default quota is only used if quota could not be determined
10655          * from data plan or data limit/warning set by the user.
10656          * @hide
10657          */
10658         public static final String NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES =
10659                 "network_default_daily_multipath_quota_bytes";
10660 
10661         /**
10662          * Network watchlist last report time.
10663          * @hide
10664          */
10665         public static final String NETWORK_WATCHLIST_LAST_REPORT_TIME =
10666                 "network_watchlist_last_report_time";
10667 
10668        /**
10669         * The thresholds of the wifi throughput badging (SD, HD etc.) as a comma-delimited list of
10670         * colon-delimited key-value pairs. The key is the badging enum value defined in
10671         * android.net.ScoredNetwork and the value is the minimum sustained network throughput in
10672         * kbps required for the badge. For example: "10:3000,20:5000,30:25000"
10673         *
10674         * @hide
10675         */
10676        @SystemApi
10677        public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
10678 
10679        /**
10680         * Whether Wifi display is enabled/disabled
10681         * 0=disabled. 1=enabled.
10682         * @hide
10683         */
10684        public static final String WIFI_DISPLAY_ON = "wifi_display_on";
10685 
10686        /**
10687         * Whether Wifi display certification mode is enabled/disabled
10688         * 0=disabled. 1=enabled.
10689         * @hide
10690         */
10691        public static final String WIFI_DISPLAY_CERTIFICATION_ON =
10692                "wifi_display_certification_on";
10693 
10694        /**
10695         * WPS Configuration method used by Wifi display, this setting only
10696         * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
10697         *
10698         * Possible values are:
10699         *
10700         * WpsInfo.INVALID: use default WPS method chosen by framework
10701         * WpsInfo.PBC    : use Push button
10702         * WpsInfo.KEYPAD : use Keypad
10703         * WpsInfo.DISPLAY: use Display
10704         * @hide
10705         */
10706        public static final String WIFI_DISPLAY_WPS_CONFIG =
10707            "wifi_display_wps_config";
10708 
10709        /**
10710         * Whether to notify the user of open networks.
10711         * <p>
10712         * If not connected and the scan results have an open network, we will
10713         * put this notification up. If we attempt to connect to a network or
10714         * the open network(s) disappear, we remove the notification. When we
10715         * show the notification, we will not show it again for
10716         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
10717         *
10718         * @deprecated This feature is no longer controlled by this setting in
10719         * {@link android.os.Build.VERSION_CODES#O}.
10720         */
10721        @Deprecated
10722        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
10723                "wifi_networks_available_notification_on";
10724 
10725        private static final Validator WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR =
10726                BOOLEAN_VALIDATOR;
10727 
10728        /**
10729         * Whether to notify the user of carrier networks.
10730         * <p>
10731         * If not connected and the scan results have a carrier network, we will
10732         * put this notification up. If we attempt to connect to a network or
10733         * the carrier network(s) disappear, we remove the notification. When we
10734         * show the notification, we will not show it again for
10735         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
10736         * @hide
10737         */
10738        public static final String WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON =
10739                "wifi_carrier_networks_available_notification_on";
10740 
10741        private static final Validator WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR =
10742                BOOLEAN_VALIDATOR;
10743 
10744        /**
10745         * {@hide}
10746         */
10747        public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
10748                "wimax_networks_available_notification_on";
10749 
10750        /**
10751         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
10752         * Connecting to a network will reset the timer.
10753         */
10754        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
10755                "wifi_networks_available_repeat_delay";
10756 
10757        private static final Validator WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY_VALIDATOR =
10758                NON_NEGATIVE_INTEGER_VALIDATOR;
10759 
10760        /**
10761         * 802.11 country code in ISO 3166 format
10762         * @hide
10763         */
10764        public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
10765 
10766        /**
10767         * The interval in milliseconds to issue wake up scans when wifi needs
10768         * to connect. This is necessary to connect to an access point when
10769         * device is on the move and the screen is off.
10770         * @hide
10771         */
10772        public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
10773                "wifi_framework_scan_interval_ms";
10774 
10775        /**
10776         * The interval in milliseconds after which Wi-Fi is considered idle.
10777         * When idle, it is possible for the device to be switched from Wi-Fi to
10778         * the mobile data network.
10779         * @hide
10780         */
10781        public static final String WIFI_IDLE_MS = "wifi_idle_ms";
10782 
10783        /**
10784         * When the number of open networks exceeds this number, the
10785         * least-recently-used excess networks will be removed.
10786         */
10787        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
10788 
10789        private static final Validator WIFI_NUM_OPEN_NETWORKS_KEPT_VALIDATOR =
10790                NON_NEGATIVE_INTEGER_VALIDATOR;
10791 
10792        /**
10793         * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
10794         */
10795        public static final String WIFI_ON = "wifi_on";
10796 
10797        /**
10798         * Setting to allow scans to be enabled even wifi is turned off for connectivity.
10799         * @hide
10800         */
10801        public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
10802                 "wifi_scan_always_enabled";
10803 
10804         /**
10805          * The interval in milliseconds at which wifi rtt ranging requests will be throttled when
10806          * they are coming from the background.
10807          *
10808          * @hide
10809          */
10810         public static final String WIFI_RTT_BACKGROUND_EXEC_GAP_MS =
10811                 "wifi_rtt_background_exec_gap_ms";
10812 
10813         /**
10814          * Indicate whether factory reset request is pending.
10815          *
10816          * Type: int (0 for false, 1 for true)
10817          * @hide
10818          */
10819         public static final String WIFI_P2P_PENDING_FACTORY_RESET =
10820                 "wifi_p2p_pending_factory_reset";
10821 
10822         /**
10823          * Whether soft AP will shut down after a timeout period when no devices are connected.
10824          *
10825          * Type: int (0 for false, 1 for true)
10826          * @hide
10827          */
10828         public static final String SOFT_AP_TIMEOUT_ENABLED = "soft_ap_timeout_enabled";
10829 
10830         private static final Validator SOFT_AP_TIMEOUT_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
10831 
10832         /**
10833          * Value to specify if Wi-Fi Wakeup feature is enabled.
10834          *
10835          * Type: int (0 for false, 1 for true)
10836          * @hide
10837          */
10838         @SystemApi
10839         public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
10840 
10841         private static final Validator WIFI_WAKEUP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
10842 
10843         /**
10844          * Value to specify whether network quality scores and badging should be shown in the UI.
10845          *
10846          * Type: int (0 for false, 1 for true)
10847          * @hide
10848          */
10849         public static final String NETWORK_SCORING_UI_ENABLED = "network_scoring_ui_enabled";
10850 
10851         /**
10852          * Value to specify how long in milliseconds to retain seen score cache curves to be used
10853          * when generating SSID only bases score curves.
10854          *
10855          * Type: long
10856          * @hide
10857          */
10858         public static final String SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS =
10859                 "speed_label_cache_eviction_age_millis";
10860 
10861         /**
10862          * Value to specify if network recommendations from
10863          * {@link com.android.server.NetworkScoreService} are enabled.
10864          *
10865          * Type: int
10866          * Valid values:
10867          *   -1 = Forced off
10868          *    0 = Disabled
10869          *    1 = Enabled
10870          *
10871          * Most readers of this setting should simply check if value == 1 to determined the
10872          * enabled state.
10873          * @hide
10874          */
10875         public static final String NETWORK_RECOMMENDATIONS_ENABLED =
10876                 "network_recommendations_enabled";
10877 
10878         private static final Validator NETWORK_RECOMMENDATIONS_ENABLED_VALIDATOR =
10879                 new SettingsValidators.DiscreteValueValidator(new String[] {"-1", "0", "1"});
10880 
10881         /**
10882          * Which package name to use for network recommendations. If null, network recommendations
10883          * will neither be requested nor accepted.
10884          *
10885          * Use {@link NetworkScoreManager#getActiveScorerPackage()} to read this value and
10886          * {@link NetworkScoreManager#setActiveScorer(String)} to write it.
10887          *
10888          * Type: string - package name
10889          * @hide
10890          */
10891         public static final String NETWORK_RECOMMENDATIONS_PACKAGE =
10892                 "network_recommendations_package";
10893 
10894         /**
10895          * The package name of the application that connect and secures high quality open wifi
10896          * networks automatically.
10897          *
10898          * Type: string package name or null if the feature is either not provided or disabled.
10899          * @hide
10900          */
10901         @TestApi
10902         public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
10903 
10904         private static final Validator USE_OPEN_WIFI_PACKAGE_VALIDATOR = new Validator() {
10905             @Override
10906             public boolean validate(@Nullable String value) {
10907                 return (value == null) || PACKAGE_NAME_VALIDATOR.validate(value);
10908             }
10909         };
10910 
10911         /**
10912          * The number of milliseconds the {@link com.android.server.NetworkScoreService}
10913          * will give a recommendation request to complete before returning a default response.
10914          *
10915          * Type: long
10916          * @hide
10917          * @deprecated to be removed
10918          */
10919         public static final String NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS =
10920                 "network_recommendation_request_timeout_ms";
10921 
10922         /**
10923          * The expiration time in milliseconds for the {@link android.net.WifiKey} request cache in
10924          * {@link com.android.server.wifi.RecommendedNetworkEvaluator}.
10925          *
10926          * Type: long
10927          * @hide
10928          */
10929         public static final String RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS =
10930                 "recommended_network_evaluator_cache_expiry_ms";
10931 
10932         /**
10933          * Whether wifi scan throttle is enabled or not.
10934          * This is intended to be used via adb commands or a menu in developer option to turn off
10935          * the default wifi scan throttling mechanism for apps.
10936          *
10937          * Type: int (0 for false, 1 for true)
10938          * @hide
10939          */
10940         public static final String WIFI_SCAN_THROTTLE_ENABLED = "wifi_scan_throttle_enabled";
10941 
10942         private static final Validator WIFI_SCAN_THROTTLE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
10943 
10944         /**
10945         * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
10946         * connectivity.
10947         * @hide
10948         */
10949         public static final String BLE_SCAN_ALWAYS_AVAILABLE = "ble_scan_always_enabled";
10950 
10951         /**
10952          * The length in milliseconds of a BLE scan window in a low-power scan mode.
10953          * @hide
10954          */
10955         public static final String BLE_SCAN_LOW_POWER_WINDOW_MS = "ble_scan_low_power_window_ms";
10956 
10957         /**
10958          * The length in milliseconds of a BLE scan window in a balanced scan mode.
10959          * @hide
10960          */
10961         public static final String BLE_SCAN_BALANCED_WINDOW_MS = "ble_scan_balanced_window_ms";
10962 
10963         /**
10964          * The length in milliseconds of a BLE scan window in a low-latency scan mode.
10965          * @hide
10966          */
10967         public static final String BLE_SCAN_LOW_LATENCY_WINDOW_MS =
10968                 "ble_scan_low_latency_window_ms";
10969 
10970         /**
10971          * The length in milliseconds of a BLE scan interval in a low-power scan mode.
10972          * @hide
10973          */
10974         public static final String BLE_SCAN_LOW_POWER_INTERVAL_MS =
10975                 "ble_scan_low_power_interval_ms";
10976 
10977         /**
10978          * The length in milliseconds of a BLE scan interval in a balanced scan mode.
10979          * @hide
10980          */
10981         public static final String BLE_SCAN_BALANCED_INTERVAL_MS =
10982                 "ble_scan_balanced_interval_ms";
10983 
10984         /**
10985          * The length in milliseconds of a BLE scan interval in a low-latency scan mode.
10986          * @hide
10987          */
10988         public static final String BLE_SCAN_LOW_LATENCY_INTERVAL_MS =
10989                 "ble_scan_low_latency_interval_ms";
10990 
10991         /**
10992          * The mode that BLE scanning clients will be moved to when in the background.
10993          * @hide
10994          */
10995         public static final String BLE_SCAN_BACKGROUND_MODE = "ble_scan_background_mode";
10996 
10997        /**
10998         * Used to save the Wifi_ON state prior to tethering.
10999         * This state will be checked to restore Wifi after
11000         * the user turns off tethering.
11001         *
11002         * @hide
11003         */
11004        @UnsupportedAppUsage
11005        public static final String WIFI_SAVED_STATE = "wifi_saved_state";
11006 
11007        /**
11008         * The interval in milliseconds to scan as used by the wifi supplicant
11009         * @hide
11010         */
11011        public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
11012                "wifi_supplicant_scan_interval_ms";
11013 
11014         /**
11015          * whether frameworks handles wifi auto-join
11016          * @hide
11017          */
11018        public static final String WIFI_ENHANCED_AUTO_JOIN =
11019                 "wifi_enhanced_auto_join";
11020 
11021         /**
11022          * whether settings show RSSI
11023          * @hide
11024          */
11025         public static final String WIFI_NETWORK_SHOW_RSSI =
11026                 "wifi_network_show_rssi";
11027 
11028         /**
11029         * The interval in milliseconds to scan at supplicant when p2p is connected
11030         * @hide
11031         */
11032        public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
11033                "wifi_scan_interval_p2p_connected_ms";
11034 
11035        /**
11036         * Whether the Wi-Fi watchdog is enabled.
11037         */
11038        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
11039 
11040        /**
11041         * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
11042         * the setting needs to be set to 0 to disable it.
11043         * @hide
11044         */
11045        @UnsupportedAppUsage
11046        public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
11047                "wifi_watchdog_poor_network_test_enabled";
11048 
11049        private static final Validator WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED_VALIDATOR =
11050                ANY_STRING_VALIDATOR;
11051 
11052        /**
11053         * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
11054         * needs to be set to 0 to disable it.
11055         * @hide
11056         */
11057        public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
11058                "wifi_suspend_optimizations_enabled";
11059 
11060        /**
11061         * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
11062         * will enable it. In the future, additional values may be supported.
11063         * @hide
11064         */
11065        public static final String WIFI_VERBOSE_LOGGING_ENABLED =
11066                "wifi_verbose_logging_enabled";
11067 
11068         /**
11069          * Setting to enable connected MAC randomization in Wi-Fi; disabled by default, and
11070          * setting to 1 will enable it. In the future, additional values may be supported.
11071          * @deprecated MAC randomization is now a per-network setting
11072          * @hide
11073          */
11074         @Deprecated
11075         public static final String WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED =
11076                 "wifi_connected_mac_randomization_enabled";
11077 
11078         /**
11079          * Parameters to adjust the performance of framework wifi scoring methods.
11080          * <p>
11081          * Encoded as a comma-separated key=value list, for example:
11082          *   "rssi5=-80:-77:-70:-57,rssi2=-83:-80:-73:-60,horizon=15"
11083          * This is intended for experimenting with new parameter values,
11084          * and is normally unset or empty. The example does not include all
11085          * parameters that may be honored.
11086          * Default values are provided by code or device configurations.
11087          * Errors in the parameters will cause the entire setting to be ignored.
11088          * @hide
11089          */
11090         public static final String WIFI_SCORE_PARAMS =
11091                 "wifi_score_params";
11092 
11093         /**
11094          * Setting to enable logging WifiIsUnusableEvent in metrics
11095          * which gets triggered when wifi becomes unusable.
11096          * Disabled by default, and setting it to 1 will enable it.
11097          * @hide
11098          */
11099         public static final String WIFI_IS_UNUSABLE_EVENT_METRICS_ENABLED =
11100                 "wifi_is_unusable_event_metrics_enabled";
11101 
11102         /**
11103          * The minimum number of txBad the framework has to observe
11104          * to trigger a wifi data stall.
11105          * @hide
11106          */
11107         public static final String WIFI_DATA_STALL_MIN_TX_BAD =
11108                 "wifi_data_stall_min_tx_bad";
11109 
11110         /**
11111          * The minimum number of txSuccess the framework has to observe
11112          * to trigger a wifi data stall when rxSuccess is 0.
11113          * @hide
11114          */
11115         public static final String WIFI_DATA_STALL_MIN_TX_SUCCESS_WITHOUT_RX =
11116                 "wifi_data_stall_min_tx_success_without_rx";
11117 
11118         /**
11119          * Setting to enable logging Wifi LinkSpeedCounts in metrics.
11120          * Disabled by default, and setting it to 1 will enable it.
11121          * @hide
11122          */
11123         public static final String WIFI_LINK_SPEED_METRICS_ENABLED =
11124                 "wifi_link_speed_metrics_enabled";
11125 
11126         /**
11127          * Setting to enable the PNO frequency culling optimization.
11128          * Disabled by default, and setting it to 1 will enable it.
11129          * The value is boolean (0 or 1).
11130          * @hide
11131          */
11132         public static final String WIFI_PNO_FREQUENCY_CULLING_ENABLED =
11133                 "wifi_pno_frequency_culling_enabled";
11134 
11135         private static final Validator WIFI_PNO_FREQUENCY_CULLING_ENABLED_VALIDATOR =
11136                 BOOLEAN_VALIDATOR;
11137 
11138         /**
11139          * Setting to enable including recency information when determining pno network priorities.
11140          * Disabled by default, and setting it to 1 will enable it.
11141          * The value is boolean (0 or 1).
11142          * @hide
11143          */
11144         public static final String WIFI_PNO_RECENCY_SORTING_ENABLED =
11145                 "wifi_pno_recency_sorting_enabled";
11146 
11147         private static final Validator WIFI_PNO_RECENCY_SORTING_ENABLED_VALIDATOR =
11148                 BOOLEAN_VALIDATOR;
11149 
11150         /**
11151          * Setting to enable the Wi-Fi link probing.
11152          * Enabled by default, and setting it to 0 will disable it.
11153          * The value is boolean (0 or 1).
11154          * @hide
11155          */
11156         public static final String WIFI_LINK_PROBING_ENABLED =
11157                 "wifi_link_probing_enabled";
11158 
11159         private static final Validator WIFI_LINK_PROBING_ENABLED_VALIDATOR =
11160                 BOOLEAN_VALIDATOR;
11161 
11162        /**
11163         * The maximum number of times we will retry a connection to an access
11164         * point for which we have failed in acquiring an IP address from DHCP.
11165         * A value of N means that we will make N+1 connection attempts in all.
11166         */
11167        public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
11168 
11169        /**
11170         * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
11171         * data connectivity to be established after a disconnect from Wi-Fi.
11172         */
11173        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
11174            "wifi_mobile_data_transition_wakelock_timeout_ms";
11175 
11176        /**
11177         * This setting controls whether WiFi configurations created by a Device Owner app
11178         * should be locked down (that is, be editable or removable only by the Device Owner App,
11179         * not even by Settings app).
11180         * This setting takes integer values. Non-zero values mean DO created configurations
11181         * are locked down. Value of zero means they are not. Default value in the absence of
11182         * actual value to this setting is 0.
11183         */
11184        public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
11185                "wifi_device_owner_configs_lockdown";
11186 
11187        /**
11188         * The operational wifi frequency band
11189         * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
11190         * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
11191         * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
11192         *
11193         * @hide
11194         */
11195        public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
11196 
11197        /**
11198         * The Wi-Fi peer-to-peer device name
11199         * @hide
11200         */
11201        public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
11202 
11203        /**
11204         * The min time between wifi disable and wifi enable
11205         * @hide
11206         */
11207        public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
11208 
11209        /**
11210         * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
11211         * from an ephemeral network if there is no BSSID for that network with a non-null score that
11212         * has been seen in this time period.
11213         *
11214         * If this is less than or equal to zero, we use a more conservative behavior and only check
11215         * for a non-null score from the currently connected or target BSSID.
11216         * @hide
11217         */
11218        public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
11219                "wifi_ephemeral_out_of_range_timeout_ms";
11220 
11221        /**
11222         * The number of milliseconds to delay when checking for data stalls during
11223         * non-aggressive detection. (screen is turned off.)
11224         * @hide
11225         */
11226        public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
11227                "data_stall_alarm_non_aggressive_delay_in_ms";
11228 
11229        /**
11230         * The number of milliseconds to delay when checking for data stalls during
11231         * aggressive detection. (screen on or suspected data stall)
11232         * @hide
11233         */
11234        public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
11235                "data_stall_alarm_aggressive_delay_in_ms";
11236 
11237        /**
11238         * The number of milliseconds to allow the provisioning apn to remain active
11239         * @hide
11240         */
11241        public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
11242                "provisioning_apn_alarm_delay_in_ms";
11243 
11244        /**
11245         * The interval in milliseconds at which to check gprs registration
11246         * after the first registration mismatch of gprs and voice service,
11247         * to detect possible data network registration problems.
11248         *
11249         * @hide
11250         */
11251        public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
11252                "gprs_register_check_period_ms";
11253 
11254        /**
11255         * Nonzero causes Log.wtf() to crash.
11256         * @hide
11257         */
11258        public static final String WTF_IS_FATAL = "wtf_is_fatal";
11259 
11260        /**
11261         * Ringer mode. This is used internally, changing this value will not
11262         * change the ringer mode. See AudioManager.
11263         */
11264        public static final String MODE_RINGER = "mode_ringer";
11265 
11266         /**
11267          * Overlay display devices setting.
11268          * The associated value is a specially formatted string that describes the
11269          * size and density of simulated secondary display devices.
11270          * <p>
11271          * Format: {width}x{height}/{dpi};...
11272          * </p><p>
11273          * Example:
11274          * <ul>
11275          * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
11276          * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
11277          * at 1080p and the second at 720p.</li>
11278          * <li>If the value is empty, then no overlay display devices are created.</li>
11279          * </ul></p>
11280          *
11281          * @hide
11282          */
11283         @UnsupportedAppUsage
11284         @TestApi
11285         public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
11286 
11287         /**
11288          * Threshold values for the duration and level of a discharge cycle,
11289          * under which we log discharge cycle info.
11290          *
11291          * @hide
11292          */
11293         public static final String
11294                 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
11295 
11296         /** @hide */
11297         public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
11298 
11299         /**
11300          * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
11301          * intents on application crashes and ANRs. If this is disabled, the
11302          * crash/ANR dialog will never display the "Report" button.
11303          * <p>
11304          * Type: int (0 = disallow, 1 = allow)
11305          *
11306          * @hide
11307          */
11308         public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
11309 
11310         /**
11311          * Maximum age of entries kept by {@link DropBoxManager}.
11312          *
11313          * @hide
11314          */
11315         public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
11316 
11317         /**
11318          * Maximum number of entry files which {@link DropBoxManager} will keep
11319          * around.
11320          *
11321          * @hide
11322          */
11323         public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
11324 
11325         /**
11326          * Maximum amount of disk space used by {@link DropBoxManager} no matter
11327          * what.
11328          *
11329          * @hide
11330          */
11331         public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
11332 
11333         /**
11334          * Percent of free disk (excluding reserve) which {@link DropBoxManager}
11335          * will use.
11336          *
11337          * @hide
11338          */
11339         public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
11340 
11341         /**
11342          * Percent of total disk which {@link DropBoxManager} will never dip
11343          * into.
11344          *
11345          * @hide
11346          */
11347         public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
11348 
11349         /**
11350          * Prefix for per-tag dropbox disable/enable settings.
11351          *
11352          * @hide
11353          */
11354         public static final String DROPBOX_TAG_PREFIX = "dropbox:";
11355 
11356         /**
11357          * Lines of logcat to include with system crash/ANR/etc. reports, as a
11358          * prefix of the dropbox tag of the report type. For example,
11359          * "logcat_for_system_server_anr" controls the lines of logcat captured
11360          * with system server ANR reports. 0 to disable.
11361          *
11362          * @hide
11363          */
11364         public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
11365 
11366         /**
11367          * The interval in minutes after which the amount of free storage left
11368          * on the device is logged to the event log
11369          *
11370          * @hide
11371          */
11372         public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
11373 
11374         /**
11375          * Threshold for the amount of change in disk free space required to
11376          * report the amount of free space. Used to prevent spamming the logs
11377          * when the disk free space isn't changing frequently.
11378          *
11379          * @hide
11380          */
11381         public static final String
11382                 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
11383 
11384         /**
11385          * Minimum percentage of free storage on the device that is used to
11386          * determine if the device is running low on storage. The default is 10.
11387          * <p>
11388          * Say this value is set to 10, the device is considered running low on
11389          * storage if 90% or more of the device storage is filled up.
11390          *
11391          * @hide
11392          */
11393         public static final String
11394                 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
11395 
11396         /**
11397          * Maximum byte size of the low storage threshold. This is to ensure
11398          * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
11399          * overly large threshold for large storage devices. Currently this must
11400          * be less than 2GB. This default is 500MB.
11401          *
11402          * @hide
11403          */
11404         public static final String
11405                 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
11406 
11407         /**
11408          * Minimum bytes of free storage on the device before the data partition
11409          * is considered full. By default, 1 MB is reserved to avoid system-wide
11410          * SQLite disk full exceptions.
11411          *
11412          * @hide
11413          */
11414         public static final String
11415                 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
11416 
11417         /**
11418          * Minimum percentage of storage on the device that is reserved for
11419          * cached data.
11420          *
11421          * @hide
11422          */
11423         public static final String
11424                 SYS_STORAGE_CACHE_PERCENTAGE = "sys_storage_cache_percentage";
11425 
11426         /**
11427          * Maximum bytes of storage on the device that is reserved for cached
11428          * data.
11429          *
11430          * @hide
11431          */
11432         public static final String
11433                 SYS_STORAGE_CACHE_MAX_BYTES = "sys_storage_cache_max_bytes";
11434 
11435         /**
11436          * The maximum reconnect delay for short network outages or when the
11437          * network is suspended due to phone use.
11438          *
11439          * @hide
11440          */
11441         public static final String
11442                 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
11443 
11444         /**
11445          * The number of milliseconds to delay before sending out
11446          * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
11447          *
11448          * @hide
11449          */
11450         public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
11451 
11452 
11453         /**
11454          * Network sampling interval, in seconds. We'll generate link information
11455          * about bytes/packets sent and error rates based on data sampled in this interval
11456          *
11457          * @hide
11458          */
11459 
11460         public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
11461                 "connectivity_sampling_interval_in_seconds";
11462 
11463         /**
11464          * The series of successively longer delays used in retrying to download PAC file.
11465          * Last delay is used between successful PAC downloads.
11466          *
11467          * @hide
11468          */
11469         public static final String PAC_CHANGE_DELAY = "pac_change_delay";
11470 
11471         /**
11472          * Don't attempt to detect captive portals.
11473          *
11474          * @hide
11475          */
11476         public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0;
11477 
11478         /**
11479          * When detecting a captive portal, display a notification that
11480          * prompts the user to sign in.
11481          *
11482          * @hide
11483          */
11484         public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1;
11485 
11486         /**
11487          * When detecting a captive portal, immediately disconnect from the
11488          * network and do not reconnect to that network in the future.
11489          *
11490          * @hide
11491          */
11492         public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
11493 
11494         /**
11495          * What to do when connecting a network that presents a captive portal.
11496          * Must be one of the CAPTIVE_PORTAL_MODE_* constants above.
11497          *
11498          * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT.
11499          * @hide
11500          */
11501         public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode";
11502 
11503         /**
11504          * Setting to turn off captive portal detection. Feature is enabled by
11505          * default and the setting needs to be set to 0 to disable it.
11506          *
11507          * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection
11508          * @hide
11509          */
11510         @Deprecated
11511         public static final String
11512                 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
11513 
11514         /**
11515          * The server used for captive portal detection upon a new conection. A
11516          * 204 response code from the server is used for validation.
11517          * TODO: remove this deprecated symbol.
11518          *
11519          * @hide
11520          */
11521         public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
11522 
11523         /**
11524          * The URL used for HTTPS captive portal detection upon a new connection.
11525          * A 204 response code from the server is used for validation.
11526          *
11527          * @hide
11528          */
11529         public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url";
11530 
11531         /**
11532          * The URL used for HTTP captive portal detection upon a new connection.
11533          * A 204 response code from the server is used for validation.
11534          *
11535          * @hide
11536          */
11537         public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url";
11538 
11539         /**
11540          * The URL used for fallback HTTP captive portal detection when previous HTTP
11541          * and HTTPS captive portal detection attemps did not return a conclusive answer.
11542          *
11543          * @hide
11544          */
11545         public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
11546 
11547         /**
11548          * A comma separated list of URLs used for captive portal detection in addition to the
11549          * fallback HTTP url associated with the CAPTIVE_PORTAL_FALLBACK_URL settings.
11550          *
11551          * @hide
11552          */
11553         public static final String CAPTIVE_PORTAL_OTHER_FALLBACK_URLS =
11554                 "captive_portal_other_fallback_urls";
11555 
11556         /**
11557          * A list of captive portal detection specifications used in addition to the fallback URLs.
11558          * Each spec has the format url@@/@@statusCodeRegex@@/@@contentRegex. Specs are separated
11559          * by "@@,@@".
11560          * @hide
11561          */
11562         public static final String CAPTIVE_PORTAL_FALLBACK_PROBE_SPECS =
11563                 "captive_portal_fallback_probe_specs";
11564 
11565         /**
11566          * Whether to use HTTPS for network validation. This is enabled by default and the setting
11567          * needs to be set to 0 to disable it. This setting is a misnomer because captive portals
11568          * don't actually use HTTPS, but it's consistent with the other settings.
11569          *
11570          * @hide
11571          */
11572         public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
11573 
11574         /**
11575          * Which User-Agent string to use in the header of the captive portal detection probes.
11576          * The User-Agent field is unset when this setting has no value (HttpUrlConnection default).
11577          *
11578          * @hide
11579          */
11580         public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent";
11581 
11582         /**
11583          * Whether to try cellular data recovery when a bad network is reported.
11584          *
11585          * @hide
11586          */
11587         public static final String DATA_STALL_RECOVERY_ON_BAD_NETWORK =
11588                 "data_stall_recovery_on_bad_network";
11589 
11590         /**
11591          * Minumim duration in millisecodns between cellular data recovery attempts
11592          *
11593          * @hide
11594          */
11595         public static final String MIN_DURATION_BETWEEN_RECOVERY_STEPS_IN_MS =
11596                 "min_duration_between_recovery_steps";
11597         /**
11598          * Whether network service discovery is enabled.
11599          *
11600          * @hide
11601          */
11602         public static final String NSD_ON = "nsd_on";
11603 
11604         /**
11605          * Let user pick default install location.
11606          *
11607          * @hide
11608          */
11609         public static final String SET_INSTALL_LOCATION = "set_install_location";
11610 
11611         /**
11612          * Default install location value.
11613          * 0 = auto, let system decide
11614          * 1 = internal
11615          * 2 = sdcard
11616          * @hide
11617          */
11618         public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
11619 
11620         /**
11621          * ms during which to consume extra events related to Inet connection
11622          * condition after a transtion to fully-connected
11623          *
11624          * @hide
11625          */
11626         public static final String
11627                 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
11628 
11629         /**
11630          * ms during which to consume extra events related to Inet connection
11631          * condtion after a transtion to partly-connected
11632          *
11633          * @hide
11634          */
11635         public static final String
11636                 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
11637 
11638         /** {@hide} */
11639         public static final String
11640                 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
11641 
11642         /**
11643          * Host name and port for global http proxy. Uses ':' seperator for
11644          * between host and port.
11645          */
11646         public static final String HTTP_PROXY = "http_proxy";
11647 
11648         /**
11649          * Host name for global http proxy. Set via ConnectivityManager.
11650          *
11651          * @hide
11652          */
11653         public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
11654 
11655         /**
11656          * Integer host port for global http proxy. Set via ConnectivityManager.
11657          *
11658          * @hide
11659          */
11660         public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
11661 
11662         /**
11663          * Exclusion list for global proxy. This string contains a list of
11664          * comma-separated domains where the global proxy does not apply.
11665          * Domains should be listed in a comma- separated list. Example of
11666          * acceptable formats: ".domain1.com,my.domain2.com" Use
11667          * ConnectivityManager to set/get.
11668          *
11669          * @hide
11670          */
11671         public static final String
11672                 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
11673 
11674         /**
11675          * The location PAC File for the proxy.
11676          * @hide
11677          */
11678         public static final String
11679                 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
11680 
11681         /**
11682          * Enables the UI setting to allow the user to specify the global HTTP
11683          * proxy and associated exclusion list.
11684          *
11685          * @hide
11686          */
11687         public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
11688 
11689         /**
11690          * Setting for default DNS in case nobody suggests one
11691          *
11692          * @hide
11693          */
11694         public static final String DEFAULT_DNS_SERVER = "default_dns_server";
11695 
11696         /**
11697          * The requested Private DNS mode (string), and an accompanying specifier (string).
11698          *
11699          * Currently, the specifier holds the chosen provider name when the mode requests
11700          * a specific provider. It may be used to store the provider name even when the
11701          * mode changes so that temporarily disabling and re-enabling the specific
11702          * provider mode does not necessitate retyping the provider hostname.
11703          *
11704          * @hide
11705          */
11706         public static final String PRIVATE_DNS_MODE = "private_dns_mode";
11707 
11708         private static final Validator PRIVATE_DNS_MODE_VALIDATOR = ANY_STRING_VALIDATOR;
11709 
11710         /**
11711          * @hide
11712          */
11713         public static final String PRIVATE_DNS_SPECIFIER = "private_dns_specifier";
11714 
11715         private static final Validator PRIVATE_DNS_SPECIFIER_VALIDATOR = ANY_STRING_VALIDATOR;
11716 
11717         /**
11718           * Forced override of the default mode (hardcoded as "automatic", nee "opportunistic").
11719           * This allows changing the default mode without effectively disabling other modes,
11720           * all of which require explicit user action to enable/configure. See also b/79719289.
11721           *
11722           * Value is a string, suitable for assignment to PRIVATE_DNS_MODE above.
11723           *
11724           * {@hide}
11725           */
11726         public static final String PRIVATE_DNS_DEFAULT_MODE = "private_dns_default_mode";
11727 
11728 
11729         /** {@hide} */
11730         public static final String
11731                 BLUETOOTH_BTSNOOP_DEFAULT_MODE = "bluetooth_btsnoop_default_mode";
11732         /** {@hide} */
11733         public static final String
11734                 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
11735         /** {@hide} */
11736         public static final String
11737                 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
11738         /** {@hide} */
11739         public static final String
11740                 BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
11741         /** {@hide} */
11742         public static final String BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX =
11743                 "bluetooth_a2dp_supports_optional_codecs_";
11744         /** {@hide} */
11745         public static final String BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX =
11746                 "bluetooth_a2dp_optional_codecs_enabled_";
11747         /** {@hide} */
11748         public static final String
11749                 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
11750         /** {@hide} */
11751         public static final String
11752                 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
11753         /** {@hide} */
11754         public static final String
11755                 BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_";
11756         /** {@hide} */
11757         public static final String
11758                 BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_";
11759         /** {@hide} */
11760         public static final String
11761                 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
11762         /** {@hide} */
11763         public static final String
11764                 BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_";
11765         /** {@hide} */
11766         public static final String
11767                 BLUETOOTH_HEARING_AID_PRIORITY_PREFIX = "bluetooth_hearing_aid_priority_";
11768         /**
11769          * Enable/disable radio bug detection
11770          *
11771          * {@hide}
11772          */
11773         public static final String
11774                 ENABLE_RADIO_BUG_DETECTION = "enable_radio_bug_detection";
11775 
11776         /**
11777          * Count threshold of RIL wakelock timeout for radio bug detection
11778          *
11779          * {@hide}
11780          */
11781         public static final String
11782                 RADIO_BUG_WAKELOCK_TIMEOUT_COUNT_THRESHOLD =
11783                 "radio_bug_wakelock_timeout_count_threshold";
11784 
11785         /**
11786          * Count threshold of RIL system error for radio bug detection
11787          *
11788          * {@hide}
11789          */
11790         public static final String
11791                 RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD =
11792                 "radio_bug_system_error_count_threshold";
11793 
11794         /**
11795          * Activity manager specific settings.
11796          * This is encoded as a key=value list, separated by commas. Ex:
11797          *
11798          * "gc_timeout=5000,max_cached_processes=24"
11799          *
11800          * The following keys are supported:
11801          *
11802          * <pre>
11803          * max_cached_processes                 (int)
11804          * background_settle_time               (long)
11805          * fgservice_min_shown_time             (long)
11806          * fgservice_min_report_time            (long)
11807          * fgservice_screen_on_before_time      (long)
11808          * fgservice_screen_on_after_time       (long)
11809          * content_provider_retain_time         (long)
11810          * gc_timeout                           (long)
11811          * gc_min_interval                      (long)
11812          * full_pss_min_interval                (long)
11813          * full_pss_lowered_interval            (long)
11814          * power_check_interval                 (long)
11815          * power_check_max_cpu_1                (int)
11816          * power_check_max_cpu_2                (int)
11817          * power_check_max_cpu_3                (int)
11818          * power_check_max_cpu_4                (int)
11819          * service_usage_interaction_time       (long)
11820          * usage_stats_interaction_interval     (long)
11821          * service_restart_duration             (long)
11822          * service_reset_run_duration           (long)
11823          * service_restart_duration_factor      (int)
11824          * service_min_restart_time_between     (long)
11825          * service_max_inactivity               (long)
11826          * service_bg_start_timeout             (long)
11827          * service_bg_activity_start_timeout    (long)
11828          * process_start_async                  (boolean)
11829          * </pre>
11830          *
11831          * <p>
11832          * Type: string
11833          * @hide
11834          * @see com.android.server.am.ActivityManagerConstants
11835          */
11836         public static final String ACTIVITY_MANAGER_CONSTANTS = "activity_manager_constants";
11837 
11838         /**
11839          * Feature flag to enable or disable the activity starts logging feature.
11840          * Type: int (0 for false, 1 for true)
11841          * Default: 1
11842          * @hide
11843          */
11844         public static final String ACTIVITY_STARTS_LOGGING_ENABLED
11845                 = "activity_starts_logging_enabled";
11846 
11847         /**
11848          * @hide
11849          * @see com.android.server.appbinding.AppBindingConstants
11850          */
11851         public static final String APP_BINDING_CONSTANTS = "app_binding_constants";
11852 
11853         /**
11854          * App ops specific settings.
11855          * This is encoded as a key=value list, separated by commas. Ex:
11856          *
11857          * "state_settle_time=10000"
11858          *
11859          * The following keys are supported:
11860          *
11861          * <pre>
11862          * top_state_settle_time                (long)
11863          * fg_service_state_settle_time         (long)
11864          * bg_state_settle_time                 (long)
11865          * </pre>
11866          *
11867          * <p>
11868          * Type: string
11869          * @hide
11870          * @see com.android.server.AppOpsService.Constants
11871          */
11872         public static final String APP_OPS_CONSTANTS = "app_ops_constants";
11873 
11874         /**
11875          * Device Idle (Doze) specific settings.
11876          * This is encoded as a key=value list, separated by commas. Ex:
11877          *
11878          * "inactive_to=60000,sensing_to=400000"
11879          *
11880          * The following keys are supported:
11881          *
11882          * <pre>
11883          * inactive_to                      (long)
11884          * sensing_to                       (long)
11885          * motion_inactive_to               (long)
11886          * idle_after_inactive_to           (long)
11887          * idle_pending_to                  (long)
11888          * max_idle_pending_to              (long)
11889          * idle_pending_factor              (float)
11890          * quick_doze_delay_to              (long)
11891          * idle_to                          (long)
11892          * max_idle_to                      (long)
11893          * idle_factor                      (float)
11894          * min_time_to_alarm                (long)
11895          * max_temp_app_whitelist_duration  (long)
11896          * notification_whitelist_duration  (long)
11897          * </pre>
11898          *
11899          * <p>
11900          * Type: string
11901          * @hide
11902          * @see com.android.server.DeviceIdleController.Constants
11903          */
11904         public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
11905 
11906         /**
11907          * Battery Saver specific settings
11908          * This is encoded as a key=value list, separated by commas. Ex:
11909          *
11910          * "vibration_disabled=true,adjust_brightness_factor=0.5"
11911          *
11912          * The following keys are supported:
11913          *
11914          * <pre>
11915          * advertise_is_enabled              (boolean)
11916          * datasaver_disabled                (boolean)
11917          * enable_night_mode                 (boolean)
11918          * launch_boost_disabled             (boolean)
11919          * vibration_disabled                (boolean)
11920          * animation_disabled                (boolean)
11921          * soundtrigger_disabled             (boolean)
11922          * fullbackup_deferred               (boolean)
11923          * keyvaluebackup_deferred           (boolean)
11924          * firewall_disabled                 (boolean)
11925          * gps_mode                          (int)
11926          * adjust_brightness_disabled        (boolean)
11927          * adjust_brightness_factor          (float)
11928          * force_all_apps_standby            (boolean)
11929          * force_background_check            (boolean)
11930          * optional_sensors_disabled         (boolean)
11931          * aod_disabled                      (boolean)
11932          * quick_doze_enabled                (boolean)
11933          * </pre>
11934          * @hide
11935          * @see com.android.server.power.batterysaver.BatterySaverPolicy
11936          */
11937         @UnsupportedAppUsage
11938         @TestApi
11939         public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
11940 
11941         /**
11942          * Battery Saver device specific settings
11943          * This is encoded as a key=value list, separated by commas.
11944          *
11945          * The following keys are supported:
11946          *
11947          * <pre>
11948          *     cpufreq-i (list of "core-number:frequency" pairs concatenated with /)
11949          *     cpufreq-n (list of "core-number:frequency" pairs concatenated with /)
11950          * </pre>
11951          *
11952          * See {@link com.android.server.power.batterysaver.BatterySaverPolicy} for the details.
11953          *
11954          * @hide
11955          */
11956         public static final String BATTERY_SAVER_DEVICE_SPECIFIC_CONSTANTS =
11957                 "battery_saver_device_specific_constants";
11958 
11959         /**
11960          * Settings for adaptive Battery Saver mode. Uses the same flags as
11961          * {@link #BATTERY_SAVER_CONSTANTS}.
11962          *
11963          * @hide
11964          */
11965         public static final String BATTERY_SAVER_ADAPTIVE_CONSTANTS =
11966                 "battery_saver_adaptive_constants";
11967 
11968         /**
11969          * Device specific settings for adaptive Battery Saver mode. Uses the same flags as
11970          * {@link #BATTERY_SAVER_DEVICE_SPECIFIC_CONSTANTS}.
11971          *
11972          * @hide
11973          */
11974         public static final String BATTERY_SAVER_ADAPTIVE_DEVICE_SPECIFIC_CONSTANTS =
11975                 "battery_saver_adaptive_device_specific_constants";
11976 
11977         /**
11978          * Battery tip specific settings
11979          * This is encoded as a key=value list, separated by commas. Ex:
11980          *
11981          * "battery_tip_enabled=true,summary_enabled=true,high_usage_enabled=true,"
11982          * "high_usage_app_count=3,reduced_battery_enabled=false,reduced_battery_percent=50,"
11983          * "high_usage_battery_draining=25,high_usage_period_ms=3000"
11984          *
11985          * The following keys are supported:
11986          *
11987          * <pre>
11988          * battery_tip_enabled              (boolean)
11989          * summary_enabled                  (boolean)
11990          * battery_saver_tip_enabled        (boolean)
11991          * high_usage_enabled               (boolean)
11992          * high_usage_app_count             (int)
11993          * high_usage_period_ms             (long)
11994          * high_usage_battery_draining      (int)
11995          * app_restriction_enabled          (boolean)
11996          * reduced_battery_enabled          (boolean)
11997          * reduced_battery_percent          (int)
11998          * low_battery_enabled              (boolean)
11999          * low_battery_hour                 (int)
12000          * </pre>
12001          * @hide
12002          */
12003         public static final String BATTERY_TIP_CONSTANTS = "battery_tip_constants";
12004 
12005         /**
12006          * Battery anomaly detection specific settings
12007          * This is encoded as a key=value list, separated by commas.
12008          * wakeup_blacklisted_tags is a string, encoded as a set of tags, encoded via
12009          * {@link Uri#encode(String)}, separated by colons. Ex:
12010          *
12011          * "anomaly_detection_enabled=true,wakelock_threshold=2000,wakeup_alarm_enabled=true,"
12012          * "wakeup_alarm_threshold=10,wakeup_blacklisted_tags=tag1:tag2:with%2Ccomma:with%3Acolon"
12013          *
12014          * The following keys are supported:
12015          *
12016          * <pre>
12017          * anomaly_detection_enabled       (boolean)
12018          * wakelock_enabled                (boolean)
12019          * wakelock_threshold              (long)
12020          * wakeup_alarm_enabled            (boolean)
12021          * wakeup_alarm_threshold          (long)
12022          * wakeup_blacklisted_tags         (string)
12023          * bluetooth_scan_enabled          (boolean)
12024          * bluetooth_scan_threshold        (long)
12025          * </pre>
12026          * @hide
12027          */
12028         public static final String ANOMALY_DETECTION_CONSTANTS = "anomaly_detection_constants";
12029 
12030         /**
12031          * An integer to show the version of the anomaly config. Ex: 1, which means
12032          * current version is 1.
12033          * @hide
12034          */
12035         public static final String ANOMALY_CONFIG_VERSION = "anomaly_config_version";
12036 
12037         /**
12038          * A base64-encoded string represents anomaly stats config, used for
12039          * {@link android.app.StatsManager}.
12040          * @hide
12041          */
12042         public static final String ANOMALY_CONFIG = "anomaly_config";
12043 
12044         /**
12045          * Always on display(AOD) specific settings
12046          * This is encoded as a key=value list, separated by commas. Ex:
12047          *
12048          * "prox_screen_off_delay=10000,screen_brightness_array=0:1:2:3:4"
12049          *
12050          * The following keys are supported:
12051          *
12052          * <pre>
12053          * screen_brightness_array         (int[])
12054          * dimming_scrim_array             (int[])
12055          * prox_screen_off_delay           (long)
12056          * prox_cooldown_trigger           (long)
12057          * prox_cooldown_period            (long)
12058          * </pre>
12059          * @hide
12060          */
12061         public static final String ALWAYS_ON_DISPLAY_CONSTANTS = "always_on_display_constants";
12062 
12063         /**
12064         * UidCpuPower global setting. This links the sys.uidcpupower system property.
12065         * The following values are supported:
12066         * 0 -> /proc/uid_cpupower/* are disabled
12067         * 1 -> /proc/uid_cpupower/* are enabled
12068         * Any other value defaults to enabled.
12069         * @hide
12070         */
12071         public static final String SYS_UIDCPUPOWER = "sys_uidcpupower";
12072 
12073         /**
12074         * traced global setting. This controls weather the deamons: traced and
12075         * traced_probes run. This links the sys.traced system property.
12076         * The following values are supported:
12077         * 0 -> traced and traced_probes are disabled
12078         * 1 -> traced and traced_probes are enabled
12079         * Any other value defaults to disabled.
12080         * @hide
12081         */
12082         public static final String SYS_TRACED = "sys_traced";
12083 
12084         /**
12085          * An integer to reduce the FPS by this factor. Only for experiments. Need to reboot the
12086          * device for this setting to take full effect.
12087          *
12088          * @hide
12089          */
12090         public static final String FPS_DEVISOR = "fps_divisor";
12091 
12092         /**
12093          * Flag to enable or disable display panel low power mode (lpm)
12094          * false -> Display panel power saving mode is disabled.
12095          * true  -> Display panel power saving mode is enabled.
12096          *
12097          * @hide
12098          */
12099         public static final String DISPLAY_PANEL_LPM = "display_panel_lpm";
12100 
12101         /**
12102          * App time limit usage source setting.
12103          * This controls which app in a task will be considered the source of usage when
12104          * calculating app usage time limits.
12105          *
12106          * 1 -> task root app
12107          * 2 -> current app
12108          * Any other value defaults to task root app.
12109          *
12110          * Need to reboot the device for this setting to take effect.
12111          * @hide
12112          */
12113         public static final String APP_TIME_LIMIT_USAGE_SOURCE = "app_time_limit_usage_source";
12114 
12115         /**
12116          * App standby (app idle) specific settings.
12117          * This is encoded as a key=value list, separated by commas. Ex:
12118          * <p>
12119          * "idle_duration=5000,parole_interval=4500,screen_thresholds=0/0/60000/120000"
12120          * <p>
12121          * All durations are in millis.
12122          * Array values are separated by forward slashes
12123          * The following keys are supported:
12124          *
12125          * <pre>
12126          * parole_interval                  (long)
12127          * parole_window                    (long)
12128          * parole_duration                  (long)
12129          * screen_thresholds                (long[4])
12130          * elapsed_thresholds               (long[4])
12131          * strong_usage_duration            (long)
12132          * notification_seen_duration       (long)
12133          * system_update_usage_duration     (long)
12134          * prediction_timeout               (long)
12135          * sync_adapter_duration            (long)
12136          * exempted_sync_duration           (long)
12137          * system_interaction_duration      (long)
12138          * initial_foreground_service_start_duration (long)
12139          * stable_charging_threshold        (long)
12140          *
12141          * idle_duration        (long) // This is deprecated and used to circumvent b/26355386.
12142          * idle_duration2       (long) // deprecated
12143          * wallclock_threshold  (long) // deprecated
12144          * </pre>
12145          *
12146          * <p>
12147          * Type: string
12148          * @hide
12149          * @see com.android.server.usage.UsageStatsService.SettingsObserver
12150          */
12151         public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
12152 
12153         /**
12154          * Enable ART bytecode verification verifications for debuggable apps.
12155          * 0 = disable, 1 = enable.
12156          * @hide
12157          */
12158         public static final String ART_VERIFIER_VERIFY_DEBUGGABLE =
12159                 "art_verifier_verify_debuggable";
12160 
12161         /**
12162          * Power manager specific settings.
12163          * This is encoded as a key=value list, separated by commas. Ex:
12164          *
12165          * "no_cached_wake_locks=1"
12166          *
12167          * The following keys are supported:
12168          *
12169          * <pre>
12170          * no_cached_wake_locks                 (boolean)
12171          * </pre>
12172          *
12173          * <p>
12174          * Type: string
12175          * @hide
12176          * @see com.android.server.power.PowerManagerConstants
12177          */
12178         public static final String POWER_MANAGER_CONSTANTS = "power_manager_constants";
12179 
12180         /**
12181          * Alarm manager specific settings.
12182          * This is encoded as a key=value list, separated by commas. Ex:
12183          *
12184          * "min_futurity=5000,allow_while_idle_short_time=4500"
12185          *
12186          * The following keys are supported:
12187          *
12188          * <pre>
12189          * min_futurity                         (long)
12190          * min_interval                         (long)
12191          * allow_while_idle_short_time          (long)
12192          * allow_while_idle_long_time           (long)
12193          * allow_while_idle_whitelist_duration  (long)
12194          * </pre>
12195          *
12196          * <p>
12197          * Type: string
12198          * @hide
12199          * @see com.android.server.AlarmManagerService.Constants
12200          */
12201         public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
12202 
12203         /**
12204          * Job scheduler specific settings.
12205          * This is encoded as a key=value list, separated by commas. Ex:
12206          *
12207          * "min_ready_jobs_count=2,moderate_use_factor=.5"
12208          *
12209          * The following keys are supported:
12210          *
12211          * <pre>
12212          * min_idle_count                       (int)
12213          * min_charging_count                   (int)
12214          * min_connectivity_count               (int)
12215          * min_content_count                    (int)
12216          * min_ready_jobs_count                 (int)
12217          * heavy_use_factor                     (float)
12218          * moderate_use_factor                  (float)
12219          * fg_job_count                         (int)
12220          * bg_normal_job_count                  (int)
12221          * bg_moderate_job_count                (int)
12222          * bg_low_job_count                     (int)
12223          * bg_critical_job_count                (int)
12224          * </pre>
12225          *
12226          * <p>
12227          * Type: string
12228          * @hide
12229          * @see com.android.server.job.JobSchedulerService.Constants
12230          */
12231         public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants";
12232 
12233         /**
12234          * Job scheduler QuotaController specific settings.
12235          * This is encoded as a key=value list, separated by commas. Ex:
12236          *
12237          * "max_job_count_working=5,max_job_count_rare=2"
12238          *
12239          * <p>
12240          * Type: string
12241          *
12242          * @hide
12243          * @see com.android.server.job.JobSchedulerService.Constants
12244          */
12245         public static final String JOB_SCHEDULER_QUOTA_CONTROLLER_CONSTANTS =
12246                 "job_scheduler_quota_controller_constants";
12247 
12248         /**
12249          * Job scheduler TimeController specific settings.
12250          * This is encoded as a key=value list, separated by commas. Ex:
12251          *
12252          * "skip_not_ready_jobs=true5,other_key=2"
12253          *
12254          * <p>
12255          * Type: string
12256          *
12257          * @hide
12258          * @see com.android.server.job.JobSchedulerService.Constants
12259          */
12260         public static final String JOB_SCHEDULER_TIME_CONTROLLER_CONSTANTS =
12261                 "job_scheduler_time_controller_constants";
12262 
12263         /**
12264          * ShortcutManager specific settings.
12265          * This is encoded as a key=value list, separated by commas. Ex:
12266          *
12267          * "reset_interval_sec=86400,max_updates_per_interval=1"
12268          *
12269          * The following keys are supported:
12270          *
12271          * <pre>
12272          * reset_interval_sec              (long)
12273          * max_updates_per_interval        (int)
12274          * max_icon_dimension_dp           (int, DP)
12275          * max_icon_dimension_dp_lowram    (int, DP)
12276          * max_shortcuts                   (int)
12277          * icon_quality                    (int, 0-100)
12278          * icon_format                     (String)
12279          * </pre>
12280          *
12281          * <p>
12282          * Type: string
12283          * @hide
12284          * @see com.android.server.pm.ShortcutService.ConfigConstants
12285          */
12286         public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants";
12287 
12288         /**
12289          * DevicePolicyManager specific settings.
12290          * This is encoded as a key=value list, separated by commas. Ex:
12291          *
12292          * <pre>
12293          * das_died_service_reconnect_backoff_sec       (long)
12294          * das_died_service_reconnect_backoff_increase  (float)
12295          * das_died_service_reconnect_max_backoff_sec   (long)
12296          * </pre>
12297          *
12298          * <p>
12299          * Type: string
12300          * @hide
12301          * see also com.android.server.devicepolicy.DevicePolicyConstants
12302          */
12303         public static final String DEVICE_POLICY_CONSTANTS = "device_policy_constants";
12304 
12305         /**
12306          * TextClassifier specific settings.
12307          * This is encoded as a key=value list, separated by commas. String[] types like
12308          * entity_list_default use ":" as delimiter for values. Ex:
12309          *
12310          * <pre>
12311          * classify_text_max_range_length                   (int)
12312          * detect_language_from_text_enabled                (boolean)
12313          * entity_list_default                              (String[])
12314          * entity_list_editable                             (String[])
12315          * entity_list_not_editable                         (String[])
12316          * generate_links_log_sample_rate                   (int)
12317          * generate_links_max_text_length                   (int)
12318          * in_app_conversation_action_types_default         (String[])
12319          * lang_id_context_settings                         (float[])
12320          * lang_id_threshold_override                       (float)
12321          * local_textclassifier_enabled                     (boolean)
12322          * model_dark_launch_enabled                        (boolean)
12323          * notification_conversation_action_types_default   (String[])
12324          * smart_linkify_enabled                            (boolean)
12325          * smart_select_animation_enabled                   (boolean)
12326          * smart_selection_enabled                          (boolean)
12327          * smart_text_share_enabled                         (boolean)
12328          * suggest_selection_max_range_length               (int)
12329          * system_textclassifier_enabled                    (boolean)
12330          * template_intent_factory_enabled                  (boolean)
12331          * translate_in_classification_enabled              (boolean)
12332          * </pre>
12333          *
12334          * <p>
12335          * Type: string
12336          * @hide
12337          * see also android.view.textclassifier.TextClassificationConstants
12338          */
12339         public static final String TEXT_CLASSIFIER_CONSTANTS = "text_classifier_constants";
12340 
12341         /**
12342          * BatteryStats specific settings.
12343          * This is encoded as a key=value list, separated by commas. Ex: "foo=1,bar=true"
12344          *
12345          * The following keys are supported:
12346          * <pre>
12347          * track_cpu_times_by_proc_state (boolean)
12348          * track_cpu_active_cluster_time (boolean)
12349          * read_binary_cpu_time          (boolean)
12350          * proc_state_cpu_times_read_delay_ms (long)
12351          * external_stats_collection_rate_limit_ms (long)
12352          * battery_level_collection_delay_ms (long)
12353          * max_history_files (int)
12354          * max_history_buffer_kb (int)
12355          * battery_charged_delay_ms (int)
12356          * </pre>
12357          *
12358          * <p>
12359          * Type: string
12360          * @hide
12361          * see also com.android.internal.os.BatteryStatsImpl.Constants
12362          */
12363         public static final String BATTERY_STATS_CONSTANTS = "battery_stats_constants";
12364 
12365         /**
12366          * SyncManager specific settings.
12367          *
12368          * <p>
12369          * Type: string
12370          * @hide
12371          * @see com.android.server.content.SyncManagerConstants
12372          */
12373         public static final String SYNC_MANAGER_CONSTANTS = "sync_manager_constants";
12374 
12375         /**
12376          * Broadcast dispatch tuning parameters specific to foreground broadcasts.
12377          *
12378          * This is encoded as a key=value list, separated by commas. Ex: "foo=1,bar=true"
12379          *
12380          * The following keys are supported:
12381          * <pre>
12382          * bcast_timeout                (long)
12383          * bcast_slow_time              (long)
12384          * bcast_deferral               (long)
12385          * bcast_deferral_decay_factor  (float)
12386          * bcast_deferral_floor         (long)
12387          * bcast_allow_bg_activity_start_timeout    (long)
12388          * </pre>
12389          *
12390          * @hide
12391          */
12392         public static final String BROADCAST_FG_CONSTANTS = "bcast_fg_constants";
12393 
12394         /**
12395          * Broadcast dispatch tuning parameters specific to background broadcasts.
12396          *
12397          * This is encoded as a key=value list, separated by commas. Ex: "foo=1,bar=true".
12398          * See {@link #BROADCAST_FG_CONSTANTS} for the list of supported keys.
12399          *
12400          * @hide
12401          */
12402         public static final String BROADCAST_BG_CONSTANTS = "bcast_bg_constants";
12403 
12404         /**
12405          * Broadcast dispatch tuning parameters specific to specific "offline" broadcasts.
12406          *
12407          * This is encoded as a key=value list, separated by commas. Ex: "foo=1,bar=true".
12408          * See {@link #BROADCAST_FG_CONSTANTS} for the list of supported keys.
12409          *
12410          * @hide
12411          */
12412         public static final String BROADCAST_OFFLOAD_CONSTANTS = "bcast_offload_constants";
12413 
12414         /**
12415          * Whether or not App Standby feature is enabled by system. This controls throttling of apps
12416          * based on usage patterns and predictions. Platform will turn on this feature if both this
12417          * flag and {@link #ADAPTIVE_BATTERY_MANAGEMENT_ENABLED} is on.
12418          * Type: int (0 for false, 1 for true)
12419          * Default: 1
12420          * @hide
12421          * @see #ADAPTIVE_BATTERY_MANAGEMENT_ENABLED
12422          */
12423         @SystemApi
12424         public static final String APP_STANDBY_ENABLED = "app_standby_enabled";
12425 
12426         /**
12427          * Whether or not adaptive battery feature is enabled by user. Platform will turn on this
12428          * feature if both this flag and {@link #APP_STANDBY_ENABLED} is on.
12429          * Type: int (0 for false, 1 for true)
12430          * Default: 1
12431          * @hide
12432          * @see #APP_STANDBY_ENABLED
12433          */
12434         public static final String ADAPTIVE_BATTERY_MANAGEMENT_ENABLED =
12435                 "adaptive_battery_management_enabled";
12436 
12437         /**
12438          * Whether or not app auto restriction is enabled. When it is enabled, settings app will
12439          * auto restrict the app if it has bad behavior(e.g. hold wakelock for long time).
12440          *
12441          * Type: boolean (0 for false, 1 for true)
12442          * Default: 1
12443          *
12444          * @hide
12445          */
12446         public static final String APP_AUTO_RESTRICTION_ENABLED =
12447                 "app_auto_restriction_enabled";
12448 
12449         private static final Validator APP_AUTO_RESTRICTION_ENABLED_VALIDATOR =
12450                 BOOLEAN_VALIDATOR;
12451 
12452         /**
12453          * Feature flag to enable or disable the Forced App Standby feature.
12454          * Type: int (0 for false, 1 for true)
12455          * Default: 1
12456          * @hide
12457          */
12458         public static final String FORCED_APP_STANDBY_ENABLED = "forced_app_standby_enabled";
12459 
12460         /**
12461          * Whether or not to enable Forced App Standby on small battery devices.
12462          * Type: int (0 for false, 1 for true)
12463          * Default: 0
12464          * @hide
12465          */
12466         public static final String FORCED_APP_STANDBY_FOR_SMALL_BATTERY_ENABLED
12467                 = "forced_app_standby_for_small_battery_enabled";
12468 
12469         /**
12470          * Whether or not to enable the User Absent, Radios Off feature on small battery devices.
12471          * Type: int (0 for false, 1 for true)
12472          * Default: 0
12473          * @hide
12474          */
12475         public static final String USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED
12476                 = "user_absent_radios_off_for_small_battery_enabled";
12477 
12478         /**
12479          * Whether or not to enable the User Absent, Touch Off feature on small battery devices.
12480          * Type: int (0 for false, 1 for true)
12481          * Default: 0
12482          * @hide
12483          */
12484         public static final String USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED
12485                 = "user_absent_touch_off_for_small_battery_enabled";
12486 
12487         /**
12488          * Whether or not to turn on Wifi when proxy is disconnected.
12489          * Type: int (0 for false, 1 for true)
12490          * Default: 1
12491          * @hide
12492          */
12493         public static final String WIFI_ON_WHEN_PROXY_DISCONNECTED
12494                 = "wifi_on_when_proxy_disconnected";
12495 
12496         /**
12497          * Time Only Mode specific settings.
12498          * This is encoded as a key=value list, separated by commas. Ex: "foo=1,bar=true"
12499          *
12500          * The following keys are supported:
12501          *
12502          * <pre>
12503          * enabled                  (boolean)
12504          * disable_home             (boolean)
12505          * disable_tilt_to_wake     (boolean)
12506          * disable_touch_to_wake    (boolean)
12507          * </pre>
12508          * Type: string
12509          * @hide
12510          */
12511         public static final String TIME_ONLY_MODE_CONSTANTS
12512                 = "time_only_mode_constants";
12513 
12514         /**
12515          * Whether of not to send keycode sleep for ungaze when Home is the foreground activity on
12516          * watch type devices.
12517          * Type: int (0 for false, 1 for true)
12518          * Default: 0
12519          * @hide
12520          */
12521         public static final String UNGAZE_SLEEP_ENABLED = "ungaze_sleep_enabled";
12522 
12523         /**
12524          * Whether or not Network Watchlist feature is enabled.
12525          * Type: int (0 for false, 1 for true)
12526          * Default: 0
12527          * @hide
12528          */
12529         public static final String NETWORK_WATCHLIST_ENABLED = "network_watchlist_enabled";
12530 
12531         /**
12532          * Whether or not show hidden launcher icon apps feature is enabled.
12533          * Type: int (0 for false, 1 for true)
12534          * Default: 1
12535          * @hide
12536          */
12537         public static final String SHOW_HIDDEN_LAUNCHER_ICON_APPS_ENABLED =
12538                 "show_hidden_icon_apps_enabled";
12539 
12540         /**
12541          * Whether or not show new app installed notification is enabled.
12542          * Type: int (0 for false, 1 for true)
12543          * Default: 0
12544          * @hide
12545          */
12546         public static final String SHOW_NEW_APP_INSTALLED_NOTIFICATION_ENABLED =
12547                 "show_new_app_installed_notification_enabled";
12548 
12549         /**
12550          * Flag to keep background restricted profiles running after exiting. If disabled,
12551          * the restricted profile can be put into stopped state as soon as the user leaves it.
12552          * Type: int (0 for false, 1 for true)
12553          *
12554          * Overridden by the system based on device information. If null, the value specified
12555          * by {@code config_keepRestrictedProfilesInBackground} is used.
12556          *
12557          * @hide
12558          */
12559         public static final String KEEP_PROFILE_IN_BACKGROUND = "keep_profile_in_background";
12560 
12561         /**
12562          * The default time in ms within which a subsequent connection from an always allowed system
12563          * is allowed to reconnect without user interaction.
12564          *
12565          * @hide
12566          */
12567         public static final long DEFAULT_ADB_ALLOWED_CONNECTION_TIME = 604800000;
12568 
12569         /**
12570          * When the user first connects their device to a system a prompt is displayed to allow
12571          * the adb connection with an option to 'Always allow' connections from this system. If the
12572          * user selects this always allow option then the connection time is stored for the system.
12573          * This setting is the time in ms within which a subsequent connection from an always
12574          * allowed system is allowed to reconnect without user interaction.
12575          *
12576          * Type: long
12577          *
12578          * @hide
12579          */
12580         public static final String ADB_ALLOWED_CONNECTION_TIME =
12581                 "adb_allowed_connection_time";
12582 
12583         /**
12584          * Scaling factor for normal window animations. Setting to 0 will
12585          * disable window animations.
12586          */
12587         public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
12588 
12589         /**
12590          * Scaling factor for activity transition animations. Setting to 0 will
12591          * disable window animations.
12592          */
12593         public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
12594 
12595         /**
12596          * Scaling factor for Animator-based animations. This affects both the
12597          * start delay and duration of all such animations. Setting to 0 will
12598          * cause animations to end immediately. The default value is 1.
12599          */
12600         public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
12601 
12602         /**
12603          * Scaling factor for normal window animations. Setting to 0 will
12604          * disable window animations.
12605          *
12606          * @hide
12607          */
12608         public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
12609 
12610         /**
12611          * If 0, the compatibility mode is off for all applications.
12612          * If 1, older applications run under compatibility mode.
12613          * TODO: remove this settings before code freeze (bug/1907571)
12614          * @hide
12615          */
12616         public static final String COMPATIBILITY_MODE = "compatibility_mode";
12617 
12618         /**
12619          * CDMA only settings
12620          * Emergency Tone  0 = Off
12621          *                 1 = Alert
12622          *                 2 = Vibrate
12623          * @hide
12624          */
12625         public static final String EMERGENCY_TONE = "emergency_tone";
12626 
12627         private static final Validator EMERGENCY_TONE_VALIDATOR =
12628                 new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1", "2"});
12629 
12630         /**
12631          * CDMA only settings
12632          * Whether the auto retry is enabled. The value is
12633          * boolean (1 or 0).
12634          * @hide
12635          */
12636         public static final String CALL_AUTO_RETRY = "call_auto_retry";
12637 
12638         private static final Validator CALL_AUTO_RETRY_VALIDATOR = BOOLEAN_VALIDATOR;
12639 
12640         /**
12641          * A setting that can be read whether the emergency affordance is currently needed.
12642          * The value is a boolean (1 or 0).
12643          * @hide
12644          */
12645         public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
12646 
12647         /**
12648          * Whether to enable automatic system server heap dumps. This only works on userdebug or
12649          * eng builds, not on user builds. This is set by the user and overrides the config value.
12650          * 1 means enable, 0 means disable.
12651          *
12652          * @hide
12653          */
12654         public static final String ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS =
12655                 "enable_automatic_system_server_heap_dumps";
12656 
12657         private static final Validator ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_VALIDATOR =
12658                 new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1"});
12659 
12660         /**
12661          * See RIL_PreferredNetworkType in ril.h
12662          * @hide
12663          */
12664         @UnsupportedAppUsage
12665         public static final String PREFERRED_NETWORK_MODE =
12666                 "preferred_network_mode";
12667 
12668         /**
12669          * Name of an application package to be debugged.
12670          */
12671         public static final String DEBUG_APP = "debug_app";
12672 
12673         /**
12674          * If 1, when launching DEBUG_APP it will wait for the debugger before
12675          * starting user code.  If 0, it will run normally.
12676          */
12677         public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
12678 
12679         /**
12680          * Allow GPU debug layers?
12681          * 0 = no
12682          * 1 = yes
12683          * @hide
12684          */
12685         public static final String ENABLE_GPU_DEBUG_LAYERS = "enable_gpu_debug_layers";
12686 
12687         /**
12688          * App allowed to load GPU debug layers
12689          * @hide
12690          */
12691         public static final String GPU_DEBUG_APP = "gpu_debug_app";
12692 
12693         /**
12694          * Package containing ANGLE libraries other than system, which are only available
12695          * to dumpable apps that opt-in.
12696          * @hide
12697          */
12698         public static final String GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE =
12699                 "angle_debug_package";
12700 
12701         /**
12702          * Force all PKGs to use ANGLE, regardless of any other settings
12703          * The value is a boolean (1 or 0).
12704          * @hide
12705          */
12706         public static final String GLOBAL_SETTINGS_ANGLE_GL_DRIVER_ALL_ANGLE =
12707                 "angle_gl_driver_all_angle";
12708 
12709         /**
12710          * List of PKGs that have an OpenGL driver selected
12711          * @hide
12712          */
12713         public static final String GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_PKGS =
12714                 "angle_gl_driver_selection_pkgs";
12715 
12716         /**
12717          * List of selected OpenGL drivers, corresponding to the PKGs in GLOBAL_SETTINGS_DRIVER_PKGS
12718          * @hide
12719          */
12720         public static final String GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_VALUES =
12721                 "angle_gl_driver_selection_values";
12722 
12723         /**
12724          * List of package names that should check ANGLE rules
12725          * @hide
12726          */
12727         public static final String GLOBAL_SETTINGS_ANGLE_WHITELIST =
12728                 "angle_whitelist";
12729 
12730         /**
12731          * Show the "ANGLE In Use" dialog box to the user when ANGLE is the OpenGL driver.
12732          * The value is a boolean (1 or 0).
12733          * @hide
12734          */
12735         public static final String GLOBAL_SETTINGS_SHOW_ANGLE_IN_USE_DIALOG_BOX =
12736                 "show_angle_in_use_dialog_box";
12737 
12738         /**
12739          * Game Driver global preference for all Apps.
12740          * 0 = Default
12741          * 1 = All Apps use Game Driver
12742          * 2 = All Apps use system graphics driver
12743          * @hide
12744          */
12745         public static final String GAME_DRIVER_ALL_APPS = "game_driver_all_apps";
12746 
12747         /**
12748          * List of Apps selected to use Game Driver.
12749          * i.e. <pkg1>,<pkg2>,...,<pkgN>
12750          * @hide
12751          */
12752         public static final String GAME_DRIVER_OPT_IN_APPS = "game_driver_opt_in_apps";
12753 
12754         /**
12755          * List of Apps selected to use prerelease Game Driver.
12756          * i.e. <pkg1>,<pkg2>,...,<pkgN>
12757          * @hide
12758          */
12759         public static final String GAME_DRIVER_PRERELEASE_OPT_IN_APPS =
12760                 "game_driver_prerelease_opt_in_apps";
12761 
12762         /**
12763          * List of Apps selected not to use Game Driver.
12764          * i.e. <pkg1>,<pkg2>,...,<pkgN>
12765          * @hide
12766          */
12767         public static final String GAME_DRIVER_OPT_OUT_APPS = "game_driver_opt_out_apps";
12768 
12769         /**
12770          * Apps on the blacklist that are forbidden to use Game Driver.
12771          * @hide
12772          */
12773         public static final String GAME_DRIVER_BLACKLIST = "game_driver_blacklist";
12774 
12775         /**
12776          * List of blacklists, each blacklist is a blacklist for a specific version of Game Driver.
12777          * @hide
12778          */
12779         public static final String GAME_DRIVER_BLACKLISTS = "game_driver_blacklists";
12780 
12781         /**
12782          * Apps on the whitelist that are allowed to use Game Driver.
12783          * The string is a list of application package names, seperated by comma.
12784          * i.e. <apk1>,<apk2>,...,<apkN>
12785          * @hide
12786          */
12787         public static final String GAME_DRIVER_WHITELIST = "game_driver_whitelist";
12788 
12789         /**
12790          * List of libraries in sphal accessible by Game Driver
12791          * The string is a list of library names, separated by colon.
12792          * i.e. <lib1>:<lib2>:...:<libN>
12793          * @hide
12794          */
12795         public static final String GAME_DRIVER_SPHAL_LIBRARIES = "game_driver_sphal_libraries";
12796 
12797         /**
12798          * Ordered GPU debug layer list for Vulkan
12799          * i.e. <layer1>:<layer2>:...:<layerN>
12800          * @hide
12801          */
12802         public static final String GPU_DEBUG_LAYERS = "gpu_debug_layers";
12803 
12804         /**
12805          * Ordered GPU debug layer list for GLES
12806          * i.e. <layer1>:<layer2>:...:<layerN>
12807          * @hide
12808          */
12809         public static final String GPU_DEBUG_LAYERS_GLES = "gpu_debug_layers_gles";
12810 
12811         /**
12812          * Addition app for GPU layer discovery
12813          * @hide
12814          */
12815         public static final String GPU_DEBUG_LAYER_APP = "gpu_debug_layer_app";
12816 
12817         /**
12818          * Control whether the process CPU usage meter should be shown.
12819          *
12820          * @deprecated This functionality is no longer available as of
12821          * {@link android.os.Build.VERSION_CODES#N_MR1}.
12822          */
12823         @Deprecated
12824         public static final String SHOW_PROCESSES = "show_processes";
12825 
12826         /**
12827          * If 1 low power mode (aka battery saver) is enabled.
12828          * @hide
12829          */
12830         @TestApi
12831         public static final String LOW_POWER_MODE = "low_power";
12832 
12833         /**
12834          * If 1, battery saver ({@link #LOW_POWER_MODE}) will be re-activated after the device
12835          * is unplugged from a charger or rebooted.
12836          * @hide
12837          */
12838         @TestApi
12839         public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
12840 
12841         /**
12842          * When a device is unplugged from a changer (or is rebooted), do not re-activate battery
12843          * saver even if {@link #LOW_POWER_MODE_STICKY} is 1, if the battery level is equal to or
12844          * above this threshold.
12845          *
12846          * @hide
12847          */
12848         public static final String LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL =
12849                 "low_power_sticky_auto_disable_level";
12850 
12851         private static final Validator LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL_VALIDATOR =
12852                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 100);
12853 
12854         /**
12855          * Whether sticky battery saver should be deactivated once the battery level has reached the
12856          * threshold specified by {@link #LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL}.
12857          *
12858          * @hide
12859          */
12860         public static final String LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED =
12861                 "low_power_sticky_auto_disable_enabled";
12862 
12863         private static final Validator LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED_VALIDATOR =
12864                 new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1"});
12865 
12866         /**
12867          * Battery level [1-100] at which low power mode automatically turns on.
12868          * If 0, it will not automatically turn on. For Q and newer, it will only automatically
12869          * turn on if the value is greater than 0 and the {@link #AUTOMATIC_POWER_SAVE_MODE}
12870          * setting is also set to
12871          * {@link android.os.PowerManager.AutoPowerSaveMode#POWER_SAVE_MODE_TRIGGER_PERCENTAGE}.
12872          * @see #AUTOMATIC_POWER_SAVE_MODE
12873          * @see android.os.PowerManager#getPowerSaveModeTrigger()
12874          * @hide
12875          */
12876         public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
12877 
12878         private static final Validator LOW_POWER_MODE_TRIGGER_LEVEL_VALIDATOR =
12879                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 100);
12880 
12881         /**
12882          * Whether battery saver is currently set to trigger based on percentage, dynamic power
12883          * savings trigger, or none. See {@link AutoPowerSaveModeTriggers} for
12884          * accepted values.
12885          *
12886          *  @hide
12887          */
12888         @TestApi
12889         public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
12890 
12891         private static final Validator AUTOMATIC_POWER_SAVE_MODE_VALIDATOR =
12892                 new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1"});
12893 
12894         /**
12895          * The setting that backs the disable threshold for the setPowerSavingsWarning api in
12896          * PowerManager
12897          *
12898          * @see android.os.PowerManager#setDynamicPowerSaveHint(boolean, int)
12899          * @hide
12900          */
12901         @TestApi
12902         public static final String DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD =
12903                 "dynamic_power_savings_disable_threshold";
12904         private static final Validator DYNAMIC_POWER_SAVINGS_VALIDATOR =
12905                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 100);
12906 
12907         /**
12908          * The setting which backs the setDynamicPowerSaveHint api in PowerManager.
12909          *
12910          * @see android.os.PowerManager#setDynamicPowerSaveHint(boolean, int)
12911          * @hide
12912          */
12913         @TestApi
12914         public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
12915 
12916         /**
12917          * A long value indicating how much longer the system battery is estimated to last in
12918          * millis. See {@link #BATTERY_ESTIMATES_LAST_UPDATE_TIME} for the last time this value
12919          * was updated.
12920          *
12921          * @hide
12922          */
12923         public static final String TIME_REMAINING_ESTIMATE_MILLIS =
12924                 "time_remaining_estimate_millis";
12925 
12926         /**
12927          * A boolean indicating whether {@link #TIME_REMAINING_ESTIMATE_MILLIS} is based customized
12928          * to the devices usage or using global models. See
12929          * {@link #BATTERY_ESTIMATES_LAST_UPDATE_TIME} for the last time this value was updated.
12930          *
12931          * @hide
12932          */
12933         public static final String TIME_REMAINING_ESTIMATE_BASED_ON_USAGE =
12934                 "time_remaining_estimate_based_on_usage";
12935 
12936         /**
12937          * A long value indicating how long the system battery takes to deplete from 100% to 0% on
12938          * average based on historical drain rates. See {@link #BATTERY_ESTIMATES_LAST_UPDATE_TIME}
12939          * for the last time this value was updated.
12940          *
12941          * @hide
12942          */
12943         public static final String AVERAGE_TIME_TO_DISCHARGE = "average_time_to_discharge";
12944 
12945         /**
12946          * A long indicating the epoch time in milliseconds when
12947          * {@link #TIME_REMAINING_ESTIMATE_MILLIS}, {@link #TIME_REMAINING_ESTIMATE_BASED_ON_USAGE},
12948          * and {@link #AVERAGE_TIME_TO_DISCHARGE} were last updated.
12949          *
12950          * @hide
12951          */
12952         public static final String BATTERY_ESTIMATES_LAST_UPDATE_TIME =
12953                 "battery_estimates_last_update_time";
12954 
12955         /**
12956          * The max value for {@link #LOW_POWER_MODE_TRIGGER_LEVEL}. If this setting is not set
12957          * or the value is 0, the default max will be used.
12958          *
12959          * @hide
12960          */
12961         public static final String LOW_POWER_MODE_TRIGGER_LEVEL_MAX = "low_power_trigger_level_max";
12962 
12963         /**
12964          * See com.android.settingslib.fuelgauge.BatterySaverUtils.
12965          * @hide
12966          */
12967         public static final String LOW_POWER_MODE_SUGGESTION_PARAMS =
12968                 "low_power_mode_suggestion_params";
12969 
12970         /**
12971          * If not 0, the activity manager will aggressively finish activities and
12972          * processes as soon as they are no longer needed.  If 0, the normal
12973          * extended lifetime is used.
12974          */
12975         public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
12976 
12977         /**
12978          * If nonzero, all system error dialogs will be hidden.  For example, the
12979          * crash and ANR dialogs will not be shown, and the system will just proceed
12980          * as if they had been accepted by the user.
12981          * @hide
12982          */
12983         public static final String HIDE_ERROR_DIALOGS = "hide_error_dialogs";
12984 
12985         /**
12986          * Use Dock audio output for media:
12987          *      0 = disabled
12988          *      1 = enabled
12989          * @hide
12990          */
12991         public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
12992 
12993         private static final Validator DOCK_AUDIO_MEDIA_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
12994 
12995         /**
12996          * The surround sound formats AC3, DTS or IEC61937 are
12997          * available for use if they are detected.
12998          * This is the default mode.
12999          *
13000          * Note that AUTO is equivalent to ALWAYS for Android TVs and other
13001          * devices that have an S/PDIF output. This is because S/PDIF
13002          * is unidirectional and the TV cannot know if a decoder is
13003          * connected. So it assumes they are always available.
13004          * @hide
13005          */
13006          public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0;
13007 
13008         /**
13009          * AC3, DTS or IEC61937 are NEVER available, even if they
13010          * are detected by the hardware. Those formats will not be
13011          * reported.
13012          *
13013          * An example use case would be an AVR reports that it is capable of
13014          * surround sound decoding but is broken. If NEVER is chosen
13015          * then apps must use PCM output instead of encoded output.
13016          * @hide
13017          */
13018          public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1;
13019 
13020         /**
13021          * AC3, DTS or IEC61937 are ALWAYS available, even if they
13022          * are not detected by the hardware. Those formats will be
13023          * reported as part of the HDMI output capability. Applications
13024          * are then free to use either PCM or encoded output.
13025          *
13026          * An example use case would be a when TV was connected over
13027          * TOS-link to an AVR. But the TV could not see it because TOS-link
13028          * is unidirectional.
13029          * @hide
13030          */
13031          public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2;
13032 
13033         /**
13034          * Surround sound formats are available according to the choice
13035          * of user, even if they are not detected by the hardware. Those
13036          * formats will be reported as part of the HDMI output capability.
13037          * Applications are then free to use either PCM or encoded output.
13038          *
13039          * An example use case would be an AVR that doesn't report a surround
13040          * format while the user knows the AVR does support it.
13041          * @hide
13042          */
13043         public static final int ENCODED_SURROUND_OUTPUT_MANUAL = 3;
13044 
13045         /**
13046          * Set to ENCODED_SURROUND_OUTPUT_AUTO,
13047          * ENCODED_SURROUND_OUTPUT_NEVER,
13048          * ENCODED_SURROUND_OUTPUT_ALWAYS or
13049          * ENCODED_SURROUND_OUTPUT_MANUAL
13050          * @hide
13051          */
13052         public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output";
13053 
13054         private static final Validator ENCODED_SURROUND_OUTPUT_VALIDATOR =
13055                 new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1", "2", "3"});
13056 
13057         /**
13058          * Surround sounds formats that are enabled when ENCODED_SURROUND_OUTPUT is set to
13059          * ENCODED_SURROUND_OUTPUT_MANUAL. Encoded as comma separated list. Allowed values
13060          * are the format constants defined in AudioFormat.java. Ex:
13061          *
13062          * "5,6"
13063          *
13064          * @hide
13065          */
13066         public static final String ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS =
13067                 "encoded_surround_output_enabled_formats";
13068 
13069         private static final Validator ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS_VALIDATOR =
13070                 new Validator() {
13071             @Override
13072             public boolean validate(@Nullable String value) {
13073                 try {
13074                     String[] surroundFormats = TextUtils.split(value, ",");
13075                     for (String format : surroundFormats) {
13076                         int audioFormat = Integer.valueOf(format);
13077                         boolean isSurroundFormat = false;
13078                         for (int sf : AudioFormat.SURROUND_SOUND_ENCODING) {
13079                             if (sf == audioFormat) {
13080                                 isSurroundFormat = true;
13081                                 break;
13082                             }
13083                         }
13084                         if (!isSurroundFormat) {
13085                             return false;
13086                         }
13087                     }
13088                     return true;
13089                 } catch (NumberFormatException e) {
13090                     return false;
13091                 }
13092             }
13093         };
13094 
13095         /**
13096          * Persisted safe headphone volume management state by AudioService
13097          * @hide
13098          */
13099         public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
13100 
13101         /**
13102          * URL for tzinfo (time zone) updates
13103          * @hide
13104          */
13105         public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
13106 
13107         /**
13108          * URL for tzinfo (time zone) update metadata
13109          * @hide
13110          */
13111         public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
13112 
13113         /**
13114          * URL for selinux (mandatory access control) updates
13115          * @hide
13116          */
13117         public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
13118 
13119         /**
13120          * URL for selinux (mandatory access control) update metadata
13121          * @hide
13122          */
13123         public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
13124 
13125         /**
13126          * URL for sms short code updates
13127          * @hide
13128          */
13129         public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
13130                 "sms_short_codes_content_url";
13131 
13132         /**
13133          * URL for sms short code update metadata
13134          * @hide
13135          */
13136         public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
13137                 "sms_short_codes_metadata_url";
13138 
13139         /**
13140          * URL for apn_db updates
13141          * @hide
13142          */
13143         public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
13144 
13145         /**
13146          * URL for apn_db update metadata
13147          * @hide
13148          */
13149         public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
13150 
13151         /**
13152          * URL for cert pinlist updates
13153          * @hide
13154          */
13155         public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
13156 
13157         /**
13158          * URL for cert pinlist updates
13159          * @hide
13160          */
13161         public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
13162 
13163         /**
13164          * URL for intent firewall updates
13165          * @hide
13166          */
13167         public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
13168                 "intent_firewall_content_url";
13169 
13170         /**
13171          * URL for intent firewall update metadata
13172          * @hide
13173          */
13174         public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
13175                 "intent_firewall_metadata_url";
13176 
13177         /**
13178          * URL for lang id model updates
13179          * @hide
13180          */
13181         public static final String LANG_ID_UPDATE_CONTENT_URL = "lang_id_content_url";
13182 
13183         /**
13184          * URL for lang id model update metadata
13185          * @hide
13186          */
13187         public static final String LANG_ID_UPDATE_METADATA_URL = "lang_id_metadata_url";
13188 
13189         /**
13190          * URL for smart selection model updates
13191          * @hide
13192          */
13193         public static final String SMART_SELECTION_UPDATE_CONTENT_URL =
13194                 "smart_selection_content_url";
13195 
13196         /**
13197          * URL for smart selection model update metadata
13198          * @hide
13199          */
13200         public static final String SMART_SELECTION_UPDATE_METADATA_URL =
13201                 "smart_selection_metadata_url";
13202 
13203         /**
13204          * URL for conversation actions model updates
13205          * @hide
13206          */
13207         public static final String CONVERSATION_ACTIONS_UPDATE_CONTENT_URL =
13208                 "conversation_actions_content_url";
13209 
13210         /**
13211          * URL for conversation actions model update metadata
13212          * @hide
13213          */
13214         public static final String CONVERSATION_ACTIONS_UPDATE_METADATA_URL =
13215                 "conversation_actions_metadata_url";
13216 
13217         /**
13218          * SELinux enforcement status. If 0, permissive; if 1, enforcing.
13219          * @hide
13220          */
13221         public static final String SELINUX_STATUS = "selinux_status";
13222 
13223         /**
13224          * Developer setting to force RTL layout.
13225          * @hide
13226          */
13227         public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
13228 
13229         /**
13230          * Milliseconds after screen-off after which low battery sounds will be silenced.
13231          *
13232          * If zero, battery sounds will always play.
13233          * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
13234          *
13235          * @hide
13236          */
13237         public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
13238 
13239         /**
13240          * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
13241          * the caller is done with this, they should call {@link ContentResolver#delete} to
13242          * clean up any value that they may have written.
13243          *
13244          * @hide
13245          */
13246         public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
13247 
13248         /**
13249          * Defines global runtime overrides to window policy.
13250          *
13251          * See {@link com.android.server.wm.PolicyControl} for value format.
13252          *
13253          * @hide
13254          */
13255         public static final String POLICY_CONTROL = "policy_control";
13256 
13257         /**
13258          * {@link android.view.DisplayCutout DisplayCutout} emulation mode.
13259          *
13260          * @hide
13261          */
13262         public static final String EMULATE_DISPLAY_CUTOUT = "emulate_display_cutout";
13263 
13264         /** @hide */ public static final int EMULATE_DISPLAY_CUTOUT_OFF = 0;
13265         /** @hide */ public static final int EMULATE_DISPLAY_CUTOUT_ON = 1;
13266 
13267         /**
13268          * A colon separated list of keys for Settings Slices.
13269          *
13270          * @hide
13271          */
13272         public static final String BLOCKED_SLICES = "blocked_slices";
13273 
13274         /**
13275          * Defines global zen mode.  ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
13276          * or ZEN_MODE_NO_INTERRUPTIONS.
13277          *
13278          * @hide
13279          */
13280         @UnsupportedAppUsage
13281         public static final String ZEN_MODE = "zen_mode";
13282 
13283         /** @hide */
13284         @UnsupportedAppUsage
13285         public static final int ZEN_MODE_OFF = 0;
13286         /** @hide */
13287         @UnsupportedAppUsage
13288         public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
13289         /** @hide */
13290         @UnsupportedAppUsage
13291         public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
13292         /** @hide */
13293         @UnsupportedAppUsage
13294         public static final int ZEN_MODE_ALARMS = 3;
13295 
zenModeToString(int mode)13296         /** @hide */ public static String zenModeToString(int mode) {
13297             if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
13298             if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
13299             if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
13300             return "ZEN_MODE_OFF";
13301         }
13302 
isValidZenMode(int value)13303         /** @hide */ public static boolean isValidZenMode(int value) {
13304             switch (value) {
13305                 case Global.ZEN_MODE_OFF:
13306                 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
13307                 case Global.ZEN_MODE_ALARMS:
13308                 case Global.ZEN_MODE_NO_INTERRUPTIONS:
13309                     return true;
13310                 default:
13311                     return false;
13312             }
13313         }
13314 
13315         /**
13316          * Value of the ringer before entering zen mode.
13317          *
13318          * @hide
13319          */
13320         public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
13321 
13322         /**
13323          * Opaque value, changes when persisted zen mode configuration changes.
13324          *
13325          * @hide
13326          */
13327         @UnsupportedAppUsage
13328         public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
13329 
13330         /**
13331          * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION} instead
13332          * @hide
13333          */
13334         @Deprecated
13335         public static final String ZEN_DURATION = "zen_duration";
13336 
13337         private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR;
13338 
13339         /**
13340          * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION_PROMPT} instead
13341          * @hide
13342          */
13343         @Deprecated
13344         public static final int ZEN_DURATION_PROMPT = -1;
13345 
13346         /**
13347          * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION_FOREVER} instead
13348          * @hide
13349          */
13350         @Deprecated
13351         public static final int ZEN_DURATION_FOREVER = 0;
13352 
13353         /**
13354          * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
13355          *
13356          * @hide
13357          */
13358         @UnsupportedAppUsage
13359         public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
13360                 "heads_up_notifications_enabled";
13361 
13362         /** @hide */
13363         @UnsupportedAppUsage
13364         public static final int HEADS_UP_OFF = 0;
13365         /** @hide */
13366         @UnsupportedAppUsage
13367         public static final int HEADS_UP_ON = 1;
13368 
13369         /**
13370          * The name of the device
13371          */
13372         public static final String DEVICE_NAME = "device_name";
13373 
13374         /**
13375          * Whether the NetworkScoringService has been first initialized.
13376          * <p>
13377          * Type: int (0 for false, 1 for true)
13378          * @hide
13379          */
13380         public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
13381 
13382         /**
13383          * Indicates whether the user wants to be prompted for password to decrypt the device on
13384          * boot. This only matters if the storage is encrypted.
13385          * <p>
13386          * Type: int (0 for false, 1 for true)
13387          *
13388          * @hide
13389          */
13390         @SystemApi
13391         public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
13392 
13393         /**
13394          * Whether the Volte is enabled. If this setting is not set then we use the Carrier Config
13395          * value
13396          * {@link android.telephony.CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}.
13397          * <p>
13398          * Type: int (0 for false, 1 for true)
13399          * @hide
13400          * @deprecated Use
13401          * {@link android.provider.Telephony.SimInfo#COLUMN_ENHANCED_4G_MODE_ENABLED} instead.
13402          */
13403         @Deprecated
13404         public static final String ENHANCED_4G_MODE_ENABLED =
13405                 Telephony.SimInfo.COLUMN_ENHANCED_4G_MODE_ENABLED;
13406 
13407         /**
13408          * Whether VT (Video Telephony over IMS) is enabled
13409          * <p>
13410          * Type: int (0 for false, 1 for true)
13411          *
13412          * @hide
13413          * @deprecated Use {@link android.provider.Telephony.SimInfo#COLUMN_VT_IMS_ENABLED} instead.
13414          */
13415         @Deprecated
13416         public static final String VT_IMS_ENABLED = Telephony.SimInfo.COLUMN_VT_IMS_ENABLED;
13417 
13418         /**
13419          * Whether WFC is enabled
13420          * <p>
13421          * Type: int (0 for false, 1 for true)
13422          *
13423          * @hide
13424          * @deprecated Use
13425          * {@link android.provider.Telephony.SimInfo#COLUMN_WFC_IMS_ENABLED} instead.
13426          */
13427         @Deprecated
13428         public static final String WFC_IMS_ENABLED = Telephony.SimInfo.COLUMN_WFC_IMS_ENABLED;
13429 
13430         /**
13431          * WFC mode on home/non-roaming network.
13432          * <p>
13433          * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
13434          *
13435          * @hide
13436          * @deprecated Use {@link android.provider.Telephony.SimInfo#COLUMN_WFC_IMS_MODE} instead.
13437          */
13438         @Deprecated
13439         public static final String WFC_IMS_MODE = Telephony.SimInfo.COLUMN_WFC_IMS_MODE;
13440 
13441         /**
13442          * WFC mode on roaming network.
13443          * <p>
13444          * Type: int - see {@link #WFC_IMS_MODE} for values
13445          *
13446          * @hide
13447          * @deprecated Use {@link android.provider.Telephony.SimInfo#COLUMN_WFC_IMS_ROAMING_MODE}
13448          * instead.
13449          */
13450         @Deprecated
13451         public static final String WFC_IMS_ROAMING_MODE =
13452                 Telephony.SimInfo.COLUMN_WFC_IMS_ROAMING_MODE;
13453 
13454         /**
13455          * Whether WFC roaming is enabled
13456          * <p>
13457          * Type: int (0 for false, 1 for true)
13458          *
13459          * @hide
13460          * @deprecated Use {@link android.provider.Telephony.SimInfo#COLUMN_WFC_IMS_ROAMING_ENABLED}
13461          * instead
13462          */
13463         @Deprecated
13464         public static final String WFC_IMS_ROAMING_ENABLED =
13465                 Telephony.SimInfo.COLUMN_WFC_IMS_ROAMING_ENABLED;
13466 
13467         /**
13468          * Whether user can enable/disable LTE as a preferred network. A carrier might control
13469          * this via gservices, OMA-DM, carrier app, etc.
13470          * <p>
13471          * Type: int (0 for false, 1 for true)
13472          * @hide
13473          */
13474         public static final String LTE_SERVICE_FORCED = "lte_service_forced";
13475 
13476 
13477         /**
13478          * Specifies the behaviour the lid triggers when closed
13479          * <p>
13480          * See WindowManagerPolicy.WindowManagerFuncs
13481          * @hide
13482          */
13483         public static final String LID_BEHAVIOR = "lid_behavior";
13484 
13485         /**
13486          * Ephemeral app cookie max size in bytes.
13487          * <p>
13488          * Type: int
13489          * @hide
13490          */
13491         public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
13492                 "ephemeral_cookie_max_size_bytes";
13493 
13494         /**
13495          * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is
13496          * enabled. Set to zero to disable.
13497          * <p>
13498          * Type: int (0 for false, 1 for true)
13499          *
13500          * @hide
13501          */
13502         public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature";
13503 
13504         /**
13505          * Toggle to enable/disable dexopt for instant applications. The default is for dexopt
13506          * to be disabled.
13507          * <p>
13508          * Type: int (0 to disable, 1 to enable)
13509          *
13510          * @hide
13511          */
13512         public static final String INSTANT_APP_DEXOPT_ENABLED = "instant_app_dexopt_enabled";
13513 
13514         /**
13515          * The min period for caching installed instant apps in milliseconds.
13516          * <p>
13517          * Type: long
13518          * @hide
13519          */
13520         public static final String INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD =
13521                 "installed_instant_app_min_cache_period";
13522 
13523         /**
13524          * The max period for caching installed instant apps in milliseconds.
13525          * <p>
13526          * Type: long
13527          * @hide
13528          */
13529         public static final String INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD =
13530                 "installed_instant_app_max_cache_period";
13531 
13532         /**
13533          * The min period for caching uninstalled instant apps in milliseconds.
13534          * <p>
13535          * Type: long
13536          * @hide
13537          */
13538         public static final String UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD =
13539                 "uninstalled_instant_app_min_cache_period";
13540 
13541         /**
13542          * The max period for caching uninstalled instant apps in milliseconds.
13543          * <p>
13544          * Type: long
13545          * @hide
13546          */
13547         public static final String UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD =
13548                 "uninstalled_instant_app_max_cache_period";
13549 
13550         /**
13551          * The min period for caching unused static shared libs in milliseconds.
13552          * <p>
13553          * Type: long
13554          * @hide
13555          */
13556         public static final String UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD =
13557                 "unused_static_shared_lib_min_cache_period";
13558 
13559         /**
13560          * Allows switching users when system user is locked.
13561          * <p>
13562          * Type: int
13563          * @hide
13564          */
13565         public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED =
13566                 "allow_user_switching_when_system_user_locked";
13567 
13568         /**
13569          * Boot count since the device starts running API level 24.
13570          * <p>
13571          * Type: int
13572          */
13573         public static final String BOOT_COUNT = "boot_count";
13574 
13575         /**
13576          * Whether the safe boot is disallowed.
13577          *
13578          * <p>This setting should have the identical value as the corresponding user restriction.
13579          * The purpose of the setting is to make the restriction available in early boot stages
13580          * before the user restrictions are loaded.
13581          * @hide
13582          */
13583         public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
13584 
13585         /**
13586          * Indicates whether this device is currently in retail demo mode. If true, the device
13587          * usage is severely limited.
13588          * <p>
13589          * Type: int (0 for false, 1 for true)
13590          *
13591          * @hide
13592          */
13593         @SystemApi
13594         public static final String DEVICE_DEMO_MODE = "device_demo_mode";
13595 
13596         /**
13597          * Indicates the maximum time that an app is blocked for the network rules to get updated.
13598          *
13599          * Type: long
13600          *
13601          * @hide
13602          */
13603         public static final String NETWORK_ACCESS_TIMEOUT_MS = "network_access_timeout_ms";
13604 
13605         /**
13606          * The reason for the settings database being downgraded. This is only for
13607          * troubleshooting purposes and its value should not be interpreted in any way.
13608          *
13609          * Type: string
13610          *
13611          * @hide
13612          */
13613         public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
13614 
13615         /**
13616          * The build id of when the settings database was first created (or re-created due it
13617          * being missing).
13618          *
13619          * Type: string
13620          *
13621          * @hide
13622          */
13623         public static final String DATABASE_CREATION_BUILDID = "database_creation_buildid";
13624 
13625         /**
13626          * Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by
13627          * default. Set to 0 to disable.
13628          *
13629          * @hide
13630          */
13631         public static final String CONTACTS_DATABASE_WAL_ENABLED = "contacts_database_wal_enabled";
13632 
13633         /**
13634          * Flag to enable the link to location permissions in location setting. Set to 0 to disable.
13635          *
13636          * @hide
13637          */
13638         public static final String LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED =
13639                 "location_settings_link_to_permissions_enabled";
13640 
13641         /**
13642          * Flag to set the waiting time for removing invisible euicc profiles inside System >
13643          * Settings.
13644          * Type: long
13645          *
13646          * @hide
13647          */
13648         public static final String EUICC_REMOVING_INVISIBLE_PROFILES_TIMEOUT_MILLIS =
13649                 "euicc_removing_invisible_profiles_timeout_millis";
13650 
13651         /**
13652          * Flag to set the waiting time for euicc factory reset inside System > Settings
13653          * Type: long
13654          *
13655          * @hide
13656          */
13657         public static final String EUICC_FACTORY_RESET_TIMEOUT_MILLIS =
13658                 "euicc_factory_reset_timeout_millis";
13659 
13660         /**
13661          * Flag to set the timeout for when to refresh the storage settings cached data.
13662          * Type: long
13663          *
13664          * @hide
13665          */
13666         public static final String STORAGE_SETTINGS_CLOBBER_THRESHOLD =
13667                 "storage_settings_clobber_threshold";
13668 
13669         /**
13670          * If set to 1, {@link Secure#LOCATION_MODE} will be set to {@link Secure#LOCATION_MODE_OFF}
13671          * temporarily for all users.
13672          *
13673          * @hide
13674          */
13675         @TestApi
13676         public static final String LOCATION_GLOBAL_KILL_SWITCH =
13677                 "location_global_kill_switch";
13678 
13679         /**
13680          * If set to 1, SettingsProvider's restoreAnyVersion="true" attribute will be ignored
13681          * and restoring to lower version of platform API will be skipped.
13682          *
13683          * @hide
13684          */
13685         public static final String OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION =
13686                 "override_settings_provider_restore_any_version";
13687         /**
13688          * Flag to toggle whether system services report attribution chains when they attribute
13689          * battery use via a {@code WorkSource}.
13690          *
13691          * Type: int (0 to disable, 1 to enable)
13692          *
13693          * @hide
13694          */
13695         public static final String CHAINED_BATTERY_ATTRIBUTION_ENABLED =
13696                 "chained_battery_attribution_enabled";
13697 
13698         /**
13699          * The packages whitelisted to be run in autofill compatibility mode. The list
13700          * of packages is {@code ":"} colon delimited, and each entry has the name of the
13701          * package and an optional list of url bar resource ids (the list is delimited by
13702          * brackets&mdash{@code [} and {@code ]}&mdash and is also comma delimited).
13703          *
13704          * <p>For example, a list with 3 packages {@code p1}, {@code p2}, and {@code p3}, where
13705          * package {@code p1} have one id ({@code url_bar}, {@code p2} has none, and {@code p3 }
13706          * have 2 ids {@code url_foo} and {@code url_bas}) would be
13707          * {@code p1[url_bar]:p2:p3[url_foo,url_bas]}
13708          *
13709          * @hide
13710          */
13711         @SystemApi
13712         @TestApi
13713         public static final String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES =
13714                 "autofill_compat_mode_allowed_packages";
13715 
13716         /**
13717          * Level of autofill logging.
13718          *
13719          * <p>Valid values are
13720          * {@link android.view.autofill.AutofillManager#NO_LOGGING},
13721          * {@link android.view.autofill.AutofillManager#FLAG_ADD_CLIENT_DEBUG}, or
13722          * {@link android.view.autofill.AutofillManager#FLAG_ADD_CLIENT_VERBOSE}.
13723          *
13724          * @hide
13725          */
13726         public static final String AUTOFILL_LOGGING_LEVEL = "autofill_logging_level";
13727 
13728         /**
13729          * Maximum number of partitions that can be allowed in an autofill session.
13730          *
13731          * @hide
13732          */
13733         public static final String AUTOFILL_MAX_PARTITIONS_SIZE = "autofill_max_partitions_size";
13734 
13735         /**
13736          * Maximum number of visible datasets in the Autofill dataset picker UI, or {@code 0} to use
13737          * the default value from resources.
13738          *
13739          * @hide
13740          */
13741         public static final String AUTOFILL_MAX_VISIBLE_DATASETS = "autofill_max_visible_datasets";
13742 
13743         /**
13744          * Exemptions to the hidden API blacklist.
13745          *
13746          * @hide
13747          */
13748         @TestApi
13749         public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS =
13750                 "hidden_api_blacklist_exemptions";
13751 
13752         /**
13753          * Hidden API enforcement policy for apps.
13754          *
13755          * Values correspond to @{@link
13756          * android.content.pm.ApplicationInfo.HiddenApiEnforcementPolicy}
13757          *
13758          * @hide
13759          */
13760         public static final String HIDDEN_API_POLICY = "hidden_api_policy";
13761 
13762         /**
13763          * Current version of signed configuration applied.
13764          *
13765          * @hide
13766          */
13767         public static final String SIGNED_CONFIG_VERSION = "signed_config_version";
13768 
13769         /**
13770          * Timeout for a single {@link android.media.soundtrigger.SoundTriggerDetectionService}
13771          * operation (in ms).
13772          *
13773          * @hide
13774          */
13775         public static final String SOUND_TRIGGER_DETECTION_SERVICE_OP_TIMEOUT =
13776                 "sound_trigger_detection_service_op_timeout";
13777 
13778         /**
13779          * Maximum number of {@link android.media.soundtrigger.SoundTriggerDetectionService}
13780          * operations per day.
13781          *
13782          * @hide
13783          */
13784         public static final String MAX_SOUND_TRIGGER_DETECTION_SERVICE_OPS_PER_DAY =
13785                 "max_sound_trigger_detection_service_ops_per_day";
13786 
13787         /** {@hide} */
13788         public static final String ISOLATED_STORAGE_LOCAL = "isolated_storage_local";
13789         /** {@hide} */
13790         public static final String ISOLATED_STORAGE_REMOTE = "isolated_storage_remote";
13791 
13792         /**
13793          * Indicates whether aware is available in the current location.
13794          * @hide
13795          */
13796         public static final String AWARE_ALLOWED = "aware_allowed";
13797 
13798         private static final Validator AWARE_ALLOWED_VALIDATOR = BOOLEAN_VALIDATOR;
13799 
13800         /**
13801          * Overrides internal R.integer.config_longPressOnPowerBehavior.
13802          * Allowable values detailed in frameworks/base/core/res/res/values/config.xml.
13803          * Used by PhoneWindowManager.
13804          * @hide
13805          */
13806         public static final String POWER_BUTTON_LONG_PRESS =
13807                 "power_button_long_press";
13808         private static final Validator POWER_BUTTON_LONG_PRESS_VALIDATOR =
13809                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 5);
13810 
13811         /**
13812          * Overrides internal R.integer.config_veryLongPressOnPowerBehavior.
13813          * Allowable values detailed in frameworks/base/core/res/res/values/config.xml.
13814          * Used by PhoneWindowManager.
13815          * @hide
13816          */
13817         public static final String POWER_BUTTON_VERY_LONG_PRESS =
13818                 "power_button_very_long_press";
13819         private static final Validator POWER_BUTTON_VERY_LONG_PRESS_VALIDATOR =
13820                 new SettingsValidators.InclusiveIntegerRangeValidator(0, 1);
13821 
13822         /**
13823          * Settings to backup. This is here so that it's in the same place as the settings
13824          * keys and easy to update.
13825          *
13826          * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
13827          * and Secure as well.  This is because those tables drive both backup and
13828          * restore, and restore needs to properly whitelist keys that used to live
13829          * in those namespaces.  The keys will only actually be backed up / restored
13830          * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
13831          *
13832          * NOTE: Settings are backed up and restored in the order they appear
13833          *       in this array. If you have one setting depending on another,
13834          *       make sure that they are ordered appropriately.
13835          *
13836          * @hide
13837          */
13838         public static final String[] SETTINGS_TO_BACKUP = {
13839             APPLY_RAMPING_RINGER,
13840             BUGREPORT_IN_POWER_MENU,
13841             STAY_ON_WHILE_PLUGGED_IN,
13842             APP_AUTO_RESTRICTION_ENABLED,
13843             AUTO_TIME,
13844             AUTO_TIME_ZONE,
13845             POWER_SOUNDS_ENABLED,
13846             DOCK_SOUNDS_ENABLED,
13847             CHARGING_SOUNDS_ENABLED,
13848             USB_MASS_STORAGE_ENABLED,
13849             NETWORK_RECOMMENDATIONS_ENABLED,
13850             WIFI_WAKEUP_ENABLED,
13851             WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
13852             WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON,
13853             USE_OPEN_WIFI_PACKAGE,
13854             WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
13855             EMERGENCY_TONE,
13856             CALL_AUTO_RETRY,
13857             DOCK_AUDIO_MEDIA_ENABLED,
13858             ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS,
13859             ENCODED_SURROUND_OUTPUT,
13860             ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS,
13861             LOW_POWER_MODE_TRIGGER_LEVEL,
13862             LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED,
13863             LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL,
13864             BLUETOOTH_ON,
13865             PRIVATE_DNS_MODE,
13866             PRIVATE_DNS_SPECIFIER,
13867             SOFT_AP_TIMEOUT_ENABLED,
13868             ZEN_DURATION,
13869             CHARGING_VIBRATION_ENABLED,
13870             AWARE_ALLOWED,
13871             NOTIFICATION_BUBBLES,
13872         };
13873 
13874         /**
13875          * All settings in {@link SETTINGS_TO_BACKUP} array *must* have a non-null validator,
13876          * otherwise they won't be restored.
13877          *
13878          * @hide
13879          */
13880         public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
13881         static {
VALIDATORS.put(APPLY_RAMPING_RINGER, APPLY_RAMPING_RINGER_VALIDATOR)13882             VALIDATORS.put(APPLY_RAMPING_RINGER, APPLY_RAMPING_RINGER_VALIDATOR);
VALIDATORS.put(BUGREPORT_IN_POWER_MENU, BUGREPORT_IN_POWER_MENU_VALIDATOR)13883             VALIDATORS.put(BUGREPORT_IN_POWER_MENU, BUGREPORT_IN_POWER_MENU_VALIDATOR);
VALIDATORS.put(STAY_ON_WHILE_PLUGGED_IN, STAY_ON_WHILE_PLUGGED_IN_VALIDATOR)13884             VALIDATORS.put(STAY_ON_WHILE_PLUGGED_IN, STAY_ON_WHILE_PLUGGED_IN_VALIDATOR);
VALIDATORS.put(AUTO_TIME, AUTO_TIME_VALIDATOR)13885             VALIDATORS.put(AUTO_TIME, AUTO_TIME_VALIDATOR);
VALIDATORS.put(AUTO_TIME_ZONE, AUTO_TIME_ZONE_VALIDATOR)13886             VALIDATORS.put(AUTO_TIME_ZONE, AUTO_TIME_ZONE_VALIDATOR);
VALIDATORS.put(POWER_SOUNDS_ENABLED, POWER_SOUNDS_ENABLED_VALIDATOR)13887             VALIDATORS.put(POWER_SOUNDS_ENABLED, POWER_SOUNDS_ENABLED_VALIDATOR);
VALIDATORS.put(DOCK_SOUNDS_ENABLED, DOCK_SOUNDS_ENABLED_VALIDATOR)13888             VALIDATORS.put(DOCK_SOUNDS_ENABLED, DOCK_SOUNDS_ENABLED_VALIDATOR);
VALIDATORS.put(CHARGING_SOUNDS_ENABLED, CHARGING_SOUNDS_ENABLED_VALIDATOR)13889             VALIDATORS.put(CHARGING_SOUNDS_ENABLED, CHARGING_SOUNDS_ENABLED_VALIDATOR);
VALIDATORS.put(USB_MASS_STORAGE_ENABLED, USB_MASS_STORAGE_ENABLED_VALIDATOR)13890             VALIDATORS.put(USB_MASS_STORAGE_ENABLED, USB_MASS_STORAGE_ENABLED_VALIDATOR);
VALIDATORS.put(NETWORK_RECOMMENDATIONS_ENABLED, NETWORK_RECOMMENDATIONS_ENABLED_VALIDATOR)13891             VALIDATORS.put(NETWORK_RECOMMENDATIONS_ENABLED,
13892                     NETWORK_RECOMMENDATIONS_ENABLED_VALIDATOR);
VALIDATORS.put(WIFI_WAKEUP_ENABLED, WIFI_WAKEUP_ENABLED_VALIDATOR)13893             VALIDATORS.put(WIFI_WAKEUP_ENABLED, WIFI_WAKEUP_ENABLED_VALIDATOR);
VALIDATORS.put(WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR)13894             VALIDATORS.put(WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
13895                     WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR);
VALIDATORS.put(USE_OPEN_WIFI_PACKAGE, USE_OPEN_WIFI_PACKAGE_VALIDATOR)13896             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)13897             VALIDATORS.put(WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
13898                     WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED_VALIDATOR);
VALIDATORS.put(EMERGENCY_TONE, EMERGENCY_TONE_VALIDATOR)13899             VALIDATORS.put(EMERGENCY_TONE, EMERGENCY_TONE_VALIDATOR);
VALIDATORS.put(CALL_AUTO_RETRY, CALL_AUTO_RETRY_VALIDATOR)13900             VALIDATORS.put(CALL_AUTO_RETRY, CALL_AUTO_RETRY_VALIDATOR);
VALIDATORS.put(DOCK_AUDIO_MEDIA_ENABLED, DOCK_AUDIO_MEDIA_ENABLED_VALIDATOR)13901             VALIDATORS.put(DOCK_AUDIO_MEDIA_ENABLED, DOCK_AUDIO_MEDIA_ENABLED_VALIDATOR);
VALIDATORS.put(ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_VALIDATOR)13902             VALIDATORS.put(ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS,
13903                     ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_VALIDATOR);
VALIDATORS.put(ENCODED_SURROUND_OUTPUT, ENCODED_SURROUND_OUTPUT_VALIDATOR)13904             VALIDATORS.put(ENCODED_SURROUND_OUTPUT, ENCODED_SURROUND_OUTPUT_VALIDATOR);
VALIDATORS.put(ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS, ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS_VALIDATOR)13905             VALIDATORS.put(ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS,
13906                     ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS_VALIDATOR);
VALIDATORS.put(LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL, LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL_VALIDATOR)13907             VALIDATORS.put(LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL,
13908                     LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL_VALIDATOR);
VALIDATORS.put(LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED, LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED_VALIDATOR)13909             VALIDATORS.put(LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED,
13910                     LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED_VALIDATOR);
VALIDATORS.put(LOW_POWER_MODE_TRIGGER_LEVEL, LOW_POWER_MODE_TRIGGER_LEVEL_VALIDATOR)13911             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)13912             VALIDATORS.put(LOW_POWER_MODE_TRIGGER_LEVEL_MAX,
13913                     LOW_POWER_MODE_TRIGGER_LEVEL_VALIDATOR);
VALIDATORS.put(AUTOMATIC_POWER_SAVE_MODE, AUTOMATIC_POWER_SAVE_MODE_VALIDATOR)13914             VALIDATORS.put(AUTOMATIC_POWER_SAVE_MODE, AUTOMATIC_POWER_SAVE_MODE_VALIDATOR);
VALIDATORS.put(DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD, DYNAMIC_POWER_SAVINGS_VALIDATOR)13915             VALIDATORS.put(DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
13916                     DYNAMIC_POWER_SAVINGS_VALIDATOR);
VALIDATORS.put(BLUETOOTH_ON, BLUETOOTH_ON_VALIDATOR)13917             VALIDATORS.put(BLUETOOTH_ON, BLUETOOTH_ON_VALIDATOR);
VALIDATORS.put(EUICC_UNSUPPORTED_COUNTRIES, EUICC_UNSUPPORTED_COUNTRIES_VALIDATOR)13918             VALIDATORS.put(EUICC_UNSUPPORTED_COUNTRIES, EUICC_UNSUPPORTED_COUNTRIES_VALIDATOR);
VALIDATORS.put(PRIVATE_DNS_MODE, PRIVATE_DNS_MODE_VALIDATOR)13919             VALIDATORS.put(PRIVATE_DNS_MODE, PRIVATE_DNS_MODE_VALIDATOR);
VALIDATORS.put(PRIVATE_DNS_SPECIFIER, PRIVATE_DNS_SPECIFIER_VALIDATOR)13920             VALIDATORS.put(PRIVATE_DNS_SPECIFIER, PRIVATE_DNS_SPECIFIER_VALIDATOR);
VALIDATORS.put(SOFT_AP_TIMEOUT_ENABLED, SOFT_AP_TIMEOUT_ENABLED_VALIDATOR)13921             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)13922             VALIDATORS.put(WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON,
13923                     WIFI_CARRIER_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR);
VALIDATORS.put(WIFI_SCAN_THROTTLE_ENABLED, WIFI_SCAN_THROTTLE_ENABLED_VALIDATOR)13924             VALIDATORS.put(WIFI_SCAN_THROTTLE_ENABLED, WIFI_SCAN_THROTTLE_ENABLED_VALIDATOR);
VALIDATORS.put(APP_AUTO_RESTRICTION_ENABLED, APP_AUTO_RESTRICTION_ENABLED_VALIDATOR)13925             VALIDATORS.put(APP_AUTO_RESTRICTION_ENABLED, APP_AUTO_RESTRICTION_ENABLED_VALIDATOR);
VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR)13926             VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR);
VALIDATORS.put(CHARGING_VIBRATION_ENABLED, CHARGING_VIBRATION_ENABLED_VALIDATOR)13927             VALIDATORS.put(CHARGING_VIBRATION_ENABLED, CHARGING_VIBRATION_ENABLED_VALIDATOR);
VALIDATORS.put(DEVICE_PROVISIONING_MOBILE_DATA_ENABLED, BOOLEAN_VALIDATOR)13928             VALIDATORS.put(DEVICE_PROVISIONING_MOBILE_DATA_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(REQUIRE_PASSWORD_TO_DECRYPT, BOOLEAN_VALIDATOR)13929             VALIDATORS.put(REQUIRE_PASSWORD_TO_DECRYPT, BOOLEAN_VALIDATOR);
VALIDATORS.put(DEVICE_DEMO_MODE, BOOLEAN_VALIDATOR)13930             VALIDATORS.put(DEVICE_DEMO_MODE, BOOLEAN_VALIDATOR);
VALIDATORS.put(WIFI_PNO_FREQUENCY_CULLING_ENABLED, WIFI_PNO_FREQUENCY_CULLING_ENABLED_VALIDATOR)13931             VALIDATORS.put(WIFI_PNO_FREQUENCY_CULLING_ENABLED,
13932                     WIFI_PNO_FREQUENCY_CULLING_ENABLED_VALIDATOR);
VALIDATORS.put(WIFI_PNO_RECENCY_SORTING_ENABLED, WIFI_PNO_RECENCY_SORTING_ENABLED_VALIDATOR)13933             VALIDATORS.put(WIFI_PNO_RECENCY_SORTING_ENABLED,
13934                     WIFI_PNO_RECENCY_SORTING_ENABLED_VALIDATOR);
VALIDATORS.put(WIFI_LINK_PROBING_ENABLED, WIFI_LINK_PROBING_ENABLED_VALIDATOR)13935             VALIDATORS.put(WIFI_LINK_PROBING_ENABLED, WIFI_LINK_PROBING_ENABLED_VALIDATOR);
VALIDATORS.put(AWARE_ALLOWED, AWARE_ALLOWED_VALIDATOR)13936             VALIDATORS.put(AWARE_ALLOWED, AWARE_ALLOWED_VALIDATOR);
VALIDATORS.put(POWER_BUTTON_LONG_PRESS, POWER_BUTTON_LONG_PRESS_VALIDATOR)13937             VALIDATORS.put(POWER_BUTTON_LONG_PRESS, POWER_BUTTON_LONG_PRESS_VALIDATOR);
VALIDATORS.put(POWER_BUTTON_VERY_LONG_PRESS, POWER_BUTTON_VERY_LONG_PRESS_VALIDATOR)13938             VALIDATORS.put(POWER_BUTTON_VERY_LONG_PRESS, POWER_BUTTON_VERY_LONG_PRESS_VALIDATOR);
VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR)13939             VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR);
13940         }
13941 
13942         /**
13943          * Global settings that shouldn't be persisted.
13944          *
13945          * @hide
13946          */
13947         public static final String[] TRANSIENT_SETTINGS = {
13948                 LOCATION_GLOBAL_KILL_SWITCH,
13949         };
13950 
13951         /**
13952          * Keys we no longer back up under the current schema, but want to continue to
13953          * process when restoring historical backup datasets.
13954          *
13955          * All settings in {@link LEGACY_RESTORE_SETTINGS} array *must* have a non-null validator,
13956          * otherwise they won't be restored.
13957          *
13958          * @hide
13959          */
13960         public static final String[] LEGACY_RESTORE_SETTINGS = {
13961         };
13962 
13963         @UnsupportedAppUsage
13964         private static final ContentProviderHolder sProviderHolder =
13965                 new ContentProviderHolder(CONTENT_URI);
13966 
13967         // Populated lazily, guarded by class object:
13968         @UnsupportedAppUsage
13969         private static final NameValueCache sNameValueCache = new NameValueCache(
13970                     CONTENT_URI,
13971                     CALL_METHOD_GET_GLOBAL,
13972                     CALL_METHOD_PUT_GLOBAL,
13973                     sProviderHolder);
13974 
13975         // Certain settings have been moved from global to the per-user secure namespace
13976         @UnsupportedAppUsage
13977         private static final HashSet<String> MOVED_TO_SECURE;
13978         static {
13979             MOVED_TO_SECURE = new HashSet<>(8);
13980             MOVED_TO_SECURE.add(Global.INSTALL_NON_MARKET_APPS);
13981             MOVED_TO_SECURE.add(Global.ZEN_DURATION);
13982             MOVED_TO_SECURE.add(Global.SHOW_ZEN_UPGRADE_NOTIFICATION);
13983             MOVED_TO_SECURE.add(Global.SHOW_ZEN_SETTINGS_SUGGESTION);
13984             MOVED_TO_SECURE.add(Global.ZEN_SETTINGS_UPDATED);
13985             MOVED_TO_SECURE.add(Global.ZEN_SETTINGS_SUGGESTION_VIEWED);
13986             MOVED_TO_SECURE.add(Global.CHARGING_SOUNDS_ENABLED);
13987             MOVED_TO_SECURE.add(Global.CHARGING_VIBRATION_ENABLED);
13988 
13989         }
13990 
13991         /** @hide */
getMovedToSecureSettings(Set<String> outKeySet)13992         public static void getMovedToSecureSettings(Set<String> outKeySet) {
13993             outKeySet.addAll(MOVED_TO_SECURE);
13994         }
13995 
13996         /** @hide */
clearProviderForTest()13997         public static void clearProviderForTest() {
13998             sProviderHolder.clearProviderForTest();
13999             sNameValueCache.clearGenerationTrackerForTest();
14000         }
14001 
14002         /**
14003          * Look up a name in the database.
14004          * @param resolver to access the database with
14005          * @param name to look up in the table
14006          * @return the corresponding value, or null if not present
14007          */
getString(ContentResolver resolver, String name)14008         public static String getString(ContentResolver resolver, String name) {
14009             return getStringForUser(resolver, name, resolver.getUserId());
14010         }
14011 
14012         /** @hide */
14013         @UnsupportedAppUsage
getStringForUser(ContentResolver resolver, String name, int userHandle)14014         public static String getStringForUser(ContentResolver resolver, String name,
14015                 int userHandle) {
14016             if (MOVED_TO_SECURE.contains(name)) {
14017                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
14018                         + " to android.provider.Settings.Secure, returning read-only value.");
14019                 return Secure.getStringForUser(resolver, name, userHandle);
14020             }
14021             return sNameValueCache.getStringForUser(resolver, name, userHandle);
14022         }
14023 
14024         /**
14025          * Store a name/value pair into the database.
14026          * @param resolver to access the database with
14027          * @param name to store
14028          * @param value to associate with the name
14029          * @return true if the value was set, false on database errors
14030          */
putString(ContentResolver resolver, String name, String value)14031         public static boolean putString(ContentResolver resolver,
14032                 String name, String value) {
14033             return putStringForUser(resolver, name, value, null, false, resolver.getUserId());
14034         }
14035 
14036         /**
14037          * Store a name/value pair into the database.
14038          * <p>
14039          * The method takes an optional tag to associate with the setting
14040          * which can be used to clear only settings made by your package and
14041          * associated with this tag by passing the tag to {@link
14042          * #resetToDefaults(ContentResolver, String)}. Anyone can override
14043          * the current tag. Also if another package changes the setting
14044          * then the tag will be set to the one specified in the set call
14045          * which can be null. Also any of the settings setters that do not
14046          * take a tag as an argument effectively clears the tag.
14047          * </p><p>
14048          * For example, if you set settings A and B with tags T1 and T2 and
14049          * another app changes setting A (potentially to the same value), it
14050          * can assign to it a tag T3 (note that now the package that changed
14051          * the setting is not yours). Now if you reset your changes for T1 and
14052          * T2 only setting B will be reset and A not (as it was changed by
14053          * another package) but since A did not change you are in the desired
14054          * initial state. Now if the other app changes the value of A (assuming
14055          * you registered an observer in the beginning) you would detect that
14056          * the setting was changed by another app and handle this appropriately
14057          * (ignore, set back to some value, etc).
14058          * </p><p>
14059          * Also the method takes an argument whether to make the value the
14060          * default for this setting. If the system already specified a default
14061          * value, then the one passed in here will <strong>not</strong>
14062          * be set as the default.
14063          * </p>
14064          *
14065          * @param resolver to access the database with.
14066          * @param name to store.
14067          * @param value to associate with the name.
14068          * @param tag to associated with the setting.
14069          * @param makeDefault whether to make the value the default one.
14070          * @return true if the value was set, false on database errors.
14071          *
14072          * @see #resetToDefaults(ContentResolver, String)
14073          *
14074          * @hide
14075          */
14076         @SystemApi
14077         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
putString(@onNull ContentResolver resolver, @NonNull String name, @Nullable String value, @Nullable String tag, boolean makeDefault)14078         public static boolean putString(@NonNull ContentResolver resolver,
14079                 @NonNull String name, @Nullable String value, @Nullable String tag,
14080                 boolean makeDefault) {
14081             return putStringForUser(resolver, name, value, tag, makeDefault,
14082                     resolver.getUserId());
14083         }
14084 
14085         /**
14086          * Reset the settings to their defaults. This would reset <strong>only</strong>
14087          * settings set by the caller's package. Think of it of a way to undo your own
14088          * changes to the secure settings. Passing in the optional tag will reset only
14089          * settings changed by your package and associated with this tag.
14090          *
14091          * @param resolver Handle to the content resolver.
14092          * @param tag Optional tag which should be associated with the settings to reset.
14093          *
14094          * @see #putString(ContentResolver, String, String, String, boolean)
14095          *
14096          * @hide
14097          */
14098         @SystemApi
14099         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
resetToDefaults(@onNull ContentResolver resolver, @Nullable String tag)14100         public static void resetToDefaults(@NonNull ContentResolver resolver,
14101                 @Nullable String tag) {
14102             resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
14103                     resolver.getUserId());
14104         }
14105 
14106         /**
14107          * Reset the settings to their defaults for a given user with a specific mode. The
14108          * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
14109          * allowing resetting the settings made by a package and associated with the tag.
14110          *
14111          * @param resolver Handle to the content resolver.
14112          * @param tag Optional tag which should be associated with the settings to reset.
14113          * @param mode The reset mode.
14114          * @param userHandle The user for which to reset to defaults.
14115          *
14116          * @see #RESET_MODE_PACKAGE_DEFAULTS
14117          * @see #RESET_MODE_UNTRUSTED_DEFAULTS
14118          * @see #RESET_MODE_UNTRUSTED_CHANGES
14119          * @see #RESET_MODE_TRUSTED_DEFAULTS
14120          *
14121          * @hide
14122          */
resetToDefaultsAsUser(@onNull ContentResolver resolver, @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle)14123         public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
14124                 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
14125             try {
14126                 Bundle arg = new Bundle();
14127                 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
14128                 if (tag != null) {
14129                     arg.putString(CALL_METHOD_TAG_KEY, tag);
14130                 }
14131                 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
14132                 IContentProvider cp = sProviderHolder.getProvider(resolver);
14133                 cp.call(resolver.getPackageName(), sProviderHolder.mUri.getAuthority(),
14134                         CALL_METHOD_RESET_GLOBAL, null, arg);
14135             } catch (RemoteException e) {
14136                 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
14137             }
14138         }
14139 
14140         /** @hide */
14141         @UnsupportedAppUsage
putStringForUser(ContentResolver resolver, String name, String value, int userHandle)14142         public static boolean putStringForUser(ContentResolver resolver,
14143                 String name, String value, int userHandle) {
14144             return putStringForUser(resolver, name, value, null, false, userHandle);
14145         }
14146 
14147         /** @hide */
putStringForUser(@onNull ContentResolver resolver, @NonNull String name, @Nullable String value, @Nullable String tag, boolean makeDefault, @UserIdInt int userHandle)14148         public static boolean putStringForUser(@NonNull ContentResolver resolver,
14149                 @NonNull String name, @Nullable String value, @Nullable String tag,
14150                 boolean makeDefault, @UserIdInt int userHandle) {
14151             if (LOCAL_LOGV) {
14152                 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
14153                         + " for " + userHandle);
14154             }
14155             // Global and Secure have the same access policy so we can forward writes
14156             if (MOVED_TO_SECURE.contains(name)) {
14157                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
14158                         + " to android.provider.Settings.Secure, value is unchanged.");
14159                 return Secure.putStringForUser(resolver, name, value, tag,
14160                         makeDefault, userHandle);
14161             }
14162             return sNameValueCache.putStringForUser(resolver, name, value, tag,
14163                     makeDefault, userHandle);
14164         }
14165 
14166         /**
14167          * Construct the content URI for a particular name/value pair,
14168          * useful for monitoring changes with a ContentObserver.
14169          * @param name to look up in the table
14170          * @return the corresponding content URI, or null if not present
14171          */
getUriFor(String name)14172         public static Uri getUriFor(String name) {
14173             return getUriFor(CONTENT_URI, name);
14174         }
14175 
14176         /**
14177          * Convenience function for retrieving a single secure settings value
14178          * as an integer.  Note that internally setting values are always
14179          * stored as strings; this function converts the string to an integer
14180          * for you.  The default value will be returned if the setting is
14181          * not defined or not an integer.
14182          *
14183          * @param cr The ContentResolver to access.
14184          * @param name The name of the setting to retrieve.
14185          * @param def Value to return if the setting is not defined.
14186          *
14187          * @return The setting's current value, or 'def' if it is not defined
14188          * or not a valid integer.
14189          */
getInt(ContentResolver cr, String name, int def)14190         public static int getInt(ContentResolver cr, String name, int def) {
14191             String v = getString(cr, name);
14192             try {
14193                 return v != null ? Integer.parseInt(v) : def;
14194             } catch (NumberFormatException e) {
14195                 return def;
14196             }
14197         }
14198 
14199         /**
14200          * Convenience function for retrieving a single secure settings value
14201          * as an integer.  Note that internally setting values are always
14202          * stored as strings; this function converts the string to an integer
14203          * for you.
14204          * <p>
14205          * This version does not take a default value.  If the setting has not
14206          * been set, or the string value is not a number,
14207          * it throws {@link SettingNotFoundException}.
14208          *
14209          * @param cr The ContentResolver to access.
14210          * @param name The name of the setting to retrieve.
14211          *
14212          * @throws SettingNotFoundException Thrown if a setting by the given
14213          * name can't be found or the setting value is not an integer.
14214          *
14215          * @return The setting's current value.
14216          */
getInt(ContentResolver cr, String name)14217         public static int getInt(ContentResolver cr, String name)
14218                 throws SettingNotFoundException {
14219             String v = getString(cr, name);
14220             try {
14221                 return Integer.parseInt(v);
14222             } catch (NumberFormatException e) {
14223                 throw new SettingNotFoundException(name);
14224             }
14225         }
14226 
14227         /**
14228          * Convenience function for updating a single settings value as an
14229          * integer. This will either create a new entry in the table if the
14230          * given name does not exist, or modify the value of the existing row
14231          * with that name.  Note that internally setting values are always
14232          * stored as strings, so this function converts the given value to a
14233          * string before storing it.
14234          *
14235          * @param cr The ContentResolver to access.
14236          * @param name The name of the setting to modify.
14237          * @param value The new value for the setting.
14238          * @return true if the value was set, false on database errors
14239          */
putInt(ContentResolver cr, String name, int value)14240         public static boolean putInt(ContentResolver cr, String name, int value) {
14241             return putString(cr, name, Integer.toString(value));
14242         }
14243 
14244         /**
14245          * Convenience function for retrieving a single secure settings value
14246          * as a {@code long}.  Note that internally setting values are always
14247          * stored as strings; this function converts the string to a {@code long}
14248          * for you.  The default value will be returned if the setting is
14249          * not defined or not a {@code long}.
14250          *
14251          * @param cr The ContentResolver to access.
14252          * @param name The name of the setting to retrieve.
14253          * @param def Value to return if the setting is not defined.
14254          *
14255          * @return The setting's current value, or 'def' if it is not defined
14256          * or not a valid {@code long}.
14257          */
getLong(ContentResolver cr, String name, long def)14258         public static long getLong(ContentResolver cr, String name, long def) {
14259             String valString = getString(cr, name);
14260             long value;
14261             try {
14262                 value = valString != null ? Long.parseLong(valString) : def;
14263             } catch (NumberFormatException e) {
14264                 value = def;
14265             }
14266             return value;
14267         }
14268 
14269         /**
14270          * Convenience function for retrieving a single secure settings value
14271          * as a {@code long}.  Note that internally setting values are always
14272          * stored as strings; this function converts the string to a {@code long}
14273          * for you.
14274          * <p>
14275          * This version does not take a default value.  If the setting has not
14276          * been set, or the string value is not a number,
14277          * it throws {@link SettingNotFoundException}.
14278          *
14279          * @param cr The ContentResolver to access.
14280          * @param name The name of the setting to retrieve.
14281          *
14282          * @return The setting's current value.
14283          * @throws SettingNotFoundException Thrown if a setting by the given
14284          * name can't be found or the setting value is not an integer.
14285          */
getLong(ContentResolver cr, String name)14286         public static long getLong(ContentResolver cr, String name)
14287                 throws SettingNotFoundException {
14288             String valString = getString(cr, name);
14289             try {
14290                 return Long.parseLong(valString);
14291             } catch (NumberFormatException e) {
14292                 throw new SettingNotFoundException(name);
14293             }
14294         }
14295 
14296         /**
14297          * Convenience function for updating a secure settings value as a long
14298          * integer. This will either create a new entry in the table if the
14299          * given name does not exist, or modify the value of the existing row
14300          * with that name.  Note that internally setting values are always
14301          * stored as strings, so this function converts the given value to a
14302          * string before storing it.
14303          *
14304          * @param cr The ContentResolver to access.
14305          * @param name The name of the setting to modify.
14306          * @param value The new value for the setting.
14307          * @return true if the value was set, false on database errors
14308          */
putLong(ContentResolver cr, String name, long value)14309         public static boolean putLong(ContentResolver cr, String name, long value) {
14310             return putString(cr, name, Long.toString(value));
14311         }
14312 
14313         /**
14314          * Convenience function for retrieving a single secure settings value
14315          * as a floating point number.  Note that internally setting values are
14316          * always stored as strings; this function converts the string to an
14317          * float for you. The default value will be returned if the setting
14318          * is not defined or not a valid float.
14319          *
14320          * @param cr The ContentResolver to access.
14321          * @param name The name of the setting to retrieve.
14322          * @param def Value to return if the setting is not defined.
14323          *
14324          * @return The setting's current value, or 'def' if it is not defined
14325          * or not a valid float.
14326          */
getFloat(ContentResolver cr, String name, float def)14327         public static float getFloat(ContentResolver cr, String name, float def) {
14328             String v = getString(cr, name);
14329             try {
14330                 return v != null ? Float.parseFloat(v) : def;
14331             } catch (NumberFormatException e) {
14332                 return def;
14333             }
14334         }
14335 
14336         /**
14337          * Convenience function for retrieving a single secure settings value
14338          * as a float.  Note that internally setting values are always
14339          * stored as strings; this function converts the string to a float
14340          * for you.
14341          * <p>
14342          * This version does not take a default value.  If the setting has not
14343          * been set, or the string value is not a number,
14344          * it throws {@link SettingNotFoundException}.
14345          *
14346          * @param cr The ContentResolver to access.
14347          * @param name The name of the setting to retrieve.
14348          *
14349          * @throws SettingNotFoundException Thrown if a setting by the given
14350          * name can't be found or the setting value is not a float.
14351          *
14352          * @return The setting's current value.
14353          */
getFloat(ContentResolver cr, String name)14354         public static float getFloat(ContentResolver cr, String name)
14355                 throws SettingNotFoundException {
14356             String v = getString(cr, name);
14357             if (v == null) {
14358                 throw new SettingNotFoundException(name);
14359             }
14360             try {
14361                 return Float.parseFloat(v);
14362             } catch (NumberFormatException e) {
14363                 throw new SettingNotFoundException(name);
14364             }
14365         }
14366 
14367         /**
14368          * Convenience function for updating a single settings value as a
14369          * floating point number. This will either create a new entry in the
14370          * table if the given name does not exist, or modify the value of the
14371          * existing row with that name.  Note that internally setting values
14372          * are always stored as strings, so this function converts the given
14373          * value to a string before storing it.
14374          *
14375          * @param cr The ContentResolver to access.
14376          * @param name The name of the setting to modify.
14377          * @param value The new value for the setting.
14378          * @return true if the value was set, false on database errors
14379          */
putFloat(ContentResolver cr, String name, float value)14380         public static boolean putFloat(ContentResolver cr, String name, float value) {
14381             return putString(cr, name, Float.toString(value));
14382         }
14383 
14384         /**
14385           * Subscription Id to be used for voice call on a multi sim device.
14386           * @hide
14387           */
14388         public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
14389 
14390         /**
14391           * Used to provide option to user to select subscription during dial.
14392           * The supported values are 0 = disable or 1 = enable prompt.
14393           * @hide
14394           */
14395         @UnsupportedAppUsage
14396         public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
14397 
14398         /**
14399           * Subscription Id to be used for data call on a multi sim device.
14400           * @hide
14401           */
14402         public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
14403 
14404         /**
14405           * Subscription Id to be used for SMS on a multi sim device.
14406           * @hide
14407           */
14408         public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
14409 
14410         /**
14411           * Used to provide option to user to select subscription during send SMS.
14412           * The value 1 - enable, 0 - disable
14413           * @hide
14414           */
14415         public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
14416 
14417         /** User preferred subscriptions setting.
14418           * This holds the details of the user selected subscription from the card and
14419           * the activation status. Each settings string have the comma separated values
14420           * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
14421           * @hide
14422          */
14423         @UnsupportedAppUsage
14424         public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
14425                 "user_preferred_sub2","user_preferred_sub3"};
14426 
14427         /**
14428          * Which subscription is enabled for a physical slot.
14429          * @hide
14430          */
14431         public static final String ENABLED_SUBSCRIPTION_FOR_SLOT = "enabled_subscription_for_slot";
14432 
14433         /**
14434          * Whether corresponding logical modem is enabled for a physical slot.
14435          * The value 1 - enable, 0 - disable
14436          * @hide
14437          */
14438         public static final String MODEM_STACK_ENABLED_FOR_SLOT = "modem_stack_enabled_for_slot";
14439 
14440         /**
14441          * Whether to enable new contacts aggregator or not.
14442          * The value 1 - enable, 0 - disable
14443          * @hide
14444          */
14445         public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
14446 
14447         /**
14448          * Whether to enable contacts metadata syncing or not
14449          * The value 1 - enable, 0 - disable
14450          *
14451          * @removed
14452          */
14453         @Deprecated
14454         public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
14455 
14456         /**
14457          * Whether to enable contacts metadata syncing or not
14458          * The value 1 - enable, 0 - disable
14459          */
14460         public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
14461 
14462         /**
14463          * Whether to enable cellular on boot.
14464          * The value 1 - enable, 0 - disable
14465          * @hide
14466          */
14467         public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
14468 
14469         /**
14470          * The maximum allowed notification enqueue rate in Hertz.
14471          *
14472          * Should be a float, and includes updates only.
14473          * @hide
14474          */
14475         public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate";
14476 
14477         /**
14478          * Displays toasts when an app posts a notification that does not specify a valid channel.
14479          *
14480          * The value 1 - enable, 0 - disable
14481          * @hide
14482          */
14483         public static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS =
14484                 "show_notification_channel_warnings";
14485 
14486         /**
14487          * Whether cell is enabled/disabled
14488          * @hide
14489          */
14490         public static final String CELL_ON = "cell_on";
14491 
14492         /**
14493          * Global settings which can be accessed by instant apps.
14494          * @hide
14495          */
14496         public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
14497         static {
14498             INSTANT_APP_SETTINGS.add(WAIT_FOR_DEBUGGER);
14499             INSTANT_APP_SETTINGS.add(DEVICE_PROVISIONED);
14500             INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
14501             INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RTL);
14502             INSTANT_APP_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
14503             INSTANT_APP_SETTINGS.add(AIRPLANE_MODE_ON);
14504             INSTANT_APP_SETTINGS.add(WINDOW_ANIMATION_SCALE);
14505             INSTANT_APP_SETTINGS.add(TRANSITION_ANIMATION_SCALE);
14506             INSTANT_APP_SETTINGS.add(ANIMATOR_DURATION_SCALE);
14507             INSTANT_APP_SETTINGS.add(DEBUG_VIEW_ATTRIBUTES);
14508             INSTANT_APP_SETTINGS.add(DEBUG_VIEW_ATTRIBUTES_APPLICATION_PACKAGE);
14509             INSTANT_APP_SETTINGS.add(WTF_IS_FATAL);
14510             INSTANT_APP_SETTINGS.add(SEND_ACTION_APP_ERROR);
14511             INSTANT_APP_SETTINGS.add(ZEN_MODE);
14512         }
14513 
14514         /**
14515          * Whether to show the high temperature warning notification.
14516          * @hide
14517          */
14518         public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
14519 
14520         /**
14521          * Whether to show the usb high temperature alarm notification.
14522          * @hide
14523          */
14524         public static final String SHOW_USB_TEMPERATURE_ALARM = "show_usb_temperature_alarm";
14525 
14526         /**
14527          * Temperature at which the high temperature warning notification should be shown.
14528          * @hide
14529          */
14530         public static final String WARNING_TEMPERATURE = "warning_temperature";
14531 
14532         /**
14533          * Whether the diskstats logging task is enabled/disabled.
14534          * @hide
14535          */
14536         public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging";
14537 
14538         /**
14539          * Whether the cache quota calculation task is enabled/disabled.
14540          * @hide
14541          */
14542         public static final String ENABLE_CACHE_QUOTA_CALCULATION =
14543                 "enable_cache_quota_calculation";
14544 
14545         /**
14546          * Whether the Deletion Helper no threshold toggle is available.
14547          * @hide
14548          */
14549         public static final String ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE =
14550                 "enable_deletion_helper_no_threshold_toggle";
14551 
14552         /**
14553          * The list of snooze options for notifications
14554          * This is encoded as a key=value list, separated by commas. Ex:
14555          *
14556          * "default=60,options_array=15:30:60:120"
14557          *
14558          * The following keys are supported:
14559          *
14560          * <pre>
14561          * default               (int)
14562          * options_array         (int[])
14563          * </pre>
14564          *
14565          * All delays in integer minutes. Array order is respected.
14566          * Options will be used in order up to the maximum allowed by the UI.
14567          * @hide
14568          */
14569         public static final String NOTIFICATION_SNOOZE_OPTIONS =
14570                 "notification_snooze_options";
14571 
14572         /**
14573          * Settings key for the ratio of notification dismissals to notification views - one of the
14574          * criteria for showing the notification blocking helper.
14575          *
14576          * <p>The value is a float ranging from 0.0 to 1.0 (the closer to 0.0, the more intrusive
14577          * the blocking helper will be).
14578          *
14579          * @hide
14580          */
14581         public static final String BLOCKING_HELPER_DISMISS_TO_VIEW_RATIO_LIMIT =
14582                 "blocking_helper_dismiss_to_view_ratio";
14583 
14584         /**
14585          * Settings key for the longest streak of dismissals  - one of the criteria for showing the
14586          * notification blocking helper.
14587          *
14588          * <p>The value is an integer greater than 0.
14589          *
14590          * @hide
14591          */
14592         public static final String BLOCKING_HELPER_STREAK_LIMIT = "blocking_helper_streak_limit";
14593 
14594         /**
14595          * Configuration flags for SQLite Compatibility WAL. Encoded as a key-value list, separated
14596          * by commas. E.g.: compatibility_wal_supported=true, wal_syncmode=OFF
14597          *
14598          * Supported keys:<br/>
14599          * <li>
14600          * <ul> {@code legacy_compatibility_wal_enabled} : A {code boolean} flag that determines
14601          * whether or not "compatibility WAL" mode is enabled by default. This is a legacy flag
14602          * and is honoured on Android Q and higher. This flag will be removed in a future release.
14603          * </ul>
14604          * <ul> {@code wal_syncmode} : A {@code String} representing the synchronization mode to use
14605          * when WAL is enabled, either via {@code legacy_compatibility_wal_enabled} or using the
14606          * obsolete {@code compatibility_wal_supported} flag.
14607          * </ul>
14608          * <ul> {@code truncate_size} : A {@code int} flag that specifies the truncate size of the
14609          * WAL journal.
14610          * </ul>
14611          * <ul> {@code compatibility_wal_supported} : A {code boolean} flag that specifies whether
14612          * the legacy "compatibility WAL" mode is enabled by default. This flag is obsolete and is
14613          * only supported on Android Pie.
14614          * </ul>
14615          * </li>
14616          *
14617          * @hide
14618          */
14619         public static final String SQLITE_COMPATIBILITY_WAL_FLAGS =
14620                 "sqlite_compatibility_wal_flags";
14621 
14622         /**
14623          * Enable GNSS Raw Measurements Full Tracking?
14624          * 0 = no
14625          * 1 = yes
14626          * @hide
14627          */
14628         public static final String ENABLE_GNSS_RAW_MEAS_FULL_TRACKING =
14629                 "enable_gnss_raw_meas_full_tracking";
14630 
14631         /**
14632          * Whether the notification should be ongoing (persistent) when a carrier app install is
14633          * required.
14634          *
14635          * The value is a boolean (1 or 0).
14636          * @hide
14637          */
14638         @SystemApi
14639         public static final String INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT =
14640                 "install_carrier_app_notification_persistent";
14641 
14642         /**
14643          * The amount of time (ms) to hide the install carrier app notification after the user has
14644          * ignored it. After this time passes, the notification will be shown again
14645          *
14646          * The value is a long
14647          * @hide
14648          */
14649         @SystemApi
14650         public static final String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS =
14651                 "install_carrier_app_notification_sleep_millis";
14652 
14653         /**
14654          * Whether we've enabled zram on this device. Takes effect on
14655          * reboot. The value "1" enables zram; "0" disables it, and
14656          * everything else is unspecified.
14657          * @hide
14658          */
14659         public static final String ZRAM_ENABLED =
14660                 "zram_enabled";
14661 
14662         /**
14663          * Configuration flags for smart replies in notifications.
14664          * This is encoded as a key=value list, separated by commas. Ex:
14665          *
14666          * "enabled=1,max_squeeze_remeasure_count=3"
14667          *
14668          * The following keys are supported:
14669          *
14670          * <pre>
14671          * enabled                           (boolean)
14672          * requires_targeting_p              (boolean)
14673          * max_squeeze_remeasure_attempts    (int)
14674          * edit_choices_before_sending       (boolean)
14675          * show_in_heads_up                  (boolean)
14676          * min_num_system_generated_replies  (int)
14677          * max_num_actions                   (int)
14678          * </pre>
14679          * @see com.android.systemui.statusbar.policy.SmartReplyConstants
14680          * @hide
14681          */
14682         public static final String SMART_REPLIES_IN_NOTIFICATIONS_FLAGS =
14683                 "smart_replies_in_notifications_flags";
14684 
14685         /**
14686          * Configuration flags for the automatic generation of smart replies and smart actions in
14687          * notifications. This is encoded as a key=value list, separated by commas. Ex:
14688          * "generate_replies=false,generate_actions=true".
14689          *
14690          * The following keys are supported:
14691          *
14692          * <pre>
14693          * generate_replies                 (boolean)
14694          * generate_actions                 (boolean)
14695          * </pre>
14696          * @hide
14697          */
14698         public static final String SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS =
14699                 "smart_suggestions_in_notifications_flags";
14700 
14701         /**
14702          * If nonzero, crashes in foreground processes will bring up a dialog.
14703          * Otherwise, the process will be silently killed.
14704          * @hide
14705          */
14706         public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
14707 
14708         /**
14709          * If nonzero, crash dialogs will show an option to restart the app.
14710          * @hide
14711          */
14712         public static final String SHOW_RESTART_IN_CRASH_DIALOG = "show_restart_in_crash_dialog";
14713 
14714         /**
14715          * If nonzero, crash dialogs will show an option to mute all future crash dialogs for
14716          * this app.
14717          * @hide
14718          */
14719         public static final String SHOW_MUTE_IN_CRASH_DIALOG = "show_mute_in_crash_dialog";
14720 
14721 
14722         /**
14723          * If nonzero, will show the zen upgrade notification when the user toggles DND on/off.
14724          * @hide
14725          * @deprecated - Use {@link android.provider.Settings.Secure#SHOW_ZEN_UPGRADE_NOTIFICATION}
14726          */
14727         @Deprecated
14728         public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification";
14729 
14730         /**
14731          * If nonzero, will show the zen update settings suggestion.
14732          * @hide
14733          * @deprecated - Use {@link android.provider.Settings.Secure#SHOW_ZEN_SETTINGS_SUGGESTION}
14734          */
14735         @Deprecated
14736         public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion";
14737 
14738         /**
14739          * If nonzero, zen has not been updated to reflect new changes.
14740          * @deprecated - Use {@link android.provider.Settings.Secure#ZEN_SETTINGS_UPDATED}
14741          * @hide
14742          */
14743         @Deprecated
14744         public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated";
14745 
14746         /**
14747          * If nonzero, zen setting suggestion has been viewed by user
14748          * @hide
14749          * @deprecated - Use {@link android.provider.Settings.Secure#ZEN_SETTINGS_SUGGESTION_VIEWED}
14750          */
14751         @Deprecated
14752         public static final String ZEN_SETTINGS_SUGGESTION_VIEWED =
14753                 "zen_settings_suggestion_viewed";
14754 
14755         /**
14756          * Backup and restore agent timeout parameters.
14757          * These parameters are represented by a comma-delimited key-value list.
14758          *
14759          * The following strings are supported as keys:
14760          * <pre>
14761          *     kv_backup_agent_timeout_millis         (long)
14762          *     full_backup_agent_timeout_millis       (long)
14763          *     shared_backup_agent_timeout_millis     (long)
14764          *     restore_agent_timeout_millis           (long)
14765          *     restore_agent_finished_timeout_millis  (long)
14766          * </pre>
14767          *
14768          * They map to milliseconds represented as longs.
14769          *
14770          * Ex: "kv_backup_agent_timeout_millis=30000,full_backup_agent_timeout_millis=300000"
14771          *
14772          * @hide
14773          */
14774         public static final String BACKUP_AGENT_TIMEOUT_PARAMETERS =
14775                 "backup_agent_timeout_parameters";
14776 
14777         /**
14778          * Whether the backup system service supports multiple users (0 = disabled, 1 = enabled). If
14779          * disabled, the service will only be active for the system user.
14780          *
14781          * @hide
14782          */
14783         public static final String BACKUP_MULTI_USER_ENABLED = "backup_multi_user_enabled";
14784 
14785         /**
14786          * Blacklist of GNSS satellites.
14787          *
14788          * This is a list of integers separated by commas to represent pairs of (constellation,
14789          * svid). Thus, the number of integers should be even.
14790          *
14791          * E.g.: "3,0,5,24" denotes (constellation=3, svid=0) and (constellation=5, svid=24) are
14792          * blacklisted. Note that svid=0 denotes all svids in the
14793          * constellation are blacklisted.
14794          *
14795          * @hide
14796          */
14797         public static final String GNSS_SATELLITE_BLACKLIST = "gnss_satellite_blacklist";
14798 
14799         /**
14800          * Duration of updates in millisecond for GNSS location request from HAL to framework.
14801          *
14802          * If zero, the GNSS location request feature is disabled.
14803          *
14804          * The value is a non-negative long.
14805          *
14806          * @hide
14807          */
14808         public static final String GNSS_HAL_LOCATION_REQUEST_DURATION_MILLIS =
14809                 "gnss_hal_location_request_duration_millis";
14810 
14811         /**
14812          * Binder call stats settings.
14813          *
14814          * The following strings are supported as keys:
14815          * <pre>
14816          *     enabled              (boolean)
14817          *     detailed_tracking    (boolean)
14818          *     upload_data          (boolean)
14819          *     sampling_interval    (int)
14820          * </pre>
14821          *
14822          * @hide
14823          */
14824         public static final String BINDER_CALLS_STATS = "binder_calls_stats";
14825 
14826         /**
14827          * Looper stats settings.
14828          *
14829          * The following strings are supported as keys:
14830          * <pre>
14831          *     enabled              (boolean)
14832          *     sampling_interval    (int)
14833          * </pre>
14834          *
14835          * @hide
14836          */
14837         public static final String LOOPER_STATS = "looper_stats";
14838 
14839         /**
14840          * Settings for collecting statistics on CPU usage per thread
14841          *
14842          * The following strings are supported as keys:
14843          * <pre>
14844          *     num_buckets          (int)
14845          *     collected_uids       (string)
14846          *     minimum_total_cpu_usage_millis (int)
14847          * </pre>
14848          *
14849          * @hide
14850          */
14851         public static final String KERNEL_CPU_THREAD_READER = "kernel_cpu_thread_reader";
14852 
14853         /**
14854          * Default user id to boot into. They map to user ids, for example, 10, 11, 12.
14855          *
14856          * @hide
14857          */
14858         public static final String DEFAULT_USER_ID_TO_BOOT_INTO = "default_boot_into_user_id";
14859 
14860         /**
14861          * Persistent user id that is last logged in to.
14862          *
14863          * They map to user ids, for example, 10, 11, 12.
14864          *
14865          * @hide
14866          */
14867         public static final String LAST_ACTIVE_USER_ID = "last_active_persistent_user_id";
14868 
14869         /**
14870          * Whether we've enabled native flags health check on this device. Takes effect on
14871          * reboot. The value "1" enables native flags health check; otherwise it's disabled.
14872          * @hide
14873          */
14874         public static final String NATIVE_FLAGS_HEALTH_CHECK_ENABLED =
14875                 "native_flags_health_check_enabled";
14876 
14877         /**
14878          * Parameter for {@link #APPOP_HISTORY_PARAMETERS} that controls the mode
14879          * in which the historical registry operates.
14880          *
14881          * @hide
14882          */
14883         public static final String APPOP_HISTORY_MODE = "mode";
14884 
14885         /**
14886          * Parameter for {@link #APPOP_HISTORY_PARAMETERS} that controls how long
14887          * is the interval between snapshots in the base case i.e. the most recent
14888          * part of the history.
14889          *
14890          * @hide
14891          */
14892         public static final String APPOP_HISTORY_BASE_INTERVAL_MILLIS = "baseIntervalMillis";
14893 
14894         /**
14895          * Parameter for {@link #APPOP_HISTORY_PARAMETERS} that controls the base
14896          * for the logarithmic step when building app op history.
14897          *
14898          * @hide
14899          */
14900         public static final String APPOP_HISTORY_INTERVAL_MULTIPLIER = "intervalMultiplier";
14901 
14902         /**
14903          * Appop history parameters. These parameters are represented by
14904          * a comma-delimited key-value list.
14905          *
14906          * The following strings are supported as keys:
14907          * <pre>
14908          *     mode                  (int)
14909          *     baseIntervalMillis    (long)
14910          *     intervalMultiplier    (int)
14911          * </pre>
14912          *
14913          * Ex: "mode=HISTORICAL_MODE_ENABLED_ACTIVE,baseIntervalMillis=1000,intervalMultiplier=10"
14914          *
14915          * @see #APPOP_HISTORY_MODE
14916          * @see #APPOP_HISTORY_BASE_INTERVAL_MILLIS
14917          * @see #APPOP_HISTORY_INTERVAL_MULTIPLIER
14918          *
14919          * @hide
14920          */
14921         public static final String APPOP_HISTORY_PARAMETERS =
14922                 "appop_history_parameters";
14923 
14924         /**
14925          * Delay for sending ACTION_CHARGING after device is plugged in.
14926          * This is used as an override for constants defined in BatteryStatsImpl for
14927          * ease of experimentation.
14928          *
14929          * @see com.android.internal.os.BatteryStatsImpl.Constants.KEY_BATTERY_CHARGED_DELAY_MS
14930          * @hide
14931          */
14932         public static final String BATTERY_CHARGING_STATE_UPDATE_DELAY =
14933                 "battery_charging_state_update_delay";
14934 
14935         /**
14936          * A serialized string of params that will be loaded into a text classifier action model.
14937          *
14938          * @hide
14939          */
14940         public static final String TEXT_CLASSIFIER_ACTION_MODEL_PARAMS =
14941                 "text_classifier_action_model_params";
14942 
14943         /**
14944          * The amount of time to suppress "power-off" from the power button after the device has
14945          * woken due to a gesture (lifting the phone).  Since users have learned to hit the power
14946          * button immediately when lifting their device, it can cause the device to turn off if a
14947          * gesture has just woken the device. This value tells us the milliseconds to wait after
14948          * a gesture before "power-off" via power-button is functional again. A value of 0 is no
14949          * delay, and reverts to the old behavior.
14950          *
14951          * @hide
14952          */
14953         public static final String POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE =
14954                 "power_button_suppression_delay_after_gesture_wake";
14955 
14956         /**
14957          * For 5G NSA capable devices, determines whether NR tracking indications are on
14958          * when the screen is off.
14959          *
14960          * Values are:
14961          * 0: off - All 5G NSA tracking indications are off when the screen is off.
14962          * 1: extended - All 5G NSA tracking indications are on when the screen is off as long as
14963          *    the device is camped on 5G NSA (5G icon is showing in status bar).
14964          *    If the device is not camped on 5G NSA, tracking indications are off.
14965          * 2: always on - All 5G NSA tracking indications are on whether the screen is on or off.
14966          * @hide
14967          */
14968         public static final String NR_NSA_TRACKING_SCREEN_OFF_MODE =
14969                 "nr_nsa_tracking_screen_off_mode";
14970     }
14971 
14972     /**
14973      * Configuration system settings, containing settings which are applied identically for all
14974      * defined users. Only Android can read these and only a specific configuration service can
14975      * write these.
14976      *
14977      * @hide
14978      */
14979     public static final class Config extends NameValueTable {
14980         private static final ContentProviderHolder sProviderHolder =
14981                 new ContentProviderHolder(DeviceConfig.CONTENT_URI);
14982 
14983         // Populated lazily, guarded by class object:
14984         private static final NameValueCache sNameValueCache = new NameValueCache(
14985                 DeviceConfig.CONTENT_URI,
14986                 CALL_METHOD_GET_CONFIG,
14987                 CALL_METHOD_PUT_CONFIG,
14988                 sProviderHolder);
14989 
14990         /**
14991          * Look up a name in the database.
14992          * @param resolver to access the database with
14993          * @param name to look up in the table
14994          * @return the corresponding value, or null if not present
14995          *
14996          * @hide
14997          */
14998         @RequiresPermission(Manifest.permission.READ_DEVICE_CONFIG)
getString(ContentResolver resolver, String name)14999         static String getString(ContentResolver resolver, String name) {
15000             return sNameValueCache.getStringForUser(resolver, name, resolver.getUserId());
15001         }
15002 
15003         /**
15004          * Store a name/value pair into the database.
15005          * <p>
15006          * Also the method takes an argument whether to make the value the default for this setting.
15007          * If the system already specified a default value, then the one passed in here will
15008          * <strong>not</strong> be set as the default.
15009          * </p>
15010          *
15011          * @param resolver to access the database with.
15012          * @param name to store.
15013          * @param value to associate with the name.
15014          * @param makeDefault whether to make the value the default one.
15015          * @return true if the value was set, false on database errors.
15016          *
15017          * @see #resetToDefaults(ContentResolver, int, String)
15018          *
15019          * @hide
15020          */
15021         @RequiresPermission(Manifest.permission.WRITE_DEVICE_CONFIG)
putString(@onNull ContentResolver resolver, @NonNull String name, @Nullable String value, boolean makeDefault)15022         static boolean putString(@NonNull ContentResolver resolver, @NonNull String name,
15023                 @Nullable String value, boolean makeDefault) {
15024             return sNameValueCache.putStringForUser(resolver, name, value, null, makeDefault,
15025                     resolver.getUserId());
15026         }
15027 
15028         /**
15029          * Reset the values to their defaults.
15030          * <p>
15031          * The method accepts an optional prefix parameter. If provided, only pairs with a name that
15032          * starts with the exact prefix will be reset. Otherwise all will be reset.
15033          *
15034          * @param resolver Handle to the content resolver.
15035          * @param resetMode The reset mode to use.
15036          * @param prefix Optionally, to limit which which pairs are reset.
15037          *
15038          * @see #putString(ContentResolver, String, String, boolean)
15039          *
15040          * @hide
15041          */
15042         @RequiresPermission(Manifest.permission.WRITE_DEVICE_CONFIG)
resetToDefaults(@onNull ContentResolver resolver, @ResetMode int resetMode, @Nullable String prefix)15043         static void resetToDefaults(@NonNull ContentResolver resolver, @ResetMode int resetMode,
15044                 @Nullable String prefix) {
15045             try {
15046                 Bundle arg = new Bundle();
15047                 arg.putInt(CALL_METHOD_USER_KEY, resolver.getUserId());
15048                 arg.putInt(CALL_METHOD_RESET_MODE_KEY, resetMode);
15049                 if (prefix != null) {
15050                     arg.putString(Settings.CALL_METHOD_PREFIX_KEY, prefix);
15051                 }
15052                 IContentProvider cp = sProviderHolder.getProvider(resolver);
15053                 cp.call(resolver.getPackageName(), sProviderHolder.mUri.getAuthority(),
15054                         CALL_METHOD_RESET_CONFIG, null, arg);
15055             } catch (RemoteException e) {
15056                 Log.w(TAG, "Can't reset to defaults for " + DeviceConfig.CONTENT_URI, e);
15057             }
15058         }
15059     }
15060 
15061     /**
15062      * User-defined bookmarks and shortcuts.  The target of each bookmark is an
15063      * Intent URL, allowing it to be either a web page or a particular
15064      * application activity.
15065      *
15066      * @hide
15067      */
15068     public static final class Bookmarks implements BaseColumns
15069     {
15070         private static final String TAG = "Bookmarks";
15071 
15072         /**
15073          * The content:// style URL for this table
15074          */
15075         @UnsupportedAppUsage
15076         public static final Uri CONTENT_URI =
15077             Uri.parse("content://" + AUTHORITY + "/bookmarks");
15078 
15079         /**
15080          * The row ID.
15081          * <p>Type: INTEGER</p>
15082          */
15083         public static final String ID = "_id";
15084 
15085         /**
15086          * Descriptive name of the bookmark that can be displayed to the user.
15087          * If this is empty, the title should be resolved at display time (use
15088          * {@link #getTitle(Context, Cursor)} any time you want to display the
15089          * title of a bookmark.)
15090          * <P>
15091          * Type: TEXT
15092          * </P>
15093          */
15094         public static final String TITLE = "title";
15095 
15096         /**
15097          * Arbitrary string (displayed to the user) that allows bookmarks to be
15098          * organized into categories.  There are some special names for
15099          * standard folders, which all start with '@'.  The label displayed for
15100          * the folder changes with the locale (via {@link #getLabelForFolder}) but
15101          * the folder name does not change so you can consistently query for
15102          * the folder regardless of the current locale.
15103          *
15104          * <P>Type: TEXT</P>
15105          *
15106          */
15107         public static final String FOLDER = "folder";
15108 
15109         /**
15110          * The Intent URL of the bookmark, describing what it points to.  This
15111          * value is given to {@link android.content.Intent#getIntent} to create
15112          * an Intent that can be launched.
15113          * <P>Type: TEXT</P>
15114          */
15115         public static final String INTENT = "intent";
15116 
15117         /**
15118          * Optional shortcut character associated with this bookmark.
15119          * <P>Type: INTEGER</P>
15120          */
15121         public static final String SHORTCUT = "shortcut";
15122 
15123         /**
15124          * The order in which the bookmark should be displayed
15125          * <P>Type: INTEGER</P>
15126          */
15127         public static final String ORDERING = "ordering";
15128 
15129         private static final String[] sIntentProjection = { INTENT };
15130         private static final String[] sShortcutProjection = { ID, SHORTCUT };
15131         private static final String sShortcutSelection = SHORTCUT + "=?";
15132 
15133         /**
15134          * Convenience function to retrieve the bookmarked Intent for a
15135          * particular shortcut key.
15136          *
15137          * @param cr The ContentResolver to query.
15138          * @param shortcut The shortcut key.
15139          *
15140          * @return Intent The bookmarked URL, or null if there is no bookmark
15141          *         matching the given shortcut.
15142          */
getIntentForShortcut(ContentResolver cr, char shortcut)15143         public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
15144         {
15145             Intent intent = null;
15146 
15147             Cursor c = cr.query(CONTENT_URI,
15148                     sIntentProjection, sShortcutSelection,
15149                     new String[] { String.valueOf((int) shortcut) }, ORDERING);
15150             // Keep trying until we find a valid shortcut
15151             try {
15152                 while (intent == null && c.moveToNext()) {
15153                     try {
15154                         String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
15155                         intent = Intent.parseUri(intentURI, 0);
15156                     } catch (java.net.URISyntaxException e) {
15157                         // The stored URL is bad...  ignore it.
15158                     } catch (IllegalArgumentException e) {
15159                         // Column not found
15160                         Log.w(TAG, "Intent column not found", e);
15161                     }
15162                 }
15163             } finally {
15164                 if (c != null) c.close();
15165             }
15166 
15167             return intent;
15168         }
15169 
15170         /**
15171          * Add a new bookmark to the system.
15172          *
15173          * @param cr The ContentResolver to query.
15174          * @param intent The desired target of the bookmark.
15175          * @param title Bookmark title that is shown to the user; null if none
15176          *            or it should be resolved to the intent's title.
15177          * @param folder Folder in which to place the bookmark; null if none.
15178          * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
15179          *            this is non-zero and there is an existing bookmark entry
15180          *            with this same shortcut, then that existing shortcut is
15181          *            cleared (the bookmark is not removed).
15182          * @return The unique content URL for the new bookmark entry.
15183          */
15184         @UnsupportedAppUsage
add(ContentResolver cr, Intent intent, String title, String folder, char shortcut, int ordering)15185         public static Uri add(ContentResolver cr,
15186                                            Intent intent,
15187                                            String title,
15188                                            String folder,
15189                                            char shortcut,
15190                                            int ordering)
15191         {
15192             // If a shortcut is supplied, and it is already defined for
15193             // another bookmark, then remove the old definition.
15194             if (shortcut != 0) {
15195                 cr.delete(CONTENT_URI, sShortcutSelection,
15196                         new String[] { String.valueOf((int) shortcut) });
15197             }
15198 
15199             ContentValues values = new ContentValues();
15200             if (title != null) values.put(TITLE, title);
15201             if (folder != null) values.put(FOLDER, folder);
15202             values.put(INTENT, intent.toUri(0));
15203             if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
15204             values.put(ORDERING, ordering);
15205             return cr.insert(CONTENT_URI, values);
15206         }
15207 
15208         /**
15209          * Return the folder name as it should be displayed to the user.  This
15210          * takes care of localizing special folders.
15211          *
15212          * @param r Resources object for current locale; only need access to
15213          *          system resources.
15214          * @param folder The value found in the {@link #FOLDER} column.
15215          *
15216          * @return CharSequence The label for this folder that should be shown
15217          *         to the user.
15218          */
getLabelForFolder(Resources r, String folder)15219         public static CharSequence getLabelForFolder(Resources r, String folder) {
15220             return folder;
15221         }
15222 
15223         /**
15224          * Return the title as it should be displayed to the user. This takes
15225          * care of localizing bookmarks that point to activities.
15226          *
15227          * @param context A context.
15228          * @param cursor A cursor pointing to the row whose title should be
15229          *        returned. The cursor must contain at least the {@link #TITLE}
15230          *        and {@link #INTENT} columns.
15231          * @return A title that is localized and can be displayed to the user,
15232          *         or the empty string if one could not be found.
15233          */
getTitle(Context context, Cursor cursor)15234         public static CharSequence getTitle(Context context, Cursor cursor) {
15235             int titleColumn = cursor.getColumnIndex(TITLE);
15236             int intentColumn = cursor.getColumnIndex(INTENT);
15237             if (titleColumn == -1 || intentColumn == -1) {
15238                 throw new IllegalArgumentException(
15239                         "The cursor must contain the TITLE and INTENT columns.");
15240             }
15241 
15242             String title = cursor.getString(titleColumn);
15243             if (!TextUtils.isEmpty(title)) {
15244                 return title;
15245             }
15246 
15247             String intentUri = cursor.getString(intentColumn);
15248             if (TextUtils.isEmpty(intentUri)) {
15249                 return "";
15250             }
15251 
15252             Intent intent;
15253             try {
15254                 intent = Intent.parseUri(intentUri, 0);
15255             } catch (URISyntaxException e) {
15256                 return "";
15257             }
15258 
15259             PackageManager packageManager = context.getPackageManager();
15260             ResolveInfo info = packageManager.resolveActivity(intent, 0);
15261             return info != null ? info.loadLabel(packageManager) : "";
15262         }
15263     }
15264 
15265     /**
15266      * <p>
15267      *     A Settings panel is floating UI that contains a fixed subset of settings to address a
15268      *     particular user problem. For example, the
15269      *     {@link #ACTION_INTERNET_CONNECTIVITY Internet Panel} surfaces settings related to
15270      *     connecting to the internet.
15271      * <p>
15272      *     Settings panels appear above the calling app to address the problem without
15273      *     the user needing to open Settings and thus leave their current screen.
15274      */
15275     public static final class Panel {
Panel()15276         private Panel() {
15277         }
15278 
15279         /**
15280          * Activity Action: Show a settings dialog containing settings to enable internet
15281          * connection.
15282          * <p>
15283          * Input: Nothing.
15284          * <p>
15285          * Output: Nothing.
15286          */
15287         @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
15288         public static final String ACTION_INTERNET_CONNECTIVITY =
15289                 "android.settings.panel.action.INTERNET_CONNECTIVITY";
15290 
15291         /**
15292          * Activity Action: Show a settings dialog containing NFC-related settings.
15293          * <p>
15294          * Input: Nothing.
15295          * <p>
15296          * Output: Nothing.
15297          */
15298         @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
15299         public static final String ACTION_NFC =
15300                 "android.settings.panel.action.NFC";
15301 
15302         /**
15303          * Activity Action: Show a settings dialog containing controls for Wifi.
15304          * <p>
15305          * Input: Nothing.
15306          * <p>
15307          * Output: Nothing.
15308          */
15309         @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
15310         public static final String ACTION_WIFI =
15311                 "android.settings.panel.action.WIFI";
15312 
15313         /**
15314          * Activity Action: Show a settings dialog containing all volume streams.
15315          * <p>
15316          * Input: Nothing.
15317          * <p>
15318          * Output: Nothing.
15319          */
15320         @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
15321         public static final String ACTION_VOLUME =
15322                 "android.settings.panel.action.VOLUME";
15323     }
15324 
15325     private static final String[] PM_WRITE_SETTINGS = {
15326         android.Manifest.permission.WRITE_SETTINGS
15327     };
15328     private static final String[] PM_CHANGE_NETWORK_STATE = {
15329         android.Manifest.permission.CHANGE_NETWORK_STATE,
15330         android.Manifest.permission.WRITE_SETTINGS
15331     };
15332     private static final String[] PM_SYSTEM_ALERT_WINDOW = {
15333         android.Manifest.permission.SYSTEM_ALERT_WINDOW
15334     };
15335 
15336     /**
15337      * Performs a strict and comprehensive check of whether a calling package is allowed to
15338      * write/modify system settings, as the condition differs for pre-M, M+, and
15339      * privileged/preinstalled apps. If the provided uid does not match the
15340      * callingPackage, a negative result will be returned.
15341      * @hide
15342      */
15343     @UnsupportedAppUsage
isCallingPackageAllowedToWriteSettings(Context context, int uid, String callingPackage, boolean throwException)15344     public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
15345             String callingPackage, boolean throwException) {
15346         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
15347                 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
15348                 PM_WRITE_SETTINGS, false);
15349     }
15350 
15351     /**
15352      * Performs a strict and comprehensive check of whether a calling package is allowed to
15353      * write/modify system settings, as the condition differs for pre-M, M+, and
15354      * privileged/preinstalled apps. If the provided uid does not match the
15355      * callingPackage, a negative result will be returned. The caller is expected to have
15356      * the WRITE_SETTINGS permission declared.
15357      *
15358      * Note: if the check is successful, the operation of this app will be updated to the
15359      * current time.
15360      * @hide
15361      */
15362     @SystemApi
checkAndNoteWriteSettingsOperation(@onNull Context context, int uid, @NonNull String callingPackage, boolean throwException)15363     public static boolean checkAndNoteWriteSettingsOperation(@NonNull Context context, int uid,
15364             @NonNull String callingPackage, boolean throwException) {
15365         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
15366                 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
15367                 PM_WRITE_SETTINGS, true);
15368     }
15369 
15370     /**
15371      * Performs a strict and comprehensive check of whether a calling package is allowed to
15372      * change the state of network, as the condition differs for pre-M, M+, and
15373      * privileged/preinstalled apps. The caller is expected to have either the
15374      * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
15375      * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
15376      * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
15377      * permission and cannot be revoked. See http://b/23597341
15378      *
15379      * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
15380      * of this app will be updated to the current time.
15381      * @hide
15382      */
checkAndNoteChangeNetworkStateOperation(Context context, int uid, String callingPackage, boolean throwException)15383     public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
15384             String callingPackage, boolean throwException) {
15385         if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
15386                 == PackageManager.PERMISSION_GRANTED) {
15387             return true;
15388         }
15389         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
15390                 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
15391                 PM_CHANGE_NETWORK_STATE, true);
15392     }
15393 
15394     /**
15395      * Performs a strict and comprehensive check of whether a calling package is allowed to
15396      * draw on top of other apps, as the conditions differs for pre-M, M+, and
15397      * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
15398      * a negative result will be returned.
15399      * @hide
15400      */
15401     @UnsupportedAppUsage
isCallingPackageAllowedToDrawOverlays(Context context, int uid, String callingPackage, boolean throwException)15402     public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
15403             String callingPackage, boolean throwException) {
15404         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
15405                 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
15406                 PM_SYSTEM_ALERT_WINDOW, false);
15407     }
15408 
15409     /**
15410      * Performs a strict and comprehensive check of whether a calling package is allowed to
15411      * draw on top of other apps, as the conditions differs for pre-M, M+, and
15412      * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
15413      * a negative result will be returned.
15414      *
15415      * Note: if the check is successful, the operation of this app will be updated to the
15416      * current time.
15417      * @hide
15418      */
checkAndNoteDrawOverlaysOperation(Context context, int uid, String callingPackage, boolean throwException)15419     public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
15420             callingPackage, boolean throwException) {
15421         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
15422                 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
15423                 PM_SYSTEM_ALERT_WINDOW, true);
15424     }
15425 
15426     /**
15427      * Helper method to perform a general and comprehensive check of whether an operation that is
15428      * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
15429      * OP_WRITE_SETTINGS
15430      * @hide
15431      */
15432     @UnsupportedAppUsage
isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context, int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[] permissions, boolean makeNote)15433     public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
15434             int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
15435             permissions, boolean makeNote) {
15436         if (callingPackage == null) {
15437             return false;
15438         }
15439 
15440         AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
15441         int mode = AppOpsManager.MODE_DEFAULT;
15442         if (makeNote) {
15443             mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
15444         } else {
15445             mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
15446         }
15447 
15448         switch (mode) {
15449             case AppOpsManager.MODE_ALLOWED:
15450                 return true;
15451 
15452             case AppOpsManager.MODE_DEFAULT:
15453                 // this is the default operating mode after an app's installation
15454                 // In this case we will check all associated static permission to see
15455                 // if it is granted during install time.
15456                 for (String permission : permissions) {
15457                     if (context.checkCallingOrSelfPermission(permission) == PackageManager
15458                             .PERMISSION_GRANTED) {
15459                         // if either of the permissions are granted, we will allow it
15460                         return true;
15461                     }
15462                 }
15463 
15464             default:
15465                 // this is for all other cases trickled down here...
15466                 if (!throwException) {
15467                     return false;
15468                 }
15469         }
15470 
15471         // prepare string to throw SecurityException
15472         StringBuilder exceptionMessage = new StringBuilder();
15473         exceptionMessage.append(callingPackage);
15474         exceptionMessage.append(" was not granted ");
15475         if (permissions.length > 1) {
15476             exceptionMessage.append(" either of these permissions: ");
15477         } else {
15478             exceptionMessage.append(" this permission: ");
15479         }
15480         for (int i = 0; i < permissions.length; i++) {
15481             exceptionMessage.append(permissions[i]);
15482             exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
15483         }
15484 
15485         throw new SecurityException(exceptionMessage.toString());
15486     }
15487 
15488     /**
15489      * Retrieves a correponding package name for a given uid. It will query all
15490      * packages that are associated with the given uid, but it will return only
15491      * the zeroth result.
15492      * Note: If package could not be found, a null is returned.
15493      * @hide
15494      */
getPackageNameForUid(Context context, int uid)15495     public static String getPackageNameForUid(Context context, int uid) {
15496         String[] packages = context.getPackageManager().getPackagesForUid(uid);
15497         if (packages == null) {
15498             return null;
15499         }
15500         return packages[0];
15501     }
15502 }
15503