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