Settings.java revision 886fd91833e1f5c6ec882baf2ed5e02078911c63
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         * This preference contains the string that shows for owner info on LockScren.
2465         * @hide
2466         */
2467        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
2468
2469        /**
2470         * This preference enables showing the owner info on LockScren.
2471         * @hide
2472         */
2473        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
2474            "lock_screen_owner_info_enabled";
2475
2476        /**
2477         * Whether assisted GPS should be enabled or not.
2478         * @hide
2479         */
2480        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2481
2482        /**
2483         * The Logging ID (a unique 64-bit value) as a hex string.
2484         * Used as a pseudonymous identifier for logging.
2485         * @deprecated This identifier is poorly initialized and has
2486         * many collisions.  It should not be used.
2487         */
2488        @Deprecated
2489        public static final String LOGGING_ID = "logging_id";
2490
2491        /**
2492         * User preference for which network(s) should be used. Only the
2493         * connectivity service should touch this.
2494         */
2495        public static final String NETWORK_PREFERENCE = "network_preference";
2496
2497        /**
2498         * Used to disable Tethering on a device - defaults to true
2499         * @hide
2500         */
2501        public static final String TETHER_SUPPORTED = "tether_supported";
2502
2503        /**
2504         * Used to require DUN APN on the device or not - defaults to a build config value
2505         * which defaults to false
2506         * @hide
2507         */
2508        public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
2509
2510        /**
2511         * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
2512         * corresponding build config values are set it will override the APN DB
2513         * values.
2514         * Consists of a comma seperated list of strings:
2515         * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
2516         * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
2517         * @hide
2518         */
2519        public static final String TETHER_DUN_APN = "tether_dun_apn";
2520
2521        /**
2522         * No longer supported.
2523         */
2524        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
2525
2526        /**
2527         * No longer supported.
2528         */
2529        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
2530
2531        /**
2532         * No longer supported.
2533         */
2534        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
2535
2536        /**
2537         * A positive value indicates the frequency of SamplingProfiler
2538         * taking snapshots in hertz. Zero value means SamplingProfiler is disabled.
2539         *
2540         * @hide
2541         */
2542        public static final String SAMPLING_PROFILER_HZ = "sampling_profiler_hz";
2543
2544        /**
2545         * Settings classname to launch when Settings is clicked from All
2546         * Applications.  Needed because of user testing between the old
2547         * and new Settings apps.
2548         */
2549        // TODO: 881807
2550        public static final String SETTINGS_CLASSNAME = "settings_classname";
2551
2552        /**
2553         * USB Mass Storage Enabled
2554         */
2555        public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
2556
2557        /**
2558         * If this setting is set (to anything), then all references
2559         * to Gmail on the device must change to Google Mail.
2560         */
2561        public static final String USE_GOOGLE_MAIL = "use_google_mail";
2562
2563        /**
2564         * If accessibility is enabled.
2565         */
2566        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2567
2568        /**
2569         * List of the enabled accessibility providers.
2570         */
2571        public static final String ENABLED_ACCESSIBILITY_SERVICES =
2572            "enabled_accessibility_services";
2573
2574        /**
2575         * If injection of accessibility enhancing JavaScript scripts
2576         * is enabled.
2577         * <p>
2578         *   Note: Accessibility injecting scripts are served by the
2579         *   Google infrastructure and enable users with disabilities to
2580         *   efficiantly navigate in and explore web content.
2581         * </p>
2582         * <p>
2583         *   This property represents a boolean value.
2584         * </p>
2585         * @hide
2586         */
2587        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
2588            "accessibility_script_injection";
2589
2590        /**
2591         * Key bindings for navigation in built-in accessibility support for web content.
2592         * <p>
2593         *   Note: These key bindings are for the built-in accessibility navigation for
2594         *   web content which is used as a fall back solution if JavaScript in a WebView
2595         *   is not enabled or the user has not opted-in script injection from Google.
2596         * </p>
2597         * <p>
2598         *   The bindings are separated by semi-colon. A binding is a mapping from
2599         *   a key to a sequence of actions (for more details look at
2600         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
2601         *   string representation of an integer obtained from a meta state (optional) shifted
2602         *   sixteen times left and bitwise ored with a key code. An action is represented
2603         *   as a hexademical string representation of an integer where the first two digits
2604         *   are navigation action index, the second, the third, and the fourth digit pairs
2605         *   represent the action arguments. The separate actions in a binding are colon
2606         *   separated. The key and the action sequence it maps to are separated by equals.
2607         * </p>
2608         * <p>
2609         *   For example, the binding below maps the DPAD right button to traverse the
2610         *   current navigation axis once without firing an accessibility event and to
2611         *   perform the same traversal again but to fire an event:
2612         *   <code>
2613         *     0x16=0x01000100:0x01000101;
2614         *   </code>
2615         * </p>
2616         * <p>
2617         *   The goal of this binding is to enable dynamic rebinding of keys to
2618         *   navigation actions for web content without requiring a framework change.
2619         * </p>
2620         * <p>
2621         *   This property represents a string value.
2622         * </p>
2623         * @hide
2624         */
2625        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
2626            "accessibility_web_content_key_bindings";
2627
2628        /**
2629         * Setting to always use the default text-to-speech settings regardless
2630         * of the application settings.
2631         * 1 = override application settings,
2632         * 0 = use application settings (if specified).
2633         */
2634        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2635
2636        /**
2637         * Default text-to-speech engine speech rate. 100 = 1x
2638         */
2639        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2640
2641        /**
2642         * Default text-to-speech engine pitch. 100 = 1x
2643         */
2644        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2645
2646        /**
2647         * Default text-to-speech engine.
2648         */
2649        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2650
2651        /**
2652         * Default text-to-speech language.
2653         */
2654        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2655
2656        /**
2657         * Default text-to-speech country.
2658         */
2659        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2660
2661        /**
2662         * Default text-to-speech locale variant.
2663         */
2664        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2665
2666        /**
2667         * Space delimited list of plugin packages that are enabled.
2668         */
2669        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
2670
2671        /**
2672         * Whether to notify the user of open networks.
2673         * <p>
2674         * If not connected and the scan results have an open network, we will
2675         * put this notification up. If we attempt to connect to a network or
2676         * the open network(s) disappear, we remove the notification. When we
2677         * show the notification, we will not show it again for
2678         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2679         */
2680        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2681                "wifi_networks_available_notification_on";
2682
2683        /**
2684         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2685         * Connecting to a network will reset the timer.
2686         */
2687        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2688                "wifi_networks_available_repeat_delay";
2689
2690        /**
2691         * The number of radio channels that are allowed in the local
2692         * 802.11 regulatory domain.
2693         * @hide
2694         */
2695        public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
2696
2697        /**
2698         * When the number of open networks exceeds this number, the
2699         * least-recently-used excess networks will be removed.
2700         */
2701        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
2702
2703        /**
2704         * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
2705         */
2706        public static final String WIFI_ON = "wifi_on";
2707
2708        /**
2709         * Used to save the Wifi_ON state prior to tethering.
2710         * This state will be checked to restore Wifi after
2711         * the user turns off tethering.
2712         *
2713         * @hide
2714         */
2715        public static final String WIFI_SAVED_STATE = "wifi_saved_state";
2716
2717        /**
2718         * AP SSID
2719         *
2720         * @hide
2721         */
2722        public static final String WIFI_AP_SSID = "wifi_ap_ssid";
2723
2724        /**
2725         * AP security
2726         *
2727         * @hide
2728         */
2729        public static final String WIFI_AP_SECURITY = "wifi_ap_security";
2730
2731        /**
2732         * AP passphrase
2733         *
2734         * @hide
2735         */
2736        public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
2737
2738        /**
2739         * The acceptable packet loss percentage (range 0 - 100) before trying
2740         * another AP on the same network.
2741         */
2742        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2743                "wifi_watchdog_acceptable_packet_loss_percentage";
2744
2745        /**
2746         * The number of access points required for a network in order for the
2747         * watchdog to monitor it.
2748         */
2749        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
2750
2751        /**
2752         * The delay between background checks.
2753         */
2754        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2755                "wifi_watchdog_background_check_delay_ms";
2756
2757        /**
2758         * Whether the Wi-Fi watchdog is enabled for background checking even
2759         * after it thinks the user has connected to a good access point.
2760         */
2761        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2762                "wifi_watchdog_background_check_enabled";
2763
2764        /**
2765         * The timeout for a background ping
2766         */
2767        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2768                "wifi_watchdog_background_check_timeout_ms";
2769
2770        /**
2771         * The number of initial pings to perform that *may* be ignored if they
2772         * fail. Again, if these fail, they will *not* be used in packet loss
2773         * calculation. For example, one network always seemed to time out for
2774         * the first couple pings, so this is set to 3 by default.
2775         */
2776        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2777            "wifi_watchdog_initial_ignored_ping_count";
2778
2779        /**
2780         * The maximum number of access points (per network) to attempt to test.
2781         * If this number is reached, the watchdog will no longer monitor the
2782         * initial connection state for the network. This is a safeguard for
2783         * networks containing multiple APs whose DNS does not respond to pings.
2784         */
2785        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
2786
2787        /**
2788         * Whether the Wi-Fi watchdog is enabled.
2789         */
2790        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2791
2792        /**
2793         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
2794         */
2795        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2796
2797        /**
2798         * The number of pings to test if an access point is a good connection.
2799         */
2800        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
2801
2802        /**
2803         * The delay between pings.
2804         */
2805        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
2806
2807        /**
2808         * The timeout per ping.
2809         */
2810        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
2811
2812        /**
2813         * The maximum number of times we will retry a connection to an access
2814         * point for which we have failed in acquiring an IP address from DHCP.
2815         * A value of N means that we will make N+1 connection attempts in all.
2816         */
2817        public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
2818
2819        /**
2820         * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2821         * data connectivity to be established after a disconnect from Wi-Fi.
2822         */
2823        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2824            "wifi_mobile_data_transition_wakelock_timeout_ms";
2825
2826        /**
2827         * Whether background data usage is allowed by the user. See
2828         * ConnectivityManager for more info.
2829         */
2830        public static final String BACKGROUND_DATA = "background_data";
2831
2832        /**
2833         * Origins for which browsers should allow geolocation by default.
2834         * The value is a space-separated list of origins.
2835         */
2836        public static final String ALLOWED_GEOLOCATION_ORIGINS
2837                = "allowed_geolocation_origins";
2838
2839        /**
2840         * Whether mobile data connections are allowed by the user.  See
2841         * ConnectivityManager for more info.
2842         * @hide
2843         */
2844        public static final String MOBILE_DATA = "mobile_data";
2845
2846        /**
2847         * The CDMA roaming mode 0 = Home Networks, CDMA default
2848         *                       1 = Roaming on Affiliated networks
2849         *                       2 = Roaming on any networks
2850         * @hide
2851         */
2852        public static final String CDMA_ROAMING_MODE = "roaming_settings";
2853
2854        /**
2855         * The CDMA subscription mode 0 = RUIM/SIM (default)
2856         *                                1 = NV
2857         * @hide
2858         */
2859        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2860
2861        /**
2862         * The preferred network mode   7 = Global
2863         *                              6 = EvDo only
2864         *                              5 = CDMA w/o EvDo
2865         *                              4 = CDMA / EvDo auto
2866         *                              3 = GSM / WCDMA auto
2867         *                              2 = WCDMA only
2868         *                              1 = GSM only
2869         *                              0 = GSM / WCDMA preferred
2870         * @hide
2871         */
2872        public static final String PREFERRED_NETWORK_MODE =
2873                "preferred_network_mode";
2874
2875        /**
2876         * The preferred TTY mode     0 = TTy Off, CDMA default
2877         *                            1 = TTY Full
2878         *                            2 = TTY HCO
2879         *                            3 = TTY VCO
2880         * @hide
2881         */
2882        public static final String PREFERRED_TTY_MODE =
2883                "preferred_tty_mode";
2884
2885
2886        /**
2887         * CDMA Cell Broadcast SMS
2888         *                            0 = CDMA Cell Broadcast SMS disabled
2889         *                            1 = CDMA Cell Broadcast SMS enabled
2890         * @hide
2891         */
2892        public static final String CDMA_CELL_BROADCAST_SMS =
2893                "cdma_cell_broadcast_sms";
2894
2895        /**
2896         * The cdma subscription 0 = Subscription from RUIM, when available
2897         *                       1 = Subscription from NV
2898         * @hide
2899         */
2900        public static final String PREFERRED_CDMA_SUBSCRIPTION =
2901                "preferred_cdma_subscription";
2902
2903        /**
2904         * Whether the enhanced voice privacy mode is enabled.
2905         * 0 = normal voice privacy
2906         * 1 = enhanced voice privacy
2907         * @hide
2908         */
2909        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2910
2911        /**
2912         * Whether the TTY mode mode is enabled.
2913         * 0 = disabled
2914         * 1 = enabled
2915         * @hide
2916         */
2917        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
2918
2919        /**
2920         * Controls whether settings backup is enabled.
2921         * Type: int ( 0 = disabled, 1 = enabled )
2922         * @hide
2923         */
2924        public static final String BACKUP_ENABLED = "backup_enabled";
2925
2926        /**
2927         * Controls whether application data is automatically restored from backup
2928         * at install time.
2929         * Type: int ( 0 = disabled, 1 = enabled )
2930         * @hide
2931         */
2932        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2933
2934        /**
2935         * Indicates whether settings backup has been fully provisioned.
2936         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2937         * @hide
2938         */
2939        public static final String BACKUP_PROVISIONED = "backup_provisioned";
2940
2941        /**
2942         * Component of the transport to use for backup/restore.
2943         * @hide
2944         */
2945        public static final String BACKUP_TRANSPORT = "backup_transport";
2946
2947        /**
2948         * Version for which the setup wizard was last shown.  Bumped for
2949         * each release when there is new setup information to show.
2950         * @hide
2951         */
2952        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
2953
2954        /**
2955         * How frequently (in seconds) to check the memory status of the
2956         * device.
2957         * @hide
2958         */
2959        public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2960
2961        /**
2962         * Max frequency (in seconds) to log memory check stats, in realtime
2963         * seconds.  This allows for throttling of logs when the device is
2964         * running for large amounts of time.
2965         * @hide
2966         */
2967        public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2968                "memcheck_log_realtime_interval";
2969
2970        /**
2971         * Boolean indicating whether rebooting due to system memory checks
2972         * is enabled.
2973         * @hide
2974         */
2975        public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2976
2977        /**
2978         * How many bytes the system process must be below to avoid scheduling
2979         * a soft reboot.  This reboot will happen when it is next determined
2980         * to be a good time.
2981         * @hide
2982         */
2983        public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2984
2985        /**
2986         * How many bytes the system process must be below to avoid scheduling
2987         * a hard reboot.  This reboot will happen immediately.
2988         * @hide
2989         */
2990        public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2991
2992        /**
2993         * How many bytes the phone process must be below to avoid scheduling
2994         * a soft restart.  This restart will happen when it is next determined
2995         * to be a good time.
2996         * @hide
2997         */
2998        public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2999
3000        /**
3001         * How many bytes the phone process must be below to avoid scheduling
3002         * a hard restart.  This restart will happen immediately.
3003         * @hide
3004         */
3005        public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
3006
3007        /**
3008         * Boolean indicating whether restarting the phone process due to
3009         * memory checks is enabled.
3010         * @hide
3011         */
3012        public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
3013
3014        /**
3015         * First time during the day it is okay to kill processes
3016         * or reboot the device due to low memory situations.  This number is
3017         * in seconds since midnight.
3018         * @hide
3019         */
3020        public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
3021
3022        /**
3023         * Last time during the day it is okay to kill processes
3024         * or reboot the device due to low memory situations.  This number is
3025         * in seconds since midnight.
3026         * @hide
3027         */
3028        public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
3029
3030        /**
3031         * How long the screen must have been off in order to kill processes
3032         * or reboot.  This number is in seconds.  A value of -1 means to
3033         * entirely disregard whether the screen is on.
3034         * @hide
3035         */
3036        public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
3037
3038        /**
3039         * How much time there must be until the next alarm in order to kill processes
3040         * or reboot.  This number is in seconds.  Note: this value must be
3041         * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
3042         * always see an alarm scheduled within its time.
3043         * @hide
3044         */
3045        public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
3046
3047        /**
3048         * How frequently to check whether it is a good time to restart things,
3049         * if the device is in a bad state.  This number is in seconds.  Note:
3050         * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
3051         * the alarm to schedule the recheck will always appear within the
3052         * minimum "do not execute now" time.
3053         * @hide
3054         */
3055        public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
3056
3057        /**
3058         * How frequently (in DAYS) to reboot the device.  If 0, no reboots
3059         * will occur.
3060         * @hide
3061         */
3062        public static final String REBOOT_INTERVAL = "reboot_interval";
3063
3064        /**
3065         * First time during the day it is okay to force a reboot of the
3066         * device (if REBOOT_INTERVAL is set).  This number is
3067         * in seconds since midnight.
3068         * @hide
3069         */
3070        public static final String REBOOT_START_TIME = "reboot_start_time";
3071
3072        /**
3073         * The window of time (in seconds) after each REBOOT_INTERVAL in which
3074         * a reboot can be executed.  If 0, a reboot will always be executed at
3075         * exactly the given time.  Otherwise, it will only be executed if
3076         * the device is idle within the window.
3077         * @hide
3078         */
3079        public static final String REBOOT_WINDOW = "reboot_window";
3080
3081        /**
3082         * Threshold values for the duration and level of a discharge cycle, under
3083         * which we log discharge cycle info.
3084         * @hide
3085         */
3086        public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3087                "battery_discharge_duration_threshold";
3088        /** @hide */
3089        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
3090
3091        /**
3092         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3093         * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3094         * will never display the "Report" button.
3095         * Type: int ( 0 = disallow, 1 = allow )
3096         * @hide
3097         */
3098        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3099
3100        /**
3101         * Nonzero causes Log.wtf() to crash.
3102         * @hide
3103         */
3104        public static final String WTF_IS_FATAL = "wtf_is_fatal";
3105
3106        /**
3107         * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}.
3108         * @hide
3109         */
3110        public static final String DROPBOX_AGE_SECONDS =
3111                "dropbox_age_seconds";
3112        /**
3113         * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around.
3114         * @hide
3115         */
3116        public static final String DROPBOX_MAX_FILES =
3117                "dropbox_max_files";
3118        /**
3119         * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what.
3120         * @hide
3121         */
3122        public static final String DROPBOX_QUOTA_KB =
3123                "dropbox_quota_kb";
3124        /**
3125         * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use.
3126         * @hide
3127         */
3128        public static final String DROPBOX_QUOTA_PERCENT =
3129                "dropbox_quota_percent";
3130        /**
3131         * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into.
3132         * @hide
3133         */
3134        public static final String DROPBOX_RESERVE_PERCENT =
3135                "dropbox_reserve_percent";
3136        /**
3137         * Prefix for per-tag dropbox disable/enable settings.
3138         * @hide
3139         */
3140        public static final String DROPBOX_TAG_PREFIX =
3141                "dropbox:";
3142        /**
3143         * Lines of logcat to include with system crash/ANR/etc. reports,
3144         * as a prefix of the dropbox tag of the report type.
3145         * For example, "logcat_for_system_server_anr" controls the lines
3146         * of logcat captured with system server ANR reports.  0 to disable.
3147         * @hide
3148         */
3149        public static final String ERROR_LOGCAT_PREFIX =
3150                "logcat_for_";
3151
3152
3153        /**
3154         * Screen timeout in milliseconds corresponding to the
3155         * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3156         * possible screen timeout behavior.)
3157         * @hide
3158         */
3159        public static final String SHORT_KEYLIGHT_DELAY_MS =
3160                "short_keylight_delay_ms";
3161
3162        /**
3163         * The interval in minutes after which the amount of free storage left on the
3164         * device is logged to the event log
3165         * @hide
3166         */
3167        public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3168                "sys_free_storage_log_interval";
3169
3170        /**
3171         * Threshold for the amount of change in disk free space required to report the amount of
3172         * free space. Used to prevent spamming the logs when the disk free space isn't changing
3173         * frequently.
3174         * @hide
3175         */
3176        public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3177                "disk_free_change_reporting_threshold";
3178
3179
3180        /**
3181         * Minimum percentage of free storage on the device that is used to determine if
3182         * the device is running low on storage.
3183         * Say this value is set to 10, the device is considered running low on storage
3184         * if 90% or more of the device storage is filled up.
3185         * @hide
3186         */
3187        public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3188                "sys_storage_threshold_percentage";
3189
3190        /**
3191         * Minimum bytes of free storage on the device before the data
3192         * partition is considered full. By default, 1 MB is reserved
3193         * to avoid system-wide SQLite disk full exceptions.
3194         * @hide
3195         */
3196        public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES =
3197                "sys_storage_full_threshold_bytes";
3198
3199        /**
3200         * The interval in milliseconds after which Wi-Fi is considered idle.
3201         * When idle, it is possible for the device to be switched from Wi-Fi to
3202         * the mobile data network.
3203         * @hide
3204         */
3205        public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3206
3207        /**
3208         * The interval in milliseconds to issue scans when the driver is
3209         * started. This is necessary to allow wifi to connect to an
3210         * access point when the driver is suspended.
3211         * @hide
3212         */
3213        public static final String WIFI_SCAN_INTERVAL_MS = "wifi_scan_interval_ms";
3214
3215        /**
3216         * The interval in milliseconds at which to check packet counts on the
3217         * mobile data interface when screen is on, to detect possible data
3218         * connection problems.
3219         * @hide
3220         */
3221        public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3222                "pdp_watchdog_poll_interval_ms";
3223
3224        /**
3225         * The interval in milliseconds at which to check packet counts on the
3226         * mobile data interface when screen is off, to detect possible data
3227         * connection problems.
3228         * @hide
3229         */
3230        public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3231                "pdp_watchdog_long_poll_interval_ms";
3232
3233        /**
3234         * The interval in milliseconds at which to check packet counts on the
3235         * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3236         * outgoing packets has been reached without incoming packets.
3237         * @hide
3238         */
3239        public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3240                "pdp_watchdog_error_poll_interval_ms";
3241
3242        /**
3243         * The number of outgoing packets sent without seeing an incoming packet
3244         * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3245         * device is logged to the event log
3246         * @hide
3247         */
3248        public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3249                "pdp_watchdog_trigger_packet_count";
3250
3251        /**
3252         * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3253         * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3254         * attempting data connection recovery.
3255         * @hide
3256         */
3257        public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3258                "pdp_watchdog_error_poll_count";
3259
3260        /**
3261         * The number of failed PDP reset attempts before moving to something more
3262         * drastic: re-registering to the network.
3263         * @hide
3264         */
3265        public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3266                "pdp_watchdog_max_pdp_reset_fail_count";
3267
3268        /**
3269         * Address to ping as a last sanity check before attempting any recovery.
3270         * Unset or set to "0.0.0.0" to skip this check.
3271         * @hide
3272         */
3273        public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
3274
3275        /**
3276         * The "-w deadline" parameter for the ping, ie, the max time in
3277         * seconds to spend pinging.
3278         * @hide
3279         */
3280        public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
3281
3282        /**
3283         * The interval in milliseconds at which to check gprs registration
3284         * after the first registration mismatch of gprs and voice service,
3285         * to detect possible data network registration problems.
3286         *
3287         * @hide
3288         */
3289        public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3290                "gprs_register_check_period_ms";
3291
3292        /**
3293         * The length of time in milli-seconds that automatic small adjustments to
3294         * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3295         * @hide
3296         */
3297        public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3298
3299        /**
3300         * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3301         * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3302         * exceeded.
3303         * @hide
3304         */
3305        public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3306
3307        /**
3308         * The maximum reconnect delay for short network outages or when the network is suspended
3309         * due to phone use.
3310         * @hide
3311         */
3312        public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3313                "sync_max_retry_delay_in_seconds";
3314
3315        /**
3316         * The interval in milliseconds at which to check the number of SMS sent
3317         * out without asking for use permit, to limit the un-authorized SMS
3318         * usage.
3319         * @hide
3320         */
3321        public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3322                "sms_outgoing_check_interval_ms";
3323
3324        /**
3325         * The number of outgoing SMS sent without asking for user permit
3326         * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3327         * @hide
3328         */
3329        public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
3330                "sms_outgoing_check_max_count";
3331
3332        /**
3333         * The number of promoted sources in GlobalSearch.
3334         * @hide
3335         */
3336        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3337        /**
3338         * The maximum number of suggestions returned by GlobalSearch.
3339         * @hide
3340         */
3341        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3342        /**
3343         * The number of suggestions GlobalSearch will ask each non-web search source for.
3344         * @hide
3345         */
3346        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3347        /**
3348         * The number of suggestions the GlobalSearch will ask the web search source for.
3349         * @hide
3350         */
3351        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3352                "search_web_results_override_limit";
3353        /**
3354         * The number of milliseconds that GlobalSearch will wait for suggestions from
3355         * promoted sources before continuing with all other sources.
3356         * @hide
3357         */
3358        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3359                "search_promoted_source_deadline_millis";
3360        /**
3361         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3362         * @hide
3363         */
3364        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3365        /**
3366         * The maximum number of milliseconds that GlobalSearch shows the previous results
3367         * after receiving a new query.
3368         * @hide
3369         */
3370        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3371        /**
3372         * The maximum age of log data used for shortcuts in GlobalSearch.
3373         * @hide
3374         */
3375        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3376        /**
3377         * The maximum age of log data used for source ranking in GlobalSearch.
3378         * @hide
3379         */
3380        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3381                "search_max_source_event_age_millis";
3382        /**
3383         * The minimum number of impressions needed to rank a source in GlobalSearch.
3384         * @hide
3385         */
3386        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3387                "search_min_impressions_for_source_ranking";
3388        /**
3389         * The minimum number of clicks needed to rank a source in GlobalSearch.
3390         * @hide
3391         */
3392        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3393                "search_min_clicks_for_source_ranking";
3394        /**
3395         * The maximum number of shortcuts shown by GlobalSearch.
3396         * @hide
3397         */
3398        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3399        /**
3400         * The size of the core thread pool for suggestion queries in GlobalSearch.
3401         * @hide
3402         */
3403        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3404                "search_query_thread_core_pool_size";
3405        /**
3406         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3407         * @hide
3408         */
3409        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3410                "search_query_thread_max_pool_size";
3411        /**
3412         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3413         * @hide
3414         */
3415        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3416                "search_shortcut_refresh_core_pool_size";
3417        /**
3418         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3419         * @hide
3420         */
3421        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3422                "search_shortcut_refresh_max_pool_size";
3423        /**
3424         * The maximun time that excess threads in the GlobalSeach thread pools will
3425         * wait before terminating.
3426         * @hide
3427         */
3428        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3429                "search_thread_keepalive_seconds";
3430        /**
3431         * The maximum number of concurrent suggestion queries to each source.
3432         * @hide
3433         */
3434        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3435                "search_per_source_concurrent_query_limit";
3436
3437        /**
3438         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
3439         * @hide
3440         */
3441        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
3442
3443        /**
3444         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3445         * @hide
3446         */
3447        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3448
3449        /**
3450         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3451         * @hide
3452         */
3453        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3454
3455        /**
3456         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3457         * @hide
3458         */
3459        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
3460
3461        /**
3462         * If nonzero, ANRs in invisible background processes bring up a dialog.
3463         * Otherwise, the process will be silently killed.
3464         * @hide
3465         */
3466        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
3467
3468        /**
3469         * The {@link ComponentName} string of the service to be used as the voice recognition
3470         * service.
3471         *
3472         * @hide
3473         */
3474        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
3475
3476        /**
3477         * What happens when the user presses the Power button while in-call
3478         * and the screen is on.<br/>
3479         * <b>Values:</b><br/>
3480         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
3481         * 2 - The Power button hangs up the current call.<br/>
3482         *
3483         * @hide
3484         */
3485        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
3486
3487        /**
3488         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
3489         * @hide
3490         */
3491        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
3492
3493        /**
3494         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
3495         * @hide
3496         */
3497        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
3498
3499        /**
3500         * INCALL_POWER_BUTTON_BEHAVIOR default value.
3501         * @hide
3502         */
3503        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
3504                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
3505
3506        /**
3507         * The current night mode that has been selected by the user.  Owned
3508         * and controlled by UiModeManagerService.  Constants are as per
3509         * UiModeManager.
3510         * @hide
3511         */
3512        public static final String UI_NIGHT_MODE = "ui_night_mode";
3513
3514        /**
3515         * Let user pick default install location.
3516         * @hide
3517         */
3518        public static final String SET_INSTALL_LOCATION = "set_install_location";
3519
3520        /**
3521         * Default install location value.
3522         * 0 = auto, let system decide
3523         * 1 = internal
3524         * 2 = sdcard
3525         * @hide
3526         */
3527        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
3528
3529        /**
3530         * The bandwidth throttle polling freqency in seconds
3531         * @hide
3532         */
3533        public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3534
3535        /**
3536         * The bandwidth throttle threshold (long)
3537         * @hide
3538         */
3539        public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
3540
3541        /**
3542         * The bandwidth throttle value (kbps)
3543         * @hide
3544         */
3545        public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
3546
3547        /**
3548         * The bandwidth throttle reset calendar day (1-28)
3549         * @hide
3550         */
3551        public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3552
3553        /**
3554         * The throttling notifications we should send
3555         * @hide
3556         */
3557        public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3558
3559        /**
3560         * Help URI for data throttling policy
3561         * @hide
3562         */
3563        public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3564
3565        /**
3566         * The length of time in Sec that we allow our notion of NTP time
3567         * to be cached before we refresh it
3568         * @hide
3569         */
3570        public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3571                "throttle_max_ntp_cache_age_sec";
3572
3573        /**
3574         * The maximum size, in bytes, of a download that the download manager will transfer over
3575         * a non-wifi connection.
3576         * @hide
3577         */
3578        public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
3579                "download_manager_max_bytes_over_mobile";
3580
3581        /**
3582         * The recommended maximum size, in bytes, of a download that the download manager should
3583         * transfer over a non-wifi connection. Over this size, the use will be warned, but will
3584         * have the option to start the download over the mobile connection anyway.
3585         * @hide
3586         */
3587        public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
3588                "download_manager_recommended_max_bytes_over_mobile";
3589
3590        /**
3591         * ms during which to consume extra events related to Inet connection condition
3592         * after a transtion to fully-connected
3593         * @hide
3594         */
3595        public static final String INET_CONDITION_DEBOUNCE_UP_DELAY =
3596                "inet_condition_debounce_up_delay";
3597
3598        /**
3599         * ms during which to consume extra events related to Inet connection condtion
3600         * after a transtion to partly-connected
3601         * @hide
3602         */
3603        public static final String INET_CONDITION_DEBOUNCE_DOWN_DELAY =
3604                "inet_condition_debounce_down_delay";
3605
3606        /**
3607         * @hide
3608         */
3609        public static final String[] SETTINGS_TO_BACKUP = {
3610            ADB_ENABLED,
3611            ALLOW_MOCK_LOCATION,
3612            PARENTAL_CONTROL_ENABLED,
3613            PARENTAL_CONTROL_REDIRECT_URL,
3614            USB_MASS_STORAGE_ENABLED,
3615            ACCESSIBILITY_ENABLED,
3616            ACCESSIBILITY_SCRIPT_INJECTION,
3617            BACKUP_AUTO_RESTORE,
3618            ENABLED_ACCESSIBILITY_SERVICES,
3619            TTS_USE_DEFAULTS,
3620            TTS_DEFAULT_RATE,
3621            TTS_DEFAULT_PITCH,
3622            TTS_DEFAULT_SYNTH,
3623            TTS_DEFAULT_LANG,
3624            TTS_DEFAULT_COUNTRY,
3625            TTS_ENABLED_PLUGINS,
3626            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3627            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
3628            WIFI_NUM_ALLOWED_CHANNELS,
3629            WIFI_NUM_OPEN_NETWORKS_KEPT,
3630            MOUNT_PLAY_NOTIFICATION_SND,
3631            MOUNT_UMS_AUTOSTART,
3632            MOUNT_UMS_PROMPT,
3633            MOUNT_UMS_NOTIFY_ENABLED,
3634            UI_NIGHT_MODE
3635        };
3636
3637        /**
3638         * Helper method for determining if a location provider is enabled.
3639         * @param cr the content resolver to use
3640         * @param provider the location provider to query
3641         * @return true if the provider is enabled
3642         */
3643        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3644            String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
3645            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
3646        }
3647
3648        /**
3649         * Thread-safe method for enabling or disabling a single location provider.
3650         * @param cr the content resolver to use
3651         * @param provider the location provider to enable or disable
3652         * @param enabled true if the provider should be enabled
3653         */
3654        public static final void setLocationProviderEnabled(ContentResolver cr,
3655                String provider, boolean enabled) {
3656            // to ensure thread safety, we write the provider name with a '+' or '-'
3657            // and let the SettingsProvider handle it rather than reading and modifying
3658            // the list of enabled providers.
3659            if (enabled) {
3660                provider = "+" + provider;
3661            } else {
3662                provider = "-" + provider;
3663            }
3664            putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3665        }
3666    }
3667
3668    /**
3669     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
3670     * Intent URL, allowing it to be either a web page or a particular
3671     * application activity.
3672     *
3673     * @hide
3674     */
3675    public static final class Bookmarks implements BaseColumns
3676    {
3677        private static final String TAG = "Bookmarks";
3678
3679        /**
3680         * The content:// style URL for this table
3681         */
3682        public static final Uri CONTENT_URI =
3683            Uri.parse("content://" + AUTHORITY + "/bookmarks");
3684
3685        /**
3686         * The row ID.
3687         * <p>Type: INTEGER</p>
3688         */
3689        public static final String ID = "_id";
3690
3691        /**
3692         * Descriptive name of the bookmark that can be displayed to the user.
3693         * If this is empty, the title should be resolved at display time (use
3694         * {@link #getTitle(Context, Cursor)} any time you want to display the
3695         * title of a bookmark.)
3696         * <P>
3697         * Type: TEXT
3698         * </P>
3699         */
3700        public static final String TITLE = "title";
3701
3702        /**
3703         * Arbitrary string (displayed to the user) that allows bookmarks to be
3704         * organized into categories.  There are some special names for
3705         * standard folders, which all start with '@'.  The label displayed for
3706         * the folder changes with the locale (via {@link #getLabelForFolder}) but
3707         * the folder name does not change so you can consistently query for
3708         * the folder regardless of the current locale.
3709         *
3710         * <P>Type: TEXT</P>
3711         *
3712         */
3713        public static final String FOLDER = "folder";
3714
3715        /**
3716         * The Intent URL of the bookmark, describing what it points to.  This
3717         * value is given to {@link android.content.Intent#getIntent} to create
3718         * an Intent that can be launched.
3719         * <P>Type: TEXT</P>
3720         */
3721        public static final String INTENT = "intent";
3722
3723        /**
3724         * Optional shortcut character associated with this bookmark.
3725         * <P>Type: INTEGER</P>
3726         */
3727        public static final String SHORTCUT = "shortcut";
3728
3729        /**
3730         * The order in which the bookmark should be displayed
3731         * <P>Type: INTEGER</P>
3732         */
3733        public static final String ORDERING = "ordering";
3734
3735        private static final String[] sIntentProjection = { INTENT };
3736        private static final String[] sShortcutProjection = { ID, SHORTCUT };
3737        private static final String sShortcutSelection = SHORTCUT + "=?";
3738
3739        /**
3740         * Convenience function to retrieve the bookmarked Intent for a
3741         * particular shortcut key.
3742         *
3743         * @param cr The ContentResolver to query.
3744         * @param shortcut The shortcut key.
3745         *
3746         * @return Intent The bookmarked URL, or null if there is no bookmark
3747         *         matching the given shortcut.
3748         */
3749        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3750        {
3751            Intent intent = null;
3752
3753            Cursor c = cr.query(CONTENT_URI,
3754                    sIntentProjection, sShortcutSelection,
3755                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
3756            // Keep trying until we find a valid shortcut
3757            try {
3758                while (intent == null && c.moveToNext()) {
3759                    try {
3760                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3761                        intent = Intent.parseUri(intentURI, 0);
3762                    } catch (java.net.URISyntaxException e) {
3763                        // The stored URL is bad...  ignore it.
3764                    } catch (IllegalArgumentException e) {
3765                        // Column not found
3766                        Log.w(TAG, "Intent column not found", e);
3767                    }
3768                }
3769            } finally {
3770                if (c != null) c.close();
3771            }
3772
3773            return intent;
3774        }
3775
3776        /**
3777         * Add a new bookmark to the system.
3778         *
3779         * @param cr The ContentResolver to query.
3780         * @param intent The desired target of the bookmark.
3781         * @param title Bookmark title that is shown to the user; null if none
3782         *            or it should be resolved to the intent's title.
3783         * @param folder Folder in which to place the bookmark; null if none.
3784         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3785         *            this is non-zero and there is an existing bookmark entry
3786         *            with this same shortcut, then that existing shortcut is
3787         *            cleared (the bookmark is not removed).
3788         * @return The unique content URL for the new bookmark entry.
3789         */
3790        public static Uri add(ContentResolver cr,
3791                                           Intent intent,
3792                                           String title,
3793                                           String folder,
3794                                           char shortcut,
3795                                           int ordering)
3796        {
3797            // If a shortcut is supplied, and it is already defined for
3798            // another bookmark, then remove the old definition.
3799            if (shortcut != 0) {
3800                cr.delete(CONTENT_URI, sShortcutSelection,
3801                        new String[] { String.valueOf((int) shortcut) });
3802            }
3803
3804            ContentValues values = new ContentValues();
3805            if (title != null) values.put(TITLE, title);
3806            if (folder != null) values.put(FOLDER, folder);
3807            values.put(INTENT, intent.toUri(0));
3808            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3809            values.put(ORDERING, ordering);
3810            return cr.insert(CONTENT_URI, values);
3811        }
3812
3813        /**
3814         * Return the folder name as it should be displayed to the user.  This
3815         * takes care of localizing special folders.
3816         *
3817         * @param r Resources object for current locale; only need access to
3818         *          system resources.
3819         * @param folder The value found in the {@link #FOLDER} column.
3820         *
3821         * @return CharSequence The label for this folder that should be shown
3822         *         to the user.
3823         */
3824        public static CharSequence getLabelForFolder(Resources r, String folder) {
3825            return folder;
3826        }
3827
3828        /**
3829         * Return the title as it should be displayed to the user. This takes
3830         * care of localizing bookmarks that point to activities.
3831         *
3832         * @param context A context.
3833         * @param cursor A cursor pointing to the row whose title should be
3834         *        returned. The cursor must contain at least the {@link #TITLE}
3835         *        and {@link #INTENT} columns.
3836         * @return A title that is localized and can be displayed to the user,
3837         *         or the empty string if one could not be found.
3838         */
3839        public static CharSequence getTitle(Context context, Cursor cursor) {
3840            int titleColumn = cursor.getColumnIndex(TITLE);
3841            int intentColumn = cursor.getColumnIndex(INTENT);
3842            if (titleColumn == -1 || intentColumn == -1) {
3843                throw new IllegalArgumentException(
3844                        "The cursor must contain the TITLE and INTENT columns.");
3845            }
3846
3847            String title = cursor.getString(titleColumn);
3848            if (!TextUtils.isEmpty(title)) {
3849                return title;
3850            }
3851
3852            String intentUri = cursor.getString(intentColumn);
3853            if (TextUtils.isEmpty(intentUri)) {
3854                return "";
3855            }
3856
3857            Intent intent;
3858            try {
3859                intent = Intent.parseUri(intentUri, 0);
3860            } catch (URISyntaxException e) {
3861                return "";
3862            }
3863
3864            PackageManager packageManager = context.getPackageManager();
3865            ResolveInfo info = packageManager.resolveActivity(intent, 0);
3866            return info != null ? info.loadLabel(packageManager) : "";
3867        }
3868    }
3869
3870    /**
3871     * Returns the device ID that we should use when connecting to the mobile gtalk server.
3872     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3873     * from the GoogleLoginService.
3874     *
3875     * @param androidId The Android ID for this device.
3876     * @return The device ID that should be used when connecting to the mobile gtalk server.
3877     * @hide
3878     */
3879    public static String getGTalkDeviceId(long androidId) {
3880        return "android-" + Long.toHexString(androidId);
3881    }
3882}
3883