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