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