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