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