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