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