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