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