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