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