Settings.java revision 5483cea67a60d3c5012fa7120f62e6eacc6ad3ba
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            EPHEMERAL_SETTINGS.add(SOUND_EFFECTS_ENABLED);
4132        }
4133
4134        /**
4135         * When to use Wi-Fi calling
4136         *
4137         * @see android.telephony.TelephonyManager.WifiCallingChoices
4138         * @hide
4139         */
4140        public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
4141
4142        // Settings moved to Settings.Secure
4143
4144        /**
4145         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
4146         * instead
4147         */
4148        @Deprecated
4149        public static final String ADB_ENABLED = Global.ADB_ENABLED;
4150
4151        /**
4152         * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
4153         */
4154        @Deprecated
4155        public static final String ANDROID_ID = Secure.ANDROID_ID;
4156
4157        /**
4158         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
4159         */
4160        @Deprecated
4161        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
4162
4163        /**
4164         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
4165         */
4166        @Deprecated
4167        public static final String DATA_ROAMING = Global.DATA_ROAMING;
4168
4169        /**
4170         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
4171         */
4172        @Deprecated
4173        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
4174
4175        /**
4176         * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
4177         */
4178        @Deprecated
4179        public static final String HTTP_PROXY = Global.HTTP_PROXY;
4180
4181        /**
4182         * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
4183         */
4184        @Deprecated
4185        public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
4186
4187        /**
4188         * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
4189         * instead
4190         */
4191        @Deprecated
4192        public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
4193
4194        /**
4195         * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
4196         */
4197        @Deprecated
4198        public static final String LOGGING_ID = Secure.LOGGING_ID;
4199
4200        /**
4201         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
4202         */
4203        @Deprecated
4204        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
4205
4206        /**
4207         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
4208         * instead
4209         */
4210        @Deprecated
4211        public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
4212
4213        /**
4214         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
4215         * instead
4216         */
4217        @Deprecated
4218        public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
4219
4220        /**
4221         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
4222         * instead
4223         */
4224        @Deprecated
4225        public static final String PARENTAL_CONTROL_REDIRECT_URL =
4226            Secure.PARENTAL_CONTROL_REDIRECT_URL;
4227
4228        /**
4229         * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
4230         */
4231        @Deprecated
4232        public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
4233
4234        /**
4235         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
4236         */
4237        @Deprecated
4238        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
4239
4240        /**
4241         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
4242         */
4243        @Deprecated
4244        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
4245
4246       /**
4247         * @deprecated Use
4248         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
4249         */
4250        @Deprecated
4251        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
4252
4253        /**
4254         * @deprecated Use
4255         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
4256         */
4257        @Deprecated
4258        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
4259                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
4260
4261        /**
4262         * @deprecated Use
4263         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
4264         */
4265        @Deprecated
4266        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
4267                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
4268
4269        /**
4270         * @deprecated Use
4271         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
4272         */
4273        @Deprecated
4274        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
4275                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
4276
4277        /**
4278         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
4279         * instead
4280         */
4281        @Deprecated
4282        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
4283
4284        /**
4285         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
4286         */
4287        @Deprecated
4288        public static final String WIFI_ON = Global.WIFI_ON;
4289
4290        /**
4291         * @deprecated Use
4292         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
4293         * instead
4294         */
4295        @Deprecated
4296        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
4297                Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
4298
4299        /**
4300         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
4301         */
4302        @Deprecated
4303        public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
4304
4305        /**
4306         * @deprecated Use
4307         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
4308         */
4309        @Deprecated
4310        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
4311                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
4312
4313        /**
4314         * @deprecated Use
4315         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
4316         */
4317        @Deprecated
4318        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
4319                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
4320
4321        /**
4322         * @deprecated Use
4323         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
4324         * instead
4325         */
4326        @Deprecated
4327        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
4328                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
4329
4330        /**
4331         * @deprecated Use
4332         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
4333         */
4334        @Deprecated
4335        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
4336            Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
4337
4338        /**
4339         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
4340         * instead
4341         */
4342        @Deprecated
4343        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
4344
4345        /**
4346         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
4347         */
4348        @Deprecated
4349        public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
4350
4351        /**
4352         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
4353         */
4354        @Deprecated
4355        public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
4356
4357        /**
4358         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
4359         * instead
4360         */
4361        @Deprecated
4362        public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
4363
4364        /**
4365         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
4366         * instead
4367         */
4368        @Deprecated
4369        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
4370            Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
4371
4372        /**
4373         * Checks if the specified app can modify system settings. As of API
4374         * level 23, an app cannot modify system settings unless it declares the
4375         * {@link android.Manifest.permission#WRITE_SETTINGS}
4376         * permission in its manifest, <em>and</em> the user specifically grants
4377         * the app this capability. To prompt the user to grant this approval,
4378         * the app must send an intent with the action {@link
4379         * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes
4380         * the system to display a permission management screen.
4381         *
4382         * @param context App context.
4383         * @return true if the calling app can write to system settings, false otherwise
4384         */
4385        public static boolean canWrite(Context context) {
4386            return isCallingPackageAllowedToWriteSettings(context, Process.myUid(),
4387                    context.getOpPackageName(), false);
4388        }
4389    }
4390
4391    /**
4392     * Secure system settings, containing system preferences that applications
4393     * can read but are not allowed to write.  These are for preferences that
4394     * the user must explicitly modify through the system UI or specialized
4395     * APIs for those values, not modified directly by applications.
4396     */
4397    public static final class Secure extends NameValueTable {
4398        /**
4399         * The content:// style URL for this table
4400         */
4401        public static final Uri CONTENT_URI =
4402            Uri.parse("content://" + AUTHORITY + "/secure");
4403
4404        private static final ContentProviderHolder sProviderHolder =
4405                new ContentProviderHolder(CONTENT_URI);
4406
4407        // Populated lazily, guarded by class object:
4408        private static final NameValueCache sNameValueCache = new NameValueCache(
4409                CONTENT_URI,
4410                CALL_METHOD_GET_SECURE,
4411                CALL_METHOD_PUT_SECURE,
4412                sProviderHolder);
4413
4414        private static ILockSettings sLockSettings = null;
4415
4416        private static boolean sIsSystemProcess;
4417        private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
4418        private static final HashSet<String> MOVED_TO_GLOBAL;
4419        static {
4420            MOVED_TO_LOCK_SETTINGS = new HashSet<>(3);
4421            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
4422            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
4423            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
4424
4425            MOVED_TO_GLOBAL = new HashSet<>();
4426            MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
4427            MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
4428            MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
4429            MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
4430            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
4431            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
4432            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
4433            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
4434            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
4435            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
4436            MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
4437            MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
4438            MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
4439            MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
4440            MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
4441            MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
4442            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
4443            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
4444            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
4445            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
4446            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
4447            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
4448            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
4449            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
4450            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
4451            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
4452            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
4453            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
4454            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
4455            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
4456            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
4457            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
4458            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
4459            MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
4460            MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
4461            MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
4462            MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
4463            MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
4464            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
4465            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
4466            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
4467            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
4468            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
4469            MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS);
4470            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
4471            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
4472            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
4473            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
4474            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
4475            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
4476            MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
4477            MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
4478            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
4479            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
4480            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
4481            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
4482            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
4483            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
4484            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
4485            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
4486            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
4487            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
4488            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
4489            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
4490            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
4491            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
4492            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED);
4493            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN);
4494            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI);
4495            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
4496            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
4497            MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
4498            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
4499            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
4500            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
4501            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
4502            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
4503            MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
4504            MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
4505            MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
4506            MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
4507            MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
4508            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
4509            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
4510            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
4511            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
4512            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
4513            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
4514            MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
4515            MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
4516            MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
4517            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
4518            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
4519            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
4520            MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
4521            MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
4522            MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
4523            MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
4524            MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
4525            MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
4526            MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
4527            MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
4528            MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
4529            MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
4530            MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
4531            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
4532            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
4533            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
4534            MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
4535            MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
4536            MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
4537            MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
4538        }
4539
4540        /** @hide */
4541        public static void getMovedToGlobalSettings(Set<String> outKeySet) {
4542            outKeySet.addAll(MOVED_TO_GLOBAL);
4543        }
4544
4545        /**
4546         * Look up a name in the database.
4547         * @param resolver to access the database with
4548         * @param name to look up in the table
4549         * @return the corresponding value, or null if not present
4550         */
4551        public static String getString(ContentResolver resolver, String name) {
4552            return getStringForUser(resolver, name, UserHandle.myUserId());
4553        }
4554
4555        /** @hide */
4556        public static String getStringForUser(ContentResolver resolver, String name,
4557                int userHandle) {
4558            if (MOVED_TO_GLOBAL.contains(name)) {
4559                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
4560                        + " to android.provider.Settings.Global.");
4561                return Global.getStringForUser(resolver, name, userHandle);
4562            }
4563
4564            if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
4565                synchronized (Secure.class) {
4566                    if (sLockSettings == null) {
4567                        sLockSettings = ILockSettings.Stub.asInterface(
4568                                (IBinder) ServiceManager.getService("lock_settings"));
4569                        sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
4570                    }
4571                }
4572                if (sLockSettings != null && !sIsSystemProcess) {
4573                    // No context; use the ActivityThread's context as an approximation for
4574                    // determining the target API level.
4575                    Application application = ActivityThread.currentApplication();
4576
4577                    boolean isPreMnc = application != null
4578                            && application.getApplicationInfo() != null
4579                            && application.getApplicationInfo().targetSdkVersion
4580                            <= VERSION_CODES.LOLLIPOP_MR1;
4581                    if (isPreMnc) {
4582                        try {
4583                            return sLockSettings.getString(name, "0", userHandle);
4584                        } catch (RemoteException re) {
4585                            // Fall through
4586                        }
4587                    } else {
4588                        throw new SecurityException("Settings.Secure." + name
4589                                + " is deprecated and no longer accessible."
4590                                + " See API documentation for potential replacements.");
4591                    }
4592                }
4593            }
4594
4595            return sNameValueCache.getStringForUser(resolver, name, userHandle);
4596        }
4597
4598        /**
4599         * Store a name/value pair into the database.
4600         * @param resolver to access the database with
4601         * @param name to store
4602         * @param value to associate with the name
4603         * @return true if the value was set, false on database errors
4604         */
4605        public static boolean putString(ContentResolver resolver, String name, String value) {
4606            return putStringForUser(resolver, name, value, UserHandle.myUserId());
4607        }
4608
4609        /** @hide */
4610        public static boolean putStringForUser(ContentResolver resolver, String name, String value,
4611                int userHandle) {
4612            return putStringForUser(resolver, name, value, null, false, userHandle);
4613        }
4614
4615        /** @hide */
4616        public static boolean putStringForUser(@NonNull ContentResolver resolver,
4617                @NonNull String name, @Nullable String value, @Nullable String tag,
4618                boolean makeDefault, @UserIdInt int userHandle) {
4619            if (LOCATION_MODE.equals(name)) {
4620                // Map LOCATION_MODE to underlying location provider storage API
4621                return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle);
4622            }
4623            if (MOVED_TO_GLOBAL.contains(name)) {
4624                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
4625                        + " to android.provider.Settings.Global");
4626                return Global.putStringForUser(resolver, name, value,
4627                        tag, makeDefault, userHandle);
4628            }
4629            return sNameValueCache.putStringForUser(resolver, name, value, tag,
4630                    makeDefault, userHandle);
4631        }
4632
4633        /**
4634         * Store a name/value pair into the database.
4635         * <p>
4636         * The method takes an optional tag to associate with the setting
4637         * which can be used to clear only settings made by your package and
4638         * associated with this tag by passing the tag to {@link
4639         * #resetToDefaults(ContentResolver, String)}. Anyone can override
4640         * the current tag. Also if another package changes the setting
4641         * then the tag will be set to the one specified in the set call
4642         * which can be null. Also any of the settings setters that do not
4643         * take a tag as an argument effectively clears the tag.
4644         * </p><p>
4645         * For example, if you set settings A and B with tags T1 and T2 and
4646         * another app changes setting A (potentially to the same value), it
4647         * can assign to it a tag T3 (note that now the package that changed
4648         * the setting is not yours). Now if you reset your changes for T1 and
4649         * T2 only setting B will be reset and A not (as it was changed by
4650         * another package) but since A did not change you are in the desired
4651         * initial state. Now if the other app changes the value of A (assuming
4652         * you registered an observer in the beginning) you would detect that
4653         * the setting was changed by another app and handle this appropriately
4654         * (ignore, set back to some value, etc).
4655         * </p><p>
4656         * Also the method takes an argument whether to make the value the
4657         * default for this setting. If the system already specified a default
4658         * value, then the one passed in here will <strong>not</strong>
4659         * be set as the default.
4660         * </p>
4661         *
4662         * @param resolver to access the database with.
4663         * @param name to store.
4664         * @param value to associate with the name.
4665         * @param tag to associate with the setting.
4666         * @param makeDefault whether to make the value the default one.
4667         * @return true if the value was set, false on database errors.
4668         *
4669         * @see #resetToDefaults(ContentResolver, String)
4670         *
4671         * @hide
4672         */
4673        @SystemApi
4674        @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
4675        public static boolean putString(@NonNull ContentResolver resolver,
4676                @NonNull String name, @Nullable String value, @Nullable String tag,
4677                boolean makeDefault) {
4678            return putStringForUser(resolver, name, value, tag, makeDefault,
4679                    UserHandle.myUserId());
4680        }
4681
4682        /**
4683         * Reset the settings to their defaults. This would reset <strong>only</strong>
4684         * settings set by the caller's package. Think of it of a way to undo your own
4685         * changes to the global settings. Passing in the optional tag will reset only
4686         * settings changed by your package and associated with this tag.
4687         *
4688         * @param resolver Handle to the content resolver.
4689         * @param tag Optional tag which should be associated with the settings to reset.
4690         *
4691         * @see #putString(ContentResolver, String, String, String, boolean)
4692         *
4693         * @hide
4694         */
4695        @SystemApi
4696        @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
4697        public static void resetToDefaults(@NonNull ContentResolver resolver,
4698                @Nullable String tag) {
4699            resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
4700                    UserHandle.myUserId());
4701        }
4702
4703        /**
4704         *
4705         * Reset the settings to their defaults for a given user with a specific mode. The
4706         * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
4707         * allowing resetting the settings made by a package and associated with the tag.
4708         *
4709         * @param resolver Handle to the content resolver.
4710         * @param tag Optional tag which should be associated with the settings to reset.
4711         * @param mode The reset mode.
4712         * @param userHandle The user for which to reset to defaults.
4713         *
4714         * @see #RESET_MODE_PACKAGE_DEFAULTS
4715         * @see #RESET_MODE_UNTRUSTED_DEFAULTS
4716         * @see #RESET_MODE_UNTRUSTED_CHANGES
4717         * @see #RESET_MODE_TRUSTED_DEFAULTS
4718         *
4719         * @hide
4720         */
4721        public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
4722                @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
4723            try {
4724                Bundle arg = new Bundle();
4725                arg.putInt(CALL_METHOD_USER_KEY, userHandle);
4726                if (tag != null) {
4727                    arg.putString(CALL_METHOD_TAG_KEY, tag);
4728                }
4729                arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
4730                IContentProvider cp = sProviderHolder.getProvider(resolver);
4731                cp.call(resolver.getPackageName(), CALL_METHOD_RESET_SECURE, null, arg);
4732            } catch (RemoteException e) {
4733                Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
4734            }
4735        }
4736
4737        /**
4738         * Construct the content URI for a particular name/value pair,
4739         * useful for monitoring changes with a ContentObserver.
4740         * @param name to look up in the table
4741         * @return the corresponding content URI, or null if not present
4742         */
4743        public static Uri getUriFor(String name) {
4744            if (MOVED_TO_GLOBAL.contains(name)) {
4745                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
4746                        + " to android.provider.Settings.Global, returning global URI.");
4747                return Global.getUriFor(Global.CONTENT_URI, name);
4748            }
4749            return getUriFor(CONTENT_URI, name);
4750        }
4751
4752        /**
4753         * Convenience function for retrieving a single secure settings value
4754         * as an integer.  Note that internally setting values are always
4755         * stored as strings; this function converts the string to an integer
4756         * for you.  The default value will be returned if the setting is
4757         * not defined or not an integer.
4758         *
4759         * @param cr The ContentResolver to access.
4760         * @param name The name of the setting to retrieve.
4761         * @param def Value to return if the setting is not defined.
4762         *
4763         * @return The setting's current value, or 'def' if it is not defined
4764         * or not a valid integer.
4765         */
4766        public static int getInt(ContentResolver cr, String name, int def) {
4767            return getIntForUser(cr, name, def, UserHandle.myUserId());
4768        }
4769
4770        /** @hide */
4771        public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
4772            if (LOCATION_MODE.equals(name)) {
4773                // Map from to underlying location provider storage API to location mode
4774                return getLocationModeForUser(cr, userHandle);
4775            }
4776            String v = getStringForUser(cr, name, userHandle);
4777            try {
4778                return v != null ? Integer.parseInt(v) : def;
4779            } catch (NumberFormatException e) {
4780                return def;
4781            }
4782        }
4783
4784        /**
4785         * Convenience function for retrieving a single secure settings value
4786         * as an integer.  Note that internally setting values are always
4787         * stored as strings; this function converts the string to an integer
4788         * for you.
4789         * <p>
4790         * This version does not take a default value.  If the setting has not
4791         * been set, or the string value is not a number,
4792         * it throws {@link SettingNotFoundException}.
4793         *
4794         * @param cr The ContentResolver to access.
4795         * @param name The name of the setting to retrieve.
4796         *
4797         * @throws SettingNotFoundException Thrown if a setting by the given
4798         * name can't be found or the setting value is not an integer.
4799         *
4800         * @return The setting's current value.
4801         */
4802        public static int getInt(ContentResolver cr, String name)
4803                throws SettingNotFoundException {
4804            return getIntForUser(cr, name, UserHandle.myUserId());
4805        }
4806
4807        /** @hide */
4808        public static int getIntForUser(ContentResolver cr, String name, int userHandle)
4809                throws SettingNotFoundException {
4810            if (LOCATION_MODE.equals(name)) {
4811                // Map from to underlying location provider storage API to location mode
4812                return getLocationModeForUser(cr, userHandle);
4813            }
4814            String v = getStringForUser(cr, name, userHandle);
4815            try {
4816                return Integer.parseInt(v);
4817            } catch (NumberFormatException e) {
4818                throw new SettingNotFoundException(name);
4819            }
4820        }
4821
4822        /**
4823         * Convenience function for updating a single settings value as an
4824         * integer. This will either create a new entry in the table if the
4825         * given name does not exist, or modify the value of the existing row
4826         * with that name.  Note that internally setting values are always
4827         * stored as strings, so this function converts the given value to a
4828         * string before storing it.
4829         *
4830         * @param cr The ContentResolver to access.
4831         * @param name The name of the setting to modify.
4832         * @param value The new value for the setting.
4833         * @return true if the value was set, false on database errors
4834         */
4835        public static boolean putInt(ContentResolver cr, String name, int value) {
4836            return putIntForUser(cr, name, value, UserHandle.myUserId());
4837        }
4838
4839        /** @hide */
4840        public static boolean putIntForUser(ContentResolver cr, String name, int value,
4841                int userHandle) {
4842            return putStringForUser(cr, name, Integer.toString(value), userHandle);
4843        }
4844
4845        /**
4846         * Convenience function for retrieving a single secure settings value
4847         * as a {@code long}.  Note that internally setting values are always
4848         * stored as strings; this function converts the string to a {@code long}
4849         * for you.  The default value will be returned if the setting is
4850         * not defined or not a {@code long}.
4851         *
4852         * @param cr The ContentResolver to access.
4853         * @param name The name of the setting to retrieve.
4854         * @param def Value to return if the setting is not defined.
4855         *
4856         * @return The setting's current value, or 'def' if it is not defined
4857         * or not a valid {@code long}.
4858         */
4859        public static long getLong(ContentResolver cr, String name, long def) {
4860            return getLongForUser(cr, name, def, UserHandle.myUserId());
4861        }
4862
4863        /** @hide */
4864        public static long getLongForUser(ContentResolver cr, String name, long def,
4865                int userHandle) {
4866            String valString = getStringForUser(cr, name, userHandle);
4867            long value;
4868            try {
4869                value = valString != null ? Long.parseLong(valString) : def;
4870            } catch (NumberFormatException e) {
4871                value = def;
4872            }
4873            return value;
4874        }
4875
4876        /**
4877         * Convenience function for retrieving a single secure settings value
4878         * as a {@code long}.  Note that internally setting values are always
4879         * stored as strings; this function converts the string to a {@code long}
4880         * for you.
4881         * <p>
4882         * This version does not take a default value.  If the setting has not
4883         * been set, or the string value is not a number,
4884         * it throws {@link SettingNotFoundException}.
4885         *
4886         * @param cr The ContentResolver to access.
4887         * @param name The name of the setting to retrieve.
4888         *
4889         * @return The setting's current value.
4890         * @throws SettingNotFoundException Thrown if a setting by the given
4891         * name can't be found or the setting value is not an integer.
4892         */
4893        public static long getLong(ContentResolver cr, String name)
4894                throws SettingNotFoundException {
4895            return getLongForUser(cr, name, UserHandle.myUserId());
4896        }
4897
4898        /** @hide */
4899        public static long getLongForUser(ContentResolver cr, String name, int userHandle)
4900                throws SettingNotFoundException {
4901            String valString = getStringForUser(cr, name, userHandle);
4902            try {
4903                return Long.parseLong(valString);
4904            } catch (NumberFormatException e) {
4905                throw new SettingNotFoundException(name);
4906            }
4907        }
4908
4909        /**
4910         * Convenience function for updating a secure settings value as a long
4911         * integer. This will either create a new entry in the table if the
4912         * given name does not exist, or modify the value of the existing row
4913         * with that name.  Note that internally setting values are always
4914         * stored as strings, so this function converts the given value to a
4915         * string before storing it.
4916         *
4917         * @param cr The ContentResolver to access.
4918         * @param name The name of the setting to modify.
4919         * @param value The new value for the setting.
4920         * @return true if the value was set, false on database errors
4921         */
4922        public static boolean putLong(ContentResolver cr, String name, long value) {
4923            return putLongForUser(cr, name, value, UserHandle.myUserId());
4924        }
4925
4926        /** @hide */
4927        public static boolean putLongForUser(ContentResolver cr, String name, long value,
4928                int userHandle) {
4929            return putStringForUser(cr, name, Long.toString(value), userHandle);
4930        }
4931
4932        /**
4933         * Convenience function for retrieving a single secure settings value
4934         * as a floating point number.  Note that internally setting values are
4935         * always stored as strings; this function converts the string to an
4936         * float for you. The default value will be returned if the setting
4937         * is not defined or not a valid float.
4938         *
4939         * @param cr The ContentResolver to access.
4940         * @param name The name of the setting to retrieve.
4941         * @param def Value to return if the setting is not defined.
4942         *
4943         * @return The setting's current value, or 'def' if it is not defined
4944         * or not a valid float.
4945         */
4946        public static float getFloat(ContentResolver cr, String name, float def) {
4947            return getFloatForUser(cr, name, def, UserHandle.myUserId());
4948        }
4949
4950        /** @hide */
4951        public static float getFloatForUser(ContentResolver cr, String name, float def,
4952                int userHandle) {
4953            String v = getStringForUser(cr, name, userHandle);
4954            try {
4955                return v != null ? Float.parseFloat(v) : def;
4956            } catch (NumberFormatException e) {
4957                return def;
4958            }
4959        }
4960
4961        /**
4962         * Convenience function for retrieving a single secure settings value
4963         * as a float.  Note that internally setting values are always
4964         * stored as strings; this function converts the string to a float
4965         * for you.
4966         * <p>
4967         * This version does not take a default value.  If the setting has not
4968         * been set, or the string value is not a number,
4969         * it throws {@link SettingNotFoundException}.
4970         *
4971         * @param cr The ContentResolver to access.
4972         * @param name The name of the setting to retrieve.
4973         *
4974         * @throws SettingNotFoundException Thrown if a setting by the given
4975         * name can't be found or the setting value is not a float.
4976         *
4977         * @return The setting's current value.
4978         */
4979        public static float getFloat(ContentResolver cr, String name)
4980                throws SettingNotFoundException {
4981            return getFloatForUser(cr, name, UserHandle.myUserId());
4982        }
4983
4984        /** @hide */
4985        public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
4986                throws SettingNotFoundException {
4987            String v = getStringForUser(cr, name, userHandle);
4988            if (v == null) {
4989                throw new SettingNotFoundException(name);
4990            }
4991            try {
4992                return Float.parseFloat(v);
4993            } catch (NumberFormatException e) {
4994                throw new SettingNotFoundException(name);
4995            }
4996        }
4997
4998        /**
4999         * Convenience function for updating a single settings value as a
5000         * floating point number. This will either create a new entry in the
5001         * table if the given name does not exist, or modify the value of the
5002         * existing row with that name.  Note that internally setting values
5003         * are always stored as strings, so this function converts the given
5004         * value to a string before storing it.
5005         *
5006         * @param cr The ContentResolver to access.
5007         * @param name The name of the setting to modify.
5008         * @param value The new value for the setting.
5009         * @return true if the value was set, false on database errors
5010         */
5011        public static boolean putFloat(ContentResolver cr, String name, float value) {
5012            return putFloatForUser(cr, name, value, UserHandle.myUserId());
5013        }
5014
5015        /** @hide */
5016        public static boolean putFloatForUser(ContentResolver cr, String name, float value,
5017                int userHandle) {
5018            return putStringForUser(cr, name, Float.toString(value), userHandle);
5019        }
5020
5021        /**
5022         * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
5023         * instead
5024         */
5025        @Deprecated
5026        public static final String DEVELOPMENT_SETTINGS_ENABLED =
5027                Global.DEVELOPMENT_SETTINGS_ENABLED;
5028
5029        /**
5030         * When the user has enable the option to have a "bug report" command
5031         * in the power menu.
5032         * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
5033         * @hide
5034         */
5035        @Deprecated
5036        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
5037
5038        /**
5039         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
5040         */
5041        @Deprecated
5042        public static final String ADB_ENABLED = Global.ADB_ENABLED;
5043
5044        /**
5045         * Setting to allow mock locations and location provider status to be injected into the
5046         * LocationManager service for testing purposes during application development.  These
5047         * locations and status values  override actual location and status information generated
5048         * by network, gps, or other location providers.
5049         *
5050         * @deprecated This settings is not used anymore.
5051         */
5052        @Deprecated
5053        public static final String ALLOW_MOCK_LOCATION = "mock_location";
5054
5055        /**
5056         * A 64-bit number (as a hex string) that is randomly
5057         * generated when the user first sets up the device and should remain
5058         * constant for the lifetime of the user's device. The value may
5059         * change if a factory reset is performed on the device.
5060         * <p class="note"><strong>Note:</strong> When a device has <a
5061         * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a>
5062         * (available on certain devices running Android 4.2 or higher), each user appears as a
5063         * completely separate device, so the {@code ANDROID_ID} value is unique to each
5064         * user.</p>
5065         */
5066        public static final String ANDROID_ID = "android_id";
5067
5068        /**
5069         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
5070         */
5071        @Deprecated
5072        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
5073
5074        /**
5075         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
5076         */
5077        @Deprecated
5078        public static final String DATA_ROAMING = Global.DATA_ROAMING;
5079
5080        /**
5081         * Setting to record the input method used by default, holding the ID
5082         * of the desired method.
5083         */
5084        public static final String DEFAULT_INPUT_METHOD = "default_input_method";
5085
5086        /**
5087         * Setting to record the input method subtype used by default, holding the ID
5088         * of the desired method.
5089         */
5090        public static final String SELECTED_INPUT_METHOD_SUBTYPE =
5091                "selected_input_method_subtype";
5092
5093        /**
5094         * Setting to record the history of input method subtype, holding the pair of ID of IME
5095         * and its last used subtype.
5096         * @hide
5097         */
5098        public static final String INPUT_METHODS_SUBTYPE_HISTORY =
5099                "input_methods_subtype_history";
5100
5101        /**
5102         * Setting to record the visibility of input method selector
5103         */
5104        public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
5105                "input_method_selector_visibility";
5106
5107        /**
5108         * The currently selected voice interaction service flattened ComponentName.
5109         * @hide
5110         */
5111        @TestApi
5112        public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
5113
5114        /**
5115         * The currently selected auto-fill service flattened ComponentName.
5116         * @hide
5117         */
5118        @TestApi
5119        public static final String AUTO_FILL_SERVICE = "auto_fill_service";
5120
5121        /**
5122         * bluetooth HCI snoop log configuration
5123         * @hide
5124         */
5125        public static final String BLUETOOTH_HCI_LOG =
5126                "bluetooth_hci_log";
5127
5128        /**
5129         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
5130         */
5131        @Deprecated
5132        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
5133
5134        /**
5135         * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
5136         * @hide
5137         */
5138        public static final String USER_SETUP_COMPLETE = "user_setup_complete";
5139
5140        /**
5141         * Prefix for category name that marks whether a suggested action from that category was
5142         * completed.
5143         * @hide
5144         */
5145        public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category.";
5146
5147        /**
5148         * List of input methods that are currently enabled.  This is a string
5149         * containing the IDs of all enabled input methods, each ID separated
5150         * by ':'.
5151         */
5152        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
5153
5154        /**
5155         * List of system input methods that are currently disabled.  This is a string
5156         * containing the IDs of all disabled input methods, each ID separated
5157         * by ':'.
5158         * @hide
5159         */
5160        public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
5161
5162        /**
5163         * Whether to show the IME when a hard keyboard is connected. This is a boolean that
5164         * determines if the IME should be shown when a hard keyboard is attached.
5165         * @hide
5166         */
5167        public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
5168
5169        /**
5170         * Host name and port for global http proxy. Uses ':' seperator for
5171         * between host and port.
5172         *
5173         * @deprecated Use {@link Global#HTTP_PROXY}
5174         */
5175        @Deprecated
5176        public static final String HTTP_PROXY = Global.HTTP_PROXY;
5177
5178        /**
5179         * Package designated as always-on VPN provider.
5180         *
5181         * @hide
5182         */
5183        public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app";
5184
5185        /**
5186         * Whether to block networking outside of VPN connections while always-on is set.
5187         * @see #ALWAYS_ON_VPN_APP
5188         *
5189         * @hide
5190         */
5191        public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown";
5192
5193        /**
5194         * Whether applications can be installed for this user via the system's
5195         * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
5196         *
5197         * <p>1 = permit app installation via the system package installer intent
5198         * <p>0 = do not allow use of the package installer
5199         * @deprecated Starting from {@link android.os.Build.VERSION_CODES#O}, apps should use
5200         * {@link PackageManager#canRequestPackageInstalls()}
5201         * @see PackageManager#canRequestPackageInstalls()
5202         */
5203        public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
5204
5205        /**
5206         * Comma-separated list of location providers that activities may access. Do not rely on
5207         * this value being present in settings.db or on ContentObserver notifications on the
5208         * corresponding Uri.
5209         *
5210         * @deprecated use {@link #LOCATION_MODE} and
5211         * {@link LocationManager#MODE_CHANGED_ACTION} (or
5212         * {@link LocationManager#PROVIDERS_CHANGED_ACTION})
5213         */
5214        @Deprecated
5215        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
5216
5217        /**
5218         * The degree of location access enabled by the user.
5219         * <p>
5220         * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
5221         * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link
5222         * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link
5223         * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location
5224         * modes that might be added in the future.
5225         * <p>
5226         * Note: do not rely on this value being present in settings.db or on ContentObserver
5227         * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION}
5228         * to receive changes in this value.
5229         */
5230        public static final String LOCATION_MODE = "location_mode";
5231        /**
5232         * Stores the previous location mode when {@link #LOCATION_MODE} is set to
5233         * {@link #LOCATION_MODE_OFF}
5234         * @hide
5235         */
5236        public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode";
5237
5238        /**
5239         * Sets all location providers to the previous states before location was turned off.
5240         * @hide
5241         */
5242        public static final int LOCATION_MODE_PREVIOUS = -1;
5243        /**
5244         * Location access disabled.
5245         */
5246        public static final int LOCATION_MODE_OFF = 0;
5247        /**
5248         * Network Location Provider disabled, but GPS and other sensors enabled.
5249         */
5250        public static final int LOCATION_MODE_SENSORS_ONLY = 1;
5251        /**
5252         * Reduced power usage, such as limiting the number of GPS updates per hour. Requests
5253         * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to
5254         * {@link android.location.Criteria#POWER_MEDIUM}.
5255         */
5256        public static final int LOCATION_MODE_BATTERY_SAVING = 2;
5257        /**
5258         * Best-effort location computation allowed.
5259         */
5260        public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
5261
5262        /**
5263         * A flag containing settings used for biometric weak
5264         * @hide
5265         */
5266        @Deprecated
5267        public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
5268                "lock_biometric_weak_flags";
5269
5270        /**
5271         * Whether lock-to-app will lock the keyguard when exiting.
5272         * @hide
5273         */
5274        public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
5275
5276        /**
5277         * Whether autolock is enabled (0 = false, 1 = true)
5278         *
5279         * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
5280         *             level of the keyguard. Accessing this setting from an app that is targeting
5281         *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
5282         */
5283        @Deprecated
5284        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
5285
5286        /**
5287         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
5288         *
5289         * @deprecated Accessing this setting from an app that is targeting
5290         *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
5291         */
5292        @Deprecated
5293        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
5294
5295        /**
5296         * Whether lock pattern will vibrate as user enters (0 = false, 1 =
5297         * true)
5298         *
5299         * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
5300         *             lockscreen uses
5301         *             {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
5302         *             Accessing this setting from an app that is targeting
5303         *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
5304         */
5305        @Deprecated
5306        public static final String
5307                LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
5308
5309        /**
5310         * This preference allows the device to be locked given time after screen goes off,
5311         * subject to current DeviceAdmin policy limits.
5312         * @hide
5313         */
5314        public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
5315
5316
5317        /**
5318         * This preference contains the string that shows for owner info on LockScreen.
5319         * @hide
5320         * @deprecated
5321         */
5322        @Deprecated
5323        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
5324
5325        /**
5326         * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
5327         * @hide
5328         */
5329        @Deprecated
5330        public static final String LOCK_SCREEN_APPWIDGET_IDS =
5331            "lock_screen_appwidget_ids";
5332
5333        /**
5334         * Id of the appwidget shown on the lock screen when appwidgets are disabled.
5335         * @hide
5336         */
5337        @Deprecated
5338        public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
5339            "lock_screen_fallback_appwidget_id";
5340
5341        /**
5342         * Index of the lockscreen appwidget to restore, -1 if none.
5343         * @hide
5344         */
5345        @Deprecated
5346        public static final String LOCK_SCREEN_STICKY_APPWIDGET =
5347            "lock_screen_sticky_appwidget";
5348
5349        /**
5350         * This preference enables showing the owner info on LockScreen.
5351         * @hide
5352         * @deprecated
5353         */
5354        @Deprecated
5355        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
5356            "lock_screen_owner_info_enabled";
5357
5358        /**
5359         * When set by a user, allows notifications to be shown atop a securely locked screen
5360         * in their full "private" form (same as when the device is unlocked).
5361         * @hide
5362         */
5363        public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
5364                "lock_screen_allow_private_notifications";
5365
5366        /**
5367         * When set by a user, allows notification remote input atop a securely locked screen
5368         * without having to unlock
5369         * @hide
5370         */
5371        public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT =
5372                "lock_screen_allow_remote_input";
5373
5374        /**
5375         * Set by the system to track if the user needs to see the call to action for
5376         * the lockscreen notification policy.
5377         * @hide
5378         */
5379        public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
5380                "show_note_about_notification_hiding";
5381
5382        /**
5383         * Set to 1 by the system after trust agents have been initialized.
5384         * @hide
5385         */
5386        public static final String TRUST_AGENTS_INITIALIZED =
5387                "trust_agents_initialized";
5388
5389        /**
5390         * The Logging ID (a unique 64-bit value) as a hex string.
5391         * Used as a pseudonymous identifier for logging.
5392         * @deprecated This identifier is poorly initialized and has
5393         * many collisions.  It should not be used.
5394         */
5395        @Deprecated
5396        public static final String LOGGING_ID = "logging_id";
5397
5398        /**
5399         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
5400         */
5401        @Deprecated
5402        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
5403
5404        /**
5405         * No longer supported.
5406         */
5407        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
5408
5409        /**
5410         * No longer supported.
5411         */
5412        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
5413
5414        /**
5415         * No longer supported.
5416         */
5417        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
5418
5419        /**
5420         * Settings classname to launch when Settings is clicked from All
5421         * Applications.  Needed because of user testing between the old
5422         * and new Settings apps.
5423         */
5424        // TODO: 881807
5425        public static final String SETTINGS_CLASSNAME = "settings_classname";
5426
5427        /**
5428         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
5429         */
5430        @Deprecated
5431        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
5432
5433        /**
5434         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
5435         */
5436        @Deprecated
5437        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
5438
5439        /**
5440         * If accessibility is enabled.
5441         */
5442        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
5443
5444        /**
5445         * Setting specifying if the accessibility shortcut dialog has been shown to this user.
5446         * @hide
5447         */
5448        public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN =
5449                "accessibility_shortcut_dialog_shown";
5450
5451        /**
5452         * Setting specifying the the accessibility service to be toggled via the accessibility
5453         * shortcut. Must be its flattened {@link ComponentName}.
5454         * @hide
5455         */
5456        public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE =
5457                "accessibility_shortcut_target_service";
5458
5459        /**
5460         * If touch exploration is enabled.
5461         */
5462        public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
5463
5464        /**
5465         * List of the enabled accessibility providers.
5466         */
5467        public static final String ENABLED_ACCESSIBILITY_SERVICES =
5468            "enabled_accessibility_services";
5469
5470        /**
5471         * List of the accessibility services to which the user has granted
5472         * permission to put the device into touch exploration mode.
5473         *
5474         * @hide
5475         */
5476        public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
5477            "touch_exploration_granted_accessibility_services";
5478
5479        /**
5480         * Whether to speak passwords while in accessibility mode.
5481         */
5482        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
5483
5484        /**
5485         * Whether to draw text with high contrast while in accessibility mode.
5486         *
5487         * @hide
5488         */
5489        public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
5490                "high_text_contrast_enabled";
5491
5492        /**
5493         * If injection of accessibility enhancing JavaScript screen-reader
5494         * is enabled.
5495         * <p>
5496         *   Note: The JavaScript based screen-reader is served by the
5497         *   Google infrastructure and enable users with disabilities to
5498         *   efficiently navigate in and explore web content.
5499         * </p>
5500         * <p>
5501         *   This property represents a boolean value.
5502         * </p>
5503         * @hide
5504         */
5505        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
5506            "accessibility_script_injection";
5507
5508        /**
5509         * The URL for the injected JavaScript based screen-reader used
5510         * for providing accessibility of content in WebView.
5511         * <p>
5512         *   Note: The JavaScript based screen-reader is served by the
5513         *   Google infrastructure and enable users with disabilities to
5514         *   efficiently navigate in and explore web content.
5515         * </p>
5516         * <p>
5517         *   This property represents a string value.
5518         * </p>
5519         * @hide
5520         */
5521        public static final String ACCESSIBILITY_SCREEN_READER_URL =
5522            "accessibility_script_injection_url";
5523
5524        /**
5525         * Key bindings for navigation in built-in accessibility support for web content.
5526         * <p>
5527         *   Note: These key bindings are for the built-in accessibility navigation for
5528         *   web content which is used as a fall back solution if JavaScript in a WebView
5529         *   is not enabled or the user has not opted-in script injection from Google.
5530         * </p>
5531         * <p>
5532         *   The bindings are separated by semi-colon. A binding is a mapping from
5533         *   a key to a sequence of actions (for more details look at
5534         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
5535         *   string representation of an integer obtained from a meta state (optional) shifted
5536         *   sixteen times left and bitwise ored with a key code. An action is represented
5537         *   as a hexademical string representation of an integer where the first two digits
5538         *   are navigation action index, the second, the third, and the fourth digit pairs
5539         *   represent the action arguments. The separate actions in a binding are colon
5540         *   separated. The key and the action sequence it maps to are separated by equals.
5541         * </p>
5542         * <p>
5543         *   For example, the binding below maps the DPAD right button to traverse the
5544         *   current navigation axis once without firing an accessibility event and to
5545         *   perform the same traversal again but to fire an event:
5546         *   <code>
5547         *     0x16=0x01000100:0x01000101;
5548         *   </code>
5549         * </p>
5550         * <p>
5551         *   The goal of this binding is to enable dynamic rebinding of keys to
5552         *   navigation actions for web content without requiring a framework change.
5553         * </p>
5554         * <p>
5555         *   This property represents a string value.
5556         * </p>
5557         * @hide
5558         */
5559        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
5560            "accessibility_web_content_key_bindings";
5561
5562        /**
5563         * Setting that specifies whether the display magnification is enabled.
5564         * Display magnifications allows the user to zoom in the display content
5565         * and is targeted to low vision users. The current magnification scale
5566         * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
5567         *
5568         * @hide
5569         */
5570        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
5571                "accessibility_display_magnification_enabled";
5572
5573        /**
5574         * Setting that specifies what the display magnification scale is.
5575         * Display magnifications allows the user to zoom in the display
5576         * content and is targeted to low vision users. Whether a display
5577         * magnification is performed is controlled by
5578         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
5579         *
5580         * @hide
5581         */
5582        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
5583                "accessibility_display_magnification_scale";
5584
5585        /**
5586         * Unused mangnification setting
5587         *
5588         * @hide
5589         * @deprecated
5590         */
5591        @Deprecated
5592        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
5593                "accessibility_display_magnification_auto_update";
5594
5595        /**
5596         * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be
5597         * modified from an AccessibilityService using the SoftKeyboardController.
5598         *
5599         * @hide
5600         */
5601        public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE =
5602                "accessibility_soft_keyboard_mode";
5603
5604        /**
5605         * Default soft keyboard behavior.
5606         *
5607         * @hide
5608         */
5609        public static final int SHOW_MODE_AUTO = 0;
5610
5611        /**
5612         * Soft keyboard is never shown.
5613         *
5614         * @hide
5615         */
5616        public static final int SHOW_MODE_HIDDEN = 1;
5617
5618        /**
5619         * Setting that specifies whether timed text (captions) should be
5620         * displayed in video content. Text display properties are controlled by
5621         * the following settings:
5622         * <ul>
5623         * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
5624         * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
5625         * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
5626         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
5627         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
5628         * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
5629         * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
5630         * </ul>
5631         *
5632         * @hide
5633         */
5634        public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
5635                "accessibility_captioning_enabled";
5636
5637        /**
5638         * Setting that specifies the language for captions as a locale string,
5639         * e.g. en_US.
5640         *
5641         * @see java.util.Locale#toString
5642         * @hide
5643         */
5644        public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
5645                "accessibility_captioning_locale";
5646
5647        /**
5648         * Integer property that specifies the preset style for captions, one
5649         * of:
5650         * <ul>
5651         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
5652         * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
5653         * </ul>
5654         *
5655         * @see java.util.Locale#toString
5656         * @hide
5657         */
5658        public static final String ACCESSIBILITY_CAPTIONING_PRESET =
5659                "accessibility_captioning_preset";
5660
5661        /**
5662         * Integer property that specifes the background color for captions as a
5663         * packed 32-bit color.
5664         *
5665         * @see android.graphics.Color#argb
5666         * @hide
5667         */
5668        public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
5669                "accessibility_captioning_background_color";
5670
5671        /**
5672         * Integer property that specifes the foreground color for captions as a
5673         * packed 32-bit color.
5674         *
5675         * @see android.graphics.Color#argb
5676         * @hide
5677         */
5678        public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
5679                "accessibility_captioning_foreground_color";
5680
5681        /**
5682         * Integer property that specifes the edge type for captions, one of:
5683         * <ul>
5684         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
5685         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
5686         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
5687         * </ul>
5688         *
5689         * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
5690         * @hide
5691         */
5692        public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
5693                "accessibility_captioning_edge_type";
5694
5695        /**
5696         * Integer property that specifes the edge color for captions as a
5697         * packed 32-bit color.
5698         *
5699         * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
5700         * @see android.graphics.Color#argb
5701         * @hide
5702         */
5703        public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
5704                "accessibility_captioning_edge_color";
5705
5706        /**
5707         * Integer property that specifes the window color for captions as a
5708         * packed 32-bit color.
5709         *
5710         * @see android.graphics.Color#argb
5711         * @hide
5712         */
5713        public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
5714                "accessibility_captioning_window_color";
5715
5716        /**
5717         * String property that specifies the typeface for captions, one of:
5718         * <ul>
5719         * <li>DEFAULT
5720         * <li>MONOSPACE
5721         * <li>SANS_SERIF
5722         * <li>SERIF
5723         * </ul>
5724         *
5725         * @see android.graphics.Typeface
5726         * @hide
5727         */
5728        public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
5729                "accessibility_captioning_typeface";
5730
5731        /**
5732         * Floating point property that specifies font scaling for captions.
5733         *
5734         * @hide
5735         */
5736        public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
5737                "accessibility_captioning_font_scale";
5738
5739        /**
5740         * Setting that specifies whether display color inversion is enabled.
5741         */
5742        public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
5743                "accessibility_display_inversion_enabled";
5744
5745        /**
5746         * Setting that specifies whether display color space adjustment is
5747         * enabled.
5748         *
5749         * @hide
5750         */
5751        public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
5752                "accessibility_display_daltonizer_enabled";
5753
5754        /**
5755         * Integer property that specifies the type of color space adjustment to
5756         * perform. Valid values are defined in AccessibilityManager.
5757         *
5758         * @hide
5759         */
5760        public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
5761                "accessibility_display_daltonizer";
5762
5763        /**
5764         * Setting that specifies whether automatic click when the mouse pointer stops moving is
5765         * enabled.
5766         *
5767         * @hide
5768         */
5769        public static final String ACCESSIBILITY_AUTOCLICK_ENABLED =
5770                "accessibility_autoclick_enabled";
5771
5772        /**
5773         * Integer setting specifying amount of time in ms the mouse pointer has to stay still
5774         * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set.
5775         *
5776         * @see #ACCESSIBILITY_AUTOCLICK_ENABLED
5777         * @hide
5778         */
5779        public static final String ACCESSIBILITY_AUTOCLICK_DELAY =
5780                "accessibility_autoclick_delay";
5781
5782        /**
5783         * Whether or not larger size icons are used for the pointer of mouse/trackpad for
5784         * accessibility.
5785         * (0 = false, 1 = true)
5786         * @hide
5787         */
5788        public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
5789                "accessibility_large_pointer_icon";
5790
5791        /**
5792         * The timeout for considering a press to be a long press in milliseconds.
5793         * @hide
5794         */
5795        public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
5796
5797        /**
5798         * The duration in milliseconds between the first tap's up event and the second tap's
5799         * down event for an interaction to be considered part of the same multi-press.
5800         * @hide
5801         */
5802        public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout";
5803
5804        /**
5805         * List of the enabled print services.
5806         *
5807         * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade
5808         * from pre-N.
5809         *
5810         * @hide
5811         */
5812        public static final String ENABLED_PRINT_SERVICES =
5813            "enabled_print_services";
5814
5815        /**
5816         * List of the disabled print services.
5817         *
5818         * @hide
5819         */
5820        public static final String DISABLED_PRINT_SERVICES =
5821            "disabled_print_services";
5822
5823        /**
5824         * The saved value for WindowManagerService.setForcedDisplayDensity()
5825         * formatted as a single integer representing DPI. If unset, then use
5826         * the real display density.
5827         *
5828         * @hide
5829         */
5830        public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
5831
5832        /**
5833         * Setting to always use the default text-to-speech settings regardless
5834         * of the application settings.
5835         * 1 = override application settings,
5836         * 0 = use application settings (if specified).
5837         *
5838         * @deprecated  The value of this setting is no longer respected by
5839         * the framework text to speech APIs as of the Ice Cream Sandwich release.
5840         */
5841        @Deprecated
5842        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
5843
5844        /**
5845         * Default text-to-speech engine speech rate. 100 = 1x
5846         */
5847        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
5848
5849        /**
5850         * Default text-to-speech engine pitch. 100 = 1x
5851         */
5852        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
5853
5854        /**
5855         * Default text-to-speech engine.
5856         */
5857        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
5858
5859        /**
5860         * Default text-to-speech language.
5861         *
5862         * @deprecated this setting is no longer in use, as of the Ice Cream
5863         * Sandwich release. Apps should never need to read this setting directly,
5864         * instead can query the TextToSpeech framework classes for the default
5865         * locale. {@link TextToSpeech#getLanguage()}.
5866         */
5867        @Deprecated
5868        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
5869
5870        /**
5871         * Default text-to-speech country.
5872         *
5873         * @deprecated this setting is no longer in use, as of the Ice Cream
5874         * Sandwich release. Apps should never need to read this setting directly,
5875         * instead can query the TextToSpeech framework classes for the default
5876         * locale. {@link TextToSpeech#getLanguage()}.
5877         */
5878        @Deprecated
5879        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
5880
5881        /**
5882         * Default text-to-speech locale variant.
5883         *
5884         * @deprecated this setting is no longer in use, as of the Ice Cream
5885         * Sandwich release. Apps should never need to read this setting directly,
5886         * instead can query the TextToSpeech framework classes for the
5887         * locale that is in use {@link TextToSpeech#getLanguage()}.
5888         */
5889        @Deprecated
5890        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
5891
5892        /**
5893         * Stores the default tts locales on a per engine basis. Stored as
5894         * a comma seperated list of values, each value being of the form
5895         * {@code engine_name:locale} for example,
5896         * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
5897         * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
5898         * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
5899         * setting directly, and can query the TextToSpeech framework classes
5900         * for the locale that is in use.
5901         *
5902         * @hide
5903         */
5904        public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
5905
5906        /**
5907         * Space delimited list of plugin packages that are enabled.
5908         */
5909        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
5910
5911        /**
5912         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
5913         * instead.
5914         */
5915        @Deprecated
5916        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
5917                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
5918
5919        /**
5920         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
5921         * instead.
5922         */
5923        @Deprecated
5924        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
5925                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
5926
5927        /**
5928         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
5929         * instead.
5930         */
5931        @Deprecated
5932        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
5933                Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
5934
5935        /**
5936         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
5937         * instead.
5938         */
5939        @Deprecated
5940        public static final String WIFI_ON = Global.WIFI_ON;
5941
5942        /**
5943         * The acceptable packet loss percentage (range 0 - 100) before trying
5944         * another AP on the same network.
5945         * @deprecated This setting is not used.
5946         */
5947        @Deprecated
5948        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
5949                "wifi_watchdog_acceptable_packet_loss_percentage";
5950
5951        /**
5952         * The number of access points required for a network in order for the
5953         * watchdog to monitor it.
5954         * @deprecated This setting is not used.
5955         */
5956        @Deprecated
5957        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
5958
5959        /**
5960         * The delay between background checks.
5961         * @deprecated This setting is not used.
5962         */
5963        @Deprecated
5964        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
5965                "wifi_watchdog_background_check_delay_ms";
5966
5967        /**
5968         * Whether the Wi-Fi watchdog is enabled for background checking even
5969         * after it thinks the user has connected to a good access point.
5970         * @deprecated This setting is not used.
5971         */
5972        @Deprecated
5973        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
5974                "wifi_watchdog_background_check_enabled";
5975
5976        /**
5977         * The timeout for a background ping
5978         * @deprecated This setting is not used.
5979         */
5980        @Deprecated
5981        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
5982                "wifi_watchdog_background_check_timeout_ms";
5983
5984        /**
5985         * The number of initial pings to perform that *may* be ignored if they
5986         * fail. Again, if these fail, they will *not* be used in packet loss
5987         * calculation. For example, one network always seemed to time out for
5988         * the first couple pings, so this is set to 3 by default.
5989         * @deprecated This setting is not used.
5990         */
5991        @Deprecated
5992        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
5993            "wifi_watchdog_initial_ignored_ping_count";
5994
5995        /**
5996         * The maximum number of access points (per network) to attempt to test.
5997         * If this number is reached, the watchdog will no longer monitor the
5998         * initial connection state for the network. This is a safeguard for
5999         * networks containing multiple APs whose DNS does not respond to pings.
6000         * @deprecated This setting is not used.
6001         */
6002        @Deprecated
6003        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
6004
6005        /**
6006         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
6007         */
6008        @Deprecated
6009        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
6010
6011        /**
6012         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
6013         * @deprecated This setting is not used.
6014         */
6015        @Deprecated
6016        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
6017
6018        /**
6019         * The number of pings to test if an access point is a good connection.
6020         * @deprecated This setting is not used.
6021         */
6022        @Deprecated
6023        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
6024
6025        /**
6026         * The delay between pings.
6027         * @deprecated This setting is not used.
6028         */
6029        @Deprecated
6030        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
6031
6032        /**
6033         * The timeout per ping.
6034         * @deprecated This setting is not used.
6035         */
6036        @Deprecated
6037        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
6038
6039        /**
6040         * @deprecated Use
6041         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
6042         */
6043        @Deprecated
6044        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
6045
6046        /**
6047         * @deprecated Use
6048         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
6049         */
6050        @Deprecated
6051        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
6052                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
6053
6054        /**
6055         * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
6056         * the receivers of the PendingIntent an opportunity to make a new network request before
6057         * the Network satisfying the request is potentially removed.
6058         *
6059         * @hide
6060         */
6061        public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
6062                "connectivity_release_pending_intent_delay_ms";
6063
6064        /**
6065         * Whether background data usage is allowed.
6066         *
6067         * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
6068         *             availability of background data depends on several
6069         *             combined factors. When background data is unavailable,
6070         *             {@link ConnectivityManager#getActiveNetworkInfo()} will
6071         *             now appear disconnected.
6072         */
6073        @Deprecated
6074        public static final String BACKGROUND_DATA = "background_data";
6075
6076        /**
6077         * Origins for which browsers should allow geolocation by default.
6078         * The value is a space-separated list of origins.
6079         */
6080        public static final String ALLOWED_GEOLOCATION_ORIGINS
6081                = "allowed_geolocation_origins";
6082
6083        /**
6084         * The preferred TTY mode     0 = TTy Off, CDMA default
6085         *                            1 = TTY Full
6086         *                            2 = TTY HCO
6087         *                            3 = TTY VCO
6088         * @hide
6089         */
6090        public static final String PREFERRED_TTY_MODE =
6091                "preferred_tty_mode";
6092
6093        /**
6094         * Whether the enhanced voice privacy mode is enabled.
6095         * 0 = normal voice privacy
6096         * 1 = enhanced voice privacy
6097         * @hide
6098         */
6099        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
6100
6101        /**
6102         * Whether the TTY mode mode is enabled.
6103         * 0 = disabled
6104         * 1 = enabled
6105         * @hide
6106         */
6107        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
6108
6109        /**
6110         * Controls whether settings backup is enabled.
6111         * Type: int ( 0 = disabled, 1 = enabled )
6112         * @hide
6113         */
6114        public static final String BACKUP_ENABLED = "backup_enabled";
6115
6116        /**
6117         * Controls whether application data is automatically restored from backup
6118         * at install time.
6119         * Type: int ( 0 = disabled, 1 = enabled )
6120         * @hide
6121         */
6122        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
6123
6124        /**
6125         * Indicates whether settings backup has been fully provisioned.
6126         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
6127         * @hide
6128         */
6129        public static final String BACKUP_PROVISIONED = "backup_provisioned";
6130
6131        /**
6132         * Component of the transport to use for backup/restore.
6133         * @hide
6134         */
6135        public static final String BACKUP_TRANSPORT = "backup_transport";
6136
6137        /**
6138         * Version for which the setup wizard was last shown.  Bumped for
6139         * each release when there is new setup information to show.
6140         * @hide
6141         */
6142        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
6143
6144        /**
6145         * The interval in milliseconds after which Wi-Fi is considered idle.
6146         * When idle, it is possible for the device to be switched from Wi-Fi to
6147         * the mobile data network.
6148         * @hide
6149         * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
6150         * instead.
6151         */
6152        @Deprecated
6153        public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
6154
6155        /**
6156         * The global search provider chosen by the user (if multiple global
6157         * search providers are installed). This will be the provider returned
6158         * by {@link SearchManager#getGlobalSearchActivity()} if it's still
6159         * installed. This setting is stored as a flattened component name as
6160         * per {@link ComponentName#flattenToString()}.
6161         *
6162         * @hide
6163         */
6164        public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
6165                "search_global_search_activity";
6166
6167        /**
6168         * The number of promoted sources in GlobalSearch.
6169         * @hide
6170         */
6171        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
6172        /**
6173         * The maximum number of suggestions returned by GlobalSearch.
6174         * @hide
6175         */
6176        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
6177        /**
6178         * The number of suggestions GlobalSearch will ask each non-web search source for.
6179         * @hide
6180         */
6181        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
6182        /**
6183         * The number of suggestions the GlobalSearch will ask the web search source for.
6184         * @hide
6185         */
6186        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
6187                "search_web_results_override_limit";
6188        /**
6189         * The number of milliseconds that GlobalSearch will wait for suggestions from
6190         * promoted sources before continuing with all other sources.
6191         * @hide
6192         */
6193        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
6194                "search_promoted_source_deadline_millis";
6195        /**
6196         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
6197         * @hide
6198         */
6199        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
6200        /**
6201         * The maximum number of milliseconds that GlobalSearch shows the previous results
6202         * after receiving a new query.
6203         * @hide
6204         */
6205        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
6206        /**
6207         * The maximum age of log data used for shortcuts in GlobalSearch.
6208         * @hide
6209         */
6210        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
6211        /**
6212         * The maximum age of log data used for source ranking in GlobalSearch.
6213         * @hide
6214         */
6215        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
6216                "search_max_source_event_age_millis";
6217        /**
6218         * The minimum number of impressions needed to rank a source in GlobalSearch.
6219         * @hide
6220         */
6221        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
6222                "search_min_impressions_for_source_ranking";
6223        /**
6224         * The minimum number of clicks needed to rank a source in GlobalSearch.
6225         * @hide
6226         */
6227        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
6228                "search_min_clicks_for_source_ranking";
6229        /**
6230         * The maximum number of shortcuts shown by GlobalSearch.
6231         * @hide
6232         */
6233        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
6234        /**
6235         * The size of the core thread pool for suggestion queries in GlobalSearch.
6236         * @hide
6237         */
6238        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
6239                "search_query_thread_core_pool_size";
6240        /**
6241         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
6242         * @hide
6243         */
6244        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
6245                "search_query_thread_max_pool_size";
6246        /**
6247         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
6248         * @hide
6249         */
6250        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
6251                "search_shortcut_refresh_core_pool_size";
6252        /**
6253         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
6254         * @hide
6255         */
6256        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
6257                "search_shortcut_refresh_max_pool_size";
6258        /**
6259         * The maximun time that excess threads in the GlobalSeach thread pools will
6260         * wait before terminating.
6261         * @hide
6262         */
6263        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
6264                "search_thread_keepalive_seconds";
6265        /**
6266         * The maximum number of concurrent suggestion queries to each source.
6267         * @hide
6268         */
6269        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
6270                "search_per_source_concurrent_query_limit";
6271
6272        /**
6273         * Whether or not alert sounds are played on StorageManagerService events.
6274         * (0 = false, 1 = true)
6275         * @hide
6276         */
6277        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
6278
6279        /**
6280         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
6281         * @hide
6282         */
6283        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
6284
6285        /**
6286         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
6287         * @hide
6288         */
6289        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
6290
6291        /**
6292         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
6293         * @hide
6294         */
6295        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
6296
6297        /**
6298         * If nonzero, ANRs in invisible background processes bring up a dialog.
6299         * Otherwise, the process will be silently killed.
6300         *
6301         * Also prevents ANRs and crash dialogs from being suppressed.
6302         * @hide
6303         */
6304        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
6305
6306        /**
6307         * The {@link ComponentName} string of the service to be used as the voice recognition
6308         * service.
6309         *
6310         * @hide
6311         */
6312        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
6313
6314        /**
6315         * Stores whether an user has consented to have apps verified through PAM.
6316         * The value is boolean (1 or 0).
6317         *
6318         * @hide
6319         */
6320        public static final String PACKAGE_VERIFIER_USER_CONSENT =
6321            "package_verifier_user_consent";
6322
6323        /**
6324         * The {@link ComponentName} string of the selected spell checker service which is
6325         * one of the services managed by the text service manager.
6326         *
6327         * @hide
6328         */
6329        public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
6330
6331        /**
6332         * The {@link ComponentName} string of the selected subtype of the selected spell checker
6333         * service which is one of the services managed by the text service manager.
6334         *
6335         * @hide
6336         */
6337        public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
6338                "selected_spell_checker_subtype";
6339
6340        /**
6341         * The {@link ComponentName} string whether spell checker is enabled or not.
6342         *
6343         * @hide
6344         */
6345        public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
6346
6347        /**
6348         * What happens when the user presses the Power button while in-call
6349         * and the screen is on.<br/>
6350         * <b>Values:</b><br/>
6351         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
6352         * 2 - The Power button hangs up the current call.<br/>
6353         *
6354         * @hide
6355         */
6356        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
6357
6358        /**
6359         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
6360         * @hide
6361         */
6362        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
6363
6364        /**
6365         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
6366         * @hide
6367         */
6368        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
6369
6370        /**
6371         * INCALL_POWER_BUTTON_BEHAVIOR default value.
6372         * @hide
6373         */
6374        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
6375                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
6376
6377        /**
6378         * What happens when the user presses the Back button while in-call
6379         * and the screen is on.<br/>
6380         * <b>Values:</b><br/>
6381         * 0 - The Back buttons does nothing different.<br/>
6382         * 1 - The Back button hangs up the current call.<br/>
6383         *
6384         * @hide
6385         */
6386        public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior";
6387
6388        /**
6389         * INCALL_BACK_BUTTON_BEHAVIOR value for no action.
6390         * @hide
6391         */
6392        public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0;
6393
6394        /**
6395         * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up".
6396         * @hide
6397         */
6398        public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1;
6399
6400        /**
6401         * INCALL_POWER_BUTTON_BEHAVIOR default value.
6402         * @hide
6403         */
6404        public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT =
6405                INCALL_BACK_BUTTON_BEHAVIOR_NONE;
6406
6407        /**
6408         * Whether the device should wake when the wake gesture sensor detects motion.
6409         * @hide
6410         */
6411        public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
6412
6413        /**
6414         * Whether the device should doze if configured.
6415         * @hide
6416         */
6417        public static final String DOZE_ENABLED = "doze_enabled";
6418
6419        /**
6420         * Whether doze should be always on.
6421         * @hide
6422         */
6423        public static final String DOZE_ALWAYS_ON = "doze_always_on";
6424
6425        /**
6426         * Whether the device should pulse on pick up gesture.
6427         * @hide
6428         */
6429        public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
6430
6431        /**
6432         * Whether the device should pulse on double tap gesture.
6433         * @hide
6434         */
6435        public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap";
6436
6437        /**
6438         * The current night mode that has been selected by the user.  Owned
6439         * and controlled by UiModeManagerService.  Constants are as per
6440         * UiModeManager.
6441         * @hide
6442         */
6443        public static final String UI_NIGHT_MODE = "ui_night_mode";
6444
6445        /**
6446         * Whether screensavers are enabled.
6447         * @hide
6448         */
6449        public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
6450
6451        /**
6452         * The user's chosen screensaver components.
6453         *
6454         * These will be launched by the PhoneWindowManager after a timeout when not on
6455         * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
6456         * @hide
6457         */
6458        public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
6459
6460        /**
6461         * If screensavers are enabled, whether the screensaver should be automatically launched
6462         * when the device is inserted into a (desk) dock.
6463         * @hide
6464         */
6465        public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
6466
6467        /**
6468         * If screensavers are enabled, whether the screensaver should be automatically launched
6469         * when the screen times out when not on battery.
6470         * @hide
6471         */
6472        public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
6473
6474        /**
6475         * If screensavers are enabled, the default screensaver component.
6476         * @hide
6477         */
6478        public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
6479
6480        /**
6481         * The default NFC payment component
6482         * @hide
6483         */
6484        public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
6485
6486        /**
6487         * Whether NFC payment is handled by the foreground application or a default.
6488         * @hide
6489         */
6490        public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
6491
6492        /**
6493         * Specifies the package name currently configured to be the primary sms application
6494         * @hide
6495         */
6496        public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
6497
6498        /**
6499         * Specifies the package name currently configured to be the default dialer application
6500         * @hide
6501         */
6502        public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application";
6503
6504        /**
6505         * Specifies the package name currently configured to be the emergency assistance application
6506         *
6507         * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
6508         *
6509         * @hide
6510         */
6511        public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
6512
6513        /**
6514         * Specifies whether the current app context on scren (assist data) will be sent to the
6515         * assist application (active voice interaction service).
6516         *
6517         * @hide
6518         */
6519        public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
6520
6521        /**
6522         * Specifies whether a screenshot of the screen contents will be sent to the assist
6523         * application (active voice interaction service).
6524         *
6525         * @hide
6526         */
6527        public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled";
6528
6529        /**
6530         * Specifies whether the screen will show an animation if screen contents are sent to the
6531         * assist application (active voice interaction service).
6532         *
6533         * Note that the disclosure will be forced for third-party assistants or if the device
6534         * does not support disabling it.
6535         *
6536         * @hide
6537         */
6538        public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled";
6539
6540        /**
6541         * Name of the service components that the current user has explicitly allowed to
6542         * see and assist with all of the user's notifications.
6543         *
6544         * @hide
6545         */
6546        public static final String ENABLED_NOTIFICATION_ASSISTANT =
6547                "enabled_notification_assistant";
6548
6549        /**
6550         * Names of the service components that the current user has explicitly allowed to
6551         * see all of the user's notifications, separated by ':'.
6552         *
6553         * @hide
6554         */
6555        public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
6556
6557        /**
6558         * Names of the packages that the current user has explicitly allowed to
6559         * manage notification policy configuration, separated by ':'.
6560         *
6561         * @hide
6562         */
6563        @TestApi
6564        public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES =
6565                "enabled_notification_policy_access_packages";
6566
6567        /**
6568         * Defines whether managed profile ringtones should be synced from it's parent profile
6569         * <p>
6570         * 0 = ringtones are not synced
6571         * 1 = ringtones are synced from the profile's parent (default)
6572         * <p>
6573         * This value is only used for managed profiles.
6574         * @hide
6575         */
6576        public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
6577
6578        /** @hide */
6579        public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
6580
6581        /**
6582         * This is the query URI for finding a print service to install.
6583         *
6584         * @hide
6585         */
6586        public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
6587
6588        /**
6589         * This is the query URI for finding a NFC payment service to install.
6590         *
6591         * @hide
6592         */
6593        public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
6594
6595        /**
6596         * If enabled, apps should try to skip any introductory hints on first launch. This might
6597         * apply to users that are already familiar with the environment or temporary users.
6598         * <p>
6599         * Type : int (0 to show hints, 1 to skip showing hints)
6600         */
6601        public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
6602
6603        /**
6604         * Persisted playback time after a user confirmation of an unsafe volume level.
6605         *
6606         * @hide
6607         */
6608        public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
6609
6610        /**
6611         * This preference enables notification display on the lockscreen.
6612         * @hide
6613         */
6614        public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
6615                "lock_screen_show_notifications";
6616
6617        /**
6618         * List of TV inputs that are currently hidden. This is a string
6619         * containing the IDs of all hidden TV inputs. Each ID is encoded by
6620         * {@link android.net.Uri#encode(String)} and separated by ':'.
6621         * @hide
6622         */
6623        public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
6624
6625        /**
6626         * List of custom TV input labels. This is a string containing <TV input id, custom name>
6627         * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
6628         * and separated by ','. Each pair is separated by ':'.
6629         * @hide
6630         */
6631        public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
6632
6633        /**
6634         * Whether automatic routing of system audio to USB audio peripheral is disabled.
6635         * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
6636         * and 0 means automatic routing is enabled.
6637         *
6638         * @hide
6639         */
6640        public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
6641                "usb_audio_automatic_routing_disabled";
6642
6643        /**
6644         * The timeout in milliseconds before the device fully goes to sleep after
6645         * a period of inactivity.  This value sets an upper bound on how long the device
6646         * will stay awake or dreaming without user activity.  It should generally
6647         * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
6648         * will sleep before it ever has a chance to dream.
6649         * <p>
6650         * Use -1 to disable this timeout.
6651         * </p>
6652         *
6653         * @hide
6654         */
6655        public static final String SLEEP_TIMEOUT = "sleep_timeout";
6656
6657        /**
6658         * Controls whether double tap to wake is enabled.
6659         * @hide
6660         */
6661        public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
6662
6663        /**
6664         * The current assistant component. It could be a voice interaction service,
6665         * or an activity that handles ACTION_ASSIST, or empty which means using the default
6666         * handling.
6667         *
6668         * @hide
6669         */
6670        public static final String ASSISTANT = "assistant";
6671
6672        /**
6673         * Whether the camera launch gesture should be disabled.
6674         *
6675         * @hide
6676         */
6677        public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled";
6678
6679        /**
6680         * Whether the camera launch gesture to double tap the power button when the screen is off
6681         * should be disabled.
6682         *
6683         * @hide
6684         */
6685        public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED =
6686                "camera_double_tap_power_gesture_disabled";
6687
6688        /**
6689         * Whether the camera double twist gesture to flip between front and back mode should be
6690         * enabled.
6691         *
6692         * @hide
6693         */
6694        public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED =
6695                "camera_double_twist_to_flip_enabled";
6696
6697        /**
6698         * Control whether Night display is currently activated.
6699         * @hide
6700         */
6701        public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated";
6702
6703        /**
6704         * Control whether Night display will automatically activate/deactivate.
6705         * @hide
6706         */
6707        public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode";
6708
6709        /**
6710         * Custom time when Night display is scheduled to activate.
6711         * Represented as milliseconds from midnight (e.g. 79200000 == 10pm).
6712         * @hide
6713         */
6714        public static final String NIGHT_DISPLAY_CUSTOM_START_TIME = "night_display_custom_start_time";
6715
6716        /**
6717         * Custom time when Night display is scheduled to deactivate.
6718         * Represented as milliseconds from midnight (e.g. 21600000 == 6am).
6719         * @hide
6720         */
6721        public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time";
6722
6723        /**
6724         * Names of the service components that the current user has explicitly allowed to
6725         * be a VR mode listener, separated by ':'.
6726         *
6727         * @hide
6728         */
6729        public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
6730
6731        /**
6732         * Behavior of the display while in VR mode.
6733         *
6734         * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}.
6735         *
6736         * @hide
6737         */
6738        public static final String VR_DISPLAY_MODE = "vr_display_mode";
6739
6740        /**
6741         * Lower the display persistence while the system is in VR mode.
6742         *
6743         * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
6744         *
6745         * @hide.
6746         */
6747        public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0;
6748
6749        /**
6750         * Do not alter the display persistence while the system is in VR mode.
6751         *
6752         * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
6753         *
6754         * @hide.
6755         */
6756        public static final int VR_DISPLAY_MODE_OFF = 1;
6757
6758        /**
6759         * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least
6760         * once.
6761         *
6762         * <p>This is used to ensure that we only take one pass which will disable apps that are not
6763         * privileged (if any). From then on, we only want to enable apps (when a matching SIM is
6764         * inserted), to avoid disabling an app that the user might actively be using.
6765         *
6766         * <p>Will be set to 1 once executed.
6767         *
6768         * @hide
6769         */
6770        public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
6771
6772        /**
6773         * Whether parent user can access remote contact in managed profile.
6774         *
6775         * @hide
6776         */
6777        public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH =
6778                "managed_profile_contact_remote_search";
6779
6780        /**
6781         * Whether or not the automatic storage manager is enabled and should run on the device.
6782         *
6783         * @hide
6784         */
6785        public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED =
6786                "automatic_storage_manager_enabled";
6787
6788        /**
6789         * How many days of information for the automatic storage manager to retain on the device.
6790         *
6791         * @hide
6792         */
6793        public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN =
6794                "automatic_storage_manager_days_to_retain";
6795
6796        /**
6797         * Default number of days of information for the automatic storage manager to retain.
6798         *
6799         * @hide
6800         */
6801        public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90;
6802
6803        /**
6804         * How many bytes the automatic storage manager has cleared out.
6805         *
6806         * @hide
6807         */
6808        public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED =
6809                "automatic_storage_manager_bytes_cleared";
6810
6811
6812        /**
6813         * Last run time for the automatic storage manager.
6814         *
6815         * @hide
6816         */
6817        public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN =
6818                "automatic_storage_manager_last_run";
6819
6820        /**
6821         * Whether SystemUI navigation keys is enabled.
6822         * @hide
6823         */
6824        public static final String SYSTEM_NAVIGATION_KEYS_ENABLED =
6825                "system_navigation_keys_enabled";
6826
6827        /**
6828         * Whether Downloads folder backup is enabled and should run on the device.
6829         *
6830         * @hide
6831         */
6832        public static final String DOWNLOADS_BACKUP_ENABLED = "downloads_backup_enabled";
6833
6834        /**
6835         * Whether Downloads folder backup should only occur if the device is using a metered
6836         * network.
6837         *
6838         * @hide
6839         */
6840        public static final String DOWNLOADS_BACKUP_ALLOW_METERED =
6841                "downloads_backup_allow_metered";
6842
6843        /**
6844         * Whether Downloads folder backup should only occur if the device is charging.
6845         *
6846         * @hide
6847         */
6848        public static final String DOWNLOADS_BACKUP_CHARGING_ONLY =
6849                "downloads_backup_charging_only";
6850
6851        /**
6852         * How many days of information for the automatic storage manager to retain on the device
6853         * for downloads.
6854         *
6855         * @hide
6856         */
6857        public static final String AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN =
6858                "automatic_storage_manager_downloads_days_to_retain";
6859
6860        /**
6861         * Holds comma separated list of ordering of QS tiles.
6862         * @hide
6863         */
6864        public static final String QS_TILES = "sysui_qs_tiles";
6865
6866        /**
6867         * Whether preloaded APKs have been installed for the user.
6868         * @hide
6869         */
6870        public static final String DEMO_USER_SETUP_COMPLETE
6871                = "demo_user_setup_complete";
6872
6873        /**
6874         * Specifies whether the web action API is enabled.
6875         *
6876         * @hide
6877         */
6878        public static final String WEB_ACTION_ENABLED = "web_action_enabled";
6879
6880        /**
6881         * Has this pairable device been paired or upgraded from a previously paired system.
6882         * @hide
6883         */
6884        public static final String DEVICE_PAIRED = "device_paired";
6885
6886        /**
6887         * Integer state indicating whether package verifier is enabled.
6888         * TODO(b/34259924): Remove this setting.
6889         *
6890         * @hide
6891         */
6892        public static final String PACKAGE_VERIFIER_STATE = "package_verifier_state";
6893
6894        /**
6895         * This are the settings to be backed up.
6896         *
6897         * NOTE: Settings are backed up and restored in the order they appear
6898         *       in this array. If you have one setting depending on another,
6899         *       make sure that they are ordered appropriately.
6900         *
6901         * @hide
6902         */
6903        public static final String[] SETTINGS_TO_BACKUP = {
6904            BUGREPORT_IN_POWER_MENU,                            // moved to global
6905            ALLOW_MOCK_LOCATION,
6906            PARENTAL_CONTROL_ENABLED,
6907            PARENTAL_CONTROL_REDIRECT_URL,
6908            USB_MASS_STORAGE_ENABLED,                           // moved to global
6909            ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
6910            ACCESSIBILITY_DISPLAY_DALTONIZER,
6911            ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
6912            ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
6913            ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
6914            ACCESSIBILITY_SCRIPT_INJECTION,
6915            ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS,
6916            ENABLED_ACCESSIBILITY_SERVICES,
6917            ENABLED_NOTIFICATION_LISTENERS,
6918            ENABLED_VR_LISTENERS,
6919            ENABLED_INPUT_METHODS,
6920            TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
6921            TOUCH_EXPLORATION_ENABLED,
6922            ACCESSIBILITY_ENABLED,
6923            ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
6924            ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
6925            ACCESSIBILITY_SPEAK_PASSWORD,
6926            ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
6927            ACCESSIBILITY_CAPTIONING_PRESET,
6928            ACCESSIBILITY_CAPTIONING_ENABLED,
6929            ACCESSIBILITY_CAPTIONING_LOCALE,
6930            ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
6931            ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
6932            ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
6933            ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
6934            ACCESSIBILITY_CAPTIONING_TYPEFACE,
6935            ACCESSIBILITY_CAPTIONING_FONT_SCALE,
6936            ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
6937            TTS_USE_DEFAULTS,
6938            TTS_DEFAULT_RATE,
6939            TTS_DEFAULT_PITCH,
6940            TTS_DEFAULT_SYNTH,
6941            TTS_DEFAULT_LANG,
6942            TTS_DEFAULT_COUNTRY,
6943            TTS_ENABLED_PLUGINS,
6944            TTS_DEFAULT_LOCALE,
6945            SHOW_IME_WITH_HARD_KEYBOARD,
6946            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
6947            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
6948            WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
6949            SELECTED_SPELL_CHECKER,
6950            SELECTED_SPELL_CHECKER_SUBTYPE,
6951            SPELL_CHECKER_ENABLED,
6952            MOUNT_PLAY_NOTIFICATION_SND,
6953            MOUNT_UMS_AUTOSTART,
6954            MOUNT_UMS_PROMPT,
6955            MOUNT_UMS_NOTIFY_ENABLED,
6956            SLEEP_TIMEOUT,
6957            DOUBLE_TAP_TO_WAKE,
6958            WAKE_GESTURE_ENABLED,
6959            LONG_PRESS_TIMEOUT,
6960            CAMERA_GESTURE_DISABLED,
6961            ACCESSIBILITY_AUTOCLICK_ENABLED,
6962            ACCESSIBILITY_AUTOCLICK_DELAY,
6963            ACCESSIBILITY_LARGE_POINTER_ICON,
6964            PREFERRED_TTY_MODE,
6965            ENHANCED_VOICE_PRIVACY_ENABLED,
6966            TTY_MODE_ENABLED,
6967            INCALL_POWER_BUTTON_BEHAVIOR,
6968            NIGHT_DISPLAY_CUSTOM_START_TIME,
6969            NIGHT_DISPLAY_CUSTOM_END_TIME,
6970            NIGHT_DISPLAY_AUTO_MODE,
6971            NIGHT_DISPLAY_ACTIVATED,
6972            SYNC_PARENT_SOUNDS,
6973            CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
6974            CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
6975            SYSTEM_NAVIGATION_KEYS_ENABLED,
6976            QS_TILES,
6977            DOZE_ENABLED,
6978            DOZE_PULSE_ON_PICK_UP,
6979            DOZE_PULSE_ON_DOUBLE_TAP,
6980            NFC_PAYMENT_DEFAULT_COMPONENT
6981        };
6982
6983        /**
6984         * These entries are considered common between the personal and the managed profile,
6985         * since the managed profile doesn't get to change them.
6986         */
6987        private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
6988
6989        static {
6990            CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
6991            CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
6992            CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
6993            CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
6994            CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
6995            CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
6996            CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
6997            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE);
6998            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
6999            CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
7000            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
7001            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
7002        }
7003
7004        /** @hide */
7005        public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
7006            outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
7007        }
7008
7009        /**
7010         * Secure settings which can be accessed by ephemeral apps.
7011         * @hide
7012         */
7013        public static final Set<String> EPHEMERAL_SETTINGS = new ArraySet<>();
7014        static {
7015            EPHEMERAL_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES);
7016            EPHEMERAL_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD);
7017            EPHEMERAL_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
7018
7019            EPHEMERAL_SETTINGS.add(DEFAULT_INPUT_METHOD);
7020            EPHEMERAL_SETTINGS.add(ENABLED_INPUT_METHODS);
7021        }
7022
7023        /**
7024         * Helper method for determining if a location provider is enabled.
7025         *
7026         * @param cr the content resolver to use
7027         * @param provider the location provider to query
7028         * @return true if the provider is enabled
7029         *
7030         * @deprecated use {@link #LOCATION_MODE} or
7031         *             {@link LocationManager#isProviderEnabled(String)}
7032         */
7033        @Deprecated
7034        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
7035            return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
7036        }
7037
7038        /**
7039         * Helper method for determining if a location provider is enabled.
7040         * @param cr the content resolver to use
7041         * @param provider the location provider to query
7042         * @param userId the userId to query
7043         * @return true if the provider is enabled
7044         * @deprecated use {@link #LOCATION_MODE} or
7045         *             {@link LocationManager#isProviderEnabled(String)}
7046         * @hide
7047         */
7048        @Deprecated
7049        public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
7050            String allowedProviders = Settings.Secure.getStringForUser(cr,
7051                    LOCATION_PROVIDERS_ALLOWED, userId);
7052            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
7053        }
7054
7055        /**
7056         * Thread-safe method for enabling or disabling a single location provider.
7057         * @param cr the content resolver to use
7058         * @param provider the location provider to enable or disable
7059         * @param enabled true if the provider should be enabled
7060         * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
7061         */
7062        @Deprecated
7063        public static final void setLocationProviderEnabled(ContentResolver cr,
7064                String provider, boolean enabled) {
7065            setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
7066        }
7067
7068        /**
7069         * Thread-safe method for enabling or disabling a single location provider.
7070         *
7071         * @param cr the content resolver to use
7072         * @param provider the location provider to enable or disable
7073         * @param enabled true if the provider should be enabled
7074         * @param userId the userId for which to enable/disable providers
7075         * @return true if the value was set, false on database errors
7076         * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
7077         *             {@link #LOCATION_MODE}
7078         * @hide
7079         */
7080        @Deprecated
7081        public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
7082                String provider, boolean enabled, int userId) {
7083            synchronized (mLocationSettingsLock) {
7084                // to ensure thread safety, we write the provider name with a '+' or '-'
7085                // and let the SettingsProvider handle it rather than reading and modifying
7086                // the list of enabled providers.
7087                if (enabled) {
7088                    provider = "+" + provider;
7089                } else {
7090                    provider = "-" + provider;
7091                }
7092                return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
7093                        userId);
7094            }
7095        }
7096
7097        /**
7098         * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
7099         */
7100        private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
7101            final int mode = getLocationModeForUser(cr, userId);
7102            return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
7103        }
7104
7105        /**
7106         * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
7107         */
7108        private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
7109            int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
7110                    LOCATION_MODE_HIGH_ACCURACY, userId);
7111            // Make sure that the previous mode is never "off". Otherwise the user won't be able to
7112            // turn on location any longer.
7113            if (mode == LOCATION_MODE_OFF) {
7114                mode = LOCATION_MODE_HIGH_ACCURACY;
7115            }
7116            return setLocationModeForUser(cr, mode, userId);
7117        }
7118
7119        /**
7120         * Thread-safe method for setting the location mode to one of
7121         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
7122         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
7123         * Necessary because the mode is a composite of the underlying location provider
7124         * settings.
7125         *
7126         * @param cr the content resolver to use
7127         * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
7128         * @param userId the userId for which to change mode
7129         * @return true if the value was set, false on database errors
7130         *
7131         * @throws IllegalArgumentException if mode is not one of the supported values
7132         */
7133        private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
7134                int userId) {
7135            synchronized (mLocationSettingsLock) {
7136                boolean gps = false;
7137                boolean network = false;
7138                switch (mode) {
7139                    case LOCATION_MODE_PREVIOUS:
7140                        // Retrieve the actual mode and set to that mode.
7141                        return restoreLocationModeForUser(cr, userId);
7142                    case LOCATION_MODE_OFF:
7143                        saveLocationModeForUser(cr, userId);
7144                        break;
7145                    case LOCATION_MODE_SENSORS_ONLY:
7146                        gps = true;
7147                        break;
7148                    case LOCATION_MODE_BATTERY_SAVING:
7149                        network = true;
7150                        break;
7151                    case LOCATION_MODE_HIGH_ACCURACY:
7152                        gps = true;
7153                        network = true;
7154                        break;
7155                    default:
7156                        throw new IllegalArgumentException("Invalid location mode: " + mode);
7157                }
7158                // Note it's important that we set the NLP mode first. The Google implementation
7159                // of NLP clears its NLP consent setting any time it receives a
7160                // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
7161                // it shows an NLP consent dialog any time it receives the broadcast, NLP is
7162                // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
7163                // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
7164                // and 3) the receiver happened to complete before we enabled NLP, then the Google
7165                // NLP would detect the attempt to enable NLP and show a redundant NLP consent
7166                // dialog. Then the people who wrote the setup wizard would be sad.
7167                boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
7168                        cr, LocationManager.NETWORK_PROVIDER, network, userId);
7169                boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
7170                        cr, LocationManager.GPS_PROVIDER, gps, userId);
7171                return gpsSuccess && nlpSuccess;
7172            }
7173        }
7174
7175        /**
7176         * Thread-safe method for reading the location mode, returns one of
7177         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
7178         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary
7179         * because the mode is a composite of the underlying location provider settings.
7180         *
7181         * @param cr the content resolver to use
7182         * @param userId the userId for which to read the mode
7183         * @return the location mode
7184         */
7185        private static final int getLocationModeForUser(ContentResolver cr, int userId) {
7186            synchronized (mLocationSettingsLock) {
7187                boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
7188                        cr, LocationManager.GPS_PROVIDER, userId);
7189                boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
7190                        cr, LocationManager.NETWORK_PROVIDER, userId);
7191                if (gpsEnabled && networkEnabled) {
7192                    return LOCATION_MODE_HIGH_ACCURACY;
7193                } else if (gpsEnabled) {
7194                    return LOCATION_MODE_SENSORS_ONLY;
7195                } else if (networkEnabled) {
7196                    return LOCATION_MODE_BATTERY_SAVING;
7197                } else {
7198                    return LOCATION_MODE_OFF;
7199                }
7200            }
7201        }
7202    }
7203
7204    /**
7205     * Global system settings, containing preferences that always apply identically
7206     * to all defined users.  Applications can read these but are not allowed to write;
7207     * like the "Secure" settings, these are for preferences that the user must
7208     * explicitly modify through the system UI or specialized APIs for those values.
7209     */
7210    public static final class Global extends NameValueTable {
7211        /**
7212         * The content:// style URL for global secure settings items.  Not public.
7213         */
7214        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
7215
7216        /**
7217         * Whether users are allowed to add more users or guest from lockscreen.
7218         * <p>
7219         * Type: int
7220         * @hide
7221         */
7222        public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
7223
7224        /**
7225         * Setting whether the global gesture for enabling accessibility is enabled.
7226         * If this gesture is enabled the user will be able to perfrom it to enable
7227         * the accessibility state without visiting the settings app.
7228         *
7229         * @hide
7230         * No longer used. Should be removed once all dependencies have been updated.
7231         */
7232        public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
7233                "enable_accessibility_global_gesture_enabled";
7234
7235        /**
7236         * Whether Airplane Mode is on.
7237         */
7238        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
7239
7240        /**
7241         * Whether Theater Mode is on.
7242         * {@hide}
7243         */
7244        @SystemApi
7245        public static final String THEATER_MODE_ON = "theater_mode_on";
7246
7247        /**
7248         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
7249         */
7250        public static final String RADIO_BLUETOOTH = "bluetooth";
7251
7252        /**
7253         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
7254         */
7255        public static final String RADIO_WIFI = "wifi";
7256
7257        /**
7258         * {@hide}
7259         */
7260        public static final String RADIO_WIMAX = "wimax";
7261        /**
7262         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
7263         */
7264        public static final String RADIO_CELL = "cell";
7265
7266        /**
7267         * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
7268         */
7269        public static final String RADIO_NFC = "nfc";
7270
7271        /**
7272         * A comma separated list of radios that need to be disabled when airplane mode
7273         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
7274         * included in the comma separated list.
7275         */
7276        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
7277
7278        /**
7279         * A comma separated list of radios that should to be disabled when airplane mode
7280         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
7281         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
7282         * will be turned off when entering airplane mode, but the user will be able to reenable
7283         * Wifi in the Settings app.
7284         *
7285         * {@hide}
7286         */
7287        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
7288
7289        /**
7290         * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
7291         * See {@link android.bluetooth.BluetoothProfile}.
7292         * {@hide}
7293         */
7294        public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
7295
7296        /**
7297         * A semi-colon separated list of Bluetooth interoperability workarounds.
7298         * Each entry is a partial Bluetooth device address string and an integer representing
7299         * the feature to be disabled, separated by a comma. The integer must correspond
7300         * to a interoperability feature as defined in "interop.h" in /system/bt.
7301         * <p>
7302         * Example: <br/>
7303         *   "00:11:22,0;01:02:03:04,2"
7304         * @hide
7305         */
7306       public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list";
7307
7308        /**
7309         * The policy for deciding when Wi-Fi should go to sleep (which will in
7310         * turn switch to using the mobile data as an Internet connection).
7311         * <p>
7312         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
7313         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
7314         * {@link #WIFI_SLEEP_POLICY_NEVER}.
7315         */
7316        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
7317
7318        /**
7319         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
7320         * policy, which is to sleep shortly after the turning off
7321         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
7322         */
7323        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
7324
7325        /**
7326         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
7327         * the device is on battery, and never go to sleep when the device is
7328         * plugged in.
7329         */
7330        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
7331
7332        /**
7333         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
7334         */
7335        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
7336
7337        /**
7338         * Value to specify if the user prefers the date, time and time zone
7339         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
7340         */
7341        public static final String AUTO_TIME = "auto_time";
7342
7343        /**
7344         * Value to specify if the user prefers the time zone
7345         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
7346         */
7347        public static final String AUTO_TIME_ZONE = "auto_time_zone";
7348
7349        /**
7350         * URI for the car dock "in" event sound.
7351         * @hide
7352         */
7353        public static final String CAR_DOCK_SOUND = "car_dock_sound";
7354
7355        /**
7356         * URI for the car dock "out" event sound.
7357         * @hide
7358         */
7359        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
7360
7361        /**
7362         * URI for the desk dock "in" event sound.
7363         * @hide
7364         */
7365        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
7366
7367        /**
7368         * URI for the desk dock "out" event sound.
7369         * @hide
7370         */
7371        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
7372
7373        /**
7374         * Whether to play a sound for dock events.
7375         * @hide
7376         */
7377        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
7378
7379        /**
7380         * Whether to play a sound for dock events, only when an accessibility service is on.
7381         * @hide
7382         */
7383        public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility";
7384
7385        /**
7386         * URI for the "device locked" (keyguard shown) sound.
7387         * @hide
7388         */
7389        public static final String LOCK_SOUND = "lock_sound";
7390
7391        /**
7392         * URI for the "device unlocked" sound.
7393         * @hide
7394         */
7395        public static final String UNLOCK_SOUND = "unlock_sound";
7396
7397        /**
7398         * URI for the "device is trusted" sound, which is played when the device enters the trusted
7399         * state without unlocking.
7400         * @hide
7401         */
7402        public static final String TRUSTED_SOUND = "trusted_sound";
7403
7404        /**
7405         * URI for the low battery sound file.
7406         * @hide
7407         */
7408        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
7409
7410        /**
7411         * Whether to play a sound for low-battery alerts.
7412         * @hide
7413         */
7414        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
7415
7416        /**
7417         * URI for the "wireless charging started" sound.
7418         * @hide
7419         */
7420        public static final String WIRELESS_CHARGING_STARTED_SOUND =
7421                "wireless_charging_started_sound";
7422
7423        /**
7424         * Whether to play a sound for charging events.
7425         * @hide
7426         */
7427        public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
7428
7429        /**
7430         * Whether we keep the device on while the device is plugged in.
7431         * Supported values are:
7432         * <ul>
7433         * <li>{@code 0} to never stay on while plugged in</li>
7434         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
7435         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
7436         * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
7437         * </ul>
7438         * These values can be OR-ed together.
7439         */
7440        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
7441
7442        /**
7443         * When the user has enable the option to have a "bug report" command
7444         * in the power menu.
7445         * @hide
7446         */
7447        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
7448
7449        /**
7450         * Whether ADB is enabled.
7451         */
7452        public static final String ADB_ENABLED = "adb_enabled";
7453
7454        /**
7455         * Whether Views are allowed to save their attribute data.
7456         * @hide
7457         */
7458        public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
7459
7460        /**
7461         * Whether assisted GPS should be enabled or not.
7462         * @hide
7463         */
7464        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
7465
7466        /**
7467         * Whether bluetooth is enabled/disabled
7468         * 0=disabled. 1=enabled.
7469         */
7470        public static final String BLUETOOTH_ON = "bluetooth_on";
7471
7472        /**
7473         * CDMA Cell Broadcast SMS
7474         *                            0 = CDMA Cell Broadcast SMS disabled
7475         *                            1 = CDMA Cell Broadcast SMS enabled
7476         * @hide
7477         */
7478        public static final String CDMA_CELL_BROADCAST_SMS =
7479                "cdma_cell_broadcast_sms";
7480
7481        /**
7482         * The CDMA roaming mode 0 = Home Networks, CDMA default
7483         *                       1 = Roaming on Affiliated networks
7484         *                       2 = Roaming on any networks
7485         * @hide
7486         */
7487        public static final String CDMA_ROAMING_MODE = "roaming_settings";
7488
7489        /**
7490         * The CDMA subscription mode 0 = RUIM/SIM (default)
7491         *                                1 = NV
7492         * @hide
7493         */
7494        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
7495
7496        /** Inactivity timeout to track mobile data activity.
7497        *
7498        * If set to a positive integer, it indicates the inactivity timeout value in seconds to
7499        * infer the data activity of mobile network. After a period of no activity on mobile
7500        * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
7501        * intent is fired to indicate a transition of network status from "active" to "idle". Any
7502        * subsequent activity on mobile networks triggers the firing of {@code
7503        * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
7504        *
7505        * Network activity refers to transmitting or receiving data on the network interfaces.
7506        *
7507        * Tracking is disabled if set to zero or negative value.
7508        *
7509        * @hide
7510        */
7511       public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
7512
7513       /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
7514        * but for Wifi network.
7515        * @hide
7516        */
7517       public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
7518
7519       /**
7520        * Whether or not data roaming is enabled. (0 = false, 1 = true)
7521        */
7522       public static final String DATA_ROAMING = "data_roaming";
7523
7524       /**
7525        * The value passed to a Mobile DataConnection via bringUp which defines the
7526        * number of retries to preform when setting up the initial connection. The default
7527        * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
7528        * @hide
7529        */
7530       public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
7531
7532       /**
7533        * Whether any package can be on external storage. When this is true, any
7534        * package, regardless of manifest values, is a candidate for installing
7535        * or moving onto external storage. (0 = false, 1 = true)
7536        * @hide
7537        */
7538       public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
7539
7540        /**
7541         * Whether any activity can be resized. When this is true, any
7542         * activity, regardless of manifest values, can be resized for multi-window.
7543         * (0 = false, 1 = true)
7544         * @hide
7545         */
7546        public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
7547                = "force_resizable_activities";
7548
7549        /**
7550         * Whether to enable experimental freeform support for windows.
7551         * @hide
7552         */
7553        public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
7554                = "enable_freeform_support";
7555
7556       /**
7557        * Whether user has enabled development settings.
7558        */
7559       public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
7560
7561       /**
7562        * Whether the device has been provisioned (0 = false, 1 = true).
7563        * <p>On a multiuser device with a separate system user, the screen may be locked
7564        * as soon as this is set to true and further activities cannot be launched on the
7565        * system user unless they are marked to show over keyguard.
7566        */
7567       public static final String DEVICE_PROVISIONED = "device_provisioned";
7568
7569       /**
7570        * Whether mobile data should be allowed while the device is being provisioned.
7571        * This allows the provisioning process to turn off mobile data before the user
7572        * has an opportunity to set things up, preventing other processes from burning
7573        * precious bytes before wifi is setup.
7574        * (0 = false, 1 = true)
7575        * @hide
7576        */
7577       public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED =
7578               "device_provisioning_mobile_data";
7579
7580       /**
7581        * The saved value for WindowManagerService.setForcedDisplaySize().
7582        * Two integers separated by a comma.  If unset, then use the real display size.
7583        * @hide
7584        */
7585       public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
7586
7587       /**
7588        * The saved value for WindowManagerService.setForcedDisplayScalingMode().
7589        * 0 or unset if scaling is automatic, 1 if scaling is disabled.
7590        * @hide
7591        */
7592       public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
7593
7594       /**
7595        * The maximum size, in bytes, of a download that the download manager will transfer over
7596        * a non-wifi connection.
7597        * @hide
7598        */
7599       public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
7600               "download_manager_max_bytes_over_mobile";
7601
7602       /**
7603        * The recommended maximum size, in bytes, of a download that the download manager should
7604        * transfer over a non-wifi connection. Over this size, the use will be warned, but will
7605        * have the option to start the download over the mobile connection anyway.
7606        * @hide
7607        */
7608       public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
7609               "download_manager_recommended_max_bytes_over_mobile";
7610
7611       /**
7612        * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
7613        */
7614       @Deprecated
7615       public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
7616
7617       /**
7618        * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
7619        * sent or processed. (0 = false, 1 = true)
7620        * @hide
7621        */
7622       public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
7623
7624       /**
7625        * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted,
7626        * and the output is redirected to AV Receiver connected via
7627        * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}.
7628        * @hide
7629        */
7630       public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled";
7631
7632       /**
7633        * Whether TV will automatically turn on upon reception of the CEC command
7634        * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
7635        * @hide
7636        */
7637       public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
7638               "hdmi_control_auto_wakeup_enabled";
7639
7640       /**
7641        * Whether TV will also turn off other CEC devices when it goes to standby mode.
7642        * (0 = false, 1 = true)
7643        * @hide
7644        */
7645       public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
7646               "hdmi_control_auto_device_off_enabled";
7647
7648       /**
7649        * The interval in milliseconds at which location requests will be throttled when they are
7650        * coming from the background.
7651        * @hide
7652        */
7653       public static final String LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS =
7654                "location_background_throttle_interval_ms";
7655
7656        /**
7657         * Packages that are whitelisted for background throttling (throttling will not be applied).
7658         * @hide
7659         */
7660        public static final String LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
7661            "location_background_throttle_package_whitelist";
7662
7663       /**
7664        * Whether TV will switch to MHL port when a mobile device is plugged in.
7665        * (0 = false, 1 = true)
7666        * @hide
7667        */
7668       public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
7669
7670       /**
7671        * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
7672        * @hide
7673        */
7674       public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
7675
7676       /**
7677        * Whether mobile data connections are allowed by the user.  See
7678        * ConnectivityManager for more info.
7679        * @hide
7680        */
7681       public static final String MOBILE_DATA = "mobile_data";
7682
7683       /**
7684        * Whether the mobile data connection should remain active even when higher
7685        * priority networks like WiFi are active, to help make network switching faster.
7686        *
7687        * See ConnectivityService for more info.
7688        *
7689        * (0 = disabled, 1 = enabled)
7690        * @hide
7691        */
7692       public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
7693
7694        /**
7695         * Size of the event buffer for IP connectivity metrics.
7696         * @hide
7697         */
7698        public static final String CONNECTIVITY_METRICS_BUFFER_SIZE =
7699              "connectivity_metrics_buffer_size";
7700
7701       /** {@hide} */
7702       public static final String NETSTATS_ENABLED = "netstats_enabled";
7703       /** {@hide} */
7704       public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
7705       /** {@hide} */
7706       public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
7707       /** {@hide} */
7708       public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
7709       /** {@hide} */
7710       public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
7711
7712       /** {@hide} */
7713       public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
7714       /** {@hide} */
7715       public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
7716       /** {@hide} */
7717       public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
7718       /** {@hide} */
7719       public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
7720
7721       /** {@hide} */
7722       public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
7723       /** {@hide} */
7724       public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
7725       /** {@hide} */
7726       public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
7727       /** {@hide} */
7728       public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
7729
7730       /** {@hide} */
7731       public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
7732       /** {@hide} */
7733       public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
7734       /** {@hide} */
7735       public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
7736       /** {@hide} */
7737       public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
7738
7739       /**
7740        * User preference for which network(s) should be used. Only the
7741        * connectivity service should touch this.
7742        */
7743       public static final String NETWORK_PREFERENCE = "network_preference";
7744
7745       /**
7746        * Which package name to use for network scoring. If null, or if the package is not a valid
7747        * scorer app, external network scores will neither be requested nor accepted.
7748        * @hide
7749        */
7750       public static final String NETWORK_SCORER_APP = "network_scorer_app";
7751
7752       /**
7753        * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
7754        * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
7755        * exceeded.
7756        * @hide
7757        */
7758       public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
7759
7760       /**
7761        * The length of time in milli-seconds that automatic small adjustments to
7762        * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
7763        * @hide
7764        */
7765       public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
7766
7767       /** Preferred NTP server. {@hide} */
7768       public static final String NTP_SERVER = "ntp_server";
7769       /** Timeout in milliseconds to wait for NTP server. {@hide} */
7770       public static final String NTP_TIMEOUT = "ntp_timeout";
7771
7772       /** {@hide} */
7773       public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
7774
7775       /**
7776        * Sample validity in seconds to configure for the system DNS resolver.
7777        * {@hide}
7778        */
7779       public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS =
7780               "dns_resolver_sample_validity_seconds";
7781
7782       /**
7783        * Success threshold in percent for use with the system DNS resolver.
7784        * {@hide}
7785        */
7786       public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT =
7787                "dns_resolver_success_threshold_percent";
7788
7789       /**
7790        * Minimum number of samples needed for statistics to be considered meaningful in the
7791        * system DNS resolver.
7792        * {@hide}
7793        */
7794       public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples";
7795
7796       /**
7797        * Maximum number taken into account for statistics purposes in the system DNS resolver.
7798        * {@hide}
7799        */
7800       public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples";
7801
7802       /**
7803        * Whether to disable the automatic scheduling of system updates.
7804        * 1 = system updates won't be automatically scheduled (will always
7805        * present notification instead).
7806        * 0 = system updates will be automatically scheduled. (default)
7807        * @hide
7808        */
7809       @SystemApi
7810       public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
7811
7812       /**
7813        * Whether the package manager should send package verification broadcasts for verifiers to
7814        * review apps prior to installation.
7815        * 1 = request apps to be verified prior to installation, if a verifier exists.
7816        * 0 = do not verify apps before installation
7817        * @hide
7818        */
7819       public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
7820
7821       /** Timeout for package verification.
7822        * @hide */
7823       public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
7824
7825       /** Default response code for package verification.
7826        * @hide */
7827       public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
7828
7829       /**
7830        * Show package verification setting in the Settings app.
7831        * 1 = show (default)
7832        * 0 = hide
7833        * @hide
7834        */
7835       public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
7836
7837       /**
7838        * Run package verification on apps installed through ADB/ADT/USB
7839        * 1 = perform package verification on ADB installs (default)
7840        * 0 = bypass package verification on ADB installs
7841        * @hide
7842        */
7843       public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
7844
7845       /**
7846        * Time since last fstrim (milliseconds) after which we force one to happen
7847        * during device startup.  If unset, the default is 3 days.
7848        * @hide
7849        */
7850       public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
7851
7852       /**
7853        * The interval in milliseconds at which to check packet counts on the
7854        * mobile data interface when screen is on, to detect possible data
7855        * connection problems.
7856        * @hide
7857        */
7858       public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
7859               "pdp_watchdog_poll_interval_ms";
7860
7861       /**
7862        * The interval in milliseconds at which to check packet counts on the
7863        * mobile data interface when screen is off, to detect possible data
7864        * connection problems.
7865        * @hide
7866        */
7867       public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
7868               "pdp_watchdog_long_poll_interval_ms";
7869
7870       /**
7871        * The interval in milliseconds at which to check packet counts on the
7872        * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
7873        * outgoing packets has been reached without incoming packets.
7874        * @hide
7875        */
7876       public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
7877               "pdp_watchdog_error_poll_interval_ms";
7878
7879       /**
7880        * The number of outgoing packets sent without seeing an incoming packet
7881        * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
7882        * device is logged to the event log
7883        * @hide
7884        */
7885       public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
7886               "pdp_watchdog_trigger_packet_count";
7887
7888       /**
7889        * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
7890        * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
7891        * attempting data connection recovery.
7892        * @hide
7893        */
7894       public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
7895               "pdp_watchdog_error_poll_count";
7896
7897       /**
7898        * The number of failed PDP reset attempts before moving to something more
7899        * drastic: re-registering to the network.
7900        * @hide
7901        */
7902       public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
7903               "pdp_watchdog_max_pdp_reset_fail_count";
7904
7905       /**
7906        * A positive value indicates how often the SamplingProfiler
7907        * should take snapshots. Zero value means SamplingProfiler
7908        * is disabled.
7909        *
7910        * @hide
7911        */
7912       public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
7913
7914       /**
7915        * URL to open browser on to allow user to manage a prepay account
7916        * @hide
7917        */
7918       public static final String SETUP_PREPAID_DATA_SERVICE_URL =
7919               "setup_prepaid_data_service_url";
7920
7921       /**
7922        * URL to attempt a GET on to see if this is a prepay device
7923        * @hide
7924        */
7925       public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
7926               "setup_prepaid_detection_target_url";
7927
7928       /**
7929        * Host to check for a redirect to after an attempt to GET
7930        * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
7931        * this is a prepaid device with zero balance.)
7932        * @hide
7933        */
7934       public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
7935               "setup_prepaid_detection_redir_host";
7936
7937       /**
7938        * The interval in milliseconds at which to check the number of SMS sent out without asking
7939        * for use permit, to limit the un-authorized SMS usage.
7940        *
7941        * @hide
7942        */
7943       public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
7944               "sms_outgoing_check_interval_ms";
7945
7946       /**
7947        * The number of outgoing SMS sent without asking for user permit (of {@link
7948        * #SMS_OUTGOING_CHECK_INTERVAL_MS}
7949        *
7950        * @hide
7951        */
7952       public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
7953               "sms_outgoing_check_max_count";
7954
7955       /**
7956        * Used to disable SMS short code confirmation - defaults to true.
7957        * True indcates we will do the check, etc.  Set to false to disable.
7958        * @see com.android.internal.telephony.SmsUsageMonitor
7959        * @hide
7960        */
7961       public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
7962
7963        /**
7964         * Used to select which country we use to determine premium sms codes.
7965         * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
7966         * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
7967         * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
7968         * @hide
7969         */
7970        public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
7971
7972       /**
7973        * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
7974        * @hide
7975        */
7976       public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
7977
7978       /**
7979        * Used to disable Tethering on a device - defaults to true
7980        * @hide
7981        */
7982       public static final String TETHER_SUPPORTED = "tether_supported";
7983
7984       /**
7985        * Used to require DUN APN on the device or not - defaults to a build config value
7986        * which defaults to false
7987        * @hide
7988        */
7989       public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
7990
7991       /**
7992        * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
7993        * corresponding build config values are set it will override the APN DB
7994        * values.
7995        * Consists of a comma seperated list of strings:
7996        * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
7997        * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
7998        * @hide
7999        */
8000       public static final String TETHER_DUN_APN = "tether_dun_apn";
8001
8002       /**
8003        * List of carrier apps which are whitelisted to prompt the user for install when
8004        * a sim card with matching uicc carrier privilege rules is inserted.
8005        *
8006        * The value is "package1;package2;..."
8007        * @hide
8008        */
8009       public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
8010
8011       /**
8012        * USB Mass Storage Enabled
8013        */
8014       public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
8015
8016       /**
8017        * If this setting is set (to anything), then all references
8018        * to Gmail on the device must change to Google Mail.
8019        */
8020       public static final String USE_GOOGLE_MAIL = "use_google_mail";
8021
8022        /**
8023         * Webview Data reduction proxy key.
8024         * @hide
8025         */
8026        public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
8027                "webview_data_reduction_proxy_key";
8028
8029       /**
8030        * Whether or not the WebView fallback mechanism should be enabled.
8031        * 0=disabled, 1=enabled.
8032        * @hide
8033        */
8034       public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED =
8035               "webview_fallback_logic_enabled";
8036
8037       /**
8038        * Name of the package used as WebView provider (if unset the provider is instead determined
8039        * by the system).
8040        * @hide
8041        */
8042       public static final String WEBVIEW_PROVIDER = "webview_provider";
8043
8044       /**
8045        * Developer setting to enable WebView multiprocess rendering.
8046        * @hide
8047        */
8048       @SystemApi
8049       public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
8050
8051       /**
8052        * The maximum number of notifications shown in 24 hours when switching networks.
8053        * @hide
8054        */
8055       public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT =
8056              "network_switch_notification_daily_limit";
8057
8058       /**
8059        * The minimum time in milliseconds between notifications when switching networks.
8060        * @hide
8061        */
8062       public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS =
8063              "network_switch_notification_rate_limit_millis";
8064
8065       /**
8066        * Whether to automatically switch away from wifi networks that lose Internet access.
8067        * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always
8068        * avoids such networks. Valid values are:
8069        *
8070        * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013.
8071        * null: Ask the user whether to switch away from bad wifi.
8072        * 1: Avoid bad wifi.
8073        *
8074        * @hide
8075        */
8076       public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi";
8077
8078       /**
8079        * User setting for ConnectivityManager.getMeteredMultipathPreference(). This value may be
8080        * overridden by the system based on device or application state. If null, the value
8081        * specified by config_networkMeteredMultipathPreference is used.
8082        *
8083        * @hide
8084        */
8085       public static final String NETWORK_METERED_MULTIPATH_PREFERENCE =
8086               "network_metered_multipath_preference";
8087
8088       /**
8089        * The thresholds of the wifi throughput badging (SD, HD etc.) as a comma-delimited list of
8090        * colon-delimited key-value pairs. The key is the badging enum value defined in
8091        * android.net.ScoredNetwork and the value is the minimum sustained network throughput in
8092        * kbps required for the badge. For example: "10:3000,20:5000,30:25000"
8093        *
8094        * @hide
8095        */
8096       @SystemApi
8097       public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
8098
8099       /**
8100        * Whether Wifi display is enabled/disabled
8101        * 0=disabled. 1=enabled.
8102        * @hide
8103        */
8104       public static final String WIFI_DISPLAY_ON = "wifi_display_on";
8105
8106       /**
8107        * Whether Wifi display certification mode is enabled/disabled
8108        * 0=disabled. 1=enabled.
8109        * @hide
8110        */
8111       public static final String WIFI_DISPLAY_CERTIFICATION_ON =
8112               "wifi_display_certification_on";
8113
8114       /**
8115        * WPS Configuration method used by Wifi display, this setting only
8116        * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
8117        *
8118        * Possible values are:
8119        *
8120        * WpsInfo.INVALID: use default WPS method chosen by framework
8121        * WpsInfo.PBC    : use Push button
8122        * WpsInfo.KEYPAD : use Keypad
8123        * WpsInfo.DISPLAY: use Display
8124        * @hide
8125        */
8126       public static final String WIFI_DISPLAY_WPS_CONFIG =
8127           "wifi_display_wps_config";
8128
8129       /**
8130        * Whether to notify the user of open networks.
8131        * <p>
8132        * If not connected and the scan results have an open network, we will
8133        * put this notification up. If we attempt to connect to a network or
8134        * the open network(s) disappear, we remove the notification. When we
8135        * show the notification, we will not show it again for
8136        * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
8137        */
8138       public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
8139               "wifi_networks_available_notification_on";
8140       /**
8141        * {@hide}
8142        */
8143       public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
8144               "wimax_networks_available_notification_on";
8145
8146       /**
8147        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
8148        * Connecting to a network will reset the timer.
8149        */
8150       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
8151               "wifi_networks_available_repeat_delay";
8152
8153       /**
8154        * 802.11 country code in ISO 3166 format
8155        * @hide
8156        */
8157       public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
8158
8159       /**
8160        * The interval in milliseconds to issue wake up scans when wifi needs
8161        * to connect. This is necessary to connect to an access point when
8162        * device is on the move and the screen is off.
8163        * @hide
8164        */
8165       public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
8166               "wifi_framework_scan_interval_ms";
8167
8168       /**
8169        * The interval in milliseconds after which Wi-Fi is considered idle.
8170        * When idle, it is possible for the device to be switched from Wi-Fi to
8171        * the mobile data network.
8172        * @hide
8173        */
8174       public static final String WIFI_IDLE_MS = "wifi_idle_ms";
8175
8176       /**
8177        * When the number of open networks exceeds this number, the
8178        * least-recently-used excess networks will be removed.
8179        */
8180       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
8181
8182       /**
8183        * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
8184        */
8185       public static final String WIFI_ON = "wifi_on";
8186
8187       /**
8188        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
8189        * @hide
8190        */
8191       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
8192                "wifi_scan_always_enabled";
8193
8194        /**
8195         * Value to specify if Wi-Fi Wakeup feature is enabled.
8196         *
8197         * Type: int (0 for false, 1 for true)
8198         * @hide
8199         */
8200        @SystemApi
8201        public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
8202
8203        /**
8204         * Value to specify whether network quality scores and badging should be shown in the UI.
8205         *
8206         * Type: int (0 for false, 1 for true)
8207         * @hide
8208         */
8209        public static final String NETWORK_SCORING_UI_ENABLED = "network_scoring_ui_enabled";
8210
8211        /**
8212         * Value to specify if network recommendations from
8213         * {@link com.android.server.NetworkScoreService} are enabled.
8214         *
8215         * Type: int (0 for false, 1 for true)
8216         * @hide
8217         */
8218        @SystemApi
8219        public static final String NETWORK_RECOMMENDATIONS_ENABLED =
8220                "network_recommendations_enabled";
8221
8222        /**
8223         * Value to specify if the Wi-Fi Framework should defer to
8224         * {@link com.android.server.NetworkScoreService} for evaluating saved open networks.
8225         *
8226         * Type: int (0 for false, 1 for true)
8227         * @hide
8228         */
8229        @SystemApi
8230        public static final String CURATE_SAVED_OPEN_NETWORKS = "curate_saved_open_networks";
8231
8232        /**
8233         * The number of milliseconds the {@link com.android.server.NetworkScoreService}
8234         * will give a recommendation request to complete before returning a default response.
8235         *
8236         * Type: long
8237         * @hide
8238         */
8239        public static final String NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS =
8240                "network_recommendation_request_timeout_ms";
8241
8242       /**
8243        * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
8244        * connectivity.
8245        * @hide
8246        */
8247       public static final String BLE_SCAN_ALWAYS_AVAILABLE =
8248               "ble_scan_always_enabled";
8249
8250       /**
8251        * Used to save the Wifi_ON state prior to tethering.
8252        * This state will be checked to restore Wifi after
8253        * the user turns off tethering.
8254        *
8255        * @hide
8256        */
8257       public static final String WIFI_SAVED_STATE = "wifi_saved_state";
8258
8259       /**
8260        * The interval in milliseconds to scan as used by the wifi supplicant
8261        * @hide
8262        */
8263       public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
8264               "wifi_supplicant_scan_interval_ms";
8265
8266        /**
8267         * whether frameworks handles wifi auto-join
8268         * @hide
8269         */
8270       public static final String WIFI_ENHANCED_AUTO_JOIN =
8271                "wifi_enhanced_auto_join";
8272
8273        /**
8274         * whether settings show RSSI
8275         * @hide
8276         */
8277        public static final String WIFI_NETWORK_SHOW_RSSI =
8278                "wifi_network_show_rssi";
8279
8280        /**
8281        * The interval in milliseconds to scan at supplicant when p2p is connected
8282        * @hide
8283        */
8284       public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
8285               "wifi_scan_interval_p2p_connected_ms";
8286
8287       /**
8288        * Whether the Wi-Fi watchdog is enabled.
8289        */
8290       public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
8291
8292       /**
8293        * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
8294        * the setting needs to be set to 0 to disable it.
8295        * @hide
8296        */
8297       public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
8298               "wifi_watchdog_poor_network_test_enabled";
8299
8300       /**
8301        * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
8302        * needs to be set to 0 to disable it.
8303        * @hide
8304        */
8305       public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
8306               "wifi_suspend_optimizations_enabled";
8307
8308       /**
8309        * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
8310        * will enable it. In the future, additional values may be supported.
8311        * @hide
8312        */
8313       public static final String WIFI_VERBOSE_LOGGING_ENABLED =
8314               "wifi_verbose_logging_enabled";
8315
8316       /**
8317        * The maximum number of times we will retry a connection to an access
8318        * point for which we have failed in acquiring an IP address from DHCP.
8319        * A value of N means that we will make N+1 connection attempts in all.
8320        */
8321       public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
8322
8323       /**
8324        * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
8325        * data connectivity to be established after a disconnect from Wi-Fi.
8326        */
8327       public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
8328           "wifi_mobile_data_transition_wakelock_timeout_ms";
8329
8330       /**
8331        * This setting controls whether WiFi configurations created by a Device Owner app
8332        * should be locked down (that is, be editable or removable only by the Device Owner App,
8333        * not even by Settings app).
8334        * This setting takes integer values. Non-zero values mean DO created configurations
8335        * are locked down. Value of zero means they are not. Default value in the absence of
8336        * actual value to this setting is 0.
8337        */
8338       public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
8339               "wifi_device_owner_configs_lockdown";
8340
8341       /**
8342        * The operational wifi frequency band
8343        * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
8344        * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
8345        * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
8346        *
8347        * @hide
8348        */
8349       public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
8350
8351       /**
8352        * The Wi-Fi peer-to-peer device name
8353        * @hide
8354        */
8355       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
8356
8357       /**
8358        * The min time between wifi disable and wifi enable
8359        * @hide
8360        */
8361       public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
8362
8363       /**
8364        * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
8365        * from an ephemeral network if there is no BSSID for that network with a non-null score that
8366        * has been seen in this time period.
8367        *
8368        * If this is less than or equal to zero, we use a more conservative behavior and only check
8369        * for a non-null score from the currently connected or target BSSID.
8370        * @hide
8371        */
8372       public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
8373               "wifi_ephemeral_out_of_range_timeout_ms";
8374
8375       /**
8376        * The number of milliseconds to delay when checking for data stalls during
8377        * non-aggressive detection. (screen is turned off.)
8378        * @hide
8379        */
8380       public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
8381               "data_stall_alarm_non_aggressive_delay_in_ms";
8382
8383       /**
8384        * The number of milliseconds to delay when checking for data stalls during
8385        * aggressive detection. (screen on or suspected data stall)
8386        * @hide
8387        */
8388       public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
8389               "data_stall_alarm_aggressive_delay_in_ms";
8390
8391       /**
8392        * The number of milliseconds to allow the provisioning apn to remain active
8393        * @hide
8394        */
8395       public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
8396               "provisioning_apn_alarm_delay_in_ms";
8397
8398       /**
8399        * The interval in milliseconds at which to check gprs registration
8400        * after the first registration mismatch of gprs and voice service,
8401        * to detect possible data network registration problems.
8402        *
8403        * @hide
8404        */
8405       public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
8406               "gprs_register_check_period_ms";
8407
8408       /**
8409        * Nonzero causes Log.wtf() to crash.
8410        * @hide
8411        */
8412       public static final String WTF_IS_FATAL = "wtf_is_fatal";
8413
8414       /**
8415        * Ringer mode. This is used internally, changing this value will not
8416        * change the ringer mode. See AudioManager.
8417        */
8418       public static final String MODE_RINGER = "mode_ringer";
8419
8420       /**
8421        * Overlay display devices setting.
8422        * The associated value is a specially formatted string that describes the
8423        * size and density of simulated secondary display devices.
8424        * <p>
8425        * Format: {width}x{height}/{dpi};...
8426        * </p><p>
8427        * Example:
8428        * <ul>
8429        * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
8430        * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
8431        * at 1080p and the second at 720p.</li>
8432        * <li>If the value is empty, then no overlay display devices are created.</li>
8433        * </ul></p>
8434        *
8435        * @hide
8436        */
8437       public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
8438
8439        /**
8440         * Threshold values for the duration and level of a discharge cycle,
8441         * under which we log discharge cycle info.
8442         *
8443         * @hide
8444         */
8445        public static final String
8446                BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
8447
8448        /** @hide */
8449        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
8450
8451        /**
8452         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
8453         * intents on application crashes and ANRs. If this is disabled, the
8454         * crash/ANR dialog will never display the "Report" button.
8455         * <p>
8456         * Type: int (0 = disallow, 1 = allow)
8457         *
8458         * @hide
8459         */
8460        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
8461
8462        /**
8463         * Maximum age of entries kept by {@link DropBoxManager}.
8464         *
8465         * @hide
8466         */
8467        public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
8468
8469        /**
8470         * Maximum number of entry files which {@link DropBoxManager} will keep
8471         * around.
8472         *
8473         * @hide
8474         */
8475        public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
8476
8477        /**
8478         * Maximum amount of disk space used by {@link DropBoxManager} no matter
8479         * what.
8480         *
8481         * @hide
8482         */
8483        public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
8484
8485        /**
8486         * Percent of free disk (excluding reserve) which {@link DropBoxManager}
8487         * will use.
8488         *
8489         * @hide
8490         */
8491        public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
8492
8493        /**
8494         * Percent of total disk which {@link DropBoxManager} will never dip
8495         * into.
8496         *
8497         * @hide
8498         */
8499        public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
8500
8501        /**
8502         * Prefix for per-tag dropbox disable/enable settings.
8503         *
8504         * @hide
8505         */
8506        public static final String DROPBOX_TAG_PREFIX = "dropbox:";
8507
8508        /**
8509         * Lines of logcat to include with system crash/ANR/etc. reports, as a
8510         * prefix of the dropbox tag of the report type. For example,
8511         * "logcat_for_system_server_anr" controls the lines of logcat captured
8512         * with system server ANR reports. 0 to disable.
8513         *
8514         * @hide
8515         */
8516        public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
8517
8518        /**
8519         * The interval in minutes after which the amount of free storage left
8520         * on the device is logged to the event log
8521         *
8522         * @hide
8523         */
8524        public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
8525
8526        /**
8527         * Threshold for the amount of change in disk free space required to
8528         * report the amount of free space. Used to prevent spamming the logs
8529         * when the disk free space isn't changing frequently.
8530         *
8531         * @hide
8532         */
8533        public static final String
8534                DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
8535
8536        /**
8537         * Minimum percentage of free storage on the device that is used to
8538         * determine if the device is running low on storage. The default is 10.
8539         * <p>
8540         * Say this value is set to 10, the device is considered running low on
8541         * storage if 90% or more of the device storage is filled up.
8542         *
8543         * @hide
8544         */
8545        public static final String
8546                SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
8547
8548        /**
8549         * Maximum byte size of the low storage threshold. This is to ensure
8550         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
8551         * overly large threshold for large storage devices. Currently this must
8552         * be less than 2GB. This default is 500MB.
8553         *
8554         * @hide
8555         */
8556        public static final String
8557                SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
8558
8559        /**
8560         * Minimum bytes of free storage on the device before the data partition
8561         * is considered full. By default, 1 MB is reserved to avoid system-wide
8562         * SQLite disk full exceptions.
8563         *
8564         * @hide
8565         */
8566        public static final String
8567                SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
8568
8569        /**
8570         * The maximum reconnect delay for short network outages or when the
8571         * network is suspended due to phone use.
8572         *
8573         * @hide
8574         */
8575        public static final String
8576                SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
8577
8578        /**
8579         * The number of milliseconds to delay before sending out
8580         * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
8581         *
8582         * @hide
8583         */
8584        public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
8585
8586
8587        /**
8588         * Network sampling interval, in seconds. We'll generate link information
8589         * about bytes/packets sent and error rates based on data sampled in this interval
8590         *
8591         * @hide
8592         */
8593
8594        public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
8595                "connectivity_sampling_interval_in_seconds";
8596
8597        /**
8598         * The series of successively longer delays used in retrying to download PAC file.
8599         * Last delay is used between successful PAC downloads.
8600         *
8601         * @hide
8602         */
8603        public static final String PAC_CHANGE_DELAY = "pac_change_delay";
8604
8605        /**
8606         * Don't attempt to detect captive portals.
8607         *
8608         * @hide
8609         */
8610        public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0;
8611
8612        /**
8613         * When detecting a captive portal, display a notification that
8614         * prompts the user to sign in.
8615         *
8616         * @hide
8617         */
8618        public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1;
8619
8620        /**
8621         * When detecting a captive portal, immediately disconnect from the
8622         * network and do not reconnect to that network in the future.
8623         *
8624         * @hide
8625         */
8626        public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
8627
8628        /**
8629         * What to do when connecting a network that presents a captive portal.
8630         * Must be one of the CAPTIVE_PORTAL_MODE_* constants above.
8631         *
8632         * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT.
8633         * @hide
8634         */
8635        public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode";
8636
8637        /**
8638         * Setting to turn off captive portal detection. Feature is enabled by
8639         * default and the setting needs to be set to 0 to disable it.
8640         *
8641         * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection
8642         * @hide
8643         */
8644        @Deprecated
8645        public static final String
8646                CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
8647
8648        /**
8649         * The server used for captive portal detection upon a new conection. A
8650         * 204 response code from the server is used for validation.
8651         * TODO: remove this deprecated symbol.
8652         *
8653         * @hide
8654         */
8655        public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
8656
8657        /**
8658         * The URL used for HTTPS captive portal detection upon a new connection.
8659         * A 204 response code from the server is used for validation.
8660         *
8661         * @hide
8662         */
8663        public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url";
8664
8665        /**
8666         * The URL used for HTTP captive portal detection upon a new connection.
8667         * A 204 response code from the server is used for validation.
8668         *
8669         * @hide
8670         */
8671        public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url";
8672
8673        /**
8674         * The URL used for fallback HTTP captive portal detection when previous HTTP
8675         * and HTTPS captive portal detection attemps did not return a conclusive answer.
8676         *
8677         * @hide
8678         */
8679        public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
8680
8681        /**
8682         * Whether to use HTTPS for network validation. This is enabled by default and the setting
8683         * needs to be set to 0 to disable it. This setting is a misnomer because captive portals
8684         * don't actually use HTTPS, but it's consistent with the other settings.
8685         *
8686         * @hide
8687         */
8688        public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
8689
8690        /**
8691         * Which User-Agent string to use in the header of the captive portal detection probes.
8692         * The User-Agent field is unset when this setting has no value (HttpUrlConnection default).
8693         *
8694         * @hide
8695         */
8696        public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent";
8697
8698        /**
8699         * Whether network service discovery is enabled.
8700         *
8701         * @hide
8702         */
8703        public static final String NSD_ON = "nsd_on";
8704
8705        /**
8706         * Let user pick default install location.
8707         *
8708         * @hide
8709         */
8710        public static final String SET_INSTALL_LOCATION = "set_install_location";
8711
8712        /**
8713         * Default install location value.
8714         * 0 = auto, let system decide
8715         * 1 = internal
8716         * 2 = sdcard
8717         * @hide
8718         */
8719        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
8720
8721        /**
8722         * ms during which to consume extra events related to Inet connection
8723         * condition after a transtion to fully-connected
8724         *
8725         * @hide
8726         */
8727        public static final String
8728                INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
8729
8730        /**
8731         * ms during which to consume extra events related to Inet connection
8732         * condtion after a transtion to partly-connected
8733         *
8734         * @hide
8735         */
8736        public static final String
8737                INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
8738
8739        /** {@hide} */
8740        public static final String
8741                READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
8742
8743        /**
8744         * Host name and port for global http proxy. Uses ':' seperator for
8745         * between host and port.
8746         */
8747        public static final String HTTP_PROXY = "http_proxy";
8748
8749        /**
8750         * Host name for global http proxy. Set via ConnectivityManager.
8751         *
8752         * @hide
8753         */
8754        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
8755
8756        /**
8757         * Integer host port for global http proxy. Set via ConnectivityManager.
8758         *
8759         * @hide
8760         */
8761        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
8762
8763        /**
8764         * Exclusion list for global proxy. This string contains a list of
8765         * comma-separated domains where the global proxy does not apply.
8766         * Domains should be listed in a comma- separated list. Example of
8767         * acceptable formats: ".domain1.com,my.domain2.com" Use
8768         * ConnectivityManager to set/get.
8769         *
8770         * @hide
8771         */
8772        public static final String
8773                GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
8774
8775        /**
8776         * The location PAC File for the proxy.
8777         * @hide
8778         */
8779        public static final String
8780                GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
8781
8782        /**
8783         * Enables the UI setting to allow the user to specify the global HTTP
8784         * proxy and associated exclusion list.
8785         *
8786         * @hide
8787         */
8788        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
8789
8790        /**
8791         * Setting for default DNS in case nobody suggests one
8792         *
8793         * @hide
8794         */
8795        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
8796
8797        /** {@hide} */
8798        public static final String
8799                BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
8800        /** {@hide} */
8801        public static final String
8802                BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
8803        /** {@hide} */
8804        public static final String
8805                BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
8806        /** {@hide} */
8807        public static final String
8808                BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
8809        /** {@hide} */
8810        public static final String
8811                BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
8812        /** {@hide} */
8813        public static final String
8814                BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_";
8815        /** {@hide} */
8816        public static final String
8817                BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_";
8818        /** {@hide} */
8819        public static final String
8820                BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
8821        /** {@hide} */
8822        public static final String
8823                BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_";
8824
8825        /**
8826         * Activity manager specific settings.
8827         * This is encoded as a key=value list, separated by commas. Ex:
8828         *
8829         * "enforce_bg_check=true,max_cached_processes=24"
8830         *
8831         * The following keys are supported:
8832         *
8833         * <pre>
8834         * enforce_bg_check                     (boolean)
8835         * max_cached_processes                 (int)
8836         * </pre>
8837         *
8838         * <p>
8839         * Type: string
8840         * @hide
8841         * @see com.android.server.am.ActivityManagerConstants
8842         */
8843        public static final String ACTIVITY_MANAGER_CONSTANTS = "activity_manager_constants";
8844
8845        /**
8846         * Device Idle (Doze) specific settings.
8847         * This is encoded as a key=value list, separated by commas. Ex:
8848         *
8849         * "inactive_to=60000,sensing_to=400000"
8850         *
8851         * The following keys are supported:
8852         *
8853         * <pre>
8854         * inactive_to                      (long)
8855         * sensing_to                       (long)
8856         * motion_inactive_to               (long)
8857         * idle_after_inactive_to           (long)
8858         * idle_pending_to                  (long)
8859         * max_idle_pending_to              (long)
8860         * idle_pending_factor              (float)
8861         * idle_to                          (long)
8862         * max_idle_to                      (long)
8863         * idle_factor                      (float)
8864         * min_time_to_alarm                (long)
8865         * max_temp_app_whitelist_duration  (long)
8866         * notification_whitelist_duration  (long)
8867         * </pre>
8868         *
8869         * <p>
8870         * Type: string
8871         * @hide
8872         * @see com.android.server.DeviceIdleController.Constants
8873         */
8874        public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
8875
8876        /**
8877         * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS}
8878         *
8879         * <p>
8880         * Type: string
8881         * @hide
8882         * @see com.android.server.DeviceIdleController.Constants
8883         */
8884        public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch";
8885
8886        /**
8887         * App standby (app idle) specific settings.
8888         * This is encoded as a key=value list, separated by commas. Ex:
8889         *
8890         * "idle_duration=5000,parole_interval=4500"
8891         *
8892         * The following keys are supported:
8893         *
8894         * <pre>
8895         * idle_duration2       (long)
8896         * wallclock_threshold  (long)
8897         * parole_interval      (long)
8898         * parole_duration      (long)
8899         *
8900         * idle_duration        (long) // This is deprecated and used to circumvent b/26355386.
8901         * </pre>
8902         *
8903         * <p>
8904         * Type: string
8905         * @hide
8906         * @see com.android.server.usage.UsageStatsService.SettingsObserver
8907         */
8908        public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
8909
8910        /**
8911         * Power manager specific settings.
8912         * This is encoded as a key=value list, separated by commas. Ex:
8913         *
8914         * "no_cached_wake_locks=1"
8915         *
8916         * The following keys are supported:
8917         *
8918         * <pre>
8919         * no_cached_wake_locks                 (boolean)
8920         * </pre>
8921         *
8922         * <p>
8923         * Type: string
8924         * @hide
8925         * @see com.android.server.power.PowerManagerConstants
8926         */
8927        public static final String POWER_MANAGER_CONSTANTS = "power_manager_constants";
8928
8929        /**
8930         * Alarm manager specific settings.
8931         * This is encoded as a key=value list, separated by commas. Ex:
8932         *
8933         * "min_futurity=5000,allow_while_idle_short_time=4500"
8934         *
8935         * The following keys are supported:
8936         *
8937         * <pre>
8938         * min_futurity                         (long)
8939         * min_interval                         (long)
8940         * allow_while_idle_short_time          (long)
8941         * allow_while_idle_long_time           (long)
8942         * allow_while_idle_whitelist_duration  (long)
8943         * </pre>
8944         *
8945         * <p>
8946         * Type: string
8947         * @hide
8948         * @see com.android.server.AlarmManagerService.Constants
8949         */
8950        public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
8951
8952        /**
8953         * Job scheduler specific settings.
8954         * This is encoded as a key=value list, separated by commas. Ex:
8955         *
8956         * "min_ready_jobs_count=2,moderate_use_factor=.5"
8957         *
8958         * The following keys are supported:
8959         *
8960         * <pre>
8961         * min_idle_count                       (int)
8962         * min_charging_count                   (int)
8963         * min_connectivity_count               (int)
8964         * min_content_count                    (int)
8965         * min_ready_jobs_count                 (int)
8966         * heavy_use_factor                     (float)
8967         * moderate_use_factor                  (float)
8968         * fg_job_count                         (int)
8969         * bg_normal_job_count                  (int)
8970         * bg_moderate_job_count                (int)
8971         * bg_low_job_count                     (int)
8972         * bg_critical_job_count                (int)
8973         * </pre>
8974         *
8975         * <p>
8976         * Type: string
8977         * @hide
8978         * @see com.android.server.job.JobSchedulerService.Constants
8979         */
8980        public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants";
8981
8982        /**
8983         * ShortcutManager specific settings.
8984         * This is encoded as a key=value list, separated by commas. Ex:
8985         *
8986         * "reset_interval_sec=86400,max_updates_per_interval=1"
8987         *
8988         * The following keys are supported:
8989         *
8990         * <pre>
8991         * reset_interval_sec              (long)
8992         * max_updates_per_interval        (int)
8993         * max_icon_dimension_dp           (int, DP)
8994         * max_icon_dimension_dp_lowram    (int, DP)
8995         * max_shortcuts                   (int)
8996         * icon_quality                    (int, 0-100)
8997         * icon_format                     (String)
8998         * </pre>
8999         *
9000         * <p>
9001         * Type: string
9002         * @hide
9003         * @see com.android.server.pm.ShortcutService.ConfigConstants
9004         */
9005        public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants";
9006
9007        /**
9008         * Get the key that retrieves a bluetooth headset's priority.
9009         * @hide
9010         */
9011        public static final String getBluetoothHeadsetPriorityKey(String address) {
9012            return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9013        }
9014
9015        /**
9016         * Get the key that retrieves a bluetooth a2dp sink's priority.
9017         * @hide
9018         */
9019        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
9020            return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9021        }
9022
9023        /**
9024         * Get the key that retrieves a bluetooth a2dp src's priority.
9025         * @hide
9026         */
9027        public static final String getBluetoothA2dpSrcPriorityKey(String address) {
9028            return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9029        }
9030
9031        /**
9032         * Get the key that retrieves a bluetooth Input Device's priority.
9033         * @hide
9034         */
9035        public static final String getBluetoothInputDevicePriorityKey(String address) {
9036            return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9037        }
9038
9039        /**
9040         * Get the key that retrieves a bluetooth pan client priority.
9041         * @hide
9042         */
9043        public static final String getBluetoothPanPriorityKey(String address) {
9044            return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9045        }
9046
9047        /**
9048         * Get the key that retrieves a bluetooth map priority.
9049         * @hide
9050         */
9051        public static final String getBluetoothMapPriorityKey(String address) {
9052            return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9053        }
9054
9055        /**
9056         * Get the key that retrieves a bluetooth map client priority.
9057         * @hide
9058         */
9059        public static final String getBluetoothMapClientPriorityKey(String address) {
9060            return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9061        }
9062
9063        /**
9064         * Get the key that retrieves a bluetooth pbap client priority.
9065         * @hide
9066         */
9067        public static final String getBluetoothPbapClientPriorityKey(String address) {
9068            return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9069        }
9070
9071        /**
9072         * Get the key that retrieves a bluetooth sap priority.
9073         * @hide
9074         */
9075        public static final String getBluetoothSapPriorityKey(String address) {
9076            return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
9077        }
9078
9079        /**
9080         * Scaling factor for normal window animations. Setting to 0 will
9081         * disable window animations.
9082         */
9083        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
9084
9085        /**
9086         * Scaling factor for activity transition animations. Setting to 0 will
9087         * disable window animations.
9088         */
9089        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
9090
9091        /**
9092         * Scaling factor for Animator-based animations. This affects both the
9093         * start delay and duration of all such animations. Setting to 0 will
9094         * cause animations to end immediately. The default value is 1.
9095         */
9096        public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
9097
9098        /**
9099         * Scaling factor for normal window animations. Setting to 0 will
9100         * disable window animations.
9101         *
9102         * @hide
9103         */
9104        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
9105
9106        /**
9107         * If 0, the compatibility mode is off for all applications.
9108         * If 1, older applications run under compatibility mode.
9109         * TODO: remove this settings before code freeze (bug/1907571)
9110         * @hide
9111         */
9112        public static final String COMPATIBILITY_MODE = "compatibility_mode";
9113
9114        /**
9115         * CDMA only settings
9116         * Emergency Tone  0 = Off
9117         *                 1 = Alert
9118         *                 2 = Vibrate
9119         * @hide
9120         */
9121        public static final String EMERGENCY_TONE = "emergency_tone";
9122
9123        /**
9124         * CDMA only settings
9125         * Whether the auto retry is enabled. The value is
9126         * boolean (1 or 0).
9127         * @hide
9128         */
9129        public static final String CALL_AUTO_RETRY = "call_auto_retry";
9130
9131        /**
9132         * A setting that can be read whether the emergency affordance is currently needed.
9133         * The value is a boolean (1 or 0).
9134         * @hide
9135         */
9136        public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
9137
9138        /**
9139         * See RIL_PreferredNetworkType in ril.h
9140         * @hide
9141         */
9142        public static final String PREFERRED_NETWORK_MODE =
9143                "preferred_network_mode";
9144
9145        /**
9146         * Name of an application package to be debugged.
9147         */
9148        public static final String DEBUG_APP = "debug_app";
9149
9150        /**
9151         * If 1, when launching DEBUG_APP it will wait for the debugger before
9152         * starting user code.  If 0, it will run normally.
9153         */
9154        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
9155
9156        /**
9157         * Control whether the process CPU usage meter should be shown.
9158         *
9159         * @deprecated This functionality is no longer available as of
9160         * {@link android.os.Build.VERSION_CODES#N_MR1}.
9161         */
9162        @Deprecated
9163        public static final String SHOW_PROCESSES = "show_processes";
9164
9165        /**
9166         * If 1 low power mode is enabled.
9167         * @hide
9168         */
9169        public static final String LOW_POWER_MODE = "low_power";
9170
9171        /**
9172         * Battery level [1-99] at which low power mode automatically turns on.
9173         * If 0, it will not automatically turn on.
9174         * @hide
9175         */
9176        public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
9177
9178         /**
9179         * If not 0, the activity manager will aggressively finish activities and
9180         * processes as soon as they are no longer needed.  If 0, the normal
9181         * extended lifetime is used.
9182         */
9183        public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
9184
9185        /**
9186         * Use Dock audio output for media:
9187         *      0 = disabled
9188         *      1 = enabled
9189         * @hide
9190         */
9191        public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
9192
9193        /**
9194         * The surround sound formats AC3, DTS or IEC61937 are
9195         * available for use if they are detected.
9196         * This is the default mode.
9197         *
9198         * Note that AUTO is equivalent to ALWAYS for Android TVs and other
9199         * devices that have an S/PDIF output. This is because S/PDIF
9200         * is unidirectional and the TV cannot know if a decoder is
9201         * connected. So it assumes they are always available.
9202         * @hide
9203         */
9204         public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0;
9205
9206        /**
9207         * AC3, DTS or IEC61937 are NEVER available, even if they
9208         * are detected by the hardware. Those formats will not be
9209         * reported.
9210         *
9211         * An example use case would be an AVR reports that it is capable of
9212         * surround sound decoding but is broken. If NEVER is chosen
9213         * then apps must use PCM output instead of encoded output.
9214         * @hide
9215         */
9216         public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1;
9217
9218        /**
9219         * AC3, DTS or IEC61937 are ALWAYS available, even if they
9220         * are not detected by the hardware. Those formats will be
9221         * reported as part of the HDMI output capability. Applications
9222         * are then free to use either PCM or encoded output.
9223         *
9224         * An example use case would be a when TV was connected over
9225         * TOS-link to an AVR. But the TV could not see it because TOS-link
9226         * is unidirectional.
9227         * @hide
9228         */
9229         public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2;
9230
9231        /**
9232         * Set to ENCODED_SURROUND_OUTPUT_AUTO,
9233         * ENCODED_SURROUND_OUTPUT_NEVER or
9234         * ENCODED_SURROUND_OUTPUT_ALWAYS
9235         * @hide
9236         */
9237        public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output";
9238
9239        /**
9240         * Persisted safe headphone volume management state by AudioService
9241         * @hide
9242         */
9243        public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
9244
9245        /**
9246         * URL for tzinfo (time zone) updates
9247         * @hide
9248         */
9249        public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
9250
9251        /**
9252         * URL for tzinfo (time zone) update metadata
9253         * @hide
9254         */
9255        public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
9256
9257        /**
9258         * URL for selinux (mandatory access control) updates
9259         * @hide
9260         */
9261        public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
9262
9263        /**
9264         * URL for selinux (mandatory access control) update metadata
9265         * @hide
9266         */
9267        public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
9268
9269        /**
9270         * URL for sms short code updates
9271         * @hide
9272         */
9273        public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
9274                "sms_short_codes_content_url";
9275
9276        /**
9277         * URL for sms short code update metadata
9278         * @hide
9279         */
9280        public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
9281                "sms_short_codes_metadata_url";
9282
9283        /**
9284         * URL for apn_db updates
9285         * @hide
9286         */
9287        public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
9288
9289        /**
9290         * URL for apn_db update metadata
9291         * @hide
9292         */
9293        public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
9294
9295        /**
9296         * URL for cert pinlist updates
9297         * @hide
9298         */
9299        public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
9300
9301        /**
9302         * URL for cert pinlist updates
9303         * @hide
9304         */
9305        public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
9306
9307        /**
9308         * URL for intent firewall updates
9309         * @hide
9310         */
9311        public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
9312                "intent_firewall_content_url";
9313
9314        /**
9315         * URL for intent firewall update metadata
9316         * @hide
9317         */
9318        public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
9319                "intent_firewall_metadata_url";
9320
9321        /**
9322         * SELinux enforcement status. If 0, permissive; if 1, enforcing.
9323         * @hide
9324         */
9325        public static final String SELINUX_STATUS = "selinux_status";
9326
9327        /**
9328         * Developer setting to force RTL layout.
9329         * @hide
9330         */
9331        public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
9332
9333        /**
9334         * Milliseconds after screen-off after which low battery sounds will be silenced.
9335         *
9336         * If zero, battery sounds will always play.
9337         * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
9338         *
9339         * @hide
9340         */
9341        public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
9342
9343        /**
9344         * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
9345         * the caller is done with this, they should call {@link ContentResolver#delete} to
9346         * clean up any value that they may have written.
9347         *
9348         * @hide
9349         */
9350        public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
9351
9352        /**
9353         * Defines global runtime overrides to window policy.
9354         *
9355         * See {@link com.android.server.policy.PolicyControl} for value format.
9356         *
9357         * @hide
9358         */
9359        public static final String POLICY_CONTROL = "policy_control";
9360
9361        /**
9362         * Defines global zen mode.  ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
9363         * or ZEN_MODE_NO_INTERRUPTIONS.
9364         *
9365         * @hide
9366         */
9367        public static final String ZEN_MODE = "zen_mode";
9368
9369        /** @hide */ public static final int ZEN_MODE_OFF = 0;
9370        /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
9371        /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
9372        /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
9373
9374        /** @hide */ public static String zenModeToString(int mode) {
9375            if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
9376            if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
9377            if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
9378            return "ZEN_MODE_OFF";
9379        }
9380
9381        /** @hide */ public static boolean isValidZenMode(int value) {
9382            switch (value) {
9383                case Global.ZEN_MODE_OFF:
9384                case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
9385                case Global.ZEN_MODE_ALARMS:
9386                case Global.ZEN_MODE_NO_INTERRUPTIONS:
9387                    return true;
9388                default:
9389                    return false;
9390            }
9391        }
9392
9393        /**
9394         * Value of the ringer before entering zen mode.
9395         *
9396         * @hide
9397         */
9398        public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
9399
9400        /**
9401         * Opaque value, changes when persisted zen mode configuration changes.
9402         *
9403         * @hide
9404         */
9405        public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
9406
9407        /**
9408         * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
9409         *
9410         * @hide
9411         */
9412        public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
9413                "heads_up_notifications_enabled";
9414
9415        /** @hide */ public static final int HEADS_UP_OFF = 0;
9416        /** @hide */ public static final int HEADS_UP_ON = 1;
9417
9418        /**
9419         * The name of the device
9420         */
9421        public static final String DEVICE_NAME = "device_name";
9422
9423        /**
9424         * Whether the NetworkScoringService has been first initialized.
9425         * <p>
9426         * Type: int (0 for false, 1 for true)
9427         * @hide
9428         */
9429        public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
9430
9431        /**
9432         * Whether the user wants to be prompted for password to decrypt the device on boot.
9433         * This only matters if the storage is encrypted.
9434         * <p>
9435         * Type: int (0 for false, 1 for true)
9436         * @hide
9437         */
9438        public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
9439
9440        /**
9441         * Whether the Volte is enabled
9442         * <p>
9443         * Type: int (0 for false, 1 for true)
9444         * @hide
9445         */
9446        public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
9447
9448        /**
9449         * Whether VT (Video Telephony over IMS) is enabled
9450         * <p>
9451         * Type: int (0 for false, 1 for true)
9452         *
9453         * @hide
9454         */
9455        public static final String VT_IMS_ENABLED = "vt_ims_enabled";
9456
9457        /**
9458         * Whether WFC is enabled
9459         * <p>
9460         * Type: int (0 for false, 1 for true)
9461         *
9462         * @hide
9463         */
9464        public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
9465
9466        /**
9467         * WFC mode on home/non-roaming network.
9468         * <p>
9469         * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
9470         *
9471         * @hide
9472         */
9473        public static final String WFC_IMS_MODE = "wfc_ims_mode";
9474
9475        /**
9476         * WFC mode on roaming network.
9477         * <p>
9478         * Type: int - see {@link #WFC_IMS_MODE} for values
9479         *
9480         * @hide
9481         */
9482        public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode";
9483
9484        /**
9485         * Whether WFC roaming is enabled
9486         * <p>
9487         * Type: int (0 for false, 1 for true)
9488         *
9489         * @hide
9490         */
9491        public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
9492
9493        /**
9494         * Whether user can enable/disable LTE as a preferred network. A carrier might control
9495         * this via gservices, OMA-DM, carrier app, etc.
9496         * <p>
9497         * Type: int (0 for false, 1 for true)
9498         * @hide
9499         */
9500        public static final String LTE_SERVICE_FORCED = "lte_service_forced";
9501
9502        /**
9503         * Ephemeral app cookie max size in bytes.
9504         * <p>
9505         * Type: int
9506         * @hide
9507         */
9508        public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
9509                "ephemeral_cookie_max_size_bytes";
9510
9511        /**
9512         * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is
9513         * enabled. Set to zero to disable.
9514         * <p>
9515         * Type: int (0 for false, 1 for true)
9516         *
9517         * @hide
9518         */
9519        public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature";
9520
9521        /**
9522         * The duration for caching uninstalled instant apps.
9523         * <p>
9524         * Type: long
9525         * @hide
9526         */
9527        public static final String UNINSTALLED_INSTANT_APP_CACHE_DURATION_MILLIS =
9528                "uninstalled_instant_app_cache_duration_millis";
9529
9530        /**
9531         * Allows switching users when system user is locked.
9532         * <p>
9533         * Type: int
9534         * @hide
9535         */
9536        public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED =
9537                "allow_user_switching_when_system_user_locked";
9538
9539        /**
9540         * Boot count since the device starts running APK level 24.
9541         * <p>
9542         * Type: int
9543         */
9544        public static final String BOOT_COUNT = "boot_count";
9545
9546        /**
9547         * Whether the safe boot is disallowed.
9548         *
9549         * <p>This setting should have the identical value as the corresponding user restriction.
9550         * The purpose of the setting is to make the restriction available in early boot stages
9551         * before the user restrictions are loaded.
9552         * @hide
9553         */
9554        public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
9555
9556        /**
9557         * Whether this device is currently in retail demo mode. If true, device
9558         * usage is severely limited.
9559         * <p>
9560         * Type: int (0 for false, 1 for true)
9561         * @hide
9562         */
9563        public static final String DEVICE_DEMO_MODE = "device_demo_mode";
9564
9565        /**
9566         * Retail mode specific settings. This is encoded as a key=value list, separated by commas.
9567         * Ex: "user_inactivity_timeout_ms=30000,warning_dialog_timeout_ms=10000". The following
9568         * keys are supported:
9569         *
9570         * <pre>
9571         * user_inactivity_timeout_ms  (long)
9572         * warning_dialog_timeout_ms   (long)
9573         * </pre>
9574         * <p>
9575         * Type: string
9576         *
9577         * @hide
9578         */
9579        public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants";
9580
9581        /**
9582         * The reason for the settings database being downgraded. This is only for
9583         * troubleshooting purposes and its value should not be interpreted in any way.
9584         *
9585         * Type: string
9586         *
9587         * @hide
9588         */
9589        public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
9590
9591        /**
9592         * Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by
9593         * default. Set to 0 to disable.
9594         *
9595         * @hide
9596         */
9597        public static final String CONTACTS_DATABASE_WAL_ENABLED = "contacts_database_wal_enabled";
9598
9599        /**
9600         * Flag to enable the link to location permissions in location setting. Set to 0 to disable.
9601         *
9602         * @hide
9603         */
9604        public static final String LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED =
9605                "location_settings_link_to_permissions_enabled";
9606
9607        /**
9608         * Settings to backup. This is here so that it's in the same place as the settings
9609         * keys and easy to update.
9610         *
9611         * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
9612         * and Secure as well.  This is because those tables drive both backup and
9613         * restore, and restore needs to properly whitelist keys that used to live
9614         * in those namespaces.  The keys will only actually be backed up / restored
9615         * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
9616         *
9617         * NOTE: Settings are backed up and restored in the order they appear
9618         *       in this array. If you have one setting depending on another,
9619         *       make sure that they are ordered appropriately.
9620         *
9621         * @hide
9622         */
9623        public static final String[] SETTINGS_TO_BACKUP = {
9624            BUGREPORT_IN_POWER_MENU,
9625            STAY_ON_WHILE_PLUGGED_IN,
9626            AUTO_TIME,
9627            AUTO_TIME_ZONE,
9628            POWER_SOUNDS_ENABLED,
9629            DOCK_SOUNDS_ENABLED,
9630            CHARGING_SOUNDS_ENABLED,
9631            USB_MASS_STORAGE_ENABLED,
9632            NETWORK_RECOMMENDATIONS_ENABLED,
9633            CURATE_SAVED_OPEN_NETWORKS,
9634            WIFI_WAKEUP_ENABLED,
9635            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
9636            WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
9637            EMERGENCY_TONE,
9638            CALL_AUTO_RETRY,
9639            DOCK_AUDIO_MEDIA_ENABLED,
9640            ENCODED_SURROUND_OUTPUT,
9641            LOW_POWER_MODE_TRIGGER_LEVEL
9642        };
9643
9644        private static final ContentProviderHolder sProviderHolder =
9645                new ContentProviderHolder(CONTENT_URI);
9646
9647        // Populated lazily, guarded by class object:
9648        private static final NameValueCache sNameValueCache = new NameValueCache(
9649                    CONTENT_URI,
9650                    CALL_METHOD_GET_GLOBAL,
9651                    CALL_METHOD_PUT_GLOBAL,
9652                    sProviderHolder);
9653
9654        // Certain settings have been moved from global to the per-user secure namespace
9655        private static final HashSet<String> MOVED_TO_SECURE;
9656        static {
9657            MOVED_TO_SECURE = new HashSet<>(1);
9658            MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
9659        }
9660
9661        /** @hide */
9662        public static void getMovedToSecureSettings(Set<String> outKeySet) {
9663            outKeySet.addAll(MOVED_TO_SECURE);
9664        }
9665
9666        /**
9667         * Look up a name in the database.
9668         * @param resolver to access the database with
9669         * @param name to look up in the table
9670         * @return the corresponding value, or null if not present
9671         */
9672        public static String getString(ContentResolver resolver, String name) {
9673            return getStringForUser(resolver, name, UserHandle.myUserId());
9674        }
9675
9676        /** @hide */
9677        public static String getStringForUser(ContentResolver resolver, String name,
9678                int userHandle) {
9679            if (MOVED_TO_SECURE.contains(name)) {
9680                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
9681                        + " to android.provider.Settings.Secure, returning read-only value.");
9682                return Secure.getStringForUser(resolver, name, userHandle);
9683            }
9684            return sNameValueCache.getStringForUser(resolver, name, userHandle);
9685        }
9686
9687        /**
9688         * Store a name/value pair into the database.
9689         * @param resolver to access the database with
9690         * @param name to store
9691         * @param value to associate with the name
9692         * @return true if the value was set, false on database errors
9693         */
9694        public static boolean putString(ContentResolver resolver,
9695                String name, String value) {
9696            return putStringForUser(resolver, name, value, null, false, UserHandle.myUserId());
9697        }
9698
9699        /**
9700         * Store a name/value pair into the database.
9701         * <p>
9702         * The method takes an optional tag to associate with the setting
9703         * which can be used to clear only settings made by your package and
9704         * associated with this tag by passing the tag to {@link
9705         * #resetToDefaults(ContentResolver, String)}. Anyone can override
9706         * the current tag. Also if another package changes the setting
9707         * then the tag will be set to the one specified in the set call
9708         * which can be null. Also any of the settings setters that do not
9709         * take a tag as an argument effectively clears the tag.
9710         * </p><p>
9711         * For example, if you set settings A and B with tags T1 and T2 and
9712         * another app changes setting A (potentially to the same value), it
9713         * can assign to it a tag T3 (note that now the package that changed
9714         * the setting is not yours). Now if you reset your changes for T1 and
9715         * T2 only setting B will be reset and A not (as it was changed by
9716         * another package) but since A did not change you are in the desired
9717         * initial state. Now if the other app changes the value of A (assuming
9718         * you registered an observer in the beginning) you would detect that
9719         * the setting was changed by another app and handle this appropriately
9720         * (ignore, set back to some value, etc).
9721         * </p><p>
9722         * Also the method takes an argument whether to make the value the
9723         * default for this setting. If the system already specified a default
9724         * value, then the one passed in here will <strong>not</strong>
9725         * be set as the default.
9726         * </p>
9727         *
9728         * @param resolver to access the database with.
9729         * @param name to store.
9730         * @param value to associate with the name.
9731         * @param tag to associated with the setting.
9732         * @param makeDefault whether to make the value the default one.
9733         * @return true if the value was set, false on database errors.
9734         *
9735         * @see #resetToDefaults(ContentResolver, String)
9736         *
9737         * @hide
9738         */
9739        @SystemApi
9740        @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
9741        public static boolean putString(@NonNull ContentResolver resolver,
9742                @NonNull String name, @Nullable String value, @Nullable String tag,
9743                boolean makeDefault) {
9744            return putStringForUser(resolver, name, value, tag, makeDefault,
9745                    UserHandle.myUserId());
9746        }
9747
9748        /**
9749         * Reset the settings to their defaults. This would reset <strong>only</strong>
9750         * settings set by the caller's package. Think of it of a way to undo your own
9751         * changes to the secure settings. Passing in the optional tag will reset only
9752         * settings changed by your package and associated with this tag.
9753         *
9754         * @param resolver Handle to the content resolver.
9755         * @param tag Optional tag which should be associated with the settings to reset.
9756         *
9757         * @see #putString(ContentResolver, String, String, String, boolean)
9758         *
9759         * @hide
9760         */
9761        @SystemApi
9762        @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
9763        public static void resetToDefaults(@NonNull ContentResolver resolver,
9764                @Nullable String tag) {
9765            resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
9766                    UserHandle.myUserId());
9767        }
9768
9769        /**
9770         * Reset the settings to their defaults for a given user with a specific mode. The
9771         * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
9772         * allowing resetting the settings made by a package and associated with the tag.
9773         *
9774         * @param resolver Handle to the content resolver.
9775         * @param tag Optional tag which should be associated with the settings to reset.
9776         * @param mode The reset mode.
9777         * @param userHandle The user for which to reset to defaults.
9778         *
9779         * @see #RESET_MODE_PACKAGE_DEFAULTS
9780         * @see #RESET_MODE_UNTRUSTED_DEFAULTS
9781         * @see #RESET_MODE_UNTRUSTED_CHANGES
9782         * @see #RESET_MODE_TRUSTED_DEFAULTS
9783         *
9784         * @hide
9785         */
9786        public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
9787                @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
9788            try {
9789                Bundle arg = new Bundle();
9790                arg.putInt(CALL_METHOD_USER_KEY, userHandle);
9791                if (tag != null) {
9792                    arg.putString(CALL_METHOD_TAG_KEY, tag);
9793                }
9794                arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
9795                IContentProvider cp = sProviderHolder.getProvider(resolver);
9796                cp.call(resolver.getPackageName(), CALL_METHOD_RESET_GLOBAL, null, arg);
9797            } catch (RemoteException e) {
9798                Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
9799            }
9800        }
9801
9802        /** @hide */
9803        public static boolean putStringForUser(ContentResolver resolver,
9804                String name, String value, int userHandle) {
9805            return putStringForUser(resolver, name, value, null, false, userHandle);
9806        }
9807
9808        /** @hide */
9809        public static boolean putStringForUser(@NonNull ContentResolver resolver,
9810                @NonNull String name, @Nullable String value, @Nullable String tag,
9811                boolean makeDefault, @UserIdInt int userHandle) {
9812            if (LOCAL_LOGV) {
9813                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
9814                        + " for " + userHandle);
9815            }
9816            // Global and Secure have the same access policy so we can forward writes
9817            if (MOVED_TO_SECURE.contains(name)) {
9818                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
9819                        + " to android.provider.Settings.Secure, value is unchanged.");
9820                return Secure.putStringForUser(resolver, name, value, tag,
9821                        makeDefault, userHandle);
9822            }
9823            return sNameValueCache.putStringForUser(resolver, name, value, tag,
9824                    makeDefault, userHandle);
9825        }
9826
9827        /**
9828         * Construct the content URI for a particular name/value pair,
9829         * useful for monitoring changes with a ContentObserver.
9830         * @param name to look up in the table
9831         * @return the corresponding content URI, or null if not present
9832         */
9833        public static Uri getUriFor(String name) {
9834            return getUriFor(CONTENT_URI, name);
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.  The default value will be returned if the setting is
9842         * not defined or not an integer.
9843         *
9844         * @param cr The ContentResolver to access.
9845         * @param name The name of the setting to retrieve.
9846         * @param def Value to return if the setting is not defined.
9847         *
9848         * @return The setting's current value, or 'def' if it is not defined
9849         * or not a valid integer.
9850         */
9851        public static int getInt(ContentResolver cr, String name, int def) {
9852            String v = getString(cr, name);
9853            try {
9854                return v != null ? Integer.parseInt(v) : def;
9855            } catch (NumberFormatException e) {
9856                return def;
9857            }
9858        }
9859
9860        /**
9861         * Convenience function for retrieving a single secure settings value
9862         * as an integer.  Note that internally setting values are always
9863         * stored as strings; this function converts the string to an integer
9864         * for you.
9865         * <p>
9866         * This version does not take a default value.  If the setting has not
9867         * been set, or the string value is not a number,
9868         * it throws {@link SettingNotFoundException}.
9869         *
9870         * @param cr The ContentResolver to access.
9871         * @param name The name of the setting to retrieve.
9872         *
9873         * @throws SettingNotFoundException Thrown if a setting by the given
9874         * name can't be found or the setting value is not an integer.
9875         *
9876         * @return The setting's current value.
9877         */
9878        public static int getInt(ContentResolver cr, String name)
9879                throws SettingNotFoundException {
9880            String v = getString(cr, name);
9881            try {
9882                return Integer.parseInt(v);
9883            } catch (NumberFormatException e) {
9884                throw new SettingNotFoundException(name);
9885            }
9886        }
9887
9888        /**
9889         * Convenience function for updating a single settings value as an
9890         * integer. This will either create a new entry in the table if the
9891         * given name does not exist, or modify the value of the existing row
9892         * with that name.  Note that internally setting values are always
9893         * stored as strings, so this function converts the given value to a
9894         * string before storing it.
9895         *
9896         * @param cr The ContentResolver to access.
9897         * @param name The name of the setting to modify.
9898         * @param value The new value for the setting.
9899         * @return true if the value was set, false on database errors
9900         */
9901        public static boolean putInt(ContentResolver cr, String name, int value) {
9902            return putString(cr, name, Integer.toString(value));
9903        }
9904
9905        /**
9906         * Convenience function for retrieving a single secure settings value
9907         * as a {@code long}.  Note that internally setting values are always
9908         * stored as strings; this function converts the string to a {@code long}
9909         * for you.  The default value will be returned if the setting is
9910         * not defined or not a {@code long}.
9911         *
9912         * @param cr The ContentResolver to access.
9913         * @param name The name of the setting to retrieve.
9914         * @param def Value to return if the setting is not defined.
9915         *
9916         * @return The setting's current value, or 'def' if it is not defined
9917         * or not a valid {@code long}.
9918         */
9919        public static long getLong(ContentResolver cr, String name, long def) {
9920            String valString = getString(cr, name);
9921            long value;
9922            try {
9923                value = valString != null ? Long.parseLong(valString) : def;
9924            } catch (NumberFormatException e) {
9925                value = def;
9926            }
9927            return value;
9928        }
9929
9930        /**
9931         * Convenience function for retrieving a single secure settings value
9932         * as a {@code long}.  Note that internally setting values are always
9933         * stored as strings; this function converts the string to a {@code long}
9934         * for you.
9935         * <p>
9936         * This version does not take a default value.  If the setting has not
9937         * been set, or the string value is not a number,
9938         * it throws {@link SettingNotFoundException}.
9939         *
9940         * @param cr The ContentResolver to access.
9941         * @param name The name of the setting to retrieve.
9942         *
9943         * @return The setting's current value.
9944         * @throws SettingNotFoundException Thrown if a setting by the given
9945         * name can't be found or the setting value is not an integer.
9946         */
9947        public static long getLong(ContentResolver cr, String name)
9948                throws SettingNotFoundException {
9949            String valString = getString(cr, name);
9950            try {
9951                return Long.parseLong(valString);
9952            } catch (NumberFormatException e) {
9953                throw new SettingNotFoundException(name);
9954            }
9955        }
9956
9957        /**
9958         * Convenience function for updating a secure settings value as a long
9959         * integer. This will either create a new entry in the table if the
9960         * given name does not exist, or modify the value of the existing row
9961         * with that name.  Note that internally setting values are always
9962         * stored as strings, so this function converts the given value to a
9963         * string before storing it.
9964         *
9965         * @param cr The ContentResolver to access.
9966         * @param name The name of the setting to modify.
9967         * @param value The new value for the setting.
9968         * @return true if the value was set, false on database errors
9969         */
9970        public static boolean putLong(ContentResolver cr, String name, long value) {
9971            return putString(cr, name, Long.toString(value));
9972        }
9973
9974        /**
9975         * Convenience function for retrieving a single secure settings value
9976         * as a floating point number.  Note that internally setting values are
9977         * always stored as strings; this function converts the string to an
9978         * float for you. The default value will be returned if the setting
9979         * is not defined or not a valid float.
9980         *
9981         * @param cr The ContentResolver to access.
9982         * @param name The name of the setting to retrieve.
9983         * @param def Value to return if the setting is not defined.
9984         *
9985         * @return The setting's current value, or 'def' if it is not defined
9986         * or not a valid float.
9987         */
9988        public static float getFloat(ContentResolver cr, String name, float def) {
9989            String v = getString(cr, name);
9990            try {
9991                return v != null ? Float.parseFloat(v) : def;
9992            } catch (NumberFormatException e) {
9993                return def;
9994            }
9995        }
9996
9997        /**
9998         * Convenience function for retrieving a single secure settings value
9999         * as a float.  Note that internally setting values are always
10000         * stored as strings; this function converts the string to a float
10001         * for you.
10002         * <p>
10003         * This version does not take a default value.  If the setting has not
10004         * been set, or the string value is not a number,
10005         * it throws {@link SettingNotFoundException}.
10006         *
10007         * @param cr The ContentResolver to access.
10008         * @param name The name of the setting to retrieve.
10009         *
10010         * @throws SettingNotFoundException Thrown if a setting by the given
10011         * name can't be found or the setting value is not a float.
10012         *
10013         * @return The setting's current value.
10014         */
10015        public static float getFloat(ContentResolver cr, String name)
10016                throws SettingNotFoundException {
10017            String v = getString(cr, name);
10018            if (v == null) {
10019                throw new SettingNotFoundException(name);
10020            }
10021            try {
10022                return Float.parseFloat(v);
10023            } catch (NumberFormatException e) {
10024                throw new SettingNotFoundException(name);
10025            }
10026        }
10027
10028        /**
10029         * Convenience function for updating a single settings value as a
10030         * floating point number. This will either create a new entry in the
10031         * table if the given name does not exist, or modify the value of the
10032         * existing row with that name.  Note that internally setting values
10033         * are always stored as strings, so this function converts the given
10034         * value to a string before storing it.
10035         *
10036         * @param cr The ContentResolver to access.
10037         * @param name The name of the setting to modify.
10038         * @param value The new value for the setting.
10039         * @return true if the value was set, false on database errors
10040         */
10041        public static boolean putFloat(ContentResolver cr, String name, float value) {
10042            return putString(cr, name, Float.toString(value));
10043        }
10044
10045        /**
10046          * Subscription to be used for voice call on a multi sim device. The supported values
10047          * are 0 = SUB1, 1 = SUB2 and etc.
10048          * @hide
10049          */
10050        public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
10051
10052        /**
10053          * Used to provide option to user to select subscription during dial.
10054          * The supported values are 0 = disable or 1 = enable prompt.
10055          * @hide
10056          */
10057        public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
10058
10059        /**
10060          * Subscription to be used for data call on a multi sim device. The supported values
10061          * are 0 = SUB1, 1 = SUB2 and etc.
10062          * @hide
10063          */
10064        public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
10065
10066        /**
10067          * Subscription to be used for SMS on a multi sim device. The supported values
10068          * are 0 = SUB1, 1 = SUB2 and etc.
10069          * @hide
10070          */
10071        public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
10072
10073       /**
10074          * Used to provide option to user to select subscription during send SMS.
10075          * The value 1 - enable, 0 - disable
10076          * @hide
10077          */
10078        public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
10079
10080
10081
10082        /** User preferred subscriptions setting.
10083          * This holds the details of the user selected subscription from the card and
10084          * the activation status. Each settings string have the coma separated values
10085          * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
10086          * @hide
10087         */
10088        public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
10089                "user_preferred_sub2","user_preferred_sub3"};
10090
10091        /**
10092         * Whether to enable new contacts aggregator or not.
10093         * The value 1 - enable, 0 - disable
10094         * @hide
10095         */
10096        public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
10097
10098        /**
10099         * Whether to enable contacts metadata syncing or not
10100         * The value 1 - enable, 0 - disable
10101         *
10102         * @removed
10103         */
10104        @Deprecated
10105        public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
10106
10107        /**
10108         * Whether to enable contacts metadata syncing or not
10109         * The value 1 - enable, 0 - disable
10110         */
10111        public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
10112
10113        /**
10114         * Whether to enable cellular on boot.
10115         * The value 1 - enable, 0 - disable
10116         * @hide
10117         */
10118        public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
10119
10120        /**
10121         * The maximum allowed notification enqueue rate in Hertz.
10122         *
10123         * Should be a float, and includes both posts and updates.
10124         * @hide
10125         */
10126        public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate";
10127
10128        /**
10129         * Whether cell is enabled/disabled
10130         * @hide
10131         */
10132        public static final String CELL_ON = "cell_on";
10133
10134        /**
10135         * Global settings which can be accessed by ephemeral apps.
10136         * @hide
10137         */
10138        public static final Set<String> EPHEMERAL_SETTINGS = new ArraySet<>();
10139        static {
10140            EPHEMERAL_SETTINGS.add(WAIT_FOR_DEBUGGER);
10141            EPHEMERAL_SETTINGS.add(DEVICE_PROVISIONED);
10142            EPHEMERAL_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
10143            EPHEMERAL_SETTINGS.add(DEVELOPMENT_FORCE_RTL);
10144            EPHEMERAL_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
10145        }
10146
10147        /**
10148         * Whether to show the high temperature warning notification.
10149         * @hide
10150         */
10151        public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
10152
10153        /**
10154         * Temperature at which the high temperature warning notification should be shown.
10155         * @hide
10156         */
10157        public static final String WARNING_TEMPERATURE = "warning_temperature";
10158
10159        /**
10160         * Whether the diskstats logging task is enabled/disabled.
10161         * @hide
10162         */
10163        public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging";
10164    }
10165
10166    /**
10167     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
10168     * Intent URL, allowing it to be either a web page or a particular
10169     * application activity.
10170     *
10171     * @hide
10172     */
10173    public static final class Bookmarks implements BaseColumns
10174    {
10175        private static final String TAG = "Bookmarks";
10176
10177        /**
10178         * The content:// style URL for this table
10179         */
10180        public static final Uri CONTENT_URI =
10181            Uri.parse("content://" + AUTHORITY + "/bookmarks");
10182
10183        /**
10184         * The row ID.
10185         * <p>Type: INTEGER</p>
10186         */
10187        public static final String ID = "_id";
10188
10189        /**
10190         * Descriptive name of the bookmark that can be displayed to the user.
10191         * If this is empty, the title should be resolved at display time (use
10192         * {@link #getTitle(Context, Cursor)} any time you want to display the
10193         * title of a bookmark.)
10194         * <P>
10195         * Type: TEXT
10196         * </P>
10197         */
10198        public static final String TITLE = "title";
10199
10200        /**
10201         * Arbitrary string (displayed to the user) that allows bookmarks to be
10202         * organized into categories.  There are some special names for
10203         * standard folders, which all start with '@'.  The label displayed for
10204         * the folder changes with the locale (via {@link #getLabelForFolder}) but
10205         * the folder name does not change so you can consistently query for
10206         * the folder regardless of the current locale.
10207         *
10208         * <P>Type: TEXT</P>
10209         *
10210         */
10211        public static final String FOLDER = "folder";
10212
10213        /**
10214         * The Intent URL of the bookmark, describing what it points to.  This
10215         * value is given to {@link android.content.Intent#getIntent} to create
10216         * an Intent that can be launched.
10217         * <P>Type: TEXT</P>
10218         */
10219        public static final String INTENT = "intent";
10220
10221        /**
10222         * Optional shortcut character associated with this bookmark.
10223         * <P>Type: INTEGER</P>
10224         */
10225        public static final String SHORTCUT = "shortcut";
10226
10227        /**
10228         * The order in which the bookmark should be displayed
10229         * <P>Type: INTEGER</P>
10230         */
10231        public static final String ORDERING = "ordering";
10232
10233        private static final String[] sIntentProjection = { INTENT };
10234        private static final String[] sShortcutProjection = { ID, SHORTCUT };
10235        private static final String sShortcutSelection = SHORTCUT + "=?";
10236
10237        /**
10238         * Convenience function to retrieve the bookmarked Intent for a
10239         * particular shortcut key.
10240         *
10241         * @param cr The ContentResolver to query.
10242         * @param shortcut The shortcut key.
10243         *
10244         * @return Intent The bookmarked URL, or null if there is no bookmark
10245         *         matching the given shortcut.
10246         */
10247        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
10248        {
10249            Intent intent = null;
10250
10251            Cursor c = cr.query(CONTENT_URI,
10252                    sIntentProjection, sShortcutSelection,
10253                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
10254            // Keep trying until we find a valid shortcut
10255            try {
10256                while (intent == null && c.moveToNext()) {
10257                    try {
10258                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
10259                        intent = Intent.parseUri(intentURI, 0);
10260                    } catch (java.net.URISyntaxException e) {
10261                        // The stored URL is bad...  ignore it.
10262                    } catch (IllegalArgumentException e) {
10263                        // Column not found
10264                        Log.w(TAG, "Intent column not found", e);
10265                    }
10266                }
10267            } finally {
10268                if (c != null) c.close();
10269            }
10270
10271            return intent;
10272        }
10273
10274        /**
10275         * Add a new bookmark to the system.
10276         *
10277         * @param cr The ContentResolver to query.
10278         * @param intent The desired target of the bookmark.
10279         * @param title Bookmark title that is shown to the user; null if none
10280         *            or it should be resolved to the intent's title.
10281         * @param folder Folder in which to place the bookmark; null if none.
10282         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
10283         *            this is non-zero and there is an existing bookmark entry
10284         *            with this same shortcut, then that existing shortcut is
10285         *            cleared (the bookmark is not removed).
10286         * @return The unique content URL for the new bookmark entry.
10287         */
10288        public static Uri add(ContentResolver cr,
10289                                           Intent intent,
10290                                           String title,
10291                                           String folder,
10292                                           char shortcut,
10293                                           int ordering)
10294        {
10295            // If a shortcut is supplied, and it is already defined for
10296            // another bookmark, then remove the old definition.
10297            if (shortcut != 0) {
10298                cr.delete(CONTENT_URI, sShortcutSelection,
10299                        new String[] { String.valueOf((int) shortcut) });
10300            }
10301
10302            ContentValues values = new ContentValues();
10303            if (title != null) values.put(TITLE, title);
10304            if (folder != null) values.put(FOLDER, folder);
10305            values.put(INTENT, intent.toUri(0));
10306            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
10307            values.put(ORDERING, ordering);
10308            return cr.insert(CONTENT_URI, values);
10309        }
10310
10311        /**
10312         * Return the folder name as it should be displayed to the user.  This
10313         * takes care of localizing special folders.
10314         *
10315         * @param r Resources object for current locale; only need access to
10316         *          system resources.
10317         * @param folder The value found in the {@link #FOLDER} column.
10318         *
10319         * @return CharSequence The label for this folder that should be shown
10320         *         to the user.
10321         */
10322        public static CharSequence getLabelForFolder(Resources r, String folder) {
10323            return folder;
10324        }
10325
10326        /**
10327         * Return the title as it should be displayed to the user. This takes
10328         * care of localizing bookmarks that point to activities.
10329         *
10330         * @param context A context.
10331         * @param cursor A cursor pointing to the row whose title should be
10332         *        returned. The cursor must contain at least the {@link #TITLE}
10333         *        and {@link #INTENT} columns.
10334         * @return A title that is localized and can be displayed to the user,
10335         *         or the empty string if one could not be found.
10336         */
10337        public static CharSequence getTitle(Context context, Cursor cursor) {
10338            int titleColumn = cursor.getColumnIndex(TITLE);
10339            int intentColumn = cursor.getColumnIndex(INTENT);
10340            if (titleColumn == -1 || intentColumn == -1) {
10341                throw new IllegalArgumentException(
10342                        "The cursor must contain the TITLE and INTENT columns.");
10343            }
10344
10345            String title = cursor.getString(titleColumn);
10346            if (!TextUtils.isEmpty(title)) {
10347                return title;
10348            }
10349
10350            String intentUri = cursor.getString(intentColumn);
10351            if (TextUtils.isEmpty(intentUri)) {
10352                return "";
10353            }
10354
10355            Intent intent;
10356            try {
10357                intent = Intent.parseUri(intentUri, 0);
10358            } catch (URISyntaxException e) {
10359                return "";
10360            }
10361
10362            PackageManager packageManager = context.getPackageManager();
10363            ResolveInfo info = packageManager.resolveActivity(intent, 0);
10364            return info != null ? info.loadLabel(packageManager) : "";
10365        }
10366    }
10367
10368    /**
10369     * Returns the device ID that we should use when connecting to the mobile gtalk server.
10370     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
10371     * from the GoogleLoginService.
10372     *
10373     * @param androidId The Android ID for this device.
10374     * @return The device ID that should be used when connecting to the mobile gtalk server.
10375     * @hide
10376     */
10377    public static String getGTalkDeviceId(long androidId) {
10378        return "android-" + Long.toHexString(androidId);
10379    }
10380
10381    private static final String[] PM_WRITE_SETTINGS = {
10382        android.Manifest.permission.WRITE_SETTINGS
10383    };
10384    private static final String[] PM_CHANGE_NETWORK_STATE = {
10385        android.Manifest.permission.CHANGE_NETWORK_STATE,
10386        android.Manifest.permission.WRITE_SETTINGS
10387    };
10388    private static final String[] PM_SYSTEM_ALERT_WINDOW = {
10389        android.Manifest.permission.SYSTEM_ALERT_WINDOW
10390    };
10391
10392    /**
10393     * Performs a strict and comprehensive check of whether a calling package is allowed to
10394     * write/modify system settings, as the condition differs for pre-M, M+, and
10395     * privileged/preinstalled apps. If the provided uid does not match the
10396     * callingPackage, a negative result will be returned.
10397     * @hide
10398     */
10399    public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
10400            String callingPackage, boolean throwException) {
10401        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
10402                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
10403                PM_WRITE_SETTINGS, false);
10404    }
10405
10406    /**
10407     * Performs a strict and comprehensive check of whether a calling package is allowed to
10408     * write/modify system settings, as the condition differs for pre-M, M+, and
10409     * privileged/preinstalled apps. If the provided uid does not match the
10410     * callingPackage, a negative result will be returned. The caller is expected to have
10411     * the WRITE_SETTINGS permission declared.
10412     *
10413     * Note: if the check is successful, the operation of this app will be updated to the
10414     * current time.
10415     * @hide
10416     */
10417    public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
10418            String callingPackage, boolean throwException) {
10419        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
10420                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
10421                PM_WRITE_SETTINGS, true);
10422    }
10423
10424    /**
10425     * Performs a strict and comprehensive check of whether a calling package is allowed to
10426     * change the state of network, as the condition differs for pre-M, M+, and
10427     * privileged/preinstalled apps. The caller is expected to have either the
10428     * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
10429     * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
10430     * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
10431     * permission and cannot be revoked. See http://b/23597341
10432     *
10433     * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
10434     * of this app will be updated to the current time.
10435     * @hide
10436     */
10437    public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
10438            String callingPackage, boolean throwException) {
10439        if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
10440                == PackageManager.PERMISSION_GRANTED) {
10441            return true;
10442        }
10443        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
10444                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
10445                PM_CHANGE_NETWORK_STATE, true);
10446    }
10447
10448    /**
10449     * Performs a strict and comprehensive check of whether a calling package is allowed to
10450     * draw on top of other apps, as the conditions differs for pre-M, M+, and
10451     * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
10452     * a negative result will be returned.
10453     * @hide
10454     */
10455    public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
10456            String callingPackage, boolean throwException) {
10457        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
10458                callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
10459                PM_SYSTEM_ALERT_WINDOW, false);
10460    }
10461
10462    /**
10463     * Performs a strict and comprehensive check of whether a calling package is allowed to
10464     * draw on top of other apps, as the conditions differs for pre-M, M+, and
10465     * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
10466     * a negative result will be returned.
10467     *
10468     * Note: if the check is successful, the operation of this app will be updated to the
10469     * current time.
10470     * @hide
10471     */
10472    public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
10473            callingPackage, boolean throwException) {
10474        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
10475                callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
10476                PM_SYSTEM_ALERT_WINDOW, true);
10477    }
10478
10479    /**
10480     * Helper method to perform a general and comprehensive check of whether an operation that is
10481     * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
10482     * OP_WRITE_SETTINGS
10483     * @hide
10484     */
10485    public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
10486            int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
10487            permissions, boolean makeNote) {
10488        if (callingPackage == null) {
10489            return false;
10490        }
10491
10492        AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
10493        int mode = AppOpsManager.MODE_DEFAULT;
10494        if (makeNote) {
10495            mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
10496        } else {
10497            mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
10498        }
10499
10500        switch (mode) {
10501            case AppOpsManager.MODE_ALLOWED:
10502                return true;
10503
10504            case AppOpsManager.MODE_DEFAULT:
10505                // this is the default operating mode after an app's installation
10506                // In this case we will check all associated static permission to see
10507                // if it is granted during install time.
10508                for (String permission : permissions) {
10509                    if (context.checkCallingOrSelfPermission(permission) == PackageManager
10510                            .PERMISSION_GRANTED) {
10511                        // if either of the permissions are granted, we will allow it
10512                        return true;
10513                    }
10514                }
10515
10516            default:
10517                // this is for all other cases trickled down here...
10518                if (!throwException) {
10519                    return false;
10520                }
10521        }
10522
10523        // prepare string to throw SecurityException
10524        StringBuilder exceptionMessage = new StringBuilder();
10525        exceptionMessage.append(callingPackage);
10526        exceptionMessage.append(" was not granted ");
10527        if (permissions.length > 1) {
10528            exceptionMessage.append(" either of these permissions: ");
10529        } else {
10530            exceptionMessage.append(" this permission: ");
10531        }
10532        for (int i = 0; i < permissions.length; i++) {
10533            exceptionMessage.append(permissions[i]);
10534            exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
10535        }
10536
10537        throw new SecurityException(exceptionMessage.toString());
10538    }
10539
10540    /**
10541     * Retrieves a correponding package name for a given uid. It will query all
10542     * packages that are associated with the given uid, but it will return only
10543     * the zeroth result.
10544     * Note: If package could not be found, a null is returned.
10545     * @hide
10546     */
10547    public static String getPackageNameForUid(Context context, int uid) {
10548        String[] packages = context.getPackageManager().getPackagesForUid(uid);
10549        if (packages == null) {
10550            return null;
10551        }
10552        return packages[0];
10553    }
10554}
10555