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