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