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