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