Settings.java revision 9999c1d97730e33751ae5a94331797d6850701c6
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
19
20
21import android.annotation.SdkConstant;
22import android.annotation.SdkConstant.SdkConstantType;
23import android.app.SearchManager;
24import android.content.ComponentName;
25import android.content.ContentResolver;
26import android.content.ContentValues;
27import android.content.Context;
28import android.content.IContentProvider;
29import android.content.Intent;
30import android.content.pm.ActivityInfo;
31import android.content.pm.PackageManager;
32import android.content.pm.ResolveInfo;
33import android.content.res.Configuration;
34import android.content.res.Resources;
35import android.database.Cursor;
36import android.database.SQLException;
37import android.net.Uri;
38import android.net.wifi.WifiManager;
39import android.os.BatteryManager;
40import android.os.Bundle;
41import android.os.RemoteException;
42import android.os.SystemProperties;
43import android.text.TextUtils;
44import android.util.AndroidException;
45import android.util.Log;
46
47import java.net.URISyntaxException;
48import java.util.HashMap;
49import java.util.HashSet;
50
51
52/**
53 * The Settings provider contains global system-level device preferences.
54 */
55public final class Settings {
56
57    // Intent actions for Settings
58
59    /**
60     * Activity Action: Show system settings.
61     * <p>
62     * Input: Nothing.
63     * <p>
64     * Output: nothing.
65     */
66    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
67    public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
68
69    /**
70     * Activity Action: Show settings to allow configuration of APNs.
71     * <p>
72     * Input: Nothing.
73     * <p>
74     * Output: nothing.
75     */
76    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
77    public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
78
79    /**
80     * Activity Action: Show settings to allow configuration of current location
81     * sources.
82     * <p>
83     * In some cases, a matching Activity may not exist, so ensure you
84     * safeguard against this.
85     * <p>
86     * Input: Nothing.
87     * <p>
88     * Output: Nothing.
89     */
90    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
91    public static final String ACTION_LOCATION_SOURCE_SETTINGS =
92            "android.settings.LOCATION_SOURCE_SETTINGS";
93
94    /**
95     * Activity Action: Show settings to allow configuration of wireless controls
96     * such as Wi-Fi, Bluetooth and Mobile networks.
97     * <p>
98     * In some cases, a matching Activity may not exist, so ensure you
99     * safeguard against this.
100     * <p>
101     * Input: Nothing.
102     * <p>
103     * Output: Nothing.
104     */
105    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
106    public static final String ACTION_WIRELESS_SETTINGS =
107            "android.settings.WIRELESS_SETTINGS";
108
109    /**
110     * Activity Action: Show settings to allow entering/exiting airplane mode.
111     * <p>
112     * In some cases, a matching Activity may not exist, so ensure you
113     * safeguard against this.
114     * <p>
115     * Input: Nothing.
116     * <p>
117     * Output: Nothing.
118     */
119    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
120    public static final String ACTION_AIRPLANE_MODE_SETTINGS =
121            "android.settings.AIRPLANE_MODE_SETTINGS";
122
123    /**
124     * Activity Action: Show settings for accessibility modules.
125     * <p>
126     * In some cases, a matching Activity may not exist, so ensure you
127     * safeguard against this.
128     * <p>
129     * Input: Nothing.
130     * <p>
131     * Output: Nothing.
132     */
133    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
134    public static final String ACTION_ACCESSIBILITY_SETTINGS =
135            "android.settings.ACCESSIBILITY_SETTINGS";
136
137    /**
138     * Activity Action: Show settings to allow configuration of security and
139     * location privacy.
140     * <p>
141     * In some cases, a matching Activity may not exist, so ensure you
142     * safeguard against this.
143     * <p>
144     * Input: Nothing.
145     * <p>
146     * Output: Nothing.
147     */
148    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
149    public static final String ACTION_SECURITY_SETTINGS =
150            "android.settings.SECURITY_SETTINGS";
151
152    /**
153     * Activity Action: Show settings to allow configuration of privacy options.
154     * <p>
155     * In some cases, a matching Activity may not exist, so ensure you
156     * safeguard against this.
157     * <p>
158     * Input: Nothing.
159     * <p>
160     * Output: Nothing.
161     */
162    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
163    public static final String ACTION_PRIVACY_SETTINGS =
164            "android.settings.PRIVACY_SETTINGS";
165
166    /**
167     * Activity Action: Show settings to allow configuration of Wi-Fi.
168
169     * <p>
170     * In some cases, a matching Activity may not exist, so ensure you
171     * safeguard against this.
172     * <p>
173     * Input: Nothing.
174     * <p>
175     * Output: Nothing.
176
177     */
178    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
179    public static final String ACTION_WIFI_SETTINGS =
180            "android.settings.WIFI_SETTINGS";
181
182    /**
183     * Activity Action: Show settings to allow configuration of a static IP
184     * address for Wi-Fi.
185     * <p>
186     * In some cases, a matching Activity may not exist, so ensure you safeguard
187     * against this.
188     * <p>
189     * Input: Nothing.
190     * <p>
191     * Output: Nothing.
192     */
193    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
194    public static final String ACTION_WIFI_IP_SETTINGS =
195            "android.settings.WIFI_IP_SETTINGS";
196
197    /**
198     * Activity Action: Show settings to allow configuration of Bluetooth.
199     * <p>
200     * In some cases, a matching Activity may not exist, so ensure you
201     * safeguard against this.
202     * <p>
203     * Input: Nothing.
204     * <p>
205     * Output: Nothing.
206     */
207    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
208    public static final String ACTION_BLUETOOTH_SETTINGS =
209            "android.settings.BLUETOOTH_SETTINGS";
210
211    /**
212     * Activity Action: Show settings to allow configuration of date and time.
213     * <p>
214     * In some cases, a matching Activity may not exist, so ensure you
215     * safeguard against this.
216     * <p>
217     * Input: Nothing.
218     * <p>
219     * Output: Nothing.
220     */
221    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
222    public static final String ACTION_DATE_SETTINGS =
223            "android.settings.DATE_SETTINGS";
224
225    /**
226     * Activity Action: Show settings to allow configuration of sound and volume.
227     * <p>
228     * In some cases, a matching Activity may not exist, so ensure you
229     * safeguard against this.
230     * <p>
231     * Input: Nothing.
232     * <p>
233     * Output: Nothing.
234     */
235    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
236    public static final String ACTION_SOUND_SETTINGS =
237            "android.settings.SOUND_SETTINGS";
238
239    /**
240     * Activity Action: Show settings to allow configuration of display.
241     * <p>
242     * In some cases, a matching Activity may not exist, so ensure you
243     * safeguard against this.
244     * <p>
245     * Input: Nothing.
246     * <p>
247     * Output: Nothing.
248     */
249    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
250    public static final String ACTION_DISPLAY_SETTINGS =
251            "android.settings.DISPLAY_SETTINGS";
252
253    /**
254     * Activity Action: Show settings to allow configuration of locale.
255     * <p>
256     * In some cases, a matching Activity may not exist, so ensure you
257     * safeguard against this.
258     * <p>
259     * Input: Nothing.
260     * <p>
261     * Output: Nothing.
262     */
263    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
264    public static final String ACTION_LOCALE_SETTINGS =
265            "android.settings.LOCALE_SETTINGS";
266
267    /**
268     * Activity Action: Show settings to configure input methods, in particular
269     * allowing the user to enable input methods.
270     * <p>
271     * In some cases, a matching Activity may not exist, so ensure you
272     * safeguard against this.
273     * <p>
274     * Input: Nothing.
275     * <p>
276     * Output: Nothing.
277     */
278    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
279    public static final String ACTION_INPUT_METHOD_SETTINGS =
280            "android.settings.INPUT_METHOD_SETTINGS";
281
282    /**
283     * Activity Action: Show settings to enable/disable input method subtypes.
284     * <p>
285     * In some cases, a matching Activity may not exist, so ensure you
286     * safeguard against this.
287     * <p>
288     * To tell which input method's subtypes are displayed in the settings, add
289     * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
290     * If there is no extra in this Intent, subtypes from all installed input methods
291     * will be displayed in the settings.
292     *
293     * @see android.view.inputmethod.InputMethodInfo#getId
294     * <p>
295     * Input: Nothing.
296     * <p>
297     * Output: Nothing.
298     */
299    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
300    public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
301            "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
302
303    /**
304     * Activity Action: Show a dialog to select input method.
305     * <p>
306     * In some cases, a matching Activity may not exist, so ensure you
307     * safeguard against this.
308     * <p>
309     * Input: Nothing.
310     * <p>
311     * Output: Nothing.
312     * @hide
313     */
314    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
315    public static final String ACTION_SHOW_INPUT_METHOD_PICKER =
316            "android.settings.SHOW_INPUT_METHOD_PICKER";
317
318    /**
319     * Activity Action: Show settings to manage the user input dictionary.
320     * <p>
321     * In some cases, a matching Activity may not exist, so ensure you
322     * safeguard against this.
323     * <p>
324     * Input: Nothing.
325     * <p>
326     * Output: Nothing.
327     */
328    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
329    public static final String ACTION_USER_DICTIONARY_SETTINGS =
330            "android.settings.USER_DICTIONARY_SETTINGS";
331
332    /**
333     * Activity Action: Show settings to allow configuration of application-related settings.
334     * <p>
335     * In some cases, a matching Activity may not exist, so ensure you
336     * safeguard against this.
337     * <p>
338     * Input: Nothing.
339     * <p>
340     * Output: Nothing.
341     */
342    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
343    public static final String ACTION_APPLICATION_SETTINGS =
344            "android.settings.APPLICATION_SETTINGS";
345
346    /**
347     * Activity Action: Show settings to allow configuration of application
348     * development-related settings.
349     * <p>
350     * In some cases, a matching Activity may not exist, so ensure you safeguard
351     * against this.
352     * <p>
353     * Input: Nothing.
354     * <p>
355     * Output: Nothing.
356     */
357    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
358    public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
359            "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
360
361    /**
362     * Activity Action: Show settings to allow configuration of quick launch shortcuts.
363     * <p>
364     * In some cases, a matching Activity may not exist, so ensure you
365     * safeguard against this.
366     * <p>
367     * Input: Nothing.
368     * <p>
369     * Output: Nothing.
370     */
371    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
372    public static final String ACTION_QUICK_LAUNCH_SETTINGS =
373            "android.settings.QUICK_LAUNCH_SETTINGS";
374
375    /**
376     * Activity Action: Show settings to manage installed applications.
377     * <p>
378     * In some cases, a matching Activity may not exist, so ensure you
379     * safeguard against this.
380     * <p>
381     * Input: Nothing.
382     * <p>
383     * Output: Nothing.
384     */
385    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
386    public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
387            "android.settings.MANAGE_APPLICATIONS_SETTINGS";
388
389    /**
390     * Activity Action: Show settings to manage all applications.
391     * <p>
392     * In some cases, a matching Activity may not exist, so ensure you
393     * safeguard against this.
394     * <p>
395     * Input: Nothing.
396     * <p>
397     * Output: Nothing.
398     */
399    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
400    public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
401            "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
402
403    /**
404     * Activity Action: Show screen of details about a particular application.
405     * <p>
406     * In some cases, a matching Activity may not exist, so ensure you
407     * safeguard against this.
408     * <p>
409     * Input: The Intent's data URI specifies the application package name
410     * to be shown, with the "package" scheme.  That is "package:com.my.app".
411     * <p>
412     * Output: Nothing.
413     */
414    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
415    public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
416            "android.settings.APPLICATION_DETAILS_SETTINGS";
417
418    /**
419     * Activity Action: Show settings for system update functionality.
420     * <p>
421     * In some cases, a matching Activity may not exist, so ensure you
422     * safeguard against this.
423     * <p>
424     * Input: Nothing.
425     * <p>
426     * Output: Nothing.
427     *
428     * @hide
429     */
430    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
431    public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
432            "android.settings.SYSTEM_UPDATE_SETTINGS";
433
434    /**
435     * Activity Action: Show settings to allow configuration of sync settings.
436     * <p>
437     * In some cases, a matching Activity may not exist, so ensure you
438     * safeguard against this.
439     * <p>
440     * The account types available to add via the add account button may be restricted by adding an
441     * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
442     * authorities. Only account types which can sync with that content provider will be offered to
443     * the user.
444     * <p>
445     * Input: Nothing.
446     * <p>
447     * Output: Nothing.
448     */
449    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
450    public static final String ACTION_SYNC_SETTINGS =
451            "android.settings.SYNC_SETTINGS";
452
453    /**
454     * Activity Action: Show add account screen for creating a new account.
455     * <p>
456     * In some cases, a matching Activity may not exist, so ensure you
457     * safeguard against this.
458     * <p>
459     * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
460     * extra to the Intent with one or more syncable content provider's authorities.  Only account
461     * types which can sync with that content provider will be offered to the user.
462     * <p>
463     * Input: Nothing.
464     * <p>
465     * Output: Nothing.
466     */
467    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
468    public static final String ACTION_ADD_ACCOUNT =
469            "android.settings.ADD_ACCOUNT_SETTINGS";
470
471    /**
472     * Activity Action: Show settings for selecting the network operator.
473     * <p>
474     * In some cases, a matching Activity may not exist, so ensure you
475     * safeguard against this.
476     * <p>
477     * Input: Nothing.
478     * <p>
479     * Output: Nothing.
480     */
481    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
482    public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
483            "android.settings.NETWORK_OPERATOR_SETTINGS";
484
485    /**
486     * Activity Action: Show settings for selection of 2G/3G.
487     * <p>
488     * In some cases, a matching Activity may not exist, so ensure you
489     * safeguard against this.
490     * <p>
491     * Input: Nothing.
492     * <p>
493     * Output: Nothing.
494     */
495    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
496    public static final String ACTION_DATA_ROAMING_SETTINGS =
497            "android.settings.DATA_ROAMING_SETTINGS";
498
499    /**
500     * Activity Action: Show settings for internal storage.
501     * <p>
502     * In some cases, a matching Activity may not exist, so ensure you
503     * safeguard against this.
504     * <p>
505     * Input: Nothing.
506     * <p>
507     * Output: Nothing.
508     */
509    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
510    public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
511            "android.settings.INTERNAL_STORAGE_SETTINGS";
512    /**
513     * Activity Action: Show settings for memory card storage.
514     * <p>
515     * In some cases, a matching Activity may not exist, so ensure you
516     * safeguard against this.
517     * <p>
518     * Input: Nothing.
519     * <p>
520     * Output: Nothing.
521     */
522    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
523    public static final String ACTION_MEMORY_CARD_SETTINGS =
524            "android.settings.MEMORY_CARD_SETTINGS";
525
526    /**
527     * Activity Action: Show settings for global search.
528     * <p>
529     * In some cases, a matching Activity may not exist, so ensure you
530     * safeguard against this.
531     * <p>
532     * Input: Nothing.
533     * <p>
534     * Output: Nothing
535     */
536    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
537    public static final String ACTION_SEARCH_SETTINGS =
538        "android.search.action.SEARCH_SETTINGS";
539
540    /**
541     * Activity Action: Show general device information settings (serial
542     * number, software version, phone number, etc.).
543     * <p>
544     * In some cases, a matching Activity may not exist, so ensure you
545     * safeguard against this.
546     * <p>
547     * Input: Nothing.
548     * <p>
549     * Output: Nothing
550     */
551    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
552    public static final String ACTION_DEVICE_INFO_SETTINGS =
553        "android.settings.DEVICE_INFO_SETTINGS";
554
555    // End of Intent actions for Settings
556
557    /**
558     * @hide - Private call() method on SettingsProvider to read from 'system' table.
559     */
560    public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
561
562    /**
563     * @hide - Private call() method on SettingsProvider to read from 'secure' table.
564     */
565    public static final String CALL_METHOD_GET_SECURE = "GET_secure";
566
567    /**
568     * Activity Extra: Limit available options in launched activity based on the given authority.
569     * <p>
570     * This can be passed as an extra field in an Activity Intent with one or more syncable content
571     * provider's authorities as a String[]. This field is used by some intents to alter the
572     * behavior of the called activity.
573     * <p>
574     * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
575     * on the authority given.
576     */
577    public static final String EXTRA_AUTHORITIES =
578            "authorities";
579
580    public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
581
582    private static final String JID_RESOURCE_PREFIX = "android";
583
584    public static final String AUTHORITY = "settings";
585
586    private static final String TAG = "Settings";
587    private static final boolean LOCAL_LOGV = false || false;
588
589    public static class SettingNotFoundException extends AndroidException {
590        public SettingNotFoundException(String msg) {
591            super(msg);
592        }
593    }
594
595    /**
596     * Common base for tables of name/value settings.
597     */
598    public static class NameValueTable implements BaseColumns {
599        public static final String NAME = "name";
600        public static final String VALUE = "value";
601
602        protected static boolean putString(ContentResolver resolver, Uri uri,
603                String name, String value) {
604            // The database will take care of replacing duplicates.
605            try {
606                ContentValues values = new ContentValues();
607                values.put(NAME, name);
608                values.put(VALUE, value);
609                resolver.insert(uri, values);
610                return true;
611            } catch (SQLException e) {
612                Log.w(TAG, "Can't set key " + name + " in " + uri, e);
613                return false;
614            }
615        }
616
617        public static Uri getUriFor(Uri uri, String name) {
618            return Uri.withAppendedPath(uri, name);
619        }
620    }
621
622    // Thread-safe.
623    private static class NameValueCache {
624        private final String mVersionSystemProperty;
625        private final Uri mUri;
626
627        private static final String[] SELECT_VALUE =
628            new String[] { Settings.NameValueTable.VALUE };
629        private static final String NAME_EQ_PLACEHOLDER = "name=?";
630
631        // Must synchronize on 'this' to access mValues and mValuesVersion.
632        private final HashMap<String, String> mValues = new HashMap<String, String>();
633        private long mValuesVersion = 0;
634
635        // Initially null; set lazily and held forever.  Synchronized on 'this'.
636        private IContentProvider mContentProvider = null;
637
638        // The method we'll call (or null, to not use) on the provider
639        // for the fast path of retrieving settings.
640        private final String mCallCommand;
641
642        public NameValueCache(String versionSystemProperty, Uri uri, String callCommand) {
643            mVersionSystemProperty = versionSystemProperty;
644            mUri = uri;
645            mCallCommand = callCommand;
646        }
647
648        public String getString(ContentResolver cr, String name) {
649            long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
650
651            synchronized (this) {
652                if (mValuesVersion != newValuesVersion) {
653                    if (LOCAL_LOGV) {
654                        Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
655                                newValuesVersion + " != cached " + mValuesVersion);
656                    }
657
658                    mValues.clear();
659                    mValuesVersion = newValuesVersion;
660                }
661
662                if (mValues.containsKey(name)) {
663                    return mValues.get(name);  // Could be null, that's OK -- negative caching
664                }
665            }
666
667            IContentProvider cp = null;
668            synchronized (this) {
669                cp = mContentProvider;
670                if (cp == null) {
671                    cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
672                }
673            }
674
675            // Try the fast path first, not using query().  If this
676            // fails (alternate Settings provider that doesn't support
677            // this interface?) then we fall back to the query/table
678            // interface.
679            if (mCallCommand != null) {
680                try {
681                    Bundle b = cp.call(mCallCommand, name, null);
682                    if (b != null) {
683                        String value = b.getPairValue();
684                        synchronized (this) {
685                            mValues.put(name, value);
686                        }
687                        return value;
688                    }
689                    // If the response Bundle is null, we fall through
690                    // to the query interface below.
691                } catch (RemoteException e) {
692                    // Not supported by the remote side?  Fall through
693                    // to query().
694                }
695            }
696
697            Cursor c = null;
698            try {
699                c = cp.query(mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
700                             new String[]{name}, null);
701                if (c == null) {
702                    Log.w(TAG, "Can't get key " + name + " from " + mUri);
703                    return null;
704                }
705
706                String value = c.moveToNext() ? c.getString(0) : null;
707                synchronized (this) {
708                    mValues.put(name, value);
709                }
710                if (LOCAL_LOGV) {
711                    Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
712                            name + " = " + (value == null ? "(null)" : value));
713                }
714                return value;
715            } catch (RemoteException e) {
716                Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
717                return null;  // Return null, but don't cache it.
718            } finally {
719                if (c != null) c.close();
720            }
721        }
722    }
723
724    /**
725     * System settings, containing miscellaneous system preferences.  This
726     * table holds simple name/value pairs.  There are convenience
727     * functions for accessing individual settings entries.
728     */
729    public static final class System extends NameValueTable {
730        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
731
732        // Populated lazily, guarded by class object:
733        private static NameValueCache sNameValueCache = null;
734
735        private static final HashSet<String> MOVED_TO_SECURE;
736        static {
737            MOVED_TO_SECURE = new HashSet<String>(30);
738            MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
739            MOVED_TO_SECURE.add(Secure.ANDROID_ID);
740            MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
741            MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
742            MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
743            MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
744            MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
745            MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
746            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
747            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
748            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
749            MOVED_TO_SECURE.add(Secure.LOGGING_ID);
750            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
751            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
752            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
753            MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
754            MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
755            MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
756            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
757            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
758            MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
759            MOVED_TO_SECURE.add(Secure.WIFI_ON);
760            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
761            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
762            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
763            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
764            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
765            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
766            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
767            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
768            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
769            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
770            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
771        }
772
773        /**
774         * Look up a name in the database.
775         * @param resolver to access the database with
776         * @param name to look up in the table
777         * @return the corresponding value, or null if not present
778         */
779        public synchronized static String getString(ContentResolver resolver, String name) {
780            if (MOVED_TO_SECURE.contains(name)) {
781                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
782                        + " to android.provider.Settings.Secure, returning read-only value.");
783                return Secure.getString(resolver, name);
784            }
785            if (sNameValueCache == null) {
786                sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
787                                                     CALL_METHOD_GET_SYSTEM);
788            }
789            return sNameValueCache.getString(resolver, name);
790        }
791
792        /**
793         * Store a name/value pair into the database.
794         * @param resolver to access the database with
795         * @param name to store
796         * @param value to associate with the name
797         * @return true if the value was set, false on database errors
798         */
799        public static boolean putString(ContentResolver resolver, String name, String value) {
800            if (MOVED_TO_SECURE.contains(name)) {
801                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
802                        + " to android.provider.Settings.Secure, value is unchanged.");
803                return false;
804            }
805            return putString(resolver, CONTENT_URI, name, value);
806        }
807
808        /**
809         * Construct the content URI for a particular name/value pair,
810         * useful for monitoring changes with a ContentObserver.
811         * @param name to look up in the table
812         * @return the corresponding content URI, or null if not present
813         */
814        public static Uri getUriFor(String name) {
815            if (MOVED_TO_SECURE.contains(name)) {
816                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
817                    + " to android.provider.Settings.Secure, returning Secure URI.");
818                return Secure.getUriFor(Secure.CONTENT_URI, name);
819            }
820            return getUriFor(CONTENT_URI, name);
821        }
822
823        /**
824         * Convenience function for retrieving a single system settings value
825         * as an integer.  Note that internally setting values are always
826         * stored as strings; this function converts the string to an integer
827         * for you.  The default value will be returned if the setting is
828         * not defined or not an integer.
829         *
830         * @param cr The ContentResolver to access.
831         * @param name The name of the setting to retrieve.
832         * @param def Value to return if the setting is not defined.
833         *
834         * @return The setting's current value, or 'def' if it is not defined
835         * or not a valid integer.
836         */
837        public static int getInt(ContentResolver cr, String name, int def) {
838            String v = getString(cr, name);
839            try {
840                return v != null ? Integer.parseInt(v) : def;
841            } catch (NumberFormatException e) {
842                return def;
843            }
844        }
845
846        /**
847         * Convenience function for retrieving a single system settings value
848         * as an integer.  Note that internally setting values are always
849         * stored as strings; this function converts the string to an integer
850         * for you.
851         * <p>
852         * This version does not take a default value.  If the setting has not
853         * been set, or the string value is not a number,
854         * it throws {@link SettingNotFoundException}.
855         *
856         * @param cr The ContentResolver to access.
857         * @param name The name of the setting to retrieve.
858         *
859         * @throws SettingNotFoundException Thrown if a setting by the given
860         * name can't be found or the setting value is not an integer.
861         *
862         * @return The setting's current value.
863         */
864        public static int getInt(ContentResolver cr, String name)
865                throws SettingNotFoundException {
866            String v = getString(cr, name);
867            try {
868                return Integer.parseInt(v);
869            } catch (NumberFormatException e) {
870                throw new SettingNotFoundException(name);
871            }
872        }
873
874        /**
875         * Convenience function for updating a single settings value as an
876         * integer. This will either create a new entry in the table if the
877         * given name does not exist, or modify the value of the existing row
878         * with that name.  Note that internally setting values are always
879         * stored as strings, so this function converts the given value to a
880         * string before storing it.
881         *
882         * @param cr The ContentResolver to access.
883         * @param name The name of the setting to modify.
884         * @param value The new value for the setting.
885         * @return true if the value was set, false on database errors
886         */
887        public static boolean putInt(ContentResolver cr, String name, int value) {
888            return putString(cr, name, Integer.toString(value));
889        }
890
891        /**
892         * Convenience function for retrieving a single system settings value
893         * as a {@code long}.  Note that internally setting values are always
894         * stored as strings; this function converts the string to a {@code long}
895         * for you.  The default value will be returned if the setting is
896         * not defined or not a {@code long}.
897         *
898         * @param cr The ContentResolver to access.
899         * @param name The name of the setting to retrieve.
900         * @param def Value to return if the setting is not defined.
901         *
902         * @return The setting's current value, or 'def' if it is not defined
903         * or not a valid {@code long}.
904         */
905        public static long getLong(ContentResolver cr, String name, long def) {
906            String valString = getString(cr, name);
907            long value;
908            try {
909                value = valString != null ? Long.parseLong(valString) : def;
910            } catch (NumberFormatException e) {
911                value = def;
912            }
913            return value;
914        }
915
916        /**
917         * Convenience function for retrieving a single system settings value
918         * as a {@code long}.  Note that internally setting values are always
919         * stored as strings; this function converts the string to a {@code long}
920         * for you.
921         * <p>
922         * This version does not take a default value.  If the setting has not
923         * been set, or the string value is not a number,
924         * it throws {@link SettingNotFoundException}.
925         *
926         * @param cr The ContentResolver to access.
927         * @param name The name of the setting to retrieve.
928         *
929         * @return The setting's current value.
930         * @throws SettingNotFoundException Thrown if a setting by the given
931         * name can't be found or the setting value is not an integer.
932         */
933        public static long getLong(ContentResolver cr, String name)
934                throws SettingNotFoundException {
935            String valString = getString(cr, name);
936            try {
937                return Long.parseLong(valString);
938            } catch (NumberFormatException e) {
939                throw new SettingNotFoundException(name);
940            }
941        }
942
943        /**
944         * Convenience function for updating a single settings value as a long
945         * integer. This will either create a new entry in the table if the
946         * given name does not exist, or modify the value of the existing row
947         * with that name.  Note that internally setting values are always
948         * stored as strings, so this function converts the given value to a
949         * string before storing it.
950         *
951         * @param cr The ContentResolver to access.
952         * @param name The name of the setting to modify.
953         * @param value The new value for the setting.
954         * @return true if the value was set, false on database errors
955         */
956        public static boolean putLong(ContentResolver cr, String name, long value) {
957            return putString(cr, name, Long.toString(value));
958        }
959
960        /**
961         * Convenience function for retrieving a single system settings value
962         * as a floating point number.  Note that internally setting values are
963         * always stored as strings; this function converts the string to an
964         * float for you. The default value will be returned if the setting
965         * is not defined or not a valid float.
966         *
967         * @param cr The ContentResolver to access.
968         * @param name The name of the setting to retrieve.
969         * @param def Value to return if the setting is not defined.
970         *
971         * @return The setting's current value, or 'def' if it is not defined
972         * or not a valid float.
973         */
974        public static float getFloat(ContentResolver cr, String name, float def) {
975            String v = getString(cr, name);
976            try {
977                return v != null ? Float.parseFloat(v) : def;
978            } catch (NumberFormatException e) {
979                return def;
980            }
981        }
982
983        /**
984         * Convenience function for retrieving a single system settings value
985         * as a float.  Note that internally setting values are always
986         * stored as strings; this function converts the string to a float
987         * for you.
988         * <p>
989         * This version does not take a default value.  If the setting has not
990         * been set, or the string value is not a number,
991         * it throws {@link SettingNotFoundException}.
992         *
993         * @param cr The ContentResolver to access.
994         * @param name The name of the setting to retrieve.
995         *
996         * @throws SettingNotFoundException Thrown if a setting by the given
997         * name can't be found or the setting value is not a float.
998         *
999         * @return The setting's current value.
1000         */
1001        public static float getFloat(ContentResolver cr, String name)
1002                throws SettingNotFoundException {
1003            String v = getString(cr, name);
1004            if (v == null) {
1005                throw new SettingNotFoundException(name);
1006            }
1007            try {
1008                return Float.parseFloat(v);
1009            } catch (NumberFormatException e) {
1010                throw new SettingNotFoundException(name);
1011            }
1012        }
1013
1014        /**
1015         * Convenience function for updating a single settings value as a
1016         * floating point number. This will either create a new entry in the
1017         * table if the given name does not exist, or modify the value of the
1018         * existing row with that name.  Note that internally setting values
1019         * are always stored as strings, so this function converts the given
1020         * value to a string before storing it.
1021         *
1022         * @param cr The ContentResolver to access.
1023         * @param name The name of the setting to modify.
1024         * @param value The new value for the setting.
1025         * @return true if the value was set, false on database errors
1026         */
1027        public static boolean putFloat(ContentResolver cr, String name, float value) {
1028            return putString(cr, name, Float.toString(value));
1029        }
1030
1031        /**
1032         * Convenience function to read all of the current
1033         * configuration-related settings into a
1034         * {@link Configuration} object.
1035         *
1036         * @param cr The ContentResolver to access.
1037         * @param outConfig Where to place the configuration settings.
1038         */
1039        public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
1040            outConfig.fontScale = Settings.System.getFloat(
1041                cr, FONT_SCALE, outConfig.fontScale);
1042            if (outConfig.fontScale < 0) {
1043                outConfig.fontScale = 1;
1044            }
1045        }
1046
1047        /**
1048         * @hide Erase the fields in the Configuration that should be applied
1049         * by the settings.
1050         */
1051        public static void clearConfiguration(Configuration inoutConfig) {
1052            inoutConfig.fontScale = 0;
1053        }
1054
1055        /**
1056         * Convenience function to write a batch of configuration-related
1057         * settings from a {@link Configuration} object.
1058         *
1059         * @param cr The ContentResolver to access.
1060         * @param config The settings to write.
1061         * @return true if the values were set, false on database errors
1062         */
1063        public static boolean putConfiguration(ContentResolver cr, Configuration config) {
1064            return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
1065        }
1066
1067        /** @hide */
1068        public static boolean hasInterestingConfigurationChanges(int changes) {
1069            return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
1070        }
1071
1072        public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
1073            return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
1074        }
1075
1076        public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1077            putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
1078        }
1079
1080        /**
1081         * The content:// style URL for this table
1082         */
1083        public static final Uri CONTENT_URI =
1084            Uri.parse("content://" + AUTHORITY + "/system");
1085
1086        /**
1087         * Whether we keep the device on while the device is plugged in.
1088         * Supported values are:
1089         * <ul>
1090         * <li>{@code 0} to never stay on while plugged in</li>
1091         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
1092         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
1093         * </ul>
1094         * These values can be OR-ed together.
1095         */
1096        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
1097
1098        /**
1099         * What happens when the user presses the end call button if they're not
1100         * on a call.<br/>
1101         * <b>Values:</b><br/>
1102         * 0 - The end button does nothing.<br/>
1103         * 1 - The end button goes to the home screen.<br/>
1104         * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1105         * 3 - The end button goes to the home screen.  If the user is already on the
1106         * home screen, it puts the device to sleep.
1107         */
1108        public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1109
1110        /**
1111         * END_BUTTON_BEHAVIOR value for "go home".
1112         * @hide
1113         */
1114        public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1115
1116        /**
1117         * END_BUTTON_BEHAVIOR value for "go to sleep".
1118         * @hide
1119         */
1120        public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1121
1122        /**
1123         * END_BUTTON_BEHAVIOR default value.
1124         * @hide
1125         */
1126        public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1127
1128        /**
1129         * Is advanced settings mode turned on. 0 == no, 1 == yes
1130         * @hide
1131         */
1132        public static final String ADVANCED_SETTINGS = "advanced_settings";
1133
1134        /**
1135         * ADVANCED_SETTINGS default value.
1136         * @hide
1137         */
1138        public static final int ADVANCED_SETTINGS_DEFAULT = 0;
1139
1140        /**
1141         * Whether Airplane Mode is on.
1142         */
1143        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
1144
1145        /**
1146         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
1147         */
1148        public static final String RADIO_BLUETOOTH = "bluetooth";
1149
1150        /**
1151         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
1152         */
1153        public static final String RADIO_WIFI = "wifi";
1154
1155        /**
1156         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
1157         */
1158        public static final String RADIO_CELL = "cell";
1159
1160        /**
1161         * A comma separated list of radios that need to be disabled when airplane mode
1162         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
1163         * included in the comma separated list.
1164         */
1165        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
1166
1167        /**
1168         * A comma separated list of radios that should to be disabled when airplane mode
1169         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
1170         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
1171         * will be turned off when entering airplane mode, but the user will be able to reenable
1172         * Wifi in the Settings app.
1173         *
1174         * {@hide}
1175         */
1176        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
1177
1178        /**
1179         * The policy for deciding when Wi-Fi should go to sleep (which will in
1180         * turn switch to using the mobile data as an Internet connection).
1181         * <p>
1182         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
1183         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
1184         * {@link #WIFI_SLEEP_POLICY_NEVER}.
1185         */
1186        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
1187
1188        /**
1189         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
1190         * policy, which is to sleep shortly after the turning off
1191         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
1192         */
1193        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
1194
1195        /**
1196         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
1197         * the device is on battery, and never go to sleep when the device is
1198         * plugged in.
1199         */
1200        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
1201
1202        /**
1203         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
1204         */
1205        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
1206
1207        //TODO: deprecate static IP constants
1208        /**
1209         * Whether to use static IP and other static network attributes.
1210         * <p>
1211         * Set to 1 for true and 0 for false.
1212         */
1213        public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1214
1215        /**
1216         * The static IP address.
1217         * <p>
1218         * Example: "192.168.1.51"
1219         */
1220        public static final String WIFI_STATIC_IP = "wifi_static_ip";
1221
1222        /**
1223         * If using static IP, the gateway's IP address.
1224         * <p>
1225         * Example: "192.168.1.1"
1226         */
1227        public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1228
1229        /**
1230         * If using static IP, the net mask.
1231         * <p>
1232         * Example: "255.255.255.0"
1233         */
1234        public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1235
1236        /**
1237         * If using static IP, the primary DNS's IP address.
1238         * <p>
1239         * Example: "192.168.1.1"
1240         */
1241        public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1242
1243        /**
1244         * If using static IP, the secondary DNS's IP address.
1245         * <p>
1246         * Example: "192.168.1.2"
1247         */
1248        public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1249
1250
1251        /**
1252         * Determines whether remote devices may discover and/or connect to
1253         * this device.
1254         * <P>Type: INT</P>
1255         * 2 -- discoverable and connectable
1256         * 1 -- connectable but not discoverable
1257         * 0 -- neither connectable nor discoverable
1258         */
1259        public static final String BLUETOOTH_DISCOVERABILITY =
1260            "bluetooth_discoverability";
1261
1262        /**
1263         * Bluetooth discoverability timeout.  If this value is nonzero, then
1264         * Bluetooth becomes discoverable for a certain number of seconds,
1265         * after which is becomes simply connectable.  The value is in seconds.
1266         */
1267        public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1268            "bluetooth_discoverability_timeout";
1269
1270        /**
1271         * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
1272         * instead
1273         */
1274        @Deprecated
1275        public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
1276
1277        /**
1278         * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
1279         * instead
1280         */
1281        @Deprecated
1282        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1283
1284        /**
1285         * @deprecated Use
1286         * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
1287         * instead
1288         */
1289        @Deprecated
1290        public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1291            "lock_pattern_tactile_feedback_enabled";
1292
1293
1294        /**
1295         * A formatted string of the next alarm that is set, or the empty string
1296         * if there is no alarm set.
1297         */
1298        public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1299
1300        /**
1301         * Scaling factor for fonts, float.
1302         */
1303        public static final String FONT_SCALE = "font_scale";
1304
1305        /**
1306         * Name of an application package to be debugged.
1307         */
1308        public static final String DEBUG_APP = "debug_app";
1309
1310        /**
1311         * If 1, when launching DEBUG_APP it will wait for the debugger before
1312         * starting user code.  If 0, it will run normally.
1313         */
1314        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1315
1316        /**
1317         * Whether or not to dim the screen. 0=no  1=yes
1318         */
1319        public static final String DIM_SCREEN = "dim_screen";
1320
1321        /**
1322         * The timeout before the screen turns off.
1323         */
1324        public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1325
1326        /**
1327         * If 0, the compatibility mode is off for all applications.
1328         * If 1, older applications run under compatibility mode.
1329         * TODO: remove this settings before code freeze (bug/1907571)
1330         * @hide
1331         */
1332        public static final String COMPATIBILITY_MODE = "compatibility_mode";
1333
1334        /**
1335         * The screen backlight brightness between 0 and 255.
1336         */
1337        public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1338
1339        /**
1340         * Control whether to enable automatic brightness mode.
1341         */
1342        public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1343
1344        /**
1345         * SCREEN_BRIGHTNESS_MODE value for manual mode.
1346         */
1347        public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1348
1349        /**
1350         * SCREEN_BRIGHTNESS_MODE value for manual mode.
1351         */
1352        public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1353
1354        /**
1355         * Control whether the process CPU usage meter should be shown.
1356         */
1357        public static final String SHOW_PROCESSES = "show_processes";
1358
1359        /**
1360         * If 1, the activity manager will aggressively finish activities and
1361         * processes as soon as they are no longer needed.  If 0, the normal
1362         * extended lifetime is used.
1363         */
1364        public static final String ALWAYS_FINISH_ACTIVITIES =
1365                "always_finish_activities";
1366
1367
1368        /**
1369         * Ringer mode. This is used internally, changing this value will not
1370         * change the ringer mode. See AudioManager.
1371         */
1372        public static final String MODE_RINGER = "mode_ringer";
1373
1374        /**
1375         * Determines which streams are affected by ringer mode changes. The
1376         * stream type's bit should be set to 1 if it should be muted when going
1377         * into an inaudible ringer mode.
1378         */
1379        public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1380
1381         /**
1382          * Determines which streams are affected by mute. The
1383          * stream type's bit should be set to 1 if it should be muted when a mute request
1384          * is received.
1385          */
1386         public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1387
1388        /**
1389         * Whether vibrate is on for different events. This is used internally,
1390         * changing this value will not change the vibrate. See AudioManager.
1391         */
1392        public static final String VIBRATE_ON = "vibrate_on";
1393
1394        /**
1395         * Ringer volume. This is used internally, changing this value will not
1396         * change the volume. See AudioManager.
1397         */
1398        public static final String VOLUME_RING = "volume_ring";
1399
1400        /**
1401         * System/notifications volume. This is used internally, changing this
1402         * value will not change the volume. See AudioManager.
1403         */
1404        public static final String VOLUME_SYSTEM = "volume_system";
1405
1406        /**
1407         * Voice call volume. This is used internally, changing this value will
1408         * not change the volume. See AudioManager.
1409         */
1410        public static final String VOLUME_VOICE = "volume_voice";
1411
1412        /**
1413         * Music/media/gaming volume. This is used internally, changing this
1414         * value will not change the volume. See AudioManager.
1415         */
1416        public static final String VOLUME_MUSIC = "volume_music";
1417
1418        /**
1419         * Alarm volume. This is used internally, changing this
1420         * value will not change the volume. See AudioManager.
1421         */
1422        public static final String VOLUME_ALARM = "volume_alarm";
1423
1424        /**
1425         * Notification volume. This is used internally, changing this
1426         * value will not change the volume. See AudioManager.
1427         */
1428        public static final String VOLUME_NOTIFICATION = "volume_notification";
1429
1430        /**
1431         * Bluetooth Headset volume. This is used internally, changing this value will
1432         * not change the volume. See AudioManager.
1433         */
1434        public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1435
1436        /**
1437         * Whether the notifications should use the ring volume (value of 1) or
1438         * a separate notification volume (value of 0). In most cases, users
1439         * will have this enabled so the notification and ringer volumes will be
1440         * the same. However, power users can disable this and use the separate
1441         * notification volume control.
1442         * <p>
1443         * Note: This is a one-off setting that will be removed in the future
1444         * when there is profile support. For this reason, it is kept hidden
1445         * from the public APIs.
1446         *
1447         * @hide
1448         */
1449        public static final String NOTIFICATIONS_USE_RING_VOLUME =
1450            "notifications_use_ring_volume";
1451
1452        /**
1453         * Whether silent mode should allow vibration feedback. This is used
1454         * internally in AudioService and the Sound settings activity to
1455         * coordinate decoupling of vibrate and silent modes. This setting
1456         * will likely be removed in a future release with support for
1457         * audio/vibe feedback profiles.
1458         *
1459         * @hide
1460         */
1461        public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
1462
1463        /**
1464         * The mapping of stream type (integer) to its setting.
1465         */
1466        public static final String[] VOLUME_SETTINGS = {
1467            VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
1468            VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
1469        };
1470
1471        /**
1472         * Appended to various volume related settings to record the previous
1473         * values before they the settings were affected by a silent/vibrate
1474         * ringer mode change.
1475         */
1476        public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1477
1478        /**
1479         * Persistent store for the system-wide default ringtone URI.
1480         * <p>
1481         * If you need to play the default ringtone at any given time, it is recommended
1482         * you give {@link #DEFAULT_RINGTONE_URI} to the media player.  It will resolve
1483         * to the set default ringtone at the time of playing.
1484         *
1485         * @see #DEFAULT_RINGTONE_URI
1486         */
1487        public static final String RINGTONE = "ringtone";
1488
1489        /**
1490         * A {@link Uri} that will point to the current default ringtone at any
1491         * given time.
1492         * <p>
1493         * If the current default ringtone is in the DRM provider and the caller
1494         * does not have permission, the exception will be a
1495         * FileNotFoundException.
1496         */
1497        public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1498
1499        /**
1500         * Persistent store for the system-wide default notification sound.
1501         *
1502         * @see #RINGTONE
1503         * @see #DEFAULT_NOTIFICATION_URI
1504         */
1505        public static final String NOTIFICATION_SOUND = "notification_sound";
1506
1507        /**
1508         * A {@link Uri} that will point to the current default notification
1509         * sound at any given time.
1510         *
1511         * @see #DEFAULT_RINGTONE_URI
1512         */
1513        public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1514
1515        /**
1516         * Persistent store for the system-wide default alarm alert.
1517         *
1518         * @see #RINGTONE
1519         * @see #DEFAULT_ALARM_ALERT_URI
1520         */
1521        public static final String ALARM_ALERT = "alarm_alert";
1522
1523        /**
1524         * A {@link Uri} that will point to the current default alarm alert at
1525         * any given time.
1526         *
1527         * @see #DEFAULT_ALARM_ALERT_URI
1528         */
1529        public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1530
1531        /**
1532         * Persistent store for the system default media button event receiver.
1533         *
1534         * @hide
1535         */
1536        public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
1537
1538        /**
1539         * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1540         */
1541        public static final String TEXT_AUTO_REPLACE = "auto_replace";
1542
1543        /**
1544         * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1545         */
1546        public static final String TEXT_AUTO_CAPS = "auto_caps";
1547
1548        /**
1549         * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1550         * feature converts two spaces to a "." and space.
1551         */
1552        public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
1553
1554        /**
1555         * Setting to showing password characters in text editors. 1 = On, 0 = Off
1556         */
1557        public static final String TEXT_SHOW_PASSWORD = "show_password";
1558
1559        public static final String SHOW_GTALK_SERVICE_STATUS =
1560                "SHOW_GTALK_SERVICE_STATUS";
1561
1562        /**
1563         * Name of activity to use for wallpaper on the home screen.
1564         */
1565        public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1566
1567        /**
1568         * Value to specify if the user prefers the date, time and time zone
1569         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1570         */
1571        public static final String AUTO_TIME = "auto_time";
1572
1573        /**
1574         * Value to specify if the user prefers the time zone
1575         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1576         */
1577        public static final String AUTO_TIME_ZONE = "auto_time_zone";
1578
1579        /**
1580         * Display times as 12 or 24 hours
1581         *   12
1582         *   24
1583         */
1584        public static final String TIME_12_24 = "time_12_24";
1585
1586        /**
1587         * Date format string
1588         *   mm/dd/yyyy
1589         *   dd/mm/yyyy
1590         *   yyyy/mm/dd
1591         */
1592        public static final String DATE_FORMAT = "date_format";
1593
1594        /**
1595         * Whether the setup wizard has been run before (on first boot), or if
1596         * it still needs to be run.
1597         *
1598         * nonzero = it has been run in the past
1599         * 0 = it has not been run in the past
1600         */
1601        public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1602
1603        /**
1604         * Scaling factor for normal window animations. Setting to 0 will disable window
1605         * animations.
1606         */
1607        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1608
1609        /**
1610         * Scaling factor for activity transition animations. Setting to 0 will disable window
1611         * animations.
1612         */
1613        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1614
1615        /**
1616         * Scaling factor for normal window animations. Setting to 0 will disable window
1617         * animations.
1618         * @hide
1619         */
1620        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1621
1622        /**
1623         * Control whether the accelerometer will be used to change screen
1624         * orientation.  If 0, it will not be used unless explicitly requested
1625         * by the application; if 1, it will be used by default unless explicitly
1626         * disabled by the application.
1627         */
1628        public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1629
1630        /**
1631         * Default screen rotation when no other policy applies.
1632         * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
1633         * preference, this rotation value will be used. Must be one of the
1634         * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
1635         *
1636         * @see Display#getRotation
1637         */
1638        public static final String USER_ROTATION = "user_rotation";
1639
1640        /**
1641         * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1642         * boolean (1 or 0).
1643         */
1644        public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1645
1646        /**
1647         * CDMA only settings
1648         * DTMF tone type played by the dialer when dialing.
1649         *                 0 = Normal
1650         *                 1 = Long
1651         * @hide
1652         */
1653        public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1654
1655        /**
1656         * CDMA only settings
1657         * Emergency Tone  0 = Off
1658         *                 1 = Alert
1659         *                 2 = Vibrate
1660         * @hide
1661         */
1662        public static final String EMERGENCY_TONE = "emergency_tone";
1663
1664        /**
1665         * CDMA only settings
1666         * Whether the auto retry is enabled. The value is
1667         * boolean (1 or 0).
1668         * @hide
1669         */
1670        public static final String CALL_AUTO_RETRY = "call_auto_retry";
1671
1672        /**
1673         * Whether the hearing aid is enabled. The value is
1674         * boolean (1 or 0).
1675         * @hide
1676         */
1677        public static final String HEARING_AID = "hearing_aid";
1678
1679        /**
1680         * CDMA only settings
1681         * TTY Mode
1682         * 0 = OFF
1683         * 1 = FULL
1684         * 2 = VCO
1685         * 3 = HCO
1686         * @hide
1687         */
1688        public static final String TTY_MODE = "tty_mode";
1689
1690        /**
1691         * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1692         * boolean (1 or 0).
1693         */
1694        public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
1695
1696        /**
1697         * Whether the haptic feedback (long presses, ...) are enabled. The value is
1698         * boolean (1 or 0).
1699         */
1700        public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
1701
1702        /**
1703         * @deprecated Each application that shows web suggestions should have its own
1704         * setting for this.
1705         */
1706        @Deprecated
1707        public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
1708
1709        /**
1710         * Whether the notification LED should repeatedly flash when a notification is
1711         * pending. The value is boolean (1 or 0).
1712         * @hide
1713         */
1714        public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1715
1716        /**
1717         * Show pointer location on screen?
1718         * 0 = no
1719         * 1 = yes
1720         * @hide
1721         */
1722        public static final String POINTER_LOCATION = "pointer_location";
1723
1724        /**
1725         * Log raw orientation data from {@link WindowOrientationListener} for use with the
1726         * orientationplot.py tool.
1727         * 0 = no
1728         * 1 = yes
1729         * @hide
1730         */
1731        public static final String WINDOW_ORIENTATION_LISTENER_LOG =
1732                "window_orientation_listener_log";
1733
1734        /**
1735         * Whether to play a sound for low-battery alerts.
1736         * @hide
1737         */
1738        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
1739
1740        /**
1741         * Whether to play a sound for dock events.
1742         * @hide
1743         */
1744        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
1745
1746        /**
1747         * Whether to play sounds when the keyguard is shown and dismissed.
1748         * @hide
1749         */
1750        public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
1751
1752        /**
1753         * URI for the low battery sound file.
1754         * @hide
1755         */
1756        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
1757
1758        /**
1759         * URI for the desk dock "in" event sound.
1760         * @hide
1761         */
1762        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
1763
1764        /**
1765         * URI for the desk dock "out" event sound.
1766         * @hide
1767         */
1768        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
1769
1770        /**
1771         * URI for the car dock "in" event sound.
1772         * @hide
1773         */
1774        public static final String CAR_DOCK_SOUND = "car_dock_sound";
1775
1776        /**
1777         * URI for the car dock "out" event sound.
1778         * @hide
1779         */
1780        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
1781
1782        /**
1783         * URI for the "device locked" (keyguard shown) sound.
1784         * @hide
1785         */
1786        public static final String LOCK_SOUND = "lock_sound";
1787
1788        /**
1789         * URI for the "device unlocked" (keyguard dismissed) sound.
1790         * @hide
1791         */
1792        public static final String UNLOCK_SOUND = "unlock_sound";
1793
1794        /**
1795         * Receive incoming SIP calls?
1796         * 0 = no
1797         * 1 = yes
1798         * @hide
1799         */
1800        public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
1801
1802        /**
1803         * Call Preference String.
1804         * "SIP_ALWAYS" : Always use SIP with network access
1805         * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
1806         * "SIP_ASK_ME_EACH_TIME" : Always ask me each time
1807         * @hide
1808         */
1809        public static final String SIP_CALL_OPTIONS = "sip_call_options";
1810
1811        /**
1812         * One of the sip call options: Always use SIP with network access.
1813         * @hide
1814         */
1815        public static final String SIP_ALWAYS = "SIP_ALWAYS";
1816
1817        /**
1818         * One of the sip call options: Only if destination is a SIP address.
1819         * @hide
1820         */
1821        public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
1822
1823        /**
1824         * One of the sip call options: Always ask me each time.
1825         * @hide
1826         */
1827        public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
1828
1829        /**
1830         * Pointer speed setting.
1831         * This is an integer value in a range between -7 and +7, so there are 15 possible values.
1832         *   -7 = slowest
1833         *    0 = default speed
1834         *   +7 = fastest
1835         * @hide
1836         */
1837        public static final String POINTER_SPEED = "pointer_speed";
1838
1839        /**
1840         * Settings to backup. This is here so that it's in the same place as the settings
1841         * keys and easy to update.
1842         * @hide
1843         */
1844        public static final String[] SETTINGS_TO_BACKUP = {
1845            STAY_ON_WHILE_PLUGGED_IN,
1846            WIFI_USE_STATIC_IP,
1847            WIFI_STATIC_IP,
1848            WIFI_STATIC_GATEWAY,
1849            WIFI_STATIC_NETMASK,
1850            WIFI_STATIC_DNS1,
1851            WIFI_STATIC_DNS2,
1852            BLUETOOTH_DISCOVERABILITY,
1853            BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1854            DIM_SCREEN,
1855            SCREEN_OFF_TIMEOUT,
1856            SCREEN_BRIGHTNESS,
1857            SCREEN_BRIGHTNESS_MODE,
1858            VIBRATE_ON,
1859            MODE_RINGER,
1860            MODE_RINGER_STREAMS_AFFECTED,
1861            MUTE_STREAMS_AFFECTED,
1862            VOLUME_VOICE,
1863            VOLUME_SYSTEM,
1864            VOLUME_RING,
1865            VOLUME_MUSIC,
1866            VOLUME_ALARM,
1867            VOLUME_NOTIFICATION,
1868            VOLUME_BLUETOOTH_SCO,
1869            VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1870            VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1871            VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1872            VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1873            VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1874            VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
1875            VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
1876            VIBRATE_IN_SILENT,
1877            TEXT_AUTO_REPLACE,
1878            TEXT_AUTO_CAPS,
1879            TEXT_AUTO_PUNCTUATE,
1880            TEXT_SHOW_PASSWORD,
1881            AUTO_TIME,
1882            AUTO_TIME_ZONE,
1883            TIME_12_24,
1884            DATE_FORMAT,
1885            ACCELEROMETER_ROTATION,
1886            USER_ROTATION,
1887            DTMF_TONE_WHEN_DIALING,
1888            DTMF_TONE_TYPE_WHEN_DIALING,
1889            EMERGENCY_TONE,
1890            CALL_AUTO_RETRY,
1891            HEARING_AID,
1892            TTY_MODE,
1893            SOUND_EFFECTS_ENABLED,
1894            HAPTIC_FEEDBACK_ENABLED,
1895            POWER_SOUNDS_ENABLED,
1896            DOCK_SOUNDS_ENABLED,
1897            LOCKSCREEN_SOUNDS_ENABLED,
1898            SHOW_WEB_SUGGESTIONS,
1899            NOTIFICATION_LIGHT_PULSE,
1900            SIP_CALL_OPTIONS,
1901            SIP_RECEIVE_CALLS,
1902            POINTER_SPEED,
1903        };
1904
1905        // Settings moved to Settings.Secure
1906
1907        /**
1908         * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
1909         * instead
1910         */
1911        @Deprecated
1912        public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1913
1914        /**
1915         * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1916         */
1917        @Deprecated
1918        public static final String ANDROID_ID = Secure.ANDROID_ID;
1919
1920        /**
1921         * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1922         */
1923        @Deprecated
1924        public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1925
1926        /**
1927         * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1928         */
1929        @Deprecated
1930        public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1931
1932        /**
1933         * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1934         */
1935        @Deprecated
1936        public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1937
1938        /**
1939         * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1940         */
1941        @Deprecated
1942        public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1943
1944        /**
1945         * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1946         */
1947        @Deprecated
1948        public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
1949
1950        /**
1951         * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1952         * instead
1953         */
1954        @Deprecated
1955        public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1956
1957        /**
1958         * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1959         */
1960        @Deprecated
1961        public static final String LOGGING_ID = Secure.LOGGING_ID;
1962
1963        /**
1964         * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1965         */
1966        @Deprecated
1967        public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1968
1969        /**
1970         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1971         * instead
1972         */
1973        @Deprecated
1974        public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1975
1976        /**
1977         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1978         * instead
1979         */
1980        @Deprecated
1981        public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1982
1983        /**
1984         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1985         * instead
1986         */
1987        @Deprecated
1988        public static final String PARENTAL_CONTROL_REDIRECT_URL =
1989            Secure.PARENTAL_CONTROL_REDIRECT_URL;
1990
1991        /**
1992         * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1993         */
1994        @Deprecated
1995        public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1996
1997        /**
1998         * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1999         */
2000        @Deprecated
2001        public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
2002
2003        /**
2004         * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
2005         */
2006        @Deprecated
2007        public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
2008
2009       /**
2010         * @deprecated Use
2011         * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
2012         */
2013        @Deprecated
2014        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
2015
2016        /**
2017         * @deprecated Use
2018         * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
2019         */
2020        @Deprecated
2021        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2022                Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
2023
2024        /**
2025         * @deprecated Use
2026         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
2027         */
2028        @Deprecated
2029        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2030            Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
2031
2032        /**
2033         * @deprecated Use
2034         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
2035         */
2036        @Deprecated
2037        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2038            Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
2039
2040        /**
2041         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
2042         * instead
2043         */
2044        @Deprecated
2045        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
2046
2047        /**
2048         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
2049         */
2050        @Deprecated
2051        public static final String WIFI_ON = Secure.WIFI_ON;
2052
2053        /**
2054         * @deprecated Use
2055         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
2056         * instead
2057         */
2058        @Deprecated
2059        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2060                Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
2061
2062        /**
2063         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
2064         */
2065        @Deprecated
2066        public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
2067
2068        /**
2069         * @deprecated Use
2070         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
2071         */
2072        @Deprecated
2073        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2074                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
2075
2076        /**
2077         * @deprecated Use
2078         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
2079         */
2080        @Deprecated
2081        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2082                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
2083
2084        /**
2085         * @deprecated Use
2086         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
2087         * instead
2088         */
2089        @Deprecated
2090        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2091                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
2092
2093        /**
2094         * @deprecated Use
2095         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
2096         */
2097        @Deprecated
2098        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2099            Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
2100
2101        /**
2102         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
2103         * instead
2104         */
2105        @Deprecated
2106        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
2107
2108        /**
2109         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
2110         */
2111        @Deprecated
2112        public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
2113
2114        /**
2115         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
2116         */
2117        @Deprecated
2118        public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
2119
2120        /**
2121         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
2122         * instead
2123         */
2124        @Deprecated
2125        public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
2126
2127        /**
2128         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
2129         * instead
2130         */
2131        @Deprecated
2132        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
2133            Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
2134    }
2135
2136    /**
2137     * Secure system settings, containing system preferences that applications
2138     * can read but are not allowed to write.  These are for preferences that
2139     * the user must explicitly modify through the system UI or specialized
2140     * APIs for those values, not modified directly by applications.
2141     */
2142    public static final class Secure extends NameValueTable {
2143        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
2144
2145        // Populated lazily, guarded by class object:
2146        private static NameValueCache sNameValueCache = null;
2147
2148        /**
2149         * Look up a name in the database.
2150         * @param resolver to access the database with
2151         * @param name to look up in the table
2152         * @return the corresponding value, or null if not present
2153         */
2154        public synchronized static String getString(ContentResolver resolver, String name) {
2155            if (sNameValueCache == null) {
2156                sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
2157                                                     CALL_METHOD_GET_SECURE);
2158            }
2159            return sNameValueCache.getString(resolver, name);
2160        }
2161
2162        /**
2163         * Store a name/value pair into the database.
2164         * @param resolver to access the database with
2165         * @param name to store
2166         * @param value to associate with the name
2167         * @return true if the value was set, false on database errors
2168         */
2169        public static boolean putString(ContentResolver resolver,
2170                String name, String value) {
2171            return putString(resolver, CONTENT_URI, name, value);
2172        }
2173
2174        /**
2175         * Construct the content URI for a particular name/value pair,
2176         * useful for monitoring changes with a ContentObserver.
2177         * @param name to look up in the table
2178         * @return the corresponding content URI, or null if not present
2179         */
2180        public static Uri getUriFor(String name) {
2181            return getUriFor(CONTENT_URI, name);
2182        }
2183
2184        /**
2185         * Convenience function for retrieving a single secure settings value
2186         * as an integer.  Note that internally setting values are always
2187         * stored as strings; this function converts the string to an integer
2188         * for you.  The default value will be returned if the setting is
2189         * not defined or not an integer.
2190         *
2191         * @param cr The ContentResolver to access.
2192         * @param name The name of the setting to retrieve.
2193         * @param def Value to return if the setting is not defined.
2194         *
2195         * @return The setting's current value, or 'def' if it is not defined
2196         * or not a valid integer.
2197         */
2198        public static int getInt(ContentResolver cr, String name, int def) {
2199            String v = getString(cr, name);
2200            try {
2201                return v != null ? Integer.parseInt(v) : def;
2202            } catch (NumberFormatException e) {
2203                return def;
2204            }
2205        }
2206
2207        /**
2208         * Convenience function for retrieving a single secure settings value
2209         * as an integer.  Note that internally setting values are always
2210         * stored as strings; this function converts the string to an integer
2211         * for you.
2212         * <p>
2213         * This version does not take a default value.  If the setting has not
2214         * been set, or the string value is not a number,
2215         * it throws {@link SettingNotFoundException}.
2216         *
2217         * @param cr The ContentResolver to access.
2218         * @param name The name of the setting to retrieve.
2219         *
2220         * @throws SettingNotFoundException Thrown if a setting by the given
2221         * name can't be found or the setting value is not an integer.
2222         *
2223         * @return The setting's current value.
2224         */
2225        public static int getInt(ContentResolver cr, String name)
2226                throws SettingNotFoundException {
2227            String v = getString(cr, name);
2228            try {
2229                return Integer.parseInt(v);
2230            } catch (NumberFormatException e) {
2231                throw new SettingNotFoundException(name);
2232            }
2233        }
2234
2235        /**
2236         * Convenience function for updating a single settings value as an
2237         * integer. This will either create a new entry in the table if the
2238         * given name does not exist, or modify the value of the existing row
2239         * with that name.  Note that internally setting values are always
2240         * stored as strings, so this function converts the given value to a
2241         * string before storing it.
2242         *
2243         * @param cr The ContentResolver to access.
2244         * @param name The name of the setting to modify.
2245         * @param value The new value for the setting.
2246         * @return true if the value was set, false on database errors
2247         */
2248        public static boolean putInt(ContentResolver cr, String name, int value) {
2249            return putString(cr, name, Integer.toString(value));
2250        }
2251
2252        /**
2253         * Convenience function for retrieving a single secure settings value
2254         * as a {@code long}.  Note that internally setting values are always
2255         * stored as strings; this function converts the string to a {@code long}
2256         * for you.  The default value will be returned if the setting is
2257         * not defined or not a {@code long}.
2258         *
2259         * @param cr The ContentResolver to access.
2260         * @param name The name of the setting to retrieve.
2261         * @param def Value to return if the setting is not defined.
2262         *
2263         * @return The setting's current value, or 'def' if it is not defined
2264         * or not a valid {@code long}.
2265         */
2266        public static long getLong(ContentResolver cr, String name, long def) {
2267            String valString = getString(cr, name);
2268            long value;
2269            try {
2270                value = valString != null ? Long.parseLong(valString) : def;
2271            } catch (NumberFormatException e) {
2272                value = def;
2273            }
2274            return value;
2275        }
2276
2277        /**
2278         * Convenience function for retrieving a single secure settings value
2279         * as a {@code long}.  Note that internally setting values are always
2280         * stored as strings; this function converts the string to a {@code long}
2281         * for you.
2282         * <p>
2283         * This version does not take a default value.  If the setting has not
2284         * been set, or the string value is not a number,
2285         * it throws {@link SettingNotFoundException}.
2286         *
2287         * @param cr The ContentResolver to access.
2288         * @param name The name of the setting to retrieve.
2289         *
2290         * @return The setting's current value.
2291         * @throws SettingNotFoundException Thrown if a setting by the given
2292         * name can't be found or the setting value is not an integer.
2293         */
2294        public static long getLong(ContentResolver cr, String name)
2295                throws SettingNotFoundException {
2296            String valString = getString(cr, name);
2297            try {
2298                return Long.parseLong(valString);
2299            } catch (NumberFormatException e) {
2300                throw new SettingNotFoundException(name);
2301            }
2302        }
2303
2304        /**
2305         * Convenience function for updating a secure settings value as a long
2306         * integer. This will either create a new entry in the table if the
2307         * given name does not exist, or modify the value of the existing row
2308         * with that name.  Note that internally setting values are always
2309         * stored as strings, so this function converts the given value to a
2310         * string before storing it.
2311         *
2312         * @param cr The ContentResolver to access.
2313         * @param name The name of the setting to modify.
2314         * @param value The new value for the setting.
2315         * @return true if the value was set, false on database errors
2316         */
2317        public static boolean putLong(ContentResolver cr, String name, long value) {
2318            return putString(cr, name, Long.toString(value));
2319        }
2320
2321        /**
2322         * Convenience function for retrieving a single secure settings value
2323         * as a floating point number.  Note that internally setting values are
2324         * always stored as strings; this function converts the string to an
2325         * float for you. The default value will be returned if the setting
2326         * is not defined or not a valid float.
2327         *
2328         * @param cr The ContentResolver to access.
2329         * @param name The name of the setting to retrieve.
2330         * @param def Value to return if the setting is not defined.
2331         *
2332         * @return The setting's current value, or 'def' if it is not defined
2333         * or not a valid float.
2334         */
2335        public static float getFloat(ContentResolver cr, String name, float def) {
2336            String v = getString(cr, name);
2337            try {
2338                return v != null ? Float.parseFloat(v) : def;
2339            } catch (NumberFormatException e) {
2340                return def;
2341            }
2342        }
2343
2344        /**
2345         * Convenience function for retrieving a single secure settings value
2346         * as a float.  Note that internally setting values are always
2347         * stored as strings; this function converts the string to a float
2348         * for you.
2349         * <p>
2350         * This version does not take a default value.  If the setting has not
2351         * been set, or the string value is not a number,
2352         * it throws {@link SettingNotFoundException}.
2353         *
2354         * @param cr The ContentResolver to access.
2355         * @param name The name of the setting to retrieve.
2356         *
2357         * @throws SettingNotFoundException Thrown if a setting by the given
2358         * name can't be found or the setting value is not a float.
2359         *
2360         * @return The setting's current value.
2361         */
2362        public static float getFloat(ContentResolver cr, String name)
2363                throws SettingNotFoundException {
2364            String v = getString(cr, name);
2365            if (v == null) {
2366                throw new SettingNotFoundException(name);
2367            }
2368            try {
2369                return Float.parseFloat(v);
2370            } catch (NumberFormatException e) {
2371                throw new SettingNotFoundException(name);
2372            }
2373        }
2374
2375        /**
2376         * Convenience function for updating a single settings value as a
2377         * floating point number. This will either create a new entry in the
2378         * table if the given name does not exist, or modify the value of the
2379         * existing row with that name.  Note that internally setting values
2380         * are always stored as strings, so this function converts the given
2381         * value to a string before storing it.
2382         *
2383         * @param cr The ContentResolver to access.
2384         * @param name The name of the setting to modify.
2385         * @param value The new value for the setting.
2386         * @return true if the value was set, false on database errors
2387         */
2388        public static boolean putFloat(ContentResolver cr, String name, float value) {
2389            return putString(cr, name, Float.toString(value));
2390        }
2391
2392        /**
2393         * The content:// style URL for this table
2394         */
2395        public static final Uri CONTENT_URI =
2396            Uri.parse("content://" + AUTHORITY + "/secure");
2397
2398        /**
2399         * Whether ADB is enabled.
2400         */
2401        public static final String ADB_ENABLED = "adb_enabled";
2402
2403        /**
2404         * Setting to allow mock locations and location provider status to be injected into the
2405         * LocationManager service for testing purposes during application development.  These
2406         * locations and status values  override actual location and status information generated
2407         * by network, gps, or other location providers.
2408         */
2409        public static final String ALLOW_MOCK_LOCATION = "mock_location";
2410
2411        /**
2412         * A 64-bit number (as a hex string) that is randomly
2413         * generated on the device's first boot and should remain
2414         * constant for the lifetime of the device.  (The value may
2415         * change if a factory reset is performed on the device.)
2416         */
2417        public static final String ANDROID_ID = "android_id";
2418
2419        /**
2420         * Whether bluetooth is enabled/disabled
2421         * 0=disabled. 1=enabled.
2422         */
2423        public static final String BLUETOOTH_ON = "bluetooth_on";
2424
2425        /**
2426         * Get the key that retrieves a bluetooth headset's priority.
2427         * @hide
2428         */
2429        public static final String getBluetoothHeadsetPriorityKey(String address) {
2430            return ("bluetooth_headset_priority_" + address.toUpperCase());
2431        }
2432
2433        /**
2434         * Get the key that retrieves a bluetooth a2dp sink's priority.
2435         * @hide
2436         */
2437        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2438            return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2439        }
2440
2441        /**
2442         * Get the key that retrieves a bluetooth Input Device's priority.
2443         * @hide
2444         */
2445        public static final String getBluetoothInputDevicePriorityKey(String address) {
2446            return ("bluetooth_input_device_priority_" + address.toUpperCase());
2447        }
2448
2449        /**
2450         * Whether or not data roaming is enabled. (0 = false, 1 = true)
2451         */
2452        public static final String DATA_ROAMING = "data_roaming";
2453
2454        /**
2455         * Setting to record the input method used by default, holding the ID
2456         * of the desired method.
2457         */
2458        public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2459
2460        /**
2461         * Setting to record the input method subtype used by default, holding the ID
2462         * of the desired method.
2463         */
2464        public static final String SELECTED_INPUT_METHOD_SUBTYPE =
2465                "selected_input_method_subtype";
2466
2467        /**
2468         * Setting to record the history of input method subtype, holding the pair of ID of IME
2469         * and its last used subtype.
2470         * @hide
2471         */
2472        public static final String INPUT_METHODS_SUBTYPE_HISTORY =
2473                "input_methods_subtype_history";
2474
2475        /**
2476         * Setting to record the visibility of input method selector
2477         */
2478        public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
2479                "input_method_selector_visibility";
2480
2481        /**
2482         * Whether the device has been provisioned (0 = false, 1 = true)
2483         */
2484        public static final String DEVICE_PROVISIONED = "device_provisioned";
2485
2486        /**
2487         * List of input methods that are currently enabled.  This is a string
2488         * containing the IDs of all enabled input methods, each ID separated
2489         * by ':'.
2490         */
2491        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
2492
2493        /**
2494         * List of system input methods that are currently disabled.  This is a string
2495         * containing the IDs of all disabled input methods, each ID separated
2496         * by ':'.
2497         * @hide
2498         */
2499        public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
2500
2501        /**
2502         * Host name and port for global http proxy.  Uses ':' seperator for between host and port
2503         * TODO - deprecate in favor of global_http_proxy_host, etc
2504         */
2505        public static final String HTTP_PROXY = "http_proxy";
2506
2507        /**
2508         * Host name for global http proxy.  Set via ConnectivityManager.
2509         * @hide
2510         */
2511        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
2512
2513        /**
2514         * Integer host port for global http proxy.  Set via ConnectivityManager.
2515         * @hide
2516         */
2517        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
2518
2519        /**
2520         * Exclusion list for global proxy. This string contains a list of comma-separated
2521         * domains where the global proxy does not apply. Domains should be listed in a comma-
2522         * separated list. Example of acceptable formats: ".domain1.com,my.domain2.com"
2523         * Use ConnectivityManager to set/get.
2524         * @hide
2525         */
2526        public static final String GLOBAL_HTTP_PROXY_EXCLUSION_LIST =
2527                "global_http_proxy_exclusion_list";
2528
2529        /**
2530         * Enables the UI setting to allow the user to specify the global HTTP proxy
2531         * and associated exclusion list.
2532         * @hide
2533         */
2534        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
2535
2536        /**
2537         * Setting for default DNS in case nobody suggests one
2538         * @hide
2539         */
2540        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
2541
2542        /**
2543         * Whether the package installer should allow installation of apps downloaded from
2544         * sources other than the Android Market (vending machine).
2545         *
2546         * 1 = allow installing from other sources
2547         * 0 = only allow installing from the Android Market
2548         */
2549        public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
2550
2551        /**
2552         * Comma-separated list of location providers that activities may access.
2553         */
2554        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
2555
2556        /**
2557         * Whether autolock is enabled (0 = false, 1 = true)
2558         */
2559        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
2560
2561        /**
2562         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
2563         */
2564        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2565
2566        /**
2567         * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
2568         */
2569        public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2570            "lock_pattern_tactile_feedback_enabled";
2571
2572        /**
2573         * This preference allows the device to be locked given time after screen goes off,
2574         * subject to current DeviceAdmin policy limits.
2575         * @hide
2576         */
2577        public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
2578
2579
2580        /**
2581         * This preference contains the string that shows for owner info on LockScren.
2582         * @hide
2583         */
2584        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
2585
2586        /**
2587         * This preference enables showing the owner info on LockScren.
2588         * @hide
2589         */
2590        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
2591            "lock_screen_owner_info_enabled";
2592
2593        /**
2594         * The saved value for WindowManagerService.setForcedDisplaySize().
2595         * Two integers separated by a comma.  If unset, then use the real display size.
2596         * @hide
2597         */
2598        public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
2599
2600        /**
2601         * Whether assisted GPS should be enabled or not.
2602         * @hide
2603         */
2604        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2605
2606        /**
2607         * The Logging ID (a unique 64-bit value) as a hex string.
2608         * Used as a pseudonymous identifier for logging.
2609         * @deprecated This identifier is poorly initialized and has
2610         * many collisions.  It should not be used.
2611         */
2612        @Deprecated
2613        public static final String LOGGING_ID = "logging_id";
2614
2615        /**
2616         * User preference for which network(s) should be used. Only the
2617         * connectivity service should touch this.
2618         */
2619        public static final String NETWORK_PREFERENCE = "network_preference";
2620
2621        /**
2622         * Used to disable Tethering on a device - defaults to true
2623         * @hide
2624         */
2625        public static final String TETHER_SUPPORTED = "tether_supported";
2626
2627        /**
2628         * Used to require DUN APN on the device or not - defaults to a build config value
2629         * which defaults to false
2630         * @hide
2631         */
2632        public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
2633
2634        /**
2635         * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
2636         * corresponding build config values are set it will override the APN DB
2637         * values.
2638         * Consists of a comma seperated list of strings:
2639         * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
2640         * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
2641         * @hide
2642         */
2643        public static final String TETHER_DUN_APN = "tether_dun_apn";
2644
2645        /**
2646         * No longer supported.
2647         */
2648        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
2649
2650        /**
2651         * No longer supported.
2652         */
2653        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
2654
2655        /**
2656         * No longer supported.
2657         */
2658        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
2659
2660        /**
2661         * A positive value indicates how often the SamplingProfiler
2662         * should take snapshots. Zero value means SamplingProfiler
2663         * is disabled.
2664         *
2665         * @hide
2666         */
2667        public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
2668
2669        /**
2670         * Settings classname to launch when Settings is clicked from All
2671         * Applications.  Needed because of user testing between the old
2672         * and new Settings apps.
2673         */
2674        // TODO: 881807
2675        public static final String SETTINGS_CLASSNAME = "settings_classname";
2676
2677        /**
2678         * USB Mass Storage Enabled
2679         */
2680        public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
2681
2682        /**
2683         * If this setting is set (to anything), then all references
2684         * to Gmail on the device must change to Google Mail.
2685         */
2686        public static final String USE_GOOGLE_MAIL = "use_google_mail";
2687
2688        /**
2689         * If accessibility is enabled.
2690         */
2691        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2692
2693        /**
2694         * If touch exploration is requested. Touch exploration is enabled if it is
2695         * requested by this setting, accessibility is enabled and there is at least
2696         * one enabled accessibility serivce that provides spoken feedback.
2697         */
2698        public static final String TOUCH_EXPLORATION_REQUESTED = "touch_exploration_requested";
2699
2700        /**
2701         * List of the enabled accessibility providers.
2702         */
2703        public static final String ENABLED_ACCESSIBILITY_SERVICES =
2704            "enabled_accessibility_services";
2705
2706        /**
2707         * If injection of accessibility enhancing JavaScript scripts
2708         * is enabled.
2709         * <p>
2710         *   Note: Accessibility injecting scripts are served by the
2711         *   Google infrastructure and enable users with disabilities to
2712         *   efficiantly navigate in and explore web content.
2713         * </p>
2714         * <p>
2715         *   This property represents a boolean value.
2716         * </p>
2717         * @hide
2718         */
2719        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
2720            "accessibility_script_injection";
2721
2722        /**
2723         * Key bindings for navigation in built-in accessibility support for web content.
2724         * <p>
2725         *   Note: These key bindings are for the built-in accessibility navigation for
2726         *   web content which is used as a fall back solution if JavaScript in a WebView
2727         *   is not enabled or the user has not opted-in script injection from Google.
2728         * </p>
2729         * <p>
2730         *   The bindings are separated by semi-colon. A binding is a mapping from
2731         *   a key to a sequence of actions (for more details look at
2732         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
2733         *   string representation of an integer obtained from a meta state (optional) shifted
2734         *   sixteen times left and bitwise ored with a key code. An action is represented
2735         *   as a hexademical string representation of an integer where the first two digits
2736         *   are navigation action index, the second, the third, and the fourth digit pairs
2737         *   represent the action arguments. The separate actions in a binding are colon
2738         *   separated. The key and the action sequence it maps to are separated by equals.
2739         * </p>
2740         * <p>
2741         *   For example, the binding below maps the DPAD right button to traverse the
2742         *   current navigation axis once without firing an accessibility event and to
2743         *   perform the same traversal again but to fire an event:
2744         *   <code>
2745         *     0x16=0x01000100:0x01000101;
2746         *   </code>
2747         * </p>
2748         * <p>
2749         *   The goal of this binding is to enable dynamic rebinding of keys to
2750         *   navigation actions for web content without requiring a framework change.
2751         * </p>
2752         * <p>
2753         *   This property represents a string value.
2754         * </p>
2755         * @hide
2756         */
2757        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
2758            "accessibility_web_content_key_bindings";
2759
2760        /**
2761         * The timout for considering a press to be a long press in milliseconds.
2762         * @hide
2763         */
2764        public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
2765
2766        /**
2767         * Setting to always use the default text-to-speech settings regardless
2768         * of the application settings.
2769         * 1 = override application settings,
2770         * 0 = use application settings (if specified).
2771         */
2772        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2773
2774        /**
2775         * Default text-to-speech engine speech rate. 100 = 1x
2776         */
2777        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2778
2779        /**
2780         * Default text-to-speech engine pitch. 100 = 1x
2781         */
2782        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2783
2784        /**
2785         * Default text-to-speech engine.
2786         */
2787        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2788
2789        /**
2790         * Default text-to-speech language.
2791         */
2792        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2793
2794        /**
2795         * Default text-to-speech country.
2796         */
2797        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2798
2799        /**
2800         * Default text-to-speech locale variant.
2801         */
2802        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2803
2804        /**
2805         * Space delimited list of plugin packages that are enabled.
2806         */
2807        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
2808
2809        /**
2810         * Whether to notify the user of open networks.
2811         * <p>
2812         * If not connected and the scan results have an open network, we will
2813         * put this notification up. If we attempt to connect to a network or
2814         * the open network(s) disappear, we remove the notification. When we
2815         * show the notification, we will not show it again for
2816         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2817         */
2818        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2819                "wifi_networks_available_notification_on";
2820
2821        /**
2822         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2823         * Connecting to a network will reset the timer.
2824         */
2825        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2826                "wifi_networks_available_repeat_delay";
2827
2828        /**
2829         * 802.11 country code in ISO 3166 format
2830         * @hide
2831         */
2832        public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
2833
2834
2835        /**
2836         * When the number of open networks exceeds this number, the
2837         * least-recently-used excess networks will be removed.
2838         */
2839        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
2840
2841        /**
2842         * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
2843         */
2844        public static final String WIFI_ON = "wifi_on";
2845
2846        /**
2847         * Used to save the Wifi_ON state prior to tethering.
2848         * This state will be checked to restore Wifi after
2849         * the user turns off tethering.
2850         *
2851         * @hide
2852         */
2853        public static final String WIFI_SAVED_STATE = "wifi_saved_state";
2854
2855        /**
2856         * AP SSID
2857         *
2858         * @hide
2859         */
2860        public static final String WIFI_AP_SSID = "wifi_ap_ssid";
2861
2862        /**
2863         * AP security
2864         *
2865         * @hide
2866         */
2867        public static final String WIFI_AP_SECURITY = "wifi_ap_security";
2868
2869        /**
2870         * AP passphrase
2871         *
2872         * @hide
2873         */
2874        public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
2875
2876        /**
2877         * The acceptable packet loss percentage (range 0 - 100) before trying
2878         * another AP on the same network.
2879         */
2880        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2881                "wifi_watchdog_acceptable_packet_loss_percentage";
2882
2883        /**
2884         * The number of access points required for a network in order for the
2885         * watchdog to monitor it.
2886         */
2887        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
2888
2889        /**
2890         * The delay between background checks.
2891         */
2892        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2893                "wifi_watchdog_background_check_delay_ms";
2894
2895        /**
2896         * Whether the Wi-Fi watchdog is enabled for background checking even
2897         * after it thinks the user has connected to a good access point.
2898         */
2899        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2900                "wifi_watchdog_background_check_enabled";
2901
2902        /**
2903         * The timeout for a background ping
2904         */
2905        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2906                "wifi_watchdog_background_check_timeout_ms";
2907
2908        /**
2909         * The number of initial pings to perform that *may* be ignored if they
2910         * fail. Again, if these fail, they will *not* be used in packet loss
2911         * calculation. For example, one network always seemed to time out for
2912         * the first couple pings, so this is set to 3 by default.
2913         */
2914        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2915            "wifi_watchdog_initial_ignored_ping_count";
2916
2917        /**
2918         * The maximum number of access points (per network) to attempt to test.
2919         * If this number is reached, the watchdog will no longer monitor the
2920         * initial connection state for the network. This is a safeguard for
2921         * networks containing multiple APs whose DNS does not respond to pings.
2922         */
2923        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
2924
2925        /**
2926         * Whether the Wi-Fi watchdog is enabled.
2927         */
2928        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2929
2930        /**
2931         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
2932         */
2933        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2934
2935        /**
2936         * The number of pings to test if an access point is a good connection.
2937         */
2938        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
2939
2940        /**
2941         * The delay between pings.
2942         */
2943        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
2944
2945        /**
2946         * The timeout per ping.
2947         */
2948        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
2949
2950        /**
2951         * Setting to turn off walled garden test on Wi-Fi. Feature is enabled by default and
2952         * the setting needs to be set to 0 to disable it.
2953         * @hide
2954         */
2955        public static final String WIFI_WATCHDOG_WALLED_GARDEN_TEST_ENABLED =
2956                "wifi_watchdog_walled_garden_test_enabled";
2957
2958        /**
2959         * The URL used for walled garden check upon a new conection. WifiWatchdogService
2960         * fetches the URL and checks to see if {@link #WIFI_WATCHDOG_WALLED_GARDEN_PATTERN}
2961         * is not part of the title string to notify the user on the presence of a walled garden.
2962         * @hide
2963         */
2964        public static final String WIFI_WATCHDOG_WALLED_GARDEN_URL =
2965                "wifi_watchdog_walled_garden_url";
2966
2967        /**
2968         * The pattern string in the fetched URL used to detect a walled garden
2969         * @hide
2970         */
2971        public static final String WIFI_WATCHDOG_WALLED_GARDEN_PATTERN =
2972                "wifi_watchdog_walled_garden_pattern";
2973
2974        /**
2975         * The maximum number of times we will retry a connection to an access
2976         * point for which we have failed in acquiring an IP address from DHCP.
2977         * A value of N means that we will make N+1 connection attempts in all.
2978         */
2979        public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
2980
2981        /**
2982         * The operational wifi frequency band
2983         * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
2984         * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
2985         * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
2986         *
2987         * @hide
2988         */
2989        public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
2990
2991        /**
2992         * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2993         * data connectivity to be established after a disconnect from Wi-Fi.
2994         */
2995        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2996            "wifi_mobile_data_transition_wakelock_timeout_ms";
2997
2998        /**
2999         * Whether background data usage is allowed by the user. See
3000         * ConnectivityManager for more info.
3001         */
3002        public static final String BACKGROUND_DATA = "background_data";
3003
3004        /**
3005         * Origins for which browsers should allow geolocation by default.
3006         * The value is a space-separated list of origins.
3007         */
3008        public static final String ALLOWED_GEOLOCATION_ORIGINS
3009                = "allowed_geolocation_origins";
3010
3011        /**
3012         * Whether mobile data connections are allowed by the user.  See
3013         * ConnectivityManager for more info.
3014         * @hide
3015         */
3016        public static final String MOBILE_DATA = "mobile_data";
3017
3018        /**
3019         * The CDMA roaming mode 0 = Home Networks, CDMA default
3020         *                       1 = Roaming on Affiliated networks
3021         *                       2 = Roaming on any networks
3022         * @hide
3023         */
3024        public static final String CDMA_ROAMING_MODE = "roaming_settings";
3025
3026        /**
3027         * The CDMA subscription mode 0 = RUIM/SIM (default)
3028         *                                1 = NV
3029         * @hide
3030         */
3031        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
3032
3033        /**
3034         * The preferred network mode   7 = Global
3035         *                              6 = EvDo only
3036         *                              5 = CDMA w/o EvDo
3037         *                              4 = CDMA / EvDo auto
3038         *                              3 = GSM / WCDMA auto
3039         *                              2 = WCDMA only
3040         *                              1 = GSM only
3041         *                              0 = GSM / WCDMA preferred
3042         * @hide
3043         */
3044        public static final String PREFERRED_NETWORK_MODE =
3045                "preferred_network_mode";
3046
3047        /**
3048         * The preferred TTY mode     0 = TTy Off, CDMA default
3049         *                            1 = TTY Full
3050         *                            2 = TTY HCO
3051         *                            3 = TTY VCO
3052         * @hide
3053         */
3054        public static final String PREFERRED_TTY_MODE =
3055                "preferred_tty_mode";
3056
3057
3058        /**
3059         * CDMA Cell Broadcast SMS
3060         *                            0 = CDMA Cell Broadcast SMS disabled
3061         *                            1 = CDMA Cell Broadcast SMS enabled
3062         * @hide
3063         */
3064        public static final String CDMA_CELL_BROADCAST_SMS =
3065                "cdma_cell_broadcast_sms";
3066
3067        /**
3068         * The cdma subscription 0 = Subscription from RUIM, when available
3069         *                       1 = Subscription from NV
3070         * @hide
3071         */
3072        public static final String PREFERRED_CDMA_SUBSCRIPTION =
3073                "preferred_cdma_subscription";
3074
3075        /**
3076         * Whether the enhanced voice privacy mode is enabled.
3077         * 0 = normal voice privacy
3078         * 1 = enhanced voice privacy
3079         * @hide
3080         */
3081        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
3082
3083        /**
3084         * Whether the TTY mode mode is enabled.
3085         * 0 = disabled
3086         * 1 = enabled
3087         * @hide
3088         */
3089        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
3090
3091        /**
3092         * Controls whether settings backup is enabled.
3093         * Type: int ( 0 = disabled, 1 = enabled )
3094         * @hide
3095         */
3096        public static final String BACKUP_ENABLED = "backup_enabled";
3097
3098        /**
3099         * Controls whether application data is automatically restored from backup
3100         * at install time.
3101         * Type: int ( 0 = disabled, 1 = enabled )
3102         * @hide
3103         */
3104        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
3105
3106        /**
3107         * Indicates whether settings backup has been fully provisioned.
3108         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
3109         * @hide
3110         */
3111        public static final String BACKUP_PROVISIONED = "backup_provisioned";
3112
3113        /**
3114         * Component of the transport to use for backup/restore.
3115         * @hide
3116         */
3117        public static final String BACKUP_TRANSPORT = "backup_transport";
3118
3119        /**
3120         * Version for which the setup wizard was last shown.  Bumped for
3121         * each release when there is new setup information to show.
3122         * @hide
3123         */
3124        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
3125
3126        /**
3127         * How frequently (in seconds) to check the memory status of the
3128         * device.
3129         * @hide
3130         */
3131        public static final String MEMCHECK_INTERVAL = "memcheck_interval";
3132
3133        /**
3134         * Max frequency (in seconds) to log memory check stats, in realtime
3135         * seconds.  This allows for throttling of logs when the device is
3136         * running for large amounts of time.
3137         * @hide
3138         */
3139        public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
3140                "memcheck_log_realtime_interval";
3141
3142        /**
3143         * Boolean indicating whether rebooting due to system memory checks
3144         * is enabled.
3145         * @hide
3146         */
3147        public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
3148
3149        /**
3150         * How many bytes the system process must be below to avoid scheduling
3151         * a soft reboot.  This reboot will happen when it is next determined
3152         * to be a good time.
3153         * @hide
3154         */
3155        public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
3156
3157        /**
3158         * How many bytes the system process must be below to avoid scheduling
3159         * a hard reboot.  This reboot will happen immediately.
3160         * @hide
3161         */
3162        public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
3163
3164        /**
3165         * How many bytes the phone process must be below to avoid scheduling
3166         * a soft restart.  This restart will happen when it is next determined
3167         * to be a good time.
3168         * @hide
3169         */
3170        public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
3171
3172        /**
3173         * How many bytes the phone process must be below to avoid scheduling
3174         * a hard restart.  This restart will happen immediately.
3175         * @hide
3176         */
3177        public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
3178
3179        /**
3180         * Boolean indicating whether restarting the phone process due to
3181         * memory checks is enabled.
3182         * @hide
3183         */
3184        public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
3185
3186        /**
3187         * First time during the day it is okay to kill processes
3188         * or reboot the device due to low memory situations.  This number is
3189         * in seconds since midnight.
3190         * @hide
3191         */
3192        public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
3193
3194        /**
3195         * Last time during the day it is okay to kill processes
3196         * or reboot the device due to low memory situations.  This number is
3197         * in seconds since midnight.
3198         * @hide
3199         */
3200        public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
3201
3202        /**
3203         * How long the screen must have been off in order to kill processes
3204         * or reboot.  This number is in seconds.  A value of -1 means to
3205         * entirely disregard whether the screen is on.
3206         * @hide
3207         */
3208        public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
3209
3210        /**
3211         * How much time there must be until the next alarm in order to kill processes
3212         * or reboot.  This number is in seconds.  Note: this value must be
3213         * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
3214         * always see an alarm scheduled within its time.
3215         * @hide
3216         */
3217        public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
3218
3219        /**
3220         * How frequently to check whether it is a good time to restart things,
3221         * if the device is in a bad state.  This number is in seconds.  Note:
3222         * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
3223         * the alarm to schedule the recheck will always appear within the
3224         * minimum "do not execute now" time.
3225         * @hide
3226         */
3227        public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
3228
3229        /**
3230         * How frequently (in DAYS) to reboot the device.  If 0, no reboots
3231         * will occur.
3232         * @hide
3233         */
3234        public static final String REBOOT_INTERVAL = "reboot_interval";
3235
3236        /**
3237         * First time during the day it is okay to force a reboot of the
3238         * device (if REBOOT_INTERVAL is set).  This number is
3239         * in seconds since midnight.
3240         * @hide
3241         */
3242        public static final String REBOOT_START_TIME = "reboot_start_time";
3243
3244        /**
3245         * The window of time (in seconds) after each REBOOT_INTERVAL in which
3246         * a reboot can be executed.  If 0, a reboot will always be executed at
3247         * exactly the given time.  Otherwise, it will only be executed if
3248         * the device is idle within the window.
3249         * @hide
3250         */
3251        public static final String REBOOT_WINDOW = "reboot_window";
3252
3253        /**
3254         * Threshold values for the duration and level of a discharge cycle, under
3255         * which we log discharge cycle info.
3256         * @hide
3257         */
3258        public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3259                "battery_discharge_duration_threshold";
3260        /** @hide */
3261        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
3262
3263        /**
3264         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3265         * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3266         * will never display the "Report" button.
3267         * Type: int ( 0 = disallow, 1 = allow )
3268         * @hide
3269         */
3270        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3271
3272        /**
3273         * Nonzero causes Log.wtf() to crash.
3274         * @hide
3275         */
3276        public static final String WTF_IS_FATAL = "wtf_is_fatal";
3277
3278        /**
3279         * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}.
3280         * @hide
3281         */
3282        public static final String DROPBOX_AGE_SECONDS =
3283                "dropbox_age_seconds";
3284        /**
3285         * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around.
3286         * @hide
3287         */
3288        public static final String DROPBOX_MAX_FILES =
3289                "dropbox_max_files";
3290        /**
3291         * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what.
3292         * @hide
3293         */
3294        public static final String DROPBOX_QUOTA_KB =
3295                "dropbox_quota_kb";
3296        /**
3297         * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use.
3298         * @hide
3299         */
3300        public static final String DROPBOX_QUOTA_PERCENT =
3301                "dropbox_quota_percent";
3302        /**
3303         * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into.
3304         * @hide
3305         */
3306        public static final String DROPBOX_RESERVE_PERCENT =
3307                "dropbox_reserve_percent";
3308        /**
3309         * Prefix for per-tag dropbox disable/enable settings.
3310         * @hide
3311         */
3312        public static final String DROPBOX_TAG_PREFIX =
3313                "dropbox:";
3314        /**
3315         * Lines of logcat to include with system crash/ANR/etc. reports,
3316         * as a prefix of the dropbox tag of the report type.
3317         * For example, "logcat_for_system_server_anr" controls the lines
3318         * of logcat captured with system server ANR reports.  0 to disable.
3319         * @hide
3320         */
3321        public static final String ERROR_LOGCAT_PREFIX =
3322                "logcat_for_";
3323
3324
3325        /**
3326         * Screen timeout in milliseconds corresponding to the
3327         * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3328         * possible screen timeout behavior.)
3329         * @hide
3330         */
3331        public static final String SHORT_KEYLIGHT_DELAY_MS =
3332                "short_keylight_delay_ms";
3333
3334        /**
3335         * The interval in minutes after which the amount of free storage left on the
3336         * device is logged to the event log
3337         * @hide
3338         */
3339        public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3340                "sys_free_storage_log_interval";
3341
3342        /**
3343         * Threshold for the amount of change in disk free space required to report the amount of
3344         * free space. Used to prevent spamming the logs when the disk free space isn't changing
3345         * frequently.
3346         * @hide
3347         */
3348        public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3349                "disk_free_change_reporting_threshold";
3350
3351
3352        /**
3353         * Minimum percentage of free storage on the device that is used to determine if
3354         * the device is running low on storage.  The default is 10.
3355         * <p>Say this value is set to 10, the device is considered running low on storage
3356         * if 90% or more of the device storage is filled up.
3357         * @hide
3358         */
3359        public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3360                "sys_storage_threshold_percentage";
3361
3362        /**
3363         * Maximum byte size of the low storage threshold.  This is to ensure
3364         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in
3365         * an overly large threshold for large storage devices.  Currently this
3366         * must be less than 2GB.  This default is 500MB.
3367         * @hide
3368         */
3369        public static final String SYS_STORAGE_THRESHOLD_MAX_BYTES =
3370                "sys_storage_threshold_max_bytes";
3371
3372        /**
3373         * Minimum bytes of free storage on the device before the data
3374         * partition is considered full. By default, 1 MB is reserved
3375         * to avoid system-wide SQLite disk full exceptions.
3376         * @hide
3377         */
3378        public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES =
3379                "sys_storage_full_threshold_bytes";
3380
3381        /**
3382         * The interval in milliseconds after which Wi-Fi is considered idle.
3383         * When idle, it is possible for the device to be switched from Wi-Fi to
3384         * the mobile data network.
3385         * @hide
3386         */
3387        public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3388
3389        /**
3390         * The interval in milliseconds to issue wake up scans when wifi needs
3391         * to connect. This is necessary to connect to an access point when
3392         * device is on the move and the screen is off.
3393         * @hide
3394         */
3395        public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
3396                "wifi_framework_scan_interval_ms";
3397
3398        /**
3399         * The interval in milliseconds to scan as used by the wifi supplicant
3400         * @hide
3401         */
3402        public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
3403                "wifi_supplicant_scan_interval_ms";
3404
3405        /**
3406         * The interval in milliseconds at which to check packet counts on the
3407         * mobile data interface when screen is on, to detect possible data
3408         * connection problems.
3409         * @hide
3410         */
3411        public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3412                "pdp_watchdog_poll_interval_ms";
3413
3414        /**
3415         * The interval in milliseconds at which to check packet counts on the
3416         * mobile data interface when screen is off, to detect possible data
3417         * connection problems.
3418         * @hide
3419         */
3420        public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3421                "pdp_watchdog_long_poll_interval_ms";
3422
3423        /**
3424         * The interval in milliseconds at which to check packet counts on the
3425         * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3426         * outgoing packets has been reached without incoming packets.
3427         * @hide
3428         */
3429        public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3430                "pdp_watchdog_error_poll_interval_ms";
3431
3432        /**
3433         * The number of outgoing packets sent without seeing an incoming packet
3434         * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3435         * device is logged to the event log
3436         * @hide
3437         */
3438        public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3439                "pdp_watchdog_trigger_packet_count";
3440
3441        /**
3442         * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3443         * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3444         * attempting data connection recovery.
3445         * @hide
3446         */
3447        public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3448                "pdp_watchdog_error_poll_count";
3449
3450        /**
3451         * The number of failed PDP reset attempts before moving to something more
3452         * drastic: re-registering to the network.
3453         * @hide
3454         */
3455        public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3456                "pdp_watchdog_max_pdp_reset_fail_count";
3457
3458        /**
3459         * The interval in milliseconds at which to check gprs registration
3460         * after the first registration mismatch of gprs and voice service,
3461         * to detect possible data network registration problems.
3462         *
3463         * @hide
3464         */
3465        public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3466                "gprs_register_check_period_ms";
3467
3468        /**
3469         * The length of time in milli-seconds that automatic small adjustments to
3470         * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3471         * @hide
3472         */
3473        public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3474
3475        /**
3476         * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3477         * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3478         * exceeded.
3479         * @hide
3480         */
3481        public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3482
3483        /**
3484         * The maximum reconnect delay for short network outages or when the network is suspended
3485         * due to phone use.
3486         * @hide
3487         */
3488        public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3489                "sync_max_retry_delay_in_seconds";
3490
3491        /**
3492         * The interval in milliseconds at which to check the number of SMS sent
3493         * out without asking for use permit, to limit the un-authorized SMS
3494         * usage.
3495         * @hide
3496         */
3497        public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3498                "sms_outgoing_check_interval_ms";
3499
3500        /**
3501         * The number of outgoing SMS sent without asking for user permit
3502         * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3503         * @hide
3504         */
3505        public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
3506                "sms_outgoing_check_max_count";
3507
3508        /**
3509         * The global search provider chosen by the user (if multiple global
3510         * search providers are installed). This will be the provider returned
3511         * by {@link SearchManager#getGlobalSearchActivity()} if it's still
3512         * installed. This setting is stored as a flattened component name as
3513         * per {@link ComponentName#flattenToString()}.
3514         *
3515         * @hide
3516         */
3517        public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
3518                "search_global_search_activity";
3519
3520        /**
3521         * The number of promoted sources in GlobalSearch.
3522         * @hide
3523         */
3524        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3525        /**
3526         * The maximum number of suggestions returned by GlobalSearch.
3527         * @hide
3528         */
3529        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3530        /**
3531         * The number of suggestions GlobalSearch will ask each non-web search source for.
3532         * @hide
3533         */
3534        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3535        /**
3536         * The number of suggestions the GlobalSearch will ask the web search source for.
3537         * @hide
3538         */
3539        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3540                "search_web_results_override_limit";
3541        /**
3542         * The number of milliseconds that GlobalSearch will wait for suggestions from
3543         * promoted sources before continuing with all other sources.
3544         * @hide
3545         */
3546        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3547                "search_promoted_source_deadline_millis";
3548        /**
3549         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3550         * @hide
3551         */
3552        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3553        /**
3554         * The maximum number of milliseconds that GlobalSearch shows the previous results
3555         * after receiving a new query.
3556         * @hide
3557         */
3558        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3559        /**
3560         * The maximum age of log data used for shortcuts in GlobalSearch.
3561         * @hide
3562         */
3563        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3564        /**
3565         * The maximum age of log data used for source ranking in GlobalSearch.
3566         * @hide
3567         */
3568        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3569                "search_max_source_event_age_millis";
3570        /**
3571         * The minimum number of impressions needed to rank a source in GlobalSearch.
3572         * @hide
3573         */
3574        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3575                "search_min_impressions_for_source_ranking";
3576        /**
3577         * The minimum number of clicks needed to rank a source in GlobalSearch.
3578         * @hide
3579         */
3580        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3581                "search_min_clicks_for_source_ranking";
3582        /**
3583         * The maximum number of shortcuts shown by GlobalSearch.
3584         * @hide
3585         */
3586        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3587        /**
3588         * The size of the core thread pool for suggestion queries in GlobalSearch.
3589         * @hide
3590         */
3591        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3592                "search_query_thread_core_pool_size";
3593        /**
3594         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3595         * @hide
3596         */
3597        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3598                "search_query_thread_max_pool_size";
3599        /**
3600         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3601         * @hide
3602         */
3603        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3604                "search_shortcut_refresh_core_pool_size";
3605        /**
3606         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3607         * @hide
3608         */
3609        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3610                "search_shortcut_refresh_max_pool_size";
3611        /**
3612         * The maximun time that excess threads in the GlobalSeach thread pools will
3613         * wait before terminating.
3614         * @hide
3615         */
3616        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3617                "search_thread_keepalive_seconds";
3618        /**
3619         * The maximum number of concurrent suggestion queries to each source.
3620         * @hide
3621         */
3622        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3623                "search_per_source_concurrent_query_limit";
3624
3625        /**
3626         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
3627         * @hide
3628         */
3629        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
3630
3631        /**
3632         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3633         * @hide
3634         */
3635        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3636
3637        /**
3638         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3639         * @hide
3640         */
3641        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3642
3643        /**
3644         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3645         * @hide
3646         */
3647        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
3648
3649        /**
3650         * If nonzero, ANRs in invisible background processes bring up a dialog.
3651         * Otherwise, the process will be silently killed.
3652         * @hide
3653         */
3654        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
3655
3656        /**
3657         * The {@link ComponentName} string of the service to be used as the voice recognition
3658         * service.
3659         *
3660         * @hide
3661         */
3662        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
3663
3664        /**
3665         * What happens when the user presses the Power button while in-call
3666         * and the screen is on.<br/>
3667         * <b>Values:</b><br/>
3668         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
3669         * 2 - The Power button hangs up the current call.<br/>
3670         *
3671         * @hide
3672         */
3673        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
3674
3675        /**
3676         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
3677         * @hide
3678         */
3679        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
3680
3681        /**
3682         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
3683         * @hide
3684         */
3685        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
3686
3687        /**
3688         * INCALL_POWER_BUTTON_BEHAVIOR default value.
3689         * @hide
3690         */
3691        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
3692                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
3693
3694        /**
3695         * The current night mode that has been selected by the user.  Owned
3696         * and controlled by UiModeManagerService.  Constants are as per
3697         * UiModeManager.
3698         * @hide
3699         */
3700        public static final String UI_NIGHT_MODE = "ui_night_mode";
3701
3702        /**
3703         * Let user pick default install location.
3704         * @hide
3705         */
3706        public static final String SET_INSTALL_LOCATION = "set_install_location";
3707
3708        /**
3709         * Default install location value.
3710         * 0 = auto, let system decide
3711         * 1 = internal
3712         * 2 = sdcard
3713         * @hide
3714         */
3715        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
3716
3717        /**
3718         * The bandwidth throttle polling freqency in seconds
3719         * @hide
3720         */
3721        public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3722
3723        /**
3724         * The bandwidth throttle threshold (long)
3725         * @hide
3726         */
3727        public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
3728
3729        /**
3730         * The bandwidth throttle value (kbps)
3731         * @hide
3732         */
3733        public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
3734
3735        /**
3736         * The bandwidth throttle reset calendar day (1-28)
3737         * @hide
3738         */
3739        public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3740
3741        /**
3742         * The throttling notifications we should send
3743         * @hide
3744         */
3745        public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3746
3747        /**
3748         * Help URI for data throttling policy
3749         * @hide
3750         */
3751        public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3752
3753        /**
3754         * The length of time in Sec that we allow our notion of NTP time
3755         * to be cached before we refresh it
3756         * @hide
3757         */
3758        public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3759                "throttle_max_ntp_cache_age_sec";
3760
3761        /**
3762         * The maximum size, in bytes, of a download that the download manager will transfer over
3763         * a non-wifi connection.
3764         * @hide
3765         */
3766        public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
3767                "download_manager_max_bytes_over_mobile";
3768
3769        /**
3770         * The recommended maximum size, in bytes, of a download that the download manager should
3771         * transfer over a non-wifi connection. Over this size, the use will be warned, but will
3772         * have the option to start the download over the mobile connection anyway.
3773         * @hide
3774         */
3775        public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
3776                "download_manager_recommended_max_bytes_over_mobile";
3777
3778        /**
3779         * ms during which to consume extra events related to Inet connection condition
3780         * after a transtion to fully-connected
3781         * @hide
3782         */
3783        public static final String INET_CONDITION_DEBOUNCE_UP_DELAY =
3784                "inet_condition_debounce_up_delay";
3785
3786        /**
3787         * ms during which to consume extra events related to Inet connection condtion
3788         * after a transtion to partly-connected
3789         * @hide
3790         */
3791        public static final String INET_CONDITION_DEBOUNCE_DOWN_DELAY =
3792                "inet_condition_debounce_down_delay";
3793
3794        /**
3795         * URL to open browser on to allow user to manage a prepay account
3796         * @hide
3797         */
3798        public static final String SETUP_PREPAID_DATA_SERVICE_URL =
3799                "setup_prepaid_data_service_url";
3800
3801        /**
3802         * URL to attempt a GET on to see if this is a prepay device
3803         * @hide
3804         */
3805        public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
3806                "setup_prepaid_detection_target_url";
3807
3808        /**
3809         * Host to check for a redirect to after an attempt to GET
3810         * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
3811         * this is a prepaid device with zero balance.)
3812         * @hide
3813         */
3814        public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
3815                "setup_prepaid_detection_redir_host";
3816
3817        /**
3818         * The user's preferred "dream" (interactive screensaver) component.
3819         *
3820         * This component will be launched by the PhoneWindowManager after the user's chosen idle
3821         * timeout (specified by {@link #DREAM_TIMEOUT}).
3822         * @hide
3823         */
3824        public static final String DREAM_COMPONENT =
3825                "dream_component";
3826
3827        /**
3828         * The delay before a "dream" is started (set to 0 to disable).
3829         * @hide
3830         */
3831        public static final String DREAM_TIMEOUT =
3832                "dream_timeout";
3833
3834        /** {@hide} */
3835        public static final String NETSTATS_ENABLED = "netstats_enabled";
3836        /** {@hide} */
3837        public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
3838        /** {@hide} */
3839        public static final String NETSTATS_PERSIST_THRESHOLD = "netstats_persist_threshold";
3840        /** {@hide} */
3841        public static final String NETSTATS_NETWORK_BUCKET_DURATION = "netstats_network_bucket_duration";
3842        /** {@hide} */
3843        public static final String NETSTATS_NETWORK_MAX_HISTORY = "netstats_network_max_history";
3844        /** {@hide} */
3845        public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
3846        /** {@hide} */
3847        public static final String NETSTATS_UID_MAX_HISTORY = "netstats_uid_max_history";
3848        /** {@hide} */
3849        public static final String NETSTATS_TAG_MAX_HISTORY = "netstats_tag_max_history";
3850
3851        /** Preferred NTP server. {@hide} */
3852        public static final String NTP_SERVER = "ntp_server";
3853        /** Timeout in milliseconds to wait for NTP server. {@hide} */
3854        public static final String NTP_TIMEOUT = "ntp_timeout";
3855
3856        /** Autofill server address (Used in WebView/browser). {@hide} */
3857        public static final String WEB_AUTOFILL_QUERY_URL =
3858            "web_autofill_query_url";
3859
3860        /**
3861         * @hide
3862         */
3863        public static final String[] SETTINGS_TO_BACKUP = {
3864            ADB_ENABLED,
3865            ALLOW_MOCK_LOCATION,
3866            PARENTAL_CONTROL_ENABLED,
3867            PARENTAL_CONTROL_REDIRECT_URL,
3868            USB_MASS_STORAGE_ENABLED,
3869            ACCESSIBILITY_ENABLED,
3870            ACCESSIBILITY_SCRIPT_INJECTION,
3871            BACKUP_AUTO_RESTORE,
3872            ENABLED_ACCESSIBILITY_SERVICES,
3873            TTS_USE_DEFAULTS,
3874            TTS_DEFAULT_RATE,
3875            TTS_DEFAULT_PITCH,
3876            TTS_DEFAULT_SYNTH,
3877            TTS_DEFAULT_LANG,
3878            TTS_DEFAULT_COUNTRY,
3879            TTS_ENABLED_PLUGINS,
3880            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3881            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
3882            WIFI_NUM_OPEN_NETWORKS_KEPT,
3883            MOUNT_PLAY_NOTIFICATION_SND,
3884            MOUNT_UMS_AUTOSTART,
3885            MOUNT_UMS_PROMPT,
3886            MOUNT_UMS_NOTIFY_ENABLED,
3887            UI_NIGHT_MODE
3888        };
3889
3890        /**
3891         * Helper method for determining if a location provider is enabled.
3892         * @param cr the content resolver to use
3893         * @param provider the location provider to query
3894         * @return true if the provider is enabled
3895         */
3896        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3897            String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
3898            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
3899        }
3900
3901        /**
3902         * Thread-safe method for enabling or disabling a single location provider.
3903         * @param cr the content resolver to use
3904         * @param provider the location provider to enable or disable
3905         * @param enabled true if the provider should be enabled
3906         */
3907        public static final void setLocationProviderEnabled(ContentResolver cr,
3908                String provider, boolean enabled) {
3909            // to ensure thread safety, we write the provider name with a '+' or '-'
3910            // and let the SettingsProvider handle it rather than reading and modifying
3911            // the list of enabled providers.
3912            if (enabled) {
3913                provider = "+" + provider;
3914            } else {
3915                provider = "-" + provider;
3916            }
3917            putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3918        }
3919    }
3920
3921    /**
3922     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
3923     * Intent URL, allowing it to be either a web page or a particular
3924     * application activity.
3925     *
3926     * @hide
3927     */
3928    public static final class Bookmarks implements BaseColumns
3929    {
3930        private static final String TAG = "Bookmarks";
3931
3932        /**
3933         * The content:// style URL for this table
3934         */
3935        public static final Uri CONTENT_URI =
3936            Uri.parse("content://" + AUTHORITY + "/bookmarks");
3937
3938        /**
3939         * The row ID.
3940         * <p>Type: INTEGER</p>
3941         */
3942        public static final String ID = "_id";
3943
3944        /**
3945         * Descriptive name of the bookmark that can be displayed to the user.
3946         * If this is empty, the title should be resolved at display time (use
3947         * {@link #getTitle(Context, Cursor)} any time you want to display the
3948         * title of a bookmark.)
3949         * <P>
3950         * Type: TEXT
3951         * </P>
3952         */
3953        public static final String TITLE = "title";
3954
3955        /**
3956         * Arbitrary string (displayed to the user) that allows bookmarks to be
3957         * organized into categories.  There are some special names for
3958         * standard folders, which all start with '@'.  The label displayed for
3959         * the folder changes with the locale (via {@link #getLabelForFolder}) but
3960         * the folder name does not change so you can consistently query for
3961         * the folder regardless of the current locale.
3962         *
3963         * <P>Type: TEXT</P>
3964         *
3965         */
3966        public static final String FOLDER = "folder";
3967
3968        /**
3969         * The Intent URL of the bookmark, describing what it points to.  This
3970         * value is given to {@link android.content.Intent#getIntent} to create
3971         * an Intent that can be launched.
3972         * <P>Type: TEXT</P>
3973         */
3974        public static final String INTENT = "intent";
3975
3976        /**
3977         * Optional shortcut character associated with this bookmark.
3978         * <P>Type: INTEGER</P>
3979         */
3980        public static final String SHORTCUT = "shortcut";
3981
3982        /**
3983         * The order in which the bookmark should be displayed
3984         * <P>Type: INTEGER</P>
3985         */
3986        public static final String ORDERING = "ordering";
3987
3988        private static final String[] sIntentProjection = { INTENT };
3989        private static final String[] sShortcutProjection = { ID, SHORTCUT };
3990        private static final String sShortcutSelection = SHORTCUT + "=?";
3991
3992        /**
3993         * Convenience function to retrieve the bookmarked Intent for a
3994         * particular shortcut key.
3995         *
3996         * @param cr The ContentResolver to query.
3997         * @param shortcut The shortcut key.
3998         *
3999         * @return Intent The bookmarked URL, or null if there is no bookmark
4000         *         matching the given shortcut.
4001         */
4002        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
4003        {
4004            Intent intent = null;
4005
4006            Cursor c = cr.query(CONTENT_URI,
4007                    sIntentProjection, sShortcutSelection,
4008                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
4009            // Keep trying until we find a valid shortcut
4010            try {
4011                while (intent == null && c.moveToNext()) {
4012                    try {
4013                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
4014                        intent = Intent.parseUri(intentURI, 0);
4015                    } catch (java.net.URISyntaxException e) {
4016                        // The stored URL is bad...  ignore it.
4017                    } catch (IllegalArgumentException e) {
4018                        // Column not found
4019                        Log.w(TAG, "Intent column not found", e);
4020                    }
4021                }
4022            } finally {
4023                if (c != null) c.close();
4024            }
4025
4026            return intent;
4027        }
4028
4029        /**
4030         * Add a new bookmark to the system.
4031         *
4032         * @param cr The ContentResolver to query.
4033         * @param intent The desired target of the bookmark.
4034         * @param title Bookmark title that is shown to the user; null if none
4035         *            or it should be resolved to the intent's title.
4036         * @param folder Folder in which to place the bookmark; null if none.
4037         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
4038         *            this is non-zero and there is an existing bookmark entry
4039         *            with this same shortcut, then that existing shortcut is
4040         *            cleared (the bookmark is not removed).
4041         * @return The unique content URL for the new bookmark entry.
4042         */
4043        public static Uri add(ContentResolver cr,
4044                                           Intent intent,
4045                                           String title,
4046                                           String folder,
4047                                           char shortcut,
4048                                           int ordering)
4049        {
4050            // If a shortcut is supplied, and it is already defined for
4051            // another bookmark, then remove the old definition.
4052            if (shortcut != 0) {
4053                cr.delete(CONTENT_URI, sShortcutSelection,
4054                        new String[] { String.valueOf((int) shortcut) });
4055            }
4056
4057            ContentValues values = new ContentValues();
4058            if (title != null) values.put(TITLE, title);
4059            if (folder != null) values.put(FOLDER, folder);
4060            values.put(INTENT, intent.toUri(0));
4061            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
4062            values.put(ORDERING, ordering);
4063            return cr.insert(CONTENT_URI, values);
4064        }
4065
4066        /**
4067         * Return the folder name as it should be displayed to the user.  This
4068         * takes care of localizing special folders.
4069         *
4070         * @param r Resources object for current locale; only need access to
4071         *          system resources.
4072         * @param folder The value found in the {@link #FOLDER} column.
4073         *
4074         * @return CharSequence The label for this folder that should be shown
4075         *         to the user.
4076         */
4077        public static CharSequence getLabelForFolder(Resources r, String folder) {
4078            return folder;
4079        }
4080
4081        /**
4082         * Return the title as it should be displayed to the user. This takes
4083         * care of localizing bookmarks that point to activities.
4084         *
4085         * @param context A context.
4086         * @param cursor A cursor pointing to the row whose title should be
4087         *        returned. The cursor must contain at least the {@link #TITLE}
4088         *        and {@link #INTENT} columns.
4089         * @return A title that is localized and can be displayed to the user,
4090         *         or the empty string if one could not be found.
4091         */
4092        public static CharSequence getTitle(Context context, Cursor cursor) {
4093            int titleColumn = cursor.getColumnIndex(TITLE);
4094            int intentColumn = cursor.getColumnIndex(INTENT);
4095            if (titleColumn == -1 || intentColumn == -1) {
4096                throw new IllegalArgumentException(
4097                        "The cursor must contain the TITLE and INTENT columns.");
4098            }
4099
4100            String title = cursor.getString(titleColumn);
4101            if (!TextUtils.isEmpty(title)) {
4102                return title;
4103            }
4104
4105            String intentUri = cursor.getString(intentColumn);
4106            if (TextUtils.isEmpty(intentUri)) {
4107                return "";
4108            }
4109
4110            Intent intent;
4111            try {
4112                intent = Intent.parseUri(intentUri, 0);
4113            } catch (URISyntaxException e) {
4114                return "";
4115            }
4116
4117            PackageManager packageManager = context.getPackageManager();
4118            ResolveInfo info = packageManager.resolveActivity(intent, 0);
4119            return info != null ? info.loadLabel(packageManager) : "";
4120        }
4121    }
4122
4123    /**
4124     * Returns the device ID that we should use when connecting to the mobile gtalk server.
4125     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
4126     * from the GoogleLoginService.
4127     *
4128     * @param androidId The Android ID for this device.
4129     * @return The device ID that should be used when connecting to the mobile gtalk server.
4130     * @hide
4131     */
4132    public static String getGTalkDeviceId(long androidId) {
4133        return "android-" + Long.toHexString(androidId);
4134    }
4135}
4136