Settings.java revision 0c09549ef45bf4a9ec3f6c83d2511023a4c67131
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         * bluetooth HCI snoop log configuration
4724         * @hide
4725         */
4726        public static final String BLUETOOTH_HCI_LOG =
4727                "bluetooth_hci_log";
4728
4729        /**
4730         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
4731         */
4732        @Deprecated
4733        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
4734
4735        /**
4736         * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
4737         * @hide
4738         */
4739        public static final String USER_SETUP_COMPLETE = "user_setup_complete";
4740
4741        /**
4742         * Prefix for category name that marks whether a suggested action from that category was
4743         * completed.
4744         * @hide
4745         */
4746        public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category.";
4747
4748        /**
4749         * List of input methods that are currently enabled.  This is a string
4750         * containing the IDs of all enabled input methods, each ID separated
4751         * by ':'.
4752         */
4753        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
4754
4755        /**
4756         * List of system input methods that are currently disabled.  This is a string
4757         * containing the IDs of all disabled input methods, each ID separated
4758         * by ':'.
4759         * @hide
4760         */
4761        public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
4762
4763        /**
4764         * Whether to show the IME when a hard keyboard is connected. This is a boolean that
4765         * determines if the IME should be shown when a hard keyboard is attached.
4766         * @hide
4767         */
4768        public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
4769
4770        /**
4771         * Host name and port for global http proxy. Uses ':' seperator for
4772         * between host and port.
4773         *
4774         * @deprecated Use {@link Global#HTTP_PROXY}
4775         */
4776        @Deprecated
4777        public static final String HTTP_PROXY = Global.HTTP_PROXY;
4778
4779        /**
4780         * Package designated as always-on VPN provider.
4781         *
4782         * @hide
4783         */
4784        public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app";
4785
4786        /**
4787         * Whether to block networking outside of VPN connections while always-on is set.
4788         * @see #ALWAYS_ON_VPN_APP
4789         *
4790         * @hide
4791         */
4792        public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown";
4793
4794        /**
4795         * Whether applications can be installed for this user via the system's
4796         * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
4797         *
4798         * <p>1 = permit app installation via the system package installer intent
4799         * <p>0 = do not allow use of the package installer
4800         */
4801        public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
4802
4803        /**
4804         * Comma-separated list of location providers that activities may access. Do not rely on
4805         * this value being present in settings.db or on ContentObserver notifications on the
4806         * corresponding Uri.
4807         *
4808         * @deprecated use {@link #LOCATION_MODE} and
4809         * {@link LocationManager#MODE_CHANGED_ACTION} (or
4810         * {@link LocationManager#PROVIDERS_CHANGED_ACTION})
4811         */
4812        @Deprecated
4813        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
4814
4815        /**
4816         * The degree of location access enabled by the user.
4817         * <p>
4818         * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
4819         * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link
4820         * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link
4821         * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location
4822         * modes that might be added in the future.
4823         * <p>
4824         * Note: do not rely on this value being present in settings.db or on ContentObserver
4825         * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION}
4826         * to receive changes in this value.
4827         */
4828        public static final String LOCATION_MODE = "location_mode";
4829        /**
4830         * Stores the previous location mode when {@link #LOCATION_MODE} is set to
4831         * {@link #LOCATION_MODE_OFF}
4832         * @hide
4833         */
4834        public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode";
4835
4836        /**
4837         * Sets all location providers to the previous states before location was turned off.
4838         * @hide
4839         */
4840        public static final int LOCATION_MODE_PREVIOUS = -1;
4841        /**
4842         * Location access disabled.
4843         */
4844        public static final int LOCATION_MODE_OFF = 0;
4845        /**
4846         * Network Location Provider disabled, but GPS and other sensors enabled.
4847         */
4848        public static final int LOCATION_MODE_SENSORS_ONLY = 1;
4849        /**
4850         * Reduced power usage, such as limiting the number of GPS updates per hour. Requests
4851         * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to
4852         * {@link android.location.Criteria#POWER_MEDIUM}.
4853         */
4854        public static final int LOCATION_MODE_BATTERY_SAVING = 2;
4855        /**
4856         * Best-effort location computation allowed.
4857         */
4858        public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
4859
4860        /**
4861         * A flag containing settings used for biometric weak
4862         * @hide
4863         */
4864        @Deprecated
4865        public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
4866                "lock_biometric_weak_flags";
4867
4868        /**
4869         * Whether lock-to-app will lock the keyguard when exiting.
4870         * @hide
4871         */
4872        public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
4873
4874        /**
4875         * Whether autolock is enabled (0 = false, 1 = true)
4876         *
4877         * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
4878         *             level of the keyguard. Accessing this setting from an app that is targeting
4879         *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
4880         */
4881        @Deprecated
4882        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
4883
4884        /**
4885         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
4886         *
4887         * @deprecated Accessing this setting from an app that is targeting
4888         *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
4889         */
4890        @Deprecated
4891        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
4892
4893        /**
4894         * Whether lock pattern will vibrate as user enters (0 = false, 1 =
4895         * true)
4896         *
4897         * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
4898         *             lockscreen uses
4899         *             {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
4900         *             Accessing this setting from an app that is targeting
4901         *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
4902         */
4903        @Deprecated
4904        public static final String
4905                LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
4906
4907        /**
4908         * This preference allows the device to be locked given time after screen goes off,
4909         * subject to current DeviceAdmin policy limits.
4910         * @hide
4911         */
4912        public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
4913
4914
4915        /**
4916         * This preference contains the string that shows for owner info on LockScreen.
4917         * @hide
4918         * @deprecated
4919         */
4920        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
4921
4922        /**
4923         * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
4924         * @hide
4925         */
4926        @Deprecated
4927        public static final String LOCK_SCREEN_APPWIDGET_IDS =
4928            "lock_screen_appwidget_ids";
4929
4930        /**
4931         * Id of the appwidget shown on the lock screen when appwidgets are disabled.
4932         * @hide
4933         */
4934        @Deprecated
4935        public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
4936            "lock_screen_fallback_appwidget_id";
4937
4938        /**
4939         * Index of the lockscreen appwidget to restore, -1 if none.
4940         * @hide
4941         */
4942        @Deprecated
4943        public static final String LOCK_SCREEN_STICKY_APPWIDGET =
4944            "lock_screen_sticky_appwidget";
4945
4946        /**
4947         * This preference enables showing the owner info on LockScreen.
4948         * @hide
4949         * @deprecated
4950         */
4951        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
4952            "lock_screen_owner_info_enabled";
4953
4954        /**
4955         * When set by a user, allows notifications to be shown atop a securely locked screen
4956         * in their full "private" form (same as when the device is unlocked).
4957         * @hide
4958         */
4959        public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
4960                "lock_screen_allow_private_notifications";
4961
4962        /**
4963         * When set by a user, allows notification remote input atop a securely locked screen
4964         * without having to unlock
4965         * @hide
4966         */
4967        public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT =
4968                "lock_screen_allow_remote_input";
4969
4970        /**
4971         * Set by the system to track if the user needs to see the call to action for
4972         * the lockscreen notification policy.
4973         * @hide
4974         */
4975        public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
4976                "show_note_about_notification_hiding";
4977
4978        /**
4979         * Set to 1 by the system after trust agents have been initialized.
4980         * @hide
4981         */
4982        public static final String TRUST_AGENTS_INITIALIZED =
4983                "trust_agents_initialized";
4984
4985        /**
4986         * The Logging ID (a unique 64-bit value) as a hex string.
4987         * Used as a pseudonymous identifier for logging.
4988         * @deprecated This identifier is poorly initialized and has
4989         * many collisions.  It should not be used.
4990         */
4991        @Deprecated
4992        public static final String LOGGING_ID = "logging_id";
4993
4994        /**
4995         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
4996         */
4997        @Deprecated
4998        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
4999
5000        /**
5001         * No longer supported.
5002         */
5003        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
5004
5005        /**
5006         * No longer supported.
5007         */
5008        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
5009
5010        /**
5011         * No longer supported.
5012         */
5013        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
5014
5015        /**
5016         * Settings classname to launch when Settings is clicked from All
5017         * Applications.  Needed because of user testing between the old
5018         * and new Settings apps.
5019         */
5020        // TODO: 881807
5021        public static final String SETTINGS_CLASSNAME = "settings_classname";
5022
5023        /**
5024         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
5025         */
5026        @Deprecated
5027        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
5028
5029        /**
5030         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
5031         */
5032        @Deprecated
5033        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
5034
5035        /**
5036         * If accessibility is enabled.
5037         */
5038        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
5039
5040        /**
5041         * If touch exploration is enabled.
5042         */
5043        public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
5044
5045        /**
5046         * List of the enabled accessibility providers.
5047         */
5048        public static final String ENABLED_ACCESSIBILITY_SERVICES =
5049            "enabled_accessibility_services";
5050
5051        /**
5052         * List of the accessibility services to which the user has granted
5053         * permission to put the device into touch exploration mode.
5054         *
5055         * @hide
5056         */
5057        public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
5058            "touch_exploration_granted_accessibility_services";
5059
5060        /**
5061         * Whether to speak passwords while in accessibility mode.
5062         */
5063        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
5064
5065        /**
5066         * Whether to draw text with high contrast while in accessibility mode.
5067         *
5068         * @hide
5069         */
5070        public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
5071                "high_text_contrast_enabled";
5072
5073        /**
5074         * If injection of accessibility enhancing JavaScript screen-reader
5075         * is enabled.
5076         * <p>
5077         *   Note: The JavaScript based screen-reader is served by the
5078         *   Google infrastructure and enable users with disabilities to
5079         *   efficiently navigate in and explore web content.
5080         * </p>
5081         * <p>
5082         *   This property represents a boolean value.
5083         * </p>
5084         * @hide
5085         */
5086        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
5087            "accessibility_script_injection";
5088
5089        /**
5090         * The URL for the injected JavaScript based screen-reader used
5091         * for providing accessibility of content in WebView.
5092         * <p>
5093         *   Note: The JavaScript based screen-reader is served by the
5094         *   Google infrastructure and enable users with disabilities to
5095         *   efficiently navigate in and explore web content.
5096         * </p>
5097         * <p>
5098         *   This property represents a string value.
5099         * </p>
5100         * @hide
5101         */
5102        public static final String ACCESSIBILITY_SCREEN_READER_URL =
5103            "accessibility_script_injection_url";
5104
5105        /**
5106         * Key bindings for navigation in built-in accessibility support for web content.
5107         * <p>
5108         *   Note: These key bindings are for the built-in accessibility navigation for
5109         *   web content which is used as a fall back solution if JavaScript in a WebView
5110         *   is not enabled or the user has not opted-in script injection from Google.
5111         * </p>
5112         * <p>
5113         *   The bindings are separated by semi-colon. A binding is a mapping from
5114         *   a key to a sequence of actions (for more details look at
5115         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
5116         *   string representation of an integer obtained from a meta state (optional) shifted
5117         *   sixteen times left and bitwise ored with a key code. An action is represented
5118         *   as a hexademical string representation of an integer where the first two digits
5119         *   are navigation action index, the second, the third, and the fourth digit pairs
5120         *   represent the action arguments. The separate actions in a binding are colon
5121         *   separated. The key and the action sequence it maps to are separated by equals.
5122         * </p>
5123         * <p>
5124         *   For example, the binding below maps the DPAD right button to traverse the
5125         *   current navigation axis once without firing an accessibility event and to
5126         *   perform the same traversal again but to fire an event:
5127         *   <code>
5128         *     0x16=0x01000100:0x01000101;
5129         *   </code>
5130         * </p>
5131         * <p>
5132         *   The goal of this binding is to enable dynamic rebinding of keys to
5133         *   navigation actions for web content without requiring a framework change.
5134         * </p>
5135         * <p>
5136         *   This property represents a string value.
5137         * </p>
5138         * @hide
5139         */
5140        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
5141            "accessibility_web_content_key_bindings";
5142
5143        /**
5144         * Setting that specifies whether the display magnification is enabled.
5145         * Display magnifications allows the user to zoom in the display content
5146         * and is targeted to low vision users. The current magnification scale
5147         * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
5148         *
5149         * @hide
5150         */
5151        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
5152                "accessibility_display_magnification_enabled";
5153
5154        /**
5155         * Setting that specifies what the display magnification scale is.
5156         * Display magnifications allows the user to zoom in the display
5157         * content and is targeted to low vision users. Whether a display
5158         * magnification is performed is controlled by
5159         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
5160         *
5161         * @hide
5162         */
5163        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
5164                "accessibility_display_magnification_scale";
5165
5166        /**
5167         * Setting that specifies whether the display magnification should be
5168         * automatically updated. If this fearture is enabled the system will
5169         * exit magnification mode or pan the viewport when a context change
5170         * occurs. For example, on staring a new activity or rotating the screen,
5171         * the system may zoom out so the user can see the new context he is in.
5172         * Another example is on showing a window that is not visible in the
5173         * magnified viewport the system may pan the viewport to make the window
5174         * the has popped up so the user knows that the context has changed.
5175         * Whether a screen magnification is performed is controlled by
5176         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
5177         *
5178         * @hide
5179         */
5180        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
5181                "accessibility_display_magnification_auto_update";
5182
5183        /**
5184         * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be
5185         * modified from an AccessibilityService using the SoftKeyboardController.
5186         *
5187         * @hide
5188         */
5189        public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE =
5190                "accessibility_soft_keyboard_mode";
5191
5192        /**
5193         * Default soft keyboard behavior.
5194         *
5195         * @hide
5196         */
5197        public static final int SHOW_MODE_AUTO = 0;
5198
5199        /**
5200         * Soft keyboard is never shown.
5201         *
5202         * @hide
5203         */
5204        public static final int SHOW_MODE_HIDDEN = 1;
5205
5206        /**
5207         * Setting that specifies whether timed text (captions) should be
5208         * displayed in video content. Text display properties are controlled by
5209         * the following settings:
5210         * <ul>
5211         * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
5212         * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
5213         * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
5214         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
5215         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
5216         * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
5217         * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
5218         * </ul>
5219         *
5220         * @hide
5221         */
5222        public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
5223                "accessibility_captioning_enabled";
5224
5225        /**
5226         * Setting that specifies the language for captions as a locale string,
5227         * e.g. en_US.
5228         *
5229         * @see java.util.Locale#toString
5230         * @hide
5231         */
5232        public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
5233                "accessibility_captioning_locale";
5234
5235        /**
5236         * Integer property that specifies the preset style for captions, one
5237         * of:
5238         * <ul>
5239         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
5240         * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
5241         * </ul>
5242         *
5243         * @see java.util.Locale#toString
5244         * @hide
5245         */
5246        public static final String ACCESSIBILITY_CAPTIONING_PRESET =
5247                "accessibility_captioning_preset";
5248
5249        /**
5250         * Integer property that specifes the background color for captions as a
5251         * packed 32-bit color.
5252         *
5253         * @see android.graphics.Color#argb
5254         * @hide
5255         */
5256        public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
5257                "accessibility_captioning_background_color";
5258
5259        /**
5260         * Integer property that specifes the foreground color for captions as a
5261         * packed 32-bit color.
5262         *
5263         * @see android.graphics.Color#argb
5264         * @hide
5265         */
5266        public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
5267                "accessibility_captioning_foreground_color";
5268
5269        /**
5270         * Integer property that specifes the edge type for captions, one of:
5271         * <ul>
5272         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
5273         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
5274         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
5275         * </ul>
5276         *
5277         * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
5278         * @hide
5279         */
5280        public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
5281                "accessibility_captioning_edge_type";
5282
5283        /**
5284         * Integer property that specifes the edge color for captions as a
5285         * packed 32-bit color.
5286         *
5287         * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
5288         * @see android.graphics.Color#argb
5289         * @hide
5290         */
5291        public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
5292                "accessibility_captioning_edge_color";
5293
5294        /**
5295         * Integer property that specifes the window color for captions as a
5296         * packed 32-bit color.
5297         *
5298         * @see android.graphics.Color#argb
5299         * @hide
5300         */
5301        public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
5302                "accessibility_captioning_window_color";
5303
5304        /**
5305         * String property that specifies the typeface for captions, one of:
5306         * <ul>
5307         * <li>DEFAULT
5308         * <li>MONOSPACE
5309         * <li>SANS_SERIF
5310         * <li>SERIF
5311         * </ul>
5312         *
5313         * @see android.graphics.Typeface
5314         * @hide
5315         */
5316        public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
5317                "accessibility_captioning_typeface";
5318
5319        /**
5320         * Floating point property that specifies font scaling for captions.
5321         *
5322         * @hide
5323         */
5324        public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
5325                "accessibility_captioning_font_scale";
5326
5327        /**
5328         * Setting that specifies whether display color inversion is enabled.
5329         */
5330        public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
5331                "accessibility_display_inversion_enabled";
5332
5333        /**
5334         * Setting that specifies whether display color space adjustment is
5335         * enabled.
5336         *
5337         * @hide
5338         */
5339        public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
5340                "accessibility_display_daltonizer_enabled";
5341
5342        /**
5343         * Integer property that specifies the type of color space adjustment to
5344         * perform. Valid values are defined in AccessibilityManager.
5345         *
5346         * @hide
5347         */
5348        public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
5349                "accessibility_display_daltonizer";
5350
5351        /**
5352         * Setting that specifies whether automatic click when the mouse pointer stops moving is
5353         * enabled.
5354         *
5355         * @hide
5356         */
5357        public static final String ACCESSIBILITY_AUTOCLICK_ENABLED =
5358                "accessibility_autoclick_enabled";
5359
5360        /**
5361         * Integer setting specifying amount of time in ms the mouse pointer has to stay still
5362         * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set.
5363         *
5364         * @see #ACCESSIBILITY_AUTOCLICK_ENABLED
5365         * @hide
5366         */
5367        public static final String ACCESSIBILITY_AUTOCLICK_DELAY =
5368                "accessibility_autoclick_delay";
5369
5370        /**
5371         * Whether or not larger size icons are used for the pointer of mouse/trackpad for
5372         * accessibility.
5373         * (0 = false, 1 = true)
5374         * @hide
5375         */
5376        public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
5377                "accessibility_large_pointer_icon";
5378
5379        /**
5380         * The timeout for considering a press to be a long press in milliseconds.
5381         * @hide
5382         */
5383        public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
5384
5385        /**
5386         * The duration in milliseconds between the first tap's up event and the second tap's
5387         * down event for an interaction to be considered part of the same multi-press.
5388         * @hide
5389         */
5390        public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout";
5391
5392        /**
5393         * List of the enabled print services.
5394         *
5395         * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade
5396         * from pre-N.
5397         *
5398         * @hide
5399         */
5400        public static final String ENABLED_PRINT_SERVICES =
5401            "enabled_print_services";
5402
5403        /**
5404         * List of the disabled print services.
5405         *
5406         * @hide
5407         */
5408        public static final String DISABLED_PRINT_SERVICES =
5409            "disabled_print_services";
5410
5411        /**
5412         * The saved value for WindowManagerService.setForcedDisplayDensity()
5413         * formatted as a single integer representing DPI. If unset, then use
5414         * the real display density.
5415         *
5416         * @hide
5417         */
5418        public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
5419
5420        /**
5421         * Setting to always use the default text-to-speech settings regardless
5422         * of the application settings.
5423         * 1 = override application settings,
5424         * 0 = use application settings (if specified).
5425         *
5426         * @deprecated  The value of this setting is no longer respected by
5427         * the framework text to speech APIs as of the Ice Cream Sandwich release.
5428         */
5429        @Deprecated
5430        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
5431
5432        /**
5433         * Default text-to-speech engine speech rate. 100 = 1x
5434         */
5435        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
5436
5437        /**
5438         * Default text-to-speech engine pitch. 100 = 1x
5439         */
5440        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
5441
5442        /**
5443         * Default text-to-speech engine.
5444         */
5445        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
5446
5447        /**
5448         * Default text-to-speech language.
5449         *
5450         * @deprecated this setting is no longer in use, as of the Ice Cream
5451         * Sandwich release. Apps should never need to read this setting directly,
5452         * instead can query the TextToSpeech framework classes for the default
5453         * locale. {@link TextToSpeech#getLanguage()}.
5454         */
5455        @Deprecated
5456        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
5457
5458        /**
5459         * Default text-to-speech country.
5460         *
5461         * @deprecated this setting is no longer in use, as of the Ice Cream
5462         * Sandwich release. Apps should never need to read this setting directly,
5463         * instead can query the TextToSpeech framework classes for the default
5464         * locale. {@link TextToSpeech#getLanguage()}.
5465         */
5466        @Deprecated
5467        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
5468
5469        /**
5470         * Default text-to-speech locale variant.
5471         *
5472         * @deprecated this setting is no longer in use, as of the Ice Cream
5473         * Sandwich release. Apps should never need to read this setting directly,
5474         * instead can query the TextToSpeech framework classes for the
5475         * locale that is in use {@link TextToSpeech#getLanguage()}.
5476         */
5477        @Deprecated
5478        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
5479
5480        /**
5481         * Stores the default tts locales on a per engine basis. Stored as
5482         * a comma seperated list of values, each value being of the form
5483         * {@code engine_name:locale} for example,
5484         * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
5485         * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
5486         * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
5487         * setting directly, and can query the TextToSpeech framework classes
5488         * for the locale that is in use.
5489         *
5490         * @hide
5491         */
5492        public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
5493
5494        /**
5495         * Space delimited list of plugin packages that are enabled.
5496         */
5497        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
5498
5499        /**
5500         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
5501         * instead.
5502         */
5503        @Deprecated
5504        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
5505                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
5506
5507        /**
5508         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
5509         * instead.
5510         */
5511        @Deprecated
5512        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
5513                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
5514
5515        /**
5516         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
5517         * instead.
5518         */
5519        @Deprecated
5520        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
5521                Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
5522
5523        /**
5524         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
5525         * instead.
5526         */
5527        @Deprecated
5528        public static final String WIFI_ON = Global.WIFI_ON;
5529
5530        /**
5531         * The acceptable packet loss percentage (range 0 - 100) before trying
5532         * another AP on the same network.
5533         * @deprecated This setting is not used.
5534         */
5535        @Deprecated
5536        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
5537                "wifi_watchdog_acceptable_packet_loss_percentage";
5538
5539        /**
5540         * The number of access points required for a network in order for the
5541         * watchdog to monitor it.
5542         * @deprecated This setting is not used.
5543         */
5544        @Deprecated
5545        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
5546
5547        /**
5548         * The delay between background checks.
5549         * @deprecated This setting is not used.
5550         */
5551        @Deprecated
5552        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
5553                "wifi_watchdog_background_check_delay_ms";
5554
5555        /**
5556         * Whether the Wi-Fi watchdog is enabled for background checking even
5557         * after it thinks the user has connected to a good access point.
5558         * @deprecated This setting is not used.
5559         */
5560        @Deprecated
5561        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
5562                "wifi_watchdog_background_check_enabled";
5563
5564        /**
5565         * The timeout for a background ping
5566         * @deprecated This setting is not used.
5567         */
5568        @Deprecated
5569        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
5570                "wifi_watchdog_background_check_timeout_ms";
5571
5572        /**
5573         * The number of initial pings to perform that *may* be ignored if they
5574         * fail. Again, if these fail, they will *not* be used in packet loss
5575         * calculation. For example, one network always seemed to time out for
5576         * the first couple pings, so this is set to 3 by default.
5577         * @deprecated This setting is not used.
5578         */
5579        @Deprecated
5580        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
5581            "wifi_watchdog_initial_ignored_ping_count";
5582
5583        /**
5584         * The maximum number of access points (per network) to attempt to test.
5585         * If this number is reached, the watchdog will no longer monitor the
5586         * initial connection state for the network. This is a safeguard for
5587         * networks containing multiple APs whose DNS does not respond to pings.
5588         * @deprecated This setting is not used.
5589         */
5590        @Deprecated
5591        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
5592
5593        /**
5594         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
5595         */
5596        @Deprecated
5597        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
5598
5599        /**
5600         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
5601         * @deprecated This setting is not used.
5602         */
5603        @Deprecated
5604        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
5605
5606        /**
5607         * The number of pings to test if an access point is a good connection.
5608         * @deprecated This setting is not used.
5609         */
5610        @Deprecated
5611        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
5612
5613        /**
5614         * The delay between pings.
5615         * @deprecated This setting is not used.
5616         */
5617        @Deprecated
5618        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
5619
5620        /**
5621         * The timeout per ping.
5622         * @deprecated This setting is not used.
5623         */
5624        @Deprecated
5625        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
5626
5627        /**
5628         * @deprecated Use
5629         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
5630         */
5631        @Deprecated
5632        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
5633
5634        /**
5635         * @deprecated Use
5636         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
5637         */
5638        @Deprecated
5639        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
5640                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
5641
5642        /**
5643         * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
5644         * the receivers of the PendingIntent an opportunity to make a new network request before
5645         * the Network satisfying the request is potentially removed.
5646         *
5647         * @hide
5648         */
5649        public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
5650                "connectivity_release_pending_intent_delay_ms";
5651
5652        /**
5653         * Whether background data usage is allowed.
5654         *
5655         * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
5656         *             availability of background data depends on several
5657         *             combined factors. When background data is unavailable,
5658         *             {@link ConnectivityManager#getActiveNetworkInfo()} will
5659         *             now appear disconnected.
5660         */
5661        @Deprecated
5662        public static final String BACKGROUND_DATA = "background_data";
5663
5664        /**
5665         * Origins for which browsers should allow geolocation by default.
5666         * The value is a space-separated list of origins.
5667         */
5668        public static final String ALLOWED_GEOLOCATION_ORIGINS
5669                = "allowed_geolocation_origins";
5670
5671        /**
5672         * The preferred TTY mode     0 = TTy Off, CDMA default
5673         *                            1 = TTY Full
5674         *                            2 = TTY HCO
5675         *                            3 = TTY VCO
5676         * @hide
5677         */
5678        public static final String PREFERRED_TTY_MODE =
5679                "preferred_tty_mode";
5680
5681        /**
5682         * Whether the enhanced voice privacy mode is enabled.
5683         * 0 = normal voice privacy
5684         * 1 = enhanced voice privacy
5685         * @hide
5686         */
5687        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
5688
5689        /**
5690         * Whether the TTY mode mode is enabled.
5691         * 0 = disabled
5692         * 1 = enabled
5693         * @hide
5694         */
5695        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
5696
5697        /**
5698         * Controls whether settings backup is enabled.
5699         * Type: int ( 0 = disabled, 1 = enabled )
5700         * @hide
5701         */
5702        public static final String BACKUP_ENABLED = "backup_enabled";
5703
5704        /**
5705         * Controls whether application data is automatically restored from backup
5706         * at install time.
5707         * Type: int ( 0 = disabled, 1 = enabled )
5708         * @hide
5709         */
5710        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
5711
5712        /**
5713         * Indicates whether settings backup has been fully provisioned.
5714         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
5715         * @hide
5716         */
5717        public static final String BACKUP_PROVISIONED = "backup_provisioned";
5718
5719        /**
5720         * Component of the transport to use for backup/restore.
5721         * @hide
5722         */
5723        public static final String BACKUP_TRANSPORT = "backup_transport";
5724
5725        /**
5726         * Version for which the setup wizard was last shown.  Bumped for
5727         * each release when there is new setup information to show.
5728         * @hide
5729         */
5730        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
5731
5732        /**
5733         * The interval in milliseconds after which Wi-Fi is considered idle.
5734         * When idle, it is possible for the device to be switched from Wi-Fi to
5735         * the mobile data network.
5736         * @hide
5737         * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
5738         * instead.
5739         */
5740        @Deprecated
5741        public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
5742
5743        /**
5744         * The global search provider chosen by the user (if multiple global
5745         * search providers are installed). This will be the provider returned
5746         * by {@link SearchManager#getGlobalSearchActivity()} if it's still
5747         * installed. This setting is stored as a flattened component name as
5748         * per {@link ComponentName#flattenToString()}.
5749         *
5750         * @hide
5751         */
5752        public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
5753                "search_global_search_activity";
5754
5755        /**
5756         * The number of promoted sources in GlobalSearch.
5757         * @hide
5758         */
5759        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
5760        /**
5761         * The maximum number of suggestions returned by GlobalSearch.
5762         * @hide
5763         */
5764        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
5765        /**
5766         * The number of suggestions GlobalSearch will ask each non-web search source for.
5767         * @hide
5768         */
5769        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
5770        /**
5771         * The number of suggestions the GlobalSearch will ask the web search source for.
5772         * @hide
5773         */
5774        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
5775                "search_web_results_override_limit";
5776        /**
5777         * The number of milliseconds that GlobalSearch will wait for suggestions from
5778         * promoted sources before continuing with all other sources.
5779         * @hide
5780         */
5781        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
5782                "search_promoted_source_deadline_millis";
5783        /**
5784         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
5785         * @hide
5786         */
5787        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
5788        /**
5789         * The maximum number of milliseconds that GlobalSearch shows the previous results
5790         * after receiving a new query.
5791         * @hide
5792         */
5793        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
5794        /**
5795         * The maximum age of log data used for shortcuts in GlobalSearch.
5796         * @hide
5797         */
5798        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
5799        /**
5800         * The maximum age of log data used for source ranking in GlobalSearch.
5801         * @hide
5802         */
5803        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
5804                "search_max_source_event_age_millis";
5805        /**
5806         * The minimum number of impressions needed to rank a source in GlobalSearch.
5807         * @hide
5808         */
5809        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
5810                "search_min_impressions_for_source_ranking";
5811        /**
5812         * The minimum number of clicks needed to rank a source in GlobalSearch.
5813         * @hide
5814         */
5815        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
5816                "search_min_clicks_for_source_ranking";
5817        /**
5818         * The maximum number of shortcuts shown by GlobalSearch.
5819         * @hide
5820         */
5821        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
5822        /**
5823         * The size of the core thread pool for suggestion queries in GlobalSearch.
5824         * @hide
5825         */
5826        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
5827                "search_query_thread_core_pool_size";
5828        /**
5829         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
5830         * @hide
5831         */
5832        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
5833                "search_query_thread_max_pool_size";
5834        /**
5835         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
5836         * @hide
5837         */
5838        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
5839                "search_shortcut_refresh_core_pool_size";
5840        /**
5841         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
5842         * @hide
5843         */
5844        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
5845                "search_shortcut_refresh_max_pool_size";
5846        /**
5847         * The maximun time that excess threads in the GlobalSeach thread pools will
5848         * wait before terminating.
5849         * @hide
5850         */
5851        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
5852                "search_thread_keepalive_seconds";
5853        /**
5854         * The maximum number of concurrent suggestion queries to each source.
5855         * @hide
5856         */
5857        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
5858                "search_per_source_concurrent_query_limit";
5859
5860        /**
5861         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
5862         * @hide
5863         */
5864        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
5865
5866        /**
5867         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
5868         * @hide
5869         */
5870        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
5871
5872        /**
5873         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
5874         * @hide
5875         */
5876        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
5877
5878        /**
5879         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
5880         * @hide
5881         */
5882        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
5883
5884        /**
5885         * If nonzero, ANRs in invisible background processes bring up a dialog.
5886         * Otherwise, the process will be silently killed.
5887         *
5888         * Also prevents ANRs and crash dialogs from being suppressed.
5889         * @hide
5890         */
5891        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
5892
5893        /**
5894         * The {@link ComponentName} string of the service to be used as the voice recognition
5895         * service.
5896         *
5897         * @hide
5898         */
5899        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
5900
5901        /**
5902         * Stores whether an user has consented to have apps verified through PAM.
5903         * The value is boolean (1 or 0).
5904         *
5905         * @hide
5906         */
5907        public static final String PACKAGE_VERIFIER_USER_CONSENT =
5908            "package_verifier_user_consent";
5909
5910        /**
5911         * The {@link ComponentName} string of the selected spell checker service which is
5912         * one of the services managed by the text service manager.
5913         *
5914         * @hide
5915         */
5916        public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
5917
5918        /**
5919         * The {@link ComponentName} string of the selected subtype of the selected spell checker
5920         * service which is one of the services managed by the text service manager.
5921         *
5922         * @hide
5923         */
5924        public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
5925                "selected_spell_checker_subtype";
5926
5927        /**
5928         * The {@link ComponentName} string whether spell checker is enabled or not.
5929         *
5930         * @hide
5931         */
5932        public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
5933
5934        /**
5935         * What happens when the user presses the Power button while in-call
5936         * and the screen is on.<br/>
5937         * <b>Values:</b><br/>
5938         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
5939         * 2 - The Power button hangs up the current call.<br/>
5940         *
5941         * @hide
5942         */
5943        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
5944
5945        /**
5946         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
5947         * @hide
5948         */
5949        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
5950
5951        /**
5952         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
5953         * @hide
5954         */
5955        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
5956
5957        /**
5958         * INCALL_POWER_BUTTON_BEHAVIOR default value.
5959         * @hide
5960         */
5961        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
5962                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
5963
5964        /**
5965         * What happens when the user presses the Back button while in-call
5966         * and the screen is on.<br/>
5967         * <b>Values:</b><br/>
5968         * 0 - The Back buttons does nothing different.<br/>
5969         * 1 - The Back button hangs up the current call.<br/>
5970         *
5971         * @hide
5972         */
5973        public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior";
5974
5975        /**
5976         * INCALL_BACK_BUTTON_BEHAVIOR value for no action.
5977         * @hide
5978         */
5979        public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0;
5980
5981        /**
5982         * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up".
5983         * @hide
5984         */
5985        public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1;
5986
5987        /**
5988         * INCALL_POWER_BUTTON_BEHAVIOR default value.
5989         * @hide
5990         */
5991        public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT =
5992                INCALL_BACK_BUTTON_BEHAVIOR_NONE;
5993
5994        /**
5995         * Whether the device should wake when the wake gesture sensor detects motion.
5996         * @hide
5997         */
5998        public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
5999
6000        /**
6001         * Whether the device should doze if configured.
6002         * @hide
6003         */
6004        public static final String DOZE_ENABLED = "doze_enabled";
6005
6006        /**
6007         * Whether the device should pulse on pick up gesture.
6008         * @hide
6009         */
6010        public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
6011
6012        /**
6013         * Whether the device should pulse on double tap gesture.
6014         * @hide
6015         */
6016        public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap";
6017
6018        /**
6019         * The current night mode that has been selected by the user.  Owned
6020         * and controlled by UiModeManagerService.  Constants are as per
6021         * UiModeManager.
6022         * @hide
6023         */
6024        public static final String UI_NIGHT_MODE = "ui_night_mode";
6025
6026        /**
6027         * Whether screensavers are enabled.
6028         * @hide
6029         */
6030        public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
6031
6032        /**
6033         * The user's chosen screensaver components.
6034         *
6035         * These will be launched by the PhoneWindowManager after a timeout when not on
6036         * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
6037         * @hide
6038         */
6039        public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
6040
6041        /**
6042         * If screensavers are enabled, whether the screensaver should be automatically launched
6043         * when the device is inserted into a (desk) dock.
6044         * @hide
6045         */
6046        public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
6047
6048        /**
6049         * If screensavers are enabled, whether the screensaver should be automatically launched
6050         * when the screen times out when not on battery.
6051         * @hide
6052         */
6053        public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
6054
6055        /**
6056         * If screensavers are enabled, the default screensaver component.
6057         * @hide
6058         */
6059        public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
6060
6061        /**
6062         * The default NFC payment component
6063         * @hide
6064         */
6065        public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
6066
6067        /**
6068         * Whether NFC payment is handled by the foreground application or a default.
6069         * @hide
6070         */
6071        public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
6072
6073        /**
6074         * Specifies the package name currently configured to be the primary sms application
6075         * @hide
6076         */
6077        public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
6078
6079        /**
6080         * Specifies the package name currently configured to be the default dialer application
6081         * @hide
6082         */
6083        public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application";
6084
6085        /**
6086         * Specifies the package name currently configured to be the emergency assistance application
6087         *
6088         * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
6089         *
6090         * @hide
6091         */
6092        public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
6093
6094        /**
6095         * Specifies whether the current app context on scren (assist data) will be sent to the
6096         * assist application (active voice interaction service).
6097         *
6098         * @hide
6099         */
6100        public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
6101
6102        /**
6103         * Specifies whether a screenshot of the screen contents will be sent to the assist
6104         * application (active voice interaction service).
6105         *
6106         * @hide
6107         */
6108        public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled";
6109
6110        /**
6111         * Specifies whether the screen will show an animation if screen contents are sent to the
6112         * assist application (active voice interaction service).
6113         *
6114         * Note that the disclosure will be forced for third-party assistants or if the device
6115         * does not support disabling it.
6116         *
6117         * @hide
6118         */
6119        public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled";
6120
6121        /**
6122         * Names of the service components that the current user has explicitly allowed to
6123         * see all of the user's notifications, separated by ':'.
6124         *
6125         * @hide
6126         */
6127        public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
6128
6129        /**
6130         * Names of the packages that the current user has explicitly allowed to
6131         * manage notification policy configuration, separated by ':'.
6132         *
6133         * @hide
6134         */
6135        @TestApi
6136        public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES =
6137                "enabled_notification_policy_access_packages";
6138
6139        /** @hide */
6140        public static final String BAR_SERVICE_COMPONENT = "bar_service_component";
6141
6142        /** @hide */
6143        public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT
6144                = "volume_controller_service_component";
6145
6146        /** @hide */
6147        public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
6148
6149        /**
6150         * This is the query URI for finding a print service to install.
6151         *
6152         * @hide
6153         */
6154        public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
6155
6156        /**
6157         * This is the query URI for finding a NFC payment service to install.
6158         *
6159         * @hide
6160         */
6161        public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
6162
6163        /**
6164         * If enabled, apps should try to skip any introductory hints on first launch. This might
6165         * apply to users that are already familiar with the environment or temporary users.
6166         * <p>
6167         * Type : int (0 to show hints, 1 to skip showing hints)
6168         */
6169        public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
6170
6171        /**
6172         * Persisted playback time after a user confirmation of an unsafe volume level.
6173         *
6174         * @hide
6175         */
6176        public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
6177
6178        /**
6179         * This preference enables notification display on the lockscreen.
6180         * @hide
6181         */
6182        public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
6183                "lock_screen_show_notifications";
6184
6185        /**
6186         * This preference stores the last stack active task time for each user, which affects what
6187         * tasks will be visible in Overview.
6188         * @hide
6189         */
6190        public static final String OVERVIEW_LAST_STACK_ACTIVE_TIME =
6191                "overview_last_stack_active_time";
6192
6193        /**
6194         * List of TV inputs that are currently hidden. This is a string
6195         * containing the IDs of all hidden TV inputs. Each ID is encoded by
6196         * {@link android.net.Uri#encode(String)} and separated by ':'.
6197         * @hide
6198         */
6199        public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
6200
6201        /**
6202         * List of custom TV input labels. This is a string containing <TV input id, custom name>
6203         * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
6204         * and separated by ','. Each pair is separated by ':'.
6205         * @hide
6206         */
6207        public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
6208
6209        /**
6210         * Whether automatic routing of system audio to USB audio peripheral is disabled.
6211         * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
6212         * and 0 means automatic routing is enabled.
6213         *
6214         * @hide
6215         */
6216        public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
6217                "usb_audio_automatic_routing_disabled";
6218
6219        /**
6220         * The timeout in milliseconds before the device fully goes to sleep after
6221         * a period of inactivity.  This value sets an upper bound on how long the device
6222         * will stay awake or dreaming without user activity.  It should generally
6223         * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
6224         * will sleep before it ever has a chance to dream.
6225         * <p>
6226         * Use -1 to disable this timeout.
6227         * </p>
6228         *
6229         * @hide
6230         */
6231        public static final String SLEEP_TIMEOUT = "sleep_timeout";
6232
6233        /**
6234         * Controls whether double tap to wake is enabled.
6235         * @hide
6236         */
6237        public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
6238
6239        /**
6240         * The current assistant component. It could be a voice interaction service,
6241         * or an activity that handles ACTION_ASSIST, or empty which means using the default
6242         * handling.
6243         *
6244         * @hide
6245         */
6246        public static final String ASSISTANT = "assistant";
6247
6248        /**
6249         * Whether the camera launch gesture should be disabled.
6250         *
6251         * @hide
6252         */
6253        public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled";
6254
6255        /**
6256         * Whether the camera launch gesture to double tap the power button when the screen is off
6257         * should be disabled.
6258         *
6259         * @hide
6260         */
6261        public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED =
6262                "camera_double_tap_power_gesture_disabled";
6263
6264        /**
6265         * Whether the camera double twist gesture to flip between front and back mode should be
6266         * enabled.
6267         *
6268         * @hide
6269         */
6270        public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED =
6271                "camera_double_twist_to_flip_enabled";
6272
6273        /**
6274         * Control whether Night display is currently activated.
6275         * @hide
6276         */
6277        public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated";
6278
6279        /**
6280         * Control whether Night display will automatically activate/deactivate.
6281         * @hide
6282         */
6283        public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode";
6284
6285        /**
6286         * Custom time when Night display is scheduled to activate.
6287         * Represented as milliseconds from midnight (e.g. 79200000 == 10pm).
6288         * @hide
6289         */
6290        public static final String NIGHT_DISPLAY_CUSTOM_START_TIME = "night_display_custom_start_time";
6291
6292        /**
6293         * Custom time when Night display is scheduled to deactivate.
6294         * Represented as milliseconds from midnight (e.g. 21600000 == 6am).
6295         * @hide
6296         */
6297        public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time";
6298
6299        /**
6300         * Names of the service components that the current user has explicitly allowed to
6301         * be a VR mode listener, separated by ':'.
6302         *
6303         * @hide
6304         */
6305        public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
6306
6307        /**
6308         * Behavior of the display while in VR mode.
6309         *
6310         * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}.
6311         *
6312         * @hide
6313         */
6314        public static final String VR_DISPLAY_MODE = "vr_display_mode";
6315
6316        /**
6317         * Lower the display persistence while the system is in VR mode.
6318         *
6319         * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
6320         *
6321         * @hide.
6322         */
6323        public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0;
6324
6325        /**
6326         * Do not alter the display persistence while the system is in VR mode.
6327         *
6328         * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
6329         *
6330         * @hide.
6331         */
6332        public static final int VR_DISPLAY_MODE_OFF = 1;
6333
6334        /**
6335         * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least
6336         * once.
6337         *
6338         * <p>This is used to ensure that we only take one pass which will disable apps that are not
6339         * privileged (if any). From then on, we only want to enable apps (when a matching SIM is
6340         * inserted), to avoid disabling an app that the user might actively be using.
6341         *
6342         * <p>Will be set to 1 once executed.
6343         *
6344         * @hide
6345         */
6346        public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
6347
6348        /**
6349         * Whether parent user can access remote contact in managed profile.
6350         *
6351         * @hide
6352         */
6353        public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH =
6354                "managed_profile_contact_remote_search";
6355
6356        /**
6357         * Whether or not the automatic storage manager is enabled and should run on the device.
6358         *
6359         * @hide
6360         */
6361        public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED =
6362                "automatic_storage_manager_enabled";
6363
6364        /**
6365         * How many days of information for the automatic storage manager to retain on the device.
6366         *
6367         * @hide
6368         */
6369        public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN =
6370                "automatic_storage_manager_days_to_retain";
6371
6372        /**
6373         * Default number of days of information for the automatic storage manager to retain.
6374         *
6375         * @hide
6376         */
6377        public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90;
6378
6379        /**
6380         * How many bytes the automatic storage manager has cleared out.
6381         *
6382         * @hide
6383         */
6384        public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED =
6385                "automatic_storage_manager_bytes_cleared";
6386
6387
6388        /**
6389         * Last run time for the automatic storage manager.
6390         *
6391         * @hide
6392         */
6393        public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN =
6394                "automatic_storage_manager_last_run";
6395
6396
6397        /**
6398         * Whether SystemUI navigation keys is enabled.
6399         * @hide
6400         */
6401        public static final String SYSTEM_NAVIGATION_KEYS_ENABLED =
6402                "system_navigation_keys_enabled";
6403
6404        /**
6405         * Holds comma separated list of ordering of QS tiles.
6406         * @hide
6407         */
6408        public static final String QS_TILES = "sysui_qs_tiles";
6409
6410        /**
6411         * Whether preloaded APKs have been installed for the user.
6412         * @hide
6413         */
6414        public static final String DEMO_USER_SETUP_COMPLETE
6415                = "demo_user_setup_complete";
6416
6417        /**
6418         * Specifies whether the web action API is enabled.
6419         *
6420         * @hide
6421         */
6422        public static final String WEB_ACTION_ENABLED = "web_action_enabled";
6423
6424        /**
6425         * Has this pairable device been paired or upgraded from a previously paired system.
6426         * @hide
6427         */
6428        public static final String DEVICE_PAIRED = "device_paired";
6429
6430        /**
6431         * This are the settings to be backed up.
6432         *
6433         * NOTE: Settings are backed up and restored in the order they appear
6434         *       in this array. If you have one setting depending on another,
6435         *       make sure that they are ordered appropriately.
6436         *
6437         * @hide
6438         */
6439        public static final String[] SETTINGS_TO_BACKUP = {
6440            BUGREPORT_IN_POWER_MENU,                            // moved to global
6441            ALLOW_MOCK_LOCATION,
6442            PARENTAL_CONTROL_ENABLED,
6443            PARENTAL_CONTROL_REDIRECT_URL,
6444            USB_MASS_STORAGE_ENABLED,                           // moved to global
6445            ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
6446            ACCESSIBILITY_DISPLAY_DALTONIZER,
6447            ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
6448            ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
6449            ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
6450            ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
6451            ACCESSIBILITY_SCRIPT_INJECTION,
6452            ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS,
6453            ENABLED_ACCESSIBILITY_SERVICES,
6454            ENABLED_NOTIFICATION_LISTENERS,
6455            ENABLED_VR_LISTENERS,
6456            ENABLED_INPUT_METHODS,
6457            TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
6458            TOUCH_EXPLORATION_ENABLED,
6459            ACCESSIBILITY_ENABLED,
6460            ACCESSIBILITY_SPEAK_PASSWORD,
6461            ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
6462            ACCESSIBILITY_CAPTIONING_PRESET,
6463            ACCESSIBILITY_CAPTIONING_ENABLED,
6464            ACCESSIBILITY_CAPTIONING_LOCALE,
6465            ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
6466            ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
6467            ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
6468            ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
6469            ACCESSIBILITY_CAPTIONING_TYPEFACE,
6470            ACCESSIBILITY_CAPTIONING_FONT_SCALE,
6471            ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
6472            TTS_USE_DEFAULTS,
6473            TTS_DEFAULT_RATE,
6474            TTS_DEFAULT_PITCH,
6475            TTS_DEFAULT_SYNTH,
6476            TTS_DEFAULT_LANG,
6477            TTS_DEFAULT_COUNTRY,
6478            TTS_ENABLED_PLUGINS,
6479            TTS_DEFAULT_LOCALE,
6480            SHOW_IME_WITH_HARD_KEYBOARD,
6481            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
6482            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
6483            WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
6484            SELECTED_SPELL_CHECKER,
6485            SELECTED_SPELL_CHECKER_SUBTYPE,
6486            SPELL_CHECKER_ENABLED,
6487            MOUNT_PLAY_NOTIFICATION_SND,
6488            MOUNT_UMS_AUTOSTART,
6489            MOUNT_UMS_PROMPT,
6490            MOUNT_UMS_NOTIFY_ENABLED,
6491            SLEEP_TIMEOUT,
6492            DOUBLE_TAP_TO_WAKE,
6493            WAKE_GESTURE_ENABLED,
6494            LONG_PRESS_TIMEOUT,
6495            CAMERA_GESTURE_DISABLED,
6496            ACCESSIBILITY_AUTOCLICK_ENABLED,
6497            ACCESSIBILITY_AUTOCLICK_DELAY,
6498            ACCESSIBILITY_LARGE_POINTER_ICON,
6499            PREFERRED_TTY_MODE,
6500            ENHANCED_VOICE_PRIVACY_ENABLED,
6501            TTY_MODE_ENABLED,
6502            INCALL_POWER_BUTTON_BEHAVIOR,
6503            NIGHT_DISPLAY_CUSTOM_START_TIME,
6504            NIGHT_DISPLAY_CUSTOM_END_TIME,
6505            NIGHT_DISPLAY_AUTO_MODE,
6506            NIGHT_DISPLAY_ACTIVATED,
6507            CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
6508            CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
6509            SYSTEM_NAVIGATION_KEYS_ENABLED,
6510            QS_TILES,
6511            DOZE_ENABLED,
6512            DOZE_PULSE_ON_PICK_UP,
6513            DOZE_PULSE_ON_DOUBLE_TAP,
6514            NFC_PAYMENT_DEFAULT_COMPONENT
6515        };
6516
6517        /**
6518         * These entries are considered common between the personal and the managed profile,
6519         * since the managed profile doesn't get to change them.
6520         */
6521        private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
6522
6523        static {
6524            CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
6525            CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
6526            CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
6527            CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
6528            CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
6529            CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
6530            CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
6531            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE);
6532            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
6533            CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
6534            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
6535            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
6536        }
6537
6538        /** @hide */
6539        public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
6540            outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
6541        }
6542
6543        /**
6544         * Helper method for determining if a location provider is enabled.
6545         *
6546         * @param cr the content resolver to use
6547         * @param provider the location provider to query
6548         * @return true if the provider is enabled
6549         *
6550         * @deprecated use {@link #LOCATION_MODE} or
6551         *             {@link LocationManager#isProviderEnabled(String)}
6552         */
6553        @Deprecated
6554        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
6555            return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
6556        }
6557
6558        /**
6559         * Helper method for determining if a location provider is enabled.
6560         * @param cr the content resolver to use
6561         * @param provider the location provider to query
6562         * @param userId the userId to query
6563         * @return true if the provider is enabled
6564         * @deprecated use {@link #LOCATION_MODE} or
6565         *             {@link LocationManager#isProviderEnabled(String)}
6566         * @hide
6567         */
6568        @Deprecated
6569        public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
6570            String allowedProviders = Settings.Secure.getStringForUser(cr,
6571                    LOCATION_PROVIDERS_ALLOWED, userId);
6572            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
6573        }
6574
6575        /**
6576         * Thread-safe method for enabling or disabling a single location provider.
6577         * @param cr the content resolver to use
6578         * @param provider the location provider to enable or disable
6579         * @param enabled true if the provider should be enabled
6580         * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
6581         */
6582        @Deprecated
6583        public static final void setLocationProviderEnabled(ContentResolver cr,
6584                String provider, boolean enabled) {
6585            setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
6586        }
6587
6588        /**
6589         * Thread-safe method for enabling or disabling a single location provider.
6590         *
6591         * @param cr the content resolver to use
6592         * @param provider the location provider to enable or disable
6593         * @param enabled true if the provider should be enabled
6594         * @param userId the userId for which to enable/disable providers
6595         * @return true if the value was set, false on database errors
6596         * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
6597         *             {@link #LOCATION_MODE}
6598         * @hide
6599         */
6600        @Deprecated
6601        public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
6602                String provider, boolean enabled, int userId) {
6603            synchronized (mLocationSettingsLock) {
6604                // to ensure thread safety, we write the provider name with a '+' or '-'
6605                // and let the SettingsProvider handle it rather than reading and modifying
6606                // the list of enabled providers.
6607                if (enabled) {
6608                    provider = "+" + provider;
6609                } else {
6610                    provider = "-" + provider;
6611                }
6612                return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
6613                        userId);
6614            }
6615        }
6616
6617        /**
6618         * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
6619         */
6620        private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
6621            final int mode = getLocationModeForUser(cr, userId);
6622            return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
6623        }
6624
6625        /**
6626         * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
6627         */
6628        private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
6629            int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
6630                    LOCATION_MODE_HIGH_ACCURACY, userId);
6631            // Make sure that the previous mode is never "off". Otherwise the user won't be able to
6632            // turn on location any longer.
6633            if (mode == LOCATION_MODE_OFF) {
6634                mode = LOCATION_MODE_HIGH_ACCURACY;
6635            }
6636            return setLocationModeForUser(cr, mode, userId);
6637        }
6638
6639        /**
6640         * Thread-safe method for setting the location mode to one of
6641         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
6642         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
6643         *
6644         * @param cr the content resolver to use
6645         * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
6646         * @param userId the userId for which to change mode
6647         * @return true if the value was set, false on database errors
6648         *
6649         * @throws IllegalArgumentException if mode is not one of the supported values
6650         */
6651        private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
6652                int userId) {
6653            synchronized (mLocationSettingsLock) {
6654                boolean gps = false;
6655                boolean network = false;
6656                switch (mode) {
6657                    case LOCATION_MODE_PREVIOUS:
6658                        // Retrieve the actual mode and set to that mode.
6659                        return restoreLocationModeForUser(cr, userId);
6660                    case LOCATION_MODE_OFF:
6661                        saveLocationModeForUser(cr, userId);
6662                        break;
6663                    case LOCATION_MODE_SENSORS_ONLY:
6664                        gps = true;
6665                        break;
6666                    case LOCATION_MODE_BATTERY_SAVING:
6667                        network = true;
6668                        break;
6669                    case LOCATION_MODE_HIGH_ACCURACY:
6670                        gps = true;
6671                        network = true;
6672                        break;
6673                    default:
6674                        throw new IllegalArgumentException("Invalid location mode: " + mode);
6675                }
6676                // Note it's important that we set the NLP mode first. The Google implementation
6677                // of NLP clears its NLP consent setting any time it receives a
6678                // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
6679                // it shows an NLP consent dialog any time it receives the broadcast, NLP is
6680                // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
6681                // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
6682                // and 3) the receiver happened to complete before we enabled NLP, then the Google
6683                // NLP would detect the attempt to enable NLP and show a redundant NLP consent
6684                // dialog. Then the people who wrote the setup wizard would be sad.
6685                boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
6686                        cr, LocationManager.NETWORK_PROVIDER, network, userId);
6687                boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
6688                        cr, LocationManager.GPS_PROVIDER, gps, userId);
6689                return gpsSuccess && nlpSuccess;
6690            }
6691        }
6692
6693        /**
6694         * Thread-safe method for reading the location mode, returns one of
6695         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
6696         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
6697         *
6698         * @param cr the content resolver to use
6699         * @param userId the userId for which to read the mode
6700         * @return the location mode
6701         */
6702        private static final int getLocationModeForUser(ContentResolver cr, int userId) {
6703            synchronized (mLocationSettingsLock) {
6704                boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
6705                        cr, LocationManager.GPS_PROVIDER, userId);
6706                boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
6707                        cr, LocationManager.NETWORK_PROVIDER, userId);
6708                if (gpsEnabled && networkEnabled) {
6709                    return LOCATION_MODE_HIGH_ACCURACY;
6710                } else if (gpsEnabled) {
6711                    return LOCATION_MODE_SENSORS_ONLY;
6712                } else if (networkEnabled) {
6713                    return LOCATION_MODE_BATTERY_SAVING;
6714                } else {
6715                    return LOCATION_MODE_OFF;
6716                }
6717            }
6718        }
6719    }
6720
6721    /**
6722     * Global system settings, containing preferences that always apply identically
6723     * to all defined users.  Applications can read these but are not allowed to write;
6724     * like the "Secure" settings, these are for preferences that the user must
6725     * explicitly modify through the system UI or specialized APIs for those values.
6726     */
6727    public static final class Global extends NameValueTable {
6728        /**
6729         * The content:// style URL for global secure settings items.  Not public.
6730         */
6731        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
6732
6733        /**
6734         * Whether users are allowed to add more users or guest from lockscreen.
6735         * <p>
6736         * Type: int
6737         * @hide
6738         */
6739        public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
6740
6741        /**
6742         * Setting whether the global gesture for enabling accessibility is enabled.
6743         * If this gesture is enabled the user will be able to perfrom it to enable
6744         * the accessibility state without visiting the settings app.
6745         * @hide
6746         */
6747        public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
6748                "enable_accessibility_global_gesture_enabled";
6749
6750        /**
6751         * Whether Airplane Mode is on.
6752         */
6753        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
6754
6755        /**
6756         * Whether Theater Mode is on.
6757         * {@hide}
6758         */
6759        @SystemApi
6760        public static final String THEATER_MODE_ON = "theater_mode_on";
6761
6762        /**
6763         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
6764         */
6765        public static final String RADIO_BLUETOOTH = "bluetooth";
6766
6767        /**
6768         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
6769         */
6770        public static final String RADIO_WIFI = "wifi";
6771
6772        /**
6773         * {@hide}
6774         */
6775        public static final String RADIO_WIMAX = "wimax";
6776        /**
6777         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
6778         */
6779        public static final String RADIO_CELL = "cell";
6780
6781        /**
6782         * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
6783         */
6784        public static final String RADIO_NFC = "nfc";
6785
6786        /**
6787         * A comma separated list of radios that need to be disabled when airplane mode
6788         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
6789         * included in the comma separated list.
6790         */
6791        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
6792
6793        /**
6794         * A comma separated list of radios that should to be disabled when airplane mode
6795         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
6796         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
6797         * will be turned off when entering airplane mode, but the user will be able to reenable
6798         * Wifi in the Settings app.
6799         *
6800         * {@hide}
6801         */
6802        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
6803
6804        /**
6805         * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
6806         * See {@link android.bluetooth.BluetoothProfile}.
6807         * {@hide}
6808         */
6809        public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
6810
6811        /**
6812         * A semi-colon separated list of Bluetooth interoperability workarounds.
6813         * Each entry is a partial Bluetooth device address string and an integer representing
6814         * the feature to be disabled, separated by a comma. The integer must correspond
6815         * to a interoperability feature as defined in "interop.h" in /system/bt.
6816         * <p>
6817         * Example: <br/>
6818         *   "00:11:22,0;01:02:03:04,2"
6819         * @hide
6820         */
6821       public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list";
6822
6823        /**
6824         * The policy for deciding when Wi-Fi should go to sleep (which will in
6825         * turn switch to using the mobile data as an Internet connection).
6826         * <p>
6827         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
6828         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
6829         * {@link #WIFI_SLEEP_POLICY_NEVER}.
6830         */
6831        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
6832
6833        /**
6834         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
6835         * policy, which is to sleep shortly after the turning off
6836         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
6837         */
6838        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
6839
6840        /**
6841         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
6842         * the device is on battery, and never go to sleep when the device is
6843         * plugged in.
6844         */
6845        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
6846
6847        /**
6848         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
6849         */
6850        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
6851
6852        /**
6853         * Value to specify if the user prefers the date, time and time zone
6854         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
6855         */
6856        public static final String AUTO_TIME = "auto_time";
6857
6858        /**
6859         * Value to specify if the user prefers the time zone
6860         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
6861         */
6862        public static final String AUTO_TIME_ZONE = "auto_time_zone";
6863
6864        /**
6865         * URI for the car dock "in" event sound.
6866         * @hide
6867         */
6868        public static final String CAR_DOCK_SOUND = "car_dock_sound";
6869
6870        /**
6871         * URI for the car dock "out" event sound.
6872         * @hide
6873         */
6874        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
6875
6876        /**
6877         * URI for the desk dock "in" event sound.
6878         * @hide
6879         */
6880        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
6881
6882        /**
6883         * URI for the desk dock "out" event sound.
6884         * @hide
6885         */
6886        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
6887
6888        /**
6889         * Whether to play a sound for dock events.
6890         * @hide
6891         */
6892        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
6893
6894        /**
6895         * Whether to play a sound for dock events, only when an accessibility service is on.
6896         * @hide
6897         */
6898        public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility";
6899
6900        /**
6901         * URI for the "device locked" (keyguard shown) sound.
6902         * @hide
6903         */
6904        public static final String LOCK_SOUND = "lock_sound";
6905
6906        /**
6907         * URI for the "device unlocked" sound.
6908         * @hide
6909         */
6910        public static final String UNLOCK_SOUND = "unlock_sound";
6911
6912        /**
6913         * URI for the "device is trusted" sound, which is played when the device enters the trusted
6914         * state without unlocking.
6915         * @hide
6916         */
6917        public static final String TRUSTED_SOUND = "trusted_sound";
6918
6919        /**
6920         * URI for the low battery sound file.
6921         * @hide
6922         */
6923        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
6924
6925        /**
6926         * Whether to play a sound for low-battery alerts.
6927         * @hide
6928         */
6929        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
6930
6931        /**
6932         * URI for the "wireless charging started" sound.
6933         * @hide
6934         */
6935        public static final String WIRELESS_CHARGING_STARTED_SOUND =
6936                "wireless_charging_started_sound";
6937
6938        /**
6939         * Whether to play a sound for charging events.
6940         * @hide
6941         */
6942        public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
6943
6944        /**
6945         * Whether we keep the device on while the device is plugged in.
6946         * Supported values are:
6947         * <ul>
6948         * <li>{@code 0} to never stay on while plugged in</li>
6949         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
6950         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
6951         * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
6952         * </ul>
6953         * These values can be OR-ed together.
6954         */
6955        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
6956
6957        /**
6958         * When the user has enable the option to have a "bug report" command
6959         * in the power menu.
6960         * @hide
6961         */
6962        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
6963
6964        /**
6965         * Whether ADB is enabled.
6966         */
6967        public static final String ADB_ENABLED = "adb_enabled";
6968
6969        /**
6970         * Whether Views are allowed to save their attribute data.
6971         * @hide
6972         */
6973        public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
6974
6975        /**
6976         * Whether assisted GPS should be enabled or not.
6977         * @hide
6978         */
6979        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
6980
6981        /**
6982         * Whether bluetooth is enabled/disabled
6983         * 0=disabled. 1=enabled.
6984         */
6985        public static final String BLUETOOTH_ON = "bluetooth_on";
6986
6987        /**
6988         * CDMA Cell Broadcast SMS
6989         *                            0 = CDMA Cell Broadcast SMS disabled
6990         *                            1 = CDMA Cell Broadcast SMS enabled
6991         * @hide
6992         */
6993        public static final String CDMA_CELL_BROADCAST_SMS =
6994                "cdma_cell_broadcast_sms";
6995
6996        /**
6997         * The CDMA roaming mode 0 = Home Networks, CDMA default
6998         *                       1 = Roaming on Affiliated networks
6999         *                       2 = Roaming on any networks
7000         * @hide
7001         */
7002        public static final String CDMA_ROAMING_MODE = "roaming_settings";
7003
7004        /**
7005         * The CDMA subscription mode 0 = RUIM/SIM (default)
7006         *                                1 = NV
7007         * @hide
7008         */
7009        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
7010
7011        /** Inactivity timeout to track mobile data activity.
7012        *
7013        * If set to a positive integer, it indicates the inactivity timeout value in seconds to
7014        * infer the data activity of mobile network. After a period of no activity on mobile
7015        * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
7016        * intent is fired to indicate a transition of network status from "active" to "idle". Any
7017        * subsequent activity on mobile networks triggers the firing of {@code
7018        * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
7019        *
7020        * Network activity refers to transmitting or receiving data on the network interfaces.
7021        *
7022        * Tracking is disabled if set to zero or negative value.
7023        *
7024        * @hide
7025        */
7026       public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
7027
7028       /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
7029        * but for Wifi network.
7030        * @hide
7031        */
7032       public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
7033
7034       /**
7035        * Whether or not data roaming is enabled. (0 = false, 1 = true)
7036        */
7037       public static final String DATA_ROAMING = "data_roaming";
7038
7039       /**
7040        * The value passed to a Mobile DataConnection via bringUp which defines the
7041        * number of retries to preform when setting up the initial connection. The default
7042        * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
7043        * @hide
7044        */
7045       public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
7046
7047       /**
7048        * Whether any package can be on external storage. When this is true, any
7049        * package, regardless of manifest values, is a candidate for installing
7050        * or moving onto external storage. (0 = false, 1 = true)
7051        * @hide
7052        */
7053       public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
7054
7055        /**
7056         * Whether any activity can be resized. When this is true, any
7057         * activity, regardless of manifest values, can be resized for multi-window.
7058         * (0 = false, 1 = true)
7059         * @hide
7060         */
7061        public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
7062                = "force_resizable_activities";
7063
7064        /**
7065         * Whether to enable experimental freeform support for windows.
7066         * @hide
7067         */
7068        public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
7069                = "enable_freeform_support";
7070
7071       /**
7072        * Whether user has enabled development settings.
7073        */
7074       public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
7075
7076       /**
7077        * Whether the device has been provisioned (0 = false, 1 = true).
7078        * <p>On a multiuser device with a separate system user, the screen may be locked
7079        * as soon as this is set to true and further activities cannot be launched on the
7080        * system user unless they are marked to show over keyguard.
7081        */
7082       public static final String DEVICE_PROVISIONED = "device_provisioned";
7083
7084       /**
7085        * Whether mobile data should be allowed while the device is being provisioned.
7086        * This allows the provisioning process to turn off mobile data before the user
7087        * has an opportunity to set things up, preventing other processes from burning
7088        * precious bytes before wifi is setup.
7089        * (0 = false, 1 = true)
7090        * @hide
7091        */
7092       public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED =
7093               "device_provisioning_mobile_data";
7094
7095       /**
7096        * The saved value for WindowManagerService.setForcedDisplaySize().
7097        * Two integers separated by a comma.  If unset, then use the real display size.
7098        * @hide
7099        */
7100       public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
7101
7102       /**
7103        * The saved value for WindowManagerService.setForcedDisplayScalingMode().
7104        * 0 or unset if scaling is automatic, 1 if scaling is disabled.
7105        * @hide
7106        */
7107       public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
7108
7109       /**
7110        * The maximum size, in bytes, of a download that the download manager will transfer over
7111        * a non-wifi connection.
7112        * @hide
7113        */
7114       public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
7115               "download_manager_max_bytes_over_mobile";
7116
7117       /**
7118        * The recommended maximum size, in bytes, of a download that the download manager should
7119        * transfer over a non-wifi connection. Over this size, the use will be warned, but will
7120        * have the option to start the download over the mobile connection anyway.
7121        * @hide
7122        */
7123       public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
7124               "download_manager_recommended_max_bytes_over_mobile";
7125
7126       /**
7127        * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
7128        */
7129       @Deprecated
7130       public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
7131
7132       /**
7133        * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
7134        * sent or processed. (0 = false, 1 = true)
7135        * @hide
7136        */
7137       public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
7138
7139       /**
7140        * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted,
7141        * and the output is redirected to AV Receiver connected via
7142        * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}.
7143        * @hide
7144        */
7145       public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled";
7146
7147       /**
7148        * Whether TV will automatically turn on upon reception of the CEC command
7149        * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
7150        * @hide
7151        */
7152       public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
7153               "hdmi_control_auto_wakeup_enabled";
7154
7155       /**
7156        * Whether TV will also turn off other CEC devices when it goes to standby mode.
7157        * (0 = false, 1 = true)
7158        * @hide
7159        */
7160       public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
7161               "hdmi_control_auto_device_off_enabled";
7162
7163       /**
7164        * Whether TV will switch to MHL port when a mobile device is plugged in.
7165        * (0 = false, 1 = true)
7166        * @hide
7167        */
7168       public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
7169
7170       /**
7171        * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
7172        * @hide
7173        */
7174       public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
7175
7176       /**
7177        * Whether mobile data connections are allowed by the user.  See
7178        * ConnectivityManager for more info.
7179        * @hide
7180        */
7181       public static final String MOBILE_DATA = "mobile_data";
7182
7183       /**
7184        * Whether the mobile data connection should remain active even when higher
7185        * priority networks like WiFi are active, to help make network switching faster.
7186        *
7187        * See ConnectivityService for more info.
7188        *
7189        * (0 = disabled, 1 = enabled)
7190        * @hide
7191        */
7192       public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
7193
7194        /**
7195         * Size of the event buffer for IP connectivity metrics.
7196         * @hide
7197         */
7198        public static final String CONNECTIVITY_METRICS_BUFFER_SIZE =
7199              "connectivity_metrics_buffer_size";
7200
7201       /** {@hide} */
7202       public static final String NETSTATS_ENABLED = "netstats_enabled";
7203       /** {@hide} */
7204       public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
7205       /** {@hide} */
7206       public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
7207       /** {@hide} */
7208       public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
7209       /** {@hide} */
7210       public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
7211
7212       /** {@hide} */
7213       public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
7214       /** {@hide} */
7215       public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
7216       /** {@hide} */
7217       public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
7218       /** {@hide} */
7219       public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
7220
7221       /** {@hide} */
7222       public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
7223       /** {@hide} */
7224       public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
7225       /** {@hide} */
7226       public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
7227       /** {@hide} */
7228       public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
7229
7230       /** {@hide} */
7231       public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
7232       /** {@hide} */
7233       public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
7234       /** {@hide} */
7235       public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
7236       /** {@hide} */
7237       public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
7238
7239       /**
7240        * User preference for which network(s) should be used. Only the
7241        * connectivity service should touch this.
7242        */
7243       public static final String NETWORK_PREFERENCE = "network_preference";
7244
7245       /**
7246        * Which package name to use for network scoring. If null, or if the package is not a valid
7247        * scorer app, external network scores will neither be requested nor accepted.
7248        * @hide
7249        */
7250       public static final String NETWORK_SCORER_APP = "network_scorer_app";
7251
7252       /**
7253        * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
7254        * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
7255        * exceeded.
7256        * @hide
7257        */
7258       public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
7259
7260       /**
7261        * The length of time in milli-seconds that automatic small adjustments to
7262        * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
7263        * @hide
7264        */
7265       public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
7266
7267       /** Preferred NTP server. {@hide} */
7268       public static final String NTP_SERVER = "ntp_server";
7269       /** Timeout in milliseconds to wait for NTP server. {@hide} */
7270       public static final String NTP_TIMEOUT = "ntp_timeout";
7271
7272       /** {@hide} */
7273       public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
7274
7275       /**
7276        * Sample validity in seconds to configure for the system DNS resolver.
7277        * {@hide}
7278        */
7279       public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS =
7280               "dns_resolver_sample_validity_seconds";
7281
7282       /**
7283        * Success threshold in percent for use with the system DNS resolver.
7284        * {@hide}
7285        */
7286       public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT =
7287                "dns_resolver_success_threshold_percent";
7288
7289       /**
7290        * Minimum number of samples needed for statistics to be considered meaningful in the
7291        * system DNS resolver.
7292        * {@hide}
7293        */
7294       public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples";
7295
7296       /**
7297        * Maximum number taken into account for statistics purposes in the system DNS resolver.
7298        * {@hide}
7299        */
7300       public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples";
7301
7302       /**
7303        * Whether to disable the automatic scheduling of system updates.
7304        * 1 = system updates won't be automatically scheduled (will always
7305        * present notification instead).
7306        * 0 = system updates will be automatically scheduled. (default)
7307        * @hide
7308        */
7309       @SystemApi
7310       public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
7311
7312       /**
7313        * Whether the package manager should send package verification broadcasts for verifiers to
7314        * review apps prior to installation.
7315        * 1 = request apps to be verified prior to installation, if a verifier exists.
7316        * 0 = do not verify apps before installation
7317        * @hide
7318        */
7319       public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
7320
7321       /** Timeout for package verification.
7322        * @hide */
7323       public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
7324
7325       /** Default response code for package verification.
7326        * @hide */
7327       public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
7328
7329       /**
7330        * Show package verification setting in the Settings app.
7331        * 1 = show (default)
7332        * 0 = hide
7333        * @hide
7334        */
7335       public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
7336
7337       /**
7338        * Run package verification on apps installed through ADB/ADT/USB
7339        * 1 = perform package verification on ADB installs (default)
7340        * 0 = bypass package verification on ADB installs
7341        * @hide
7342        */
7343       public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
7344
7345       /**
7346        * Time since last fstrim (milliseconds) after which we force one to happen
7347        * during device startup.  If unset, the default is 3 days.
7348        * @hide
7349        */
7350       public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
7351
7352       /**
7353        * The interval in milliseconds at which to check packet counts on the
7354        * mobile data interface when screen is on, to detect possible data
7355        * connection problems.
7356        * @hide
7357        */
7358       public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
7359               "pdp_watchdog_poll_interval_ms";
7360
7361       /**
7362        * The interval in milliseconds at which to check packet counts on the
7363        * mobile data interface when screen is off, to detect possible data
7364        * connection problems.
7365        * @hide
7366        */
7367       public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
7368               "pdp_watchdog_long_poll_interval_ms";
7369
7370       /**
7371        * The interval in milliseconds at which to check packet counts on the
7372        * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
7373        * outgoing packets has been reached without incoming packets.
7374        * @hide
7375        */
7376       public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
7377               "pdp_watchdog_error_poll_interval_ms";
7378
7379       /**
7380        * The number of outgoing packets sent without seeing an incoming packet
7381        * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
7382        * device is logged to the event log
7383        * @hide
7384        */
7385       public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
7386               "pdp_watchdog_trigger_packet_count";
7387
7388       /**
7389        * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
7390        * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
7391        * attempting data connection recovery.
7392        * @hide
7393        */
7394       public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
7395               "pdp_watchdog_error_poll_count";
7396
7397       /**
7398        * The number of failed PDP reset attempts before moving to something more
7399        * drastic: re-registering to the network.
7400        * @hide
7401        */
7402       public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
7403               "pdp_watchdog_max_pdp_reset_fail_count";
7404
7405       /**
7406        * A positive value indicates how often the SamplingProfiler
7407        * should take snapshots. Zero value means SamplingProfiler
7408        * is disabled.
7409        *
7410        * @hide
7411        */
7412       public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
7413
7414       /**
7415        * URL to open browser on to allow user to manage a prepay account
7416        * @hide
7417        */
7418       public static final String SETUP_PREPAID_DATA_SERVICE_URL =
7419               "setup_prepaid_data_service_url";
7420
7421       /**
7422        * URL to attempt a GET on to see if this is a prepay device
7423        * @hide
7424        */
7425       public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
7426               "setup_prepaid_detection_target_url";
7427
7428       /**
7429        * Host to check for a redirect to after an attempt to GET
7430        * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
7431        * this is a prepaid device with zero balance.)
7432        * @hide
7433        */
7434       public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
7435               "setup_prepaid_detection_redir_host";
7436
7437       /**
7438        * The interval in milliseconds at which to check the number of SMS sent out without asking
7439        * for use permit, to limit the un-authorized SMS usage.
7440        *
7441        * @hide
7442        */
7443       public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
7444               "sms_outgoing_check_interval_ms";
7445
7446       /**
7447        * The number of outgoing SMS sent without asking for user permit (of {@link
7448        * #SMS_OUTGOING_CHECK_INTERVAL_MS}
7449        *
7450        * @hide
7451        */
7452       public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
7453               "sms_outgoing_check_max_count";
7454
7455       /**
7456        * Used to disable SMS short code confirmation - defaults to true.
7457        * True indcates we will do the check, etc.  Set to false to disable.
7458        * @see com.android.internal.telephony.SmsUsageMonitor
7459        * @hide
7460        */
7461       public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
7462
7463        /**
7464         * Used to select which country we use to determine premium sms codes.
7465         * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
7466         * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
7467         * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
7468         * @hide
7469         */
7470        public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
7471
7472       /**
7473        * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
7474        * @hide
7475        */
7476       public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
7477
7478       /**
7479        * Used to disable Tethering on a device - defaults to true
7480        * @hide
7481        */
7482       public static final String TETHER_SUPPORTED = "tether_supported";
7483
7484       /**
7485        * Used to require DUN APN on the device or not - defaults to a build config value
7486        * which defaults to false
7487        * @hide
7488        */
7489       public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
7490
7491       /**
7492        * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
7493        * corresponding build config values are set it will override the APN DB
7494        * values.
7495        * Consists of a comma seperated list of strings:
7496        * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
7497        * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
7498        * @hide
7499        */
7500       public static final String TETHER_DUN_APN = "tether_dun_apn";
7501
7502       /**
7503        * List of carrier apps which are whitelisted to prompt the user for install when
7504        * a sim card with matching uicc carrier privilege rules is inserted.
7505        *
7506        * The value is "package1;package2;..."
7507        * @hide
7508        */
7509       public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
7510
7511       /**
7512        * USB Mass Storage Enabled
7513        */
7514       public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
7515
7516       /**
7517        * If this setting is set (to anything), then all references
7518        * to Gmail on the device must change to Google Mail.
7519        */
7520       public static final String USE_GOOGLE_MAIL = "use_google_mail";
7521
7522        /**
7523         * Webview Data reduction proxy key.
7524         * @hide
7525         */
7526        public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
7527                "webview_data_reduction_proxy_key";
7528
7529       /**
7530        * Whether or not the WebView fallback mechanism should be enabled.
7531        * 0=disabled, 1=enabled.
7532        * @hide
7533        */
7534       public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED =
7535               "webview_fallback_logic_enabled";
7536
7537       /**
7538        * Name of the package used as WebView provider (if unset the provider is instead determined
7539        * by the system).
7540        * @hide
7541        */
7542       public static final String WEBVIEW_PROVIDER = "webview_provider";
7543
7544       /**
7545        * Developer setting to enable WebView multiprocess rendering.
7546        * @hide
7547        */
7548       @SystemApi
7549       public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
7550
7551       /**
7552        * The maximum number of notifications shown in 24 hours when switching networks.
7553        * @hide
7554        */
7555       public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT =
7556              "network_switch_notification_daily_limit";
7557
7558       /**
7559        * The minimum time in milliseconds between notifications when switching networks.
7560        * @hide
7561        */
7562       public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS =
7563              "network_switch_notification_rate_limit_millis";
7564
7565       /**
7566        * Whether to automatically switch away from wifi networks that lose Internet access.
7567        * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always
7568        * avoids such networks. Valid values are:
7569        *
7570        * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013.
7571        * null: Ask the user whether to switch away from bad wifi.
7572        * 1: Avoid bad wifi.
7573        *
7574        * @hide
7575        */
7576       public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi";
7577
7578       /**
7579        * Whether Wifi display is enabled/disabled
7580        * 0=disabled. 1=enabled.
7581        * @hide
7582        */
7583       public static final String WIFI_DISPLAY_ON = "wifi_display_on";
7584
7585       /**
7586        * Whether Wifi display certification mode is enabled/disabled
7587        * 0=disabled. 1=enabled.
7588        * @hide
7589        */
7590       public static final String WIFI_DISPLAY_CERTIFICATION_ON =
7591               "wifi_display_certification_on";
7592
7593       /**
7594        * WPS Configuration method used by Wifi display, this setting only
7595        * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
7596        *
7597        * Possible values are:
7598        *
7599        * WpsInfo.INVALID: use default WPS method chosen by framework
7600        * WpsInfo.PBC    : use Push button
7601        * WpsInfo.KEYPAD : use Keypad
7602        * WpsInfo.DISPLAY: use Display
7603        * @hide
7604        */
7605       public static final String WIFI_DISPLAY_WPS_CONFIG =
7606           "wifi_display_wps_config";
7607
7608       /**
7609        * Whether to notify the user of open networks.
7610        * <p>
7611        * If not connected and the scan results have an open network, we will
7612        * put this notification up. If we attempt to connect to a network or
7613        * the open network(s) disappear, we remove the notification. When we
7614        * show the notification, we will not show it again for
7615        * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
7616        */
7617       public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
7618               "wifi_networks_available_notification_on";
7619       /**
7620        * {@hide}
7621        */
7622       public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
7623               "wimax_networks_available_notification_on";
7624
7625       /**
7626        * Whether we support connecting to Carrier Networks.
7627        * @hide
7628        **/
7629        public static final String WIFI_CONNECT_CARRIER_NETWORKS =
7630               "wifi_connect_carrier_networks";
7631
7632       /**
7633        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
7634        * Connecting to a network will reset the timer.
7635        */
7636       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
7637               "wifi_networks_available_repeat_delay";
7638
7639       /**
7640        * 802.11 country code in ISO 3166 format
7641        * @hide
7642        */
7643       public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
7644
7645       /**
7646        * The interval in milliseconds to issue wake up scans when wifi needs
7647        * to connect. This is necessary to connect to an access point when
7648        * device is on the move and the screen is off.
7649        * @hide
7650        */
7651       public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
7652               "wifi_framework_scan_interval_ms";
7653
7654       /**
7655        * The interval in milliseconds after which Wi-Fi is considered idle.
7656        * When idle, it is possible for the device to be switched from Wi-Fi to
7657        * the mobile data network.
7658        * @hide
7659        */
7660       public static final String WIFI_IDLE_MS = "wifi_idle_ms";
7661
7662       /**
7663        * When the number of open networks exceeds this number, the
7664        * least-recently-used excess networks will be removed.
7665        */
7666       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
7667
7668       /**
7669        * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
7670        */
7671       public static final String WIFI_ON = "wifi_on";
7672
7673       /**
7674        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
7675        * @hide
7676        */
7677       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
7678                "wifi_scan_always_enabled";
7679
7680        /**
7681         * Value to specify if Wi-Fi Wakeup feature is enabled.
7682         *
7683         * Type: int (0 for false, 1 for true)
7684         * @hide
7685         */
7686        @SystemApi
7687        public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
7688
7689        /**
7690         * Value to specify if network recommendations from
7691         * {@link com.android.server.NetworkScoreService} are enabled.
7692         *
7693         * Type: int (0 for false, 1 for true)
7694         * @hide
7695         */
7696        @SystemApi
7697        public static final String NETWORK_RECOMMENDATIONS_ENABLED =
7698                "network_recommendations_enabled";
7699
7700        /**
7701         * Value to specify if the Wi-Fi Framework should defer to
7702         * {@link com.android.server.NetworkScoreService} for evaluating saved open networks.
7703         *
7704         * Type: int (0 for false, 1 for true)
7705         * @hide
7706         */
7707        @SystemApi
7708        public static final String CURATE_SAVED_OPEN_NETWORKS = "curate_saved_open_networks";
7709
7710        /**
7711         * The number of milliseconds the {@link com.android.server.NetworkScoreService}
7712         * will give a recommendation request to complete before returning a default response.
7713         *
7714         * Type: long
7715         * @hide
7716         */
7717        public static final String NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS =
7718                "network_recommendation_request_timeout_ms";
7719
7720       /**
7721        * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
7722        * connectivity.
7723        * @hide
7724        */
7725       public static final String BLE_SCAN_ALWAYS_AVAILABLE =
7726               "ble_scan_always_enabled";
7727
7728       /**
7729        * Used to save the Wifi_ON state prior to tethering.
7730        * This state will be checked to restore Wifi after
7731        * the user turns off tethering.
7732        *
7733        * @hide
7734        */
7735       public static final String WIFI_SAVED_STATE = "wifi_saved_state";
7736
7737       /**
7738        * The interval in milliseconds to scan as used by the wifi supplicant
7739        * @hide
7740        */
7741       public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
7742               "wifi_supplicant_scan_interval_ms";
7743
7744        /**
7745         * whether frameworks handles wifi auto-join
7746         * @hide
7747         */
7748       public static final String WIFI_ENHANCED_AUTO_JOIN =
7749                "wifi_enhanced_auto_join";
7750
7751        /**
7752         * whether settings show RSSI
7753         * @hide
7754         */
7755        public static final String WIFI_NETWORK_SHOW_RSSI =
7756                "wifi_network_show_rssi";
7757
7758        /**
7759        * The interval in milliseconds to scan at supplicant when p2p is connected
7760        * @hide
7761        */
7762       public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
7763               "wifi_scan_interval_p2p_connected_ms";
7764
7765       /**
7766        * Whether the Wi-Fi watchdog is enabled.
7767        */
7768       public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
7769
7770       /**
7771        * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
7772        * the setting needs to be set to 0 to disable it.
7773        * @hide
7774        */
7775       public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
7776               "wifi_watchdog_poor_network_test_enabled";
7777
7778       /**
7779        * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
7780        * needs to be set to 0 to disable it.
7781        * @hide
7782        */
7783       public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
7784               "wifi_suspend_optimizations_enabled";
7785
7786       /**
7787        * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
7788        * will enable it. In the future, additional values may be supported.
7789        * @hide
7790        */
7791       public static final String WIFI_VERBOSE_LOGGING_ENABLED =
7792               "wifi_verbose_logging_enabled";
7793
7794       /**
7795        * The maximum number of times we will retry a connection to an access
7796        * point for which we have failed in acquiring an IP address from DHCP.
7797        * A value of N means that we will make N+1 connection attempts in all.
7798        */
7799       public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
7800
7801       /**
7802        * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
7803        * data connectivity to be established after a disconnect from Wi-Fi.
7804        */
7805       public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
7806           "wifi_mobile_data_transition_wakelock_timeout_ms";
7807
7808       /**
7809        * This setting controls whether WiFi configurations created by a Device Owner app
7810        * should be locked down (that is, be editable or removable only by the Device Owner App,
7811        * not even by Settings app).
7812        * This setting takes integer values. Non-zero values mean DO created configurations
7813        * are locked down. Value of zero means they are not. Default value in the absence of
7814        * actual value to this setting is 0.
7815        */
7816       public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
7817               "wifi_device_owner_configs_lockdown";
7818
7819       /**
7820        * The operational wifi frequency band
7821        * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
7822        * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
7823        * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
7824        *
7825        * @hide
7826        */
7827       public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
7828
7829       /**
7830        * The Wi-Fi peer-to-peer device name
7831        * @hide
7832        */
7833       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
7834
7835       /**
7836        * The min time between wifi disable and wifi enable
7837        * @hide
7838        */
7839       public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
7840
7841       /**
7842        * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
7843        * from an ephemeral network if there is no BSSID for that network with a non-null score that
7844        * has been seen in this time period.
7845        *
7846        * If this is less than or equal to zero, we use a more conservative behavior and only check
7847        * for a non-null score from the currently connected or target BSSID.
7848        * @hide
7849        */
7850       public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
7851               "wifi_ephemeral_out_of_range_timeout_ms";
7852
7853       /**
7854        * The number of milliseconds to delay when checking for data stalls during
7855        * non-aggressive detection. (screen is turned off.)
7856        * @hide
7857        */
7858       public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
7859               "data_stall_alarm_non_aggressive_delay_in_ms";
7860
7861       /**
7862        * The number of milliseconds to delay when checking for data stalls during
7863        * aggressive detection. (screen on or suspected data stall)
7864        * @hide
7865        */
7866       public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
7867               "data_stall_alarm_aggressive_delay_in_ms";
7868
7869       /**
7870        * The number of milliseconds to allow the provisioning apn to remain active
7871        * @hide
7872        */
7873       public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
7874               "provisioning_apn_alarm_delay_in_ms";
7875
7876       /**
7877        * The interval in milliseconds at which to check gprs registration
7878        * after the first registration mismatch of gprs and voice service,
7879        * to detect possible data network registration problems.
7880        *
7881        * @hide
7882        */
7883       public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
7884               "gprs_register_check_period_ms";
7885
7886       /**
7887        * Nonzero causes Log.wtf() to crash.
7888        * @hide
7889        */
7890       public static final String WTF_IS_FATAL = "wtf_is_fatal";
7891
7892       /**
7893        * Ringer mode. This is used internally, changing this value will not
7894        * change the ringer mode. See AudioManager.
7895        */
7896       public static final String MODE_RINGER = "mode_ringer";
7897
7898       /**
7899        * Overlay display devices setting.
7900        * The associated value is a specially formatted string that describes the
7901        * size and density of simulated secondary display devices.
7902        * <p>
7903        * Format: {width}x{height}/{dpi};...
7904        * </p><p>
7905        * Example:
7906        * <ul>
7907        * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
7908        * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
7909        * at 1080p and the second at 720p.</li>
7910        * <li>If the value is empty, then no overlay display devices are created.</li>
7911        * </ul></p>
7912        *
7913        * @hide
7914        */
7915       public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
7916
7917        /**
7918         * Threshold values for the duration and level of a discharge cycle,
7919         * under which we log discharge cycle info.
7920         *
7921         * @hide
7922         */
7923        public static final String
7924                BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
7925
7926        /** @hide */
7927        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
7928
7929        /**
7930         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
7931         * intents on application crashes and ANRs. If this is disabled, the
7932         * crash/ANR dialog will never display the "Report" button.
7933         * <p>
7934         * Type: int (0 = disallow, 1 = allow)
7935         *
7936         * @hide
7937         */
7938        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
7939
7940        /**
7941         * Maximum age of entries kept by {@link DropBoxManager}.
7942         *
7943         * @hide
7944         */
7945        public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
7946
7947        /**
7948         * Maximum number of entry files which {@link DropBoxManager} will keep
7949         * around.
7950         *
7951         * @hide
7952         */
7953        public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
7954
7955        /**
7956         * Maximum amount of disk space used by {@link DropBoxManager} no matter
7957         * what.
7958         *
7959         * @hide
7960         */
7961        public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
7962
7963        /**
7964         * Percent of free disk (excluding reserve) which {@link DropBoxManager}
7965         * will use.
7966         *
7967         * @hide
7968         */
7969        public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
7970
7971        /**
7972         * Percent of total disk which {@link DropBoxManager} will never dip
7973         * into.
7974         *
7975         * @hide
7976         */
7977        public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
7978
7979        /**
7980         * Prefix for per-tag dropbox disable/enable settings.
7981         *
7982         * @hide
7983         */
7984        public static final String DROPBOX_TAG_PREFIX = "dropbox:";
7985
7986        /**
7987         * Lines of logcat to include with system crash/ANR/etc. reports, as a
7988         * prefix of the dropbox tag of the report type. For example,
7989         * "logcat_for_system_server_anr" controls the lines of logcat captured
7990         * with system server ANR reports. 0 to disable.
7991         *
7992         * @hide
7993         */
7994        public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
7995
7996        /**
7997         * The interval in minutes after which the amount of free storage left
7998         * on the device is logged to the event log
7999         *
8000         * @hide
8001         */
8002        public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
8003
8004        /**
8005         * Threshold for the amount of change in disk free space required to
8006         * report the amount of free space. Used to prevent spamming the logs
8007         * when the disk free space isn't changing frequently.
8008         *
8009         * @hide
8010         */
8011        public static final String
8012                DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
8013
8014        /**
8015         * Minimum percentage of free storage on the device that is used to
8016         * determine if the device is running low on storage. The default is 10.
8017         * <p>
8018         * Say this value is set to 10, the device is considered running low on
8019         * storage if 90% or more of the device storage is filled up.
8020         *
8021         * @hide
8022         */
8023        public static final String
8024                SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
8025
8026        /**
8027         * Maximum byte size of the low storage threshold. This is to ensure
8028         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
8029         * overly large threshold for large storage devices. Currently this must
8030         * be less than 2GB. This default is 500MB.
8031         *
8032         * @hide
8033         */
8034        public static final String
8035                SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
8036
8037        /**
8038         * Minimum bytes of free storage on the device before the data partition
8039         * is considered full. By default, 1 MB is reserved to avoid system-wide
8040         * SQLite disk full exceptions.
8041         *
8042         * @hide
8043         */
8044        public static final String
8045                SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
8046
8047        /**
8048         * The maximum reconnect delay for short network outages or when the
8049         * network is suspended due to phone use.
8050         *
8051         * @hide
8052         */
8053        public static final String
8054                SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
8055
8056        /**
8057         * The number of milliseconds to delay before sending out
8058         * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
8059         *
8060         * @hide
8061         */
8062        public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
8063
8064
8065        /**
8066         * Network sampling interval, in seconds. We'll generate link information
8067         * about bytes/packets sent and error rates based on data sampled in this interval
8068         *
8069         * @hide
8070         */
8071
8072        public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
8073                "connectivity_sampling_interval_in_seconds";
8074
8075        /**
8076         * The series of successively longer delays used in retrying to download PAC file.
8077         * Last delay is used between successful PAC downloads.
8078         *
8079         * @hide
8080         */
8081        public static final String PAC_CHANGE_DELAY = "pac_change_delay";
8082
8083        /**
8084         * Don't attempt to detect captive portals.
8085         *
8086         * @hide
8087         */
8088        public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0;
8089
8090        /**
8091         * When detecting a captive portal, display a notification that
8092         * prompts the user to sign in.
8093         *
8094         * @hide
8095         */
8096        public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1;
8097
8098        /**
8099         * When detecting a captive portal, immediately disconnect from the
8100         * network and do not reconnect to that network in the future.
8101         *
8102         * @hide
8103         */
8104        public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
8105
8106        /**
8107         * What to do when connecting a network that presents a captive portal.
8108         * Must be one of the CAPTIVE_PORTAL_MODE_* constants above.
8109         *
8110         * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT.
8111         * @hide
8112         */
8113        public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode";
8114
8115        /**
8116         * Setting to turn off captive portal detection. Feature is enabled by
8117         * default and the setting needs to be set to 0 to disable it.
8118         *
8119         * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection
8120         * @hide
8121         */
8122        @Deprecated
8123        public static final String
8124                CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
8125
8126        /**
8127         * The server used for captive portal detection upon a new conection. A
8128         * 204 response code from the server is used for validation.
8129         * TODO: remove this deprecated symbol.
8130         *
8131         * @hide
8132         */
8133        public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
8134
8135        /**
8136         * The URL used for HTTPS captive portal detection upon a new connection.
8137         * A 204 response code from the server is used for validation.
8138         *
8139         * @hide
8140         */
8141        public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url";
8142
8143        /**
8144         * The URL used for HTTP captive portal detection upon a new connection.
8145         * A 204 response code from the server is used for validation.
8146         *
8147         * @hide
8148         */
8149        public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url";
8150
8151        /**
8152         * The URL used for fallback HTTP captive portal detection when previous HTTP
8153         * and HTTPS captive portal detection attemps did not return a conclusive answer.
8154         *
8155         * @hide
8156         */
8157        public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
8158
8159        /**
8160         * Whether to use HTTPS for network validation. This is enabled by default and the setting
8161         * needs to be set to 0 to disable it. This setting is a misnomer because captive portals
8162         * don't actually use HTTPS, but it's consistent with the other settings.
8163         *
8164         * @hide
8165         */
8166        public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
8167
8168        /**
8169         * Which User-Agent string to use in the header of the captive portal detection probes.
8170         * The User-Agent field is unset when this setting has no value (HttpUrlConnection default).
8171         *
8172         * @hide
8173         */
8174        public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent";
8175
8176        /**
8177         * Whether network service discovery is enabled.
8178         *
8179         * @hide
8180         */
8181        public static final String NSD_ON = "nsd_on";
8182
8183        /**
8184         * Let user pick default install location.
8185         *
8186         * @hide
8187         */
8188        public static final String SET_INSTALL_LOCATION = "set_install_location";
8189
8190        /**
8191         * Default install location value.
8192         * 0 = auto, let system decide
8193         * 1 = internal
8194         * 2 = sdcard
8195         * @hide
8196         */
8197        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
8198
8199        /**
8200         * ms during which to consume extra events related to Inet connection
8201         * condition after a transtion to fully-connected
8202         *
8203         * @hide
8204         */
8205        public static final String
8206                INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
8207
8208        /**
8209         * ms during which to consume extra events related to Inet connection
8210         * condtion after a transtion to partly-connected
8211         *
8212         * @hide
8213         */
8214        public static final String
8215                INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
8216
8217        /** {@hide} */
8218        public static final String
8219                READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
8220
8221        /**
8222         * Host name and port for global http proxy. Uses ':' seperator for
8223         * between host and port.
8224         */
8225        public static final String HTTP_PROXY = "http_proxy";
8226
8227        /**
8228         * Host name for global http proxy. Set via ConnectivityManager.
8229         *
8230         * @hide
8231         */
8232        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
8233
8234        /**
8235         * Integer host port for global http proxy. Set via ConnectivityManager.
8236         *
8237         * @hide
8238         */
8239        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
8240
8241        /**
8242         * Exclusion list for global proxy. This string contains a list of
8243         * comma-separated domains where the global proxy does not apply.
8244         * Domains should be listed in a comma- separated list. Example of
8245         * acceptable formats: ".domain1.com,my.domain2.com" Use
8246         * ConnectivityManager to set/get.
8247         *
8248         * @hide
8249         */
8250        public static final String
8251                GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
8252
8253        /**
8254         * The location PAC File for the proxy.
8255         * @hide
8256         */
8257        public static final String
8258                GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
8259
8260        /**
8261         * Enables the UI setting to allow the user to specify the global HTTP
8262         * proxy and associated exclusion list.
8263         *
8264         * @hide
8265         */
8266        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
8267
8268        /**
8269         * Setting for default DNS in case nobody suggests one
8270         *
8271         * @hide
8272         */
8273        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
8274
8275        /** {@hide} */
8276        public static final String
8277                BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
8278        /** {@hide} */
8279        public static final String
8280                BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
8281        /** {@hide} */
8282        public static final String
8283                BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
8284        /** {@hide} */
8285        public static final String
8286                BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
8287        /** {@hide} */
8288        public static final String
8289                BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
8290        /** {@hide} */
8291        public static final String
8292                BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_";
8293        /** {@hide} */
8294        public static final String
8295                BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_";
8296        /** {@hide} */
8297        public static final String
8298                BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
8299        /** {@hide} */
8300        public static final String
8301                BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_";
8302
8303        /**
8304         * Device Idle (Doze) specific settings.
8305         * This is encoded as a key=value list, separated by commas. Ex:
8306         *
8307         * "inactive_to=60000,sensing_to=400000"
8308         *
8309         * The following keys are supported:
8310         *
8311         * <pre>
8312         * inactive_to                      (long)
8313         * sensing_to                       (long)
8314         * motion_inactive_to               (long)
8315         * idle_after_inactive_to           (long)
8316         * idle_pending_to                  (long)
8317         * max_idle_pending_to              (long)
8318         * idle_pending_factor              (float)
8319         * idle_to                          (long)
8320         * max_idle_to                      (long)
8321         * idle_factor                      (float)
8322         * min_time_to_alarm                (long)
8323         * max_temp_app_whitelist_duration  (long)
8324         * notification_whitelist_duration  (long)
8325         * </pre>
8326         *
8327         * <p>
8328         * Type: string
8329         * @hide
8330         * @see com.android.server.DeviceIdleController.Constants
8331         */
8332        public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
8333
8334        /**
8335         * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS}
8336         *
8337         * <p>
8338         * Type: string
8339         * @hide
8340         * @see com.android.server.DeviceIdleController.Constants
8341         */
8342        public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch";
8343
8344        /**
8345         * App standby (app idle) specific settings.
8346         * This is encoded as a key=value list, separated by commas. Ex:
8347         *
8348         * "idle_duration=5000,parole_interval=4500"
8349         *
8350         * The following keys are supported:
8351         *
8352         * <pre>
8353         * idle_duration2       (long)
8354         * wallclock_threshold  (long)
8355         * parole_interval      (long)
8356         * parole_duration      (long)
8357         *
8358         * idle_duration        (long) // This is deprecated and used to circumvent b/26355386.
8359         * </pre>
8360         *
8361         * <p>
8362         * Type: string
8363         * @hide
8364         * @see com.android.server.usage.UsageStatsService.SettingsObserver
8365         */
8366        public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
8367
8368        /**
8369         * Alarm manager specific settings.
8370         * This is encoded as a key=value list, separated by commas. Ex:
8371         *
8372         * "min_futurity=5000,allow_while_idle_short_time=4500"
8373         *
8374         * The following keys are supported:
8375         *
8376         * <pre>
8377         * min_futurity                         (long)
8378         * min_interval                         (long)
8379         * allow_while_idle_short_time          (long)
8380         * allow_while_idle_long_time           (long)
8381         * allow_while_idle_whitelist_duration  (long)
8382         * </pre>
8383         *
8384         * <p>
8385         * Type: string
8386         * @hide
8387         * @see com.android.server.AlarmManagerService.Constants
8388         */
8389        public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
8390
8391        /**
8392         * Job scheduler specific settings.
8393         * This is encoded as a key=value list, separated by commas. Ex:
8394         *
8395         * "min_ready_jobs_count=2,moderate_use_factor=.5"
8396         *
8397         * The following keys are supported:
8398         *
8399         * <pre>
8400         * min_idle_count                       (int)
8401         * min_charging_count                   (int)
8402         * min_connectivity_count               (int)
8403         * min_content_count                    (int)
8404         * min_ready_jobs_count                 (int)
8405         * heavy_use_factor                     (float)
8406         * moderate_use_factor                  (float)
8407         * fg_job_count                         (int)
8408         * bg_normal_job_count                  (int)
8409         * bg_moderate_job_count                (int)
8410         * bg_low_job_count                     (int)
8411         * bg_critical_job_count                (int)
8412         * </pre>
8413         *
8414         * <p>
8415         * Type: string
8416         * @hide
8417         * @see com.android.server.job.JobSchedulerService.Constants
8418         */
8419        public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants";
8420
8421        /**
8422         * ShortcutManager specific settings.
8423         * This is encoded as a key=value list, separated by commas. Ex:
8424         *
8425         * "reset_interval_sec=86400,max_updates_per_interval=1"
8426         *
8427         * The following keys are supported:
8428         *
8429         * <pre>
8430         * reset_interval_sec              (long)
8431         * max_updates_per_interval        (int)
8432         * max_icon_dimension_dp           (int, DP)
8433         * max_icon_dimension_dp_lowram    (int, DP)
8434         * max_shortcuts                   (int)
8435         * icon_quality                    (int, 0-100)
8436         * icon_format                     (String)
8437         * </pre>
8438         *
8439         * <p>
8440         * Type: string
8441         * @hide
8442         * @see com.android.server.pm.ShortcutService.ConfigConstants
8443         */
8444        public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants";
8445
8446        /**
8447         * Get the key that retrieves a bluetooth headset's priority.
8448         * @hide
8449         */
8450        public static final String getBluetoothHeadsetPriorityKey(String address) {
8451            return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8452        }
8453
8454        /**
8455         * Get the key that retrieves a bluetooth a2dp sink's priority.
8456         * @hide
8457         */
8458        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
8459            return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8460        }
8461
8462        /**
8463         * Get the key that retrieves a bluetooth a2dp src's priority.
8464         * @hide
8465         */
8466        public static final String getBluetoothA2dpSrcPriorityKey(String address) {
8467            return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8468        }
8469
8470        /**
8471         * Get the key that retrieves a bluetooth Input Device's priority.
8472         * @hide
8473         */
8474        public static final String getBluetoothInputDevicePriorityKey(String address) {
8475            return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8476        }
8477
8478        /**
8479         * Get the key that retrieves a bluetooth pan client priority.
8480         * @hide
8481         */
8482        public static final String getBluetoothPanPriorityKey(String address) {
8483            return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8484        }
8485
8486        /**
8487         * Get the key that retrieves a bluetooth map priority.
8488         * @hide
8489         */
8490        public static final String getBluetoothMapPriorityKey(String address) {
8491            return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8492        }
8493
8494        /**
8495         * Get the key that retrieves a bluetooth map client priority.
8496         * @hide
8497         */
8498        public static final String getBluetoothMapClientPriorityKey(String address) {
8499            return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8500        }
8501
8502        /**
8503         * Get the key that retrieves a bluetooth pbap client priority.
8504         * @hide
8505         */
8506        public static final String getBluetoothPbapClientPriorityKey(String address) {
8507            return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8508        }
8509
8510        /**
8511         * Get the key that retrieves a bluetooth sap priority.
8512         * @hide
8513         */
8514        public static final String getBluetoothSapPriorityKey(String address) {
8515            return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8516        }
8517
8518        /**
8519         * Scaling factor for normal window animations. Setting to 0 will
8520         * disable window animations.
8521         */
8522        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
8523
8524        /**
8525         * Scaling factor for activity transition animations. Setting to 0 will
8526         * disable window animations.
8527         */
8528        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
8529
8530        /**
8531         * Scaling factor for Animator-based animations. This affects both the
8532         * start delay and duration of all such animations. Setting to 0 will
8533         * cause animations to end immediately. The default value is 1.
8534         */
8535        public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
8536
8537        /**
8538         * Scaling factor for normal window animations. Setting to 0 will
8539         * disable window animations.
8540         *
8541         * @hide
8542         */
8543        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
8544
8545        /**
8546         * If 0, the compatibility mode is off for all applications.
8547         * If 1, older applications run under compatibility mode.
8548         * TODO: remove this settings before code freeze (bug/1907571)
8549         * @hide
8550         */
8551        public static final String COMPATIBILITY_MODE = "compatibility_mode";
8552
8553        /**
8554         * CDMA only settings
8555         * Emergency Tone  0 = Off
8556         *                 1 = Alert
8557         *                 2 = Vibrate
8558         * @hide
8559         */
8560        public static final String EMERGENCY_TONE = "emergency_tone";
8561
8562        /**
8563         * CDMA only settings
8564         * Whether the auto retry is enabled. The value is
8565         * boolean (1 or 0).
8566         * @hide
8567         */
8568        public static final String CALL_AUTO_RETRY = "call_auto_retry";
8569
8570        /**
8571         * A setting that can be read whether the emergency affordance is currently needed.
8572         * The value is a boolean (1 or 0).
8573         * @hide
8574         */
8575        public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
8576
8577        /**
8578         * See RIL_PreferredNetworkType in ril.h
8579         * @hide
8580         */
8581        public static final String PREFERRED_NETWORK_MODE =
8582                "preferred_network_mode";
8583
8584        /**
8585         * Name of an application package to be debugged.
8586         */
8587        public static final String DEBUG_APP = "debug_app";
8588
8589        /**
8590         * If 1, when launching DEBUG_APP it will wait for the debugger before
8591         * starting user code.  If 0, it will run normally.
8592         */
8593        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
8594
8595        /**
8596         * Control whether the process CPU usage meter should be shown.
8597         *
8598         * @deprecated This functionality is no longer available as of
8599         * {@link android.os.Build.VERSION_CODES#N_MR1}.
8600         */
8601        @Deprecated
8602        public static final String SHOW_PROCESSES = "show_processes";
8603
8604        /**
8605         * If 1 low power mode is enabled.
8606         * @hide
8607         */
8608        public static final String LOW_POWER_MODE = "low_power";
8609
8610        /**
8611         * Battery level [1-99] at which low power mode automatically turns on.
8612         * If 0, it will not automatically turn on.
8613         * @hide
8614         */
8615        public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
8616
8617         /**
8618         * If not 0, the activity manager will aggressively finish activities and
8619         * processes as soon as they are no longer needed.  If 0, the normal
8620         * extended lifetime is used.
8621         */
8622        public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
8623
8624        /**
8625         * @hide
8626         * If not 0, the activity manager will implement a looser version of background
8627         * check that is more compatible with existing apps.
8628         */
8629        public static final String LENIENT_BACKGROUND_CHECK = "lenient_background_check";
8630
8631        /**
8632         * Use Dock audio output for media:
8633         *      0 = disabled
8634         *      1 = enabled
8635         * @hide
8636         */
8637        public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
8638
8639        /**
8640         * The surround sound formats AC3, DTS or IEC61937 are
8641         * available for use if they are detected.
8642         * This is the default mode.
8643         *
8644         * Note that AUTO is equivalent to ALWAYS for Android TVs and other
8645         * devices that have an S/PDIF output. This is because S/PDIF
8646         * is unidirectional and the TV cannot know if a decoder is
8647         * connected. So it assumes they are always available.
8648         * @hide
8649         */
8650         public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0;
8651
8652        /**
8653         * AC3, DTS or IEC61937 are NEVER available, even if they
8654         * are detected by the hardware. Those formats will not be
8655         * reported.
8656         *
8657         * An example use case would be an AVR reports that it is capable of
8658         * surround sound decoding but is broken. If NEVER is chosen
8659         * then apps must use PCM output instead of encoded output.
8660         * @hide
8661         */
8662         public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1;
8663
8664        /**
8665         * AC3, DTS or IEC61937 are ALWAYS available, even if they
8666         * are not detected by the hardware. Those formats will be
8667         * reported as part of the HDMI output capability. Applications
8668         * are then free to use either PCM or encoded output.
8669         *
8670         * An example use case would be a when TV was connected over
8671         * TOS-link to an AVR. But the TV could not see it because TOS-link
8672         * is unidirectional.
8673         * @hide
8674         */
8675         public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2;
8676
8677        /**
8678         * Set to ENCODED_SURROUND_OUTPUT_AUTO,
8679         * ENCODED_SURROUND_OUTPUT_NEVER or
8680         * ENCODED_SURROUND_OUTPUT_ALWAYS
8681         * @hide
8682         */
8683        public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output";
8684
8685        /**
8686         * Persisted safe headphone volume management state by AudioService
8687         * @hide
8688         */
8689        public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
8690
8691        /**
8692         * URL for tzinfo (time zone) updates
8693         * @hide
8694         */
8695        public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
8696
8697        /**
8698         * URL for tzinfo (time zone) update metadata
8699         * @hide
8700         */
8701        public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
8702
8703        /**
8704         * URL for selinux (mandatory access control) updates
8705         * @hide
8706         */
8707        public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
8708
8709        /**
8710         * URL for selinux (mandatory access control) update metadata
8711         * @hide
8712         */
8713        public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
8714
8715        /**
8716         * URL for sms short code updates
8717         * @hide
8718         */
8719        public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
8720                "sms_short_codes_content_url";
8721
8722        /**
8723         * URL for sms short code update metadata
8724         * @hide
8725         */
8726        public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
8727                "sms_short_codes_metadata_url";
8728
8729        /**
8730         * URL for apn_db updates
8731         * @hide
8732         */
8733        public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
8734
8735        /**
8736         * URL for apn_db update metadata
8737         * @hide
8738         */
8739        public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
8740
8741        /**
8742         * URL for cert pinlist updates
8743         * @hide
8744         */
8745        public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
8746
8747        /**
8748         * URL for cert pinlist updates
8749         * @hide
8750         */
8751        public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
8752
8753        /**
8754         * URL for intent firewall updates
8755         * @hide
8756         */
8757        public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
8758                "intent_firewall_content_url";
8759
8760        /**
8761         * URL for intent firewall update metadata
8762         * @hide
8763         */
8764        public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
8765                "intent_firewall_metadata_url";
8766
8767        /**
8768         * SELinux enforcement status. If 0, permissive; if 1, enforcing.
8769         * @hide
8770         */
8771        public static final String SELINUX_STATUS = "selinux_status";
8772
8773        /**
8774         * Developer setting to force RTL layout.
8775         * @hide
8776         */
8777        public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
8778
8779        /**
8780         * Milliseconds after screen-off after which low battery sounds will be silenced.
8781         *
8782         * If zero, battery sounds will always play.
8783         * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
8784         *
8785         * @hide
8786         */
8787        public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
8788
8789        /**
8790         * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
8791         * the caller is done with this, they should call {@link ContentResolver#delete} to
8792         * clean up any value that they may have written.
8793         *
8794         * @hide
8795         */
8796        public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
8797
8798        /**
8799         * Defines global runtime overrides to window policy.
8800         *
8801         * See {@link com.android.server.policy.PolicyControl} for value format.
8802         *
8803         * @hide
8804         */
8805        public static final String POLICY_CONTROL = "policy_control";
8806
8807        /**
8808         * Defines global zen mode.  ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
8809         * or ZEN_MODE_NO_INTERRUPTIONS.
8810         *
8811         * @hide
8812         */
8813        public static final String ZEN_MODE = "zen_mode";
8814
8815        /** @hide */ public static final int ZEN_MODE_OFF = 0;
8816        /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
8817        /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
8818        /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
8819
8820        /** @hide */ public static String zenModeToString(int mode) {
8821            if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
8822            if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
8823            if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
8824            return "ZEN_MODE_OFF";
8825        }
8826
8827        /** @hide */ public static boolean isValidZenMode(int value) {
8828            switch (value) {
8829                case Global.ZEN_MODE_OFF:
8830                case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
8831                case Global.ZEN_MODE_ALARMS:
8832                case Global.ZEN_MODE_NO_INTERRUPTIONS:
8833                    return true;
8834                default:
8835                    return false;
8836            }
8837        }
8838
8839        /**
8840         * Value of the ringer before entering zen mode.
8841         *
8842         * @hide
8843         */
8844        public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
8845
8846        /**
8847         * Opaque value, changes when persisted zen mode configuration changes.
8848         *
8849         * @hide
8850         */
8851        public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
8852
8853        /**
8854         * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
8855         *
8856         * @hide
8857         */
8858        public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
8859                "heads_up_notifications_enabled";
8860
8861        /** @hide */ public static final int HEADS_UP_OFF = 0;
8862        /** @hide */ public static final int HEADS_UP_ON = 1;
8863
8864        /**
8865         * The name of the device
8866         */
8867        public static final String DEVICE_NAME = "device_name";
8868
8869        /**
8870         * Whether the NetworkScoringService has been first initialized.
8871         * <p>
8872         * Type: int (0 for false, 1 for true)
8873         * @hide
8874         */
8875        public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
8876
8877        /**
8878         * Whether the user wants to be prompted for password to decrypt the device on boot.
8879         * This only matters if the storage is encrypted.
8880         * <p>
8881         * Type: int (0 for false, 1 for true)
8882         * @hide
8883         */
8884        public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
8885
8886        /**
8887         * Whether the Volte is enabled
8888         * <p>
8889         * Type: int (0 for false, 1 for true)
8890         * @hide
8891         */
8892        public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
8893
8894        /**
8895         * Whether VT (Video Telephony over IMS) is enabled
8896         * <p>
8897         * Type: int (0 for false, 1 for true)
8898         *
8899         * @hide
8900         */
8901        public static final String VT_IMS_ENABLED = "vt_ims_enabled";
8902
8903        /**
8904         * Whether WFC is enabled
8905         * <p>
8906         * Type: int (0 for false, 1 for true)
8907         *
8908         * @hide
8909         */
8910        public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
8911
8912        /**
8913         * WFC mode on home/non-roaming network.
8914         * <p>
8915         * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
8916         *
8917         * @hide
8918         */
8919        public static final String WFC_IMS_MODE = "wfc_ims_mode";
8920
8921        /**
8922         * WFC mode on roaming network.
8923         * <p>
8924         * Type: int - see {@link WFC_IMS_MODE} for values
8925         *
8926         * @hide
8927         */
8928        public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode";
8929
8930        /**
8931         * Whether WFC roaming is enabled
8932         * <p>
8933         * Type: int (0 for false, 1 for true)
8934         *
8935         * @hide
8936         */
8937        public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
8938
8939        /**
8940         * Whether user can enable/disable LTE as a preferred network. A carrier might control
8941         * this via gservices, OMA-DM, carrier app, etc.
8942         * <p>
8943         * Type: int (0 for false, 1 for true)
8944         * @hide
8945         */
8946        public static final String LTE_SERVICE_FORCED = "lte_service_forced";
8947
8948        /**
8949         * Ephemeral app cookie max size in bytes.
8950         * <p>
8951         * Type: int
8952         * @hide
8953         */
8954        public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
8955                "ephemeral_cookie_max_size_bytes";
8956
8957        /**
8958         * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is
8959         * enabled. Set to zero to disable.
8960         * <p>
8961         * Type: int (0 for false, 1 for true)
8962         *
8963         * @hide
8964         */
8965        public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature";
8966
8967        /**
8968         * A mask applied to the ephemeral hash to generate the hash prefix.
8969         * <p>
8970         * Type: int
8971         *
8972         * @hide
8973         */
8974        public static final String EPHEMERAL_HASH_PREFIX_MASK = "ephemeral_hash_prefix_mask";
8975
8976        /**
8977         * Number of hash prefixes to send during ephemeral resolution.
8978         * <p>
8979         * Type: int
8980         *
8981         * @hide
8982         */
8983        public static final String EPHEMERAL_HASH_PREFIX_COUNT = "ephemeral_hash_prefix_count";
8984
8985        /**
8986         * The duration for caching uninstalled ephemeral apps.
8987         * <p>
8988         * Type: long
8989         * @hide
8990         */
8991        public static final String UNINSTALLED_EPHEMERAL_APP_CACHE_DURATION_MILLIS =
8992                "uninstalled_ephemeral_app_cache_duration_millis";
8993
8994        /**
8995         * Allows switching users when system user is locked.
8996         * <p>
8997         * Type: int
8998         * @hide
8999         */
9000        public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED =
9001                "allow_user_switching_when_system_user_locked";
9002
9003        /**
9004         * Boot count since the device starts running APK level 24.
9005         * <p>
9006         * Type: int
9007         */
9008        public static final String BOOT_COUNT = "boot_count";
9009
9010        /**
9011         * Whether the safe boot is disallowed.
9012         *
9013         * <p>This setting should have the identical value as the corresponding user restriction.
9014         * The purpose of the setting is to make the restriction available in early boot stages
9015         * before the user restrictions are loaded.
9016         * @hide
9017         */
9018        public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
9019
9020        /**
9021         * Whether this device is currently in retail demo mode. If true, device
9022         * usage is severely limited.
9023         * <p>
9024         * Type: int (0 for false, 1 for true)
9025         * @hide
9026         */
9027        public static final String DEVICE_DEMO_MODE = "device_demo_mode";
9028
9029        /**
9030         * Retail mode specific settings. This is encoded as a key=value list, separated by commas.
9031         * Ex: "user_inactivity_timeout_ms=30000,warning_dialog_timeout_ms=10000". The following
9032         * keys are supported:
9033         *
9034         * <pre>
9035         * user_inactivity_timeout_ms  (long)
9036         * warning_dialog_timeout_ms   (long)
9037         * </pre>
9038         * <p>
9039         * Type: string
9040         *
9041         * @hide
9042         */
9043        public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants";
9044
9045        /**
9046         * The reason for the settings database being downgraded. This is only for
9047         * troubleshooting purposes and its value should not be interpreted in any way.
9048         *
9049         * Type: string
9050         *
9051         * @hide
9052         */
9053        public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
9054
9055        /**
9056         * Settings to backup. This is here so that it's in the same place as the settings
9057         * keys and easy to update.
9058         *
9059         * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
9060         * and Secure as well.  This is because those tables drive both backup and
9061         * restore, and restore needs to properly whitelist keys that used to live
9062         * in those namespaces.  The keys will only actually be backed up / restored
9063         * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
9064         *
9065         * NOTE: Settings are backed up and restored in the order they appear
9066         *       in this array. If you have one setting depending on another,
9067         *       make sure that they are ordered appropriately.
9068         *
9069         * @hide
9070         */
9071        public static final String[] SETTINGS_TO_BACKUP = {
9072            BUGREPORT_IN_POWER_MENU,
9073            STAY_ON_WHILE_PLUGGED_IN,
9074            AUTO_TIME,
9075            AUTO_TIME_ZONE,
9076            POWER_SOUNDS_ENABLED,
9077            DOCK_SOUNDS_ENABLED,
9078            CHARGING_SOUNDS_ENABLED,
9079            USB_MASS_STORAGE_ENABLED,
9080            ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
9081            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
9082            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
9083            WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
9084            WIFI_NUM_OPEN_NETWORKS_KEPT,
9085            EMERGENCY_TONE,
9086            CALL_AUTO_RETRY,
9087            DOCK_AUDIO_MEDIA_ENABLED,
9088            ENCODED_SURROUND_OUTPUT,
9089            LOW_POWER_MODE_TRIGGER_LEVEL
9090        };
9091
9092        // Populated lazily, guarded by class object:
9093        private static NameValueCache sNameValueCache = new NameValueCache(
9094                    CONTENT_URI,
9095                    CALL_METHOD_GET_GLOBAL,
9096                    CALL_METHOD_PUT_GLOBAL);
9097
9098        // Certain settings have been moved from global to the per-user secure namespace
9099        private static final HashSet<String> MOVED_TO_SECURE;
9100        static {
9101            MOVED_TO_SECURE = new HashSet<String>(1);
9102            MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
9103        }
9104
9105        /** @hide */
9106        public static void getMovedToSecureSettings(Set<String> outKeySet) {
9107            outKeySet.addAll(MOVED_TO_SECURE);
9108        }
9109
9110        /**
9111         * Look up a name in the database.
9112         * @param resolver to access the database with
9113         * @param name to look up in the table
9114         * @return the corresponding value, or null if not present
9115         */
9116        public static String getString(ContentResolver resolver, String name) {
9117            return getStringForUser(resolver, name, UserHandle.myUserId());
9118        }
9119
9120        /** @hide */
9121        public static String getStringForUser(ContentResolver resolver, String name,
9122                int userHandle) {
9123            if (MOVED_TO_SECURE.contains(name)) {
9124                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
9125                        + " to android.provider.Settings.Secure, returning read-only value.");
9126                return Secure.getStringForUser(resolver, name, userHandle);
9127            }
9128            return sNameValueCache.getStringForUser(resolver, name, userHandle);
9129        }
9130
9131        /**
9132         * Store a name/value pair into the database.
9133         * @param resolver to access the database with
9134         * @param name to store
9135         * @param value to associate with the name
9136         * @return true if the value was set, false on database errors
9137         */
9138        public static boolean putString(ContentResolver resolver,
9139                String name, String value) {
9140            return putStringForUser(resolver, name, value, UserHandle.myUserId());
9141        }
9142
9143        /** @hide */
9144        public static boolean putStringForUser(ContentResolver resolver,
9145                String name, String value, int userHandle) {
9146            if (LOCAL_LOGV) {
9147                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
9148                        + " for " + userHandle);
9149            }
9150            // Global and Secure have the same access policy so we can forward writes
9151            if (MOVED_TO_SECURE.contains(name)) {
9152                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
9153                        + " to android.provider.Settings.Secure, value is unchanged.");
9154                return Secure.putStringForUser(resolver, name, value, userHandle);
9155            }
9156            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
9157        }
9158
9159        /**
9160         * Construct the content URI for a particular name/value pair,
9161         * useful for monitoring changes with a ContentObserver.
9162         * @param name to look up in the table
9163         * @return the corresponding content URI, or null if not present
9164         */
9165        public static Uri getUriFor(String name) {
9166            return getUriFor(CONTENT_URI, name);
9167        }
9168
9169        /**
9170         * Convenience function for retrieving a single secure settings value
9171         * as an integer.  Note that internally setting values are always
9172         * stored as strings; this function converts the string to an integer
9173         * for you.  The default value will be returned if the setting is
9174         * not defined or not an integer.
9175         *
9176         * @param cr The ContentResolver to access.
9177         * @param name The name of the setting to retrieve.
9178         * @param def Value to return if the setting is not defined.
9179         *
9180         * @return The setting's current value, or 'def' if it is not defined
9181         * or not a valid integer.
9182         */
9183        public static int getInt(ContentResolver cr, String name, int def) {
9184            String v = getString(cr, name);
9185            try {
9186                return v != null ? Integer.parseInt(v) : def;
9187            } catch (NumberFormatException e) {
9188                return def;
9189            }
9190        }
9191
9192        /**
9193         * Convenience function for retrieving a single secure settings value
9194         * as an integer.  Note that internally setting values are always
9195         * stored as strings; this function converts the string to an integer
9196         * for you.
9197         * <p>
9198         * This version does not take a default value.  If the setting has not
9199         * been set, or the string value is not a number,
9200         * it throws {@link SettingNotFoundException}.
9201         *
9202         * @param cr The ContentResolver to access.
9203         * @param name The name of the setting to retrieve.
9204         *
9205         * @throws SettingNotFoundException Thrown if a setting by the given
9206         * name can't be found or the setting value is not an integer.
9207         *
9208         * @return The setting's current value.
9209         */
9210        public static int getInt(ContentResolver cr, String name)
9211                throws SettingNotFoundException {
9212            String v = getString(cr, name);
9213            try {
9214                return Integer.parseInt(v);
9215            } catch (NumberFormatException e) {
9216                throw new SettingNotFoundException(name);
9217            }
9218        }
9219
9220        /**
9221         * Convenience function for updating a single settings value as an
9222         * integer. This will either create a new entry in the table if the
9223         * given name does not exist, or modify the value of the existing row
9224         * with that name.  Note that internally setting values are always
9225         * stored as strings, so this function converts the given value to a
9226         * string before storing it.
9227         *
9228         * @param cr The ContentResolver to access.
9229         * @param name The name of the setting to modify.
9230         * @param value The new value for the setting.
9231         * @return true if the value was set, false on database errors
9232         */
9233        public static boolean putInt(ContentResolver cr, String name, int value) {
9234            return putString(cr, name, Integer.toString(value));
9235        }
9236
9237        /**
9238         * Convenience function for retrieving a single secure settings value
9239         * as a {@code long}.  Note that internally setting values are always
9240         * stored as strings; this function converts the string to a {@code long}
9241         * for you.  The default value will be returned if the setting is
9242         * not defined or not a {@code long}.
9243         *
9244         * @param cr The ContentResolver to access.
9245         * @param name The name of the setting to retrieve.
9246         * @param def Value to return if the setting is not defined.
9247         *
9248         * @return The setting's current value, or 'def' if it is not defined
9249         * or not a valid {@code long}.
9250         */
9251        public static long getLong(ContentResolver cr, String name, long def) {
9252            String valString = getString(cr, name);
9253            long value;
9254            try {
9255                value = valString != null ? Long.parseLong(valString) : def;
9256            } catch (NumberFormatException e) {
9257                value = def;
9258            }
9259            return value;
9260        }
9261
9262        /**
9263         * Convenience function for retrieving a single secure settings value
9264         * as a {@code long}.  Note that internally setting values are always
9265         * stored as strings; this function converts the string to a {@code long}
9266         * for you.
9267         * <p>
9268         * This version does not take a default value.  If the setting has not
9269         * been set, or the string value is not a number,
9270         * it throws {@link SettingNotFoundException}.
9271         *
9272         * @param cr The ContentResolver to access.
9273         * @param name The name of the setting to retrieve.
9274         *
9275         * @return The setting's current value.
9276         * @throws SettingNotFoundException Thrown if a setting by the given
9277         * name can't be found or the setting value is not an integer.
9278         */
9279        public static long getLong(ContentResolver cr, String name)
9280                throws SettingNotFoundException {
9281            String valString = getString(cr, name);
9282            try {
9283                return Long.parseLong(valString);
9284            } catch (NumberFormatException e) {
9285                throw new SettingNotFoundException(name);
9286            }
9287        }
9288
9289        /**
9290         * Convenience function for updating a secure settings value as a long
9291         * integer. This will either create a new entry in the table if the
9292         * given name does not exist, or modify the value of the existing row
9293         * with that name.  Note that internally setting values are always
9294         * stored as strings, so this function converts the given value to a
9295         * string before storing it.
9296         *
9297         * @param cr The ContentResolver to access.
9298         * @param name The name of the setting to modify.
9299         * @param value The new value for the setting.
9300         * @return true if the value was set, false on database errors
9301         */
9302        public static boolean putLong(ContentResolver cr, String name, long value) {
9303            return putString(cr, name, Long.toString(value));
9304        }
9305
9306        /**
9307         * Convenience function for retrieving a single secure settings value
9308         * as a floating point number.  Note that internally setting values are
9309         * always stored as strings; this function converts the string to an
9310         * float for you. The default value will be returned if the setting
9311         * is not defined or not a valid float.
9312         *
9313         * @param cr The ContentResolver to access.
9314         * @param name The name of the setting to retrieve.
9315         * @param def Value to return if the setting is not defined.
9316         *
9317         * @return The setting's current value, or 'def' if it is not defined
9318         * or not a valid float.
9319         */
9320        public static float getFloat(ContentResolver cr, String name, float def) {
9321            String v = getString(cr, name);
9322            try {
9323                return v != null ? Float.parseFloat(v) : def;
9324            } catch (NumberFormatException e) {
9325                return def;
9326            }
9327        }
9328
9329        /**
9330         * Convenience function for retrieving a single secure settings value
9331         * as a float.  Note that internally setting values are always
9332         * stored as strings; this function converts the string to a float
9333         * for you.
9334         * <p>
9335         * This version does not take a default value.  If the setting has not
9336         * been set, or the string value is not a number,
9337         * it throws {@link SettingNotFoundException}.
9338         *
9339         * @param cr The ContentResolver to access.
9340         * @param name The name of the setting to retrieve.
9341         *
9342         * @throws SettingNotFoundException Thrown if a setting by the given
9343         * name can't be found or the setting value is not a float.
9344         *
9345         * @return The setting's current value.
9346         */
9347        public static float getFloat(ContentResolver cr, String name)
9348                throws SettingNotFoundException {
9349            String v = getString(cr, name);
9350            if (v == null) {
9351                throw new SettingNotFoundException(name);
9352            }
9353            try {
9354                return Float.parseFloat(v);
9355            } catch (NumberFormatException e) {
9356                throw new SettingNotFoundException(name);
9357            }
9358        }
9359
9360        /**
9361         * Convenience function for updating a single settings value as a
9362         * floating point number. This will either create a new entry in the
9363         * table if the given name does not exist, or modify the value of the
9364         * existing row with that name.  Note that internally setting values
9365         * are always stored as strings, so this function converts the given
9366         * value to a string before storing it.
9367         *
9368         * @param cr The ContentResolver to access.
9369         * @param name The name of the setting to modify.
9370         * @param value The new value for the setting.
9371         * @return true if the value was set, false on database errors
9372         */
9373        public static boolean putFloat(ContentResolver cr, String name, float value) {
9374            return putString(cr, name, Float.toString(value));
9375        }
9376
9377
9378        /**
9379          * Subscription to be used for voice call on a multi sim device. The supported values
9380          * are 0 = SUB1, 1 = SUB2 and etc.
9381          * @hide
9382          */
9383        public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
9384
9385        /**
9386          * Used to provide option to user to select subscription during dial.
9387          * The supported values are 0 = disable or 1 = enable prompt.
9388          * @hide
9389          */
9390        public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
9391
9392        /**
9393          * Subscription to be used for data call on a multi sim device. The supported values
9394          * are 0 = SUB1, 1 = SUB2 and etc.
9395          * @hide
9396          */
9397        public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
9398
9399        /**
9400          * Subscription to be used for SMS on a multi sim device. The supported values
9401          * are 0 = SUB1, 1 = SUB2 and etc.
9402          * @hide
9403          */
9404        public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
9405
9406       /**
9407          * Used to provide option to user to select subscription during send SMS.
9408          * The value 1 - enable, 0 - disable
9409          * @hide
9410          */
9411        public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
9412
9413
9414
9415        /** User preferred subscriptions setting.
9416          * This holds the details of the user selected subscription from the card and
9417          * the activation status. Each settings string have the coma separated values
9418          * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
9419          * @hide
9420         */
9421        public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
9422                "user_preferred_sub2","user_preferred_sub3"};
9423
9424        /**
9425         * Whether to enable new contacts aggregator or not.
9426         * The value 1 - enable, 0 - disable
9427         * @hide
9428         */
9429        public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
9430
9431        /**
9432         * Whether to enable contacts metadata syncing or not
9433         * The value 1 - enable, 0 - disable
9434         *
9435         * @removed
9436         */
9437        @Deprecated
9438        public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
9439
9440        /**
9441         * Whether to enable contacts metadata syncing or not
9442         * The value 1 - enable, 0 - disable
9443         */
9444        public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
9445
9446        /**
9447         * Whether to enable cellular on boot.
9448         * The value 1 - enable, 0 - disable
9449         * @hide
9450         */
9451        public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
9452
9453        /**
9454         * The maximum allowed notification enqueue rate in Hertz.
9455         *
9456         * Should be a float, and includes both posts and updates.
9457         * @hide
9458         */
9459        public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate";
9460
9461        /**
9462         * Whether cell is enabled/disabled
9463         * @hide
9464         */
9465        public static final String CELL_ON = "cell_on";
9466
9467        /**
9468         * Whether to show the high temperature warning notification.
9469         * @hide
9470         */
9471        public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
9472
9473        /**
9474         * Temperature at which the high temperature warning notification should be shown.
9475         * @hide
9476         */
9477        public static final String WARNING_TEMPERATURE = "warning_temperature";
9478
9479        /**
9480         * Whether the diskstats logging task is enabled/disabled.
9481         * @hide
9482         */
9483        public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging";
9484    }
9485
9486    /**
9487     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
9488     * Intent URL, allowing it to be either a web page or a particular
9489     * application activity.
9490     *
9491     * @hide
9492     */
9493    public static final class Bookmarks implements BaseColumns
9494    {
9495        private static final String TAG = "Bookmarks";
9496
9497        /**
9498         * The content:// style URL for this table
9499         */
9500        public static final Uri CONTENT_URI =
9501            Uri.parse("content://" + AUTHORITY + "/bookmarks");
9502
9503        /**
9504         * The row ID.
9505         * <p>Type: INTEGER</p>
9506         */
9507        public static final String ID = "_id";
9508
9509        /**
9510         * Descriptive name of the bookmark that can be displayed to the user.
9511         * If this is empty, the title should be resolved at display time (use
9512         * {@link #getTitle(Context, Cursor)} any time you want to display the
9513         * title of a bookmark.)
9514         * <P>
9515         * Type: TEXT
9516         * </P>
9517         */
9518        public static final String TITLE = "title";
9519
9520        /**
9521         * Arbitrary string (displayed to the user) that allows bookmarks to be
9522         * organized into categories.  There are some special names for
9523         * standard folders, which all start with '@'.  The label displayed for
9524         * the folder changes with the locale (via {@link #getLabelForFolder}) but
9525         * the folder name does not change so you can consistently query for
9526         * the folder regardless of the current locale.
9527         *
9528         * <P>Type: TEXT</P>
9529         *
9530         */
9531        public static final String FOLDER = "folder";
9532
9533        /**
9534         * The Intent URL of the bookmark, describing what it points to.  This
9535         * value is given to {@link android.content.Intent#getIntent} to create
9536         * an Intent that can be launched.
9537         * <P>Type: TEXT</P>
9538         */
9539        public static final String INTENT = "intent";
9540
9541        /**
9542         * Optional shortcut character associated with this bookmark.
9543         * <P>Type: INTEGER</P>
9544         */
9545        public static final String SHORTCUT = "shortcut";
9546
9547        /**
9548         * The order in which the bookmark should be displayed
9549         * <P>Type: INTEGER</P>
9550         */
9551        public static final String ORDERING = "ordering";
9552
9553        private static final String[] sIntentProjection = { INTENT };
9554        private static final String[] sShortcutProjection = { ID, SHORTCUT };
9555        private static final String sShortcutSelection = SHORTCUT + "=?";
9556
9557        /**
9558         * Convenience function to retrieve the bookmarked Intent for a
9559         * particular shortcut key.
9560         *
9561         * @param cr The ContentResolver to query.
9562         * @param shortcut The shortcut key.
9563         *
9564         * @return Intent The bookmarked URL, or null if there is no bookmark
9565         *         matching the given shortcut.
9566         */
9567        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
9568        {
9569            Intent intent = null;
9570
9571            Cursor c = cr.query(CONTENT_URI,
9572                    sIntentProjection, sShortcutSelection,
9573                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
9574            // Keep trying until we find a valid shortcut
9575            try {
9576                while (intent == null && c.moveToNext()) {
9577                    try {
9578                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
9579                        intent = Intent.parseUri(intentURI, 0);
9580                    } catch (java.net.URISyntaxException e) {
9581                        // The stored URL is bad...  ignore it.
9582                    } catch (IllegalArgumentException e) {
9583                        // Column not found
9584                        Log.w(TAG, "Intent column not found", e);
9585                    }
9586                }
9587            } finally {
9588                if (c != null) c.close();
9589            }
9590
9591            return intent;
9592        }
9593
9594        /**
9595         * Add a new bookmark to the system.
9596         *
9597         * @param cr The ContentResolver to query.
9598         * @param intent The desired target of the bookmark.
9599         * @param title Bookmark title that is shown to the user; null if none
9600         *            or it should be resolved to the intent's title.
9601         * @param folder Folder in which to place the bookmark; null if none.
9602         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
9603         *            this is non-zero and there is an existing bookmark entry
9604         *            with this same shortcut, then that existing shortcut is
9605         *            cleared (the bookmark is not removed).
9606         * @return The unique content URL for the new bookmark entry.
9607         */
9608        public static Uri add(ContentResolver cr,
9609                                           Intent intent,
9610                                           String title,
9611                                           String folder,
9612                                           char shortcut,
9613                                           int ordering)
9614        {
9615            // If a shortcut is supplied, and it is already defined for
9616            // another bookmark, then remove the old definition.
9617            if (shortcut != 0) {
9618                cr.delete(CONTENT_URI, sShortcutSelection,
9619                        new String[] { String.valueOf((int) shortcut) });
9620            }
9621
9622            ContentValues values = new ContentValues();
9623            if (title != null) values.put(TITLE, title);
9624            if (folder != null) values.put(FOLDER, folder);
9625            values.put(INTENT, intent.toUri(0));
9626            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
9627            values.put(ORDERING, ordering);
9628            return cr.insert(CONTENT_URI, values);
9629        }
9630
9631        /**
9632         * Return the folder name as it should be displayed to the user.  This
9633         * takes care of localizing special folders.
9634         *
9635         * @param r Resources object for current locale; only need access to
9636         *          system resources.
9637         * @param folder The value found in the {@link #FOLDER} column.
9638         *
9639         * @return CharSequence The label for this folder that should be shown
9640         *         to the user.
9641         */
9642        public static CharSequence getLabelForFolder(Resources r, String folder) {
9643            return folder;
9644        }
9645
9646        /**
9647         * Return the title as it should be displayed to the user. This takes
9648         * care of localizing bookmarks that point to activities.
9649         *
9650         * @param context A context.
9651         * @param cursor A cursor pointing to the row whose title should be
9652         *        returned. The cursor must contain at least the {@link #TITLE}
9653         *        and {@link #INTENT} columns.
9654         * @return A title that is localized and can be displayed to the user,
9655         *         or the empty string if one could not be found.
9656         */
9657        public static CharSequence getTitle(Context context, Cursor cursor) {
9658            int titleColumn = cursor.getColumnIndex(TITLE);
9659            int intentColumn = cursor.getColumnIndex(INTENT);
9660            if (titleColumn == -1 || intentColumn == -1) {
9661                throw new IllegalArgumentException(
9662                        "The cursor must contain the TITLE and INTENT columns.");
9663            }
9664
9665            String title = cursor.getString(titleColumn);
9666            if (!TextUtils.isEmpty(title)) {
9667                return title;
9668            }
9669
9670            String intentUri = cursor.getString(intentColumn);
9671            if (TextUtils.isEmpty(intentUri)) {
9672                return "";
9673            }
9674
9675            Intent intent;
9676            try {
9677                intent = Intent.parseUri(intentUri, 0);
9678            } catch (URISyntaxException e) {
9679                return "";
9680            }
9681
9682            PackageManager packageManager = context.getPackageManager();
9683            ResolveInfo info = packageManager.resolveActivity(intent, 0);
9684            return info != null ? info.loadLabel(packageManager) : "";
9685        }
9686    }
9687
9688    /**
9689     * Returns the device ID that we should use when connecting to the mobile gtalk server.
9690     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
9691     * from the GoogleLoginService.
9692     *
9693     * @param androidId The Android ID for this device.
9694     * @return The device ID that should be used when connecting to the mobile gtalk server.
9695     * @hide
9696     */
9697    public static String getGTalkDeviceId(long androidId) {
9698        return "android-" + Long.toHexString(androidId);
9699    }
9700
9701    private static final String[] PM_WRITE_SETTINGS = {
9702        android.Manifest.permission.WRITE_SETTINGS
9703    };
9704    private static final String[] PM_CHANGE_NETWORK_STATE = {
9705        android.Manifest.permission.CHANGE_NETWORK_STATE,
9706        android.Manifest.permission.WRITE_SETTINGS
9707    };
9708    private static final String[] PM_SYSTEM_ALERT_WINDOW = {
9709        android.Manifest.permission.SYSTEM_ALERT_WINDOW
9710    };
9711
9712    /**
9713     * Performs a strict and comprehensive check of whether a calling package is allowed to
9714     * write/modify system settings, as the condition differs for pre-M, M+, and
9715     * privileged/preinstalled apps. If the provided uid does not match the
9716     * callingPackage, a negative result will be returned.
9717     * @hide
9718     */
9719    public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
9720            String callingPackage, boolean throwException) {
9721        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9722                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
9723                PM_WRITE_SETTINGS, false);
9724    }
9725
9726    /**
9727     * Performs a strict and comprehensive check of whether a calling package is allowed to
9728     * write/modify system settings, as the condition differs for pre-M, M+, and
9729     * privileged/preinstalled apps. If the provided uid does not match the
9730     * callingPackage, a negative result will be returned. The caller is expected to have
9731     * the WRITE_SETTINGS permission declared.
9732     *
9733     * Note: if the check is successful, the operation of this app will be updated to the
9734     * current time.
9735     * @hide
9736     */
9737    public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
9738            String callingPackage, boolean throwException) {
9739        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9740                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
9741                PM_WRITE_SETTINGS, true);
9742    }
9743
9744    /**
9745     * Performs a strict and comprehensive check of whether a calling package is allowed to
9746     * change the state of network, as the condition differs for pre-M, M+, and
9747     * privileged/preinstalled apps. The caller is expected to have either the
9748     * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
9749     * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
9750     * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
9751     * permission and cannot be revoked. See http://b/23597341
9752     *
9753     * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
9754     * of this app will be updated to the current time.
9755     * @hide
9756     */
9757    public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
9758            String callingPackage, boolean throwException) {
9759        if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
9760                == PackageManager.PERMISSION_GRANTED) {
9761            return true;
9762        }
9763        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9764                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
9765                PM_CHANGE_NETWORK_STATE, true);
9766    }
9767
9768    /**
9769     * Performs a strict and comprehensive check of whether a calling package is allowed to
9770     * draw on top of other apps, as the conditions differs for pre-M, M+, and
9771     * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
9772     * a negative result will be returned.
9773     * @hide
9774     */
9775    public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
9776            String callingPackage, boolean throwException) {
9777        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9778                callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
9779                PM_SYSTEM_ALERT_WINDOW, false);
9780    }
9781
9782    /**
9783     * Performs a strict and comprehensive check of whether a calling package is allowed to
9784     * draw on top of other apps, as the conditions differs for pre-M, M+, and
9785     * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
9786     * a negative result will be returned.
9787     *
9788     * Note: if the check is successful, the operation of this app will be updated to the
9789     * current time.
9790     * @hide
9791     */
9792    public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
9793            callingPackage, boolean throwException) {
9794        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9795                callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
9796                PM_SYSTEM_ALERT_WINDOW, true);
9797    }
9798
9799    /**
9800     * Helper method to perform a general and comprehensive check of whether an operation that is
9801     * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
9802     * OP_WRITE_SETTINGS
9803     * @hide
9804     */
9805    public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
9806            int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
9807            permissions, boolean makeNote) {
9808        if (callingPackage == null) {
9809            return false;
9810        }
9811
9812        AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
9813        int mode = AppOpsManager.MODE_DEFAULT;
9814        if (makeNote) {
9815            mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
9816        } else {
9817            mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
9818        }
9819
9820        switch (mode) {
9821            case AppOpsManager.MODE_ALLOWED:
9822                return true;
9823
9824            case AppOpsManager.MODE_DEFAULT:
9825                // this is the default operating mode after an app's installation
9826                // In this case we will check all associated static permission to see
9827                // if it is granted during install time.
9828                for (String permission : permissions) {
9829                    if (context.checkCallingOrSelfPermission(permission) == PackageManager
9830                            .PERMISSION_GRANTED) {
9831                        // if either of the permissions are granted, we will allow it
9832                        return true;
9833                    }
9834                }
9835
9836            default:
9837                // this is for all other cases trickled down here...
9838                if (!throwException) {
9839                    return false;
9840                }
9841        }
9842
9843        // prepare string to throw SecurityException
9844        StringBuilder exceptionMessage = new StringBuilder();
9845        exceptionMessage.append(callingPackage);
9846        exceptionMessage.append(" was not granted ");
9847        if (permissions.length > 1) {
9848            exceptionMessage.append(" either of these permissions: ");
9849        } else {
9850            exceptionMessage.append(" this permission: ");
9851        }
9852        for (int i = 0; i < permissions.length; i++) {
9853            exceptionMessage.append(permissions[i]);
9854            exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
9855        }
9856
9857        throw new SecurityException(exceptionMessage.toString());
9858    }
9859
9860    /**
9861     * Retrieves a correponding package name for a given uid. It will query all
9862     * packages that are associated with the given uid, but it will return only
9863     * the zeroth result.
9864     * Note: If package could not be found, a null is returned.
9865     * @hide
9866     */
9867    public static String getPackageNameForUid(Context context, int uid) {
9868        String[] packages = context.getPackageManager().getPackagesForUid(uid);
9869        if (packages == null) {
9870            return null;
9871        }
9872        return packages[0];
9873    }
9874}
9875