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