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