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