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