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