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