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