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