Settings.java revision b92aa5bdfde63e56f1e1e63fbe913638c440ffba
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        };
6503
6504        /**
6505         * These entries are considered common between the personal and the managed profile,
6506         * since the managed profile doesn't get to change them.
6507         */
6508        private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
6509
6510        static {
6511            CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
6512            CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
6513            CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
6514            CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
6515            CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
6516            CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
6517            CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
6518            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE);
6519            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
6520            CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
6521            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
6522            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
6523        }
6524
6525        /** @hide */
6526        public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
6527            outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
6528        }
6529
6530        /**
6531         * Helper method for determining if a location provider is enabled.
6532         *
6533         * @param cr the content resolver to use
6534         * @param provider the location provider to query
6535         * @return true if the provider is enabled
6536         *
6537         * @deprecated use {@link #LOCATION_MODE} or
6538         *             {@link LocationManager#isProviderEnabled(String)}
6539         */
6540        @Deprecated
6541        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
6542            return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
6543        }
6544
6545        /**
6546         * Helper method for determining if a location provider is enabled.
6547         * @param cr the content resolver to use
6548         * @param provider the location provider to query
6549         * @param userId the userId to query
6550         * @return true if the provider is enabled
6551         * @deprecated use {@link #LOCATION_MODE} or
6552         *             {@link LocationManager#isProviderEnabled(String)}
6553         * @hide
6554         */
6555        @Deprecated
6556        public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
6557            String allowedProviders = Settings.Secure.getStringForUser(cr,
6558                    LOCATION_PROVIDERS_ALLOWED, userId);
6559            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
6560        }
6561
6562        /**
6563         * Thread-safe method for enabling or disabling a single location provider.
6564         * @param cr the content resolver to use
6565         * @param provider the location provider to enable or disable
6566         * @param enabled true if the provider should be enabled
6567         * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
6568         */
6569        @Deprecated
6570        public static final void setLocationProviderEnabled(ContentResolver cr,
6571                String provider, boolean enabled) {
6572            setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
6573        }
6574
6575        /**
6576         * Thread-safe method for enabling or disabling a single location provider.
6577         *
6578         * @param cr the content resolver to use
6579         * @param provider the location provider to enable or disable
6580         * @param enabled true if the provider should be enabled
6581         * @param userId the userId for which to enable/disable providers
6582         * @return true if the value was set, false on database errors
6583         * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
6584         *             {@link #LOCATION_MODE}
6585         * @hide
6586         */
6587        @Deprecated
6588        public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
6589                String provider, boolean enabled, int userId) {
6590            synchronized (mLocationSettingsLock) {
6591                // to ensure thread safety, we write the provider name with a '+' or '-'
6592                // and let the SettingsProvider handle it rather than reading and modifying
6593                // the list of enabled providers.
6594                if (enabled) {
6595                    provider = "+" + provider;
6596                } else {
6597                    provider = "-" + provider;
6598                }
6599                return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
6600                        userId);
6601            }
6602        }
6603
6604        /**
6605         * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
6606         */
6607        private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
6608            final int mode = getLocationModeForUser(cr, userId);
6609            return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
6610        }
6611
6612        /**
6613         * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
6614         */
6615        private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
6616            int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
6617                    LOCATION_MODE_HIGH_ACCURACY, userId);
6618            // Make sure that the previous mode is never "off". Otherwise the user won't be able to
6619            // turn on location any longer.
6620            if (mode == LOCATION_MODE_OFF) {
6621                mode = LOCATION_MODE_HIGH_ACCURACY;
6622            }
6623            return setLocationModeForUser(cr, mode, userId);
6624        }
6625
6626        /**
6627         * Thread-safe method for setting the location mode to one of
6628         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
6629         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
6630         *
6631         * @param cr the content resolver to use
6632         * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
6633         * @param userId the userId for which to change mode
6634         * @return true if the value was set, false on database errors
6635         *
6636         * @throws IllegalArgumentException if mode is not one of the supported values
6637         */
6638        private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
6639                int userId) {
6640            synchronized (mLocationSettingsLock) {
6641                boolean gps = false;
6642                boolean network = false;
6643                switch (mode) {
6644                    case LOCATION_MODE_PREVIOUS:
6645                        // Retrieve the actual mode and set to that mode.
6646                        return restoreLocationModeForUser(cr, userId);
6647                    case LOCATION_MODE_OFF:
6648                        saveLocationModeForUser(cr, userId);
6649                        break;
6650                    case LOCATION_MODE_SENSORS_ONLY:
6651                        gps = true;
6652                        break;
6653                    case LOCATION_MODE_BATTERY_SAVING:
6654                        network = true;
6655                        break;
6656                    case LOCATION_MODE_HIGH_ACCURACY:
6657                        gps = true;
6658                        network = true;
6659                        break;
6660                    default:
6661                        throw new IllegalArgumentException("Invalid location mode: " + mode);
6662                }
6663                // Note it's important that we set the NLP mode first. The Google implementation
6664                // of NLP clears its NLP consent setting any time it receives a
6665                // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
6666                // it shows an NLP consent dialog any time it receives the broadcast, NLP is
6667                // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
6668                // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
6669                // and 3) the receiver happened to complete before we enabled NLP, then the Google
6670                // NLP would detect the attempt to enable NLP and show a redundant NLP consent
6671                // dialog. Then the people who wrote the setup wizard would be sad.
6672                boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
6673                        cr, LocationManager.NETWORK_PROVIDER, network, userId);
6674                boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
6675                        cr, LocationManager.GPS_PROVIDER, gps, userId);
6676                return gpsSuccess && nlpSuccess;
6677            }
6678        }
6679
6680        /**
6681         * Thread-safe method for reading the location mode, returns one of
6682         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
6683         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
6684         *
6685         * @param cr the content resolver to use
6686         * @param userId the userId for which to read the mode
6687         * @return the location mode
6688         */
6689        private static final int getLocationModeForUser(ContentResolver cr, int userId) {
6690            synchronized (mLocationSettingsLock) {
6691                boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
6692                        cr, LocationManager.GPS_PROVIDER, userId);
6693                boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
6694                        cr, LocationManager.NETWORK_PROVIDER, userId);
6695                if (gpsEnabled && networkEnabled) {
6696                    return LOCATION_MODE_HIGH_ACCURACY;
6697                } else if (gpsEnabled) {
6698                    return LOCATION_MODE_SENSORS_ONLY;
6699                } else if (networkEnabled) {
6700                    return LOCATION_MODE_BATTERY_SAVING;
6701                } else {
6702                    return LOCATION_MODE_OFF;
6703                }
6704            }
6705        }
6706    }
6707
6708    /**
6709     * Global system settings, containing preferences that always apply identically
6710     * to all defined users.  Applications can read these but are not allowed to write;
6711     * like the "Secure" settings, these are for preferences that the user must
6712     * explicitly modify through the system UI or specialized APIs for those values.
6713     */
6714    public static final class Global extends NameValueTable {
6715        /**
6716         * The content:// style URL for global secure settings items.  Not public.
6717         */
6718        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
6719
6720        /**
6721         * Whether users are allowed to add more users or guest from lockscreen.
6722         * <p>
6723         * Type: int
6724         * @hide
6725         */
6726        public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
6727
6728        /**
6729         * Setting whether the global gesture for enabling accessibility is enabled.
6730         * If this gesture is enabled the user will be able to perfrom it to enable
6731         * the accessibility state without visiting the settings app.
6732         * @hide
6733         */
6734        public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
6735                "enable_accessibility_global_gesture_enabled";
6736
6737        /**
6738         * Whether Airplane Mode is on.
6739         */
6740        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
6741
6742        /**
6743         * Whether Theater Mode is on.
6744         * {@hide}
6745         */
6746        @SystemApi
6747        public static final String THEATER_MODE_ON = "theater_mode_on";
6748
6749        /**
6750         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
6751         */
6752        public static final String RADIO_BLUETOOTH = "bluetooth";
6753
6754        /**
6755         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
6756         */
6757        public static final String RADIO_WIFI = "wifi";
6758
6759        /**
6760         * {@hide}
6761         */
6762        public static final String RADIO_WIMAX = "wimax";
6763        /**
6764         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
6765         */
6766        public static final String RADIO_CELL = "cell";
6767
6768        /**
6769         * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
6770         */
6771        public static final String RADIO_NFC = "nfc";
6772
6773        /**
6774         * A comma separated list of radios that need to be disabled when airplane mode
6775         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
6776         * included in the comma separated list.
6777         */
6778        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
6779
6780        /**
6781         * A comma separated list of radios that should to be disabled when airplane mode
6782         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
6783         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
6784         * will be turned off when entering airplane mode, but the user will be able to reenable
6785         * Wifi in the Settings app.
6786         *
6787         * {@hide}
6788         */
6789        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
6790
6791        /**
6792         * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
6793         * See {@link android.bluetooth.BluetoothProfile}.
6794         * {@hide}
6795         */
6796        public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
6797
6798        /**
6799         * A semi-colon separated list of Bluetooth interoperability workarounds.
6800         * Each entry is a partial Bluetooth device address string and an integer representing
6801         * the feature to be disabled, separated by a comma. The integer must correspond
6802         * to a interoperability feature as defined in "interop.h" in /system/bt.
6803         * <p>
6804         * Example: <br/>
6805         *   "00:11:22,0;01:02:03:04,2"
6806         * @hide
6807         */
6808       public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list";
6809
6810        /**
6811         * The policy for deciding when Wi-Fi should go to sleep (which will in
6812         * turn switch to using the mobile data as an Internet connection).
6813         * <p>
6814         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
6815         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
6816         * {@link #WIFI_SLEEP_POLICY_NEVER}.
6817         */
6818        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
6819
6820        /**
6821         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
6822         * policy, which is to sleep shortly after the turning off
6823         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
6824         */
6825        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
6826
6827        /**
6828         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
6829         * the device is on battery, and never go to sleep when the device is
6830         * plugged in.
6831         */
6832        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
6833
6834        /**
6835         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
6836         */
6837        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
6838
6839        /**
6840         * Value to specify if the user prefers the date, time and time zone
6841         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
6842         */
6843        public static final String AUTO_TIME = "auto_time";
6844
6845        /**
6846         * Value to specify if the user prefers the time zone
6847         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
6848         */
6849        public static final String AUTO_TIME_ZONE = "auto_time_zone";
6850
6851        /**
6852         * URI for the car dock "in" event sound.
6853         * @hide
6854         */
6855        public static final String CAR_DOCK_SOUND = "car_dock_sound";
6856
6857        /**
6858         * URI for the car dock "out" event sound.
6859         * @hide
6860         */
6861        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
6862
6863        /**
6864         * URI for the desk dock "in" event sound.
6865         * @hide
6866         */
6867        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
6868
6869        /**
6870         * URI for the desk dock "out" event sound.
6871         * @hide
6872         */
6873        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
6874
6875        /**
6876         * Whether to play a sound for dock events.
6877         * @hide
6878         */
6879        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
6880
6881        /**
6882         * URI for the "device locked" (keyguard shown) sound.
6883         * @hide
6884         */
6885        public static final String LOCK_SOUND = "lock_sound";
6886
6887        /**
6888         * URI for the "device unlocked" sound.
6889         * @hide
6890         */
6891        public static final String UNLOCK_SOUND = "unlock_sound";
6892
6893        /**
6894         * URI for the "device is trusted" sound, which is played when the device enters the trusted
6895         * state without unlocking.
6896         * @hide
6897         */
6898        public static final String TRUSTED_SOUND = "trusted_sound";
6899
6900        /**
6901         * URI for the low battery sound file.
6902         * @hide
6903         */
6904        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
6905
6906        /**
6907         * Whether to play a sound for low-battery alerts.
6908         * @hide
6909         */
6910        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
6911
6912        /**
6913         * URI for the "wireless charging started" sound.
6914         * @hide
6915         */
6916        public static final String WIRELESS_CHARGING_STARTED_SOUND =
6917                "wireless_charging_started_sound";
6918
6919        /**
6920         * Whether to play a sound for charging events.
6921         * @hide
6922         */
6923        public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
6924
6925        /**
6926         * Whether we keep the device on while the device is plugged in.
6927         * Supported values are:
6928         * <ul>
6929         * <li>{@code 0} to never stay on while plugged in</li>
6930         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
6931         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
6932         * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
6933         * </ul>
6934         * These values can be OR-ed together.
6935         */
6936        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
6937
6938        /**
6939         * When the user has enable the option to have a "bug report" command
6940         * in the power menu.
6941         * @hide
6942         */
6943        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
6944
6945        /**
6946         * Whether ADB is enabled.
6947         */
6948        public static final String ADB_ENABLED = "adb_enabled";
6949
6950        /**
6951         * Whether Views are allowed to save their attribute data.
6952         * @hide
6953         */
6954        public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
6955
6956        /**
6957         * Whether assisted GPS should be enabled or not.
6958         * @hide
6959         */
6960        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
6961
6962        /**
6963         * Whether bluetooth is enabled/disabled
6964         * 0=disabled. 1=enabled.
6965         */
6966        public static final String BLUETOOTH_ON = "bluetooth_on";
6967
6968        /**
6969         * CDMA Cell Broadcast SMS
6970         *                            0 = CDMA Cell Broadcast SMS disabled
6971         *                            1 = CDMA Cell Broadcast SMS enabled
6972         * @hide
6973         */
6974        public static final String CDMA_CELL_BROADCAST_SMS =
6975                "cdma_cell_broadcast_sms";
6976
6977        /**
6978         * The CDMA roaming mode 0 = Home Networks, CDMA default
6979         *                       1 = Roaming on Affiliated networks
6980         *                       2 = Roaming on any networks
6981         * @hide
6982         */
6983        public static final String CDMA_ROAMING_MODE = "roaming_settings";
6984
6985        /**
6986         * The CDMA subscription mode 0 = RUIM/SIM (default)
6987         *                                1 = NV
6988         * @hide
6989         */
6990        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
6991
6992        /** Inactivity timeout to track mobile data activity.
6993        *
6994        * If set to a positive integer, it indicates the inactivity timeout value in seconds to
6995        * infer the data activity of mobile network. After a period of no activity on mobile
6996        * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
6997        * intent is fired to indicate a transition of network status from "active" to "idle". Any
6998        * subsequent activity on mobile networks triggers the firing of {@code
6999        * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
7000        *
7001        * Network activity refers to transmitting or receiving data on the network interfaces.
7002        *
7003        * Tracking is disabled if set to zero or negative value.
7004        *
7005        * @hide
7006        */
7007       public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
7008
7009       /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
7010        * but for Wifi network.
7011        * @hide
7012        */
7013       public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
7014
7015       /**
7016        * Whether or not data roaming is enabled. (0 = false, 1 = true)
7017        */
7018       public static final String DATA_ROAMING = "data_roaming";
7019
7020       /**
7021        * The value passed to a Mobile DataConnection via bringUp which defines the
7022        * number of retries to preform when setting up the initial connection. The default
7023        * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
7024        * @hide
7025        */
7026       public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
7027
7028       /**
7029        * Whether any package can be on external storage. When this is true, any
7030        * package, regardless of manifest values, is a candidate for installing
7031        * or moving onto external storage. (0 = false, 1 = true)
7032        * @hide
7033        */
7034       public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
7035
7036        /**
7037         * Whether any activity can be resized. When this is true, any
7038         * activity, regardless of manifest values, can be resized for multi-window.
7039         * (0 = false, 1 = true)
7040         * @hide
7041         */
7042        public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
7043                = "force_resizable_activities";
7044
7045        /**
7046         * Whether to enable experimental freeform support for windows.
7047         * @hide
7048         */
7049        public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
7050                = "enable_freeform_support";
7051
7052       /**
7053        * Whether user has enabled development settings.
7054        */
7055       public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
7056
7057       /**
7058        * Whether the device has been provisioned (0 = false, 1 = true).
7059        * <p>On a multiuser device with a separate system user, the screen may be locked
7060        * as soon as this is set to true and further activities cannot be launched on the
7061        * system user unless they are marked to show over keyguard.
7062        */
7063       public static final String DEVICE_PROVISIONED = "device_provisioned";
7064
7065       /**
7066        * Whether mobile data should be allowed while the device is being provisioned.
7067        * This allows the provisioning process to turn off mobile data before the user
7068        * has an opportunity to set things up, preventing other processes from burning
7069        * precious bytes before wifi is setup.
7070        * (0 = false, 1 = true)
7071        * @hide
7072        */
7073       public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED =
7074               "device_provisioning_mobile_data";
7075
7076       /**
7077        * The saved value for WindowManagerService.setForcedDisplaySize().
7078        * Two integers separated by a comma.  If unset, then use the real display size.
7079        * @hide
7080        */
7081       public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
7082
7083       /**
7084        * The saved value for WindowManagerService.setForcedDisplayScalingMode().
7085        * 0 or unset if scaling is automatic, 1 if scaling is disabled.
7086        * @hide
7087        */
7088       public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
7089
7090       /**
7091        * The maximum size, in bytes, of a download that the download manager will transfer over
7092        * a non-wifi connection.
7093        * @hide
7094        */
7095       public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
7096               "download_manager_max_bytes_over_mobile";
7097
7098       /**
7099        * The recommended maximum size, in bytes, of a download that the download manager should
7100        * transfer over a non-wifi connection. Over this size, the use will be warned, but will
7101        * have the option to start the download over the mobile connection anyway.
7102        * @hide
7103        */
7104       public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
7105               "download_manager_recommended_max_bytes_over_mobile";
7106
7107       /**
7108        * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
7109        */
7110       @Deprecated
7111       public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
7112
7113       /**
7114        * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
7115        * sent or processed. (0 = false, 1 = true)
7116        * @hide
7117        */
7118       public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
7119
7120       /**
7121        * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted,
7122        * and the output is redirected to AV Receiver connected via
7123        * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}.
7124        * @hide
7125        */
7126       public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled";
7127
7128       /**
7129        * Whether TV will automatically turn on upon reception of the CEC command
7130        * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
7131        * @hide
7132        */
7133       public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
7134               "hdmi_control_auto_wakeup_enabled";
7135
7136       /**
7137        * Whether TV will also turn off other CEC devices when it goes to standby mode.
7138        * (0 = false, 1 = true)
7139        * @hide
7140        */
7141       public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
7142               "hdmi_control_auto_device_off_enabled";
7143
7144       /**
7145        * Whether TV will switch to MHL port when a mobile device is plugged in.
7146        * (0 = false, 1 = true)
7147        * @hide
7148        */
7149       public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
7150
7151       /**
7152        * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
7153        * @hide
7154        */
7155       public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
7156
7157       /**
7158        * Whether mobile data connections are allowed by the user.  See
7159        * ConnectivityManager for more info.
7160        * @hide
7161        */
7162       public static final String MOBILE_DATA = "mobile_data";
7163
7164       /**
7165        * Whether the mobile data connection should remain active even when higher
7166        * priority networks like WiFi are active, to help make network switching faster.
7167        *
7168        * See ConnectivityService for more info.
7169        *
7170        * (0 = disabled, 1 = enabled)
7171        * @hide
7172        */
7173       public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
7174
7175       /** {@hide} */
7176       public static final String NETSTATS_ENABLED = "netstats_enabled";
7177       /** {@hide} */
7178       public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
7179       /** {@hide} */
7180       public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
7181       /** {@hide} */
7182       public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
7183       /** {@hide} */
7184       public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
7185
7186       /** {@hide} */
7187       public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
7188       /** {@hide} */
7189       public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
7190       /** {@hide} */
7191       public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
7192       /** {@hide} */
7193       public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
7194
7195       /** {@hide} */
7196       public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
7197       /** {@hide} */
7198       public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
7199       /** {@hide} */
7200       public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
7201       /** {@hide} */
7202       public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
7203
7204       /** {@hide} */
7205       public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
7206       /** {@hide} */
7207       public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
7208       /** {@hide} */
7209       public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
7210       /** {@hide} */
7211       public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
7212
7213       /**
7214        * User preference for which network(s) should be used. Only the
7215        * connectivity service should touch this.
7216        */
7217       public static final String NETWORK_PREFERENCE = "network_preference";
7218
7219       /**
7220        * Which package name to use for network scoring. If null, or if the package is not a valid
7221        * scorer app, external network scores will neither be requested nor accepted.
7222        * @hide
7223        */
7224       public static final String NETWORK_SCORER_APP = "network_scorer_app";
7225
7226       /**
7227        * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
7228        * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
7229        * exceeded.
7230        * @hide
7231        */
7232       public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
7233
7234       /**
7235        * The length of time in milli-seconds that automatic small adjustments to
7236        * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
7237        * @hide
7238        */
7239       public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
7240
7241       /** Preferred NTP server. {@hide} */
7242       public static final String NTP_SERVER = "ntp_server";
7243       /** Timeout in milliseconds to wait for NTP server. {@hide} */
7244       public static final String NTP_TIMEOUT = "ntp_timeout";
7245
7246       /** {@hide} */
7247       public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
7248
7249       /**
7250        * Sample validity in seconds to configure for the system DNS resolver.
7251        * {@hide}
7252        */
7253       public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS =
7254               "dns_resolver_sample_validity_seconds";
7255
7256       /**
7257        * Success threshold in percent for use with the system DNS resolver.
7258        * {@hide}
7259        */
7260       public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT =
7261                "dns_resolver_success_threshold_percent";
7262
7263       /**
7264        * Minimum number of samples needed for statistics to be considered meaningful in the
7265        * system DNS resolver.
7266        * {@hide}
7267        */
7268       public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples";
7269
7270       /**
7271        * Maximum number taken into account for statistics purposes in the system DNS resolver.
7272        * {@hide}
7273        */
7274       public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples";
7275
7276       /**
7277        * Whether to disable the automatic scheduling of system updates.
7278        * 1 = system updates won't be automatically scheduled (will always
7279        * present notification instead).
7280        * 0 = system updates will be automatically scheduled. (default)
7281        * @hide
7282        */
7283       @SystemApi
7284       public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
7285
7286       /**
7287        * Whether the package manager should send package verification broadcasts for verifiers to
7288        * review apps prior to installation.
7289        * 1 = request apps to be verified prior to installation, if a verifier exists.
7290        * 0 = do not verify apps before installation
7291        * @hide
7292        */
7293       public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
7294
7295       /** Timeout for package verification.
7296        * @hide */
7297       public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
7298
7299       /** Default response code for package verification.
7300        * @hide */
7301       public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
7302
7303       /**
7304        * Show package verification setting in the Settings app.
7305        * 1 = show (default)
7306        * 0 = hide
7307        * @hide
7308        */
7309       public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
7310
7311       /**
7312        * Run package verification on apps installed through ADB/ADT/USB
7313        * 1 = perform package verification on ADB installs (default)
7314        * 0 = bypass package verification on ADB installs
7315        * @hide
7316        */
7317       public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
7318
7319       /**
7320        * Time since last fstrim (milliseconds) after which we force one to happen
7321        * during device startup.  If unset, the default is 3 days.
7322        * @hide
7323        */
7324       public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
7325
7326       /**
7327        * The interval in milliseconds at which to check packet counts on the
7328        * mobile data interface when screen is on, to detect possible data
7329        * connection problems.
7330        * @hide
7331        */
7332       public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
7333               "pdp_watchdog_poll_interval_ms";
7334
7335       /**
7336        * The interval in milliseconds at which to check packet counts on the
7337        * mobile data interface when screen is off, to detect possible data
7338        * connection problems.
7339        * @hide
7340        */
7341       public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
7342               "pdp_watchdog_long_poll_interval_ms";
7343
7344       /**
7345        * The interval in milliseconds at which to check packet counts on the
7346        * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
7347        * outgoing packets has been reached without incoming packets.
7348        * @hide
7349        */
7350       public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
7351               "pdp_watchdog_error_poll_interval_ms";
7352
7353       /**
7354        * The number of outgoing packets sent without seeing an incoming packet
7355        * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
7356        * device is logged to the event log
7357        * @hide
7358        */
7359       public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
7360               "pdp_watchdog_trigger_packet_count";
7361
7362       /**
7363        * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
7364        * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
7365        * attempting data connection recovery.
7366        * @hide
7367        */
7368       public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
7369               "pdp_watchdog_error_poll_count";
7370
7371       /**
7372        * The number of failed PDP reset attempts before moving to something more
7373        * drastic: re-registering to the network.
7374        * @hide
7375        */
7376       public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
7377               "pdp_watchdog_max_pdp_reset_fail_count";
7378
7379       /**
7380        * A positive value indicates how often the SamplingProfiler
7381        * should take snapshots. Zero value means SamplingProfiler
7382        * is disabled.
7383        *
7384        * @hide
7385        */
7386       public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
7387
7388       /**
7389        * URL to open browser on to allow user to manage a prepay account
7390        * @hide
7391        */
7392       public static final String SETUP_PREPAID_DATA_SERVICE_URL =
7393               "setup_prepaid_data_service_url";
7394
7395       /**
7396        * URL to attempt a GET on to see if this is a prepay device
7397        * @hide
7398        */
7399       public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
7400               "setup_prepaid_detection_target_url";
7401
7402       /**
7403        * Host to check for a redirect to after an attempt to GET
7404        * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
7405        * this is a prepaid device with zero balance.)
7406        * @hide
7407        */
7408       public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
7409               "setup_prepaid_detection_redir_host";
7410
7411       /**
7412        * The interval in milliseconds at which to check the number of SMS sent out without asking
7413        * for use permit, to limit the un-authorized SMS usage.
7414        *
7415        * @hide
7416        */
7417       public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
7418               "sms_outgoing_check_interval_ms";
7419
7420       /**
7421        * The number of outgoing SMS sent without asking for user permit (of {@link
7422        * #SMS_OUTGOING_CHECK_INTERVAL_MS}
7423        *
7424        * @hide
7425        */
7426       public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
7427               "sms_outgoing_check_max_count";
7428
7429       /**
7430        * Used to disable SMS short code confirmation - defaults to true.
7431        * True indcates we will do the check, etc.  Set to false to disable.
7432        * @see com.android.internal.telephony.SmsUsageMonitor
7433        * @hide
7434        */
7435       public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
7436
7437        /**
7438         * Used to select which country we use to determine premium sms codes.
7439         * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
7440         * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
7441         * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
7442         * @hide
7443         */
7444        public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
7445
7446       /**
7447        * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
7448        * @hide
7449        */
7450       public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
7451
7452       /**
7453        * Used to disable Tethering on a device - defaults to true
7454        * @hide
7455        */
7456       public static final String TETHER_SUPPORTED = "tether_supported";
7457
7458       /**
7459        * Used to require DUN APN on the device or not - defaults to a build config value
7460        * which defaults to false
7461        * @hide
7462        */
7463       public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
7464
7465       /**
7466        * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
7467        * corresponding build config values are set it will override the APN DB
7468        * values.
7469        * Consists of a comma seperated list of strings:
7470        * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
7471        * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
7472        * @hide
7473        */
7474       public static final String TETHER_DUN_APN = "tether_dun_apn";
7475
7476       /**
7477        * List of carrier apps which are whitelisted to prompt the user for install when
7478        * a sim card with matching uicc carrier privilege rules is inserted.
7479        *
7480        * The value is "package1;package2;..."
7481        * @hide
7482        */
7483       public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
7484
7485       /**
7486        * USB Mass Storage Enabled
7487        */
7488       public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
7489
7490       /**
7491        * If this setting is set (to anything), then all references
7492        * to Gmail on the device must change to Google Mail.
7493        */
7494       public static final String USE_GOOGLE_MAIL = "use_google_mail";
7495
7496        /**
7497         * Webview Data reduction proxy key.
7498         * @hide
7499         */
7500        public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
7501                "webview_data_reduction_proxy_key";
7502
7503       /**
7504        * Whether or not the WebView fallback mechanism should be enabled.
7505        * 0=disabled, 1=enabled.
7506        * @hide
7507        */
7508       public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED =
7509               "webview_fallback_logic_enabled";
7510
7511       /**
7512        * Name of the package used as WebView provider (if unset the provider is instead determined
7513        * by the system).
7514        * @hide
7515        */
7516       public static final String WEBVIEW_PROVIDER = "webview_provider";
7517
7518       /**
7519        * Developer setting to enable WebView multiprocess rendering.
7520        * @hide
7521        */
7522       @SystemApi
7523       public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
7524
7525       /**
7526        * The maximum number of notifications shown in 24 hours when switching networks.
7527        * @hide
7528        */
7529       public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT =
7530              "network_switch_notification_daily_limit";
7531
7532       /**
7533        * The minimum time in milliseconds between notifications when switching networks.
7534        * @hide
7535        */
7536       public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS =
7537              "network_switch_notification_rate_limit_millis";
7538
7539       /**
7540        * Whether to automatically switch away from wifi networks that lose Internet access.
7541        * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always
7542        * avoids such networks. Valid values are:
7543        *
7544        * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013.
7545        * null: Ask the user whether to switch away from bad wifi.
7546        * 1: Avoid bad wifi.
7547        *
7548        * @hide
7549        */
7550       public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi";
7551
7552       /**
7553        * Whether Wifi display is enabled/disabled
7554        * 0=disabled. 1=enabled.
7555        * @hide
7556        */
7557       public static final String WIFI_DISPLAY_ON = "wifi_display_on";
7558
7559       /**
7560        * Whether Wifi display certification mode is enabled/disabled
7561        * 0=disabled. 1=enabled.
7562        * @hide
7563        */
7564       public static final String WIFI_DISPLAY_CERTIFICATION_ON =
7565               "wifi_display_certification_on";
7566
7567       /**
7568        * WPS Configuration method used by Wifi display, this setting only
7569        * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
7570        *
7571        * Possible values are:
7572        *
7573        * WpsInfo.INVALID: use default WPS method chosen by framework
7574        * WpsInfo.PBC    : use Push button
7575        * WpsInfo.KEYPAD : use Keypad
7576        * WpsInfo.DISPLAY: use Display
7577        * @hide
7578        */
7579       public static final String WIFI_DISPLAY_WPS_CONFIG =
7580           "wifi_display_wps_config";
7581
7582       /**
7583        * Whether to notify the user of open networks.
7584        * <p>
7585        * If not connected and the scan results have an open network, we will
7586        * put this notification up. If we attempt to connect to a network or
7587        * the open network(s) disappear, we remove the notification. When we
7588        * show the notification, we will not show it again for
7589        * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
7590        */
7591       public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
7592               "wifi_networks_available_notification_on";
7593       /**
7594        * {@hide}
7595        */
7596       public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
7597               "wimax_networks_available_notification_on";
7598
7599       /**
7600        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
7601        * Connecting to a network will reset the timer.
7602        */
7603       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
7604               "wifi_networks_available_repeat_delay";
7605
7606       /**
7607        * 802.11 country code in ISO 3166 format
7608        * @hide
7609        */
7610       public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
7611
7612       /**
7613        * The interval in milliseconds to issue wake up scans when wifi needs
7614        * to connect. This is necessary to connect to an access point when
7615        * device is on the move and the screen is off.
7616        * @hide
7617        */
7618       public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
7619               "wifi_framework_scan_interval_ms";
7620
7621       /**
7622        * The interval in milliseconds after which Wi-Fi is considered idle.
7623        * When idle, it is possible for the device to be switched from Wi-Fi to
7624        * the mobile data network.
7625        * @hide
7626        */
7627       public static final String WIFI_IDLE_MS = "wifi_idle_ms";
7628
7629       /**
7630        * When the number of open networks exceeds this number, the
7631        * least-recently-used excess networks will be removed.
7632        */
7633       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
7634
7635       /**
7636        * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
7637        */
7638       public static final String WIFI_ON = "wifi_on";
7639
7640       /**
7641        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
7642        * @hide
7643        */
7644       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
7645                "wifi_scan_always_enabled";
7646
7647        /**
7648         * Value to specify if Wi-Fi Wakeup feature is enabled.
7649         *
7650         * Type: int (0 for false, 1 for true)
7651         * @hide
7652         */
7653        @SystemApi
7654        public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
7655
7656        /**
7657         * Value to specify if network recommendations from
7658         * {@link com.android.server.NetworkScoreService} are enabled.
7659         *
7660         * Type: int (0 for false, 1 for true)
7661         * @hide
7662         */
7663        @SystemApi
7664        public static final String NETWORK_RECOMMENDATIONS_ENABLED =
7665                "network_recommendations_enabled";
7666
7667       /**
7668        * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
7669        * connectivity.
7670        * @hide
7671        */
7672       public static final String BLE_SCAN_ALWAYS_AVAILABLE =
7673               "ble_scan_always_enabled";
7674
7675       /**
7676        * Used to save the Wifi_ON state prior to tethering.
7677        * This state will be checked to restore Wifi after
7678        * the user turns off tethering.
7679        *
7680        * @hide
7681        */
7682       public static final String WIFI_SAVED_STATE = "wifi_saved_state";
7683
7684       /**
7685        * The interval in milliseconds to scan as used by the wifi supplicant
7686        * @hide
7687        */
7688       public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
7689               "wifi_supplicant_scan_interval_ms";
7690
7691        /**
7692         * whether frameworks handles wifi auto-join
7693         * @hide
7694         */
7695       public static final String WIFI_ENHANCED_AUTO_JOIN =
7696                "wifi_enhanced_auto_join";
7697
7698        /**
7699         * whether settings show RSSI
7700         * @hide
7701         */
7702        public static final String WIFI_NETWORK_SHOW_RSSI =
7703                "wifi_network_show_rssi";
7704
7705        /**
7706        * The interval in milliseconds to scan at supplicant when p2p is connected
7707        * @hide
7708        */
7709       public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
7710               "wifi_scan_interval_p2p_connected_ms";
7711
7712       /**
7713        * Whether the Wi-Fi watchdog is enabled.
7714        */
7715       public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
7716
7717       /**
7718        * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
7719        * the setting needs to be set to 0 to disable it.
7720        * @hide
7721        */
7722       public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
7723               "wifi_watchdog_poor_network_test_enabled";
7724
7725       /**
7726        * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
7727        * needs to be set to 0 to disable it.
7728        * @hide
7729        */
7730       public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
7731               "wifi_suspend_optimizations_enabled";
7732
7733       /**
7734        * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
7735        * will enable it. In the future, additional values may be supported.
7736        * @hide
7737        */
7738       public static final String WIFI_VERBOSE_LOGGING_ENABLED =
7739               "wifi_verbose_logging_enabled";
7740
7741       /**
7742        * The maximum number of times we will retry a connection to an access
7743        * point for which we have failed in acquiring an IP address from DHCP.
7744        * A value of N means that we will make N+1 connection attempts in all.
7745        */
7746       public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
7747
7748       /**
7749        * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
7750        * data connectivity to be established after a disconnect from Wi-Fi.
7751        */
7752       public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
7753           "wifi_mobile_data_transition_wakelock_timeout_ms";
7754
7755       /**
7756        * This setting controls whether WiFi configurations created by a Device Owner app
7757        * should be locked down (that is, be editable or removable only by the Device Owner App,
7758        * not even by Settings app).
7759        * This setting takes integer values. Non-zero values mean DO created configurations
7760        * are locked down. Value of zero means they are not. Default value in the absence of
7761        * actual value to this setting is 0.
7762        */
7763       public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
7764               "wifi_device_owner_configs_lockdown";
7765
7766       /**
7767        * The operational wifi frequency band
7768        * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
7769        * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
7770        * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
7771        *
7772        * @hide
7773        */
7774       public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
7775
7776       /**
7777        * The Wi-Fi peer-to-peer device name
7778        * @hide
7779        */
7780       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
7781
7782       /**
7783        * The min time between wifi disable and wifi enable
7784        * @hide
7785        */
7786       public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
7787
7788       /**
7789        * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
7790        * from an ephemeral network if there is no BSSID for that network with a non-null score that
7791        * has been seen in this time period.
7792        *
7793        * If this is less than or equal to zero, we use a more conservative behavior and only check
7794        * for a non-null score from the currently connected or target BSSID.
7795        * @hide
7796        */
7797       public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
7798               "wifi_ephemeral_out_of_range_timeout_ms";
7799
7800       /**
7801        * The number of milliseconds to delay when checking for data stalls during
7802        * non-aggressive detection. (screen is turned off.)
7803        * @hide
7804        */
7805       public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
7806               "data_stall_alarm_non_aggressive_delay_in_ms";
7807
7808       /**
7809        * The number of milliseconds to delay when checking for data stalls during
7810        * aggressive detection. (screen on or suspected data stall)
7811        * @hide
7812        */
7813       public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
7814               "data_stall_alarm_aggressive_delay_in_ms";
7815
7816       /**
7817        * The number of milliseconds to allow the provisioning apn to remain active
7818        * @hide
7819        */
7820       public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
7821               "provisioning_apn_alarm_delay_in_ms";
7822
7823       /**
7824        * The interval in milliseconds at which to check gprs registration
7825        * after the first registration mismatch of gprs and voice service,
7826        * to detect possible data network registration problems.
7827        *
7828        * @hide
7829        */
7830       public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
7831               "gprs_register_check_period_ms";
7832
7833       /**
7834        * Nonzero causes Log.wtf() to crash.
7835        * @hide
7836        */
7837       public static final String WTF_IS_FATAL = "wtf_is_fatal";
7838
7839       /**
7840        * Ringer mode. This is used internally, changing this value will not
7841        * change the ringer mode. See AudioManager.
7842        */
7843       public static final String MODE_RINGER = "mode_ringer";
7844
7845       /**
7846        * Overlay display devices setting.
7847        * The associated value is a specially formatted string that describes the
7848        * size and density of simulated secondary display devices.
7849        * <p>
7850        * Format: {width}x{height}/{dpi};...
7851        * </p><p>
7852        * Example:
7853        * <ul>
7854        * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
7855        * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
7856        * at 1080p and the second at 720p.</li>
7857        * <li>If the value is empty, then no overlay display devices are created.</li>
7858        * </ul></p>
7859        *
7860        * @hide
7861        */
7862       public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
7863
7864        /**
7865         * Threshold values for the duration and level of a discharge cycle,
7866         * under which we log discharge cycle info.
7867         *
7868         * @hide
7869         */
7870        public static final String
7871                BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
7872
7873        /** @hide */
7874        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
7875
7876        /**
7877         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
7878         * intents on application crashes and ANRs. If this is disabled, the
7879         * crash/ANR dialog will never display the "Report" button.
7880         * <p>
7881         * Type: int (0 = disallow, 1 = allow)
7882         *
7883         * @hide
7884         */
7885        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
7886
7887        /**
7888         * Maximum age of entries kept by {@link DropBoxManager}.
7889         *
7890         * @hide
7891         */
7892        public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
7893
7894        /**
7895         * Maximum number of entry files which {@link DropBoxManager} will keep
7896         * around.
7897         *
7898         * @hide
7899         */
7900        public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
7901
7902        /**
7903         * Maximum amount of disk space used by {@link DropBoxManager} no matter
7904         * what.
7905         *
7906         * @hide
7907         */
7908        public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
7909
7910        /**
7911         * Percent of free disk (excluding reserve) which {@link DropBoxManager}
7912         * will use.
7913         *
7914         * @hide
7915         */
7916        public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
7917
7918        /**
7919         * Percent of total disk which {@link DropBoxManager} will never dip
7920         * into.
7921         *
7922         * @hide
7923         */
7924        public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
7925
7926        /**
7927         * Prefix for per-tag dropbox disable/enable settings.
7928         *
7929         * @hide
7930         */
7931        public static final String DROPBOX_TAG_PREFIX = "dropbox:";
7932
7933        /**
7934         * Lines of logcat to include with system crash/ANR/etc. reports, as a
7935         * prefix of the dropbox tag of the report type. For example,
7936         * "logcat_for_system_server_anr" controls the lines of logcat captured
7937         * with system server ANR reports. 0 to disable.
7938         *
7939         * @hide
7940         */
7941        public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
7942
7943        /**
7944         * The interval in minutes after which the amount of free storage left
7945         * on the device is logged to the event log
7946         *
7947         * @hide
7948         */
7949        public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
7950
7951        /**
7952         * Threshold for the amount of change in disk free space required to
7953         * report the amount of free space. Used to prevent spamming the logs
7954         * when the disk free space isn't changing frequently.
7955         *
7956         * @hide
7957         */
7958        public static final String
7959                DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
7960
7961        /**
7962         * Minimum percentage of free storage on the device that is used to
7963         * determine if the device is running low on storage. The default is 10.
7964         * <p>
7965         * Say this value is set to 10, the device is considered running low on
7966         * storage if 90% or more of the device storage is filled up.
7967         *
7968         * @hide
7969         */
7970        public static final String
7971                SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
7972
7973        /**
7974         * Maximum byte size of the low storage threshold. This is to ensure
7975         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
7976         * overly large threshold for large storage devices. Currently this must
7977         * be less than 2GB. This default is 500MB.
7978         *
7979         * @hide
7980         */
7981        public static final String
7982                SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
7983
7984        /**
7985         * Minimum bytes of free storage on the device before the data partition
7986         * is considered full. By default, 1 MB is reserved to avoid system-wide
7987         * SQLite disk full exceptions.
7988         *
7989         * @hide
7990         */
7991        public static final String
7992                SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
7993
7994        /**
7995         * The maximum reconnect delay for short network outages or when the
7996         * network is suspended due to phone use.
7997         *
7998         * @hide
7999         */
8000        public static final String
8001                SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
8002
8003        /**
8004         * The number of milliseconds to delay before sending out
8005         * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
8006         *
8007         * @hide
8008         */
8009        public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
8010
8011
8012        /**
8013         * Network sampling interval, in seconds. We'll generate link information
8014         * about bytes/packets sent and error rates based on data sampled in this interval
8015         *
8016         * @hide
8017         */
8018
8019        public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
8020                "connectivity_sampling_interval_in_seconds";
8021
8022        /**
8023         * The series of successively longer delays used in retrying to download PAC file.
8024         * Last delay is used between successful PAC downloads.
8025         *
8026         * @hide
8027         */
8028        public static final String PAC_CHANGE_DELAY = "pac_change_delay";
8029
8030        /**
8031         * Don't attempt to detect captive portals.
8032         *
8033         * @hide
8034         */
8035        public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0;
8036
8037        /**
8038         * When detecting a captive portal, display a notification that
8039         * prompts the user to sign in.
8040         *
8041         * @hide
8042         */
8043        public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1;
8044
8045        /**
8046         * When detecting a captive portal, immediately disconnect from the
8047         * network and do not reconnect to that network in the future.
8048         *
8049         * @hide
8050         */
8051        public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
8052
8053        /**
8054         * What to do when connecting a network that presents a captive portal.
8055         * Must be one of the CAPTIVE_PORTAL_MODE_* constants above.
8056         *
8057         * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT.
8058         * @hide
8059         */
8060        public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode";
8061
8062        /**
8063         * Setting to turn off captive portal detection. Feature is enabled by
8064         * default and the setting needs to be set to 0 to disable it.
8065         *
8066         * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection
8067         * @hide
8068         */
8069        @Deprecated
8070        public static final String
8071                CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
8072
8073        /**
8074         * The server used for captive portal detection upon a new conection. A
8075         * 204 response code from the server is used for validation.
8076         * TODO: remove this deprecated symbol.
8077         *
8078         * @hide
8079         */
8080        public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
8081
8082        /**
8083         * The URL used for HTTPS captive portal detection upon a new connection.
8084         * A 204 response code from the server is used for validation.
8085         *
8086         * @hide
8087         */
8088        public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url";
8089
8090        /**
8091         * The URL used for HTTP captive portal detection upon a new connection.
8092         * A 204 response code from the server is used for validation.
8093         *
8094         * @hide
8095         */
8096        public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url";
8097
8098        /**
8099         * The URL used for fallback HTTP captive portal detection when previous HTTP
8100         * and HTTPS captive portal detection attemps did not return a conclusive answer.
8101         *
8102         * @hide
8103         */
8104        public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
8105
8106        /**
8107         * Whether to use HTTPS for network validation. This is enabled by default and the setting
8108         * needs to be set to 0 to disable it. This setting is a misnomer because captive portals
8109         * don't actually use HTTPS, but it's consistent with the other settings.
8110         *
8111         * @hide
8112         */
8113        public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
8114
8115        /**
8116         * Which User-Agent string to use in the header of the captive portal detection probes.
8117         * The User-Agent field is unset when this setting has no value (HttpUrlConnection default).
8118         *
8119         * @hide
8120         */
8121        public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent";
8122
8123        /**
8124         * Whether network service discovery is enabled.
8125         *
8126         * @hide
8127         */
8128        public static final String NSD_ON = "nsd_on";
8129
8130        /**
8131         * Let user pick default install location.
8132         *
8133         * @hide
8134         */
8135        public static final String SET_INSTALL_LOCATION = "set_install_location";
8136
8137        /**
8138         * Default install location value.
8139         * 0 = auto, let system decide
8140         * 1 = internal
8141         * 2 = sdcard
8142         * @hide
8143         */
8144        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
8145
8146        /**
8147         * ms during which to consume extra events related to Inet connection
8148         * condition after a transtion to fully-connected
8149         *
8150         * @hide
8151         */
8152        public static final String
8153                INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
8154
8155        /**
8156         * ms during which to consume extra events related to Inet connection
8157         * condtion after a transtion to partly-connected
8158         *
8159         * @hide
8160         */
8161        public static final String
8162                INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
8163
8164        /** {@hide} */
8165        public static final String
8166                READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
8167
8168        /**
8169         * Host name and port for global http proxy. Uses ':' seperator for
8170         * between host and port.
8171         */
8172        public static final String HTTP_PROXY = "http_proxy";
8173
8174        /**
8175         * Host name for global http proxy. Set via ConnectivityManager.
8176         *
8177         * @hide
8178         */
8179        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
8180
8181        /**
8182         * Integer host port for global http proxy. Set via ConnectivityManager.
8183         *
8184         * @hide
8185         */
8186        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
8187
8188        /**
8189         * Exclusion list for global proxy. This string contains a list of
8190         * comma-separated domains where the global proxy does not apply.
8191         * Domains should be listed in a comma- separated list. Example of
8192         * acceptable formats: ".domain1.com,my.domain2.com" Use
8193         * ConnectivityManager to set/get.
8194         *
8195         * @hide
8196         */
8197        public static final String
8198                GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
8199
8200        /**
8201         * The location PAC File for the proxy.
8202         * @hide
8203         */
8204        public static final String
8205                GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
8206
8207        /**
8208         * Enables the UI setting to allow the user to specify the global HTTP
8209         * proxy and associated exclusion list.
8210         *
8211         * @hide
8212         */
8213        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
8214
8215        /**
8216         * Setting for default DNS in case nobody suggests one
8217         *
8218         * @hide
8219         */
8220        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
8221
8222        /** {@hide} */
8223        public static final String
8224                BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
8225        /** {@hide} */
8226        public static final String
8227                BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
8228        /** {@hide} */
8229        public static final String
8230                BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
8231        /** {@hide} */
8232        public static final String
8233                BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
8234        /** {@hide} */
8235        public static final String
8236                BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
8237        /** {@hide} */
8238        public static final String
8239                BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_";
8240        /** {@hide} */
8241        public static final String
8242                BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_";
8243        /** {@hide} */
8244        public static final String
8245                BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
8246        /** {@hide} */
8247        public static final String
8248                BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_";
8249
8250        /**
8251         * Device Idle (Doze) specific settings.
8252         * This is encoded as a key=value list, separated by commas. Ex:
8253         *
8254         * "inactive_to=60000,sensing_to=400000"
8255         *
8256         * The following keys are supported:
8257         *
8258         * <pre>
8259         * inactive_to                      (long)
8260         * sensing_to                       (long)
8261         * motion_inactive_to               (long)
8262         * idle_after_inactive_to           (long)
8263         * idle_pending_to                  (long)
8264         * max_idle_pending_to              (long)
8265         * idle_pending_factor              (float)
8266         * idle_to                          (long)
8267         * max_idle_to                      (long)
8268         * idle_factor                      (float)
8269         * min_time_to_alarm                (long)
8270         * max_temp_app_whitelist_duration  (long)
8271         * notification_whitelist_duration  (long)
8272         * </pre>
8273         *
8274         * <p>
8275         * Type: string
8276         * @hide
8277         * @see com.android.server.DeviceIdleController.Constants
8278         */
8279        public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
8280
8281        /**
8282         * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS}
8283         *
8284         * <p>
8285         * Type: string
8286         * @hide
8287         * @see com.android.server.DeviceIdleController.Constants
8288         */
8289        public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch";
8290
8291        /**
8292         * App standby (app idle) specific settings.
8293         * This is encoded as a key=value list, separated by commas. Ex:
8294         *
8295         * "idle_duration=5000,parole_interval=4500"
8296         *
8297         * The following keys are supported:
8298         *
8299         * <pre>
8300         * idle_duration2       (long)
8301         * wallclock_threshold  (long)
8302         * parole_interval      (long)
8303         * parole_duration      (long)
8304         *
8305         * idle_duration        (long) // This is deprecated and used to circumvent b/26355386.
8306         * </pre>
8307         *
8308         * <p>
8309         * Type: string
8310         * @hide
8311         * @see com.android.server.usage.UsageStatsService.SettingsObserver
8312         */
8313        public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
8314
8315        /**
8316         * Alarm manager specific settings.
8317         * This is encoded as a key=value list, separated by commas. Ex:
8318         *
8319         * "min_futurity=5000,allow_while_idle_short_time=4500"
8320         *
8321         * The following keys are supported:
8322         *
8323         * <pre>
8324         * min_futurity                         (long)
8325         * min_interval                         (long)
8326         * allow_while_idle_short_time          (long)
8327         * allow_while_idle_long_time           (long)
8328         * allow_while_idle_whitelist_duration  (long)
8329         * </pre>
8330         *
8331         * <p>
8332         * Type: string
8333         * @hide
8334         * @see com.android.server.AlarmManagerService.Constants
8335         */
8336        public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
8337
8338        /**
8339         * Job scheduler specific settings.
8340         * This is encoded as a key=value list, separated by commas. Ex:
8341         *
8342         * "min_ready_jobs_count=2,moderate_use_factor=.5"
8343         *
8344         * The following keys are supported:
8345         *
8346         * <pre>
8347         * min_idle_count                       (int)
8348         * min_charging_count                   (int)
8349         * min_connectivity_count               (int)
8350         * min_content_count                    (int)
8351         * min_ready_jobs_count                 (int)
8352         * heavy_use_factor                     (float)
8353         * moderate_use_factor                  (float)
8354         * fg_job_count                         (int)
8355         * bg_normal_job_count                  (int)
8356         * bg_moderate_job_count                (int)
8357         * bg_low_job_count                     (int)
8358         * bg_critical_job_count                (int)
8359         * </pre>
8360         *
8361         * <p>
8362         * Type: string
8363         * @hide
8364         * @see com.android.server.job.JobSchedulerService.Constants
8365         */
8366        public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants";
8367
8368        /**
8369         * ShortcutManager specific settings.
8370         * This is encoded as a key=value list, separated by commas. Ex:
8371         *
8372         * "reset_interval_sec=86400,max_updates_per_interval=1"
8373         *
8374         * The following keys are supported:
8375         *
8376         * <pre>
8377         * reset_interval_sec              (long)
8378         * max_updates_per_interval        (int)
8379         * max_icon_dimension_dp           (int, DP)
8380         * max_icon_dimension_dp_lowram    (int, DP)
8381         * max_shortcuts                   (int)
8382         * icon_quality                    (int, 0-100)
8383         * icon_format                     (String)
8384         * </pre>
8385         *
8386         * <p>
8387         * Type: string
8388         * @hide
8389         * @see com.android.server.pm.ShortcutService.ConfigConstants
8390         */
8391        public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants";
8392
8393        /**
8394         * Get the key that retrieves a bluetooth headset's priority.
8395         * @hide
8396         */
8397        public static final String getBluetoothHeadsetPriorityKey(String address) {
8398            return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8399        }
8400
8401        /**
8402         * Get the key that retrieves a bluetooth a2dp sink's priority.
8403         * @hide
8404         */
8405        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
8406            return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8407        }
8408
8409        /**
8410         * Get the key that retrieves a bluetooth a2dp src's priority.
8411         * @hide
8412         */
8413        public static final String getBluetoothA2dpSrcPriorityKey(String address) {
8414            return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8415        }
8416
8417        /**
8418         * Get the key that retrieves a bluetooth Input Device's priority.
8419         * @hide
8420         */
8421        public static final String getBluetoothInputDevicePriorityKey(String address) {
8422            return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8423        }
8424
8425        /**
8426         * Get the key that retrieves a bluetooth pan client priority.
8427         * @hide
8428         */
8429        public static final String getBluetoothPanPriorityKey(String address) {
8430            return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8431        }
8432
8433        /**
8434         * Get the key that retrieves a bluetooth map priority.
8435         * @hide
8436         */
8437        public static final String getBluetoothMapPriorityKey(String address) {
8438            return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8439        }
8440
8441        /**
8442         * Get the key that retrieves a bluetooth map client priority.
8443         * @hide
8444         */
8445        public static final String getBluetoothMapClientPriorityKey(String address) {
8446            return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8447        }
8448
8449        /**
8450         * Get the key that retrieves a bluetooth pbap client priority.
8451         * @hide
8452         */
8453        public static final String getBluetoothPbapClientPriorityKey(String address) {
8454            return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8455        }
8456
8457        /**
8458         * Get the key that retrieves a bluetooth sap priority.
8459         * @hide
8460         */
8461        public static final String getBluetoothSapPriorityKey(String address) {
8462            return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
8463        }
8464
8465        /**
8466         * Scaling factor for normal window animations. Setting to 0 will
8467         * disable window animations.
8468         */
8469        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
8470
8471        /**
8472         * Scaling factor for activity transition animations. Setting to 0 will
8473         * disable window animations.
8474         */
8475        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
8476
8477        /**
8478         * Scaling factor for Animator-based animations. This affects both the
8479         * start delay and duration of all such animations. Setting to 0 will
8480         * cause animations to end immediately. The default value is 1.
8481         */
8482        public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
8483
8484        /**
8485         * Scaling factor for normal window animations. Setting to 0 will
8486         * disable window animations.
8487         *
8488         * @hide
8489         */
8490        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
8491
8492        /**
8493         * If 0, the compatibility mode is off for all applications.
8494         * If 1, older applications run under compatibility mode.
8495         * TODO: remove this settings before code freeze (bug/1907571)
8496         * @hide
8497         */
8498        public static final String COMPATIBILITY_MODE = "compatibility_mode";
8499
8500        /**
8501         * CDMA only settings
8502         * Emergency Tone  0 = Off
8503         *                 1 = Alert
8504         *                 2 = Vibrate
8505         * @hide
8506         */
8507        public static final String EMERGENCY_TONE = "emergency_tone";
8508
8509        /**
8510         * CDMA only settings
8511         * Whether the auto retry is enabled. The value is
8512         * boolean (1 or 0).
8513         * @hide
8514         */
8515        public static final String CALL_AUTO_RETRY = "call_auto_retry";
8516
8517        /**
8518         * A setting that can be read whether the emergency affordance is currently needed.
8519         * The value is a boolean (1 or 0).
8520         * @hide
8521         */
8522        public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
8523
8524        /**
8525         * See RIL_PreferredNetworkType in ril.h
8526         * @hide
8527         */
8528        public static final String PREFERRED_NETWORK_MODE =
8529                "preferred_network_mode";
8530
8531        /**
8532         * Name of an application package to be debugged.
8533         */
8534        public static final String DEBUG_APP = "debug_app";
8535
8536        /**
8537         * If 1, when launching DEBUG_APP it will wait for the debugger before
8538         * starting user code.  If 0, it will run normally.
8539         */
8540        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
8541
8542        /**
8543         * Control whether the process CPU usage meter should be shown.
8544         *
8545         * @deprecated This functionality is no longer available as of
8546         * {@link android.os.Build.VERSION_CODES#N_MR1}.
8547         */
8548        @Deprecated
8549        public static final String SHOW_PROCESSES = "show_processes";
8550
8551        /**
8552         * If 1 low power mode is enabled.
8553         * @hide
8554         */
8555        public static final String LOW_POWER_MODE = "low_power";
8556
8557        /**
8558         * Battery level [1-99] at which low power mode automatically turns on.
8559         * If 0, it will not automatically turn on.
8560         * @hide
8561         */
8562        public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
8563
8564         /**
8565         * If not 0, the activity manager will aggressively finish activities and
8566         * processes as soon as they are no longer needed.  If 0, the normal
8567         * extended lifetime is used.
8568         */
8569        public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
8570
8571        /**
8572         * @hide
8573         * If not 0, the activity manager will implement a looser version of background
8574         * check that is more compatible with existing apps.
8575         */
8576        public static final String LENIENT_BACKGROUND_CHECK = "lenient_background_check";
8577
8578        /**
8579         * Use Dock audio output for media:
8580         *      0 = disabled
8581         *      1 = enabled
8582         * @hide
8583         */
8584        public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
8585
8586        /**
8587         * The surround sound formats AC3, DTS or IEC61937 are
8588         * available for use if they are detected.
8589         * This is the default mode.
8590         *
8591         * Note that AUTO is equivalent to ALWAYS for Android TVs and other
8592         * devices that have an S/PDIF output. This is because S/PDIF
8593         * is unidirectional and the TV cannot know if a decoder is
8594         * connected. So it assumes they are always available.
8595         * @hide
8596         */
8597         public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0;
8598
8599        /**
8600         * AC3, DTS or IEC61937 are NEVER available, even if they
8601         * are detected by the hardware. Those formats will not be
8602         * reported.
8603         *
8604         * An example use case would be an AVR reports that it is capable of
8605         * surround sound decoding but is broken. If NEVER is chosen
8606         * then apps must use PCM output instead of encoded output.
8607         * @hide
8608         */
8609         public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1;
8610
8611        /**
8612         * AC3, DTS or IEC61937 are ALWAYS available, even if they
8613         * are not detected by the hardware. Those formats will be
8614         * reported as part of the HDMI output capability. Applications
8615         * are then free to use either PCM or encoded output.
8616         *
8617         * An example use case would be a when TV was connected over
8618         * TOS-link to an AVR. But the TV could not see it because TOS-link
8619         * is unidirectional.
8620         * @hide
8621         */
8622         public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2;
8623
8624        /**
8625         * Set to ENCODED_SURROUND_OUTPUT_AUTO,
8626         * ENCODED_SURROUND_OUTPUT_NEVER or
8627         * ENCODED_SURROUND_OUTPUT_ALWAYS
8628         * @hide
8629         */
8630        public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output";
8631
8632        /**
8633         * Persisted safe headphone volume management state by AudioService
8634         * @hide
8635         */
8636        public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
8637
8638        /**
8639         * URL for tzinfo (time zone) updates
8640         * @hide
8641         */
8642        public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
8643
8644        /**
8645         * URL for tzinfo (time zone) update metadata
8646         * @hide
8647         */
8648        public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
8649
8650        /**
8651         * URL for selinux (mandatory access control) updates
8652         * @hide
8653         */
8654        public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
8655
8656        /**
8657         * URL for selinux (mandatory access control) update metadata
8658         * @hide
8659         */
8660        public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
8661
8662        /**
8663         * URL for sms short code updates
8664         * @hide
8665         */
8666        public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
8667                "sms_short_codes_content_url";
8668
8669        /**
8670         * URL for sms short code update metadata
8671         * @hide
8672         */
8673        public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
8674                "sms_short_codes_metadata_url";
8675
8676        /**
8677         * URL for apn_db updates
8678         * @hide
8679         */
8680        public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
8681
8682        /**
8683         * URL for apn_db update metadata
8684         * @hide
8685         */
8686        public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
8687
8688        /**
8689         * URL for cert pinlist updates
8690         * @hide
8691         */
8692        public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
8693
8694        /**
8695         * URL for cert pinlist updates
8696         * @hide
8697         */
8698        public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
8699
8700        /**
8701         * URL for intent firewall updates
8702         * @hide
8703         */
8704        public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
8705                "intent_firewall_content_url";
8706
8707        /**
8708         * URL for intent firewall update metadata
8709         * @hide
8710         */
8711        public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
8712                "intent_firewall_metadata_url";
8713
8714        /**
8715         * SELinux enforcement status. If 0, permissive; if 1, enforcing.
8716         * @hide
8717         */
8718        public static final String SELINUX_STATUS = "selinux_status";
8719
8720        /**
8721         * Developer setting to force RTL layout.
8722         * @hide
8723         */
8724        public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
8725
8726        /**
8727         * Milliseconds after screen-off after which low battery sounds will be silenced.
8728         *
8729         * If zero, battery sounds will always play.
8730         * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
8731         *
8732         * @hide
8733         */
8734        public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
8735
8736        /**
8737         * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
8738         * the caller is done with this, they should call {@link ContentResolver#delete} to
8739         * clean up any value that they may have written.
8740         *
8741         * @hide
8742         */
8743        public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
8744
8745        /**
8746         * Defines global runtime overrides to window policy.
8747         *
8748         * See {@link com.android.server.policy.PolicyControl} for value format.
8749         *
8750         * @hide
8751         */
8752        public static final String POLICY_CONTROL = "policy_control";
8753
8754        /**
8755         * Defines global zen mode.  ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
8756         * or ZEN_MODE_NO_INTERRUPTIONS.
8757         *
8758         * @hide
8759         */
8760        public static final String ZEN_MODE = "zen_mode";
8761
8762        /** @hide */ public static final int ZEN_MODE_OFF = 0;
8763        /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
8764        /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
8765        /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
8766
8767        /** @hide */ public static String zenModeToString(int mode) {
8768            if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
8769            if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
8770            if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
8771            return "ZEN_MODE_OFF";
8772        }
8773
8774        /** @hide */ public static boolean isValidZenMode(int value) {
8775            switch (value) {
8776                case Global.ZEN_MODE_OFF:
8777                case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
8778                case Global.ZEN_MODE_ALARMS:
8779                case Global.ZEN_MODE_NO_INTERRUPTIONS:
8780                    return true;
8781                default:
8782                    return false;
8783            }
8784        }
8785
8786        /**
8787         * Value of the ringer before entering zen mode.
8788         *
8789         * @hide
8790         */
8791        public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
8792
8793        /**
8794         * Opaque value, changes when persisted zen mode configuration changes.
8795         *
8796         * @hide
8797         */
8798        public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
8799
8800        /**
8801         * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
8802         *
8803         * @hide
8804         */
8805        public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
8806                "heads_up_notifications_enabled";
8807
8808        /** @hide */ public static final int HEADS_UP_OFF = 0;
8809        /** @hide */ public static final int HEADS_UP_ON = 1;
8810
8811        /**
8812         * The name of the device
8813         */
8814        public static final String DEVICE_NAME = "device_name";
8815
8816        /**
8817         * Whether the NetworkScoringService has been first initialized.
8818         * <p>
8819         * Type: int (0 for false, 1 for true)
8820         * @hide
8821         */
8822        public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
8823
8824        /**
8825         * Whether the user wants to be prompted for password to decrypt the device on boot.
8826         * This only matters if the storage is encrypted.
8827         * <p>
8828         * Type: int (0 for false, 1 for true)
8829         * @hide
8830         */
8831        public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
8832
8833        /**
8834         * Whether the Volte is enabled
8835         * <p>
8836         * Type: int (0 for false, 1 for true)
8837         * @hide
8838         */
8839        public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
8840
8841        /**
8842         * Whether VT (Video Telephony over IMS) is enabled
8843         * <p>
8844         * Type: int (0 for false, 1 for true)
8845         *
8846         * @hide
8847         */
8848        public static final String VT_IMS_ENABLED = "vt_ims_enabled";
8849
8850        /**
8851         * Whether WFC is enabled
8852         * <p>
8853         * Type: int (0 for false, 1 for true)
8854         *
8855         * @hide
8856         */
8857        public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
8858
8859        /**
8860         * WFC mode on home/non-roaming network.
8861         * <p>
8862         * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
8863         *
8864         * @hide
8865         */
8866        public static final String WFC_IMS_MODE = "wfc_ims_mode";
8867
8868        /**
8869         * WFC mode on roaming network.
8870         * <p>
8871         * Type: int - see {@link WFC_IMS_MODE} for values
8872         *
8873         * @hide
8874         */
8875        public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode";
8876
8877        /**
8878         * Whether WFC roaming is enabled
8879         * <p>
8880         * Type: int (0 for false, 1 for true)
8881         *
8882         * @hide
8883         */
8884        public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
8885
8886        /**
8887         * Whether user can enable/disable LTE as a preferred network. A carrier might control
8888         * this via gservices, OMA-DM, carrier app, etc.
8889         * <p>
8890         * Type: int (0 for false, 1 for true)
8891         * @hide
8892         */
8893        public static final String LTE_SERVICE_FORCED = "lte_service_forced";
8894
8895        /**
8896         * Ephemeral app cookie max size in bytes.
8897         * <p>
8898         * Type: int
8899         * @hide
8900         */
8901        public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
8902                "ephemeral_cookie_max_size_bytes";
8903
8904        /**
8905         * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is
8906         * enabled. Set to zero to disable.
8907         * <p>
8908         * Type: int (0 for false, 1 for true)
8909         *
8910         * @hide
8911         */
8912        public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature";
8913
8914        /**
8915         * A mask applied to the ephemeral hash to generate the hash prefix.
8916         * <p>
8917         * Type: int
8918         *
8919         * @hide
8920         */
8921        public static final String EPHEMERAL_HASH_PREFIX_MASK = "ephemeral_hash_prefix_mask";
8922
8923        /**
8924         * Number of hash prefixes to send during ephemeral resolution.
8925         * <p>
8926         * Type: int
8927         *
8928         * @hide
8929         */
8930        public static final String EPHEMERAL_HASH_PREFIX_COUNT = "ephemeral_hash_prefix_count";
8931
8932        /**
8933         * The duration for caching uninstalled ephemeral apps.
8934         * <p>
8935         * Type: long
8936         * @hide
8937         */
8938        public static final String UNINSTALLED_EPHEMERAL_APP_CACHE_DURATION_MILLIS =
8939                "uninstalled_ephemeral_app_cache_duration_millis";
8940
8941        /**
8942         * Allows switching users when system user is locked.
8943         * <p>
8944         * Type: int
8945         * @hide
8946         */
8947        public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED =
8948                "allow_user_switching_when_system_user_locked";
8949
8950        /**
8951         * Boot count since the device starts running APK level 24.
8952         * <p>
8953         * Type: int
8954         */
8955        public static final String BOOT_COUNT = "boot_count";
8956
8957        /**
8958         * Whether the safe boot is disallowed.
8959         *
8960         * <p>This setting should have the identical value as the corresponding user restriction.
8961         * The purpose of the setting is to make the restriction available in early boot stages
8962         * before the user restrictions are loaded.
8963         * @hide
8964         */
8965        public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
8966
8967        /**
8968         * Whether this device is currently in retail demo mode. If true, device
8969         * usage is severely limited.
8970         * <p>
8971         * Type: int (0 for false, 1 for true)
8972         * @hide
8973         */
8974        public static final String DEVICE_DEMO_MODE = "device_demo_mode";
8975
8976        /**
8977         * Retail mode specific settings. This is encoded as a key=value list, separated by commas.
8978         * Ex: "user_inactivity_timeout_ms=30000,warning_dialog_timeout_ms=10000". The following
8979         * keys are supported:
8980         *
8981         * <pre>
8982         * user_inactivity_timeout_ms  (long)
8983         * warning_dialog_timeout_ms   (long)
8984         * </pre>
8985         * <p>
8986         * Type: string
8987         *
8988         * @hide
8989         */
8990        public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants";
8991
8992        /**
8993         * The reason for the settings database being downgraded. This is only for
8994         * troubleshooting purposes and its value should not be interpreted in any way.
8995         *
8996         * Type: string
8997         *
8998         * @hide
8999         */
9000        public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
9001
9002        /**
9003         * Settings to backup. This is here so that it's in the same place as the settings
9004         * keys and easy to update.
9005         *
9006         * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
9007         * and Secure as well.  This is because those tables drive both backup and
9008         * restore, and restore needs to properly whitelist keys that used to live
9009         * in those namespaces.  The keys will only actually be backed up / restored
9010         * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
9011         *
9012         * NOTE: Settings are backed up and restored in the order they appear
9013         *       in this array. If you have one setting depending on another,
9014         *       make sure that they are ordered appropriately.
9015         *
9016         * @hide
9017         */
9018        public static final String[] SETTINGS_TO_BACKUP = {
9019            BUGREPORT_IN_POWER_MENU,
9020            STAY_ON_WHILE_PLUGGED_IN,
9021            AUTO_TIME,
9022            AUTO_TIME_ZONE,
9023            POWER_SOUNDS_ENABLED,
9024            DOCK_SOUNDS_ENABLED,
9025            CHARGING_SOUNDS_ENABLED,
9026            USB_MASS_STORAGE_ENABLED,
9027            ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
9028            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
9029            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
9030            WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
9031            WIFI_NUM_OPEN_NETWORKS_KEPT,
9032            EMERGENCY_TONE,
9033            CALL_AUTO_RETRY,
9034            DOCK_AUDIO_MEDIA_ENABLED,
9035            ENCODED_SURROUND_OUTPUT,
9036            LOW_POWER_MODE_TRIGGER_LEVEL
9037        };
9038
9039        // Populated lazily, guarded by class object:
9040        private static NameValueCache sNameValueCache = new NameValueCache(
9041                    CONTENT_URI,
9042                    CALL_METHOD_GET_GLOBAL,
9043                    CALL_METHOD_PUT_GLOBAL);
9044
9045        // Certain settings have been moved from global to the per-user secure namespace
9046        private static final HashSet<String> MOVED_TO_SECURE;
9047        static {
9048            MOVED_TO_SECURE = new HashSet<String>(1);
9049            MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
9050        }
9051
9052        /** @hide */
9053        public static void getMovedToSecureSettings(Set<String> outKeySet) {
9054            outKeySet.addAll(MOVED_TO_SECURE);
9055        }
9056
9057        /**
9058         * Look up a name in the database.
9059         * @param resolver to access the database with
9060         * @param name to look up in the table
9061         * @return the corresponding value, or null if not present
9062         */
9063        public static String getString(ContentResolver resolver, String name) {
9064            return getStringForUser(resolver, name, UserHandle.myUserId());
9065        }
9066
9067        /** @hide */
9068        public static String getStringForUser(ContentResolver resolver, String name,
9069                int userHandle) {
9070            if (MOVED_TO_SECURE.contains(name)) {
9071                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
9072                        + " to android.provider.Settings.Secure, returning read-only value.");
9073                return Secure.getStringForUser(resolver, name, userHandle);
9074            }
9075            return sNameValueCache.getStringForUser(resolver, name, userHandle);
9076        }
9077
9078        /**
9079         * Store a name/value pair into the database.
9080         * @param resolver to access the database with
9081         * @param name to store
9082         * @param value to associate with the name
9083         * @return true if the value was set, false on database errors
9084         */
9085        public static boolean putString(ContentResolver resolver,
9086                String name, String value) {
9087            return putStringForUser(resolver, name, value, UserHandle.myUserId());
9088        }
9089
9090        /** @hide */
9091        public static boolean putStringForUser(ContentResolver resolver,
9092                String name, String value, int userHandle) {
9093            if (LOCAL_LOGV) {
9094                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
9095                        + " for " + userHandle);
9096            }
9097            // Global and Secure have the same access policy so we can forward writes
9098            if (MOVED_TO_SECURE.contains(name)) {
9099                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
9100                        + " to android.provider.Settings.Secure, value is unchanged.");
9101                return Secure.putStringForUser(resolver, name, value, userHandle);
9102            }
9103            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
9104        }
9105
9106        /**
9107         * Construct the content URI for a particular name/value pair,
9108         * useful for monitoring changes with a ContentObserver.
9109         * @param name to look up in the table
9110         * @return the corresponding content URI, or null if not present
9111         */
9112        public static Uri getUriFor(String name) {
9113            return getUriFor(CONTENT_URI, name);
9114        }
9115
9116        /**
9117         * Convenience function for retrieving a single secure settings value
9118         * as an integer.  Note that internally setting values are always
9119         * stored as strings; this function converts the string to an integer
9120         * for you.  The default value will be returned if the setting is
9121         * not defined or not an integer.
9122         *
9123         * @param cr The ContentResolver to access.
9124         * @param name The name of the setting to retrieve.
9125         * @param def Value to return if the setting is not defined.
9126         *
9127         * @return The setting's current value, or 'def' if it is not defined
9128         * or not a valid integer.
9129         */
9130        public static int getInt(ContentResolver cr, String name, int def) {
9131            String v = getString(cr, name);
9132            try {
9133                return v != null ? Integer.parseInt(v) : def;
9134            } catch (NumberFormatException e) {
9135                return def;
9136            }
9137        }
9138
9139        /**
9140         * Convenience function for retrieving a single secure settings value
9141         * as an integer.  Note that internally setting values are always
9142         * stored as strings; this function converts the string to an integer
9143         * for you.
9144         * <p>
9145         * This version does not take a default value.  If the setting has not
9146         * been set, or the string value is not a number,
9147         * it throws {@link SettingNotFoundException}.
9148         *
9149         * @param cr The ContentResolver to access.
9150         * @param name The name of the setting to retrieve.
9151         *
9152         * @throws SettingNotFoundException Thrown if a setting by the given
9153         * name can't be found or the setting value is not an integer.
9154         *
9155         * @return The setting's current value.
9156         */
9157        public static int getInt(ContentResolver cr, String name)
9158                throws SettingNotFoundException {
9159            String v = getString(cr, name);
9160            try {
9161                return Integer.parseInt(v);
9162            } catch (NumberFormatException e) {
9163                throw new SettingNotFoundException(name);
9164            }
9165        }
9166
9167        /**
9168         * Convenience function for updating a single settings value as an
9169         * integer. This will either create a new entry in the table if the
9170         * given name does not exist, or modify the value of the existing row
9171         * with that name.  Note that internally setting values are always
9172         * stored as strings, so this function converts the given value to a
9173         * string before storing it.
9174         *
9175         * @param cr The ContentResolver to access.
9176         * @param name The name of the setting to modify.
9177         * @param value The new value for the setting.
9178         * @return true if the value was set, false on database errors
9179         */
9180        public static boolean putInt(ContentResolver cr, String name, int value) {
9181            return putString(cr, name, Integer.toString(value));
9182        }
9183
9184        /**
9185         * Convenience function for retrieving a single secure settings value
9186         * as a {@code long}.  Note that internally setting values are always
9187         * stored as strings; this function converts the string to a {@code long}
9188         * for you.  The default value will be returned if the setting is
9189         * not defined or not a {@code long}.
9190         *
9191         * @param cr The ContentResolver to access.
9192         * @param name The name of the setting to retrieve.
9193         * @param def Value to return if the setting is not defined.
9194         *
9195         * @return The setting's current value, or 'def' if it is not defined
9196         * or not a valid {@code long}.
9197         */
9198        public static long getLong(ContentResolver cr, String name, long def) {
9199            String valString = getString(cr, name);
9200            long value;
9201            try {
9202                value = valString != null ? Long.parseLong(valString) : def;
9203            } catch (NumberFormatException e) {
9204                value = def;
9205            }
9206            return value;
9207        }
9208
9209        /**
9210         * Convenience function for retrieving a single secure settings value
9211         * as a {@code long}.  Note that internally setting values are always
9212         * stored as strings; this function converts the string to a {@code long}
9213         * for you.
9214         * <p>
9215         * This version does not take a default value.  If the setting has not
9216         * been set, or the string value is not a number,
9217         * it throws {@link SettingNotFoundException}.
9218         *
9219         * @param cr The ContentResolver to access.
9220         * @param name The name of the setting to retrieve.
9221         *
9222         * @return The setting's current value.
9223         * @throws SettingNotFoundException Thrown if a setting by the given
9224         * name can't be found or the setting value is not an integer.
9225         */
9226        public static long getLong(ContentResolver cr, String name)
9227                throws SettingNotFoundException {
9228            String valString = getString(cr, name);
9229            try {
9230                return Long.parseLong(valString);
9231            } catch (NumberFormatException e) {
9232                throw new SettingNotFoundException(name);
9233            }
9234        }
9235
9236        /**
9237         * Convenience function for updating a secure settings value as a long
9238         * integer. This will either create a new entry in the table if the
9239         * given name does not exist, or modify the value of the existing row
9240         * with that name.  Note that internally setting values are always
9241         * stored as strings, so this function converts the given value to a
9242         * string before storing it.
9243         *
9244         * @param cr The ContentResolver to access.
9245         * @param name The name of the setting to modify.
9246         * @param value The new value for the setting.
9247         * @return true if the value was set, false on database errors
9248         */
9249        public static boolean putLong(ContentResolver cr, String name, long value) {
9250            return putString(cr, name, Long.toString(value));
9251        }
9252
9253        /**
9254         * Convenience function for retrieving a single secure settings value
9255         * as a floating point number.  Note that internally setting values are
9256         * always stored as strings; this function converts the string to an
9257         * float for you. The default value will be returned if the setting
9258         * is not defined or not a valid float.
9259         *
9260         * @param cr The ContentResolver to access.
9261         * @param name The name of the setting to retrieve.
9262         * @param def Value to return if the setting is not defined.
9263         *
9264         * @return The setting's current value, or 'def' if it is not defined
9265         * or not a valid float.
9266         */
9267        public static float getFloat(ContentResolver cr, String name, float def) {
9268            String v = getString(cr, name);
9269            try {
9270                return v != null ? Float.parseFloat(v) : def;
9271            } catch (NumberFormatException e) {
9272                return def;
9273            }
9274        }
9275
9276        /**
9277         * Convenience function for retrieving a single secure settings value
9278         * as a float.  Note that internally setting values are always
9279         * stored as strings; this function converts the string to a float
9280         * for you.
9281         * <p>
9282         * This version does not take a default value.  If the setting has not
9283         * been set, or the string value is not a number,
9284         * it throws {@link SettingNotFoundException}.
9285         *
9286         * @param cr The ContentResolver to access.
9287         * @param name The name of the setting to retrieve.
9288         *
9289         * @throws SettingNotFoundException Thrown if a setting by the given
9290         * name can't be found or the setting value is not a float.
9291         *
9292         * @return The setting's current value.
9293         */
9294        public static float getFloat(ContentResolver cr, String name)
9295                throws SettingNotFoundException {
9296            String v = getString(cr, name);
9297            if (v == null) {
9298                throw new SettingNotFoundException(name);
9299            }
9300            try {
9301                return Float.parseFloat(v);
9302            } catch (NumberFormatException e) {
9303                throw new SettingNotFoundException(name);
9304            }
9305        }
9306
9307        /**
9308         * Convenience function for updating a single settings value as a
9309         * floating point number. This will either create a new entry in the
9310         * table if the given name does not exist, or modify the value of the
9311         * existing row with that name.  Note that internally setting values
9312         * are always stored as strings, so this function converts the given
9313         * value to a string before storing it.
9314         *
9315         * @param cr The ContentResolver to access.
9316         * @param name The name of the setting to modify.
9317         * @param value The new value for the setting.
9318         * @return true if the value was set, false on database errors
9319         */
9320        public static boolean putFloat(ContentResolver cr, String name, float value) {
9321            return putString(cr, name, Float.toString(value));
9322        }
9323
9324
9325        /**
9326          * Subscription to be used for voice call on a multi sim device. The supported values
9327          * are 0 = SUB1, 1 = SUB2 and etc.
9328          * @hide
9329          */
9330        public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
9331
9332        /**
9333          * Used to provide option to user to select subscription during dial.
9334          * The supported values are 0 = disable or 1 = enable prompt.
9335          * @hide
9336          */
9337        public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
9338
9339        /**
9340          * Subscription to be used for data call on a multi sim device. The supported values
9341          * are 0 = SUB1, 1 = SUB2 and etc.
9342          * @hide
9343          */
9344        public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
9345
9346        /**
9347          * Subscription to be used for SMS 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_SMS_SUBSCRIPTION = "multi_sim_sms";
9352
9353       /**
9354          * Used to provide option to user to select subscription during send SMS.
9355          * The value 1 - enable, 0 - disable
9356          * @hide
9357          */
9358        public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
9359
9360
9361
9362        /** User preferred subscriptions setting.
9363          * This holds the details of the user selected subscription from the card and
9364          * the activation status. Each settings string have the coma separated values
9365          * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
9366          * @hide
9367         */
9368        public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
9369                "user_preferred_sub2","user_preferred_sub3"};
9370
9371        /**
9372         * Whether to enable new contacts aggregator or not.
9373         * The value 1 - enable, 0 - disable
9374         * @hide
9375         */
9376        public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
9377
9378        /**
9379         * Whether to enable contacts metadata syncing or not
9380         * The value 1 - enable, 0 - disable
9381         *
9382         * @removed
9383         */
9384        @Deprecated
9385        public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
9386
9387        /**
9388         * Whether to enable contacts metadata syncing or not
9389         * The value 1 - enable, 0 - disable
9390         */
9391        public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
9392
9393        /**
9394         * Whether to enable cellular on boot.
9395         * The value 1 - enable, 0 - disable
9396         * @hide
9397         */
9398        public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
9399
9400        /**
9401         * The maximum allowed notification enqueue rate in Hertz.
9402         *
9403         * Should be a float, and includes both posts and updates.
9404         * @hide
9405         */
9406        public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate";
9407
9408        /**
9409         * Whether cell is enabled/disabled
9410         * @hide
9411         */
9412        public static final String CELL_ON = "cell_on";
9413    }
9414
9415    /**
9416     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
9417     * Intent URL, allowing it to be either a web page or a particular
9418     * application activity.
9419     *
9420     * @hide
9421     */
9422    public static final class Bookmarks implements BaseColumns
9423    {
9424        private static final String TAG = "Bookmarks";
9425
9426        /**
9427         * The content:// style URL for this table
9428         */
9429        public static final Uri CONTENT_URI =
9430            Uri.parse("content://" + AUTHORITY + "/bookmarks");
9431
9432        /**
9433         * The row ID.
9434         * <p>Type: INTEGER</p>
9435         */
9436        public static final String ID = "_id";
9437
9438        /**
9439         * Descriptive name of the bookmark that can be displayed to the user.
9440         * If this is empty, the title should be resolved at display time (use
9441         * {@link #getTitle(Context, Cursor)} any time you want to display the
9442         * title of a bookmark.)
9443         * <P>
9444         * Type: TEXT
9445         * </P>
9446         */
9447        public static final String TITLE = "title";
9448
9449        /**
9450         * Arbitrary string (displayed to the user) that allows bookmarks to be
9451         * organized into categories.  There are some special names for
9452         * standard folders, which all start with '@'.  The label displayed for
9453         * the folder changes with the locale (via {@link #getLabelForFolder}) but
9454         * the folder name does not change so you can consistently query for
9455         * the folder regardless of the current locale.
9456         *
9457         * <P>Type: TEXT</P>
9458         *
9459         */
9460        public static final String FOLDER = "folder";
9461
9462        /**
9463         * The Intent URL of the bookmark, describing what it points to.  This
9464         * value is given to {@link android.content.Intent#getIntent} to create
9465         * an Intent that can be launched.
9466         * <P>Type: TEXT</P>
9467         */
9468        public static final String INTENT = "intent";
9469
9470        /**
9471         * Optional shortcut character associated with this bookmark.
9472         * <P>Type: INTEGER</P>
9473         */
9474        public static final String SHORTCUT = "shortcut";
9475
9476        /**
9477         * The order in which the bookmark should be displayed
9478         * <P>Type: INTEGER</P>
9479         */
9480        public static final String ORDERING = "ordering";
9481
9482        private static final String[] sIntentProjection = { INTENT };
9483        private static final String[] sShortcutProjection = { ID, SHORTCUT };
9484        private static final String sShortcutSelection = SHORTCUT + "=?";
9485
9486        /**
9487         * Convenience function to retrieve the bookmarked Intent for a
9488         * particular shortcut key.
9489         *
9490         * @param cr The ContentResolver to query.
9491         * @param shortcut The shortcut key.
9492         *
9493         * @return Intent The bookmarked URL, or null if there is no bookmark
9494         *         matching the given shortcut.
9495         */
9496        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
9497        {
9498            Intent intent = null;
9499
9500            Cursor c = cr.query(CONTENT_URI,
9501                    sIntentProjection, sShortcutSelection,
9502                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
9503            // Keep trying until we find a valid shortcut
9504            try {
9505                while (intent == null && c.moveToNext()) {
9506                    try {
9507                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
9508                        intent = Intent.parseUri(intentURI, 0);
9509                    } catch (java.net.URISyntaxException e) {
9510                        // The stored URL is bad...  ignore it.
9511                    } catch (IllegalArgumentException e) {
9512                        // Column not found
9513                        Log.w(TAG, "Intent column not found", e);
9514                    }
9515                }
9516            } finally {
9517                if (c != null) c.close();
9518            }
9519
9520            return intent;
9521        }
9522
9523        /**
9524         * Add a new bookmark to the system.
9525         *
9526         * @param cr The ContentResolver to query.
9527         * @param intent The desired target of the bookmark.
9528         * @param title Bookmark title that is shown to the user; null if none
9529         *            or it should be resolved to the intent's title.
9530         * @param folder Folder in which to place the bookmark; null if none.
9531         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
9532         *            this is non-zero and there is an existing bookmark entry
9533         *            with this same shortcut, then that existing shortcut is
9534         *            cleared (the bookmark is not removed).
9535         * @return The unique content URL for the new bookmark entry.
9536         */
9537        public static Uri add(ContentResolver cr,
9538                                           Intent intent,
9539                                           String title,
9540                                           String folder,
9541                                           char shortcut,
9542                                           int ordering)
9543        {
9544            // If a shortcut is supplied, and it is already defined for
9545            // another bookmark, then remove the old definition.
9546            if (shortcut != 0) {
9547                cr.delete(CONTENT_URI, sShortcutSelection,
9548                        new String[] { String.valueOf((int) shortcut) });
9549            }
9550
9551            ContentValues values = new ContentValues();
9552            if (title != null) values.put(TITLE, title);
9553            if (folder != null) values.put(FOLDER, folder);
9554            values.put(INTENT, intent.toUri(0));
9555            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
9556            values.put(ORDERING, ordering);
9557            return cr.insert(CONTENT_URI, values);
9558        }
9559
9560        /**
9561         * Return the folder name as it should be displayed to the user.  This
9562         * takes care of localizing special folders.
9563         *
9564         * @param r Resources object for current locale; only need access to
9565         *          system resources.
9566         * @param folder The value found in the {@link #FOLDER} column.
9567         *
9568         * @return CharSequence The label for this folder that should be shown
9569         *         to the user.
9570         */
9571        public static CharSequence getLabelForFolder(Resources r, String folder) {
9572            return folder;
9573        }
9574
9575        /**
9576         * Return the title as it should be displayed to the user. This takes
9577         * care of localizing bookmarks that point to activities.
9578         *
9579         * @param context A context.
9580         * @param cursor A cursor pointing to the row whose title should be
9581         *        returned. The cursor must contain at least the {@link #TITLE}
9582         *        and {@link #INTENT} columns.
9583         * @return A title that is localized and can be displayed to the user,
9584         *         or the empty string if one could not be found.
9585         */
9586        public static CharSequence getTitle(Context context, Cursor cursor) {
9587            int titleColumn = cursor.getColumnIndex(TITLE);
9588            int intentColumn = cursor.getColumnIndex(INTENT);
9589            if (titleColumn == -1 || intentColumn == -1) {
9590                throw new IllegalArgumentException(
9591                        "The cursor must contain the TITLE and INTENT columns.");
9592            }
9593
9594            String title = cursor.getString(titleColumn);
9595            if (!TextUtils.isEmpty(title)) {
9596                return title;
9597            }
9598
9599            String intentUri = cursor.getString(intentColumn);
9600            if (TextUtils.isEmpty(intentUri)) {
9601                return "";
9602            }
9603
9604            Intent intent;
9605            try {
9606                intent = Intent.parseUri(intentUri, 0);
9607            } catch (URISyntaxException e) {
9608                return "";
9609            }
9610
9611            PackageManager packageManager = context.getPackageManager();
9612            ResolveInfo info = packageManager.resolveActivity(intent, 0);
9613            return info != null ? info.loadLabel(packageManager) : "";
9614        }
9615    }
9616
9617    /**
9618     * Returns the device ID that we should use when connecting to the mobile gtalk server.
9619     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
9620     * from the GoogleLoginService.
9621     *
9622     * @param androidId The Android ID for this device.
9623     * @return The device ID that should be used when connecting to the mobile gtalk server.
9624     * @hide
9625     */
9626    public static String getGTalkDeviceId(long androidId) {
9627        return "android-" + Long.toHexString(androidId);
9628    }
9629
9630    private static final String[] PM_WRITE_SETTINGS = {
9631        android.Manifest.permission.WRITE_SETTINGS
9632    };
9633    private static final String[] PM_CHANGE_NETWORK_STATE = {
9634        android.Manifest.permission.CHANGE_NETWORK_STATE,
9635        android.Manifest.permission.WRITE_SETTINGS
9636    };
9637    private static final String[] PM_SYSTEM_ALERT_WINDOW = {
9638        android.Manifest.permission.SYSTEM_ALERT_WINDOW
9639    };
9640
9641    /**
9642     * Performs a strict and comprehensive check of whether a calling package is allowed to
9643     * write/modify system settings, as the condition differs for pre-M, M+, and
9644     * privileged/preinstalled apps. If the provided uid does not match the
9645     * callingPackage, a negative result will be returned.
9646     * @hide
9647     */
9648    public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
9649            String callingPackage, boolean throwException) {
9650        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9651                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
9652                PM_WRITE_SETTINGS, false);
9653    }
9654
9655    /**
9656     * Performs a strict and comprehensive check of whether a calling package is allowed to
9657     * write/modify system settings, as the condition differs for pre-M, M+, and
9658     * privileged/preinstalled apps. If the provided uid does not match the
9659     * callingPackage, a negative result will be returned. The caller is expected to have
9660     * the WRITE_SETTINGS permission declared.
9661     *
9662     * Note: if the check is successful, the operation of this app will be updated to the
9663     * current time.
9664     * @hide
9665     */
9666    public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
9667            String callingPackage, boolean throwException) {
9668        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9669                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
9670                PM_WRITE_SETTINGS, true);
9671    }
9672
9673    /**
9674     * Performs a strict and comprehensive check of whether a calling package is allowed to
9675     * change the state of network, as the condition differs for pre-M, M+, and
9676     * privileged/preinstalled apps. The caller is expected to have either the
9677     * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
9678     * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
9679     * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
9680     * permission and cannot be revoked. See http://b/23597341
9681     *
9682     * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
9683     * of this app will be updated to the current time.
9684     * @hide
9685     */
9686    public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
9687            String callingPackage, boolean throwException) {
9688        if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
9689                == PackageManager.PERMISSION_GRANTED) {
9690            return true;
9691        }
9692        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9693                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
9694                PM_CHANGE_NETWORK_STATE, true);
9695    }
9696
9697    /**
9698     * Performs a strict and comprehensive check of whether a calling package is allowed to
9699     * draw on top of other apps, as the conditions differs for pre-M, M+, and
9700     * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
9701     * a negative result will be returned.
9702     * @hide
9703     */
9704    public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
9705            String callingPackage, boolean throwException) {
9706        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9707                callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
9708                PM_SYSTEM_ALERT_WINDOW, false);
9709    }
9710
9711    /**
9712     * Performs a strict and comprehensive check of whether a calling package is allowed to
9713     * draw on top of other apps, as the conditions differs for pre-M, M+, and
9714     * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
9715     * a negative result will be returned.
9716     *
9717     * Note: if the check is successful, the operation of this app will be updated to the
9718     * current time.
9719     * @hide
9720     */
9721    public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
9722            callingPackage, boolean throwException) {
9723        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
9724                callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
9725                PM_SYSTEM_ALERT_WINDOW, true);
9726    }
9727
9728    /**
9729     * Helper method to perform a general and comprehensive check of whether an operation that is
9730     * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
9731     * OP_WRITE_SETTINGS
9732     * @hide
9733     */
9734    public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
9735            int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
9736            permissions, boolean makeNote) {
9737        if (callingPackage == null) {
9738            return false;
9739        }
9740
9741        AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
9742        int mode = AppOpsManager.MODE_DEFAULT;
9743        if (makeNote) {
9744            mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
9745        } else {
9746            mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
9747        }
9748
9749        switch (mode) {
9750            case AppOpsManager.MODE_ALLOWED:
9751                return true;
9752
9753            case AppOpsManager.MODE_DEFAULT:
9754                // this is the default operating mode after an app's installation
9755                // In this case we will check all associated static permission to see
9756                // if it is granted during install time.
9757                for (String permission : permissions) {
9758                    if (context.checkCallingOrSelfPermission(permission) == PackageManager
9759                            .PERMISSION_GRANTED) {
9760                        // if either of the permissions are granted, we will allow it
9761                        return true;
9762                    }
9763                }
9764
9765            default:
9766                // this is for all other cases trickled down here...
9767                if (!throwException) {
9768                    return false;
9769                }
9770        }
9771
9772        // prepare string to throw SecurityException
9773        StringBuilder exceptionMessage = new StringBuilder();
9774        exceptionMessage.append(callingPackage);
9775        exceptionMessage.append(" was not granted ");
9776        if (permissions.length > 1) {
9777            exceptionMessage.append(" either of these permissions: ");
9778        } else {
9779            exceptionMessage.append(" this permission: ");
9780        }
9781        for (int i = 0; i < permissions.length; i++) {
9782            exceptionMessage.append(permissions[i]);
9783            exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
9784        }
9785
9786        throw new SecurityException(exceptionMessage.toString());
9787    }
9788
9789    /**
9790     * Retrieves a correponding package name for a given uid. It will query all
9791     * packages that are associated with the given uid, but it will return only
9792     * the zeroth result.
9793     * Note: If package could not be found, a null is returned.
9794     * @hide
9795     */
9796    public static String getPackageNameForUid(Context context, int uid) {
9797        String[] packages = context.getPackageManager().getPackagesForUid(uid);
9798        if (packages == null) {
9799            return null;
9800        }
9801        return packages[0];
9802    }
9803}
9804