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