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