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