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