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