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