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