Settings.java revision c868b645b46685574955eaff9f8d46d9262a3357
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.PACKAGE_VERIFIER_ENABLE);
2620            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
2621            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
2622            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
2623            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
2624            MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
2625            MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
2626        }
2627
2628        private static void lazyInitCache() {
2629            if (sNameValueCache == null) {
2630                sNameValueCache = new NameValueCache(
2631                        SYS_PROP_SETTING_VERSION + '_' + UserHandle.myUserId(),
2632                        CONTENT_URI,
2633                        CALL_METHOD_GET_SECURE,
2634                        CALL_METHOD_PUT_SECURE);
2635            }
2636        }
2637
2638        /**
2639         * Look up a name in the database.
2640         * @param resolver to access the database with
2641         * @param name to look up in the table
2642         * @return the corresponding value, or null if not present
2643         */
2644        public synchronized static String getString(ContentResolver resolver, String name) {
2645            return getStringForUser(resolver, name, UserHandle.myUserId());
2646        }
2647
2648        /** @hide */
2649        public synchronized static String getStringForUser(ContentResolver resolver, String name,
2650                int userHandle) {
2651            if (MOVED_TO_GLOBAL.contains(name)) {
2652                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
2653                        + " to android.provider.Settings.Global.");
2654                return Global.getStringForUser(resolver, name, userHandle);
2655            }
2656
2657            if (sLockSettings == null) {
2658                sLockSettings = ILockSettings.Stub.asInterface(
2659                        (IBinder) ServiceManager.getService("lock_settings"));
2660                sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
2661            }
2662            if (sLockSettings != null && !sIsSystemProcess
2663                    && MOVED_TO_LOCK_SETTINGS.contains(name)) {
2664                try {
2665                    return sLockSettings.getString(name, "0", userHandle);
2666                } catch (RemoteException re) {
2667                    // Fall through
2668                }
2669            }
2670
2671            lazyInitCache();
2672            return sNameValueCache.getStringForUser(resolver, name, userHandle);
2673        }
2674
2675        /**
2676         * Store a name/value pair into the database.
2677         * @param resolver to access the database with
2678         * @param name to store
2679         * @param value to associate with the name
2680         * @return true if the value was set, false on database errors
2681         */
2682        public static boolean putString(ContentResolver resolver, String name, String value) {
2683            return putStringForUser(resolver, name, value, UserHandle.myUserId());
2684        }
2685
2686        /** @hide */
2687        public static boolean putStringForUser(ContentResolver resolver, String name, String value,
2688                int userHandle) {
2689            if (MOVED_TO_GLOBAL.contains(name)) {
2690                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
2691                        + " to android.provider.Settings.Global");
2692                return Global.putStringForUser(resolver, name, value, userHandle);
2693            }
2694            lazyInitCache();
2695            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
2696        }
2697
2698        /**
2699         * Construct the content URI for a particular name/value pair,
2700         * useful for monitoring changes with a ContentObserver.
2701         * @param name to look up in the table
2702         * @return the corresponding content URI, or null if not present
2703         */
2704        public static Uri getUriFor(String name) {
2705            if (MOVED_TO_GLOBAL.contains(name)) {
2706                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
2707                        + " to android.provider.Settings.Global, returning global URI.");
2708                return Global.getUriFor(Global.CONTENT_URI, name);
2709            }
2710            return getUriFor(CONTENT_URI, name);
2711        }
2712
2713        /**
2714         * Convenience function for retrieving a single secure settings value
2715         * as an integer.  Note that internally setting values are always
2716         * stored as strings; this function converts the string to an integer
2717         * for you.  The default value will be returned if the setting is
2718         * not defined or not an integer.
2719         *
2720         * @param cr The ContentResolver to access.
2721         * @param name The name of the setting to retrieve.
2722         * @param def Value to return if the setting is not defined.
2723         *
2724         * @return The setting's current value, or 'def' if it is not defined
2725         * or not a valid integer.
2726         */
2727        public static int getInt(ContentResolver cr, String name, int def) {
2728            return getIntForUser(cr, name, def, UserHandle.myUserId());
2729        }
2730
2731        /** @hide */
2732        public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
2733            String v = getStringForUser(cr, name, userHandle);
2734            try {
2735                return v != null ? Integer.parseInt(v) : def;
2736            } catch (NumberFormatException e) {
2737                return def;
2738            }
2739        }
2740
2741        /**
2742         * Convenience function for retrieving a single secure settings value
2743         * as an integer.  Note that internally setting values are always
2744         * stored as strings; this function converts the string to an integer
2745         * for you.
2746         * <p>
2747         * This version does not take a default value.  If the setting has not
2748         * been set, or the string value is not a number,
2749         * it throws {@link SettingNotFoundException}.
2750         *
2751         * @param cr The ContentResolver to access.
2752         * @param name The name of the setting to retrieve.
2753         *
2754         * @throws SettingNotFoundException Thrown if a setting by the given
2755         * name can't be found or the setting value is not an integer.
2756         *
2757         * @return The setting's current value.
2758         */
2759        public static int getInt(ContentResolver cr, String name)
2760                throws SettingNotFoundException {
2761            return getIntForUser(cr, name, UserHandle.myUserId());
2762        }
2763
2764        /** @hide */
2765        public static int getIntForUser(ContentResolver cr, String name, int userHandle)
2766                throws SettingNotFoundException {
2767            String v = getStringForUser(cr, name, userHandle);
2768            try {
2769                return Integer.parseInt(v);
2770            } catch (NumberFormatException e) {
2771                throw new SettingNotFoundException(name);
2772            }
2773        }
2774
2775        /**
2776         * Convenience function for updating a single settings value as an
2777         * integer. This will either create a new entry in the table if the
2778         * given name does not exist, or modify the value of the existing row
2779         * with that name.  Note that internally setting values are always
2780         * stored as strings, so this function converts the given value to a
2781         * string before storing it.
2782         *
2783         * @param cr The ContentResolver to access.
2784         * @param name The name of the setting to modify.
2785         * @param value The new value for the setting.
2786         * @return true if the value was set, false on database errors
2787         */
2788        public static boolean putInt(ContentResolver cr, String name, int value) {
2789            return putIntForUser(cr, name, value, UserHandle.myUserId());
2790        }
2791
2792        /** @hide */
2793        public static boolean putIntForUser(ContentResolver cr, String name, int value,
2794                int userHandle) {
2795            return putStringForUser(cr, name, Integer.toString(value), userHandle);
2796        }
2797
2798        /**
2799         * Convenience function for retrieving a single secure settings value
2800         * as a {@code long}.  Note that internally setting values are always
2801         * stored as strings; this function converts the string to a {@code long}
2802         * for you.  The default value will be returned if the setting is
2803         * not defined or not a {@code long}.
2804         *
2805         * @param cr The ContentResolver to access.
2806         * @param name The name of the setting to retrieve.
2807         * @param def Value to return if the setting is not defined.
2808         *
2809         * @return The setting's current value, or 'def' if it is not defined
2810         * or not a valid {@code long}.
2811         */
2812        public static long getLong(ContentResolver cr, String name, long def) {
2813            return getLongForUser(cr, name, def, UserHandle.myUserId());
2814        }
2815
2816        /** @hide */
2817        public static long getLongForUser(ContentResolver cr, String name, long def,
2818                int userHandle) {
2819            String valString = getStringForUser(cr, name, userHandle);
2820            long value;
2821            try {
2822                value = valString != null ? Long.parseLong(valString) : def;
2823            } catch (NumberFormatException e) {
2824                value = def;
2825            }
2826            return value;
2827        }
2828
2829        /**
2830         * Convenience function for retrieving a single secure settings value
2831         * as a {@code long}.  Note that internally setting values are always
2832         * stored as strings; this function converts the string to a {@code long}
2833         * for you.
2834         * <p>
2835         * This version does not take a default value.  If the setting has not
2836         * been set, or the string value is not a number,
2837         * it throws {@link SettingNotFoundException}.
2838         *
2839         * @param cr The ContentResolver to access.
2840         * @param name The name of the setting to retrieve.
2841         *
2842         * @return The setting's current value.
2843         * @throws SettingNotFoundException Thrown if a setting by the given
2844         * name can't be found or the setting value is not an integer.
2845         */
2846        public static long getLong(ContentResolver cr, String name)
2847                throws SettingNotFoundException {
2848            return getLongForUser(cr, name, UserHandle.myUserId());
2849        }
2850
2851        /** @hide */
2852        public static long getLongForUser(ContentResolver cr, String name, int userHandle)
2853                throws SettingNotFoundException {
2854            String valString = getStringForUser(cr, name, userHandle);
2855            try {
2856                return Long.parseLong(valString);
2857            } catch (NumberFormatException e) {
2858                throw new SettingNotFoundException(name);
2859            }
2860        }
2861
2862        /**
2863         * Convenience function for updating a secure settings value as a long
2864         * integer. This will either create a new entry in the table if the
2865         * given name does not exist, or modify the value of the existing row
2866         * with that name.  Note that internally setting values are always
2867         * stored as strings, so this function converts the given value to a
2868         * string before storing it.
2869         *
2870         * @param cr The ContentResolver to access.
2871         * @param name The name of the setting to modify.
2872         * @param value The new value for the setting.
2873         * @return true if the value was set, false on database errors
2874         */
2875        public static boolean putLong(ContentResolver cr, String name, long value) {
2876            return putLongForUser(cr, name, value, UserHandle.myUserId());
2877        }
2878
2879        /** @hide */
2880        public static boolean putLongForUser(ContentResolver cr, String name, long value,
2881                int userHandle) {
2882            return putStringForUser(cr, name, Long.toString(value), userHandle);
2883        }
2884
2885        /**
2886         * Convenience function for retrieving a single secure settings value
2887         * as a floating point number.  Note that internally setting values are
2888         * always stored as strings; this function converts the string to an
2889         * float for you. The default value will be returned if the setting
2890         * is not defined or not a valid float.
2891         *
2892         * @param cr The ContentResolver to access.
2893         * @param name The name of the setting to retrieve.
2894         * @param def Value to return if the setting is not defined.
2895         *
2896         * @return The setting's current value, or 'def' if it is not defined
2897         * or not a valid float.
2898         */
2899        public static float getFloat(ContentResolver cr, String name, float def) {
2900            return getFloatForUser(cr, name, def, UserHandle.myUserId());
2901        }
2902
2903        /** @hide */
2904        public static float getFloatForUser(ContentResolver cr, String name, float def,
2905                int userHandle) {
2906            String v = getStringForUser(cr, name, userHandle);
2907            try {
2908                return v != null ? Float.parseFloat(v) : def;
2909            } catch (NumberFormatException e) {
2910                return def;
2911            }
2912        }
2913
2914        /**
2915         * Convenience function for retrieving a single secure settings value
2916         * as a float.  Note that internally setting values are always
2917         * stored as strings; this function converts the string to a float
2918         * for you.
2919         * <p>
2920         * This version does not take a default value.  If the setting has not
2921         * been set, or the string value is not a number,
2922         * it throws {@link SettingNotFoundException}.
2923         *
2924         * @param cr The ContentResolver to access.
2925         * @param name The name of the setting to retrieve.
2926         *
2927         * @throws SettingNotFoundException Thrown if a setting by the given
2928         * name can't be found or the setting value is not a float.
2929         *
2930         * @return The setting's current value.
2931         */
2932        public static float getFloat(ContentResolver cr, String name)
2933                throws SettingNotFoundException {
2934            return getFloatForUser(cr, name, UserHandle.myUserId());
2935        }
2936
2937        /** @hide */
2938        public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
2939                throws SettingNotFoundException {
2940            String v = getStringForUser(cr, name, userHandle);
2941            if (v == null) {
2942                throw new SettingNotFoundException(name);
2943            }
2944            try {
2945                return Float.parseFloat(v);
2946            } catch (NumberFormatException e) {
2947                throw new SettingNotFoundException(name);
2948            }
2949        }
2950
2951        /**
2952         * Convenience function for updating a single settings value as a
2953         * floating point number. This will either create a new entry in the
2954         * table if the given name does not exist, or modify the value of the
2955         * existing row with that name.  Note that internally setting values
2956         * are always stored as strings, so this function converts the given
2957         * value to a string before storing it.
2958         *
2959         * @param cr The ContentResolver to access.
2960         * @param name The name of the setting to modify.
2961         * @param value The new value for the setting.
2962         * @return true if the value was set, false on database errors
2963         */
2964        public static boolean putFloat(ContentResolver cr, String name, float value) {
2965            return putFloatForUser(cr, name, value, UserHandle.myUserId());
2966        }
2967
2968        /** @hide */
2969        public static boolean putFloatForUser(ContentResolver cr, String name, float value,
2970                int userHandle) {
2971            return putStringForUser(cr, name, Float.toString(value), userHandle);
2972        }
2973
2974        /**
2975         * The content:// style URL for this table
2976         */
2977        public static final Uri CONTENT_URI =
2978            Uri.parse("content://" + AUTHORITY + "/secure");
2979
2980        /**
2981         * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
2982         * instead
2983         */
2984        @Deprecated
2985        public static final String DEVELOPMENT_SETTINGS_ENABLED =
2986                Global.DEVELOPMENT_SETTINGS_ENABLED;
2987
2988        /**
2989         * When the user has enable the option to have a "bug report" command
2990         * in the power menu.
2991         * @hide
2992         */
2993        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
2994
2995        /**
2996         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
2997         */
2998        @Deprecated
2999        public static final String ADB_ENABLED = Global.ADB_ENABLED;
3000
3001        /**
3002         * Setting to allow mock locations and location provider status to be injected into the
3003         * LocationManager service for testing purposes during application development.  These
3004         * locations and status values  override actual location and status information generated
3005         * by network, gps, or other location providers.
3006         */
3007        public static final String ALLOW_MOCK_LOCATION = "mock_location";
3008
3009        /**
3010         * A 64-bit number (as a hex string) that is randomly
3011         * generated on the device's first boot and should remain
3012         * constant for the lifetime of the device.  (The value may
3013         * change if a factory reset is performed on the device.)
3014         */
3015        public static final String ANDROID_ID = "android_id";
3016
3017        /**
3018         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
3019         */
3020        @Deprecated
3021        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
3022
3023        /**
3024         * Get the key that retrieves a bluetooth headset's priority.
3025         * @hide
3026         */
3027        public static final String getBluetoothHeadsetPriorityKey(String address) {
3028            return ("bluetooth_headset_priority_" + address.toUpperCase());
3029        }
3030
3031        /**
3032         * Get the key that retrieves a bluetooth a2dp sink's priority.
3033         * @hide
3034         */
3035        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
3036            return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
3037        }
3038
3039        /**
3040         * Get the key that retrieves a bluetooth Input Device's priority.
3041         * @hide
3042         */
3043        public static final String getBluetoothInputDevicePriorityKey(String address) {
3044            return ("bluetooth_input_device_priority_" + address.toUpperCase());
3045        }
3046
3047        /**
3048         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
3049         */
3050        public static final String DATA_ROAMING = Global.DATA_ROAMING;
3051
3052        /**
3053         * Setting to record the input method used by default, holding the ID
3054         * of the desired method.
3055         */
3056        public static final String DEFAULT_INPUT_METHOD = "default_input_method";
3057
3058        /**
3059         * Setting to record the input method subtype used by default, holding the ID
3060         * of the desired method.
3061         */
3062        public static final String SELECTED_INPUT_METHOD_SUBTYPE =
3063                "selected_input_method_subtype";
3064
3065        /**
3066         * Setting to record the history of input method subtype, holding the pair of ID of IME
3067         * and its last used subtype.
3068         * @hide
3069         */
3070        public static final String INPUT_METHODS_SUBTYPE_HISTORY =
3071                "input_methods_subtype_history";
3072
3073        /**
3074         * Setting to record the visibility of input method selector
3075         */
3076        public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
3077                "input_method_selector_visibility";
3078
3079        /**
3080         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
3081         */
3082        @Deprecated
3083        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
3084
3085        /**
3086         * List of input methods that are currently enabled.  This is a string
3087         * containing the IDs of all enabled input methods, each ID separated
3088         * by ':'.
3089         */
3090        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
3091
3092        /**
3093         * List of system input methods that are currently disabled.  This is a string
3094         * containing the IDs of all disabled input methods, each ID separated
3095         * by ':'.
3096         * @hide
3097         */
3098        public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
3099
3100        /**
3101         * Host name and port for global http proxy.  Uses ':' seperator for between host and port
3102         * TODO - deprecate in favor of global_http_proxy_host, etc
3103         */
3104        public static final String HTTP_PROXY = "http_proxy";
3105
3106        /**
3107         * Host name for global http proxy.  Set via ConnectivityManager.
3108         * @hide
3109         */
3110        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
3111
3112        /**
3113         * Integer host port for global http proxy.  Set via ConnectivityManager.
3114         * @hide
3115         */
3116        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
3117
3118        /**
3119         * Exclusion list for global proxy. This string contains a list of comma-separated
3120         * domains where the global proxy does not apply. Domains should be listed in a comma-
3121         * separated list. Example of acceptable formats: ".domain1.com,my.domain2.com"
3122         * Use ConnectivityManager to set/get.
3123         * @hide
3124         */
3125        public static final String GLOBAL_HTTP_PROXY_EXCLUSION_LIST =
3126                "global_http_proxy_exclusion_list";
3127
3128        /**
3129         * Enables the UI setting to allow the user to specify the global HTTP proxy
3130         * and associated exclusion list.
3131         * @hide
3132         */
3133        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
3134
3135        /**
3136         * Setting for default DNS in case nobody suggests one
3137         * @hide
3138         */
3139        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
3140
3141        /**
3142         * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead
3143         */
3144        @Deprecated
3145        public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS;
3146
3147        /**
3148         * Comma-separated list of location providers that activities may access.
3149         */
3150        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
3151
3152        /**
3153         * A flag containing settings used for biometric weak
3154         * @hide
3155         */
3156        public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
3157                "lock_biometric_weak_flags";
3158
3159        /**
3160         * Whether autolock is enabled (0 = false, 1 = true)
3161         */
3162        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
3163
3164        /**
3165         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
3166         */
3167        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
3168
3169        /**
3170         * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
3171         */
3172        public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
3173            "lock_pattern_tactile_feedback_enabled";
3174
3175        /**
3176         * This preference allows the device to be locked given time after screen goes off,
3177         * subject to current DeviceAdmin policy limits.
3178         * @hide
3179         */
3180        public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
3181
3182
3183        /**
3184         * This preference contains the string that shows for owner info on LockScren.
3185         * @hide
3186         */
3187        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
3188
3189        /**
3190         * This preference enables showing the owner info on LockScren.
3191         * @hide
3192         */
3193        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
3194            "lock_screen_owner_info_enabled";
3195
3196        /**
3197         * @deprecated Use {@link android.provider.Settings.Global#DISPLAY_SIZE_FORCED} instead
3198         * @hide
3199         */
3200        @Deprecated
3201        public static final String DISPLAY_SIZE_FORCED = Global.DISPLAY_SIZE_FORCED;
3202
3203        /**
3204         * @deprecated Use {@link android.provider.Settings.Global#DISPLAY_DENSITY_FORCED} instead
3205         * @hide
3206         */
3207        @Deprecated
3208        public static final String DISPLAY_DENSITY_FORCED = Global.DISPLAY_DENSITY_FORCED;
3209
3210        /**
3211         * @deprecated Use {@link android.provider.Settings.Global#ASSISTED_GPS_ENABLE} instead
3212         * @hide
3213         */
3214        @Deprecated
3215        public static final String ASSISTED_GPS_ENABLED = Global.ASSISTED_GPS_ENABLED;
3216
3217        /**
3218         * The Logging ID (a unique 64-bit value) as a hex string.
3219         * Used as a pseudonymous identifier for logging.
3220         * @deprecated This identifier is poorly initialized and has
3221         * many collisions.  It should not be used.
3222         */
3223        @Deprecated
3224        public static final String LOGGING_ID = "logging_id";
3225
3226        /**
3227         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
3228         */
3229        @Deprecated
3230        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
3231
3232        /**
3233         * @deprecated Use {@link android.provider.Settings.Global#TETHER_SUPPORTED} instead
3234         * @hide
3235         */
3236        @Deprecated
3237        public static final String TETHER_SUPPORTED = Global.TETHER_SUPPORTED;
3238
3239        /**
3240         * @deprecated Use {@link android.provider.Settings.Global#TETHER_DUN_REQUIRED} instead
3241         * @hide
3242         */
3243        @Deprecated
3244        public static final String TETHER_DUN_REQUIRED = Global.TETHER_DUN_REQUIRED;
3245
3246        /**
3247         * @deprecated Use {@link android.provider.Settings.Global#TETHER_DUN_REQUIRED} instead
3248         * @hide
3249         */
3250        @Deprecated
3251        public static final String TETHER_DUN_APN = Global.TETHER_DUN_APN;
3252
3253        /**
3254         * @deprecated Use {@link android.provider.Settings.Global#DATA_ACTIVITY_TIMEOUT_MOBILE}
3255         * instead
3256         * @hide
3257         */
3258        @Deprecated
3259        public static final String DATA_ACTIVITY_TIMEOUT_MOBILE =
3260            Global.DATA_ACTIVITY_TIMEOUT_MOBILE;
3261
3262        /**
3263         * @deprecated Use {@link android.provider.Settings.Global#DATA_ACTIVITY_TIMEOUT_MOBILE}
3264         * instead
3265         * @hide
3266         */
3267        @Deprecated
3268        public static final String DATA_ACTIVITY_TIMEOUT_WIFI = Global.DATA_ACTIVITY_TIMEOUT_WIFI;
3269
3270        /**
3271         * No longer supported.
3272         */
3273        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
3274
3275        /**
3276         * No longer supported.
3277         */
3278        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
3279
3280        /**
3281         * No longer supported.
3282         */
3283        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
3284
3285        /**
3286         * @deprecated Use {@link android.provider.Settings.Global#SAMPLING_PROFILER_MS} instead
3287         * @hide
3288         */
3289        @Deprecated
3290        public static final String SAMPLING_PROFILER_MS = Global.SAMPLING_PROFILER_MS;
3291
3292        /**
3293         * Settings classname to launch when Settings is clicked from All
3294         * Applications.  Needed because of user testing between the old
3295         * and new Settings apps.
3296         */
3297        // TODO: 881807
3298        public static final String SETTINGS_CLASSNAME = "settings_classname";
3299
3300        /**
3301         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
3302         */
3303        @Deprecated
3304        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
3305
3306        /**
3307         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
3308         */
3309        @Deprecated
3310        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
3311
3312        /**
3313         * If accessibility is enabled.
3314         */
3315        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
3316
3317        /**
3318         * If touch exploration is enabled.
3319         */
3320        public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
3321
3322        /**
3323         * List of the enabled accessibility providers.
3324         */
3325        public static final String ENABLED_ACCESSIBILITY_SERVICES =
3326            "enabled_accessibility_services";
3327
3328        /**
3329         * List of the accessibility services to which the user has graned
3330         * permission to put the device into touch exploration mode.
3331         *
3332         * @hide
3333         */
3334        public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
3335            "touch_exploration_granted_accessibility_services";
3336
3337        /**
3338         * Whether to speak passwords while in accessibility mode.
3339         */
3340        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
3341
3342        /**
3343         * If injection of accessibility enhancing JavaScript screen-reader
3344         * is enabled.
3345         * <p>
3346         *   Note: The JavaScript based screen-reader is served by the
3347         *   Google infrastructure and enable users with disabilities to
3348         *   efficiantly navigate in and explore web content.
3349         * </p>
3350         * <p>
3351         *   This property represents a boolean value.
3352         * </p>
3353         * @hide
3354         */
3355        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
3356            "accessibility_script_injection";
3357
3358        /**
3359         * The URL for the injected JavaScript based screen-reader used
3360         * for providing accessiblity of content in WebView.
3361         * <p>
3362         *   Note: The JavaScript based screen-reader is served by the
3363         *   Google infrastructure and enable users with disabilities to
3364         *   efficiently navigate in and explore web content.
3365         * </p>
3366         * <p>
3367         *   This property represents a string value.
3368         * </p>
3369         * @hide
3370         */
3371        public static final String ACCESSIBILITY_SCREEN_READER_URL =
3372            "accessibility_script_injection_url";
3373
3374        /**
3375         * Key bindings for navigation in built-in accessibility support for web content.
3376         * <p>
3377         *   Note: These key bindings are for the built-in accessibility navigation for
3378         *   web content which is used as a fall back solution if JavaScript in a WebView
3379         *   is not enabled or the user has not opted-in script injection from Google.
3380         * </p>
3381         * <p>
3382         *   The bindings are separated by semi-colon. A binding is a mapping from
3383         *   a key to a sequence of actions (for more details look at
3384         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
3385         *   string representation of an integer obtained from a meta state (optional) shifted
3386         *   sixteen times left and bitwise ored with a key code. An action is represented
3387         *   as a hexademical string representation of an integer where the first two digits
3388         *   are navigation action index, the second, the third, and the fourth digit pairs
3389         *   represent the action arguments. The separate actions in a binding are colon
3390         *   separated. The key and the action sequence it maps to are separated by equals.
3391         * </p>
3392         * <p>
3393         *   For example, the binding below maps the DPAD right button to traverse the
3394         *   current navigation axis once without firing an accessibility event and to
3395         *   perform the same traversal again but to fire an event:
3396         *   <code>
3397         *     0x16=0x01000100:0x01000101;
3398         *   </code>
3399         * </p>
3400         * <p>
3401         *   The goal of this binding is to enable dynamic rebinding of keys to
3402         *   navigation actions for web content without requiring a framework change.
3403         * </p>
3404         * <p>
3405         *   This property represents a string value.
3406         * </p>
3407         * @hide
3408         */
3409        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
3410            "accessibility_web_content_key_bindings";
3411
3412        /**
3413         * Setting that specifies whether the display magnification is enabled.
3414         * Display magnifications allows the user to zoom in the display content
3415         * and is targeted to low vision users. The current magnification scale
3416         * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
3417         *
3418         * @hide
3419         */
3420        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
3421                "accessibility_display_magnification_enabled";
3422
3423        /**
3424         * Setting that specifies what the display magnification scale is.
3425         * Display magnifications allows the user to zoom in the display
3426         * content and is targeted to low vision users. Whether a display
3427         * magnification is performed is controlled by
3428         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
3429         *
3430         * @hide
3431         */
3432        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
3433                "accessibility_display_magnification_scale";
3434
3435        /**
3436         * Setting that specifies whether the display magnification should be
3437         * automatically updated. If this fearture is enabled the system will
3438         * exit magnification mode or pan the viewport when a context change
3439         * occurs. For example, on staring a new activity or rotating the screen,
3440         * the system may zoom out so the user can see the new context he is in.
3441         * Another example is on showing a window that is not visible in the
3442         * magnified viewport the system may pan the viewport to make the window
3443         * the has popped up so the user knows that the context has changed.
3444         * Whether a screen magnification is performed is controlled by
3445         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
3446         *
3447         * @hide
3448         */
3449        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
3450                "accessibility_display_magnification_auto_update";
3451
3452        /**
3453         * The timout for considering a press to be a long press in milliseconds.
3454         * @hide
3455         */
3456        public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
3457
3458        /**
3459         * Setting to always use the default text-to-speech settings regardless
3460         * of the application settings.
3461         * 1 = override application settings,
3462         * 0 = use application settings (if specified).
3463         *
3464         * @deprecated  The value of this setting is no longer respected by
3465         * the framework text to speech APIs as of the Ice Cream Sandwich release.
3466         */
3467        @Deprecated
3468        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
3469
3470        /**
3471         * Default text-to-speech engine speech rate. 100 = 1x
3472         */
3473        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
3474
3475        /**
3476         * Default text-to-speech engine pitch. 100 = 1x
3477         */
3478        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
3479
3480        /**
3481         * Default text-to-speech engine.
3482         */
3483        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
3484
3485        /**
3486         * Default text-to-speech language.
3487         *
3488         * @deprecated this setting is no longer in use, as of the Ice Cream
3489         * Sandwich release. Apps should never need to read this setting directly,
3490         * instead can query the TextToSpeech framework classes for the default
3491         * locale. {@link TextToSpeech#getLanguage()}.
3492         */
3493        @Deprecated
3494        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
3495
3496        /**
3497         * Default text-to-speech country.
3498         *
3499         * @deprecated this setting is no longer in use, as of the Ice Cream
3500         * Sandwich release. Apps should never need to read this setting directly,
3501         * instead can query the TextToSpeech framework classes for the default
3502         * locale. {@link TextToSpeech#getLanguage()}.
3503         */
3504        @Deprecated
3505        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
3506
3507        /**
3508         * Default text-to-speech locale variant.
3509         *
3510         * @deprecated this setting is no longer in use, as of the Ice Cream
3511         * Sandwich release. Apps should never need to read this setting directly,
3512         * instead can query the TextToSpeech framework classes for the
3513         * locale that is in use {@link TextToSpeech#getLanguage()}.
3514         */
3515        @Deprecated
3516        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
3517
3518        /**
3519         * Stores the default tts locales on a per engine basis. Stored as
3520         * a comma seperated list of values, each value being of the form
3521         * {@code engine_name:locale} for example,
3522         * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
3523         * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
3524         * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
3525         * setting directly, and can query the TextToSpeech framework classes
3526         * for the locale that is in use.
3527         *
3528         * @hide
3529         */
3530        public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
3531
3532        /**
3533         * Space delimited list of plugin packages that are enabled.
3534         */
3535        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
3536
3537        /**
3538         * Whether to notify the user of open networks.
3539         * <p>
3540         * If not connected and the scan results have an open network, we will
3541         * put this notification up. If we attempt to connect to a network or
3542         * the open network(s) disappear, we remove the notification. When we
3543         * show the notification, we will not show it again for
3544         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
3545         */
3546        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
3547                "wifi_networks_available_notification_on";
3548        /**
3549         * {@hide}
3550         */
3551        public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
3552                "wimax_networks_available_notification_on";
3553
3554        /**
3555         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
3556         * Connecting to a network will reset the timer.
3557         */
3558        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
3559                "wifi_networks_available_repeat_delay";
3560
3561        /**
3562         * 802.11 country code in ISO 3166 format
3563         * @hide
3564         */
3565        public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
3566
3567
3568        /**
3569         * When the number of open networks exceeds this number, the
3570         * least-recently-used excess networks will be removed.
3571         */
3572        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
3573
3574        /**
3575         * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
3576         */
3577        public static final String WIFI_ON = "wifi_on";
3578
3579        /**
3580         * Used to save the Wifi_ON state prior to tethering.
3581         * This state will be checked to restore Wifi after
3582         * the user turns off tethering.
3583         *
3584         * @hide
3585         */
3586        public static final String WIFI_SAVED_STATE = "wifi_saved_state";
3587
3588        /**
3589         * AP SSID
3590         *
3591         * @hide
3592         */
3593        public static final String WIFI_AP_SSID = "wifi_ap_ssid";
3594
3595        /**
3596         * AP security
3597         *
3598         * @hide
3599         */
3600        public static final String WIFI_AP_SECURITY = "wifi_ap_security";
3601
3602        /**
3603         * AP passphrase
3604         *
3605         * @hide
3606         */
3607        public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
3608
3609        /**
3610         * The acceptable packet loss percentage (range 0 - 100) before trying
3611         * another AP on the same network.
3612         */
3613        @Deprecated
3614        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
3615                "wifi_watchdog_acceptable_packet_loss_percentage";
3616
3617        /**
3618         * The number of access points required for a network in order for the
3619         * watchdog to monitor it.
3620         */
3621        @Deprecated
3622        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
3623
3624        /**
3625         * The delay between background checks.
3626         */
3627        @Deprecated
3628        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
3629                "wifi_watchdog_background_check_delay_ms";
3630
3631        /**
3632         * Whether the Wi-Fi watchdog is enabled for background checking even
3633         * after it thinks the user has connected to a good access point.
3634         */
3635        @Deprecated
3636        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
3637                "wifi_watchdog_background_check_enabled";
3638
3639        /**
3640         * The timeout for a background ping
3641         */
3642        @Deprecated
3643        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
3644                "wifi_watchdog_background_check_timeout_ms";
3645
3646        /**
3647         * The number of initial pings to perform that *may* be ignored if they
3648         * fail. Again, if these fail, they will *not* be used in packet loss
3649         * calculation. For example, one network always seemed to time out for
3650         * the first couple pings, so this is set to 3 by default.
3651         */
3652        @Deprecated
3653        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
3654            "wifi_watchdog_initial_ignored_ping_count";
3655
3656        /**
3657         * The maximum number of access points (per network) to attempt to test.
3658         * If this number is reached, the watchdog will no longer monitor the
3659         * initial connection state for the network. This is a safeguard for
3660         * networks containing multiple APs whose DNS does not respond to pings.
3661         */
3662        @Deprecated
3663        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
3664
3665        /**
3666         * Whether the Wi-Fi watchdog is enabled.
3667         */
3668        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
3669
3670        /**
3671         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
3672         */
3673        @Deprecated
3674        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
3675
3676        /**
3677         * The number of pings to test if an access point is a good connection.
3678         */
3679        @Deprecated
3680        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
3681
3682        /**
3683         * The delay between pings.
3684         */
3685        @Deprecated
3686        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
3687
3688        /**
3689         * The timeout per ping.
3690         */
3691        @Deprecated
3692        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
3693
3694        /**
3695         * ms delay before rechecking an 'online' wifi connection when it is thought to be unstable.
3696         * @hide
3697         */
3698        public static final String WIFI_WATCHDOG_ARP_CHECK_INTERVAL_MS =
3699                "wifi_watchdog_arp_interval_ms";
3700
3701        /**
3702         * ms delay interval between rssi polling when the signal is known to be weak
3703         * @hide
3704         */
3705        public static final String WIFI_WATCHDOG_RSSI_FETCH_INTERVAL_MS =
3706                "wifi_watchdog_rssi_fetch_interval_ms";
3707
3708
3709        /**
3710         * Number of ARP pings per check.
3711         * @hide
3712         */
3713        public static final String WIFI_WATCHDOG_NUM_ARP_PINGS = "wifi_watchdog_num_arp_pings";
3714
3715        /**
3716         * Minimum number of responses to the arp pings to consider the test 'successful'.
3717         * @hide
3718         */
3719        public static final String WIFI_WATCHDOG_MIN_ARP_RESPONSES =
3720                "wifi_watchdog_min_arp_responses";
3721
3722        /**
3723         * Timeout on ARP pings
3724         * @hide
3725         */
3726        public static final String WIFI_WATCHDOG_ARP_PING_TIMEOUT_MS =
3727                "wifi_watchdog_arp_ping_timeout_ms";
3728
3729        /**
3730         * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
3731         * the setting needs to be set to 0 to disable it.
3732         * @hide
3733         */
3734        public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
3735                "wifi_watchdog_poor_network_test_enabled";
3736
3737        /**
3738         * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
3739         * needs to be set to 0 to disable it.
3740         * @hide
3741         */
3742        public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
3743                "wifi_suspend_optimizations_enabled";
3744
3745        /**
3746         * @deprecated Use
3747         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
3748         */
3749        @Deprecated
3750        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
3751
3752        /**
3753         * The operational wifi frequency band
3754         * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
3755         * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
3756         * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
3757         *
3758         * @hide
3759         */
3760        public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
3761
3762        /**
3763         * The Wi-Fi peer-to-peer device name
3764         * @hide
3765         */
3766        public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
3767
3768        /**
3769         * Setting to turn off captive portal detection. Feature is enabled by default and
3770         * the setting needs to be set to 0 to disable it.
3771         * @hide
3772         */
3773        public static final String CAPTIVE_PORTAL_DETECTION_ENABLED =
3774                "captive_portal_detection_enabled";
3775
3776        /**
3777         * The server used for captive portal detection upon a new conection. A 204 response
3778         * code from the server is used for validation.
3779         * @hide
3780         */
3781        public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
3782
3783        /**
3784         * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
3785         * data connectivity to be established after a disconnect from Wi-Fi.
3786         */
3787        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
3788            "wifi_mobile_data_transition_wakelock_timeout_ms";
3789
3790        /**
3791         * Whether network service discovery is enabled.
3792         * @hide
3793         */
3794        public static final String NSD_ON = "nsd_on";
3795
3796        /**
3797         * Whether background data usage is allowed by the user. See
3798         * ConnectivityManager for more info.
3799         */
3800        @Deprecated
3801        public static final String BACKGROUND_DATA = "background_data";
3802
3803        /**
3804         * Origins for which browsers should allow geolocation by default.
3805         * The value is a space-separated list of origins.
3806         */
3807        public static final String ALLOWED_GEOLOCATION_ORIGINS
3808                = "allowed_geolocation_origins";
3809
3810        /**
3811         * @deprecated Use {@link android.provider.Settings.Global#MOBILE_DATA} instead
3812         * @hide
3813         */
3814        @Deprecated
3815        public static final String MOBILE_DATA = Global.MOBILE_DATA;
3816
3817        /**
3818         * @deprecated Use {@link android.provider.Settings.Global#CDMA_ROAMING_MODE} instead
3819         * @hide
3820         */
3821        @Deprecated
3822        public static final String CDMA_ROAMING_MODE = Global.CDMA_ROAMING_MODE;
3823
3824        /**
3825         * @deprecated Use {@link android.provider.Settings.Global#CDMA_ROAMING_MODE} instead
3826         * @hide
3827         */
3828        @Deprecated
3829        public static final String CDMA_SUBSCRIPTION_MODE = Global.CDMA_SUBSCRIPTION_MODE;
3830
3831        /**
3832         * The preferred network mode   7 = Global
3833         *                              6 = EvDo only
3834         *                              5 = CDMA w/o EvDo
3835         *                              4 = CDMA / EvDo auto
3836         *                              3 = GSM / WCDMA auto
3837         *                              2 = WCDMA only
3838         *                              1 = GSM only
3839         *                              0 = GSM / WCDMA preferred
3840         * @hide
3841         */
3842        public static final String PREFERRED_NETWORK_MODE =
3843                "preferred_network_mode";
3844
3845        /**
3846         * The preferred TTY mode     0 = TTy Off, CDMA default
3847         *                            1 = TTY Full
3848         *                            2 = TTY HCO
3849         *                            3 = TTY VCO
3850         * @hide
3851         */
3852        public static final String PREFERRED_TTY_MODE =
3853                "preferred_tty_mode";
3854
3855
3856        /**
3857         * @deprecated Use {@link android.provider.Settings.Global#CDMA_CELL_BROADCAST_SMS} instead
3858         * @hide
3859         */
3860        @Deprecated
3861        public static final String CDMA_CELL_BROADCAST_SMS = Global.CDMA_CELL_BROADCAST_SMS;
3862
3863        /**
3864         * The cdma subscription 0 = Subscription from RUIM, when available
3865         *                       1 = Subscription from NV
3866         * @hide
3867         */
3868        public static final String PREFERRED_CDMA_SUBSCRIPTION =
3869                "preferred_cdma_subscription";
3870
3871        /**
3872         * Whether the enhanced voice privacy mode is enabled.
3873         * 0 = normal voice privacy
3874         * 1 = enhanced voice privacy
3875         * @hide
3876         */
3877        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
3878
3879        /**
3880         * Whether the TTY mode mode is enabled.
3881         * 0 = disabled
3882         * 1 = enabled
3883         * @hide
3884         */
3885        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
3886
3887        /**
3888         * The number of milliseconds to delay before sending out Connectivyt Change broadcasts
3889         * @hide
3890         */
3891        public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
3892
3893        /**
3894         * Default value for CONNECTIVITY_CHANGE_DELAY in milliseconds.
3895         * @hide
3896         */
3897        public static final int CONNECTIVITY_CHANGE_DELAY_DEFAULT = 3000;
3898
3899        /**
3900         * Controls whether settings backup is enabled.
3901         * Type: int ( 0 = disabled, 1 = enabled )
3902         * @hide
3903         */
3904        public static final String BACKUP_ENABLED = "backup_enabled";
3905
3906        /**
3907         * Controls whether application data is automatically restored from backup
3908         * at install time.
3909         * Type: int ( 0 = disabled, 1 = enabled )
3910         * @hide
3911         */
3912        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
3913
3914        /**
3915         * Indicates whether settings backup has been fully provisioned.
3916         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
3917         * @hide
3918         */
3919        public static final String BACKUP_PROVISIONED = "backup_provisioned";
3920
3921        /**
3922         * Component of the transport to use for backup/restore.
3923         * @hide
3924         */
3925        public static final String BACKUP_TRANSPORT = "backup_transport";
3926
3927        /**
3928         * Version for which the setup wizard was last shown.  Bumped for
3929         * each release when there is new setup information to show.
3930         * @hide
3931         */
3932        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
3933
3934        /**
3935         * How frequently (in seconds) to check the memory status of the
3936         * device.
3937         * @hide
3938         */
3939        public static final String MEMCHECK_INTERVAL = "memcheck_interval";
3940
3941        /**
3942         * Max frequency (in seconds) to log memory check stats, in realtime
3943         * seconds.  This allows for throttling of logs when the device is
3944         * running for large amounts of time.
3945         * @hide
3946         */
3947        public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
3948                "memcheck_log_realtime_interval";
3949
3950        /**
3951         * Boolean indicating whether rebooting due to system memory checks
3952         * is enabled.
3953         * @hide
3954         */
3955        public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
3956
3957        /**
3958         * How many bytes the system process must be below to avoid scheduling
3959         * a soft reboot.  This reboot will happen when it is next determined
3960         * to be a good time.
3961         * @hide
3962         */
3963        public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
3964
3965        /**
3966         * How many bytes the system process must be below to avoid scheduling
3967         * a hard reboot.  This reboot will happen immediately.
3968         * @hide
3969         */
3970        public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
3971
3972        /**
3973         * How many bytes the phone process must be below to avoid scheduling
3974         * a soft restart.  This restart will happen when it is next determined
3975         * to be a good time.
3976         * @hide
3977         */
3978        public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
3979
3980        /**
3981         * How many bytes the phone process must be below to avoid scheduling
3982         * a hard restart.  This restart will happen immediately.
3983         * @hide
3984         */
3985        public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
3986
3987        /**
3988         * Boolean indicating whether restarting the phone process due to
3989         * memory checks is enabled.
3990         * @hide
3991         */
3992        public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
3993
3994        /**
3995         * First time during the day it is okay to kill processes
3996         * or reboot the device due to low memory situations.  This number is
3997         * in seconds since midnight.
3998         * @hide
3999         */
4000        public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
4001
4002        /**
4003         * Last time during the day it is okay to kill processes
4004         * or reboot the device due to low memory situations.  This number is
4005         * in seconds since midnight.
4006         * @hide
4007         */
4008        public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
4009
4010        /**
4011         * How long the screen must have been off in order to kill processes
4012         * or reboot.  This number is in seconds.  A value of -1 means to
4013         * entirely disregard whether the screen is on.
4014         * @hide
4015         */
4016        public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
4017
4018        /**
4019         * How much time there must be until the next alarm in order to kill processes
4020         * or reboot.  This number is in seconds.  Note: this value must be
4021         * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
4022         * always see an alarm scheduled within its time.
4023         * @hide
4024         */
4025        public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
4026
4027        /**
4028         * How frequently to check whether it is a good time to restart things,
4029         * if the device is in a bad state.  This number is in seconds.  Note:
4030         * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
4031         * the alarm to schedule the recheck will always appear within the
4032         * minimum "do not execute now" time.
4033         * @hide
4034         */
4035        public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
4036
4037        /**
4038         * How frequently (in DAYS) to reboot the device.  If 0, no reboots
4039         * will occur.
4040         * @hide
4041         */
4042        public static final String REBOOT_INTERVAL = "reboot_interval";
4043
4044        /**
4045         * First time during the day it is okay to force a reboot of the
4046         * device (if REBOOT_INTERVAL is set).  This number is
4047         * in seconds since midnight.
4048         * @hide
4049         */
4050        public static final String REBOOT_START_TIME = "reboot_start_time";
4051
4052        /**
4053         * The window of time (in seconds) after each REBOOT_INTERVAL in which
4054         * a reboot can be executed.  If 0, a reboot will always be executed at
4055         * exactly the given time.  Otherwise, it will only be executed if
4056         * the device is idle within the window.
4057         * @hide
4058         */
4059        public static final String REBOOT_WINDOW = "reboot_window";
4060
4061        /**
4062         * Threshold values for the duration and level of a discharge cycle, under
4063         * which we log discharge cycle info.
4064         * @hide
4065         */
4066        public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
4067                "battery_discharge_duration_threshold";
4068        /** @hide */
4069        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
4070
4071        /**
4072         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
4073         * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
4074         * will never display the "Report" button.
4075         * Type: int ( 0 = disallow, 1 = allow )
4076         * @hide
4077         */
4078        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
4079
4080        /**
4081         * @deprecated Use {@link android.provider.Settings.Global#WTF_IS_FATAL} instead
4082         * @hide
4083         */
4084        @Deprecated
4085        public static final String WTF_IS_FATAL = Global.WTF_IS_FATAL;
4086
4087        /**
4088         * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}.
4089         * @hide
4090         */
4091        public static final String DROPBOX_AGE_SECONDS =
4092                "dropbox_age_seconds";
4093        /**
4094         * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around.
4095         * @hide
4096         */
4097        public static final String DROPBOX_MAX_FILES =
4098                "dropbox_max_files";
4099        /**
4100         * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what.
4101         * @hide
4102         */
4103        public static final String DROPBOX_QUOTA_KB =
4104                "dropbox_quota_kb";
4105        /**
4106         * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use.
4107         * @hide
4108         */
4109        public static final String DROPBOX_QUOTA_PERCENT =
4110                "dropbox_quota_percent";
4111        /**
4112         * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into.
4113         * @hide
4114         */
4115        public static final String DROPBOX_RESERVE_PERCENT =
4116                "dropbox_reserve_percent";
4117        /**
4118         * Prefix for per-tag dropbox disable/enable settings.
4119         * @hide
4120         */
4121        public static final String DROPBOX_TAG_PREFIX =
4122                "dropbox:";
4123        /**
4124         * Lines of logcat to include with system crash/ANR/etc. reports,
4125         * as a prefix of the dropbox tag of the report type.
4126         * For example, "logcat_for_system_server_anr" controls the lines
4127         * of logcat captured with system server ANR reports.  0 to disable.
4128         * @hide
4129         */
4130        public static final String ERROR_LOGCAT_PREFIX =
4131                "logcat_for_";
4132
4133
4134        /**
4135         * Screen timeout in milliseconds corresponding to the
4136         * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
4137         * possible screen timeout behavior.)
4138         * @hide
4139         */
4140        public static final String SHORT_KEYLIGHT_DELAY_MS =
4141                "short_keylight_delay_ms";
4142
4143        /**
4144         * The interval in minutes after which the amount of free storage left on the
4145         * device is logged to the event log
4146         * @hide
4147         */
4148        public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
4149                "sys_free_storage_log_interval";
4150
4151        /**
4152         * Threshold for the amount of change in disk free space required to report the amount of
4153         * free space. Used to prevent spamming the logs when the disk free space isn't changing
4154         * frequently.
4155         * @hide
4156         */
4157        public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
4158                "disk_free_change_reporting_threshold";
4159
4160
4161        /**
4162         * Minimum percentage of free storage on the device that is used to determine if
4163         * the device is running low on storage.  The default is 10.
4164         * <p>Say this value is set to 10, the device is considered running low on storage
4165         * if 90% or more of the device storage is filled up.
4166         * @hide
4167         */
4168        public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
4169                "sys_storage_threshold_percentage";
4170
4171        /**
4172         * Maximum byte size of the low storage threshold.  This is to ensure
4173         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in
4174         * an overly large threshold for large storage devices.  Currently this
4175         * must be less than 2GB.  This default is 500MB.
4176         * @hide
4177         */
4178        public static final String SYS_STORAGE_THRESHOLD_MAX_BYTES =
4179                "sys_storage_threshold_max_bytes";
4180
4181        /**
4182         * Minimum bytes of free storage on the device before the data
4183         * partition is considered full. By default, 1 MB is reserved
4184         * to avoid system-wide SQLite disk full exceptions.
4185         * @hide
4186         */
4187        public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES =
4188                "sys_storage_full_threshold_bytes";
4189
4190        /**
4191         * The interval in milliseconds after which Wi-Fi is considered idle.
4192         * When idle, it is possible for the device to be switched from Wi-Fi to
4193         * the mobile data network.
4194         * @hide
4195         */
4196        public static final String WIFI_IDLE_MS = "wifi_idle_ms";
4197
4198        /**
4199         * The interval in milliseconds to issue wake up scans when wifi needs
4200         * to connect. This is necessary to connect to an access point when
4201         * device is on the move and the screen is off.
4202         * @hide
4203         */
4204        public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
4205                "wifi_framework_scan_interval_ms";
4206
4207        /**
4208         * The interval in milliseconds to scan as used by the wifi supplicant
4209         * @hide
4210         */
4211        public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
4212                "wifi_supplicant_scan_interval_ms";
4213
4214        /**
4215         * @deprecated Moved to Settings.Global
4216         * @hide
4217         */
4218        @Deprecated
4219        public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
4220                Global.PDP_WATCHDOG_POLL_INTERVAL_MS;
4221
4222        /**
4223         * @deprecated Moved to Settings.Global
4224         * @hide
4225         */
4226        @Deprecated
4227        public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
4228                Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS;
4229
4230        /**
4231         * @deprecated Moved to Settings.Global
4232         * @hide
4233         */
4234        @Deprecated
4235        public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
4236                Global.PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS;
4237
4238        /**
4239         * @deprecated Moved to Settings.Global
4240         * @hide
4241         */
4242        @Deprecated
4243        public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
4244                Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT;
4245
4246        /**
4247         * @deprecated Moved to Settings.Global
4248         * @hide
4249         */
4250        @Deprecated
4251        public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
4252                Global.PDP_WATCHDOG_ERROR_POLL_COUNT;
4253
4254        /**
4255         * @deprecated Moved to Settings.Global
4256         * @hide
4257         */
4258        @Deprecated
4259        public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
4260                Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT;
4261
4262        /**
4263         * @deprecated Moved to Settings.Global
4264         * @hide
4265         */
4266        @Deprecated
4267        public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
4268                Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS;
4269
4270        /**
4271         * @deprecated Moved to Settings.Global
4272         * @hide
4273         */
4274        @Deprecated
4275        public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
4276                Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS;
4277
4278        /**
4279         * @deprecated Moved to Settings.Global
4280         * @hide
4281         */
4282        @Deprecated
4283        public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
4284                Global.GPRS_REGISTER_CHECK_PERIOD_MS;
4285
4286        /**
4287         * @deprecated Use {@link android.provider.Settings.Global#NITZ_UPDATE_SPACING} instead
4288         * @hide
4289         */
4290        public static final String NITZ_UPDATE_SPACING = Global.NITZ_UPDATE_SPACING;
4291
4292        /**
4293         * @deprecated Use {@link android.provider.Settings.Global#NITZ_UPDATE_SPACING} instead
4294         * @hide
4295         */
4296        public static final String NITZ_UPDATE_DIFF = Global.NITZ_UPDATE_DIFF;
4297
4298        /**
4299         * The maximum reconnect delay for short network outages or when the network is suspended
4300         * due to phone use.
4301         * @hide
4302         */
4303        public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
4304                "sync_max_retry_delay_in_seconds";
4305
4306        /**
4307         * The interval in milliseconds at which to check the number of SMS sent
4308         * out without asking for use permit, to limit the un-authorized SMS
4309         * usage.
4310         * @hide
4311         */
4312        public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
4313                "sms_outgoing_check_interval_ms";
4314
4315        /**
4316         * The number of outgoing SMS sent without asking for user permit
4317         * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
4318         * @hide
4319         */
4320        public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
4321                "sms_outgoing_check_max_count";
4322
4323        /**
4324         * The global search provider chosen by the user (if multiple global
4325         * search providers are installed). This will be the provider returned
4326         * by {@link SearchManager#getGlobalSearchActivity()} if it's still
4327         * installed. This setting is stored as a flattened component name as
4328         * per {@link ComponentName#flattenToString()}.
4329         *
4330         * @hide
4331         */
4332        public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
4333                "search_global_search_activity";
4334
4335        /**
4336         * The number of promoted sources in GlobalSearch.
4337         * @hide
4338         */
4339        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
4340        /**
4341         * The maximum number of suggestions returned by GlobalSearch.
4342         * @hide
4343         */
4344        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
4345        /**
4346         * The number of suggestions GlobalSearch will ask each non-web search source for.
4347         * @hide
4348         */
4349        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
4350        /**
4351         * The number of suggestions the GlobalSearch will ask the web search source for.
4352         * @hide
4353         */
4354        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
4355                "search_web_results_override_limit";
4356        /**
4357         * The number of milliseconds that GlobalSearch will wait for suggestions from
4358         * promoted sources before continuing with all other sources.
4359         * @hide
4360         */
4361        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
4362                "search_promoted_source_deadline_millis";
4363        /**
4364         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
4365         * @hide
4366         */
4367        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
4368        /**
4369         * The maximum number of milliseconds that GlobalSearch shows the previous results
4370         * after receiving a new query.
4371         * @hide
4372         */
4373        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
4374        /**
4375         * The maximum age of log data used for shortcuts in GlobalSearch.
4376         * @hide
4377         */
4378        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
4379        /**
4380         * The maximum age of log data used for source ranking in GlobalSearch.
4381         * @hide
4382         */
4383        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
4384                "search_max_source_event_age_millis";
4385        /**
4386         * The minimum number of impressions needed to rank a source in GlobalSearch.
4387         * @hide
4388         */
4389        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
4390                "search_min_impressions_for_source_ranking";
4391        /**
4392         * The minimum number of clicks needed to rank a source in GlobalSearch.
4393         * @hide
4394         */
4395        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
4396                "search_min_clicks_for_source_ranking";
4397        /**
4398         * The maximum number of shortcuts shown by GlobalSearch.
4399         * @hide
4400         */
4401        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
4402        /**
4403         * The size of the core thread pool for suggestion queries in GlobalSearch.
4404         * @hide
4405         */
4406        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
4407                "search_query_thread_core_pool_size";
4408        /**
4409         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
4410         * @hide
4411         */
4412        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
4413                "search_query_thread_max_pool_size";
4414        /**
4415         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
4416         * @hide
4417         */
4418        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
4419                "search_shortcut_refresh_core_pool_size";
4420        /**
4421         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
4422         * @hide
4423         */
4424        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
4425                "search_shortcut_refresh_max_pool_size";
4426        /**
4427         * The maximun time that excess threads in the GlobalSeach thread pools will
4428         * wait before terminating.
4429         * @hide
4430         */
4431        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
4432                "search_thread_keepalive_seconds";
4433        /**
4434         * The maximum number of concurrent suggestion queries to each source.
4435         * @hide
4436         */
4437        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
4438                "search_per_source_concurrent_query_limit";
4439
4440        /**
4441         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
4442         * @hide
4443         */
4444        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
4445
4446        /**
4447         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
4448         * @hide
4449         */
4450        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
4451
4452        /**
4453         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
4454         * @hide
4455         */
4456        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
4457
4458        /**
4459         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
4460         * @hide
4461         */
4462        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
4463
4464        /**
4465         * If nonzero, ANRs in invisible background processes bring up a dialog.
4466         * Otherwise, the process will be silently killed.
4467         * @hide
4468         */
4469        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
4470
4471        /**
4472         * The {@link ComponentName} string of the service to be used as the voice recognition
4473         * service.
4474         *
4475         * @hide
4476         */
4477        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
4478
4479
4480        /**
4481         * The {@link ComponentName} string of the selected spell checker service which is
4482         * one of the services managed by the text service manager.
4483         *
4484         * @hide
4485         */
4486        public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
4487
4488        /**
4489         * The {@link ComponentName} string of the selected subtype of the selected spell checker
4490         * service which is one of the services managed by the text service manager.
4491         *
4492         * @hide
4493         */
4494        public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
4495                "selected_spell_checker_subtype";
4496
4497        /**
4498         * The {@link ComponentName} string whether spell checker is enabled or not.
4499         *
4500         * @hide
4501         */
4502        public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
4503
4504        /**
4505         * What happens when the user presses the Power button while in-call
4506         * and the screen is on.<br/>
4507         * <b>Values:</b><br/>
4508         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
4509         * 2 - The Power button hangs up the current call.<br/>
4510         *
4511         * @hide
4512         */
4513        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
4514
4515        /**
4516         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
4517         * @hide
4518         */
4519        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
4520
4521        /**
4522         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
4523         * @hide
4524         */
4525        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
4526
4527        /**
4528         * INCALL_POWER_BUTTON_BEHAVIOR default value.
4529         * @hide
4530         */
4531        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
4532                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
4533
4534        /**
4535         * The current night mode that has been selected by the user.  Owned
4536         * and controlled by UiModeManagerService.  Constants are as per
4537         * UiModeManager.
4538         * @hide
4539         */
4540        public static final String UI_NIGHT_MODE = "ui_night_mode";
4541
4542        /**
4543         * Let user pick default install location.
4544         * @hide
4545         */
4546        public static final String SET_INSTALL_LOCATION = "set_install_location";
4547
4548        /**
4549         * Default install location value.
4550         * 0 = auto, let system decide
4551         * 1 = internal
4552         * 2 = sdcard
4553         * @hide
4554         */
4555        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
4556
4557        /**
4558         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_POLLING_SEC} instead
4559         * @hide
4560         */
4561        @Deprecated
4562        public static final String THROTTLE_POLLING_SEC = Global.THROTTLE_POLLING_SEC;
4563
4564        /**
4565         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_THRESHOLD_BYTES} instead
4566         * @hide
4567         */
4568        @Deprecated
4569        public static final String THROTTLE_THRESHOLD_BYTES = Global.THROTTLE_THRESHOLD_BYTES;
4570
4571        /**
4572         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_VALUE_KBITSPS} instead
4573         * @hide
4574         */
4575        @Deprecated
4576        public static final String THROTTLE_VALUE_KBITSPS = Global.THROTTLE_VALUE_KBITSPS;
4577
4578        /**
4579         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_VALUE_KBITSPS} instead
4580         * @hide
4581         */
4582        @Deprecated
4583        public static final String THROTTLE_RESET_DAY = Global.THROTTLE_RESET_DAY;
4584
4585        /**
4586         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_NOTIFICATION_TYPE} instead
4587         * @hide
4588         */
4589        @Deprecated
4590        public static final String THROTTLE_NOTIFICATION_TYPE = Global.THROTTLE_NOTIFICATION_TYPE;
4591
4592        /**
4593         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_HELP_URI} instead
4594         * @hide
4595         */
4596        @Deprecated
4597        public static final String THROTTLE_HELP_URI = Global.THROTTLE_HELP_URI;
4598
4599        /**
4600         * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_MAX_NTP_CACHE_AGE_SEC} instead
4601         * @hide
4602         */
4603        @Deprecated
4604        public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
4605                Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC;
4606
4607        /**
4608         * @deprecated Use {@link android.provider.Settings.Global#DOWNLOAD_MAX_BYTES_OVER_MOBILE} instead
4609         * @hide
4610         */
4611        @Deprecated
4612        public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
4613                Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE;
4614
4615        /**
4616         * @deprecated Use {@link android.provider.Settings.Global#DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE} instead
4617         * @hide
4618         */
4619        @Deprecated
4620        public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
4621                Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE;
4622
4623        /**
4624         * ms during which to consume extra events related to Inet connection condition
4625         * after a transtion to fully-connected
4626         * @hide
4627         */
4628        public static final String INET_CONDITION_DEBOUNCE_UP_DELAY =
4629                "inet_condition_debounce_up_delay";
4630
4631        /**
4632         * ms during which to consume extra events related to Inet connection condtion
4633         * after a transtion to partly-connected
4634         * @hide
4635         */
4636        public static final String INET_CONDITION_DEBOUNCE_DOWN_DELAY =
4637                "inet_condition_debounce_down_delay";
4638
4639        /**
4640         * @deprecated Use {@link android.provider.Settings.Global#SETUP_PREPAID_DATA_SERVICE_URL} instead
4641         * @hide
4642         */
4643        @Deprecated
4644        public static final String SETUP_PREPAID_DATA_SERVICE_URL =
4645                Global.SETUP_PREPAID_DATA_SERVICE_URL;
4646
4647        /**
4648         * @deprecated Use {@link android.provider.Settings.Global#SETUP_PREPAID_DETECTION_TARGET_URL} instead
4649         * @hide
4650         */
4651        @Deprecated
4652        public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
4653                Global.SETUP_PREPAID_DETECTION_TARGET_URL;
4654
4655        /**
4656         * @deprecated Use {@link android.provider.Settings.Global#SETUP_PREPAID_DETECTION_REDIR_HOST} instead
4657         * @hide
4658         */
4659        @Deprecated
4660        public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
4661                Global.SETUP_PREPAID_DETECTION_REDIR_HOST;
4662
4663        /**
4664         * Whether screensavers are enabled.
4665         * @hide
4666         */
4667        public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
4668
4669        /**
4670         * The user's chosen screensaver components.
4671         *
4672         * These will be launched by the PhoneWindowManager after a timeout when not on
4673         * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
4674         * @hide
4675         */
4676        public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
4677
4678        /**
4679         * If screensavers are enabled, whether the screensaver should be automatically launched
4680         * when the device is inserted into a (desk) dock.
4681         * @hide
4682         */
4683        public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
4684
4685        /**
4686         * If screensavers are enabled, whether the screensaver should be automatically launched
4687         * when the screen times out when not on battery.
4688         * @hide
4689         */
4690        public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
4691
4692        /**
4693         * If screensavers are enabled, the default screensaver component.
4694         * @hide
4695         */
4696        public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
4697
4698        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4699         * {@hide} */
4700        @Deprecated
4701        public static final String NETSTATS_ENABLED = Global.NETSTATS_ENABLED;
4702        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4703         * {@hide} */
4704        @Deprecated
4705        public static final String NETSTATS_POLL_INTERVAL = Global.NETSTATS_POLL_INTERVAL;
4706        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4707         * {@hide} */
4708        @Deprecated
4709        public static final String NETSTATS_TIME_CACHE_MAX_AGE = Global.NETSTATS_TIME_CACHE_MAX_AGE;
4710        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4711         * {@hide} */
4712        @Deprecated
4713        public static final String NETSTATS_GLOBAL_ALERT_BYTES = Global.NETSTATS_GLOBAL_ALERT_BYTES;
4714        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4715         * {@hide} */
4716        @Deprecated
4717        public static final String NETSTATS_SAMPLE_ENABLED = Global.NETSTATS_SAMPLE_ENABLED;
4718        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4719         * {@hide} */
4720        @Deprecated
4721        public static final String NETSTATS_REPORT_XT_OVER_DEV = Global.NETSTATS_REPORT_XT_OVER_DEV;
4722
4723        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4724         * {@hide} */
4725        @Deprecated
4726        public static final String NETSTATS_DEV_BUCKET_DURATION = Global.NETSTATS_DEV_BUCKET_DURATION;
4727        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4728         * {@hide} */
4729        @Deprecated
4730        public static final String NETSTATS_DEV_PERSIST_BYTES = Global.NETSTATS_DEV_PERSIST_BYTES;
4731        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4732         * {@hide} */
4733        @Deprecated
4734        public static final String NETSTATS_DEV_ROTATE_AGE = Global.NETSTATS_DEV_ROTATE_AGE;
4735        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4736         * {@hide} */
4737        @Deprecated
4738        public static final String NETSTATS_DEV_DELETE_AGE = Global.NETSTATS_DEV_DELETE_AGE;
4739
4740        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4741         * {@hide} */
4742        @Deprecated
4743        public static final String NETSTATS_UID_BUCKET_DURATION = Global.NETSTATS_UID_BUCKET_DURATION;
4744        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4745         * {@hide} */
4746        @Deprecated
4747        public static final String NETSTATS_UID_PERSIST_BYTES = Global.NETSTATS_UID_PERSIST_BYTES;
4748        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4749         * {@hide} */
4750        @Deprecated
4751        public static final String NETSTATS_UID_ROTATE_AGE = Global.NETSTATS_UID_ROTATE_AGE;
4752        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4753         * {@hide} */
4754        @Deprecated
4755        public static final String NETSTATS_UID_DELETE_AGE = Global.NETSTATS_UID_DELETE_AGE;
4756
4757        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4758         * {@hide} */
4759        @Deprecated
4760        public static final String NETSTATS_UID_TAG_BUCKET_DURATION = Global.NETSTATS_UID_TAG_BUCKET_DURATION;
4761        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4762         * {@hide} */
4763        @Deprecated
4764        public static final String NETSTATS_UID_TAG_PERSIST_BYTES = Global.NETSTATS_UID_TAG_PERSIST_BYTES;
4765        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4766         * {@hide} */
4767        @Deprecated
4768        public static final String NETSTATS_UID_TAG_ROTATE_AGE = Global.NETSTATS_UID_TAG_ROTATE_AGE;
4769        /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
4770         * {@hide} */
4771        @Deprecated
4772        public static final String NETSTATS_UID_TAG_DELETE_AGE = Global.NETSTATS_UID_TAG_DELETE_AGE;
4773
4774        /** Preferred NTP server. {@hide}
4775         * @deprecated moved to Settings.Global */
4776        public static final String NTP_SERVER = Global.NTP_SERVER;
4777
4778        /** Timeout in milliseconds to wait for NTP server. {@hide}
4779         * @deprecated moved to Settings.Global */
4780        public static final String NTP_TIMEOUT = Global.NTP_TIMEOUT;
4781
4782        /** Autofill server address (Used in WebView/browser).
4783         * @deprecated moved to Settings.Global
4784         * {@hide} */
4785        public static final String WEB_AUTOFILL_QUERY_URL = Global.WEB_AUTOFILL_QUERY_URL;
4786
4787        /**
4788         * Whether the package manager should send package verification broadcasts for verifiers to
4789         * review apps prior to installation.
4790         * @deprecated moved to Settings.Global
4791         * 1 = request apps to be verified prior to installation, if a verifier exists.
4792         * 0 = do not verify apps before installation
4793         * {@hide}
4794         */
4795        @Deprecated
4796        public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
4797
4798        /** Timeout for package verification.
4799         * @deprecated moved to Settings.Global
4800         * {@hide} */
4801        @Deprecated
4802        public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
4803
4804        /** Default response code for package verification.
4805         * @deprecated moved to Settings.Global
4806         * {@hide} */
4807        @Deprecated
4808        public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
4809
4810        /** {@hide} */
4811        public static final String
4812                READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
4813
4814        /**
4815         * Duration in milliseconds before pre-authorized URIs for the contacts
4816         * provider should expire.
4817         * @hide
4818         */
4819        public static final String CONTACTS_PREAUTH_URI_EXPIRATION =
4820                "contacts_preauth_uri_expiration";
4821
4822        /**
4823         * Prefix for SMS short code regex patterns (country code is appended).
4824         * @see com.android.internal.telephony.SmsUsageMonitor
4825         * @hide
4826         */
4827        public static final String SMS_SHORT_CODES_PREFIX = "sms_short_codes_";
4828
4829        /**
4830         * Overlay display devices setting.
4831         * The associated value is a specially formatted string that describes the
4832         * size and density of simulated secondary display devices.
4833         * <p>
4834         * Format: {width}x{height}/{dpi};...
4835         * </p><p>
4836         * Example:
4837         * <ul>
4838         * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
4839         * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
4840         * at 1080p and the second at 720p.</li>
4841         * <li>If the value is empty, then no overlay display devices are created.</li>
4842         * </ul></p>
4843         *
4844         * @hide
4845         */
4846        public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
4847
4848        /**
4849         * This are the settings to be backed up.
4850         *
4851         * NOTE: Settings are backed up and restored in the order they appear
4852         *       in this array. If you have one setting depending on another,
4853         *       make sure that they are ordered appropriately.
4854         *
4855         * @hide
4856         */
4857        public static final String[] SETTINGS_TO_BACKUP = {
4858            ADB_ENABLED,
4859            BUGREPORT_IN_POWER_MENU,
4860            ALLOW_MOCK_LOCATION,
4861            PARENTAL_CONTROL_ENABLED,
4862            PARENTAL_CONTROL_REDIRECT_URL,
4863            USB_MASS_STORAGE_ENABLED,
4864            ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
4865            ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
4866            ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
4867            ACCESSIBILITY_SCRIPT_INJECTION,
4868            BACKUP_AUTO_RESTORE,
4869            ENABLED_ACCESSIBILITY_SERVICES,
4870            TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
4871            TOUCH_EXPLORATION_ENABLED,
4872            ACCESSIBILITY_ENABLED,
4873            ACCESSIBILITY_SPEAK_PASSWORD,
4874            TTS_USE_DEFAULTS,
4875            TTS_DEFAULT_RATE,
4876            TTS_DEFAULT_PITCH,
4877            TTS_DEFAULT_SYNTH,
4878            TTS_DEFAULT_LANG,
4879            TTS_DEFAULT_COUNTRY,
4880            TTS_ENABLED_PLUGINS,
4881            TTS_DEFAULT_LOCALE,
4882            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
4883            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
4884            WIFI_NUM_OPEN_NETWORKS_KEPT,
4885            MOUNT_PLAY_NOTIFICATION_SND,
4886            MOUNT_UMS_AUTOSTART,
4887            MOUNT_UMS_PROMPT,
4888            MOUNT_UMS_NOTIFY_ENABLED,
4889            UI_NIGHT_MODE,
4890            LOCK_SCREEN_OWNER_INFO,
4891            LOCK_SCREEN_OWNER_INFO_ENABLED
4892        };
4893
4894        /**
4895         * Helper method for determining if a location provider is enabled.
4896         * @param cr the content resolver to use
4897         * @param provider the location provider to query
4898         * @return true if the provider is enabled
4899         */
4900        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
4901            String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
4902            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
4903        }
4904
4905        /**
4906         * Thread-safe method for enabling or disabling a single location provider.
4907         * @param cr the content resolver to use
4908         * @param provider the location provider to enable or disable
4909         * @param enabled true if the provider should be enabled
4910         */
4911        public static final void setLocationProviderEnabled(ContentResolver cr,
4912                String provider, boolean enabled) {
4913            // to ensure thread safety, we write the provider name with a '+' or '-'
4914            // and let the SettingsProvider handle it rather than reading and modifying
4915            // the list of enabled providers.
4916            if (enabled) {
4917                provider = "+" + provider;
4918            } else {
4919                provider = "-" + provider;
4920            }
4921            putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
4922        }
4923    }
4924
4925    /**
4926     * Global system settings, containing preferences that always apply identically
4927     * to all defined users.  Applications can read these but are not allowed to write;
4928     * like the "Secure" settings, these are for preferences that the user must
4929     * explicitly modify through the system UI or specialized APIs for those values.
4930     */
4931    public static final class Global extends NameValueTable {
4932        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version";
4933
4934        /**
4935         * The content:// style URL for global secure settings items.  Not public.
4936         */
4937        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
4938
4939        /**
4940         * Whether Airplane Mode is on.
4941         */
4942        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
4943
4944        /**
4945         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
4946         */
4947        public static final String RADIO_BLUETOOTH = "bluetooth";
4948
4949        /**
4950         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
4951         */
4952        public static final String RADIO_WIFI = "wifi";
4953
4954        /**
4955         * {@hide}
4956         */
4957        public static final String RADIO_WIMAX = "wimax";
4958        /**
4959         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
4960         */
4961        public static final String RADIO_CELL = "cell";
4962
4963        /**
4964         * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
4965         */
4966        public static final String RADIO_NFC = "nfc";
4967
4968        /**
4969         * A comma separated list of radios that need to be disabled when airplane mode
4970         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
4971         * included in the comma separated list.
4972         */
4973        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
4974
4975        /**
4976         * A comma separated list of radios that should to be disabled when airplane mode
4977         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
4978         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
4979         * will be turned off when entering airplane mode, but the user will be able to reenable
4980         * Wifi in the Settings app.
4981         *
4982         * {@hide}
4983         */
4984        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
4985
4986        /**
4987         * The policy for deciding when Wi-Fi should go to sleep (which will in
4988         * turn switch to using the mobile data as an Internet connection).
4989         * <p>
4990         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
4991         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
4992         * {@link #WIFI_SLEEP_POLICY_NEVER}.
4993         */
4994        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
4995
4996        /**
4997         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
4998         * policy, which is to sleep shortly after the turning off
4999         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
5000         */
5001        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
5002
5003        /**
5004         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
5005         * the device is on battery, and never go to sleep when the device is
5006         * plugged in.
5007         */
5008        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
5009
5010        /**
5011         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
5012         */
5013        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
5014
5015        /**
5016         * Value to specify if the user prefers the date, time and time zone
5017         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
5018         */
5019        public static final String AUTO_TIME = "auto_time";
5020
5021        /**
5022         * Value to specify if the user prefers the time zone
5023         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
5024         */
5025        public static final String AUTO_TIME_ZONE = "auto_time_zone";
5026
5027        /**
5028         * URI for the car dock "in" event sound.
5029         * @hide
5030         */
5031        public static final String CAR_DOCK_SOUND = "car_dock_sound";
5032
5033        /**
5034         * URI for the car dock "out" event sound.
5035         * @hide
5036         */
5037        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
5038
5039        /**
5040         * URI for the desk dock "in" event sound.
5041         * @hide
5042         */
5043        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
5044
5045        /**
5046         * URI for the desk dock "out" event sound.
5047         * @hide
5048         */
5049        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
5050
5051        /**
5052         * Whether to play a sound for dock events.
5053         * @hide
5054         */
5055        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
5056
5057        /**
5058         * URI for the "device locked" (keyguard shown) sound.
5059         * @hide
5060         */
5061        public static final String LOCK_SOUND = "lock_sound";
5062
5063        /**
5064         * URI for the "device unlocked" sound.
5065         * @hide
5066         */
5067        public static final String UNLOCK_SOUND = "unlock_sound";
5068
5069        /**
5070         * URI for the low battery sound file.
5071         * @hide
5072         */
5073        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
5074
5075        /**
5076         * Whether to play a sound for low-battery alerts.
5077         * @hide
5078         */
5079        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
5080
5081        /**
5082         * Whether we keep the device on while the device is plugged in.
5083         * Supported values are:
5084         * <ul>
5085         * <li>{@code 0} to never stay on while plugged in</li>
5086         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
5087         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
5088         * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
5089         * </ul>
5090         * These values can be OR-ed together.
5091         */
5092        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
5093
5094        /**
5095         * Whether ADB is enabled.
5096         */
5097        public static final String ADB_ENABLED = "adb_enabled";
5098
5099        /**
5100         * Whether assisted GPS should be enabled or not.
5101         * @hide
5102         */
5103        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
5104
5105        /**
5106         * Whether bluetooth is enabled/disabled
5107         * 0=disabled. 1=enabled.
5108         */
5109        public static final String BLUETOOTH_ON = "bluetooth_on";
5110
5111        /**
5112         * CDMA Cell Broadcast SMS
5113         *                            0 = CDMA Cell Broadcast SMS disabled
5114         *                            1 = CDMA Cell Broadcast SMS enabled
5115         * @hide
5116         */
5117        public static final String CDMA_CELL_BROADCAST_SMS =
5118                "cdma_cell_broadcast_sms";
5119
5120        /**
5121         * The CDMA roaming mode 0 = Home Networks, CDMA default
5122         *                       1 = Roaming on Affiliated networks
5123         *                       2 = Roaming on any networks
5124         * @hide
5125         */
5126        public static final String CDMA_ROAMING_MODE = "roaming_settings";
5127
5128        /**
5129         * The CDMA subscription mode 0 = RUIM/SIM (default)
5130         *                                1 = NV
5131         * @hide
5132         */
5133        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
5134
5135        /** Inactivity timeout to track mobile data activity.
5136        *
5137        * If set to a positive integer, it indicates the inactivity timeout value in seconds to
5138        * infer the data activity of mobile network. After a period of no activity on mobile
5139        * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
5140        * intent is fired to indicate a transition of network status from "active" to "idle". Any
5141        * subsequent activity on mobile networks triggers the firing of {@code
5142        * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
5143        *
5144        * Network activity refers to transmitting or receiving data on the network interfaces.
5145        *
5146        * Tracking is disabled if set to zero or negative value.
5147        *
5148        * @hide
5149        */
5150       public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
5151
5152       /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
5153        * but for Wifi network.
5154        * @hide
5155        */
5156       public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
5157
5158       /**
5159        * Whether or not data roaming is enabled. (0 = false, 1 = true)
5160        */
5161       public static final String DATA_ROAMING = "data_roaming";
5162
5163       /**
5164        * Whether user has enabled development settings.
5165        */
5166       public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
5167
5168       /**
5169        * Whether the device has been provisioned (0 = false, 1 = true)
5170        */
5171       public static final String DEVICE_PROVISIONED = "device_provisioned";
5172
5173       /**
5174        * The saved value for WindowManagerService.setForcedDisplayDensity().
5175        * One integer in dpi.  If unset, then use the real display density.
5176        * @hide
5177        */
5178       public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
5179
5180       /**
5181        * The saved value for WindowManagerService.setForcedDisplaySize().
5182        * Two integers separated by a comma.  If unset, then use the real display size.
5183        * @hide
5184        */
5185       public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
5186
5187       /**
5188        * The maximum size, in bytes, of a download that the download manager will transfer over
5189        * a non-wifi connection.
5190        * @hide
5191        */
5192       public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
5193               "download_manager_max_bytes_over_mobile";
5194
5195       /**
5196        * The recommended maximum size, in bytes, of a download that the download manager should
5197        * transfer over a non-wifi connection. Over this size, the use will be warned, but will
5198        * have the option to start the download over the mobile connection anyway.
5199        * @hide
5200        */
5201       public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
5202               "download_manager_recommended_max_bytes_over_mobile";
5203
5204       /**
5205        * Whether the package installer should allow installation of apps downloaded from
5206        * sources other than Google Play.
5207        *
5208        * 1 = allow installing from other sources
5209        * 0 = only allow installing from Google Play
5210        */
5211       public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
5212
5213       /**
5214        * Whether mobile data connections are allowed by the user.  See
5215        * ConnectivityManager for more info.
5216        * @hide
5217        */
5218       public static final String MOBILE_DATA = "mobile_data";
5219
5220       /** {@hide} */
5221       public static final String NETSTATS_ENABLED = "netstats_enabled";
5222       /** {@hide} */
5223       public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
5224       /** {@hide} */
5225       public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
5226       /** {@hide} */
5227       public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
5228       /** {@hide} */
5229       public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
5230       /** {@hide} */
5231       public static final String NETSTATS_REPORT_XT_OVER_DEV = "netstats_report_xt_over_dev";
5232
5233       /** {@hide} */
5234       public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
5235       /** {@hide} */
5236       public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
5237       /** {@hide} */
5238       public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
5239       /** {@hide} */
5240       public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
5241
5242       /** {@hide} */
5243       public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
5244       /** {@hide} */
5245       public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
5246       /** {@hide} */
5247       public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
5248       /** {@hide} */
5249       public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
5250
5251       /** {@hide} */
5252       public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
5253       /** {@hide} */
5254       public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
5255       /** {@hide} */
5256       public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
5257       /** {@hide} */
5258       public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
5259
5260       /**
5261        * User preference for which network(s) should be used. Only the
5262        * connectivity service should touch this.
5263        */
5264       public static final String NETWORK_PREFERENCE = "network_preference";
5265
5266       /**
5267        * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
5268        * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
5269        * exceeded.
5270        * @hide
5271        */
5272       public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
5273
5274       /**
5275        * The length of time in milli-seconds that automatic small adjustments to
5276        * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
5277        * @hide
5278        */
5279       public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
5280
5281       /** Preferred NTP server. {@hide} */
5282       public static final String NTP_SERVER = "ntp_server";
5283       /** Timeout in milliseconds to wait for NTP server. {@hide} */
5284       public static final String NTP_TIMEOUT = "ntp_timeout";
5285
5286       /**
5287        * Whether the package manager should send package verification broadcasts for verifiers to
5288        * review apps prior to installation.
5289        * 1 = request apps to be verified prior to installation, if a verifier exists.
5290        * 0 = do not verify apps before installation
5291        * {@hide}
5292        */
5293       public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
5294
5295       /** Timeout for package verification.
5296        * {@hide} */
5297       public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
5298
5299       /** Default response code for package verification.
5300        * {@hide} */
5301       public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
5302
5303       /**
5304        * The interval in milliseconds at which to check packet counts on the
5305        * mobile data interface when screen is on, to detect possible data
5306        * connection problems.
5307        * @hide
5308        */
5309       public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
5310               "pdp_watchdog_poll_interval_ms";
5311
5312       /**
5313        * The interval in milliseconds at which to check packet counts on the
5314        * mobile data interface when screen is off, to detect possible data
5315        * connection problems.
5316        * @hide
5317        */
5318       public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
5319               "pdp_watchdog_long_poll_interval_ms";
5320
5321       /**
5322        * The interval in milliseconds at which to check packet counts on the
5323        * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
5324        * outgoing packets has been reached without incoming packets.
5325        * @hide
5326        */
5327       public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
5328               "pdp_watchdog_error_poll_interval_ms";
5329
5330       /**
5331        * The number of outgoing packets sent without seeing an incoming packet
5332        * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
5333        * device is logged to the event log
5334        * @hide
5335        */
5336       public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
5337               "pdp_watchdog_trigger_packet_count";
5338
5339       /**
5340        * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
5341        * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
5342        * attempting data connection recovery.
5343        * @hide
5344        */
5345       public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
5346               "pdp_watchdog_error_poll_count";
5347
5348       /**
5349        * The number of failed PDP reset attempts before moving to something more
5350        * drastic: re-registering to the network.
5351        * @hide
5352        */
5353       public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
5354               "pdp_watchdog_max_pdp_reset_fail_count";
5355
5356       /**
5357        * A positive value indicates how often the SamplingProfiler
5358        * should take snapshots. Zero value means SamplingProfiler
5359        * is disabled.
5360        *
5361        * @hide
5362        */
5363       public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
5364
5365       /**
5366        * URL to open browser on to allow user to manage a prepay account
5367        * @hide
5368        */
5369       public static final String SETUP_PREPAID_DATA_SERVICE_URL =
5370               "setup_prepaid_data_service_url";
5371
5372       /**
5373        * URL to attempt a GET on to see if this is a prepay device
5374        * @hide
5375        */
5376       public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
5377               "setup_prepaid_detection_target_url";
5378
5379       /**
5380        * Host to check for a redirect to after an attempt to GET
5381        * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
5382        * this is a prepaid device with zero balance.)
5383        * @hide
5384        */
5385       public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
5386               "setup_prepaid_detection_redir_host";
5387
5388       /**
5389        * Used to disable Tethering on a device - defaults to true
5390        * @hide
5391        */
5392       public static final String TETHER_SUPPORTED = "tether_supported";
5393
5394       /**
5395        * Used to require DUN APN on the device or not - defaults to a build config value
5396        * which defaults to false
5397        * @hide
5398        */
5399       public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
5400
5401       /**
5402        * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
5403        * corresponding build config values are set it will override the APN DB
5404        * values.
5405        * Consists of a comma seperated list of strings:
5406        * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
5407        * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
5408        * @hide
5409        */
5410       public static final String TETHER_DUN_APN = "tether_dun_apn";
5411
5412       /**
5413        * The bandwidth throttle polling freqency in seconds
5414        * @hide
5415        */
5416       public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
5417
5418       /**
5419        * The bandwidth throttle threshold (long)
5420        * @hide
5421        */
5422       public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
5423
5424       /**
5425        * The bandwidth throttle value (kbps)
5426        * @hide
5427        */
5428       public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
5429
5430       /**
5431        * The bandwidth throttle reset calendar day (1-28)
5432        * @hide
5433        */
5434       public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
5435
5436       /**
5437        * The throttling notifications we should send
5438        * @hide
5439        */
5440       public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
5441
5442       /**
5443        * Help URI for data throttling policy
5444        * @hide
5445        */
5446       public static final String THROTTLE_HELP_URI = "throttle_help_uri";
5447
5448       /**
5449        * The length of time in Sec that we allow our notion of NTP time
5450        * to be cached before we refresh it
5451        * @hide
5452        */
5453       public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
5454               "throttle_max_ntp_cache_age_sec";
5455
5456       /**
5457        * USB Mass Storage Enabled
5458        */
5459       public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
5460
5461       /**
5462        * If this setting is set (to anything), then all references
5463        * to Gmail on the device must change to Google Mail.
5464        */
5465       public static final String USE_GOOGLE_MAIL = "use_google_mail";
5466
5467       /** Autofill server address (Used in WebView/browser).
5468        * {@hide} */
5469       public static final String WEB_AUTOFILL_QUERY_URL =
5470           "web_autofill_query_url";
5471
5472       /**
5473        * Whether to notify the user of open networks.
5474        * <p>
5475        * If not connected and the scan results have an open network, we will
5476        * put this notification up. If we attempt to connect to a network or
5477        * the open network(s) disappear, we remove the notification. When we
5478        * show the notification, we will not show it again for
5479        * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
5480        */
5481       public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
5482               "wifi_networks_available_notification_on";
5483       /**
5484        * {@hide}
5485        */
5486       public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
5487               "wimax_networks_available_notification_on";
5488
5489       /**
5490        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
5491        * Connecting to a network will reset the timer.
5492        */
5493       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
5494               "wifi_networks_available_repeat_delay";
5495
5496       /**
5497        * 802.11 country code in ISO 3166 format
5498        * @hide
5499        */
5500       public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
5501
5502       /**
5503        * The interval in milliseconds to issue wake up scans when wifi needs
5504        * to connect. This is necessary to connect to an access point when
5505        * device is on the move and the screen is off.
5506        * @hide
5507        */
5508       public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
5509               "wifi_framework_scan_interval_ms";
5510
5511       /**
5512        * The interval in milliseconds after which Wi-Fi is considered idle.
5513        * When idle, it is possible for the device to be switched from Wi-Fi to
5514        * the mobile data network.
5515        * @hide
5516        */
5517       public static final String WIFI_IDLE_MS = "wifi_idle_ms";
5518
5519       /**
5520        * When the number of open networks exceeds this number, the
5521        * least-recently-used excess networks will be removed.
5522        */
5523       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
5524
5525       /**
5526        * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
5527        */
5528       public static final String WIFI_ON = "wifi_on";
5529
5530       /**
5531        * Used to save the Wifi_ON state prior to tethering.
5532        * This state will be checked to restore Wifi after
5533        * the user turns off tethering.
5534        *
5535        * @hide
5536        */
5537       public static final String WIFI_SAVED_STATE = "wifi_saved_state";
5538
5539       /**
5540        * The interval in milliseconds to scan as used by the wifi supplicant
5541        * @hide
5542        */
5543       public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
5544               "wifi_supplicant_scan_interval_ms";
5545
5546       /**
5547        * Whether the Wi-Fi watchdog is enabled.
5548        */
5549       public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
5550
5551       /**
5552        * ms delay interval between rssi polling when the signal is known to be weak
5553        * @hide
5554        */
5555       public static final String WIFI_WATCHDOG_RSSI_FETCH_INTERVAL_MS =
5556               "wifi_watchdog_rssi_fetch_interval_ms";
5557
5558       /**
5559        * Number of ARP pings per check.
5560        * @hide
5561        */
5562       public static final String WIFI_WATCHDOG_NUM_ARP_PINGS = "wifi_watchdog_num_arp_pings";
5563
5564       /**
5565        * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
5566        * the setting needs to be set to 0 to disable it.
5567        * @hide
5568        */
5569       public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
5570               "wifi_watchdog_poor_network_test_enabled";
5571
5572       /**
5573        * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
5574        * needs to be set to 0 to disable it.
5575        * @hide
5576        */
5577       public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
5578               "wifi_suspend_optimizations_enabled";
5579
5580       /**
5581        * The maximum number of times we will retry a connection to an access
5582        * point for which we have failed in acquiring an IP address from DHCP.
5583        * A value of N means that we will make N+1 connection attempts in all.
5584        */
5585       public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
5586
5587       /**
5588        * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
5589        * data connectivity to be established after a disconnect from Wi-Fi.
5590        */
5591       public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
5592           "wifi_mobile_data_transition_wakelock_timeout_ms";
5593
5594       /**
5595        * The operational wifi frequency band
5596        * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
5597        * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
5598        * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
5599        *
5600        * @hide
5601        */
5602       public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
5603
5604       /**
5605        * The Wi-Fi peer-to-peer device name
5606        * @hide
5607        */
5608       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
5609
5610       /**
5611        * The number of milliseconds to delay when checking for data stalls during
5612        * non-aggressive detection. (screen is turned off.)
5613        * @hide
5614        */
5615       public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
5616               "data_stall_alarm_non_aggressive_delay_in_ms";
5617
5618       /**
5619        * The number of milliseconds to delay when checking for data stalls during
5620        * aggressive detection. (screen on or suspected data stall)
5621        * @hide
5622        */
5623       public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
5624               "data_stall_alarm_aggressive_delay_in_ms";
5625
5626       /**
5627        * The interval in milliseconds at which to check gprs registration
5628        * after the first registration mismatch of gprs and voice service,
5629        * to detect possible data network registration problems.
5630        *
5631        * @hide
5632        */
5633       public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
5634               "gprs_register_check_period_ms";
5635
5636       /**
5637        * Nonzero causes Log.wtf() to crash.
5638        * @hide
5639        */
5640       public static final String WTF_IS_FATAL = "wtf_is_fatal";
5641
5642
5643
5644
5645        // Populated lazily, guarded by class object:
5646        private static NameValueCache sNameValueCache = null;
5647
5648        private static void lazyInitCache() {
5649            if (sNameValueCache == null) {
5650                sNameValueCache = new NameValueCache(
5651                        SYS_PROP_SETTING_VERSION,
5652                        CONTENT_URI,
5653                        CALL_METHOD_GET_GLOBAL,
5654                        CALL_METHOD_PUT_GLOBAL);
5655            }
5656        }
5657
5658        /**
5659         * Look up a name in the database.
5660         * @param resolver to access the database with
5661         * @param name to look up in the table
5662         * @return the corresponding value, or null if not present
5663         */
5664        public synchronized static String getString(ContentResolver resolver, String name) {
5665            return getStringForUser(resolver, name, UserHandle.myUserId());
5666        }
5667
5668        /** @hide */
5669        public synchronized static String getStringForUser(ContentResolver resolver, String name,
5670                int userHandle) {
5671            lazyInitCache();
5672            return sNameValueCache.getStringForUser(resolver, name, userHandle);
5673        }
5674
5675        /**
5676         * Store a name/value pair into the database.
5677         * @param resolver to access the database with
5678         * @param name to store
5679         * @param value to associate with the name
5680         * @return true if the value was set, false on database errors
5681         */
5682        public static boolean putString(ContentResolver resolver,
5683                String name, String value) {
5684            return putStringForUser(resolver, name, value, UserHandle.myUserId());
5685        }
5686
5687        /** @hide */
5688        public static boolean putStringForUser(ContentResolver resolver,
5689                String name, String value, int userHandle) {
5690            lazyInitCache();
5691            if (LOCAL_LOGV) {
5692                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
5693                        + " for " + userHandle);
5694            }
5695            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
5696        }
5697
5698        /**
5699         * Construct the content URI for a particular name/value pair,
5700         * useful for monitoring changes with a ContentObserver.
5701         * @param name to look up in the table
5702         * @return the corresponding content URI, or null if not present
5703         */
5704        public static Uri getUriFor(String name) {
5705            return getUriFor(CONTENT_URI, name);
5706        }
5707
5708        /**
5709         * Convenience function for retrieving a single secure settings value
5710         * as an integer.  Note that internally setting values are always
5711         * stored as strings; this function converts the string to an integer
5712         * for you.  The default value will be returned if the setting is
5713         * not defined or not an integer.
5714         *
5715         * @param cr The ContentResolver to access.
5716         * @param name The name of the setting to retrieve.
5717         * @param def Value to return if the setting is not defined.
5718         *
5719         * @return The setting's current value, or 'def' if it is not defined
5720         * or not a valid integer.
5721         */
5722        public static int getInt(ContentResolver cr, String name, int def) {
5723            String v = getString(cr, name);
5724            try {
5725                return v != null ? Integer.parseInt(v) : def;
5726            } catch (NumberFormatException e) {
5727                return def;
5728            }
5729        }
5730
5731        /**
5732         * Convenience function for retrieving a single secure settings value
5733         * as an integer.  Note that internally setting values are always
5734         * stored as strings; this function converts the string to an integer
5735         * for you.
5736         * <p>
5737         * This version does not take a default value.  If the setting has not
5738         * been set, or the string value is not a number,
5739         * it throws {@link SettingNotFoundException}.
5740         *
5741         * @param cr The ContentResolver to access.
5742         * @param name The name of the setting to retrieve.
5743         *
5744         * @throws SettingNotFoundException Thrown if a setting by the given
5745         * name can't be found or the setting value is not an integer.
5746         *
5747         * @return The setting's current value.
5748         */
5749        public static int getInt(ContentResolver cr, String name)
5750                throws SettingNotFoundException {
5751            String v = getString(cr, name);
5752            try {
5753                return Integer.parseInt(v);
5754            } catch (NumberFormatException e) {
5755                throw new SettingNotFoundException(name);
5756            }
5757        }
5758
5759        /**
5760         * Convenience function for updating a single settings value as an
5761         * integer. This will either create a new entry in the table if the
5762         * given name does not exist, or modify the value of the existing row
5763         * with that name.  Note that internally setting values are always
5764         * stored as strings, so this function converts the given value to a
5765         * string before storing it.
5766         *
5767         * @param cr The ContentResolver to access.
5768         * @param name The name of the setting to modify.
5769         * @param value The new value for the setting.
5770         * @return true if the value was set, false on database errors
5771         */
5772        public static boolean putInt(ContentResolver cr, String name, int value) {
5773            return putString(cr, name, Integer.toString(value));
5774        }
5775
5776        /**
5777         * Convenience function for retrieving a single secure settings value
5778         * as a {@code long}.  Note that internally setting values are always
5779         * stored as strings; this function converts the string to a {@code long}
5780         * for you.  The default value will be returned if the setting is
5781         * not defined or not a {@code long}.
5782         *
5783         * @param cr The ContentResolver to access.
5784         * @param name The name of the setting to retrieve.
5785         * @param def Value to return if the setting is not defined.
5786         *
5787         * @return The setting's current value, or 'def' if it is not defined
5788         * or not a valid {@code long}.
5789         */
5790        public static long getLong(ContentResolver cr, String name, long def) {
5791            String valString = getString(cr, name);
5792            long value;
5793            try {
5794                value = valString != null ? Long.parseLong(valString) : def;
5795            } catch (NumberFormatException e) {
5796                value = def;
5797            }
5798            return value;
5799        }
5800
5801        /**
5802         * Convenience function for retrieving a single secure settings value
5803         * as a {@code long}.  Note that internally setting values are always
5804         * stored as strings; this function converts the string to a {@code long}
5805         * for you.
5806         * <p>
5807         * This version does not take a default value.  If the setting has not
5808         * been set, or the string value is not a number,
5809         * it throws {@link SettingNotFoundException}.
5810         *
5811         * @param cr The ContentResolver to access.
5812         * @param name The name of the setting to retrieve.
5813         *
5814         * @return The setting's current value.
5815         * @throws SettingNotFoundException Thrown if a setting by the given
5816         * name can't be found or the setting value is not an integer.
5817         */
5818        public static long getLong(ContentResolver cr, String name)
5819                throws SettingNotFoundException {
5820            String valString = getString(cr, name);
5821            try {
5822                return Long.parseLong(valString);
5823            } catch (NumberFormatException e) {
5824                throw new SettingNotFoundException(name);
5825            }
5826        }
5827
5828        /**
5829         * Convenience function for updating a secure settings value as a long
5830         * integer. This will either create a new entry in the table if the
5831         * given name does not exist, or modify the value of the existing row
5832         * with that name.  Note that internally setting values are always
5833         * stored as strings, so this function converts the given value to a
5834         * string before storing it.
5835         *
5836         * @param cr The ContentResolver to access.
5837         * @param name The name of the setting to modify.
5838         * @param value The new value for the setting.
5839         * @return true if the value was set, false on database errors
5840         */
5841        public static boolean putLong(ContentResolver cr, String name, long value) {
5842            return putString(cr, name, Long.toString(value));
5843        }
5844
5845        /**
5846         * Convenience function for retrieving a single secure settings value
5847         * as a floating point number.  Note that internally setting values are
5848         * always stored as strings; this function converts the string to an
5849         * float for you. The default value will be returned if the setting
5850         * is not defined or not a valid float.
5851         *
5852         * @param cr The ContentResolver to access.
5853         * @param name The name of the setting to retrieve.
5854         * @param def Value to return if the setting is not defined.
5855         *
5856         * @return The setting's current value, or 'def' if it is not defined
5857         * or not a valid float.
5858         */
5859        public static float getFloat(ContentResolver cr, String name, float def) {
5860            String v = getString(cr, name);
5861            try {
5862                return v != null ? Float.parseFloat(v) : def;
5863            } catch (NumberFormatException e) {
5864                return def;
5865            }
5866        }
5867
5868        /**
5869         * Convenience function for retrieving a single secure settings value
5870         * as a float.  Note that internally setting values are always
5871         * stored as strings; this function converts the string to a float
5872         * for you.
5873         * <p>
5874         * This version does not take a default value.  If the setting has not
5875         * been set, or the string value is not a number,
5876         * it throws {@link SettingNotFoundException}.
5877         *
5878         * @param cr The ContentResolver to access.
5879         * @param name The name of the setting to retrieve.
5880         *
5881         * @throws SettingNotFoundException Thrown if a setting by the given
5882         * name can't be found or the setting value is not a float.
5883         *
5884         * @return The setting's current value.
5885         */
5886        public static float getFloat(ContentResolver cr, String name)
5887                throws SettingNotFoundException {
5888            String v = getString(cr, name);
5889            if (v == null) {
5890                throw new SettingNotFoundException(name);
5891            }
5892            try {
5893                return Float.parseFloat(v);
5894            } catch (NumberFormatException e) {
5895                throw new SettingNotFoundException(name);
5896            }
5897        }
5898
5899        /**
5900         * Convenience function for updating a single settings value as a
5901         * floating point number. This will either create a new entry in the
5902         * table if the given name does not exist, or modify the value of the
5903         * existing row with that name.  Note that internally setting values
5904         * are always stored as strings, so this function converts the given
5905         * value to a string before storing it.
5906         *
5907         * @param cr The ContentResolver to access.
5908         * @param name The name of the setting to modify.
5909         * @param value The new value for the setting.
5910         * @return true if the value was set, false on database errors
5911         */
5912        public static boolean putFloat(ContentResolver cr, String name, float value) {
5913            return putString(cr, name, Float.toString(value));
5914        }
5915    }
5916
5917    /**
5918     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
5919     * Intent URL, allowing it to be either a web page or a particular
5920     * application activity.
5921     *
5922     * @hide
5923     */
5924    public static final class Bookmarks implements BaseColumns
5925    {
5926        private static final String TAG = "Bookmarks";
5927
5928        /**
5929         * The content:// style URL for this table
5930         */
5931        public static final Uri CONTENT_URI =
5932            Uri.parse("content://" + AUTHORITY + "/bookmarks");
5933
5934        /**
5935         * The row ID.
5936         * <p>Type: INTEGER</p>
5937         */
5938        public static final String ID = "_id";
5939
5940        /**
5941         * Descriptive name of the bookmark that can be displayed to the user.
5942         * If this is empty, the title should be resolved at display time (use
5943         * {@link #getTitle(Context, Cursor)} any time you want to display the
5944         * title of a bookmark.)
5945         * <P>
5946         * Type: TEXT
5947         * </P>
5948         */
5949        public static final String TITLE = "title";
5950
5951        /**
5952         * Arbitrary string (displayed to the user) that allows bookmarks to be
5953         * organized into categories.  There are some special names for
5954         * standard folders, which all start with '@'.  The label displayed for
5955         * the folder changes with the locale (via {@link #getLabelForFolder}) but
5956         * the folder name does not change so you can consistently query for
5957         * the folder regardless of the current locale.
5958         *
5959         * <P>Type: TEXT</P>
5960         *
5961         */
5962        public static final String FOLDER = "folder";
5963
5964        /**
5965         * The Intent URL of the bookmark, describing what it points to.  This
5966         * value is given to {@link android.content.Intent#getIntent} to create
5967         * an Intent that can be launched.
5968         * <P>Type: TEXT</P>
5969         */
5970        public static final String INTENT = "intent";
5971
5972        /**
5973         * Optional shortcut character associated with this bookmark.
5974         * <P>Type: INTEGER</P>
5975         */
5976        public static final String SHORTCUT = "shortcut";
5977
5978        /**
5979         * The order in which the bookmark should be displayed
5980         * <P>Type: INTEGER</P>
5981         */
5982        public static final String ORDERING = "ordering";
5983
5984        private static final String[] sIntentProjection = { INTENT };
5985        private static final String[] sShortcutProjection = { ID, SHORTCUT };
5986        private static final String sShortcutSelection = SHORTCUT + "=?";
5987
5988        /**
5989         * Convenience function to retrieve the bookmarked Intent for a
5990         * particular shortcut key.
5991         *
5992         * @param cr The ContentResolver to query.
5993         * @param shortcut The shortcut key.
5994         *
5995         * @return Intent The bookmarked URL, or null if there is no bookmark
5996         *         matching the given shortcut.
5997         */
5998        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
5999        {
6000            Intent intent = null;
6001
6002            Cursor c = cr.query(CONTENT_URI,
6003                    sIntentProjection, sShortcutSelection,
6004                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
6005            // Keep trying until we find a valid shortcut
6006            try {
6007                while (intent == null && c.moveToNext()) {
6008                    try {
6009                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
6010                        intent = Intent.parseUri(intentURI, 0);
6011                    } catch (java.net.URISyntaxException e) {
6012                        // The stored URL is bad...  ignore it.
6013                    } catch (IllegalArgumentException e) {
6014                        // Column not found
6015                        Log.w(TAG, "Intent column not found", e);
6016                    }
6017                }
6018            } finally {
6019                if (c != null) c.close();
6020            }
6021
6022            return intent;
6023        }
6024
6025        /**
6026         * Add a new bookmark to the system.
6027         *
6028         * @param cr The ContentResolver to query.
6029         * @param intent The desired target of the bookmark.
6030         * @param title Bookmark title that is shown to the user; null if none
6031         *            or it should be resolved to the intent's title.
6032         * @param folder Folder in which to place the bookmark; null if none.
6033         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
6034         *            this is non-zero and there is an existing bookmark entry
6035         *            with this same shortcut, then that existing shortcut is
6036         *            cleared (the bookmark is not removed).
6037         * @return The unique content URL for the new bookmark entry.
6038         */
6039        public static Uri add(ContentResolver cr,
6040                                           Intent intent,
6041                                           String title,
6042                                           String folder,
6043                                           char shortcut,
6044                                           int ordering)
6045        {
6046            // If a shortcut is supplied, and it is already defined for
6047            // another bookmark, then remove the old definition.
6048            if (shortcut != 0) {
6049                cr.delete(CONTENT_URI, sShortcutSelection,
6050                        new String[] { String.valueOf((int) shortcut) });
6051            }
6052
6053            ContentValues values = new ContentValues();
6054            if (title != null) values.put(TITLE, title);
6055            if (folder != null) values.put(FOLDER, folder);
6056            values.put(INTENT, intent.toUri(0));
6057            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
6058            values.put(ORDERING, ordering);
6059            return cr.insert(CONTENT_URI, values);
6060        }
6061
6062        /**
6063         * Return the folder name as it should be displayed to the user.  This
6064         * takes care of localizing special folders.
6065         *
6066         * @param r Resources object for current locale; only need access to
6067         *          system resources.
6068         * @param folder The value found in the {@link #FOLDER} column.
6069         *
6070         * @return CharSequence The label for this folder that should be shown
6071         *         to the user.
6072         */
6073        public static CharSequence getLabelForFolder(Resources r, String folder) {
6074            return folder;
6075        }
6076
6077        /**
6078         * Return the title as it should be displayed to the user. This takes
6079         * care of localizing bookmarks that point to activities.
6080         *
6081         * @param context A context.
6082         * @param cursor A cursor pointing to the row whose title should be
6083         *        returned. The cursor must contain at least the {@link #TITLE}
6084         *        and {@link #INTENT} columns.
6085         * @return A title that is localized and can be displayed to the user,
6086         *         or the empty string if one could not be found.
6087         */
6088        public static CharSequence getTitle(Context context, Cursor cursor) {
6089            int titleColumn = cursor.getColumnIndex(TITLE);
6090            int intentColumn = cursor.getColumnIndex(INTENT);
6091            if (titleColumn == -1 || intentColumn == -1) {
6092                throw new IllegalArgumentException(
6093                        "The cursor must contain the TITLE and INTENT columns.");
6094            }
6095
6096            String title = cursor.getString(titleColumn);
6097            if (!TextUtils.isEmpty(title)) {
6098                return title;
6099            }
6100
6101            String intentUri = cursor.getString(intentColumn);
6102            if (TextUtils.isEmpty(intentUri)) {
6103                return "";
6104            }
6105
6106            Intent intent;
6107            try {
6108                intent = Intent.parseUri(intentUri, 0);
6109            } catch (URISyntaxException e) {
6110                return "";
6111            }
6112
6113            PackageManager packageManager = context.getPackageManager();
6114            ResolveInfo info = packageManager.resolveActivity(intent, 0);
6115            return info != null ? info.loadLabel(packageManager) : "";
6116        }
6117    }
6118
6119    /**
6120     * Returns the device ID that we should use when connecting to the mobile gtalk server.
6121     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
6122     * from the GoogleLoginService.
6123     *
6124     * @param androidId The Android ID for this device.
6125     * @return The device ID that should be used when connecting to the mobile gtalk server.
6126     * @hide
6127     */
6128    public static String getGTalkDeviceId(long androidId) {
6129        return "android-" + Long.toHexString(androidId);
6130    }
6131}
6132