Settings.java revision 2191a0c8570b518c8a62e2a7c5e03a5b32ce0aa0
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.app.SearchManager;
22import android.app.WallpaperManager;
23import android.content.ComponentName;
24import android.content.ContentResolver;
25import android.content.ContentValues;
26import android.content.Context;
27import android.content.IContentProvider;
28import android.content.Intent;
29import android.content.pm.ActivityInfo;
30import android.content.pm.PackageManager;
31import android.content.pm.ResolveInfo;
32import android.content.res.Configuration;
33import android.content.res.Resources;
34import android.database.Cursor;
35import android.database.SQLException;
36import android.net.ConnectivityManager;
37import android.net.Uri;
38import android.net.wifi.WifiManager;
39import android.os.BatteryManager;
40import android.os.Bundle;
41import android.os.DropBoxManager;
42import android.os.IBinder;
43import android.os.Process;
44import android.os.RemoteException;
45import android.os.ServiceManager;
46import android.os.SystemProperties;
47import android.os.UserHandle;
48import android.os.Build.VERSION_CODES;
49import android.speech.tts.TextToSpeech;
50import android.text.TextUtils;
51import android.util.AndroidException;
52import android.util.Log;
53
54import com.android.internal.widget.ILockSettings;
55
56import java.net.URISyntaxException;
57import java.util.HashMap;
58import java.util.HashSet;
59import java.util.Locale;
60
61/**
62 * The Settings provider contains global system-level device preferences.
63 */
64public final class Settings {
65
66    // Intent actions for Settings
67
68    /**
69     * Activity Action: Show system settings.
70     * <p>
71     * Input: Nothing.
72     * <p>
73     * Output: Nothing.
74     */
75    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
76    public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
77
78    /**
79     * Activity Action: Show settings to allow configuration of APNs.
80     * <p>
81     * Input: Nothing.
82     * <p>
83     * Output: Nothing.
84     */
85    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
86    public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
87
88    /**
89     * Activity Action: Show settings to allow configuration of current location
90     * sources.
91     * <p>
92     * In some cases, a matching Activity may not exist, so ensure you
93     * safeguard against this.
94     * <p>
95     * Input: Nothing.
96     * <p>
97     * Output: Nothing.
98     */
99    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
100    public static final String ACTION_LOCATION_SOURCE_SETTINGS =
101            "android.settings.LOCATION_SOURCE_SETTINGS";
102
103    /**
104     * Activity Action: Show settings to allow configuration of wireless controls
105     * such as Wi-Fi, Bluetooth and Mobile networks.
106     * <p>
107     * In some cases, a matching Activity may not exist, so ensure you
108     * safeguard against this.
109     * <p>
110     * Input: Nothing.
111     * <p>
112     * Output: Nothing.
113     */
114    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
115    public static final String ACTION_WIRELESS_SETTINGS =
116            "android.settings.WIRELESS_SETTINGS";
117
118    /**
119     * Activity Action: Show settings to allow entering/exiting airplane mode.
120     * <p>
121     * In some cases, a matching Activity may not exist, so ensure you
122     * safeguard against this.
123     * <p>
124     * Input: Nothing.
125     * <p>
126     * Output: Nothing.
127     */
128    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
129    public static final String ACTION_AIRPLANE_MODE_SETTINGS =
130            "android.settings.AIRPLANE_MODE_SETTINGS";
131
132    /**
133     * Activity Action: Show settings for accessibility modules.
134     * <p>
135     * In some cases, a matching Activity may not exist, so ensure you
136     * safeguard against this.
137     * <p>
138     * Input: Nothing.
139     * <p>
140     * Output: Nothing.
141     */
142    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
143    public static final String ACTION_ACCESSIBILITY_SETTINGS =
144            "android.settings.ACCESSIBILITY_SETTINGS";
145
146    /**
147     * Activity Action: Show settings to allow configuration of security and
148     * location privacy.
149     * <p>
150     * In some cases, a matching Activity may not exist, so ensure you
151     * safeguard against this.
152     * <p>
153     * Input: Nothing.
154     * <p>
155     * Output: Nothing.
156     */
157    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
158    public static final String ACTION_SECURITY_SETTINGS =
159            "android.settings.SECURITY_SETTINGS";
160
161    /**
162     * Activity Action: Show settings to allow configuration of privacy options.
163     * <p>
164     * In some cases, a matching Activity may not exist, so ensure you
165     * safeguard against this.
166     * <p>
167     * Input: Nothing.
168     * <p>
169     * Output: Nothing.
170     */
171    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
172    public static final String ACTION_PRIVACY_SETTINGS =
173            "android.settings.PRIVACY_SETTINGS";
174
175    /**
176     * Activity Action: Show settings to allow configuration of Wi-Fi.
177
178     * <p>
179     * In some cases, a matching Activity may not exist, so ensure you
180     * safeguard against this.
181     * <p>
182     * Input: Nothing.
183     * <p>
184     * Output: Nothing.
185
186     */
187    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
188    public static final String ACTION_WIFI_SETTINGS =
189            "android.settings.WIFI_SETTINGS";
190
191    /**
192     * Activity Action: Show settings to allow configuration of a static IP
193     * address for Wi-Fi.
194     * <p>
195     * In some cases, a matching Activity may not exist, so ensure you safeguard
196     * against this.
197     * <p>
198     * Input: Nothing.
199     * <p>
200     * Output: Nothing.
201     */
202    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
203    public static final String ACTION_WIFI_IP_SETTINGS =
204            "android.settings.WIFI_IP_SETTINGS";
205
206    /**
207     * Activity Action: Show settings to allow configuration of Bluetooth.
208     * <p>
209     * In some cases, a matching Activity may not exist, so ensure you
210     * safeguard against this.
211     * <p>
212     * Input: Nothing.
213     * <p>
214     * Output: Nothing.
215     */
216    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
217    public static final String ACTION_BLUETOOTH_SETTINGS =
218            "android.settings.BLUETOOTH_SETTINGS";
219
220    /**
221     * Activity Action: Show settings to allow configuration of Wifi Displays.
222     * <p>
223     * In some cases, a matching Activity may not exist, so ensure you
224     * safeguard against this.
225     * <p>
226     * Input: Nothing.
227     * <p>
228     * Output: Nothing.
229     * @hide
230     */
231    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
232    public static final String ACTION_WIFI_DISPLAY_SETTINGS =
233            "android.settings.WIFI_DISPLAY_SETTINGS";
234
235    /**
236     * Activity Action: Show settings to allow configuration of date and time.
237     * <p>
238     * In some cases, a matching Activity may not exist, so ensure you
239     * safeguard against this.
240     * <p>
241     * Input: Nothing.
242     * <p>
243     * Output: Nothing.
244     */
245    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
246    public static final String ACTION_DATE_SETTINGS =
247            "android.settings.DATE_SETTINGS";
248
249    /**
250     * Activity Action: Show settings to allow configuration of sound and volume.
251     * <p>
252     * In some cases, a matching Activity may not exist, so ensure you
253     * safeguard against this.
254     * <p>
255     * Input: Nothing.
256     * <p>
257     * Output: Nothing.
258     */
259    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
260    public static final String ACTION_SOUND_SETTINGS =
261            "android.settings.SOUND_SETTINGS";
262
263    /**
264     * Activity Action: Show settings to allow configuration of display.
265     * <p>
266     * In some cases, a matching Activity may not exist, so ensure you
267     * safeguard against this.
268     * <p>
269     * Input: Nothing.
270     * <p>
271     * Output: Nothing.
272     */
273    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
274    public static final String ACTION_DISPLAY_SETTINGS =
275            "android.settings.DISPLAY_SETTINGS";
276
277    /**
278     * Activity Action: Show settings to allow configuration of locale.
279     * <p>
280     * In some cases, a matching Activity may not exist, so ensure you
281     * safeguard against this.
282     * <p>
283     * Input: Nothing.
284     * <p>
285     * Output: Nothing.
286     */
287    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
288    public static final String ACTION_LOCALE_SETTINGS =
289            "android.settings.LOCALE_SETTINGS";
290
291    /**
292     * Activity Action: Show settings to configure input methods, in particular
293     * allowing the user to enable input methods.
294     * <p>
295     * In some cases, a matching Activity may not exist, so ensure you
296     * safeguard against this.
297     * <p>
298     * Input: Nothing.
299     * <p>
300     * Output: Nothing.
301     */
302    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
303    public static final String ACTION_INPUT_METHOD_SETTINGS =
304            "android.settings.INPUT_METHOD_SETTINGS";
305
306    /**
307     * Activity Action: Show settings to enable/disable input method subtypes.
308     * <p>
309     * In some cases, a matching Activity may not exist, so ensure you
310     * safeguard against this.
311     * <p>
312     * To tell which input method's subtypes are displayed in the settings, add
313     * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
314     * If there is no extra in this Intent, subtypes from all installed input methods
315     * will be displayed in the settings.
316     *
317     * @see android.view.inputmethod.InputMethodInfo#getId
318     * <p>
319     * Input: Nothing.
320     * <p>
321     * Output: Nothing.
322     */
323    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
324    public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
325            "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
326
327    /**
328     * Activity Action: Show a dialog to select input method.
329     * <p>
330     * In some cases, a matching Activity may not exist, so ensure you
331     * safeguard against this.
332     * <p>
333     * Input: Nothing.
334     * <p>
335     * Output: Nothing.
336     * @hide
337     */
338    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
339    public static final String ACTION_SHOW_INPUT_METHOD_PICKER =
340            "android.settings.SHOW_INPUT_METHOD_PICKER";
341
342    /**
343     * Activity Action: Show settings to manage the user input dictionary.
344     * <p>
345     * Starting with {@link android.os.Build.VERSION_CODES#KEY_LIME_PIE},
346     * it is guaranteed there will always be an appropriate implementation for this Intent action.
347     * In prior releases of the platform this was optional, so ensure you safeguard against it.
348     * <p>
349     * Input: Nothing.
350     * <p>
351     * Output: Nothing.
352     */
353    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
354    public static final String ACTION_USER_DICTIONARY_SETTINGS =
355            "android.settings.USER_DICTIONARY_SETTINGS";
356
357    /**
358     * Activity Action: Adds a word to the user dictionary.
359     * <p>
360     * In some cases, a matching Activity may not exist, so ensure you
361     * safeguard against this.
362     * <p>
363     * Input: An extra with key <code>word</code> that contains the word
364     * that should be added to the dictionary.
365     * <p>
366     * Output: Nothing.
367     *
368     * @hide
369     */
370    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
371    public static final String ACTION_USER_DICTIONARY_INSERT =
372            "com.android.settings.USER_DICTIONARY_INSERT";
373
374    /**
375     * Activity Action: Show settings to allow configuration of application-related settings.
376     * <p>
377     * In some cases, a matching Activity may not exist, so ensure you
378     * safeguard against this.
379     * <p>
380     * Input: Nothing.
381     * <p>
382     * Output: Nothing.
383     */
384    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
385    public static final String ACTION_APPLICATION_SETTINGS =
386            "android.settings.APPLICATION_SETTINGS";
387
388    /**
389     * Activity Action: Show settings to allow configuration of application
390     * development-related settings.  As of
391     * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
392     * a required part of the platform.
393     * <p>
394     * Input: Nothing.
395     * <p>
396     * Output: Nothing.
397     */
398    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
399    public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
400            "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
401
402    /**
403     * Activity Action: Show settings to allow configuration of quick launch shortcuts.
404     * <p>
405     * In some cases, a matching Activity may not exist, so ensure you
406     * safeguard against this.
407     * <p>
408     * Input: Nothing.
409     * <p>
410     * Output: Nothing.
411     */
412    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
413    public static final String ACTION_QUICK_LAUNCH_SETTINGS =
414            "android.settings.QUICK_LAUNCH_SETTINGS";
415
416    /**
417     * Activity Action: Show settings to manage installed applications.
418     * <p>
419     * In some cases, a matching Activity may not exist, so ensure you
420     * safeguard against this.
421     * <p>
422     * Input: Nothing.
423     * <p>
424     * Output: Nothing.
425     */
426    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
427    public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
428            "android.settings.MANAGE_APPLICATIONS_SETTINGS";
429
430    /**
431     * Activity Action: Show settings to manage all applications.
432     * <p>
433     * In some cases, a matching Activity may not exist, so ensure you
434     * safeguard against this.
435     * <p>
436     * Input: Nothing.
437     * <p>
438     * Output: Nothing.
439     */
440    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
441    public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
442            "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
443
444    /**
445     * Activity Action: Show screen of details about a particular application.
446     * <p>
447     * In some cases, a matching Activity may not exist, so ensure you
448     * safeguard against this.
449     * <p>
450     * Input: The Intent's data URI specifies the application package name
451     * to be shown, with the "package" scheme.  That is "package:com.my.app".
452     * <p>
453     * Output: Nothing.
454     */
455    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
456    public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
457            "android.settings.APPLICATION_DETAILS_SETTINGS";
458
459    /**
460     * @hide
461     * Activity Action: Show the "app ops" settings screen.
462     * <p>
463     * Input: Nothing.
464     * <p>
465     * Output: Nothing.
466     */
467    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
468    public static final String ACTION_APP_OPS_SETTINGS =
469            "android.settings.APP_OPS_SETTINGS";
470
471    /**
472     * Activity Action: Show settings for system update functionality.
473     * <p>
474     * In some cases, a matching Activity may not exist, so ensure you
475     * safeguard against this.
476     * <p>
477     * Input: Nothing.
478     * <p>
479     * Output: Nothing.
480     *
481     * @hide
482     */
483    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
484    public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
485            "android.settings.SYSTEM_UPDATE_SETTINGS";
486
487    /**
488     * Activity Action: Show settings to allow configuration of sync settings.
489     * <p>
490     * In some cases, a matching Activity may not exist, so ensure you
491     * safeguard against this.
492     * <p>
493     * The account types available to add via the add account button may be restricted by adding an
494     * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
495     * authorities. Only account types which can sync with that content provider will be offered to
496     * the user.
497     * <p>
498     * Input: Nothing.
499     * <p>
500     * Output: Nothing.
501     */
502    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
503    public static final String ACTION_SYNC_SETTINGS =
504            "android.settings.SYNC_SETTINGS";
505
506    /**
507     * Activity Action: Show add account screen for creating a new account.
508     * <p>
509     * In some cases, a matching Activity may not exist, so ensure you
510     * safeguard against this.
511     * <p>
512     * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
513     * extra to the Intent with one or more syncable content provider's authorities.  Only account
514     * types which can sync with that content provider will be offered to the user.
515     * <p>
516     * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the
517     * Intent with one or more account types.
518     * <p>
519     * Input: Nothing.
520     * <p>
521     * Output: Nothing.
522     */
523    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
524    public static final String ACTION_ADD_ACCOUNT =
525            "android.settings.ADD_ACCOUNT_SETTINGS";
526
527    /**
528     * Activity Action: Show settings for selecting the network operator.
529     * <p>
530     * In some cases, a matching Activity may not exist, so ensure you
531     * safeguard against this.
532     * <p>
533     * Input: Nothing.
534     * <p>
535     * Output: Nothing.
536     */
537    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
538    public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
539            "android.settings.NETWORK_OPERATOR_SETTINGS";
540
541    /**
542     * Activity Action: Show settings for selection of 2G/3G.
543     * <p>
544     * In some cases, a matching Activity may not exist, so ensure you
545     * safeguard against this.
546     * <p>
547     * Input: Nothing.
548     * <p>
549     * Output: Nothing.
550     */
551    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
552    public static final String ACTION_DATA_ROAMING_SETTINGS =
553            "android.settings.DATA_ROAMING_SETTINGS";
554
555    /**
556     * Activity Action: Show settings for internal storage.
557     * <p>
558     * In some cases, a matching Activity may not exist, so ensure you
559     * safeguard against this.
560     * <p>
561     * Input: Nothing.
562     * <p>
563     * Output: Nothing.
564     */
565    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
566    public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
567            "android.settings.INTERNAL_STORAGE_SETTINGS";
568    /**
569     * Activity Action: Show settings for memory card storage.
570     * <p>
571     * In some cases, a matching Activity may not exist, so ensure you
572     * safeguard against this.
573     * <p>
574     * Input: Nothing.
575     * <p>
576     * Output: Nothing.
577     */
578    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
579    public static final String ACTION_MEMORY_CARD_SETTINGS =
580            "android.settings.MEMORY_CARD_SETTINGS";
581
582    /**
583     * Activity Action: Show settings for global search.
584     * <p>
585     * In some cases, a matching Activity may not exist, so ensure you
586     * safeguard against this.
587     * <p>
588     * Input: Nothing.
589     * <p>
590     * Output: Nothing
591     */
592    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
593    public static final String ACTION_SEARCH_SETTINGS =
594        "android.search.action.SEARCH_SETTINGS";
595
596    /**
597     * Activity Action: Show general device information settings (serial
598     * number, software version, phone number, etc.).
599     * <p>
600     * In some cases, a matching Activity may not exist, so ensure you
601     * safeguard against this.
602     * <p>
603     * Input: Nothing.
604     * <p>
605     * Output: Nothing
606     */
607    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
608    public static final String ACTION_DEVICE_INFO_SETTINGS =
609        "android.settings.DEVICE_INFO_SETTINGS";
610
611    /**
612     * Activity Action: Show NFC settings.
613     * <p>
614     * This shows UI that allows NFC to be turned on or off.
615     * <p>
616     * In some cases, a matching Activity may not exist, so ensure you
617     * safeguard against this.
618     * <p>
619     * Input: Nothing.
620     * <p>
621     * Output: Nothing
622     * @see android.nfc.NfcAdapter#isEnabled()
623     */
624    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
625    public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
626
627    /**
628     * Activity Action: Show NFC Sharing settings.
629     * <p>
630     * This shows UI that allows NDEF Push (Android Beam) to be turned on or
631     * off.
632     * <p>
633     * In some cases, a matching Activity may not exist, so ensure you
634     * safeguard against this.
635     * <p>
636     * Input: Nothing.
637     * <p>
638     * Output: Nothing
639     * @see android.nfc.NfcAdapter#isNdefPushEnabled()
640     */
641    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
642    public static final String ACTION_NFCSHARING_SETTINGS =
643        "android.settings.NFCSHARING_SETTINGS";
644
645    /**
646     * Activity Action: Show Daydream settings.
647     * <p>
648     * In some cases, a matching Activity may not exist, so ensure you
649     * safeguard against this.
650     * <p>
651     * Input: Nothing.
652     * <p>
653     * Output: Nothing.
654     * @see android.service.dreams.DreamService
655     */
656    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
657    public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
658
659    /**
660     * Activity Action: Show Notification listener settings.
661     * <p>
662     * In some cases, a matching Activity may not exist, so ensure you
663     * safeguard against this.
664     * <p>
665     * Input: Nothing.
666     * <p>
667     * Output: Nothing.
668     * @see android.service.notification.NotificationListenerService
669     * @hide
670     */
671    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
672    public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS
673            = "android.settings.NOTIFICATION_LISTENER_SETTINGS";
674
675    // End of Intent actions for Settings
676
677    /**
678     * @hide - Private call() method on SettingsProvider to read from 'system' table.
679     */
680    public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
681
682    /**
683     * @hide - Private call() method on SettingsProvider to read from 'secure' table.
684     */
685    public static final String CALL_METHOD_GET_SECURE = "GET_secure";
686
687    /**
688     * @hide - Private call() method on SettingsProvider to read from 'global' table.
689     */
690    public static final String CALL_METHOD_GET_GLOBAL = "GET_global";
691
692    /**
693     * @hide - User handle argument extra to the fast-path call()-based requests
694     */
695    public static final String CALL_METHOD_USER_KEY = "_user";
696
697    /** @hide - Private call() method to write to 'system' table */
698    public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
699
700    /** @hide - Private call() method to write to 'secure' table */
701    public static final String CALL_METHOD_PUT_SECURE = "PUT_secure";
702
703    /** @hide - Private call() method to write to 'global' table */
704    public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global";
705
706    /**
707     * Activity Extra: Limit available options in launched activity based on the given authority.
708     * <p>
709     * This can be passed as an extra field in an Activity Intent with one or more syncable content
710     * provider's authorities as a String[]. This field is used by some intents to alter the
711     * behavior of the called activity.
712     * <p>
713     * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
714     * on the authority given.
715     */
716    public static final String EXTRA_AUTHORITIES = "authorities";
717
718    /**
719     * Activity Extra: Limit available options in launched activity based on the given account
720     * types.
721     * <p>
722     * This can be passed as an extra field in an Activity Intent with one or more account types
723     * as a String[]. This field is used by some intents to alter the behavior of the called
724     * activity.
725     * <p>
726     * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified
727     * list.
728     */
729    public static final String EXTRA_ACCOUNT_TYPES = "account_types";
730
731    public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
732
733    private static final String JID_RESOURCE_PREFIX = "android";
734
735    public static final String AUTHORITY = "settings";
736
737    private static final String TAG = "Settings";
738    private static final boolean LOCAL_LOGV = false;
739
740    public static class SettingNotFoundException extends AndroidException {
741        public SettingNotFoundException(String msg) {
742            super(msg);
743        }
744    }
745
746    /**
747     * Common base for tables of name/value settings.
748     */
749    public static class NameValueTable implements BaseColumns {
750        public static final String NAME = "name";
751        public static final String VALUE = "value";
752
753        protected static boolean putString(ContentResolver resolver, Uri uri,
754                String name, String value) {
755            // The database will take care of replacing duplicates.
756            try {
757                ContentValues values = new ContentValues();
758                values.put(NAME, name);
759                values.put(VALUE, value);
760                resolver.insert(uri, values);
761                return true;
762            } catch (SQLException e) {
763                Log.w(TAG, "Can't set key " + name + " in " + uri, e);
764                return false;
765            }
766        }
767
768        public static Uri getUriFor(Uri uri, String name) {
769            return Uri.withAppendedPath(uri, name);
770        }
771    }
772
773    // Thread-safe.
774    private static class NameValueCache {
775        private final String mVersionSystemProperty;
776        private final Uri mUri;
777
778        private static final String[] SELECT_VALUE =
779            new String[] { Settings.NameValueTable.VALUE };
780        private static final String NAME_EQ_PLACEHOLDER = "name=?";
781
782        // Must synchronize on 'this' to access mValues and mValuesVersion.
783        private final HashMap<String, String> mValues = new HashMap<String, String>();
784        private long mValuesVersion = 0;
785
786        // Initially null; set lazily and held forever.  Synchronized on 'this'.
787        private IContentProvider mContentProvider = null;
788
789        // The method we'll call (or null, to not use) on the provider
790        // for the fast path of retrieving settings.
791        private final String mCallGetCommand;
792        private final String mCallSetCommand;
793
794        public NameValueCache(String versionSystemProperty, Uri uri,
795                String getCommand, String setCommand) {
796            mVersionSystemProperty = versionSystemProperty;
797            mUri = uri;
798            mCallGetCommand = getCommand;
799            mCallSetCommand = setCommand;
800        }
801
802        private IContentProvider lazyGetProvider(ContentResolver cr) {
803            IContentProvider cp = null;
804            synchronized (this) {
805                cp = mContentProvider;
806                if (cp == null) {
807                    cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
808                }
809            }
810            return cp;
811        }
812
813        public boolean putStringForUser(ContentResolver cr, String name, String value,
814                final int userHandle) {
815            try {
816                Bundle arg = new Bundle();
817                arg.putString(Settings.NameValueTable.VALUE, value);
818                arg.putInt(CALL_METHOD_USER_KEY, userHandle);
819                IContentProvider cp = lazyGetProvider(cr);
820                cp.call(cr.getPackageName(), mCallSetCommand, name, arg);
821            } catch (RemoteException e) {
822                Log.w(TAG, "Can't set key " + name + " in " + mUri, e);
823                return false;
824            }
825            return true;
826        }
827
828        public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
829            final boolean isSelf = (userHandle == UserHandle.myUserId());
830            if (isSelf) {
831                long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
832
833                // Our own user's settings data uses a client-side cache
834                synchronized (this) {
835                    if (mValuesVersion != newValuesVersion) {
836                        if (LOCAL_LOGV || false) {
837                            Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current "
838                                    + newValuesVersion + " != cached " + mValuesVersion);
839                        }
840
841                        mValues.clear();
842                        mValuesVersion = newValuesVersion;
843                    }
844
845                    if (mValues.containsKey(name)) {
846                        return mValues.get(name);  // Could be null, that's OK -- negative caching
847                    }
848                }
849            } else {
850                if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle
851                        + " by user " + UserHandle.myUserId() + " so skipping cache");
852            }
853
854            IContentProvider cp = lazyGetProvider(cr);
855
856            // Try the fast path first, not using query().  If this
857            // fails (alternate Settings provider that doesn't support
858            // this interface?) then we fall back to the query/table
859            // interface.
860            if (mCallGetCommand != null) {
861                try {
862                    Bundle args = null;
863                    if (!isSelf) {
864                        args = new Bundle();
865                        args.putInt(CALL_METHOD_USER_KEY, userHandle);
866                    }
867                    Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
868                    if (b != null) {
869                        String value = b.getPairValue();
870                        // Don't update our cache for reads of other users' data
871                        if (isSelf) {
872                            synchronized (this) {
873                                mValues.put(name, value);
874                            }
875                        } else {
876                            if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
877                                    + " by " + UserHandle.myUserId()
878                                    + " so not updating cache");
879                        }
880                        return value;
881                    }
882                    // If the response Bundle is null, we fall through
883                    // to the query interface below.
884                } catch (RemoteException e) {
885                    // Not supported by the remote side?  Fall through
886                    // to query().
887                }
888            }
889
890            Cursor c = null;
891            try {
892                c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
893                             new String[]{name}, null, null);
894                if (c == null) {
895                    Log.w(TAG, "Can't get key " + name + " from " + mUri);
896                    return null;
897                }
898
899                String value = c.moveToNext() ? c.getString(0) : null;
900                synchronized (this) {
901                    mValues.put(name, value);
902                }
903                if (LOCAL_LOGV) {
904                    Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
905                            name + " = " + (value == null ? "(null)" : value));
906                }
907                return value;
908            } catch (RemoteException e) {
909                Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
910                return null;  // Return null, but don't cache it.
911            } finally {
912                if (c != null) c.close();
913            }
914        }
915    }
916
917    /**
918     * System settings, containing miscellaneous system preferences.  This
919     * table holds simple name/value pairs.  There are convenience
920     * functions for accessing individual settings entries.
921     */
922    public static final class System extends NameValueTable {
923        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
924
925        /**
926         * The content:// style URL for this table
927         */
928        public static final Uri CONTENT_URI =
929            Uri.parse("content://" + AUTHORITY + "/system");
930
931        private static final NameValueCache sNameValueCache = new NameValueCache(
932                SYS_PROP_SETTING_VERSION,
933                CONTENT_URI,
934                CALL_METHOD_GET_SYSTEM,
935                CALL_METHOD_PUT_SYSTEM);
936
937        private static final HashSet<String> MOVED_TO_SECURE;
938        static {
939            MOVED_TO_SECURE = new HashSet<String>(30);
940            MOVED_TO_SECURE.add(Secure.ANDROID_ID);
941            MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
942            MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
943            MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
944            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
945            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
946            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
947            MOVED_TO_SECURE.add(Secure.LOGGING_ID);
948            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
949            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
950            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
951            MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
952            MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
953            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
954            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
955            MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
956            MOVED_TO_SECURE.add(Secure.WIFI_ON);
957            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
958            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
959            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
960            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
961            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
962            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
963            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
964            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
965            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
966            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
967            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
968        }
969
970        private static final HashSet<String> MOVED_TO_GLOBAL;
971        private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL;
972        static {
973            MOVED_TO_GLOBAL = new HashSet<String>();
974            MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>();
975
976            // these were originally in system but migrated to secure in the past,
977            // so are duplicated in the Secure.* namespace
978            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED);
979            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON);
980            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING);
981            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED);
982            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.INSTALL_NON_MARKET_APPS);
983            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED);
984            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY);
985
986            // these are moving directly from system to global
987            MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON);
988            MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS);
989            MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
990            MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME);
991            MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE);
992            MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND);
993            MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND);
994            MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND);
995            MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND);
996            MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED);
997            MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND);
998            MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND);
999            MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND);
1000            MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED);
1001            MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
1002            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY);
1003            MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
1004            MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE);
1005            MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE);
1006            MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE);
1007            MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS);
1008            MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE);
1009            MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE);
1010            MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY);
1011            MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP);
1012            MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER);
1013            MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES);
1014            MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES);
1015            MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL);
1016            MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL);
1017            MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL);
1018            MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL);
1019            MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL);
1020            MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL);
1021            MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL);
1022            MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL);
1023        }
1024
1025        /** @hide */
1026        public static void getMovedKeys(HashSet<String> outKeySet) {
1027            outKeySet.addAll(MOVED_TO_GLOBAL);
1028            outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL);
1029        }
1030
1031        /** @hide */
1032        public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) {
1033            outKeySet.addAll(MOVED_TO_GLOBAL);
1034        }
1035
1036        /**
1037         * Look up a name in the database.
1038         * @param resolver to access the database with
1039         * @param name to look up in the table
1040         * @return the corresponding value, or null if not present
1041         */
1042        public static String getString(ContentResolver resolver, String name) {
1043            return getStringForUser(resolver, name, UserHandle.myUserId());
1044        }
1045
1046        /** @hide */
1047        public static String getStringForUser(ContentResolver resolver, String name,
1048                int userHandle) {
1049            if (MOVED_TO_SECURE.contains(name)) {
1050                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1051                        + " to android.provider.Settings.Secure, returning read-only value.");
1052                return Secure.getStringForUser(resolver, name, userHandle);
1053            }
1054            if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
1055                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1056                        + " to android.provider.Settings.Global, returning read-only value.");
1057                return Global.getStringForUser(resolver, name, userHandle);
1058            }
1059            return sNameValueCache.getStringForUser(resolver, name, userHandle);
1060        }
1061
1062        /**
1063         * Store a name/value pair into the database.
1064         * @param resolver to access the database with
1065         * @param name to store
1066         * @param value to associate with the name
1067         * @return true if the value was set, false on database errors
1068         */
1069        public static boolean putString(ContentResolver resolver, String name, String value) {
1070            return putStringForUser(resolver, name, value, UserHandle.myUserId());
1071        }
1072
1073        /** @hide */
1074        public static boolean putStringForUser(ContentResolver resolver, String name, String value,
1075                int userHandle) {
1076            if (MOVED_TO_SECURE.contains(name)) {
1077                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1078                        + " to android.provider.Settings.Secure, value is unchanged.");
1079                return false;
1080            }
1081            if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
1082                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1083                        + " to android.provider.Settings.Global, value is unchanged.");
1084                return false;
1085            }
1086            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
1087        }
1088
1089        /**
1090         * Construct the content URI for a particular name/value pair,
1091         * useful for monitoring changes with a ContentObserver.
1092         * @param name to look up in the table
1093         * @return the corresponding content URI, or null if not present
1094         */
1095        public static Uri getUriFor(String name) {
1096            if (MOVED_TO_SECURE.contains(name)) {
1097                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1098                    + " to android.provider.Settings.Secure, returning Secure URI.");
1099                return Secure.getUriFor(Secure.CONTENT_URI, name);
1100            }
1101            if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
1102                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1103                        + " to android.provider.Settings.Global, returning read-only global URI.");
1104                return Global.getUriFor(Global.CONTENT_URI, name);
1105            }
1106            return getUriFor(CONTENT_URI, name);
1107        }
1108
1109        /**
1110         * Convenience function for retrieving a single system settings value
1111         * as an integer.  Note that internally setting values are always
1112         * stored as strings; this function converts the string to an integer
1113         * for you.  The default value will be returned if the setting is
1114         * not defined or not an integer.
1115         *
1116         * @param cr The ContentResolver to access.
1117         * @param name The name of the setting to retrieve.
1118         * @param def Value to return if the setting is not defined.
1119         *
1120         * @return The setting's current value, or 'def' if it is not defined
1121         * or not a valid integer.
1122         */
1123        public static int getInt(ContentResolver cr, String name, int def) {
1124            return getIntForUser(cr, name, def, UserHandle.myUserId());
1125        }
1126
1127        /** @hide */
1128        public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
1129            String v = getStringForUser(cr, name, userHandle);
1130            try {
1131                return v != null ? Integer.parseInt(v) : def;
1132            } catch (NumberFormatException e) {
1133                return def;
1134            }
1135        }
1136
1137        /**
1138         * Convenience function for retrieving a single system settings value
1139         * as an integer.  Note that internally setting values are always
1140         * stored as strings; this function converts the string to an integer
1141         * for you.
1142         * <p>
1143         * This version does not take a default value.  If the setting has not
1144         * been set, or the string value is not a number,
1145         * it throws {@link SettingNotFoundException}.
1146         *
1147         * @param cr The ContentResolver to access.
1148         * @param name The name of the setting to retrieve.
1149         *
1150         * @throws SettingNotFoundException Thrown if a setting by the given
1151         * name can't be found or the setting value is not an integer.
1152         *
1153         * @return The setting's current value.
1154         */
1155        public static int getInt(ContentResolver cr, String name)
1156                throws SettingNotFoundException {
1157            return getIntForUser(cr, name, UserHandle.myUserId());
1158        }
1159
1160        /** @hide */
1161        public static int getIntForUser(ContentResolver cr, String name, int userHandle)
1162                throws SettingNotFoundException {
1163            String v = getStringForUser(cr, name, userHandle);
1164            try {
1165                return Integer.parseInt(v);
1166            } catch (NumberFormatException e) {
1167                throw new SettingNotFoundException(name);
1168            }
1169        }
1170
1171        /**
1172         * Convenience function for updating a single settings value as an
1173         * integer. This will either create a new entry in the table if the
1174         * given name does not exist, or modify the value of the existing row
1175         * with that name.  Note that internally setting values are always
1176         * stored as strings, so this function converts the given value to a
1177         * string before storing it.
1178         *
1179         * @param cr The ContentResolver to access.
1180         * @param name The name of the setting to modify.
1181         * @param value The new value for the setting.
1182         * @return true if the value was set, false on database errors
1183         */
1184        public static boolean putInt(ContentResolver cr, String name, int value) {
1185            return putIntForUser(cr, name, value, UserHandle.myUserId());
1186        }
1187
1188        /** @hide */
1189        public static boolean putIntForUser(ContentResolver cr, String name, int value,
1190                int userHandle) {
1191            return putStringForUser(cr, name, Integer.toString(value), userHandle);
1192        }
1193
1194        /**
1195         * Convenience function for retrieving a single system settings value
1196         * as a {@code long}.  Note that internally setting values are always
1197         * stored as strings; this function converts the string to a {@code long}
1198         * for you.  The default value will be returned if the setting is
1199         * not defined or not a {@code long}.
1200         *
1201         * @param cr The ContentResolver to access.
1202         * @param name The name of the setting to retrieve.
1203         * @param def Value to return if the setting is not defined.
1204         *
1205         * @return The setting's current value, or 'def' if it is not defined
1206         * or not a valid {@code long}.
1207         */
1208        public static long getLong(ContentResolver cr, String name, long def) {
1209            return getLongForUser(cr, name, def, UserHandle.myUserId());
1210        }
1211
1212        /** @hide */
1213        public static long getLongForUser(ContentResolver cr, String name, long def,
1214                int userHandle) {
1215            String valString = getStringForUser(cr, name, userHandle);
1216            long value;
1217            try {
1218                value = valString != null ? Long.parseLong(valString) : def;
1219            } catch (NumberFormatException e) {
1220                value = def;
1221            }
1222            return value;
1223        }
1224
1225        /**
1226         * Convenience function for retrieving a single system settings value
1227         * as a {@code long}.  Note that internally setting values are always
1228         * stored as strings; this function converts the string to a {@code long}
1229         * for you.
1230         * <p>
1231         * This version does not take a default value.  If the setting has not
1232         * been set, or the string value is not a number,
1233         * it throws {@link SettingNotFoundException}.
1234         *
1235         * @param cr The ContentResolver to access.
1236         * @param name The name of the setting to retrieve.
1237         *
1238         * @return The setting's current value.
1239         * @throws SettingNotFoundException Thrown if a setting by the given
1240         * name can't be found or the setting value is not an integer.
1241         */
1242        public static long getLong(ContentResolver cr, String name)
1243                throws SettingNotFoundException {
1244            return getLongForUser(cr, name, UserHandle.myUserId());
1245        }
1246
1247        /** @hide */
1248        public static long getLongForUser(ContentResolver cr, String name, int userHandle)
1249                throws SettingNotFoundException {
1250            String valString = getStringForUser(cr, name, userHandle);
1251            try {
1252                return Long.parseLong(valString);
1253            } catch (NumberFormatException e) {
1254                throw new SettingNotFoundException(name);
1255            }
1256        }
1257
1258        /**
1259         * Convenience function for updating a single settings value as a long
1260         * integer. This will either create a new entry in the table if the
1261         * given name does not exist, or modify the value of the existing row
1262         * with that name.  Note that internally setting values are always
1263         * stored as strings, so this function converts the given value to a
1264         * string before storing it.
1265         *
1266         * @param cr The ContentResolver to access.
1267         * @param name The name of the setting to modify.
1268         * @param value The new value for the setting.
1269         * @return true if the value was set, false on database errors
1270         */
1271        public static boolean putLong(ContentResolver cr, String name, long value) {
1272            return putLongForUser(cr, name, value, UserHandle.myUserId());
1273        }
1274
1275        /** @hide */
1276        public static boolean putLongForUser(ContentResolver cr, String name, long value,
1277                int userHandle) {
1278            return putStringForUser(cr, name, Long.toString(value), userHandle);
1279        }
1280
1281        /**
1282         * Convenience function for retrieving a single system settings value
1283         * as a floating point number.  Note that internally setting values are
1284         * always stored as strings; this function converts the string to an
1285         * float for you. The default value will be returned if the setting
1286         * is not defined or not a valid float.
1287         *
1288         * @param cr The ContentResolver to access.
1289         * @param name The name of the setting to retrieve.
1290         * @param def Value to return if the setting is not defined.
1291         *
1292         * @return The setting's current value, or 'def' if it is not defined
1293         * or not a valid float.
1294         */
1295        public static float getFloat(ContentResolver cr, String name, float def) {
1296            return getFloatForUser(cr, name, def, UserHandle.myUserId());
1297        }
1298
1299        /** @hide */
1300        public static float getFloatForUser(ContentResolver cr, String name, float def,
1301                int userHandle) {
1302            String v = getStringForUser(cr, name, userHandle);
1303            try {
1304                return v != null ? Float.parseFloat(v) : def;
1305            } catch (NumberFormatException e) {
1306                return def;
1307            }
1308        }
1309
1310        /**
1311         * Convenience function for retrieving a single system settings value
1312         * as a float.  Note that internally setting values are always
1313         * stored as strings; this function converts the string to a float
1314         * for you.
1315         * <p>
1316         * This version does not take a default value.  If the setting has not
1317         * been set, or the string value is not a number,
1318         * it throws {@link SettingNotFoundException}.
1319         *
1320         * @param cr The ContentResolver to access.
1321         * @param name The name of the setting to retrieve.
1322         *
1323         * @throws SettingNotFoundException Thrown if a setting by the given
1324         * name can't be found or the setting value is not a float.
1325         *
1326         * @return The setting's current value.
1327         */
1328        public static float getFloat(ContentResolver cr, String name)
1329                throws SettingNotFoundException {
1330            return getFloatForUser(cr, name, UserHandle.myUserId());
1331        }
1332
1333        /** @hide */
1334        public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
1335                throws SettingNotFoundException {
1336            String v = getStringForUser(cr, name, userHandle);
1337            if (v == null) {
1338                throw new SettingNotFoundException(name);
1339            }
1340            try {
1341                return Float.parseFloat(v);
1342            } catch (NumberFormatException e) {
1343                throw new SettingNotFoundException(name);
1344            }
1345        }
1346
1347        /**
1348         * Convenience function for updating a single settings value as a
1349         * floating point number. This will either create a new entry in the
1350         * table if the given name does not exist, or modify the value of the
1351         * existing row with that name.  Note that internally setting values
1352         * are always stored as strings, so this function converts the given
1353         * value to a string before storing it.
1354         *
1355         * @param cr The ContentResolver to access.
1356         * @param name The name of the setting to modify.
1357         * @param value The new value for the setting.
1358         * @return true if the value was set, false on database errors
1359         */
1360        public static boolean putFloat(ContentResolver cr, String name, float value) {
1361            return putFloatForUser(cr, name, value, UserHandle.myUserId());
1362        }
1363
1364        /** @hide */
1365        public static boolean putFloatForUser(ContentResolver cr, String name, float value,
1366                int userHandle) {
1367            return putStringForUser(cr, name, Float.toString(value), userHandle);
1368        }
1369
1370        /**
1371         * Convenience function to read all of the current
1372         * configuration-related settings into a
1373         * {@link Configuration} object.
1374         *
1375         * @param cr The ContentResolver to access.
1376         * @param outConfig Where to place the configuration settings.
1377         */
1378        public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
1379            getConfigurationForUser(cr, outConfig, UserHandle.myUserId());
1380        }
1381
1382        /** @hide */
1383        public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig,
1384                int userHandle) {
1385            outConfig.fontScale = Settings.System.getFloatForUser(
1386                cr, FONT_SCALE, outConfig.fontScale, userHandle);
1387            if (outConfig.fontScale < 0) {
1388                outConfig.fontScale = 1;
1389            }
1390        }
1391
1392        /**
1393         * @hide Erase the fields in the Configuration that should be applied
1394         * by the settings.
1395         */
1396        public static void clearConfiguration(Configuration inoutConfig) {
1397            inoutConfig.fontScale = 0;
1398        }
1399
1400        /**
1401         * Convenience function to write a batch of configuration-related
1402         * settings from a {@link Configuration} object.
1403         *
1404         * @param cr The ContentResolver to access.
1405         * @param config The settings to write.
1406         * @return true if the values were set, false on database errors
1407         */
1408        public static boolean putConfiguration(ContentResolver cr, Configuration config) {
1409            return putConfigurationForUser(cr, config, UserHandle.myUserId());
1410        }
1411
1412        /** @hide */
1413        public static boolean putConfigurationForUser(ContentResolver cr, Configuration config,
1414                int userHandle) {
1415            return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle);
1416        }
1417
1418        /** @hide */
1419        public static boolean hasInterestingConfigurationChanges(int changes) {
1420            return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
1421        }
1422
1423        /** @deprecated - Do not use */
1424        @Deprecated
1425        public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
1426            return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId());
1427        }
1428
1429        /**
1430         * @hide
1431         * @deprecated - Do not use
1432         */
1433        public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr,
1434                int userHandle) {
1435            return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0;
1436        }
1437
1438        /** @deprecated - Do not use */
1439        @Deprecated
1440        public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1441            setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId());
1442        }
1443
1444        /**
1445         * @hide
1446         * @deprecated - Do not use
1447         */
1448        @Deprecated
1449        public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag,
1450                int userHandle) {
1451            putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
1452        }
1453
1454        /**
1455         * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
1456         */
1457        @Deprecated
1458        public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN;
1459
1460        /**
1461         * What happens when the user presses the end call button if they're not
1462         * on a call.<br/>
1463         * <b>Values:</b><br/>
1464         * 0 - The end button does nothing.<br/>
1465         * 1 - The end button goes to the home screen.<br/>
1466         * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1467         * 3 - The end button goes to the home screen.  If the user is already on the
1468         * home screen, it puts the device to sleep.
1469         */
1470        public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1471
1472        /**
1473         * END_BUTTON_BEHAVIOR value for "go home".
1474         * @hide
1475         */
1476        public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1477
1478        /**
1479         * END_BUTTON_BEHAVIOR value for "go to sleep".
1480         * @hide
1481         */
1482        public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1483
1484        /**
1485         * END_BUTTON_BEHAVIOR default value.
1486         * @hide
1487         */
1488        public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1489
1490        /**
1491         * Is advanced settings mode turned on. 0 == no, 1 == yes
1492         * @hide
1493         */
1494        public static final String ADVANCED_SETTINGS = "advanced_settings";
1495
1496        /**
1497         * ADVANCED_SETTINGS default value.
1498         * @hide
1499         */
1500        public static final int ADVANCED_SETTINGS_DEFAULT = 0;
1501
1502        /**
1503         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
1504         */
1505        @Deprecated
1506        public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON;
1507
1508        /**
1509         * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead
1510         */
1511        @Deprecated
1512        public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH;
1513
1514        /**
1515         * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead
1516         */
1517        @Deprecated
1518        public static final String RADIO_WIFI = Global.RADIO_WIFI;
1519
1520        /**
1521         * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead
1522         * {@hide}
1523         */
1524        @Deprecated
1525        public static final String RADIO_WIMAX = Global.RADIO_WIMAX;
1526
1527        /**
1528         * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead
1529         */
1530        @Deprecated
1531        public static final String RADIO_CELL = Global.RADIO_CELL;
1532
1533        /**
1534         * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead
1535         */
1536        @Deprecated
1537        public static final String RADIO_NFC = Global.RADIO_NFC;
1538
1539        /**
1540         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead
1541         */
1542        @Deprecated
1543        public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS;
1544
1545        /**
1546         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead
1547         *
1548         * {@hide}
1549         */
1550        @Deprecated
1551        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS =
1552                Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS;
1553
1554        /**
1555         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead
1556         */
1557        @Deprecated
1558        public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY;
1559
1560        /**
1561         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead
1562         */
1563        @Deprecated
1564        public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT;
1565
1566        /**
1567         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead
1568         */
1569        @Deprecated
1570        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED =
1571                Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
1572
1573        /**
1574         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead
1575         */
1576        @Deprecated
1577        public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER;
1578
1579        /**
1580         * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead
1581         */
1582        @Deprecated
1583        public static final String MODE_RINGER = Global.MODE_RINGER;
1584
1585        /**
1586         * Whether to use static IP and other static network attributes.
1587         * <p>
1588         * Set to 1 for true and 0 for false.
1589         *
1590         * @deprecated Use {@link WifiManager} instead
1591         */
1592        @Deprecated
1593        public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1594
1595        /**
1596         * The static IP address.
1597         * <p>
1598         * Example: "192.168.1.51"
1599         *
1600         * @deprecated Use {@link WifiManager} instead
1601         */
1602        @Deprecated
1603        public static final String WIFI_STATIC_IP = "wifi_static_ip";
1604
1605        /**
1606         * If using static IP, the gateway's IP address.
1607         * <p>
1608         * Example: "192.168.1.1"
1609         *
1610         * @deprecated Use {@link WifiManager} instead
1611         */
1612        @Deprecated
1613        public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1614
1615        /**
1616         * If using static IP, the net mask.
1617         * <p>
1618         * Example: "255.255.255.0"
1619         *
1620         * @deprecated Use {@link WifiManager} instead
1621         */
1622        @Deprecated
1623        public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1624
1625        /**
1626         * If using static IP, the primary DNS's IP address.
1627         * <p>
1628         * Example: "192.168.1.1"
1629         *
1630         * @deprecated Use {@link WifiManager} instead
1631         */
1632        @Deprecated
1633        public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1634
1635        /**
1636         * If using static IP, the secondary DNS's IP address.
1637         * <p>
1638         * Example: "192.168.1.2"
1639         *
1640         * @deprecated Use {@link WifiManager} instead
1641         */
1642        @Deprecated
1643        public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1644
1645
1646        /**
1647         * Determines whether remote devices may discover and/or connect to
1648         * this device.
1649         * <P>Type: INT</P>
1650         * 2 -- discoverable and connectable
1651         * 1 -- connectable but not discoverable
1652         * 0 -- neither connectable nor discoverable
1653         */
1654        public static final String BLUETOOTH_DISCOVERABILITY =
1655            "bluetooth_discoverability";
1656
1657        /**
1658         * Bluetooth discoverability timeout.  If this value is nonzero, then
1659         * Bluetooth becomes discoverable for a certain number of seconds,
1660         * after which is becomes simply connectable.  The value is in seconds.
1661         */
1662        public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1663            "bluetooth_discoverability_timeout";
1664
1665        /**
1666         * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
1667         * instead
1668         */
1669        @Deprecated
1670        public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
1671
1672        /**
1673         * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
1674         * instead
1675         */
1676        @Deprecated
1677        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1678
1679        /**
1680         * @deprecated Use
1681         * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
1682         * instead
1683         */
1684        @Deprecated
1685        public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1686            "lock_pattern_tactile_feedback_enabled";
1687
1688
1689        /**
1690         * A formatted string of the next alarm that is set, or the empty string
1691         * if there is no alarm set.
1692         */
1693        public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1694
1695        /**
1696         * Scaling factor for fonts, float.
1697         */
1698        public static final String FONT_SCALE = "font_scale";
1699
1700        /**
1701         * Name of an application package to be debugged.
1702         *
1703         * @deprecated Use {@link Global#DEBUG_APP} instead
1704         */
1705        @Deprecated
1706        public static final String DEBUG_APP = Global.DEBUG_APP;
1707
1708        /**
1709         * If 1, when launching DEBUG_APP it will wait for the debugger before
1710         * starting user code.  If 0, it will run normally.
1711         *
1712         * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead
1713         */
1714        @Deprecated
1715        public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER;
1716
1717        /**
1718         * Whether or not to dim the screen. 0=no  1=yes
1719         * @deprecated This setting is no longer used.
1720         */
1721        @Deprecated
1722        public static final String DIM_SCREEN = "dim_screen";
1723
1724        /**
1725         * The timeout before the screen turns off.
1726         */
1727        public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1728
1729        /**
1730         * The screen backlight brightness between 0 and 255.
1731         */
1732        public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1733
1734        /**
1735         * Control whether to enable automatic brightness mode.
1736         */
1737        public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1738
1739        /**
1740         * Adjustment to auto-brightness to make it generally more (>0.0 <1.0)
1741         * or less (<0.0 >-1.0) bright.
1742         * @hide
1743         */
1744        public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj";
1745
1746        /**
1747         * SCREEN_BRIGHTNESS_MODE value for manual mode.
1748         */
1749        public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1750
1751        /**
1752         * SCREEN_BRIGHTNESS_MODE value for automatic mode.
1753         */
1754        public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1755
1756        /**
1757         * Control whether the process CPU usage meter should be shown.
1758         *
1759         * @deprecated Use {@link Global#SHOW_PROCESSES} instead
1760         */
1761        @Deprecated
1762        public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES;
1763
1764        /**
1765         * If 1, the activity manager will aggressively finish activities and
1766         * processes as soon as they are no longer needed.  If 0, the normal
1767         * extended lifetime is used.
1768         *
1769         * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead
1770         */
1771        @Deprecated
1772        public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;
1773
1774        /**
1775         * Determines which streams are affected by ringer mode changes. The
1776         * stream type's bit should be set to 1 if it should be muted when going
1777         * into an inaudible ringer mode.
1778         */
1779        public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1780
1781         /**
1782          * Determines which streams are affected by mute. The
1783          * stream type's bit should be set to 1 if it should be muted when a mute request
1784          * is received.
1785          */
1786         public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1787
1788        /**
1789         * Whether vibrate is on for different events. This is used internally,
1790         * changing this value will not change the vibrate. See AudioManager.
1791         */
1792        public static final String VIBRATE_ON = "vibrate_on";
1793
1794        /**
1795         * If 1, redirects the system vibrator to all currently attached input devices
1796         * that support vibration.  If there are no such input devices, then the system
1797         * vibrator is used instead.
1798         * If 0, does not register the system vibrator.
1799         *
1800         * This setting is mainly intended to provide a compatibility mechanism for
1801         * applications that only know about the system vibrator and do not use the
1802         * input device vibrator API.
1803         *
1804         * @hide
1805         */
1806        public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices";
1807
1808        /**
1809         * Ringer volume. This is used internally, changing this value will not
1810         * change the volume. See AudioManager.
1811         */
1812        public static final String VOLUME_RING = "volume_ring";
1813
1814        /**
1815         * System/notifications volume. This is used internally, changing this
1816         * value will not change the volume. See AudioManager.
1817         */
1818        public static final String VOLUME_SYSTEM = "volume_system";
1819
1820        /**
1821         * Voice call volume. This is used internally, changing this value will
1822         * not change the volume. See AudioManager.
1823         */
1824        public static final String VOLUME_VOICE = "volume_voice";
1825
1826        /**
1827         * Music/media/gaming volume. This is used internally, changing this
1828         * value will not change the volume. See AudioManager.
1829         */
1830        public static final String VOLUME_MUSIC = "volume_music";
1831
1832        /**
1833         * Alarm volume. This is used internally, changing this
1834         * value will not change the volume. See AudioManager.
1835         */
1836        public static final String VOLUME_ALARM = "volume_alarm";
1837
1838        /**
1839         * Notification volume. This is used internally, changing this
1840         * value will not change the volume. See AudioManager.
1841         */
1842        public static final String VOLUME_NOTIFICATION = "volume_notification";
1843
1844        /**
1845         * Bluetooth Headset volume. This is used internally, changing this value will
1846         * not change the volume. See AudioManager.
1847         */
1848        public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1849
1850        /**
1851         * Master volume (float in the range 0.0f to 1.0f).
1852         * @hide
1853         */
1854        public static final String VOLUME_MASTER = "volume_master";
1855
1856        /**
1857         * Master volume mute (int 1 = mute, 0 = not muted).
1858         *
1859         * @hide
1860         */
1861        public static final String VOLUME_MASTER_MUTE = "volume_master_mute";
1862
1863        /**
1864         * Whether the notifications should use the ring volume (value of 1) or
1865         * a separate notification volume (value of 0). In most cases, users
1866         * will have this enabled so the notification and ringer volumes will be
1867         * the same. However, power users can disable this and use the separate
1868         * notification volume control.
1869         * <p>
1870         * Note: This is a one-off setting that will be removed in the future
1871         * when there is profile support. For this reason, it is kept hidden
1872         * from the public APIs.
1873         *
1874         * @hide
1875         * @deprecated
1876         */
1877        @Deprecated
1878        public static final String NOTIFICATIONS_USE_RING_VOLUME =
1879            "notifications_use_ring_volume";
1880
1881        /**
1882         * Whether silent mode should allow vibration feedback. This is used
1883         * internally in AudioService and the Sound settings activity to
1884         * coordinate decoupling of vibrate and silent modes. This setting
1885         * will likely be removed in a future release with support for
1886         * audio/vibe feedback profiles.
1887         *
1888         * Not used anymore. On devices with vibrator, the user explicitly selects
1889         * silent or vibrate mode.
1890         * Kept for use by legacy database upgrade code in DatabaseHelper.
1891         * @hide
1892         */
1893        public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
1894
1895        /**
1896         * The mapping of stream type (integer) to its setting.
1897         */
1898        public static final String[] VOLUME_SETTINGS = {
1899            VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
1900            VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
1901        };
1902
1903        /**
1904         * Appended to various volume related settings to record the previous
1905         * values before they the settings were affected by a silent/vibrate
1906         * ringer mode change.
1907         */
1908        public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1909
1910        /**
1911         * Persistent store for the system-wide default ringtone URI.
1912         * <p>
1913         * If you need to play the default ringtone at any given time, it is recommended
1914         * you give {@link #DEFAULT_RINGTONE_URI} to the media player.  It will resolve
1915         * to the set default ringtone at the time of playing.
1916         *
1917         * @see #DEFAULT_RINGTONE_URI
1918         */
1919        public static final String RINGTONE = "ringtone";
1920
1921        /**
1922         * A {@link Uri} that will point to the current default ringtone at any
1923         * given time.
1924         * <p>
1925         * If the current default ringtone is in the DRM provider and the caller
1926         * does not have permission, the exception will be a
1927         * FileNotFoundException.
1928         */
1929        public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1930
1931        /**
1932         * Persistent store for the system-wide default notification sound.
1933         *
1934         * @see #RINGTONE
1935         * @see #DEFAULT_NOTIFICATION_URI
1936         */
1937        public static final String NOTIFICATION_SOUND = "notification_sound";
1938
1939        /**
1940         * A {@link Uri} that will point to the current default notification
1941         * sound at any given time.
1942         *
1943         * @see #DEFAULT_RINGTONE_URI
1944         */
1945        public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1946
1947        /**
1948         * Persistent store for the system-wide default alarm alert.
1949         *
1950         * @see #RINGTONE
1951         * @see #DEFAULT_ALARM_ALERT_URI
1952         */
1953        public static final String ALARM_ALERT = "alarm_alert";
1954
1955        /**
1956         * A {@link Uri} that will point to the current default alarm alert at
1957         * any given time.
1958         *
1959         * @see #DEFAULT_ALARM_ALERT_URI
1960         */
1961        public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1962
1963        /**
1964         * Persistent store for the system default media button event receiver.
1965         *
1966         * @hide
1967         */
1968        public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
1969
1970        /**
1971         * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1972         */
1973        public static final String TEXT_AUTO_REPLACE = "auto_replace";
1974
1975        /**
1976         * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1977         */
1978        public static final String TEXT_AUTO_CAPS = "auto_caps";
1979
1980        /**
1981         * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1982         * feature converts two spaces to a "." and space.
1983         */
1984        public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
1985
1986        /**
1987         * Setting to showing password characters in text editors. 1 = On, 0 = Off
1988         */
1989        public static final String TEXT_SHOW_PASSWORD = "show_password";
1990
1991        public static final String SHOW_GTALK_SERVICE_STATUS =
1992                "SHOW_GTALK_SERVICE_STATUS";
1993
1994        /**
1995         * Name of activity to use for wallpaper on the home screen.
1996         *
1997         * @deprecated Use {@link WallpaperManager} instead.
1998         */
1999        @Deprecated
2000        public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
2001
2002        /**
2003         * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME}
2004         * instead
2005         */
2006        @Deprecated
2007        public static final String AUTO_TIME = Global.AUTO_TIME;
2008
2009        /**
2010         * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE}
2011         * instead
2012         */
2013        @Deprecated
2014        public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE;
2015
2016        /**
2017         * Display times as 12 or 24 hours
2018         *   12
2019         *   24
2020         */
2021        public static final String TIME_12_24 = "time_12_24";
2022
2023        /**
2024         * Date format string
2025         *   mm/dd/yyyy
2026         *   dd/mm/yyyy
2027         *   yyyy/mm/dd
2028         */
2029        public static final String DATE_FORMAT = "date_format";
2030
2031        /**
2032         * Whether the setup wizard has been run before (on first boot), or if
2033         * it still needs to be run.
2034         *
2035         * nonzero = it has been run in the past
2036         * 0 = it has not been run in the past
2037         */
2038        public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
2039
2040        /**
2041         * Scaling factor for normal window animations. Setting to 0 will disable window
2042         * animations.
2043         *
2044         * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead
2045         */
2046        @Deprecated
2047        public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE;
2048
2049        /**
2050         * Scaling factor for activity transition animations. Setting to 0 will disable window
2051         * animations.
2052         *
2053         * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead
2054         */
2055        @Deprecated
2056        public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE;
2057
2058        /**
2059         * Scaling factor for Animator-based animations. This affects both the start delay and
2060         * duration of all such animations. Setting to 0 will cause animations to end immediately.
2061         * The default value is 1.
2062         *
2063         * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead
2064         */
2065        @Deprecated
2066        public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
2067
2068        /**
2069         * Control whether the accelerometer will be used to change screen
2070         * orientation.  If 0, it will not be used unless explicitly requested
2071         * by the application; if 1, it will be used by default unless explicitly
2072         * disabled by the application.
2073         */
2074        public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
2075
2076        /**
2077         * Default screen rotation when no other policy applies.
2078         * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
2079         * preference, this rotation value will be used. Must be one of the
2080         * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
2081         *
2082         * @see Display#getRotation
2083         */
2084        public static final String USER_ROTATION = "user_rotation";
2085
2086        /**
2087         * Control whether the rotation lock toggle in the System UI should be hidden.
2088         * Typically this is done for accessibility purposes to make it harder for
2089         * the user to accidentally toggle the rotation lock while the display rotation
2090         * has been locked for accessibility.
2091         *
2092         * If 0, then rotation lock toggle is not hidden for accessibility (although it may be
2093         * unavailable for other reasons).  If 1, then the rotation lock toggle is hidden.
2094         *
2095         * @hide
2096         */
2097        public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY =
2098                "hide_rotation_lock_toggle_for_accessibility";
2099
2100        /**
2101         * Whether the phone vibrates when it is ringing due to an incoming call. This will
2102         * be used by Phone and Setting apps; it shouldn't affect other apps.
2103         * The value is boolean (1 or 0).
2104         *
2105         * Note: this is not same as "vibrate on ring", which had been available until ICS.
2106         * It was about AudioManager's setting and thus affected all the applications which
2107         * relied on the setting, while this is purely about the vibration setting for incoming
2108         * calls.
2109         *
2110         * @hide
2111         */
2112        public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
2113
2114        /**
2115         * Whether the audible DTMF tones are played by the dialer when dialing. The value is
2116         * boolean (1 or 0).
2117         */
2118        public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
2119
2120        /**
2121         * CDMA only settings
2122         * DTMF tone type played by the dialer when dialing.
2123         *                 0 = Normal
2124         *                 1 = Long
2125         * @hide
2126         */
2127        public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
2128
2129        /**
2130         * Whether the hearing aid is enabled. The value is
2131         * boolean (1 or 0).
2132         * @hide
2133         */
2134        public static final String HEARING_AID = "hearing_aid";
2135
2136        /**
2137         * CDMA only settings
2138         * TTY Mode
2139         * 0 = OFF
2140         * 1 = FULL
2141         * 2 = VCO
2142         * 3 = HCO
2143         * @hide
2144         */
2145        public static final String TTY_MODE = "tty_mode";
2146
2147        /**
2148         * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
2149         * boolean (1 or 0).
2150         */
2151        public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
2152
2153        /**
2154         * Whether the haptic feedback (long presses, ...) are enabled. The value is
2155         * boolean (1 or 0).
2156         */
2157        public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
2158
2159        /**
2160         * @deprecated Each application that shows web suggestions should have its own
2161         * setting for this.
2162         */
2163        @Deprecated
2164        public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
2165
2166        /**
2167         * Whether the notification LED should repeatedly flash when a notification is
2168         * pending. The value is boolean (1 or 0).
2169         * @hide
2170         */
2171        public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
2172
2173        /**
2174         * Show pointer location on screen?
2175         * 0 = no
2176         * 1 = yes
2177         * @hide
2178         */
2179        public static final String POINTER_LOCATION = "pointer_location";
2180
2181        /**
2182         * Show touch positions on screen?
2183         * 0 = no
2184         * 1 = yes
2185         * @hide
2186         */
2187        public static final String SHOW_TOUCHES = "show_touches";
2188
2189        /**
2190         * Log raw orientation data from {@link WindowOrientationListener} for use with the
2191         * orientationplot.py tool.
2192         * 0 = no
2193         * 1 = yes
2194         * @hide
2195         */
2196        public static final String WINDOW_ORIENTATION_LISTENER_LOG =
2197                "window_orientation_listener_log";
2198
2199        /**
2200         * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED}
2201         * instead
2202         * @hide
2203         */
2204        @Deprecated
2205        public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED;
2206
2207        /**
2208         * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED}
2209         * instead
2210         * @hide
2211         */
2212        @Deprecated
2213        public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED;
2214
2215        /**
2216         * Whether to play sounds when the keyguard is shown and dismissed.
2217         * @hide
2218         */
2219        public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
2220
2221        /**
2222         * Whether the lockscreen should be completely disabled.
2223         * @hide
2224         */
2225        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
2226
2227        /**
2228         * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
2229         * instead
2230         * @hide
2231         */
2232        @Deprecated
2233        public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND;
2234
2235        /**
2236         * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND}
2237         * instead
2238         * @hide
2239         */
2240        @Deprecated
2241        public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND;
2242
2243        /**
2244         * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND}
2245         * instead
2246         * @hide
2247         */
2248        @Deprecated
2249        public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND;
2250
2251        /**
2252         * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND}
2253         * instead
2254         * @hide
2255         */
2256        @Deprecated
2257        public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND;
2258
2259        /**
2260         * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND}
2261         * instead
2262         * @hide
2263         */
2264        @Deprecated
2265        public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND;
2266
2267        /**
2268         * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND}
2269         * instead
2270         * @hide
2271         */
2272        @Deprecated
2273        public static final String LOCK_SOUND = Global.LOCK_SOUND;
2274
2275        /**
2276         * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND}
2277         * instead
2278         * @hide
2279         */
2280        @Deprecated
2281        public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND;
2282
2283        /**
2284         * Receive incoming SIP calls?
2285         * 0 = no
2286         * 1 = yes
2287         * @hide
2288         */
2289        public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
2290
2291        /**
2292         * Call Preference String.
2293         * "SIP_ALWAYS" : Always use SIP with network access
2294         * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
2295         * "SIP_ASK_ME_EACH_TIME" : Always ask me each time
2296         * @hide
2297         */
2298        public static final String SIP_CALL_OPTIONS = "sip_call_options";
2299
2300        /**
2301         * One of the sip call options: Always use SIP with network access.
2302         * @hide
2303         */
2304        public static final String SIP_ALWAYS = "SIP_ALWAYS";
2305
2306        /**
2307         * One of the sip call options: Only if destination is a SIP address.
2308         * @hide
2309         */
2310        public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
2311
2312        /**
2313         * One of the sip call options: Always ask me each time.
2314         * @hide
2315         */
2316        public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
2317
2318        /**
2319         * Pointer speed setting.
2320         * This is an integer value in a range between -7 and +7, so there are 15 possible values.
2321         *   -7 = slowest
2322         *    0 = default speed
2323         *   +7 = fastest
2324         * @hide
2325         */
2326        public static final String POINTER_SPEED = "pointer_speed";
2327
2328        /**
2329         * Settings to backup. This is here so that it's in the same place as the settings
2330         * keys and easy to update.
2331         *
2332         * NOTE: Settings are backed up and restored in the order they appear
2333         *       in this array. If you have one setting depending on another,
2334         *       make sure that they are ordered appropriately.
2335         *
2336         * @hide
2337         */
2338        public static final String[] SETTINGS_TO_BACKUP = {
2339            STAY_ON_WHILE_PLUGGED_IN,   // moved to global
2340            WIFI_USE_STATIC_IP,
2341            WIFI_STATIC_IP,
2342            WIFI_STATIC_GATEWAY,
2343            WIFI_STATIC_NETMASK,
2344            WIFI_STATIC_DNS1,
2345            WIFI_STATIC_DNS2,
2346            BLUETOOTH_DISCOVERABILITY,
2347            BLUETOOTH_DISCOVERABILITY_TIMEOUT,
2348            DIM_SCREEN,
2349            SCREEN_OFF_TIMEOUT,
2350            SCREEN_BRIGHTNESS,
2351            SCREEN_BRIGHTNESS_MODE,
2352            SCREEN_AUTO_BRIGHTNESS_ADJ,
2353            VIBRATE_INPUT_DEVICES,
2354            MODE_RINGER,                // moved to global
2355            MODE_RINGER_STREAMS_AFFECTED,
2356            MUTE_STREAMS_AFFECTED,
2357            VOLUME_VOICE,
2358            VOLUME_SYSTEM,
2359            VOLUME_RING,
2360            VOLUME_MUSIC,
2361            VOLUME_ALARM,
2362            VOLUME_NOTIFICATION,
2363            VOLUME_BLUETOOTH_SCO,
2364            VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
2365            VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
2366            VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
2367            VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
2368            VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
2369            VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
2370            VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
2371            TEXT_AUTO_REPLACE,
2372            TEXT_AUTO_CAPS,
2373            TEXT_AUTO_PUNCTUATE,
2374            TEXT_SHOW_PASSWORD,
2375            AUTO_TIME,                  // moved to global
2376            AUTO_TIME_ZONE,             // moved to global
2377            TIME_12_24,
2378            DATE_FORMAT,
2379            DTMF_TONE_WHEN_DIALING,
2380            DTMF_TONE_TYPE_WHEN_DIALING,
2381            HEARING_AID,
2382            TTY_MODE,
2383            SOUND_EFFECTS_ENABLED,
2384            HAPTIC_FEEDBACK_ENABLED,
2385            POWER_SOUNDS_ENABLED,       // moved to global
2386            DOCK_SOUNDS_ENABLED,        // moved to global
2387            LOCKSCREEN_SOUNDS_ENABLED,
2388            SHOW_WEB_SUGGESTIONS,
2389            NOTIFICATION_LIGHT_PULSE,
2390            SIP_CALL_OPTIONS,
2391            SIP_RECEIVE_CALLS,
2392            POINTER_SPEED,
2393            VIBRATE_WHEN_RINGING
2394        };
2395
2396        // Settings moved to Settings.Secure
2397
2398        /**
2399         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
2400         * instead
2401         */
2402        @Deprecated
2403        public static final String ADB_ENABLED = Global.ADB_ENABLED;
2404
2405        /**
2406         * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
2407         */
2408        @Deprecated
2409        public static final String ANDROID_ID = Secure.ANDROID_ID;
2410
2411        /**
2412         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
2413         */
2414        @Deprecated
2415        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
2416
2417        /**
2418         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
2419         */
2420        @Deprecated
2421        public static final String DATA_ROAMING = Global.DATA_ROAMING;
2422
2423        /**
2424         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
2425         */
2426        @Deprecated
2427        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
2428
2429        /**
2430         * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
2431         */
2432        @Deprecated
2433        public static final String HTTP_PROXY = Global.HTTP_PROXY;
2434
2435        /**
2436         * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead
2437         */
2438        @Deprecated
2439        public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS;
2440
2441        /**
2442         * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
2443         * instead
2444         */
2445        @Deprecated
2446        public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
2447
2448        /**
2449         * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
2450         */
2451        @Deprecated
2452        public static final String LOGGING_ID = Secure.LOGGING_ID;
2453
2454        /**
2455         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
2456         */
2457        @Deprecated
2458        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
2459
2460        /**
2461         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
2462         * instead
2463         */
2464        @Deprecated
2465        public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
2466
2467        /**
2468         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
2469         * instead
2470         */
2471        @Deprecated
2472        public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
2473
2474        /**
2475         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
2476         * instead
2477         */
2478        @Deprecated
2479        public static final String PARENTAL_CONTROL_REDIRECT_URL =
2480            Secure.PARENTAL_CONTROL_REDIRECT_URL;
2481
2482        /**
2483         * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
2484         */
2485        @Deprecated
2486        public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
2487
2488        /**
2489         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
2490         */
2491        @Deprecated
2492        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
2493
2494        /**
2495         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
2496         */
2497        @Deprecated
2498        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
2499
2500       /**
2501         * @deprecated Use
2502         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
2503         */
2504        @Deprecated
2505        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
2506
2507        /**
2508         * @deprecated Use
2509         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
2510         */
2511        @Deprecated
2512        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2513                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
2514
2515        /**
2516         * @deprecated Use
2517         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
2518         */
2519        @Deprecated
2520        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2521                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
2522
2523        /**
2524         * @deprecated Use
2525         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
2526         */
2527        @Deprecated
2528        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2529                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
2530
2531        /**
2532         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
2533         * instead
2534         */
2535        @Deprecated
2536        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
2537
2538        /**
2539         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
2540         */
2541        @Deprecated
2542        public static final String WIFI_ON = Global.WIFI_ON;
2543
2544        /**
2545         * @deprecated Use
2546         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
2547         * instead
2548         */
2549        @Deprecated
2550        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2551                Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
2552
2553        /**
2554         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
2555         */
2556        @Deprecated
2557        public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
2558
2559        /**
2560         * @deprecated Use
2561         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
2562         */
2563        @Deprecated
2564        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2565                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
2566
2567        /**
2568         * @deprecated Use
2569         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
2570         */
2571        @Deprecated
2572        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2573                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
2574
2575        /**
2576         * @deprecated Use
2577         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
2578         * instead
2579         */
2580        @Deprecated
2581        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2582                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
2583
2584        /**
2585         * @deprecated Use
2586         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
2587         */
2588        @Deprecated
2589        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2590            Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
2591
2592        /**
2593         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
2594         * instead
2595         */
2596        @Deprecated
2597        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
2598
2599        /**
2600         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
2601         */
2602        @Deprecated
2603        public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
2604
2605        /**
2606         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
2607         */
2608        @Deprecated
2609        public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
2610
2611        /**
2612         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
2613         * instead
2614         */
2615        @Deprecated
2616        public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
2617
2618        /**
2619         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
2620         * instead
2621         */
2622        @Deprecated
2623        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
2624            Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
2625    }
2626
2627    /**
2628     * Secure system settings, containing system preferences that applications
2629     * can read but are not allowed to write.  These are for preferences that
2630     * the user must explicitly modify through the system UI or specialized
2631     * APIs for those values, not modified directly by applications.
2632     */
2633    public static final class Secure extends NameValueTable {
2634        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
2635
2636        /**
2637         * The content:// style URL for this table
2638         */
2639        public static final Uri CONTENT_URI =
2640            Uri.parse("content://" + AUTHORITY + "/secure");
2641
2642        // Populated lazily, guarded by class object:
2643        private static final NameValueCache sNameValueCache = new NameValueCache(
2644                SYS_PROP_SETTING_VERSION,
2645                CONTENT_URI,
2646                CALL_METHOD_GET_SECURE,
2647                CALL_METHOD_PUT_SECURE);
2648
2649        private static ILockSettings sLockSettings = null;
2650
2651        private static boolean sIsSystemProcess;
2652        private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
2653        private static final HashSet<String> MOVED_TO_GLOBAL;
2654        static {
2655            MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3);
2656            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
2657            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
2658            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
2659
2660            MOVED_TO_GLOBAL = new HashSet<String>();
2661            MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
2662            MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
2663            MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
2664            MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
2665            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
2666            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
2667            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
2668            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
2669            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
2670            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
2671            MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
2672            MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
2673            MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED);
2674            MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
2675            MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
2676            MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
2677            MOVED_TO_GLOBAL.add(Settings.Global.INSTALL_NON_MARKET_APPS);
2678            MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
2679            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
2680            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
2681            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
2682            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
2683            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
2684            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
2685            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
2686            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_REPORT_XT_OVER_DEV);
2687            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
2688            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
2689            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
2690            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
2691            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
2692            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
2693            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
2694            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
2695            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
2696            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
2697            MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
2698            MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
2699            MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
2700            MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
2701            MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
2702            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
2703            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
2704            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
2705            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
2706            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
2707            MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS);
2708            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
2709            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
2710            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
2711            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
2712            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
2713            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
2714            MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
2715            MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
2716            MOVED_TO_GLOBAL.add(Settings.Global.WEB_AUTOFILL_QUERY_URL);
2717            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
2718            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
2719            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
2720            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
2721            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
2722            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
2723            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
2724            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
2725            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
2726            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
2727            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
2728            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
2729            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
2730            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
2731            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
2732            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
2733            MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
2734            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
2735            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
2736            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
2737            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
2738            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
2739            MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
2740            MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
2741            MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
2742            MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
2743            MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
2744            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
2745            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
2746            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
2747            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
2748            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
2749            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
2750            MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
2751            MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
2752            MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
2753            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
2754            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
2755            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
2756            MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
2757            MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
2758            MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
2759            MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
2760            MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
2761            MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
2762            MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
2763            MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
2764            MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
2765            MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
2766            MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
2767            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
2768            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
2769            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
2770            MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
2771            MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
2772            MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
2773            MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_CDMA_SUBSCRIPTION);
2774        }
2775
2776        /** @hide */
2777        public static void getMovedKeys(HashSet<String> outKeySet) {
2778            outKeySet.addAll(MOVED_TO_GLOBAL);
2779        }
2780
2781        /**
2782         * Look up a name in the database.
2783         * @param resolver to access the database with
2784         * @param name to look up in the table
2785         * @return the corresponding value, or null if not present
2786         */
2787        public static String getString(ContentResolver resolver, String name) {
2788            return getStringForUser(resolver, name, UserHandle.myUserId());
2789        }
2790
2791        /** @hide */
2792        public static String getStringForUser(ContentResolver resolver, String name,
2793                int userHandle) {
2794            if (MOVED_TO_GLOBAL.contains(name)) {
2795                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
2796                        + " to android.provider.Settings.Global.");
2797                return Global.getStringForUser(resolver, name, userHandle);
2798            }
2799
2800            if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
2801                synchronized (Secure.class) {
2802                    if (sLockSettings == null) {
2803                        sLockSettings = ILockSettings.Stub.asInterface(
2804                                (IBinder) ServiceManager.getService("lock_settings"));
2805                        sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
2806                    }
2807                }
2808                if (sLockSettings != null && !sIsSystemProcess) {
2809                    try {
2810                        return sLockSettings.getString(name, "0", userHandle);
2811                    } catch (RemoteException re) {
2812                        // Fall through
2813                    }
2814                }
2815            }
2816
2817            return sNameValueCache.getStringForUser(resolver, name, userHandle);
2818        }
2819
2820        /**
2821         * Store a name/value pair into the database.
2822         * @param resolver to access the database with
2823         * @param name to store
2824         * @param value to associate with the name
2825         * @return true if the value was set, false on database errors
2826         */
2827        public static boolean putString(ContentResolver resolver, String name, String value) {
2828            return putStringForUser(resolver, name, value, UserHandle.myUserId());
2829        }
2830
2831        /** @hide */
2832        public static boolean putStringForUser(ContentResolver resolver, String name, String value,
2833                int userHandle) {
2834            if (MOVED_TO_GLOBAL.contains(name)) {
2835                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2836                        + " to android.provider.Settings.Global");
2837                return Global.putStringForUser(resolver, name, value, userHandle);
2838            }
2839            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
2840        }
2841
2842        /**
2843         * Construct the content URI for a particular name/value pair,
2844         * useful for monitoring changes with a ContentObserver.
2845         * @param name to look up in the table
2846         * @return the corresponding content URI, or null if not present
2847         */
2848        public static Uri getUriFor(String name) {
2849            if (MOVED_TO_GLOBAL.contains(name)) {
2850                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
2851                        + " to android.provider.Settings.Global, returning global URI.");
2852                return Global.getUriFor(Global.CONTENT_URI, name);
2853            }
2854            return getUriFor(CONTENT_URI, name);
2855        }
2856
2857        /**
2858         * Convenience function for retrieving a single secure settings value
2859         * as an integer.  Note that internally setting values are always
2860         * stored as strings; this function converts the string to an integer
2861         * for you.  The default value will be returned if the setting is
2862         * not defined or not an integer.
2863         *
2864         * @param cr The ContentResolver to access.
2865         * @param name The name of the setting to retrieve.
2866         * @param def Value to return if the setting is not defined.
2867         *
2868         * @return The setting's current value, or 'def' if it is not defined
2869         * or not a valid integer.
2870         */
2871        public static int getInt(ContentResolver cr, String name, int def) {
2872            return getIntForUser(cr, name, def, UserHandle.myUserId());
2873        }
2874
2875        /** @hide */
2876        public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
2877            String v = getStringForUser(cr, name, userHandle);
2878            try {
2879                return v != null ? Integer.parseInt(v) : def;
2880            } catch (NumberFormatException e) {
2881                return def;
2882            }
2883        }
2884
2885        /**
2886         * Convenience function for retrieving a single secure settings value
2887         * as an integer.  Note that internally setting values are always
2888         * stored as strings; this function converts the string to an integer
2889         * for you.
2890         * <p>
2891         * This version does not take a default value.  If the setting has not
2892         * been set, or the string value is not a number,
2893         * it throws {@link SettingNotFoundException}.
2894         *
2895         * @param cr The ContentResolver to access.
2896         * @param name The name of the setting to retrieve.
2897         *
2898         * @throws SettingNotFoundException Thrown if a setting by the given
2899         * name can't be found or the setting value is not an integer.
2900         *
2901         * @return The setting's current value.
2902         */
2903        public static int getInt(ContentResolver cr, String name)
2904                throws SettingNotFoundException {
2905            return getIntForUser(cr, name, UserHandle.myUserId());
2906        }
2907
2908        /** @hide */
2909        public static int getIntForUser(ContentResolver cr, String name, int userHandle)
2910                throws SettingNotFoundException {
2911            String v = getStringForUser(cr, name, userHandle);
2912            try {
2913                return Integer.parseInt(v);
2914            } catch (NumberFormatException e) {
2915                throw new SettingNotFoundException(name);
2916            }
2917        }
2918
2919        /**
2920         * Convenience function for updating a single settings value as an
2921         * integer. This will either create a new entry in the table if the
2922         * given name does not exist, or modify the value of the existing row
2923         * with that name.  Note that internally setting values are always
2924         * stored as strings, so this function converts the given value to a
2925         * string before storing it.
2926         *
2927         * @param cr The ContentResolver to access.
2928         * @param name The name of the setting to modify.
2929         * @param value The new value for the setting.
2930         * @return true if the value was set, false on database errors
2931         */
2932        public static boolean putInt(ContentResolver cr, String name, int value) {
2933            return putIntForUser(cr, name, value, UserHandle.myUserId());
2934        }
2935
2936        /** @hide */
2937        public static boolean putIntForUser(ContentResolver cr, String name, int value,
2938                int userHandle) {
2939            return putStringForUser(cr, name, Integer.toString(value), userHandle);
2940        }
2941
2942        /**
2943         * Convenience function for retrieving a single secure settings value
2944         * as a {@code long}.  Note that internally setting values are always
2945         * stored as strings; this function converts the string to a {@code long}
2946         * for you.  The default value will be returned if the setting is
2947         * not defined or not a {@code long}.
2948         *
2949         * @param cr The ContentResolver to access.
2950         * @param name The name of the setting to retrieve.
2951         * @param def Value to return if the setting is not defined.
2952         *
2953         * @return The setting's current value, or 'def' if it is not defined
2954         * or not a valid {@code long}.
2955         */
2956        public static long getLong(ContentResolver cr, String name, long def) {
2957            return getLongForUser(cr, name, def, UserHandle.myUserId());
2958        }
2959
2960        /** @hide */
2961        public static long getLongForUser(ContentResolver cr, String name, long def,
2962                int userHandle) {
2963            String valString = getStringForUser(cr, name, userHandle);
2964            long value;
2965            try {
2966                value = valString != null ? Long.parseLong(valString) : def;
2967            } catch (NumberFormatException e) {
2968                value = def;
2969            }
2970            return value;
2971        }
2972
2973        /**
2974         * Convenience function for retrieving a single secure settings value
2975         * as a {@code long}.  Note that internally setting values are always
2976         * stored as strings; this function converts the string to a {@code long}
2977         * for you.
2978         * <p>
2979         * This version does not take a default value.  If the setting has not
2980         * been set, or the string value is not a number,
2981         * it throws {@link SettingNotFoundException}.
2982         *
2983         * @param cr The ContentResolver to access.
2984         * @param name The name of the setting to retrieve.
2985         *
2986         * @return The setting's current value.
2987         * @throws SettingNotFoundException Thrown if a setting by the given
2988         * name can't be found or the setting value is not an integer.
2989         */
2990        public static long getLong(ContentResolver cr, String name)
2991                throws SettingNotFoundException {
2992            return getLongForUser(cr, name, UserHandle.myUserId());
2993        }
2994
2995        /** @hide */
2996        public static long getLongForUser(ContentResolver cr, String name, int userHandle)
2997                throws SettingNotFoundException {
2998            String valString = getStringForUser(cr, name, userHandle);
2999            try {
3000                return Long.parseLong(valString);
3001            } catch (NumberFormatException e) {
3002                throw new SettingNotFoundException(name);
3003            }
3004        }
3005
3006        /**
3007         * Convenience function for updating a secure settings value as a long
3008         * integer. This will either create a new entry in the table if the
3009         * given name does not exist, or modify the value of the existing row
3010         * with that name.  Note that internally setting values are always
3011         * stored as strings, so this function converts the given value to a
3012         * string before storing it.
3013         *
3014         * @param cr The ContentResolver to access.
3015         * @param name The name of the setting to modify.
3016         * @param value The new value for the setting.
3017         * @return true if the value was set, false on database errors
3018         */
3019        public static boolean putLong(ContentResolver cr, String name, long value) {
3020            return putLongForUser(cr, name, value, UserHandle.myUserId());
3021        }
3022
3023        /** @hide */
3024        public static boolean putLongForUser(ContentResolver cr, String name, long value,
3025                int userHandle) {
3026            return putStringForUser(cr, name, Long.toString(value), userHandle);
3027        }
3028
3029        /**
3030         * Convenience function for retrieving a single secure settings value
3031         * as a floating point number.  Note that internally setting values are
3032         * always stored as strings; this function converts the string to an
3033         * float for you. The default value will be returned if the setting
3034         * is not defined or not a valid float.
3035         *
3036         * @param cr The ContentResolver to access.
3037         * @param name The name of the setting to retrieve.
3038         * @param def Value to return if the setting is not defined.
3039         *
3040         * @return The setting's current value, or 'def' if it is not defined
3041         * or not a valid float.
3042         */
3043        public static float getFloat(ContentResolver cr, String name, float def) {
3044            return getFloatForUser(cr, name, def, UserHandle.myUserId());
3045        }
3046
3047        /** @hide */
3048        public static float getFloatForUser(ContentResolver cr, String name, float def,
3049                int userHandle) {
3050            String v = getStringForUser(cr, name, userHandle);
3051            try {
3052                return v != null ? Float.parseFloat(v) : def;
3053            } catch (NumberFormatException e) {
3054                return def;
3055            }
3056        }
3057
3058        /**
3059         * Convenience function for retrieving a single secure settings value
3060         * as a float.  Note that internally setting values are always
3061         * stored as strings; this function converts the string to a float
3062         * for you.
3063         * <p>
3064         * This version does not take a default value.  If the setting has not
3065         * been set, or the string value is not a number,
3066         * it throws {@link SettingNotFoundException}.
3067         *
3068         * @param cr The ContentResolver to access.
3069         * @param name The name of the setting to retrieve.
3070         *
3071         * @throws SettingNotFoundException Thrown if a setting by the given
3072         * name can't be found or the setting value is not a float.
3073         *
3074         * @return The setting's current value.
3075         */
3076        public static float getFloat(ContentResolver cr, String name)
3077                throws SettingNotFoundException {
3078            return getFloatForUser(cr, name, UserHandle.myUserId());
3079        }
3080
3081        /** @hide */
3082        public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
3083                throws SettingNotFoundException {
3084            String v = getStringForUser(cr, name, userHandle);
3085            if (v == null) {
3086                throw new SettingNotFoundException(name);
3087            }
3088            try {
3089                return Float.parseFloat(v);
3090            } catch (NumberFormatException e) {
3091                throw new SettingNotFoundException(name);
3092            }
3093        }
3094
3095        /**
3096         * Convenience function for updating a single settings value as a
3097         * floating point number. This will either create a new entry in the
3098         * table if the given name does not exist, or modify the value of the
3099         * existing row with that name.  Note that internally setting values
3100         * are always stored as strings, so this function converts the given
3101         * value to a string before storing it.
3102         *
3103         * @param cr The ContentResolver to access.
3104         * @param name The name of the setting to modify.
3105         * @param value The new value for the setting.
3106         * @return true if the value was set, false on database errors
3107         */
3108        public static boolean putFloat(ContentResolver cr, String name, float value) {
3109            return putFloatForUser(cr, name, value, UserHandle.myUserId());
3110        }
3111
3112        /** @hide */
3113        public static boolean putFloatForUser(ContentResolver cr, String name, float value,
3114                int userHandle) {
3115            return putStringForUser(cr, name, Float.toString(value), userHandle);
3116        }
3117
3118        /**
3119         * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
3120         * instead
3121         */
3122        @Deprecated
3123        public static final String DEVELOPMENT_SETTINGS_ENABLED =
3124                Global.DEVELOPMENT_SETTINGS_ENABLED;
3125
3126        /**
3127         * When the user has enable the option to have a "bug report" command
3128         * in the power menu.
3129         * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
3130         * @hide
3131         */
3132        @Deprecated
3133        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
3134
3135        /**
3136         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
3137         */
3138        @Deprecated
3139        public static final String ADB_ENABLED = Global.ADB_ENABLED;
3140
3141        /**
3142         * Setting to allow mock locations and location provider status to be injected into the
3143         * LocationManager service for testing purposes during application development.  These
3144         * locations and status values  override actual location and status information generated
3145         * by network, gps, or other location providers.
3146         */
3147        public static final String ALLOW_MOCK_LOCATION = "mock_location";
3148
3149        /**
3150         * A 64-bit number (as a hex string) that is randomly
3151         * generated on the device's first boot and should remain
3152         * constant for the lifetime of the device.  (The value may
3153         * change if a factory reset is performed on the device.)
3154         */
3155        public static final String ANDROID_ID = "android_id";
3156
3157        /**
3158         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
3159         */
3160        @Deprecated
3161        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
3162
3163        /**
3164         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
3165         */
3166        @Deprecated
3167        public static final String DATA_ROAMING = Global.DATA_ROAMING;
3168
3169        /**
3170         * Setting to record the input method used by default, holding the ID
3171         * of the desired method.
3172         */
3173        public static final String DEFAULT_INPUT_METHOD = "default_input_method";
3174
3175        /**
3176         * Setting to record the input method subtype used by default, holding the ID
3177         * of the desired method.
3178         */
3179        public static final String SELECTED_INPUT_METHOD_SUBTYPE =
3180                "selected_input_method_subtype";
3181
3182        /**
3183         * Setting to record the history of input method subtype, holding the pair of ID of IME
3184         * and its last used subtype.
3185         * @hide
3186         */
3187        public static final String INPUT_METHODS_SUBTYPE_HISTORY =
3188                "input_methods_subtype_history";
3189
3190        /**
3191         * Setting to record the visibility of input method selector
3192         */
3193        public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
3194                "input_method_selector_visibility";
3195
3196        /**
3197         * bluetooth HCI snoop log configuration
3198         * @hide
3199         */
3200        public static final String BLUETOOTH_HCI_LOG =
3201                "bluetooth_hci_log";
3202
3203        /**
3204         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
3205         */
3206        @Deprecated
3207        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
3208
3209        /**
3210         * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
3211         * @hide
3212         */
3213        public static final String USER_SETUP_COMPLETE = "user_setup_complete";
3214
3215        /**
3216         * List of input methods that are currently enabled.  This is a string
3217         * containing the IDs of all enabled input methods, each ID separated
3218         * by ':'.
3219         */
3220        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
3221
3222        /**
3223         * List of system input methods that are currently disabled.  This is a string
3224         * containing the IDs of all disabled input methods, each ID separated
3225         * by ':'.
3226         * @hide
3227         */
3228        public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
3229
3230        /**
3231         * Host name and port for global http proxy. Uses ':' seperator for
3232         * between host and port.
3233         *
3234         * @deprecated Use {@link Global#HTTP_PROXY}
3235         */
3236        @Deprecated
3237        public static final String HTTP_PROXY = Global.HTTP_PROXY;
3238
3239        /**
3240         * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead
3241         */
3242        @Deprecated
3243        public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS;
3244
3245        /**
3246         * Comma-separated list of location providers that activities may access.
3247         */
3248        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
3249
3250        /**
3251         * A flag containing settings used for biometric weak
3252         * @hide
3253         */
3254        public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
3255                "lock_biometric_weak_flags";
3256
3257        /**
3258         * Whether autolock is enabled (0 = false, 1 = true)
3259         */
3260        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
3261
3262        /**
3263         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
3264         */
3265        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
3266
3267        /**
3268         * Whether lock pattern will vibrate as user enters (0 = false, 1 =
3269         * true)
3270         *
3271         * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
3272         *             lockscreen uses
3273         *             {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
3274         */
3275        @Deprecated
3276        public static final String
3277                LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
3278
3279        /**
3280         * This preference allows the device to be locked given time after screen goes off,
3281         * subject to current DeviceAdmin policy limits.
3282         * @hide
3283         */
3284        public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
3285
3286
3287        /**
3288         * This preference contains the string that shows for owner info on LockScreen.
3289         * @hide
3290         * @deprecated
3291         */
3292        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
3293
3294        /**
3295         * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
3296         * @hide
3297         */
3298        public static final String LOCK_SCREEN_APPWIDGET_IDS =
3299            "lock_screen_appwidget_ids";
3300
3301        /**
3302         * Id of the appwidget shown on the lock screen when appwidgets are disabled.
3303         * @hide
3304         */
3305        public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
3306            "lock_screen_fallback_appwidget_id";
3307
3308        /**
3309         * Index of the lockscreen appwidget to restore, -1 if none.
3310         * @hide
3311         */
3312        public static final String LOCK_SCREEN_STICKY_APPWIDGET =
3313            "lock_screen_sticky_appwidget";
3314
3315        /**
3316         * This preference enables showing the owner info on LockScreen.
3317         * @hide
3318         * @deprecated
3319         */
3320        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
3321            "lock_screen_owner_info_enabled";
3322
3323        /**
3324         * The Logging ID (a unique 64-bit value) as a hex string.
3325         * Used as a pseudonymous identifier for logging.
3326         * @deprecated This identifier is poorly initialized and has
3327         * many collisions.  It should not be used.
3328         */
3329        @Deprecated
3330        public static final String LOGGING_ID = "logging_id";
3331
3332        /**
3333         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
3334         */
3335        @Deprecated
3336        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
3337
3338        /**
3339         * No longer supported.
3340         */
3341        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
3342
3343        /**
3344         * No longer supported.
3345         */
3346        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
3347
3348        /**
3349         * No longer supported.
3350         */
3351        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
3352
3353        /**
3354         * Settings classname to launch when Settings is clicked from All
3355         * Applications.  Needed because of user testing between the old
3356         * and new Settings apps.
3357         */
3358        // TODO: 881807
3359        public static final String SETTINGS_CLASSNAME = "settings_classname";
3360
3361        /**
3362         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
3363         */
3364        @Deprecated
3365        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
3366
3367        /**
3368         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
3369         */
3370        @Deprecated
3371        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
3372
3373        /**
3374         * If accessibility is enabled.
3375         */
3376        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
3377
3378        /**
3379         * If touch exploration is enabled.
3380         */
3381        public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
3382
3383        /**
3384         * List of the enabled accessibility providers.
3385         */
3386        public static final String ENABLED_ACCESSIBILITY_SERVICES =
3387            "enabled_accessibility_services";
3388
3389        /**
3390         * List of the accessibility services to which the user has granted
3391         * permission to put the device into touch exploration mode.
3392         *
3393         * @hide
3394         */
3395        public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
3396            "touch_exploration_granted_accessibility_services";
3397
3398        /**
3399         * Whether to speak passwords while in accessibility mode.
3400         */
3401        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
3402
3403        /**
3404         * If injection of accessibility enhancing JavaScript screen-reader
3405         * is enabled.
3406         * <p>
3407         *   Note: The JavaScript based screen-reader is served by the
3408         *   Google infrastructure and enable users with disabilities to
3409         *   efficiently navigate in and explore web content.
3410         * </p>
3411         * <p>
3412         *   This property represents a boolean value.
3413         * </p>
3414         * @hide
3415         */
3416        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
3417            "accessibility_script_injection";
3418
3419        /**
3420         * The URL for the injected JavaScript based screen-reader used
3421         * for providing accessibility of content in WebView.
3422         * <p>
3423         *   Note: The JavaScript based screen-reader is served by the
3424         *   Google infrastructure and enable users with disabilities to
3425         *   efficiently navigate in and explore web content.
3426         * </p>
3427         * <p>
3428         *   This property represents a string value.
3429         * </p>
3430         * @hide
3431         */
3432        public static final String ACCESSIBILITY_SCREEN_READER_URL =
3433            "accessibility_script_injection_url";
3434
3435        /**
3436         * Key bindings for navigation in built-in accessibility support for web content.
3437         * <p>
3438         *   Note: These key bindings are for the built-in accessibility navigation for
3439         *   web content which is used as a fall back solution if JavaScript in a WebView
3440         *   is not enabled or the user has not opted-in script injection from Google.
3441         * </p>
3442         * <p>
3443         *   The bindings are separated by semi-colon. A binding is a mapping from
3444         *   a key to a sequence of actions (for more details look at
3445         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
3446         *   string representation of an integer obtained from a meta state (optional) shifted
3447         *   sixteen times left and bitwise ored with a key code. An action is represented
3448         *   as a hexademical string representation of an integer where the first two digits
3449         *   are navigation action index, the second, the third, and the fourth digit pairs
3450         *   represent the action arguments. The separate actions in a binding are colon
3451         *   separated. The key and the action sequence it maps to are separated by equals.
3452         * </p>
3453         * <p>
3454         *   For example, the binding below maps the DPAD right button to traverse the
3455         *   current navigation axis once without firing an accessibility event and to
3456         *   perform the same traversal again but to fire an event:
3457         *   <code>
3458         *     0x16=0x01000100:0x01000101;
3459         *   </code>
3460         * </p>
3461         * <p>
3462         *   The goal of this binding is to enable dynamic rebinding of keys to
3463         *   navigation actions for web content without requiring a framework change.
3464         * </p>
3465         * <p>
3466         *   This property represents a string value.
3467         * </p>
3468         * @hide
3469         */
3470        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
3471            "accessibility_web_content_key_bindings";
3472
3473        /**
3474         * Setting that specifies whether the display magnification is enabled.
3475         * Display magnifications allows the user to zoom in the display content
3476         * and is targeted to low vision users. The current magnification scale
3477         * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
3478         *
3479         * @hide
3480         */
3481        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
3482                "accessibility_display_magnification_enabled";
3483
3484        /**
3485         * Setting that specifies what the display magnification scale is.
3486         * Display magnifications allows the user to zoom in the display
3487         * content and is targeted to low vision users. Whether a display
3488         * magnification is performed is controlled by
3489         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
3490         *
3491         * @hide
3492         */
3493        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
3494                "accessibility_display_magnification_scale";
3495
3496        /**
3497         * Setting that specifies whether the display magnification should be
3498         * automatically updated. If this fearture is enabled the system will
3499         * exit magnification mode or pan the viewport when a context change
3500         * occurs. For example, on staring a new activity or rotating the screen,
3501         * the system may zoom out so the user can see the new context he is in.
3502         * Another example is on showing a window that is not visible in the
3503         * magnified viewport the system may pan the viewport to make the window
3504         * the has popped up so the user knows that the context has changed.
3505         * Whether a screen magnification is performed is controlled by
3506         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
3507         *
3508         * @hide
3509         */
3510        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
3511                "accessibility_display_magnification_auto_update";
3512
3513        /**
3514         * Setting that specifies whether timed text (captions) should be
3515         * displayed in video content. Text display properties are controlled by
3516         * the following settings:
3517         * <ul>
3518         * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
3519         * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
3520         * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
3521         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
3522         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
3523         * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
3524         * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SIZE}
3525         * </ul>
3526         *
3527         * @hide
3528         */
3529        public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
3530                "accessibility_captioning_enabled";
3531
3532        /**
3533         * Setting that specifies the language for captions as a locale string,
3534         * e.g. en_US.
3535         *
3536         * @see java.util.Locale#toString
3537         * @hide
3538         */
3539        public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
3540                "accessibility_captioning_locale";
3541
3542        /**
3543         * Integer property that specifies the preset style for captions, one
3544         * of:
3545         * <ul>
3546         * <li>{@link android.view.accessibility.CaptioningManager#PRESET_WHITE_ON_BLACK}
3547         * <li>{@link android.view.accessibility.CaptioningManager#PRESET_BLACK_ON_WHITE}
3548         * <li>{@link android.view.accessibility.CaptioningManager#PRESET_CUSTOM}
3549         * </ul>
3550         *
3551         * @see java.util.Locale#toString
3552         * @hide
3553         */
3554        public static final String ACCESSIBILITY_CAPTIONING_PRESET =
3555                "accessibility_captioning_preset";
3556
3557        /**
3558         * Integer property that specifes the background color for captions as a
3559         * packed 32-bit color.
3560         *
3561         * @see android.graphics.Color#argb
3562         * @hide
3563         */
3564        public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
3565                "accessibility_captioning_background_color";
3566
3567        /**
3568         * Integer property that specifes the foreground color for captions as a
3569         * packed 32-bit color.
3570         *
3571         * @see android.graphics.Color#argb
3572         * @hide
3573         */
3574        public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
3575                "accessibility_captioning_foreground_color";
3576
3577        /**
3578         * Integer property that specifes the edge type for captions, one of:
3579         * <ul>
3580         * <li>{@link android.view.accessibility.CaptioningManager#EDGE_TYPE_NONE}
3581         * <li>{@link android.view.accessibility.CaptioningManager#EDGE_TYPE_OUTLINE}
3582         * <li>{@link android.view.accessibility.CaptioningManager#EDGE_TYPE_DROP_SHADOWED}
3583         * </ul>
3584         *
3585         * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
3586         * @hide
3587         */
3588        public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
3589                "accessibility_captioning_edge_type";
3590
3591        /**
3592         * Integer property that specifes the edge color for captions as a
3593         * packed 32-bit color.
3594         *
3595         * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
3596         * @see android.graphics.Color#argb
3597         * @hide
3598         */
3599        public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
3600                "accessibility_captioning_edge_color";
3601
3602        /**
3603         * String property that specifies the typeface for captions, one of:
3604         * <ul>
3605         * <li>DEFAULT
3606         * <li>MONOSPACE
3607         * <li>SANS_SERIF
3608         * <li>SERIF
3609         * </ul>
3610         *
3611         * @see android.graphics.Typeface
3612         * @hide
3613         */
3614        public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
3615                "accessibility_captioning_typeface";
3616
3617        /**
3618         * Integer point property that specifies font size for captions in
3619         * scaled pixels (sp).
3620         *
3621         * @hide
3622         */
3623        public static final String ACCESSIBILITY_CAPTIONING_FONT_SIZE =
3624                "accessibility_captioning_font_size";
3625
3626        /**
3627         * The timout for considering a press to be a long press in milliseconds.
3628         * @hide
3629         */
3630        public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
3631
3632        /**
3633         * List of the enabled print providers.
3634         * @hide
3635         */
3636        public static final String ENABLED_PRINT_SERVICES =
3637            "enabled_print_services";
3638
3639        /**
3640         * Setting to always use the default text-to-speech settings regardless
3641         * of the application settings.
3642         * 1 = override application settings,
3643         * 0 = use application settings (if specified).
3644         *
3645         * @deprecated  The value of this setting is no longer respected by
3646         * the framework text to speech APIs as of the Ice Cream Sandwich release.
3647         */
3648        @Deprecated
3649        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
3650
3651        /**
3652         * Default text-to-speech engine speech rate. 100 = 1x
3653         */
3654        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
3655
3656        /**
3657         * Default text-to-speech engine pitch. 100 = 1x
3658         */
3659        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
3660
3661        /**
3662         * Default text-to-speech engine.
3663         */
3664        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
3665
3666        /**
3667         * Default text-to-speech language.
3668         *
3669         * @deprecated this setting is no longer in use, as of the Ice Cream
3670         * Sandwich release. Apps should never need to read this setting directly,
3671         * instead can query the TextToSpeech framework classes for the default
3672         * locale. {@link TextToSpeech#getLanguage()}.
3673         */
3674        @Deprecated
3675        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
3676
3677        /**
3678         * Default text-to-speech country.
3679         *
3680         * @deprecated this setting is no longer in use, as of the Ice Cream
3681         * Sandwich release. Apps should never need to read this setting directly,
3682         * instead can query the TextToSpeech framework classes for the default
3683         * locale. {@link TextToSpeech#getLanguage()}.
3684         */
3685        @Deprecated
3686        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
3687
3688        /**
3689         * Default text-to-speech locale variant.
3690         *
3691         * @deprecated this setting is no longer in use, as of the Ice Cream
3692         * Sandwich release. Apps should never need to read this setting directly,
3693         * instead can query the TextToSpeech framework classes for the
3694         * locale that is in use {@link TextToSpeech#getLanguage()}.
3695         */
3696        @Deprecated
3697        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
3698
3699        /**
3700         * Stores the default tts locales on a per engine basis. Stored as
3701         * a comma seperated list of values, each value being of the form
3702         * {@code engine_name:locale} for example,
3703         * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
3704         * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
3705         * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
3706         * setting directly, and can query the TextToSpeech framework classes
3707         * for the locale that is in use.
3708         *
3709         * @hide
3710         */
3711        public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
3712
3713        /**
3714         * Space delimited list of plugin packages that are enabled.
3715         */
3716        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
3717
3718        /**
3719         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
3720         * instead.
3721         */
3722        @Deprecated
3723        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
3724                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
3725
3726        /**
3727         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
3728         * instead.
3729         */
3730        @Deprecated
3731        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
3732                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
3733
3734        /**
3735         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
3736         * instead.
3737         */
3738        @Deprecated
3739        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
3740                Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
3741
3742        /**
3743         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
3744         * instead.
3745         */
3746        @Deprecated
3747        public static final String WIFI_ON = Global.WIFI_ON;
3748
3749        /**
3750         * The acceptable packet loss percentage (range 0 - 100) before trying
3751         * another AP on the same network.
3752         * @deprecated This setting is not used.
3753         */
3754        @Deprecated
3755        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
3756                "wifi_watchdog_acceptable_packet_loss_percentage";
3757
3758        /**
3759         * The number of access points required for a network in order for the
3760         * watchdog to monitor it.
3761         * @deprecated This setting is not used.
3762         */
3763        @Deprecated
3764        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
3765
3766        /**
3767         * The delay between background checks.
3768         * @deprecated This setting is not used.
3769         */
3770        @Deprecated
3771        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
3772                "wifi_watchdog_background_check_delay_ms";
3773
3774        /**
3775         * Whether the Wi-Fi watchdog is enabled for background checking even
3776         * after it thinks the user has connected to a good access point.
3777         * @deprecated This setting is not used.
3778         */
3779        @Deprecated
3780        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
3781                "wifi_watchdog_background_check_enabled";
3782
3783        /**
3784         * The timeout for a background ping
3785         * @deprecated This setting is not used.
3786         */
3787        @Deprecated
3788        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
3789                "wifi_watchdog_background_check_timeout_ms";
3790
3791        /**
3792         * The number of initial pings to perform that *may* be ignored if they
3793         * fail. Again, if these fail, they will *not* be used in packet loss
3794         * calculation. For example, one network always seemed to time out for
3795         * the first couple pings, so this is set to 3 by default.
3796         * @deprecated This setting is not used.
3797         */
3798        @Deprecated
3799        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
3800            "wifi_watchdog_initial_ignored_ping_count";
3801
3802        /**
3803         * The maximum number of access points (per network) to attempt to test.
3804         * If this number is reached, the watchdog will no longer monitor the
3805         * initial connection state for the network. This is a safeguard for
3806         * networks containing multiple APs whose DNS does not respond to pings.
3807         * @deprecated This setting is not used.
3808         */
3809        @Deprecated
3810        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
3811
3812        /**
3813         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
3814         */
3815        @Deprecated
3816        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
3817
3818        /**
3819         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
3820         * @deprecated This setting is not used.
3821         */
3822        @Deprecated
3823        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
3824
3825        /**
3826         * The number of pings to test if an access point is a good connection.
3827         * @deprecated This setting is not used.
3828         */
3829        @Deprecated
3830        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
3831
3832        /**
3833         * The delay between pings.
3834         * @deprecated This setting is not used.
3835         */
3836        @Deprecated
3837        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
3838
3839        /**
3840         * The timeout per ping.
3841         * @deprecated This setting is not used.
3842         */
3843        @Deprecated
3844        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
3845
3846        /**
3847         * @deprecated Use
3848         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
3849         */
3850        @Deprecated
3851        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
3852
3853        /**
3854         * @deprecated Use
3855         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
3856         */
3857        @Deprecated
3858        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
3859                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
3860
3861        /**
3862         * Whether background data usage is allowed.
3863         *
3864         * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
3865         *             availability of background data depends on several
3866         *             combined factors. When background data is unavailable,
3867         *             {@link ConnectivityManager#getActiveNetworkInfo()} will
3868         *             now appear disconnected.
3869         */
3870        @Deprecated
3871        public static final String BACKGROUND_DATA = "background_data";
3872
3873        /**
3874         * Origins for which browsers should allow geolocation by default.
3875         * The value is a space-separated list of origins.
3876         */
3877        public static final String ALLOWED_GEOLOCATION_ORIGINS
3878                = "allowed_geolocation_origins";
3879
3880        /**
3881         * The preferred TTY mode     0 = TTy Off, CDMA default
3882         *                            1 = TTY Full
3883         *                            2 = TTY HCO
3884         *                            3 = TTY VCO
3885         * @hide
3886         */
3887        public static final String PREFERRED_TTY_MODE =
3888                "preferred_tty_mode";
3889
3890        /**
3891         * Whether the enhanced voice privacy mode is enabled.
3892         * 0 = normal voice privacy
3893         * 1 = enhanced voice privacy
3894         * @hide
3895         */
3896        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
3897
3898        /**
3899         * Whether the TTY mode mode is enabled.
3900         * 0 = disabled
3901         * 1 = enabled
3902         * @hide
3903         */
3904        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
3905
3906        /**
3907         * Controls whether settings backup is enabled.
3908         * Type: int ( 0 = disabled, 1 = enabled )
3909         * @hide
3910         */
3911        public static final String BACKUP_ENABLED = "backup_enabled";
3912
3913        /**
3914         * Controls whether application data is automatically restored from backup
3915         * at install time.
3916         * Type: int ( 0 = disabled, 1 = enabled )
3917         * @hide
3918         */
3919        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
3920
3921        /**
3922         * Indicates whether settings backup has been fully provisioned.
3923         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
3924         * @hide
3925         */
3926        public static final String BACKUP_PROVISIONED = "backup_provisioned";
3927
3928        /**
3929         * Component of the transport to use for backup/restore.
3930         * @hide
3931         */
3932        public static final String BACKUP_TRANSPORT = "backup_transport";
3933
3934        /**
3935         * Version for which the setup wizard was last shown.  Bumped for
3936         * each release when there is new setup information to show.
3937         * @hide
3938         */
3939        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
3940
3941        /**
3942         * The interval in milliseconds after which Wi-Fi is considered idle.
3943         * When idle, it is possible for the device to be switched from Wi-Fi to
3944         * the mobile data network.
3945         * @hide
3946         * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
3947         * instead.
3948         */
3949        @Deprecated
3950        public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
3951
3952        /**
3953         * The global search provider chosen by the user (if multiple global
3954         * search providers are installed). This will be the provider returned
3955         * by {@link SearchManager#getGlobalSearchActivity()} if it's still
3956         * installed. This setting is stored as a flattened component name as
3957         * per {@link ComponentName#flattenToString()}.
3958         *
3959         * @hide
3960         */
3961        public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
3962                "search_global_search_activity";
3963
3964        /**
3965         * The number of promoted sources in GlobalSearch.
3966         * @hide
3967         */
3968        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3969        /**
3970         * The maximum number of suggestions returned by GlobalSearch.
3971         * @hide
3972         */
3973        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3974        /**
3975         * The number of suggestions GlobalSearch will ask each non-web search source for.
3976         * @hide
3977         */
3978        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3979        /**
3980         * The number of suggestions the GlobalSearch will ask the web search source for.
3981         * @hide
3982         */
3983        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3984                "search_web_results_override_limit";
3985        /**
3986         * The number of milliseconds that GlobalSearch will wait for suggestions from
3987         * promoted sources before continuing with all other sources.
3988         * @hide
3989         */
3990        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3991                "search_promoted_source_deadline_millis";
3992        /**
3993         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3994         * @hide
3995         */
3996        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3997        /**
3998         * The maximum number of milliseconds that GlobalSearch shows the previous results
3999         * after receiving a new query.
4000         * @hide
4001         */
4002        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
4003        /**
4004         * The maximum age of log data used for shortcuts in GlobalSearch.
4005         * @hide
4006         */
4007        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
4008        /**
4009         * The maximum age of log data used for source ranking in GlobalSearch.
4010         * @hide
4011         */
4012        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
4013                "search_max_source_event_age_millis";
4014        /**
4015         * The minimum number of impressions needed to rank a source in GlobalSearch.
4016         * @hide
4017         */
4018        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
4019                "search_min_impressions_for_source_ranking";
4020        /**
4021         * The minimum number of clicks needed to rank a source in GlobalSearch.
4022         * @hide
4023         */
4024        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
4025                "search_min_clicks_for_source_ranking";
4026        /**
4027         * The maximum number of shortcuts shown by GlobalSearch.
4028         * @hide
4029         */
4030        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
4031        /**
4032         * The size of the core thread pool for suggestion queries in GlobalSearch.
4033         * @hide
4034         */
4035        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
4036                "search_query_thread_core_pool_size";
4037        /**
4038         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
4039         * @hide
4040         */
4041        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
4042                "search_query_thread_max_pool_size";
4043        /**
4044         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
4045         * @hide
4046         */
4047        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
4048                "search_shortcut_refresh_core_pool_size";
4049        /**
4050         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
4051         * @hide
4052         */
4053        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
4054                "search_shortcut_refresh_max_pool_size";
4055        /**
4056         * The maximun time that excess threads in the GlobalSeach thread pools will
4057         * wait before terminating.
4058         * @hide
4059         */
4060        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
4061                "search_thread_keepalive_seconds";
4062        /**
4063         * The maximum number of concurrent suggestion queries to each source.
4064         * @hide
4065         */
4066        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
4067                "search_per_source_concurrent_query_limit";
4068
4069        /**
4070         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
4071         * @hide
4072         */
4073        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
4074
4075        /**
4076         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
4077         * @hide
4078         */
4079        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
4080
4081        /**
4082         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
4083         * @hide
4084         */
4085        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
4086
4087        /**
4088         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
4089         * @hide
4090         */
4091        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
4092
4093        /**
4094         * If nonzero, ANRs in invisible background processes bring up a dialog.
4095         * Otherwise, the process will be silently killed.
4096         * @hide
4097         */
4098        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
4099
4100        /**
4101         * The {@link ComponentName} string of the service to be used as the voice recognition
4102         * service.
4103         *
4104         * @hide
4105         */
4106        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
4107
4108        /**
4109         * Stores whether an user has consented to have apps verified through PAM.
4110         * The value is boolean (1 or 0).
4111         *
4112         * @hide
4113         */
4114        public static final String PACKAGE_VERIFIER_USER_CONSENT =
4115            "package_verifier_user_consent";
4116
4117        /**
4118         * The {@link ComponentName} string of the selected spell checker service which is
4119         * one of the services managed by the text service manager.
4120         *
4121         * @hide
4122         */
4123        public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
4124
4125        /**
4126         * The {@link ComponentName} string of the selected subtype of the selected spell checker
4127         * service which is one of the services managed by the text service manager.
4128         *
4129         * @hide
4130         */
4131        public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
4132                "selected_spell_checker_subtype";
4133
4134        /**
4135         * The {@link ComponentName} string whether spell checker is enabled or not.
4136         *
4137         * @hide
4138         */
4139        public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
4140
4141        /**
4142         * What happens when the user presses the Power button while in-call
4143         * and the screen is on.<br/>
4144         * <b>Values:</b><br/>
4145         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
4146         * 2 - The Power button hangs up the current call.<br/>
4147         *
4148         * @hide
4149         */
4150        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
4151
4152        /**
4153         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
4154         * @hide
4155         */
4156        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
4157
4158        /**
4159         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
4160         * @hide
4161         */
4162        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
4163
4164        /**
4165         * INCALL_POWER_BUTTON_BEHAVIOR default value.
4166         * @hide
4167         */
4168        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
4169                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
4170
4171        /**
4172         * The current night mode that has been selected by the user.  Owned
4173         * and controlled by UiModeManagerService.  Constants are as per
4174         * UiModeManager.
4175         * @hide
4176         */
4177        public static final String UI_NIGHT_MODE = "ui_night_mode";
4178
4179        /**
4180         * Whether screensavers are enabled.
4181         * @hide
4182         */
4183        public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
4184
4185        /**
4186         * The user's chosen screensaver components.
4187         *
4188         * These will be launched by the PhoneWindowManager after a timeout when not on
4189         * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
4190         * @hide
4191         */
4192        public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
4193
4194        /**
4195         * If screensavers are enabled, whether the screensaver should be automatically launched
4196         * when the device is inserted into a (desk) dock.
4197         * @hide
4198         */
4199        public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
4200
4201        /**
4202         * If screensavers are enabled, whether the screensaver should be automatically launched
4203         * when the screen times out when not on battery.
4204         * @hide
4205         */
4206        public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
4207
4208        /**
4209         * If screensavers are enabled, the default screensaver component.
4210         * @hide
4211         */
4212        public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
4213
4214        /**
4215         * The default NFC payment component
4216         * @hide
4217         */
4218        public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
4219
4220        /**
4221         * Whether to automatically invoke NFC payment app or manually select on tap.
4222         * @hide
4223         */
4224        public static final String NFC_PAYMENT_MODE = "nfc_payment_mode";
4225
4226        /**
4227         * Name of a package that the current user has explicitly allowed to see all of that
4228         * user's notifications.
4229         *
4230         * @hide
4231         */
4232        public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
4233
4234        /**
4235         * Whether or not to enable the dial pad autocomplete functionality.
4236         *
4237         * @hide
4238         */
4239        public static final String DIALPAD_AUTOCOMPLETE = "dialpad_autocomplete";
4240
4241        /** @hide */
4242        public static final String BAR_SERVICE_COMPONENT = "bar_service_component";
4243
4244        /**
4245         * This are the settings to be backed up.
4246         *
4247         * NOTE: Settings are backed up and restored in the order they appear
4248         *       in this array. If you have one setting depending on another,
4249         *       make sure that they are ordered appropriately.
4250         *
4251         * @hide
4252         */
4253        public static final String[] SETTINGS_TO_BACKUP = {
4254            BUGREPORT_IN_POWER_MENU,                            // moved to global
4255            ALLOW_MOCK_LOCATION,
4256            PARENTAL_CONTROL_ENABLED,
4257            PARENTAL_CONTROL_REDIRECT_URL,
4258            USB_MASS_STORAGE_ENABLED,                           // moved to global
4259            ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
4260            ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
4261            ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
4262            ACCESSIBILITY_SCRIPT_INJECTION,
4263            BACKUP_AUTO_RESTORE,
4264            ENABLED_ACCESSIBILITY_SERVICES,
4265            TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
4266            TOUCH_EXPLORATION_ENABLED,
4267            ACCESSIBILITY_ENABLED,
4268            ACCESSIBILITY_SPEAK_PASSWORD,
4269            ACCESSIBILITY_CAPTIONING_ENABLED,
4270            ACCESSIBILITY_CAPTIONING_LOCALE,
4271            ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
4272            ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
4273            ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
4274            ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
4275            ACCESSIBILITY_CAPTIONING_TYPEFACE,
4276            ACCESSIBILITY_CAPTIONING_FONT_SIZE,
4277            TTS_USE_DEFAULTS,
4278            TTS_DEFAULT_RATE,
4279            TTS_DEFAULT_PITCH,
4280            TTS_DEFAULT_SYNTH,
4281            TTS_DEFAULT_LANG,
4282            TTS_DEFAULT_COUNTRY,
4283            TTS_ENABLED_PLUGINS,
4284            TTS_DEFAULT_LOCALE,
4285            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
4286            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
4287            WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
4288            MOUNT_PLAY_NOTIFICATION_SND,
4289            MOUNT_UMS_AUTOSTART,
4290            MOUNT_UMS_PROMPT,
4291            MOUNT_UMS_NOTIFY_ENABLED,
4292            UI_NIGHT_MODE,
4293            DIALPAD_AUTOCOMPLETE
4294        };
4295
4296        /**
4297         * Helper method for determining if a location provider is enabled.
4298         * @param cr the content resolver to use
4299         * @param provider the location provider to query
4300         * @return true if the provider is enabled
4301         */
4302        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
4303            return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
4304        }
4305
4306        /**
4307         * Helper method for determining if a location provider is enabled.
4308         * @param cr the content resolver to use
4309         * @param provider the location provider to query
4310         * @param userId the userId to query
4311         * @return true if the provider is enabled
4312         * @hide
4313         */
4314        public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
4315            String allowedProviders = Settings.Secure.getStringForUser(cr,
4316                    LOCATION_PROVIDERS_ALLOWED, userId);
4317            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
4318        }
4319
4320        /**
4321         * Thread-safe method for enabling or disabling a single location provider.
4322         * @param cr the content resolver to use
4323         * @param provider the location provider to enable or disable
4324         * @param enabled true if the provider should be enabled
4325         */
4326        public static final void setLocationProviderEnabled(ContentResolver cr,
4327                String provider, boolean enabled) {
4328            setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
4329        }
4330
4331        /**
4332         * Thread-safe method for enabling or disabling a single location provider.
4333         * @param cr the content resolver to use
4334         * @param provider the location provider to enable or disable
4335         * @param enabled true if the provider should be enabled
4336         * @param userId the userId for which to enable/disable providers
4337         * @hide
4338         */
4339        public static final void setLocationProviderEnabledForUser(ContentResolver cr,
4340                String provider, boolean enabled, int userId) {
4341            // to ensure thread safety, we write the provider name with a '+' or '-'
4342            // and let the SettingsProvider handle it rather than reading and modifying
4343            // the list of enabled providers.
4344            if (enabled) {
4345                provider = "+" + provider;
4346            } else {
4347                provider = "-" + provider;
4348            }
4349            putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
4350                    userId);
4351        }
4352    }
4353
4354    /**
4355     * Global system settings, containing preferences that always apply identically
4356     * to all defined users.  Applications can read these but are not allowed to write;
4357     * like the "Secure" settings, these are for preferences that the user must
4358     * explicitly modify through the system UI or specialized APIs for those values.
4359     */
4360    public static final class Global extends NameValueTable {
4361        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version";
4362
4363        /**
4364         * The content:// style URL for global secure settings items.  Not public.
4365         */
4366        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
4367
4368        /**
4369         * Setting whether the global gesture for enabling accessibility is enabled.
4370         * If this gesture is enabled the user will be able to perfrom it to enable
4371         * the accessibility state without visiting the settings app.
4372         * @hide
4373         */
4374        public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
4375                "enable_accessibility_global_gesture_enabled";
4376
4377        /**
4378         * Whether Airplane Mode is on.
4379         */
4380        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
4381
4382        /**
4383         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
4384         */
4385        public static final String RADIO_BLUETOOTH = "bluetooth";
4386
4387        /**
4388         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
4389         */
4390        public static final String RADIO_WIFI = "wifi";
4391
4392        /**
4393         * {@hide}
4394         */
4395        public static final String RADIO_WIMAX = "wimax";
4396        /**
4397         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
4398         */
4399        public static final String RADIO_CELL = "cell";
4400
4401        /**
4402         * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
4403         */
4404        public static final String RADIO_NFC = "nfc";
4405
4406        /**
4407         * A comma separated list of radios that need to be disabled when airplane mode
4408         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
4409         * included in the comma separated list.
4410         */
4411        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
4412
4413        /**
4414         * A comma separated list of radios that should to be disabled when airplane mode
4415         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
4416         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
4417         * will be turned off when entering airplane mode, but the user will be able to reenable
4418         * Wifi in the Settings app.
4419         *
4420         * {@hide}
4421         */
4422        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
4423
4424        /**
4425         * The policy for deciding when Wi-Fi should go to sleep (which will in
4426         * turn switch to using the mobile data as an Internet connection).
4427         * <p>
4428         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
4429         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
4430         * {@link #WIFI_SLEEP_POLICY_NEVER}.
4431         */
4432        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
4433
4434        /**
4435         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
4436         * policy, which is to sleep shortly after the turning off
4437         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
4438         */
4439        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
4440
4441        /**
4442         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
4443         * the device is on battery, and never go to sleep when the device is
4444         * plugged in.
4445         */
4446        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
4447
4448        /**
4449         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
4450         */
4451        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
4452
4453        /**
4454         * Value to specify if the user prefers the date, time and time zone
4455         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
4456         */
4457        public static final String AUTO_TIME = "auto_time";
4458
4459        /**
4460         * Value to specify if the user prefers the time zone
4461         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
4462         */
4463        public static final String AUTO_TIME_ZONE = "auto_time_zone";
4464
4465        /**
4466         * URI for the car dock "in" event sound.
4467         * @hide
4468         */
4469        public static final String CAR_DOCK_SOUND = "car_dock_sound";
4470
4471        /**
4472         * URI for the car dock "out" event sound.
4473         * @hide
4474         */
4475        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
4476
4477        /**
4478         * URI for the desk dock "in" event sound.
4479         * @hide
4480         */
4481        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
4482
4483        /**
4484         * URI for the desk dock "out" event sound.
4485         * @hide
4486         */
4487        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
4488
4489        /**
4490         * Whether to play a sound for dock events.
4491         * @hide
4492         */
4493        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
4494
4495        /**
4496         * URI for the "device locked" (keyguard shown) sound.
4497         * @hide
4498         */
4499        public static final String LOCK_SOUND = "lock_sound";
4500
4501        /**
4502         * URI for the "device unlocked" sound.
4503         * @hide
4504         */
4505        public static final String UNLOCK_SOUND = "unlock_sound";
4506
4507        /**
4508         * URI for the low battery sound file.
4509         * @hide
4510         */
4511        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
4512
4513        /**
4514         * Whether to play a sound for low-battery alerts.
4515         * @hide
4516         */
4517        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
4518
4519        /**
4520         * URI for the "wireless charging started" sound.
4521         * @hide
4522         */
4523        public static final String WIRELESS_CHARGING_STARTED_SOUND =
4524                "wireless_charging_started_sound";
4525
4526        /**
4527         * Whether we keep the device on while the device is plugged in.
4528         * Supported values are:
4529         * <ul>
4530         * <li>{@code 0} to never stay on while plugged in</li>
4531         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
4532         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
4533         * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
4534         * </ul>
4535         * These values can be OR-ed together.
4536         */
4537        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
4538
4539        /**
4540         * When the user has enable the option to have a "bug report" command
4541         * in the power menu.
4542         * @hide
4543         */
4544        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
4545
4546        /**
4547         * Whether ADB is enabled.
4548         */
4549        public static final String ADB_ENABLED = "adb_enabled";
4550
4551        /**
4552         * Whether assisted GPS should be enabled or not.
4553         * @hide
4554         */
4555        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
4556
4557        /**
4558         * Whether bluetooth is enabled/disabled
4559         * 0=disabled. 1=enabled.
4560         */
4561        public static final String BLUETOOTH_ON = "bluetooth_on";
4562
4563        /**
4564         * CDMA Cell Broadcast SMS
4565         *                            0 = CDMA Cell Broadcast SMS disabled
4566         *                            1 = CDMA Cell Broadcast SMS enabled
4567         * @hide
4568         */
4569        public static final String CDMA_CELL_BROADCAST_SMS =
4570                "cdma_cell_broadcast_sms";
4571
4572        /**
4573         * The CDMA roaming mode 0 = Home Networks, CDMA default
4574         *                       1 = Roaming on Affiliated networks
4575         *                       2 = Roaming on any networks
4576         * @hide
4577         */
4578        public static final String CDMA_ROAMING_MODE = "roaming_settings";
4579
4580        /**
4581         * The CDMA subscription mode 0 = RUIM/SIM (default)
4582         *                                1 = NV
4583         * @hide
4584         */
4585        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
4586
4587        /** Inactivity timeout to track mobile data activity.
4588        *
4589        * If set to a positive integer, it indicates the inactivity timeout value in seconds to
4590        * infer the data activity of mobile network. After a period of no activity on mobile
4591        * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
4592        * intent is fired to indicate a transition of network status from "active" to "idle". Any
4593        * subsequent activity on mobile networks triggers the firing of {@code
4594        * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
4595        *
4596        * Network activity refers to transmitting or receiving data on the network interfaces.
4597        *
4598        * Tracking is disabled if set to zero or negative value.
4599        *
4600        * @hide
4601        */
4602       public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
4603
4604       /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
4605        * but for Wifi network.
4606        * @hide
4607        */
4608       public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
4609
4610       /**
4611        * Whether or not data roaming is enabled. (0 = false, 1 = true)
4612        */
4613       public static final String DATA_ROAMING = "data_roaming";
4614
4615       /**
4616        * The value passed to a Mobile DataConnection via bringUp which defines the
4617        * number of retries to preform when setting up the initial connection. The default
4618        * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
4619        * @hide
4620        */
4621       public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
4622
4623       /**
4624        * Whether user has enabled development settings.
4625        */
4626       public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
4627
4628       /**
4629        * Whether the device has been provisioned (0 = false, 1 = true)
4630        */
4631       public static final String DEVICE_PROVISIONED = "device_provisioned";
4632
4633       /**
4634        * The saved value for WindowManagerService.setForcedDisplayDensity().
4635        * One integer in dpi.  If unset, then use the real display density.
4636        * @hide
4637        */
4638       public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
4639
4640       /**
4641        * The saved value for WindowManagerService.setForcedDisplaySize().
4642        * Two integers separated by a comma.  If unset, then use the real display size.
4643        * @hide
4644        */
4645       public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
4646
4647       /**
4648        * The maximum size, in bytes, of a download that the download manager will transfer over
4649        * a non-wifi connection.
4650        * @hide
4651        */
4652       public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
4653               "download_manager_max_bytes_over_mobile";
4654
4655       /**
4656        * The recommended maximum size, in bytes, of a download that the download manager should
4657        * transfer over a non-wifi connection. Over this size, the use will be warned, but will
4658        * have the option to start the download over the mobile connection anyway.
4659        * @hide
4660        */
4661       public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
4662               "download_manager_recommended_max_bytes_over_mobile";
4663
4664       /**
4665        * Whether the package installer should allow installation of apps downloaded from
4666        * sources other than Google Play.
4667        *
4668        * 1 = allow installing from other sources
4669        * 0 = only allow installing from Google Play
4670        */
4671       public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
4672
4673       /**
4674        * Whether mobile data connections are allowed by the user.  See
4675        * ConnectivityManager for more info.
4676        * @hide
4677        */
4678       public static final String MOBILE_DATA = "mobile_data";
4679
4680       /** {@hide} */
4681       public static final String NETSTATS_ENABLED = "netstats_enabled";
4682       /** {@hide} */
4683       public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
4684       /** {@hide} */
4685       public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
4686       /** {@hide} */
4687       public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
4688       /** {@hide} */
4689       public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
4690       /** {@hide} */
4691       public static final String NETSTATS_REPORT_XT_OVER_DEV = "netstats_report_xt_over_dev";
4692
4693       /** {@hide} */
4694       public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
4695       /** {@hide} */
4696       public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
4697       /** {@hide} */
4698       public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
4699       /** {@hide} */
4700       public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
4701
4702       /** {@hide} */
4703       public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
4704       /** {@hide} */
4705       public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
4706       /** {@hide} */
4707       public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
4708       /** {@hide} */
4709       public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
4710
4711       /** {@hide} */
4712       public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
4713       /** {@hide} */
4714       public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
4715       /** {@hide} */
4716       public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
4717       /** {@hide} */
4718       public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
4719
4720       /**
4721        * User preference for which network(s) should be used. Only the
4722        * connectivity service should touch this.
4723        */
4724       public static final String NETWORK_PREFERENCE = "network_preference";
4725
4726       /**
4727        * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
4728        * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
4729        * exceeded.
4730        * @hide
4731        */
4732       public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
4733
4734       /**
4735        * The length of time in milli-seconds that automatic small adjustments to
4736        * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
4737        * @hide
4738        */
4739       public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
4740
4741       /** Preferred NTP server. {@hide} */
4742       public static final String NTP_SERVER = "ntp_server";
4743       /** Timeout in milliseconds to wait for NTP server. {@hide} */
4744       public static final String NTP_TIMEOUT = "ntp_timeout";
4745
4746       /**
4747        * Whether the package manager should send package verification broadcasts for verifiers to
4748        * review apps prior to installation.
4749        * 1 = request apps to be verified prior to installation, if a verifier exists.
4750        * 0 = do not verify apps before installation
4751        * @hide
4752        */
4753       public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
4754
4755       /** Timeout for package verification.
4756        * @hide */
4757       public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
4758
4759       /** Default response code for package verification.
4760        * @hide */
4761       public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
4762
4763       /**
4764        * Show package verification setting in the Settings app.
4765        * 1 = show (default)
4766        * 0 = hide
4767        * @hide
4768        */
4769       public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
4770
4771       /**
4772        * Run package verificaiton on apps installed through ADB/ADT/USB
4773        * 1 = perform package verification on ADB installs (default)
4774        * 0 = bypass package verification on ADB installs
4775        * @hide
4776        */
4777       public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
4778
4779       /**
4780        * The interval in milliseconds at which to check packet counts on the
4781        * mobile data interface when screen is on, to detect possible data
4782        * connection problems.
4783        * @hide
4784        */
4785       public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
4786               "pdp_watchdog_poll_interval_ms";
4787
4788       /**
4789        * The interval in milliseconds at which to check packet counts on the
4790        * mobile data interface when screen is off, to detect possible data
4791        * connection problems.
4792        * @hide
4793        */
4794       public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
4795               "pdp_watchdog_long_poll_interval_ms";
4796
4797       /**
4798        * The interval in milliseconds at which to check packet counts on the
4799        * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
4800        * outgoing packets has been reached without incoming packets.
4801        * @hide
4802        */
4803       public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
4804               "pdp_watchdog_error_poll_interval_ms";
4805
4806       /**
4807        * The number of outgoing packets sent without seeing an incoming packet
4808        * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
4809        * device is logged to the event log
4810        * @hide
4811        */
4812       public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
4813               "pdp_watchdog_trigger_packet_count";
4814
4815       /**
4816        * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
4817        * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
4818        * attempting data connection recovery.
4819        * @hide
4820        */
4821       public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
4822               "pdp_watchdog_error_poll_count";
4823
4824       /**
4825        * The number of failed PDP reset attempts before moving to something more
4826        * drastic: re-registering to the network.
4827        * @hide
4828        */
4829       public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
4830               "pdp_watchdog_max_pdp_reset_fail_count";
4831
4832       /**
4833        * A positive value indicates how often the SamplingProfiler
4834        * should take snapshots. Zero value means SamplingProfiler
4835        * is disabled.
4836        *
4837        * @hide
4838        */
4839       public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
4840
4841       /**
4842        * URL to open browser on to allow user to manage a prepay account
4843        * @hide
4844        */
4845       public static final String SETUP_PREPAID_DATA_SERVICE_URL =
4846               "setup_prepaid_data_service_url";
4847
4848       /**
4849        * URL to attempt a GET on to see if this is a prepay device
4850        * @hide
4851        */
4852       public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
4853               "setup_prepaid_detection_target_url";
4854
4855       /**
4856        * Host to check for a redirect to after an attempt to GET
4857        * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
4858        * this is a prepaid device with zero balance.)
4859        * @hide
4860        */
4861       public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
4862               "setup_prepaid_detection_redir_host";
4863
4864       /**
4865        * The interval in milliseconds at which to check the number of SMS sent out without asking
4866        * for use permit, to limit the un-authorized SMS usage.
4867        *
4868        * @hide
4869        */
4870       public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
4871               "sms_outgoing_check_interval_ms";
4872
4873       /**
4874        * The number of outgoing SMS sent without asking for user permit (of {@link
4875        * #SMS_OUTGOING_CHECK_INTERVAL_MS}
4876        *
4877        * @hide
4878        */
4879       public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
4880               "sms_outgoing_check_max_count";
4881
4882       /**
4883        * Used to disable SMS short code confirmation - defaults to true.
4884        * True indcates we will do the check, etc.  Set to false to disable.
4885        * @see com.android.internal.telephony.SmsUsageMonitor
4886        * @hide
4887        */
4888       public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
4889
4890        /**
4891         * Used to select which country we use to determine premium sms codes.
4892         * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
4893         * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
4894         * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
4895         * @hide
4896         */
4897        public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
4898
4899       /**
4900        * Used to disable Tethering on a device - defaults to true
4901        * @hide
4902        */
4903       public static final String TETHER_SUPPORTED = "tether_supported";
4904
4905       /**
4906        * Used to require DUN APN on the device or not - defaults to a build config value
4907        * which defaults to false
4908        * @hide
4909        */
4910       public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
4911
4912       /**
4913        * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
4914        * corresponding build config values are set it will override the APN DB
4915        * values.
4916        * Consists of a comma seperated list of strings:
4917        * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
4918        * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
4919        * @hide
4920        */
4921       public static final String TETHER_DUN_APN = "tether_dun_apn";
4922
4923       /**
4924        * USB Mass Storage Enabled
4925        */
4926       public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
4927
4928       /**
4929        * If this setting is set (to anything), then all references
4930        * to Gmail on the device must change to Google Mail.
4931        */
4932       public static final String USE_GOOGLE_MAIL = "use_google_mail";
4933
4934       /** Autofill server address (Used in WebView/browser).
4935        * {@hide} */
4936       public static final String WEB_AUTOFILL_QUERY_URL =
4937           "web_autofill_query_url";
4938
4939       /**
4940        * Whether Wifi display is enabled/disabled
4941        * 0=disabled. 1=enabled.
4942        * @hide
4943        */
4944       public static final String WIFI_DISPLAY_ON = "wifi_display_on";
4945
4946       /**
4947        * Whether to notify the user of open networks.
4948        * <p>
4949        * If not connected and the scan results have an open network, we will
4950        * put this notification up. If we attempt to connect to a network or
4951        * the open network(s) disappear, we remove the notification. When we
4952        * show the notification, we will not show it again for
4953        * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
4954        */
4955       public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
4956               "wifi_networks_available_notification_on";
4957       /**
4958        * {@hide}
4959        */
4960       public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
4961               "wimax_networks_available_notification_on";
4962
4963       /**
4964        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
4965        * Connecting to a network will reset the timer.
4966        */
4967       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
4968               "wifi_networks_available_repeat_delay";
4969
4970       /**
4971        * 802.11 country code in ISO 3166 format
4972        * @hide
4973        */
4974       public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
4975
4976       /**
4977        * The interval in milliseconds to issue wake up scans when wifi needs
4978        * to connect. This is necessary to connect to an access point when
4979        * device is on the move and the screen is off.
4980        * @hide
4981        */
4982       public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
4983               "wifi_framework_scan_interval_ms";
4984
4985       /**
4986        * The interval in milliseconds after which Wi-Fi is considered idle.
4987        * When idle, it is possible for the device to be switched from Wi-Fi to
4988        * the mobile data network.
4989        * @hide
4990        */
4991       public static final String WIFI_IDLE_MS = "wifi_idle_ms";
4992
4993       /**
4994        * When the number of open networks exceeds this number, the
4995        * least-recently-used excess networks will be removed.
4996        */
4997       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
4998
4999       /**
5000        * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
5001        */
5002       public static final String WIFI_ON = "wifi_on";
5003
5004       /**
5005        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
5006        * @hide
5007        */
5008       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
5009                "wifi_scan_always_enabled";
5010
5011       /**
5012        * Used to save the Wifi_ON state prior to tethering.
5013        * This state will be checked to restore Wifi after
5014        * the user turns off tethering.
5015        *
5016        * @hide
5017        */
5018       public static final String WIFI_SAVED_STATE = "wifi_saved_state";
5019
5020       /**
5021        * The interval in milliseconds to scan as used by the wifi supplicant
5022        * @hide
5023        */
5024       public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
5025               "wifi_supplicant_scan_interval_ms";
5026
5027       /**
5028        * The interval in milliseconds to scan at supplicant when p2p is connected
5029        * @hide
5030        */
5031       public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
5032               "wifi_scan_interval_p2p_connected_ms";
5033
5034       /**
5035        * Whether the Wi-Fi watchdog is enabled.
5036        */
5037       public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
5038
5039       /**
5040        * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
5041        * the setting needs to be set to 0 to disable it.
5042        * @hide
5043        */
5044       public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
5045               "wifi_watchdog_poor_network_test_enabled";
5046
5047       /**
5048        * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
5049        * needs to be set to 0 to disable it.
5050        * @hide
5051        */
5052       public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
5053               "wifi_suspend_optimizations_enabled";
5054
5055       /**
5056        * The maximum number of times we will retry a connection to an access
5057        * point for which we have failed in acquiring an IP address from DHCP.
5058        * A value of N means that we will make N+1 connection attempts in all.
5059        */
5060       public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
5061
5062       /**
5063        * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
5064        * data connectivity to be established after a disconnect from Wi-Fi.
5065        */
5066       public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
5067           "wifi_mobile_data_transition_wakelock_timeout_ms";
5068
5069       /**
5070        * The operational wifi frequency band
5071        * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
5072        * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
5073        * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
5074        *
5075        * @hide
5076        */
5077       public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
5078
5079       /**
5080        * The Wi-Fi peer-to-peer device name
5081        * @hide
5082        */
5083       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
5084
5085       /**
5086        * The min time between wifi disable and wifi enable
5087        * @hide
5088        */
5089       public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
5090
5091       /**
5092        * The number of milliseconds to delay when checking for data stalls during
5093        * non-aggressive detection. (screen is turned off.)
5094        * @hide
5095        */
5096       public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
5097               "data_stall_alarm_non_aggressive_delay_in_ms";
5098
5099       /**
5100        * The number of milliseconds to delay when checking for data stalls during
5101        * aggressive detection. (screen on or suspected data stall)
5102        * @hide
5103        */
5104       public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
5105               "data_stall_alarm_aggressive_delay_in_ms";
5106
5107       /**
5108        * The interval in milliseconds at which to check gprs registration
5109        * after the first registration mismatch of gprs and voice service,
5110        * to detect possible data network registration problems.
5111        *
5112        * @hide
5113        */
5114       public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
5115               "gprs_register_check_period_ms";
5116
5117       /**
5118        * Nonzero causes Log.wtf() to crash.
5119        * @hide
5120        */
5121       public static final String WTF_IS_FATAL = "wtf_is_fatal";
5122
5123       /**
5124        * Ringer mode. This is used internally, changing this value will not
5125        * change the ringer mode. See AudioManager.
5126        */
5127       public static final String MODE_RINGER = "mode_ringer";
5128
5129       /**
5130        * Overlay display devices setting.
5131        * The associated value is a specially formatted string that describes the
5132        * size and density of simulated secondary display devices.
5133        * <p>
5134        * Format: {width}x{height}/{dpi};...
5135        * </p><p>
5136        * Example:
5137        * <ul>
5138        * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
5139        * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
5140        * at 1080p and the second at 720p.</li>
5141        * <li>If the value is empty, then no overlay display devices are created.</li>
5142        * </ul></p>
5143        *
5144        * @hide
5145        */
5146       public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
5147
5148        /**
5149         * Threshold values for the duration and level of a discharge cycle,
5150         * under which we log discharge cycle info.
5151         *
5152         * @hide
5153         */
5154        public static final String
5155                BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
5156
5157        /** @hide */
5158        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
5159
5160        /**
5161         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
5162         * intents on application crashes and ANRs. If this is disabled, the
5163         * crash/ANR dialog will never display the "Report" button.
5164         * <p>
5165         * Type: int (0 = disallow, 1 = allow)
5166         *
5167         * @hide
5168         */
5169        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
5170
5171        /**
5172         * Maximum age of entries kept by {@link DropBoxManager}.
5173         *
5174         * @hide
5175         */
5176        public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
5177
5178        /**
5179         * Maximum number of entry files which {@link DropBoxManager} will keep
5180         * around.
5181         *
5182         * @hide
5183         */
5184        public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
5185
5186        /**
5187         * Maximum amount of disk space used by {@link DropBoxManager} no matter
5188         * what.
5189         *
5190         * @hide
5191         */
5192        public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
5193
5194        /**
5195         * Percent of free disk (excluding reserve) which {@link DropBoxManager}
5196         * will use.
5197         *
5198         * @hide
5199         */
5200        public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
5201
5202        /**
5203         * Percent of total disk which {@link DropBoxManager} will never dip
5204         * into.
5205         *
5206         * @hide
5207         */
5208        public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
5209
5210        /**
5211         * Prefix for per-tag dropbox disable/enable settings.
5212         *
5213         * @hide
5214         */
5215        public static final String DROPBOX_TAG_PREFIX = "dropbox:";
5216
5217        /**
5218         * Lines of logcat to include with system crash/ANR/etc. reports, as a
5219         * prefix of the dropbox tag of the report type. For example,
5220         * "logcat_for_system_server_anr" controls the lines of logcat captured
5221         * with system server ANR reports. 0 to disable.
5222         *
5223         * @hide
5224         */
5225        public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
5226
5227        /**
5228         * The interval in minutes after which the amount of free storage left
5229         * on the device is logged to the event log
5230         *
5231         * @hide
5232         */
5233        public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
5234
5235        /**
5236         * Threshold for the amount of change in disk free space required to
5237         * report the amount of free space. Used to prevent spamming the logs
5238         * when the disk free space isn't changing frequently.
5239         *
5240         * @hide
5241         */
5242        public static final String
5243                DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
5244
5245        /**
5246         * Minimum percentage of free storage on the device that is used to
5247         * determine if the device is running low on storage. The default is 10.
5248         * <p>
5249         * Say this value is set to 10, the device is considered running low on
5250         * storage if 90% or more of the device storage is filled up.
5251         *
5252         * @hide
5253         */
5254        public static final String
5255                SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
5256
5257        /**
5258         * Maximum byte size of the low storage threshold. This is to ensure
5259         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
5260         * overly large threshold for large storage devices. Currently this must
5261         * be less than 2GB. This default is 500MB.
5262         *
5263         * @hide
5264         */
5265        public static final String
5266                SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
5267
5268        /**
5269         * Minimum bytes of free storage on the device before the data partition
5270         * is considered full. By default, 1 MB is reserved to avoid system-wide
5271         * SQLite disk full exceptions.
5272         *
5273         * @hide
5274         */
5275        public static final String
5276                SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
5277
5278        /**
5279         * The maximum reconnect delay for short network outages or when the
5280         * network is suspended due to phone use.
5281         *
5282         * @hide
5283         */
5284        public static final String
5285                SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
5286
5287        /**
5288         * The number of milliseconds to delay before sending out
5289         * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts.
5290         *
5291         * @hide
5292         */
5293        public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
5294
5295        /**
5296         * Setting to turn off captive portal detection. Feature is enabled by
5297         * default and the setting needs to be set to 0 to disable it.
5298         *
5299         * @hide
5300         */
5301        public static final String
5302                CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
5303
5304        /**
5305         * The server used for captive portal detection upon a new conection. A
5306         * 204 response code from the server is used for validation.
5307         *
5308         * @hide
5309         */
5310        public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
5311
5312        /**
5313         * Whether network service discovery is enabled.
5314         *
5315         * @hide
5316         */
5317        public static final String NSD_ON = "nsd_on";
5318
5319        /**
5320         * Let user pick default install location.
5321         *
5322         * @hide
5323         */
5324        public static final String SET_INSTALL_LOCATION = "set_install_location";
5325
5326        /**
5327         * Default install location value.
5328         * 0 = auto, let system decide
5329         * 1 = internal
5330         * 2 = sdcard
5331         * @hide
5332         */
5333        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
5334
5335        /**
5336         * ms during which to consume extra events related to Inet connection
5337         * condition after a transtion to fully-connected
5338         *
5339         * @hide
5340         */
5341        public static final String
5342                INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
5343
5344        /**
5345         * ms during which to consume extra events related to Inet connection
5346         * condtion after a transtion to partly-connected
5347         *
5348         * @hide
5349         */
5350        public static final String
5351                INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
5352
5353        /** {@hide} */
5354        public static final String
5355                READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
5356
5357        /**
5358         * Host name and port for global http proxy. Uses ':' seperator for
5359         * between host and port.
5360         */
5361        public static final String HTTP_PROXY = "http_proxy";
5362
5363        /**
5364         * Host name for global http proxy. Set via ConnectivityManager.
5365         *
5366         * @hide
5367         */
5368        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
5369
5370        /**
5371         * Integer host port for global http proxy. Set via ConnectivityManager.
5372         *
5373         * @hide
5374         */
5375        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
5376
5377        /**
5378         * Exclusion list for global proxy. This string contains a list of
5379         * comma-separated domains where the global proxy does not apply.
5380         * Domains should be listed in a comma- separated list. Example of
5381         * acceptable formats: ".domain1.com,my.domain2.com" Use
5382         * ConnectivityManager to set/get.
5383         *
5384         * @hide
5385         */
5386        public static final String
5387                GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
5388
5389        /**
5390         * Enables the UI setting to allow the user to specify the global HTTP
5391         * proxy and associated exclusion list.
5392         *
5393         * @hide
5394         */
5395        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
5396
5397        /**
5398         * Setting for default DNS in case nobody suggests one
5399         *
5400         * @hide
5401         */
5402        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
5403
5404        /** {@hide} */
5405        public static final String
5406                BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
5407        /** {@hide} */
5408        public static final String
5409                BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
5410        /** {@hide} */
5411        public static final String
5412                BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
5413
5414        /**
5415         * Get the key that retrieves a bluetooth headset's priority.
5416         * @hide
5417         */
5418        public static final String getBluetoothHeadsetPriorityKey(String address) {
5419            return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
5420        }
5421
5422        /**
5423         * Get the key that retrieves a bluetooth a2dp sink's priority.
5424         * @hide
5425         */
5426        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
5427            return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
5428        }
5429
5430        /**
5431         * Get the key that retrieves a bluetooth Input Device's priority.
5432         * @hide
5433         */
5434        public static final String getBluetoothInputDevicePriorityKey(String address) {
5435            return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
5436        }
5437
5438        /**
5439         * Scaling factor for normal window animations. Setting to 0 will
5440         * disable window animations.
5441         */
5442        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
5443
5444        /**
5445         * Scaling factor for activity transition animations. Setting to 0 will
5446         * disable window animations.
5447         */
5448        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
5449
5450        /**
5451         * Scaling factor for Animator-based animations. This affects both the
5452         * start delay and duration of all such animations. Setting to 0 will
5453         * cause animations to end immediately. The default value is 1.
5454         */
5455        public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
5456
5457        /**
5458         * Scaling factor for normal window animations. Setting to 0 will
5459         * disable window animations.
5460         *
5461         * @hide
5462         */
5463        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
5464
5465        /**
5466         * If 0, the compatibility mode is off for all applications.
5467         * If 1, older applications run under compatibility mode.
5468         * TODO: remove this settings before code freeze (bug/1907571)
5469         * @hide
5470         */
5471        public static final String COMPATIBILITY_MODE = "compatibility_mode";
5472
5473        /**
5474         * CDMA only settings
5475         * Emergency Tone  0 = Off
5476         *                 1 = Alert
5477         *                 2 = Vibrate
5478         * @hide
5479         */
5480        public static final String EMERGENCY_TONE = "emergency_tone";
5481
5482        /**
5483         * CDMA only settings
5484         * Whether the auto retry is enabled. The value is
5485         * boolean (1 or 0).
5486         * @hide
5487         */
5488        public static final String CALL_AUTO_RETRY = "call_auto_retry";
5489
5490        /**
5491         * The preferred network mode   7 = Global
5492         *                              6 = EvDo only
5493         *                              5 = CDMA w/o EvDo
5494         *                              4 = CDMA / EvDo auto
5495         *                              3 = GSM / WCDMA auto
5496         *                              2 = WCDMA only
5497         *                              1 = GSM only
5498         *                              0 = GSM / WCDMA preferred
5499         * @hide
5500         */
5501        public static final String PREFERRED_NETWORK_MODE =
5502                "preferred_network_mode";
5503
5504        /**
5505         * The cdma subscription 0 = Subscription from RUIM, when available
5506         *                       1 = Subscription from NV
5507         * @hide
5508         */
5509        public static final String PREFERRED_CDMA_SUBSCRIPTION =
5510                "preferred_cdma_subscription";
5511
5512        /**
5513         * Name of an application package to be debugged.
5514         */
5515        public static final String DEBUG_APP = "debug_app";
5516
5517        /**
5518         * If 1, when launching DEBUG_APP it will wait for the debugger before
5519         * starting user code.  If 0, it will run normally.
5520         */
5521        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
5522
5523        /**
5524         * Control whether the process CPU usage meter should be shown.
5525         */
5526        public static final String SHOW_PROCESSES = "show_processes";
5527
5528        /**
5529         * If 1, the activity manager will aggressively finish activities and
5530         * processes as soon as they are no longer needed.  If 0, the normal
5531         * extended lifetime is used.
5532         */
5533        public static final String ALWAYS_FINISH_ACTIVITIES =
5534                "always_finish_activities";
5535
5536        /**
5537         * Use Dock audio output for media:
5538         *      0 = disabled
5539         *      1 = enabled
5540         * @hide
5541         */
5542        public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
5543
5544        /**
5545         * Persisted safe headphone volume management state by AudioService
5546         * @hide
5547         */
5548        public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
5549
5550        /**
5551         * URL for tzinfo (time zone) updates
5552         * @hide
5553         */
5554        public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
5555
5556        /**
5557         * URL for tzinfo (time zone) update metadata
5558         * @hide
5559         */
5560        public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
5561
5562        /**
5563         * URL for selinux (mandatory access control) updates
5564         * @hide
5565         */
5566        public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
5567
5568        /**
5569         * URL for selinux (mandatory access control) update metadata
5570         * @hide
5571         */
5572        public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
5573
5574        /**
5575         * URL for sms short code updates
5576         * @hide
5577         */
5578        public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
5579                "sms_short_codes_content_url";
5580
5581        /**
5582         * URL for sms short code update metadata
5583         * @hide
5584         */
5585        public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
5586                "sms_short_codes_metadata_url";
5587
5588        /**
5589         * URL for cert pinlist updates
5590         * @hide
5591         */
5592        public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
5593
5594        /**
5595         * URL for cert pinlist updates
5596         * @hide
5597         */
5598        public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
5599
5600        /**
5601         * URL for intent firewall updates
5602         * @hide
5603         */
5604        public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
5605                "intent_firewall_content_url";
5606
5607        /**
5608         * URL for intent firewall update metadata
5609         * @hide
5610         */
5611        public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
5612                "intent_firewall_metadata_url";
5613
5614        /**
5615         * SELinux enforcement status. If 0, permissive; if 1, enforcing.
5616         * @hide
5617         */
5618        public static final String SELINUX_STATUS = "selinux_status";
5619
5620        /**
5621         * Settings to backup. This is here so that it's in the same place as the settings
5622         * keys and easy to update.
5623         *
5624         * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
5625         * and Secure as well.  This is because those tables drive both backup and
5626         * restore, and restore needs to properly whitelist keys that used to live
5627         * in those namespaces.  The keys will only actually be backed up / restored
5628         * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
5629         *
5630         * NOTE: Settings are backed up and restored in the order they appear
5631         *       in this array. If you have one setting depending on another,
5632         *       make sure that they are ordered appropriately.
5633         *
5634         * @hide
5635         */
5636        public static final String[] SETTINGS_TO_BACKUP = {
5637            BUGREPORT_IN_POWER_MENU,
5638            STAY_ON_WHILE_PLUGGED_IN,
5639            MODE_RINGER,
5640            AUTO_TIME,
5641            AUTO_TIME_ZONE,
5642            POWER_SOUNDS_ENABLED,
5643            DOCK_SOUNDS_ENABLED,
5644            USB_MASS_STORAGE_ENABLED,
5645            ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
5646            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
5647            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
5648            WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
5649            WIFI_NUM_OPEN_NETWORKS_KEPT,
5650            EMERGENCY_TONE,
5651            CALL_AUTO_RETRY,
5652            DOCK_AUDIO_MEDIA_ENABLED
5653        };
5654
5655        // Populated lazily, guarded by class object:
5656        private static NameValueCache sNameValueCache = new NameValueCache(
5657                    SYS_PROP_SETTING_VERSION,
5658                    CONTENT_URI,
5659                    CALL_METHOD_GET_GLOBAL,
5660                    CALL_METHOD_PUT_GLOBAL);
5661
5662        /**
5663         * Look up a name in the database.
5664         * @param resolver to access the database with
5665         * @param name to look up in the table
5666         * @return the corresponding value, or null if not present
5667         */
5668        public static String getString(ContentResolver resolver, String name) {
5669            return getStringForUser(resolver, name, UserHandle.myUserId());
5670        }
5671
5672        /** @hide */
5673        public static String getStringForUser(ContentResolver resolver, String name,
5674                int userHandle) {
5675            return sNameValueCache.getStringForUser(resolver, name, userHandle);
5676        }
5677
5678        /**
5679         * Store a name/value pair into the database.
5680         * @param resolver to access the database with
5681         * @param name to store
5682         * @param value to associate with the name
5683         * @return true if the value was set, false on database errors
5684         */
5685        public static boolean putString(ContentResolver resolver,
5686                String name, String value) {
5687            return putStringForUser(resolver, name, value, UserHandle.myUserId());
5688        }
5689
5690        /** @hide */
5691        public static boolean putStringForUser(ContentResolver resolver,
5692                String name, String value, int userHandle) {
5693            if (LOCAL_LOGV) {
5694                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
5695                        + " for " + userHandle);
5696            }
5697            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
5698        }
5699
5700        /**
5701         * Construct the content URI for a particular name/value pair,
5702         * useful for monitoring changes with a ContentObserver.
5703         * @param name to look up in the table
5704         * @return the corresponding content URI, or null if not present
5705         */
5706        public static Uri getUriFor(String name) {
5707            return getUriFor(CONTENT_URI, name);
5708        }
5709
5710        /**
5711         * Convenience function for retrieving a single secure settings value
5712         * as an integer.  Note that internally setting values are always
5713         * stored as strings; this function converts the string to an integer
5714         * for you.  The default value will be returned if the setting is
5715         * not defined or not an integer.
5716         *
5717         * @param cr The ContentResolver to access.
5718         * @param name The name of the setting to retrieve.
5719         * @param def Value to return if the setting is not defined.
5720         *
5721         * @return The setting's current value, or 'def' if it is not defined
5722         * or not a valid integer.
5723         */
5724        public static int getInt(ContentResolver cr, String name, int def) {
5725            String v = getString(cr, name);
5726            try {
5727                return v != null ? Integer.parseInt(v) : def;
5728            } catch (NumberFormatException e) {
5729                return def;
5730            }
5731        }
5732
5733        /**
5734         * Convenience function for retrieving a single secure settings value
5735         * as an integer.  Note that internally setting values are always
5736         * stored as strings; this function converts the string to an integer
5737         * for you.
5738         * <p>
5739         * This version does not take a default value.  If the setting has not
5740         * been set, or the string value is not a number,
5741         * it throws {@link SettingNotFoundException}.
5742         *
5743         * @param cr The ContentResolver to access.
5744         * @param name The name of the setting to retrieve.
5745         *
5746         * @throws SettingNotFoundException Thrown if a setting by the given
5747         * name can't be found or the setting value is not an integer.
5748         *
5749         * @return The setting's current value.
5750         */
5751        public static int getInt(ContentResolver cr, String name)
5752                throws SettingNotFoundException {
5753            String v = getString(cr, name);
5754            try {
5755                return Integer.parseInt(v);
5756            } catch (NumberFormatException e) {
5757                throw new SettingNotFoundException(name);
5758            }
5759        }
5760
5761        /**
5762         * Convenience function for updating a single settings value as an
5763         * integer. This will either create a new entry in the table if the
5764         * given name does not exist, or modify the value of the existing row
5765         * with that name.  Note that internally setting values are always
5766         * stored as strings, so this function converts the given value to a
5767         * string before storing it.
5768         *
5769         * @param cr The ContentResolver to access.
5770         * @param name The name of the setting to modify.
5771         * @param value The new value for the setting.
5772         * @return true if the value was set, false on database errors
5773         */
5774        public static boolean putInt(ContentResolver cr, String name, int value) {
5775            return putString(cr, name, Integer.toString(value));
5776        }
5777
5778        /**
5779         * Convenience function for retrieving a single secure settings value
5780         * as a {@code long}.  Note that internally setting values are always
5781         * stored as strings; this function converts the string to a {@code long}
5782         * for you.  The default value will be returned if the setting is
5783         * not defined or not a {@code long}.
5784         *
5785         * @param cr The ContentResolver to access.
5786         * @param name The name of the setting to retrieve.
5787         * @param def Value to return if the setting is not defined.
5788         *
5789         * @return The setting's current value, or 'def' if it is not defined
5790         * or not a valid {@code long}.
5791         */
5792        public static long getLong(ContentResolver cr, String name, long def) {
5793            String valString = getString(cr, name);
5794            long value;
5795            try {
5796                value = valString != null ? Long.parseLong(valString) : def;
5797            } catch (NumberFormatException e) {
5798                value = def;
5799            }
5800            return value;
5801        }
5802
5803        /**
5804         * Convenience function for retrieving a single secure settings value
5805         * as a {@code long}.  Note that internally setting values are always
5806         * stored as strings; this function converts the string to a {@code long}
5807         * for you.
5808         * <p>
5809         * This version does not take a default value.  If the setting has not
5810         * been set, or the string value is not a number,
5811         * it throws {@link SettingNotFoundException}.
5812         *
5813         * @param cr The ContentResolver to access.
5814         * @param name The name of the setting to retrieve.
5815         *
5816         * @return The setting's current value.
5817         * @throws SettingNotFoundException Thrown if a setting by the given
5818         * name can't be found or the setting value is not an integer.
5819         */
5820        public static long getLong(ContentResolver cr, String name)
5821                throws SettingNotFoundException {
5822            String valString = getString(cr, name);
5823            try {
5824                return Long.parseLong(valString);
5825            } catch (NumberFormatException e) {
5826                throw new SettingNotFoundException(name);
5827            }
5828        }
5829
5830        /**
5831         * Convenience function for updating a secure settings value as a long
5832         * integer. This will either create a new entry in the table if the
5833         * given name does not exist, or modify the value of the existing row
5834         * with that name.  Note that internally setting values are always
5835         * stored as strings, so this function converts the given value to a
5836         * string before storing it.
5837         *
5838         * @param cr The ContentResolver to access.
5839         * @param name The name of the setting to modify.
5840         * @param value The new value for the setting.
5841         * @return true if the value was set, false on database errors
5842         */
5843        public static boolean putLong(ContentResolver cr, String name, long value) {
5844            return putString(cr, name, Long.toString(value));
5845        }
5846
5847        /**
5848         * Convenience function for retrieving a single secure settings value
5849         * as a floating point number.  Note that internally setting values are
5850         * always stored as strings; this function converts the string to an
5851         * float for you. The default value will be returned if the setting
5852         * is not defined or not a valid float.
5853         *
5854         * @param cr The ContentResolver to access.
5855         * @param name The name of the setting to retrieve.
5856         * @param def Value to return if the setting is not defined.
5857         *
5858         * @return The setting's current value, or 'def' if it is not defined
5859         * or not a valid float.
5860         */
5861        public static float getFloat(ContentResolver cr, String name, float def) {
5862            String v = getString(cr, name);
5863            try {
5864                return v != null ? Float.parseFloat(v) : def;
5865            } catch (NumberFormatException e) {
5866                return def;
5867            }
5868        }
5869
5870        /**
5871         * Convenience function for retrieving a single secure settings value
5872         * as a float.  Note that internally setting values are always
5873         * stored as strings; this function converts the string to a float
5874         * for you.
5875         * <p>
5876         * This version does not take a default value.  If the setting has not
5877         * been set, or the string value is not a number,
5878         * it throws {@link SettingNotFoundException}.
5879         *
5880         * @param cr The ContentResolver to access.
5881         * @param name The name of the setting to retrieve.
5882         *
5883         * @throws SettingNotFoundException Thrown if a setting by the given
5884         * name can't be found or the setting value is not a float.
5885         *
5886         * @return The setting's current value.
5887         */
5888        public static float getFloat(ContentResolver cr, String name)
5889                throws SettingNotFoundException {
5890            String v = getString(cr, name);
5891            if (v == null) {
5892                throw new SettingNotFoundException(name);
5893            }
5894            try {
5895                return Float.parseFloat(v);
5896            } catch (NumberFormatException e) {
5897                throw new SettingNotFoundException(name);
5898            }
5899        }
5900
5901        /**
5902         * Convenience function for updating a single settings value as a
5903         * floating point number. This will either create a new entry in the
5904         * table if the given name does not exist, or modify the value of the
5905         * existing row with that name.  Note that internally setting values
5906         * are always stored as strings, so this function converts the given
5907         * value to a string before storing it.
5908         *
5909         * @param cr The ContentResolver to access.
5910         * @param name The name of the setting to modify.
5911         * @param value The new value for the setting.
5912         * @return true if the value was set, false on database errors
5913         */
5914        public static boolean putFloat(ContentResolver cr, String name, float value) {
5915            return putString(cr, name, Float.toString(value));
5916        }
5917    }
5918
5919    /**
5920     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
5921     * Intent URL, allowing it to be either a web page or a particular
5922     * application activity.
5923     *
5924     * @hide
5925     */
5926    public static final class Bookmarks implements BaseColumns
5927    {
5928        private static final String TAG = "Bookmarks";
5929
5930        /**
5931         * The content:// style URL for this table
5932         */
5933        public static final Uri CONTENT_URI =
5934            Uri.parse("content://" + AUTHORITY + "/bookmarks");
5935
5936        /**
5937         * The row ID.
5938         * <p>Type: INTEGER</p>
5939         */
5940        public static final String ID = "_id";
5941
5942        /**
5943         * Descriptive name of the bookmark that can be displayed to the user.
5944         * If this is empty, the title should be resolved at display time (use
5945         * {@link #getTitle(Context, Cursor)} any time you want to display the
5946         * title of a bookmark.)
5947         * <P>
5948         * Type: TEXT
5949         * </P>
5950         */
5951        public static final String TITLE = "title";
5952
5953        /**
5954         * Arbitrary string (displayed to the user) that allows bookmarks to be
5955         * organized into categories.  There are some special names for
5956         * standard folders, which all start with '@'.  The label displayed for
5957         * the folder changes with the locale (via {@link #getLabelForFolder}) but
5958         * the folder name does not change so you can consistently query for
5959         * the folder regardless of the current locale.
5960         *
5961         * <P>Type: TEXT</P>
5962         *
5963         */
5964        public static final String FOLDER = "folder";
5965
5966        /**
5967         * The Intent URL of the bookmark, describing what it points to.  This
5968         * value is given to {@link android.content.Intent#getIntent} to create
5969         * an Intent that can be launched.
5970         * <P>Type: TEXT</P>
5971         */
5972        public static final String INTENT = "intent";
5973
5974        /**
5975         * Optional shortcut character associated with this bookmark.
5976         * <P>Type: INTEGER</P>
5977         */
5978        public static final String SHORTCUT = "shortcut";
5979
5980        /**
5981         * The order in which the bookmark should be displayed
5982         * <P>Type: INTEGER</P>
5983         */
5984        public static final String ORDERING = "ordering";
5985
5986        private static final String[] sIntentProjection = { INTENT };
5987        private static final String[] sShortcutProjection = { ID, SHORTCUT };
5988        private static final String sShortcutSelection = SHORTCUT + "=?";
5989
5990        /**
5991         * Convenience function to retrieve the bookmarked Intent for a
5992         * particular shortcut key.
5993         *
5994         * @param cr The ContentResolver to query.
5995         * @param shortcut The shortcut key.
5996         *
5997         * @return Intent The bookmarked URL, or null if there is no bookmark
5998         *         matching the given shortcut.
5999         */
6000        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
6001        {
6002            Intent intent = null;
6003
6004            Cursor c = cr.query(CONTENT_URI,
6005                    sIntentProjection, sShortcutSelection,
6006                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
6007            // Keep trying until we find a valid shortcut
6008            try {
6009                while (intent == null && c.moveToNext()) {
6010                    try {
6011                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
6012                        intent = Intent.parseUri(intentURI, 0);
6013                    } catch (java.net.URISyntaxException e) {
6014                        // The stored URL is bad...  ignore it.
6015                    } catch (IllegalArgumentException e) {
6016                        // Column not found
6017                        Log.w(TAG, "Intent column not found", e);
6018                    }
6019                }
6020            } finally {
6021                if (c != null) c.close();
6022            }
6023
6024            return intent;
6025        }
6026
6027        /**
6028         * Add a new bookmark to the system.
6029         *
6030         * @param cr The ContentResolver to query.
6031         * @param intent The desired target of the bookmark.
6032         * @param title Bookmark title that is shown to the user; null if none
6033         *            or it should be resolved to the intent's title.
6034         * @param folder Folder in which to place the bookmark; null if none.
6035         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
6036         *            this is non-zero and there is an existing bookmark entry
6037         *            with this same shortcut, then that existing shortcut is
6038         *            cleared (the bookmark is not removed).
6039         * @return The unique content URL for the new bookmark entry.
6040         */
6041        public static Uri add(ContentResolver cr,
6042                                           Intent intent,
6043                                           String title,
6044                                           String folder,
6045                                           char shortcut,
6046                                           int ordering)
6047        {
6048            // If a shortcut is supplied, and it is already defined for
6049            // another bookmark, then remove the old definition.
6050            if (shortcut != 0) {
6051                cr.delete(CONTENT_URI, sShortcutSelection,
6052                        new String[] { String.valueOf((int) shortcut) });
6053            }
6054
6055            ContentValues values = new ContentValues();
6056            if (title != null) values.put(TITLE, title);
6057            if (folder != null) values.put(FOLDER, folder);
6058            values.put(INTENT, intent.toUri(0));
6059            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
6060            values.put(ORDERING, ordering);
6061            return cr.insert(CONTENT_URI, values);
6062        }
6063
6064        /**
6065         * Return the folder name as it should be displayed to the user.  This
6066         * takes care of localizing special folders.
6067         *
6068         * @param r Resources object for current locale; only need access to
6069         *          system resources.
6070         * @param folder The value found in the {@link #FOLDER} column.
6071         *
6072         * @return CharSequence The label for this folder that should be shown
6073         *         to the user.
6074         */
6075        public static CharSequence getLabelForFolder(Resources r, String folder) {
6076            return folder;
6077        }
6078
6079        /**
6080         * Return the title as it should be displayed to the user. This takes
6081         * care of localizing bookmarks that point to activities.
6082         *
6083         * @param context A context.
6084         * @param cursor A cursor pointing to the row whose title should be
6085         *        returned. The cursor must contain at least the {@link #TITLE}
6086         *        and {@link #INTENT} columns.
6087         * @return A title that is localized and can be displayed to the user,
6088         *         or the empty string if one could not be found.
6089         */
6090        public static CharSequence getTitle(Context context, Cursor cursor) {
6091            int titleColumn = cursor.getColumnIndex(TITLE);
6092            int intentColumn = cursor.getColumnIndex(INTENT);
6093            if (titleColumn == -1 || intentColumn == -1) {
6094                throw new IllegalArgumentException(
6095                        "The cursor must contain the TITLE and INTENT columns.");
6096            }
6097
6098            String title = cursor.getString(titleColumn);
6099            if (!TextUtils.isEmpty(title)) {
6100                return title;
6101            }
6102
6103            String intentUri = cursor.getString(intentColumn);
6104            if (TextUtils.isEmpty(intentUri)) {
6105                return "";
6106            }
6107
6108            Intent intent;
6109            try {
6110                intent = Intent.parseUri(intentUri, 0);
6111            } catch (URISyntaxException e) {
6112                return "";
6113            }
6114
6115            PackageManager packageManager = context.getPackageManager();
6116            ResolveInfo info = packageManager.resolveActivity(intent, 0);
6117            return info != null ? info.loadLabel(packageManager) : "";
6118        }
6119    }
6120
6121    /**
6122     * Returns the device ID that we should use when connecting to the mobile gtalk server.
6123     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
6124     * from the GoogleLoginService.
6125     *
6126     * @param androidId The Android ID for this device.
6127     * @return The device ID that should be used when connecting to the mobile gtalk server.
6128     * @hide
6129     */
6130    public static String getGTalkDeviceId(long androidId) {
6131        return "android-" + Long.toHexString(androidId);
6132    }
6133}
6134