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