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