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