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