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