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