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