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