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