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