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