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