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