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