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