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