2 * Copyright (C) 2006 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.provider;
19 import com.google.android.collect.Maps;
21 import org.apache.commons.codec.binary.Base64;
23 import android.annotation.SdkConstant;
24 import android.annotation.SdkConstant.SdkConstantType;
25 import android.content.ComponentName;
26 import android.content.ContentQueryMap;
27 import android.content.ContentResolver;
28 import android.content.ContentValues;
29 import android.content.Context;
30 import android.content.IContentProvider;
31 import android.content.Intent;
32 import android.content.pm.ActivityInfo;
33 import android.content.pm.PackageManager;
34 import android.content.pm.ResolveInfo;
35 import android.content.res.Configuration;
36 import android.content.res.Resources;
37 import android.database.Cursor;
38 import android.database.SQLException;
39 import android.net.Uri;
41 import android.telephony.TelephonyManager;
42 import android.text.TextUtils;
43 import android.util.AndroidException;
44 import android.util.Config;
45 import android.util.Log;
47 import java.net.URISyntaxException;
48 import java.security.MessageDigest;
49 import java.security.NoSuchAlgorithmException;
50 import java.util.Collections;
51 import java.util.HashMap;
52 import java.util.HashSet;
57 * The Settings provider contains global system-level device preferences.
59 public final class Settings {
61 // Intent actions for Settings
64 * Activity Action: Show system settings.
70 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
71 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
74 * Activity Action: Show settings to allow configuration of APNs.
80 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
81 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
84 * Activity Action: Show settings to allow configuration of current location
87 * In some cases, a matching Activity may not exist, so ensure you
88 * safeguard against this.
94 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
95 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
96 "android.settings.LOCATION_SOURCE_SETTINGS";
99 * Activity Action: Show settings to allow configuration of wireless controls
100 * such as Wi-Fi, Bluetooth and Mobile networks.
102 * In some cases, a matching Activity may not exist, so ensure you
103 * safeguard against this.
109 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
110 public static final String ACTION_WIRELESS_SETTINGS =
111 "android.settings.WIRELESS_SETTINGS";
114 * Activity Action: Show settings to allow entering/exiting airplane mode.
116 * In some cases, a matching Activity may not exist, so ensure you
117 * safeguard against this.
123 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
124 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
125 "android.settings.AIRPLANE_MODE_SETTINGS";
128 * Activity Action: Show settings for accessibility modules.
130 * In some cases, a matching Activity may not exist, so ensure you
131 * safeguard against this.
137 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
138 public static final String ACTION_ACCESSIBILITY_SETTINGS =
139 "android.settings.ACCESSIBILITY_SETTINGS";
142 * Activity Action: Show settings to allow configuration of security and
145 * In some cases, a matching Activity may not exist, so ensure you
146 * safeguard against this.
152 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
153 public static final String ACTION_SECURITY_SETTINGS =
154 "android.settings.SECURITY_SETTINGS";
157 * Activity Action: Show settings to allow configuration of privacy options.
159 * In some cases, a matching Activity may not exist, so ensure you
160 * safeguard against this.
166 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
167 public static final String ACTION_PRIVACY_SETTINGS =
168 "android.settings.PRIVACY_SETTINGS";
171 * Activity Action: Show settings to allow configuration of Wi-Fi.
174 * In some cases, a matching Activity may not exist, so ensure you
175 * safeguard against this.
182 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
183 public static final String ACTION_WIFI_SETTINGS =
184 "android.settings.WIFI_SETTINGS";
187 * Activity Action: Show settings to allow configuration of a static IP
190 * In some cases, a matching Activity may not exist, so ensure you safeguard
197 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
198 public static final String ACTION_WIFI_IP_SETTINGS =
199 "android.settings.WIFI_IP_SETTINGS";
202 * Activity Action: Show settings to allow configuration of Bluetooth.
204 * In some cases, a matching Activity may not exist, so ensure you
205 * safeguard against this.
211 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
212 public static final String ACTION_BLUETOOTH_SETTINGS =
213 "android.settings.BLUETOOTH_SETTINGS";
216 * Activity Action: Show settings to allow configuration of date and time.
218 * In some cases, a matching Activity may not exist, so ensure you
219 * safeguard against this.
225 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
226 public static final String ACTION_DATE_SETTINGS =
227 "android.settings.DATE_SETTINGS";
230 * Activity Action: Show settings to allow configuration of sound and volume.
232 * In some cases, a matching Activity may not exist, so ensure you
233 * safeguard against this.
239 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
240 public static final String ACTION_SOUND_SETTINGS =
241 "android.settings.SOUND_SETTINGS";
244 * Activity Action: Show settings to allow configuration of display.
246 * In some cases, a matching Activity may not exist, so ensure you
247 * safeguard against this.
253 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
254 public static final String ACTION_DISPLAY_SETTINGS =
255 "android.settings.DISPLAY_SETTINGS";
258 * Activity Action: Show settings to allow configuration of locale.
260 * In some cases, a matching Activity may not exist, so ensure you
261 * safeguard against this.
267 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
268 public static final String ACTION_LOCALE_SETTINGS =
269 "android.settings.LOCALE_SETTINGS";
272 * Activity Action: Show settings to configure input methods, in particular
273 * allowing the user to enable input methods.
275 * In some cases, a matching Activity may not exist, so ensure you
276 * safeguard against this.
282 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
283 public static final String ACTION_INPUT_METHOD_SETTINGS =
284 "android.settings.INPUT_METHOD_SETTINGS";
287 * Activity Action: Show settings to manage the user input dictionary.
289 * In some cases, a matching Activity may not exist, so ensure you
290 * safeguard against this.
296 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
297 public static final String ACTION_USER_DICTIONARY_SETTINGS =
298 "android.settings.USER_DICTIONARY_SETTINGS";
301 * Activity Action: Show settings to allow configuration of application-related settings.
303 * In some cases, a matching Activity may not exist, so ensure you
304 * safeguard against this.
310 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
311 public static final String ACTION_APPLICATION_SETTINGS =
312 "android.settings.APPLICATION_SETTINGS";
315 * Activity Action: Show settings to allow configuration of application
316 * development-related settings.
318 * In some cases, a matching Activity may not exist, so ensure you safeguard
325 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
326 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
327 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
330 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
332 * In some cases, a matching Activity may not exist, so ensure you
333 * safeguard against this.
339 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
340 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
341 "android.settings.QUICK_LAUNCH_SETTINGS";
344 * Activity Action: Show settings to manage installed applications.
346 * In some cases, a matching Activity may not exist, so ensure you
347 * safeguard against this.
353 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
354 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
355 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
358 * Activity Action: Show settings for system update functionality.
360 * In some cases, a matching Activity may not exist, so ensure you
361 * safeguard against this.
369 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
370 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
371 "android.settings.SYSTEM_UPDATE_SETTINGS";
374 * Activity Action: Show settings to allow configuration of sync settings.
376 * In some cases, a matching Activity may not exist, so ensure you
377 * safeguard against this.
379 * The account types available to add via the add account button may be restricted by adding an
380 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
381 * authorities. Only account types which can sync with that content provider will be offered to
388 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
389 public static final String ACTION_SYNC_SETTINGS =
390 "android.settings.SYNC_SETTINGS";
393 * Activity Action: Show add account screen for creating a new account.
395 * In some cases, a matching Activity may not exist, so ensure you
396 * safeguard against this.
398 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
399 * extra to the Intent with one or more syncable content provider's authorities. Only account
400 * types which can sync with that content provider will be offered to the user.
406 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
407 public static final String ACTION_ADD_ACCOUNT =
408 "android.settings.ADD_ACCOUNT_SETTINGS";
411 * Activity Action: Show settings for selecting the network operator.
413 * In some cases, a matching Activity may not exist, so ensure you
414 * safeguard against this.
420 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
421 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
422 "android.settings.NETWORK_OPERATOR_SETTINGS";
425 * Activity Action: Show settings for selection of 2G/3G.
427 * In some cases, a matching Activity may not exist, so ensure you
428 * safeguard against this.
434 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
435 public static final String ACTION_DATA_ROAMING_SETTINGS =
436 "android.settings.DATA_ROAMING_SETTINGS";
439 * Activity Action: Show settings for internal storage.
441 * In some cases, a matching Activity may not exist, so ensure you
442 * safeguard against this.
448 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
449 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
450 "android.settings.INTERNAL_STORAGE_SETTINGS";
452 * Activity Action: Show settings for memory card storage.
454 * In some cases, a matching Activity may not exist, so ensure you
455 * safeguard against this.
461 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
462 public static final String ACTION_MEMORY_CARD_SETTINGS =
463 "android.settings.MEMORY_CARD_SETTINGS";
466 * Activity Action: Show settings for global search.
468 * In some cases, a matching Activity may not exist, so ensure you
469 * safeguard against this.
475 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
476 public static final String ACTION_SEARCH_SETTINGS =
477 "android.search.action.SEARCH_SETTINGS";
480 * Activity Action: Show general device information settings (serial
481 * number, software version, phone number, etc.).
483 * In some cases, a matching Activity may not exist, so ensure you
484 * safeguard against this.
490 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
491 public static final String ACTION_DEVICE_INFO_SETTINGS =
492 "android.settings.DEVICE_INFO_SETTINGS";
494 // End of Intent actions for Settings
497 * @hide - Private call() method on SettingsProvider to read from 'system' table.
499 public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
502 * @hide - Private call() method on SettingsProvider to read from 'secure' table.
504 public static final String CALL_METHOD_GET_SECURE = "GET_secure";
507 * Activity Extra: Limit available options in launched activity based on the given authority.
509 * This can be passed as an extra field in an Activity Intent with one or more syncable content
510 * provider's authorities as a String[]. This field is used by some intents to alter the
511 * behavior of the called activity.
513 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
514 * on the authority given.
516 public static final String EXTRA_AUTHORITIES =
519 private static final String JID_RESOURCE_PREFIX = "android";
521 public static final String AUTHORITY = "settings";
523 private static final String TAG = "Settings";
524 private static final boolean LOCAL_LOGV = Config.LOGV || false;
526 public static class SettingNotFoundException extends AndroidException {
527 public SettingNotFoundException(String msg) {
533 * Common base for tables of name/value settings.
535 public static class NameValueTable implements BaseColumns {
536 public static final String NAME = "name";
537 public static final String VALUE = "value";
539 protected static boolean putString(ContentResolver resolver, Uri uri,
540 String name, String value) {
541 // The database will take care of replacing duplicates.
543 ContentValues values = new ContentValues();
544 values.put(NAME, name);
545 values.put(VALUE, value);
546 resolver.insert(uri, values);
548 } catch (SQLException e) {
549 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
554 public static Uri getUriFor(Uri uri, String name) {
555 return Uri.withAppendedPath(uri, name);
560 private static class NameValueCache {
561 private final String mVersionSystemProperty;
562 private final Uri mUri;
564 private static final String[] SELECT_VALUE =
565 new String[] { Settings.NameValueTable.VALUE };
566 private static final String NAME_EQ_PLACEHOLDER = "name=?";
568 // Must synchronize on 'this' to access mValues and mValuesVersion.
569 private final HashMap<String, String> mValues = new HashMap<String, String>();
570 private long mValuesVersion = 0;
572 // Initially null; set lazily and held forever. Synchronized on 'this'.
573 private IContentProvider mContentProvider = null;
575 // The method we'll call (or null, to not use) on the provider
576 // for the fast path of retrieving settings.
577 private final String mCallCommand;
579 public NameValueCache(String versionSystemProperty, Uri uri, String callCommand) {
580 mVersionSystemProperty = versionSystemProperty;
582 mCallCommand = callCommand;
585 public String getString(ContentResolver cr, String name) {
586 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
588 synchronized (this) {
589 if (mValuesVersion != newValuesVersion) {
591 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
592 newValuesVersion + " != cached " + mValuesVersion);
596 mValuesVersion = newValuesVersion;
599 if (mValues.containsKey(name)) {
600 return mValues.get(name); // Could be null, that's OK -- negative caching
604 IContentProvider cp = null;
605 synchronized (this) {
606 cp = mContentProvider;
608 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
612 // Try the fast path first, not using query(). If this
613 // fails (alternate Settings provider that doesn't support
614 // this interface?) then we fall back to the query/table
616 if (mCallCommand != null) {
618 Bundle b = cp.call(mCallCommand, name, null);
620 String value = b.getPairValue();
621 synchronized (this) {
622 mValues.put(name, value);
626 // If the response Bundle is null, we fall through
627 // to the query interface below.
628 } catch (RemoteException e) {
629 // Not supported by the remote side? Fall through
636 c = cp.query(mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
637 new String[]{name}, null);
639 Log.w(TAG, "Can't get key " + name + " from " + mUri);
643 String value = c.moveToNext() ? c.getString(0) : null;
644 synchronized (this) {
645 mValues.put(name, value);
648 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
649 name + " = " + (value == null ? "(null)" : value));
652 } catch (RemoteException e) {
653 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
654 return null; // Return null, but don't cache it.
656 if (c != null) c.close();
662 * System settings, containing miscellaneous system preferences. This
663 * table holds simple name/value pairs. There are convenience
664 * functions for accessing individual settings entries.
666 public static final class System extends NameValueTable {
667 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
669 // Populated lazily, guarded by class object:
670 private static NameValueCache sNameValueCache = null;
672 private static final HashSet<String> MOVED_TO_SECURE;
674 MOVED_TO_SECURE = new HashSet<String>(30);
675 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
676 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
677 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
678 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
679 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
680 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
681 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
682 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
683 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
684 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
685 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
686 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
687 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
688 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
689 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
690 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
691 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
692 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
693 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
694 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
695 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
696 MOVED_TO_SECURE.add(Secure.WIFI_ON);
697 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
698 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
699 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
700 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
701 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
702 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
703 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
704 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
705 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
706 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
707 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
711 * Look up a name in the database.
712 * @param resolver to access the database with
713 * @param name to look up in the table
714 * @return the corresponding value, or null if not present
716 public synchronized static String getString(ContentResolver resolver, String name) {
717 if (MOVED_TO_SECURE.contains(name)) {
718 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
719 + " to android.provider.Settings.Secure, returning read-only value.");
720 return Secure.getString(resolver, name);
722 if (sNameValueCache == null) {
723 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
724 CALL_METHOD_GET_SYSTEM);
726 return sNameValueCache.getString(resolver, name);
730 * Store a name/value pair into the database.
731 * @param resolver to access the database with
732 * @param name to store
733 * @param value to associate with the name
734 * @return true if the value was set, false on database errors
736 public static boolean putString(ContentResolver resolver, String name, String value) {
737 if (MOVED_TO_SECURE.contains(name)) {
738 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
739 + " to android.provider.Settings.Secure, value is unchanged.");
742 return putString(resolver, CONTENT_URI, name, value);
746 * Construct the content URI for a particular name/value pair,
747 * useful for monitoring changes with a ContentObserver.
748 * @param name to look up in the table
749 * @return the corresponding content URI, or null if not present
751 public static Uri getUriFor(String name) {
752 if (MOVED_TO_SECURE.contains(name)) {
753 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
754 + " to android.provider.Settings.Secure, returning Secure URI.");
755 return Secure.getUriFor(Secure.CONTENT_URI, name);
757 return getUriFor(CONTENT_URI, name);
761 * Convenience function for retrieving a single system settings value
762 * as an integer. Note that internally setting values are always
763 * stored as strings; this function converts the string to an integer
764 * for you. The default value will be returned if the setting is
765 * not defined or not an integer.
767 * @param cr The ContentResolver to access.
768 * @param name The name of the setting to retrieve.
769 * @param def Value to return if the setting is not defined.
771 * @return The setting's current value, or 'def' if it is not defined
772 * or not a valid integer.
774 public static int getInt(ContentResolver cr, String name, int def) {
775 String v = getString(cr, name);
777 return v != null ? Integer.parseInt(v) : def;
778 } catch (NumberFormatException e) {
784 * Convenience function for retrieving a single system settings value
785 * as an integer. Note that internally setting values are always
786 * stored as strings; this function converts the string to an integer
789 * This version does not take a default value. If the setting has not
790 * been set, or the string value is not a number,
791 * it throws {@link SettingNotFoundException}.
793 * @param cr The ContentResolver to access.
794 * @param name The name of the setting to retrieve.
796 * @throws SettingNotFoundException Thrown if a setting by the given
797 * name can't be found or the setting value is not an integer.
799 * @return The setting's current value.
801 public static int getInt(ContentResolver cr, String name)
802 throws SettingNotFoundException {
803 String v = getString(cr, name);
805 return Integer.parseInt(v);
806 } catch (NumberFormatException e) {
807 throw new SettingNotFoundException(name);
812 * Convenience function for updating a single settings value as an
813 * integer. This will either create a new entry in the table if the
814 * given name does not exist, or modify the value of the existing row
815 * with that name. Note that internally setting values are always
816 * stored as strings, so this function converts the given value to a
817 * string before storing it.
819 * @param cr The ContentResolver to access.
820 * @param name The name of the setting to modify.
821 * @param value The new value for the setting.
822 * @return true if the value was set, false on database errors
824 public static boolean putInt(ContentResolver cr, String name, int value) {
825 return putString(cr, name, Integer.toString(value));
829 * Convenience function for retrieving a single system settings value
830 * as a {@code long}. Note that internally setting values are always
831 * stored as strings; this function converts the string to a {@code long}
832 * for you. The default value will be returned if the setting is
833 * not defined or not a {@code long}.
835 * @param cr The ContentResolver to access.
836 * @param name The name of the setting to retrieve.
837 * @param def Value to return if the setting is not defined.
839 * @return The setting's current value, or 'def' if it is not defined
840 * or not a valid {@code long}.
842 public static long getLong(ContentResolver cr, String name, long def) {
843 String valString = getString(cr, name);
846 value = valString != null ? Long.parseLong(valString) : def;
847 } catch (NumberFormatException e) {
854 * Convenience function for retrieving a single system settings value
855 * as a {@code long}. Note that internally setting values are always
856 * stored as strings; this function converts the string to a {@code long}
859 * This version does not take a default value. If the setting has not
860 * been set, or the string value is not a number,
861 * it throws {@link SettingNotFoundException}.
863 * @param cr The ContentResolver to access.
864 * @param name The name of the setting to retrieve.
866 * @return The setting's current value.
867 * @throws SettingNotFoundException Thrown if a setting by the given
868 * name can't be found or the setting value is not an integer.
870 public static long getLong(ContentResolver cr, String name)
871 throws SettingNotFoundException {
872 String valString = getString(cr, name);
874 return Long.parseLong(valString);
875 } catch (NumberFormatException e) {
876 throw new SettingNotFoundException(name);
881 * Convenience function for updating a single settings value as a long
882 * integer. This will either create a new entry in the table if the
883 * given name does not exist, or modify the value of the existing row
884 * with that name. Note that internally setting values are always
885 * stored as strings, so this function converts the given value to a
886 * string before storing it.
888 * @param cr The ContentResolver to access.
889 * @param name The name of the setting to modify.
890 * @param value The new value for the setting.
891 * @return true if the value was set, false on database errors
893 public static boolean putLong(ContentResolver cr, String name, long value) {
894 return putString(cr, name, Long.toString(value));
898 * Convenience function for retrieving a single system settings value
899 * as a floating point number. Note that internally setting values are
900 * always stored as strings; this function converts the string to an
901 * float for you. The default value will be returned if the setting
902 * is not defined or not a valid float.
904 * @param cr The ContentResolver to access.
905 * @param name The name of the setting to retrieve.
906 * @param def Value to return if the setting is not defined.
908 * @return The setting's current value, or 'def' if it is not defined
909 * or not a valid float.
911 public static float getFloat(ContentResolver cr, String name, float def) {
912 String v = getString(cr, name);
914 return v != null ? Float.parseFloat(v) : def;
915 } catch (NumberFormatException e) {
921 * Convenience function for retrieving a single system settings value
922 * as a float. Note that internally setting values are always
923 * stored as strings; this function converts the string to a float
926 * This version does not take a default value. If the setting has not
927 * been set, or the string value is not a number,
928 * it throws {@link SettingNotFoundException}.
930 * @param cr The ContentResolver to access.
931 * @param name The name of the setting to retrieve.
933 * @throws SettingNotFoundException Thrown if a setting by the given
934 * name can't be found or the setting value is not a float.
936 * @return The setting's current value.
938 public static float getFloat(ContentResolver cr, String name)
939 throws SettingNotFoundException {
940 String v = getString(cr, name);
942 return Float.parseFloat(v);
943 } catch (NumberFormatException e) {
944 throw new SettingNotFoundException(name);
949 * Convenience function for updating a single settings value as a
950 * floating point number. This will either create a new entry in the
951 * table if the given name does not exist, or modify the value of the
952 * existing row with that name. Note that internally setting values
953 * are always stored as strings, so this function converts the given
954 * value to a string before storing it.
956 * @param cr The ContentResolver to access.
957 * @param name The name of the setting to modify.
958 * @param value The new value for the setting.
959 * @return true if the value was set, false on database errors
961 public static boolean putFloat(ContentResolver cr, String name, float value) {
962 return putString(cr, name, Float.toString(value));
966 * Convenience function to read all of the current
967 * configuration-related settings into a
968 * {@link Configuration} object.
970 * @param cr The ContentResolver to access.
971 * @param outConfig Where to place the configuration settings.
973 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
974 outConfig.fontScale = Settings.System.getFloat(
975 cr, FONT_SCALE, outConfig.fontScale);
976 if (outConfig.fontScale < 0) {
977 outConfig.fontScale = 1;
982 * Convenience function to write a batch of configuration-related
983 * settings from a {@link Configuration} object.
985 * @param cr The ContentResolver to access.
986 * @param config The settings to write.
987 * @return true if the values were set, false on database errors
989 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
990 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
994 public static boolean hasInterestingConfigurationChanges(int changes) {
995 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
998 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
999 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
1002 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1003 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
1007 * The content:// style URL for this table
1009 public static final Uri CONTENT_URI =
1010 Uri.parse("content://" + AUTHORITY + "/system");
1013 * Whether we keep the device on while the device is plugged in.
1014 * Supported values are:
1016 * <li>{@code 0} to never stay on while plugged in</li>
1017 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
1018 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
1020 * These values can be OR-ed together.
1022 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
1025 * What happens when the user presses the end call button if they're not
1027 * <b>Values:</b><br/>
1028 * 0 - The end button does nothing.<br/>
1029 * 1 - The end button goes to the home screen.<br/>
1030 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1031 * 3 - The end button goes to the home screen. If the user is already on the
1032 * home screen, it puts the device to sleep.
1034 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1037 * END_BUTTON_BEHAVIOR value for "go home".
1040 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1043 * END_BUTTON_BEHAVIOR value for "go to sleep".
1046 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1049 * END_BUTTON_BEHAVIOR default value.
1052 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1055 * Whether Airplane Mode is on.
1057 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
1060 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
1062 public static final String RADIO_BLUETOOTH = "bluetooth";
1065 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
1067 public static final String RADIO_WIFI = "wifi";
1070 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
1072 public static final String RADIO_CELL = "cell";
1075 * A comma separated list of radios that need to be disabled when airplane mode
1076 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
1077 * included in the comma separated list.
1079 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
1082 * A comma separated list of radios that should to be disabled when airplane mode
1083 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
1084 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
1085 * will be turned off when entering airplane mode, but the user will be able to reenable
1086 * Wifi in the Settings app.
1090 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
1093 * The policy for deciding when Wi-Fi should go to sleep (which will in
1094 * turn switch to using the mobile data as an Internet connection).
1096 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
1097 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
1098 * {@link #WIFI_SLEEP_POLICY_NEVER}.
1100 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
1103 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
1104 * policy, which is to sleep shortly after the turning off
1105 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
1107 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
1110 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
1111 * the device is on battery, and never go to sleep when the device is
1114 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
1117 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
1119 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
1122 * Whether to use static IP and other static network attributes.
1124 * Set to 1 for true and 0 for false.
1126 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1129 * The static IP address.
1131 * Example: "192.168.1.51"
1133 public static final String WIFI_STATIC_IP = "wifi_static_ip";
1136 * If using static IP, the gateway's IP address.
1138 * Example: "192.168.1.1"
1140 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1143 * If using static IP, the net mask.
1145 * Example: "255.255.255.0"
1147 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1150 * If using static IP, the primary DNS's IP address.
1152 * Example: "192.168.1.1"
1154 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1157 * If using static IP, the secondary DNS's IP address.
1159 * Example: "192.168.1.2"
1161 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1164 * The number of radio channels that are allowed in the local
1165 * 802.11 regulatory domain.
1168 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1171 * Determines whether remote devices may discover and/or connect to
1174 * 2 -- discoverable and connectable
1175 * 1 -- connectable but not discoverable
1176 * 0 -- neither connectable nor discoverable
1178 public static final String BLUETOOTH_DISCOVERABILITY =
1179 "bluetooth_discoverability";
1182 * Bluetooth discoverability timeout. If this value is nonzero, then
1183 * Bluetooth becomes discoverable for a certain number of seconds,
1184 * after which is becomes simply connectable. The value is in seconds.
1186 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1187 "bluetooth_discoverability_timeout";
1190 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
1194 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
1197 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
1201 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1205 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
1209 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1210 "lock_pattern_tactile_feedback_enabled";
1214 * A formatted string of the next alarm that is set, or the empty string
1215 * if there is no alarm set.
1217 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1220 * Scaling factor for fonts, float.
1222 public static final String FONT_SCALE = "font_scale";
1225 * Name of an application package to be debugged.
1227 public static final String DEBUG_APP = "debug_app";
1230 * If 1, when launching DEBUG_APP it will wait for the debugger before
1231 * starting user code. If 0, it will run normally.
1233 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1236 * Whether or not to dim the screen. 0=no 1=yes
1238 public static final String DIM_SCREEN = "dim_screen";
1241 * The timeout before the screen turns off.
1243 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1246 * If 0, the compatibility mode is off for all applications.
1247 * If 1, older applications run under compatibility mode.
1248 * TODO: remove this settings before code freeze (bug/1907571)
1251 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1254 * The screen backlight brightness between 0 and 255.
1256 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1259 * Control whether to enable automatic brightness mode.
1261 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1264 * SCREEN_BRIGHTNESS_MODE value for manual mode.
1266 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1269 * SCREEN_BRIGHTNESS_MODE value for manual mode.
1271 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1274 * Control whether the process CPU usage meter should be shown.
1276 public static final String SHOW_PROCESSES = "show_processes";
1279 * If 1, the activity manager will aggressively finish activities and
1280 * processes as soon as they are no longer needed. If 0, the normal
1281 * extended lifetime is used.
1283 public static final String ALWAYS_FINISH_ACTIVITIES =
1284 "always_finish_activities";
1288 * Ringer mode. This is used internally, changing this value will not
1289 * change the ringer mode. See AudioManager.
1291 public static final String MODE_RINGER = "mode_ringer";
1294 * Determines which streams are affected by ringer mode changes. The
1295 * stream type's bit should be set to 1 if it should be muted when going
1296 * into an inaudible ringer mode.
1298 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1301 * Determines which streams are affected by mute. The
1302 * stream type's bit should be set to 1 if it should be muted when a mute request
1305 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1308 * Whether vibrate is on for different events. This is used internally,
1309 * changing this value will not change the vibrate. See AudioManager.
1311 public static final String VIBRATE_ON = "vibrate_on";
1314 * Ringer volume. This is used internally, changing this value will not
1315 * change the volume. See AudioManager.
1317 public static final String VOLUME_RING = "volume_ring";
1320 * System/notifications volume. This is used internally, changing this
1321 * value will not change the volume. See AudioManager.
1323 public static final String VOLUME_SYSTEM = "volume_system";
1326 * Voice call volume. This is used internally, changing this value will
1327 * not change the volume. See AudioManager.
1329 public static final String VOLUME_VOICE = "volume_voice";
1332 * Music/media/gaming volume. This is used internally, changing this
1333 * value will not change the volume. See AudioManager.
1335 public static final String VOLUME_MUSIC = "volume_music";
1338 * Alarm volume. This is used internally, changing this
1339 * value will not change the volume. See AudioManager.
1341 public static final String VOLUME_ALARM = "volume_alarm";
1344 * Notification volume. This is used internally, changing this
1345 * value will not change the volume. See AudioManager.
1347 public static final String VOLUME_NOTIFICATION = "volume_notification";
1350 * Bluetooth Headset volume. This is used internally, changing this value will
1351 * not change the volume. See AudioManager.
1353 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1356 * Whether the notifications should use the ring volume (value of 1) or
1357 * a separate notification volume (value of 0). In most cases, users
1358 * will have this enabled so the notification and ringer volumes will be
1359 * the same. However, power users can disable this and use the separate
1360 * notification volume control.
1362 * Note: This is a one-off setting that will be removed in the future
1363 * when there is profile support. For this reason, it is kept hidden
1364 * from the public APIs.
1368 public static final String NOTIFICATIONS_USE_RING_VOLUME =
1369 "notifications_use_ring_volume";
1372 * Whether silent mode should allow vibration feedback. This is used
1373 * internally in AudioService and the Sound settings activity to
1374 * coordinate decoupling of vibrate and silent modes. This setting
1375 * will likely be removed in a future release with support for
1376 * audio/vibe feedback profiles.
1380 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
1383 * The mapping of stream type (integer) to its setting.
1385 public static final String[] VOLUME_SETTINGS = {
1386 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
1387 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
1391 * Appended to various volume related settings to record the previous
1392 * values before they the settings were affected by a silent/vibrate
1393 * ringer mode change.
1395 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1398 * Persistent store for the system-wide default ringtone URI.
1400 * If you need to play the default ringtone at any given time, it is recommended
1401 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1402 * to the set default ringtone at the time of playing.
1404 * @see #DEFAULT_RINGTONE_URI
1406 public static final String RINGTONE = "ringtone";
1409 * A {@link Uri} that will point to the current default ringtone at any
1412 * If the current default ringtone is in the DRM provider and the caller
1413 * does not have permission, the exception will be a
1414 * FileNotFoundException.
1416 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1419 * Persistent store for the system-wide default notification sound.
1422 * @see #DEFAULT_NOTIFICATION_URI
1424 public static final String NOTIFICATION_SOUND = "notification_sound";
1427 * A {@link Uri} that will point to the current default notification
1428 * sound at any given time.
1430 * @see #DEFAULT_RINGTONE_URI
1432 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1435 * Persistent store for the system-wide default alarm alert.
1438 * @see #DEFAULT_ALARM_ALERT_URI
1440 public static final String ALARM_ALERT = "alarm_alert";
1443 * A {@link Uri} that will point to the current default alarm alert at
1446 * @see #DEFAULT_ALARM_ALERT_URI
1448 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1451 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1453 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1456 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1458 public static final String TEXT_AUTO_CAPS = "auto_caps";
1461 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1462 * feature converts two spaces to a "." and space.
1464 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
1467 * Setting to showing softkeyboard in text editors. 1 = On, 0 = Off
1469 public static final String SOFTKEYBOARD = "softkeyboard";
1472 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1474 public static final String TEXT_SHOW_PASSWORD = "show_password";
1476 public static final String SHOW_GTALK_SERVICE_STATUS =
1477 "SHOW_GTALK_SERVICE_STATUS";
1480 * Name of activity to use for wallpaper on the home screen.
1482 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1485 * Value to specify if the user prefers the date, time and time zone
1486 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1488 public static final String AUTO_TIME = "auto_time";
1491 * Display times as 12 or 24 hours
1495 public static final String TIME_12_24 = "time_12_24";
1498 * Date format string
1503 public static final String DATE_FORMAT = "date_format";
1506 * Whether the setup wizard has been run before (on first boot), or if
1507 * it still needs to be run.
1509 * nonzero = it has been run in the past
1510 * 0 = it has not been run in the past
1512 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1515 * Scaling factor for normal window animations. Setting to 0 will disable window
1518 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1521 * Scaling factor for activity transition animations. Setting to 0 will disable window
1524 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1527 * Scaling factor for normal window animations. Setting to 0 will disable window
1531 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1534 * Control whether the accelerometer will be used to change screen
1535 * orientation. If 0, it will not be used unless explicitly requested
1536 * by the application; if 1, it will be used by default unless explicitly
1537 * disabled by the application.
1539 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1542 * Toggles whether to display the PLMN field on the Lockscreen
1545 public static final String SHOW_PLMN_LS = "show_plmn_ls";
1548 * Toggles whether to display the SPN field on the Lockscreen
1551 public static final String SHOW_SPN_LS = "show_spn_ls";
1554 * Toggles whether to display the PLMN field on the Notification bar
1557 public static final String SHOW_PLMN_SB = "show_plmn_sb";
1560 * Toggles whether to display the SPN field on the Notification bar
1563 public static final String SHOW_SPN_SB = "show_spn_sb";
1566 * Specifies whether to show or hide clock
1569 public static final String SHOW_STATUS_CLOCK = "show_status_clock";
1572 * Specifies the clock color
1575 public static final String CLOCK_COLOR = "clock_color";
1578 * Specifies notification count color
1581 public static final String NOTIF_COUNT_COLOR = "notifications_count_color";
1584 * Specifies the date color
1587 public static final String DATE_COLOR = "date_color";
1590 * Specifies new notification ticker color
1593 public static final String NEW_NOTIF_TICKER_COLOR = "new_notifications_ticker_color";
1596 * Specifies no notifications color
1599 public static final String NO_NOTIF_COLOR = "no_notifications_color";
1602 * Specifies latest nofitication color
1605 public static final String LATEST_NOTIF_COLOR = "latest_notifications_color";
1608 * Specifies ongoing notification color
1611 public static final String ONGOING_NOTIF_COLOR = "ongoing_notifications_color";
1614 * Specifies spn label color
1617 public static final String SPN_LABEL_COLOR = "spn_label_color";
1620 * Specifies plmn color
1623 public static final String PLMN_LABEL_COLOR = "plmn_label_color";
1626 * Specifies clear button color
1629 public static final String CLEAR_BUTTON_LABEL_COLOR = "clear_button_label_color";
1632 * Specifies notification item title color.
1635 public static final String NOTIF_ITEM_TITLE_COLOR = "notifications_title_color";
1638 * Specifies notification item text color.
1641 public static final String NOTIF_ITEM_TEXT_COLOR = "notifications_text_color";
1644 * Specifies notification item time color.
1647 public static final String NOTIF_ITEM_TIME_COLOR = "notifications_time_color";
1650 * Whether to show the battery level percentage overlayed on the icon.
1653 public static final String BATTERY_PERCENTAGE_STATUS_ICON = "battery_percentage_status_icon";
1656 * Specifies battery percentage status color
1659 public static final String BATTERY_PERCENTAGE_STATUS_COLOR = "battery_status_color_title";
1662 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1665 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1668 * CDMA only settings
1669 * DTMF tone type played by the dialer when dialing.
1674 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1677 * CDMA only settings
1678 * Emergency Tone 0 = Off
1683 public static final String EMERGENCY_TONE = "emergency_tone";
1686 * CDMA only settings
1687 * Whether the auto retry is enabled. The value is
1691 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1694 * Whether the hearing aid is enabled. The value is
1698 public static final String HEARING_AID = "hearing_aid";
1701 * CDMA only settings
1709 public static final String TTY_MODE = "tty_mode";
1712 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1715 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
1718 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1721 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
1724 * Whether live web suggestions while the user types into search dialogs are
1725 * enabled. Browsers and other search UIs should respect this, as it allows
1726 * a user to avoid sending partial queries to a search engine, if it poses
1727 * any privacy concern. The value is boolean (1 or 0).
1729 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
1732 * Whether the notification LED should repeatedly flash when a notification is
1733 * pending. The value is boolean (1 or 0).
1736 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1739 * Show pointer location on screen?
1744 public static final String POINTER_LOCATION = "pointer_location";
1747 * Whether to play a sound for low-battery alerts.
1750 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
1753 * Whether to play a sound for dock events.
1756 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
1759 * Whether to play sounds when the keyguard is shown and dismissed.
1762 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
1765 * URI for the low battery sound file.
1768 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
1771 * URI for the desk dock "in" event sound.
1774 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
1777 * URI for the desk dock "out" event sound.
1780 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
1783 * URI for the car dock "in" event sound.
1786 public static final String CAR_DOCK_SOUND = "car_dock_sound";
1789 * URI for the car dock "out" event sound.
1792 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
1795 * URI for the "device locked" (keyguard shown) sound.
1798 public static final String LOCK_SOUND = "lock_sound";
1801 * URI for the "device unlocked" (keyguard dismissed) sound.
1804 public static final String UNLOCK_SOUND = "unlock_sound";
1807 * Settings to backup. This is here so that it's in the same place as the settings
1808 * keys and easy to update.
1811 public static final String[] SETTINGS_TO_BACKUP = {
1812 STAY_ON_WHILE_PLUGGED_IN,
1816 WIFI_STATIC_GATEWAY,
1817 WIFI_STATIC_NETMASK,
1820 BLUETOOTH_DISCOVERABILITY,
1821 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1825 SCREEN_BRIGHTNESS_MODE,
1827 NOTIFICATIONS_USE_RING_VOLUME,
1829 MODE_RINGER_STREAMS_AFFECTED,
1830 MUTE_STREAMS_AFFECTED,
1836 VOLUME_NOTIFICATION,
1837 VOLUME_BLUETOOTH_SCO,
1838 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1839 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1840 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1841 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1842 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1843 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
1844 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
1848 TEXT_AUTO_PUNCTUATE,
1853 ACCELEROMETER_ROTATION,
1854 DTMF_TONE_WHEN_DIALING,
1855 DTMF_TONE_TYPE_WHEN_DIALING,
1860 SOUND_EFFECTS_ENABLED,
1861 HAPTIC_FEEDBACK_ENABLED,
1862 POWER_SOUNDS_ENABLED,
1863 DOCK_SOUNDS_ENABLED,
1864 LOCKSCREEN_SOUNDS_ENABLED,
1865 SHOW_WEB_SUGGESTIONS,
1866 NOTIFICATION_LIGHT_PULSE
1869 // Settings moved to Settings.Secure
1872 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
1876 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1879 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1882 public static final String ANDROID_ID = Secure.ANDROID_ID;
1885 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1888 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1891 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1894 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1897 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1900 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1903 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1906 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1909 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1912 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
1915 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1919 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1922 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1925 public static final String LOGGING_ID = Secure.LOGGING_ID;
1928 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1931 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1934 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1938 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1941 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1945 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1948 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1952 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1953 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1956 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1959 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1962 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1965 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
1968 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1971 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1975 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1978 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1982 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1985 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1986 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1990 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1993 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1994 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1998 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
2001 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2002 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
2005 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
2009 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
2012 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
2015 public static final String WIFI_ON = Secure.WIFI_ON;
2019 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
2023 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2024 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
2027 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
2030 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
2034 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
2037 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2038 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
2042 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
2045 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2046 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
2050 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
2054 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2055 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
2059 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
2062 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2063 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
2066 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
2070 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
2073 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
2076 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
2079 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
2082 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
2085 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
2089 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
2092 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
2096 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
2097 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
2101 * Secure system settings, containing system preferences that applications
2102 * can read but are not allowed to write. These are for preferences that
2103 * the user must explicitly modify through the system UI or specialized
2104 * APIs for those values, not modified directly by applications.
2106 public static final class Secure extends NameValueTable {
2107 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
2109 // Populated lazily, guarded by class object:
2110 private static NameValueCache sNameValueCache = null;
2113 * Look up a name in the database.
2114 * @param resolver to access the database with
2115 * @param name to look up in the table
2116 * @return the corresponding value, or null if not present
2118 public synchronized static String getString(ContentResolver resolver, String name) {
2119 if (sNameValueCache == null) {
2120 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
2121 CALL_METHOD_GET_SECURE);
2123 return sNameValueCache.getString(resolver, name);
2127 * Store a name/value pair into the database.
2128 * @param resolver to access the database with
2129 * @param name to store
2130 * @param value to associate with the name
2131 * @return true if the value was set, false on database errors
2133 public static boolean putString(ContentResolver resolver,
2134 String name, String value) {
2135 return putString(resolver, CONTENT_URI, name, value);
2139 * Construct the content URI for a particular name/value pair,
2140 * useful for monitoring changes with a ContentObserver.
2141 * @param name to look up in the table
2142 * @return the corresponding content URI, or null if not present
2144 public static Uri getUriFor(String name) {
2145 return getUriFor(CONTENT_URI, name);
2149 * Convenience function for retrieving a single secure settings value
2150 * as an integer. Note that internally setting values are always
2151 * stored as strings; this function converts the string to an integer
2152 * for you. The default value will be returned if the setting is
2153 * not defined or not an integer.
2155 * @param cr The ContentResolver to access.
2156 * @param name The name of the setting to retrieve.
2157 * @param def Value to return if the setting is not defined.
2159 * @return The setting's current value, or 'def' if it is not defined
2160 * or not a valid integer.
2162 public static int getInt(ContentResolver cr, String name, int def) {
2163 String v = getString(cr, name);
2165 return v != null ? Integer.parseInt(v) : def;
2166 } catch (NumberFormatException e) {
2172 * Convenience function for retrieving a single secure settings value
2173 * as an integer. Note that internally setting values are always
2174 * stored as strings; this function converts the string to an integer
2177 * This version does not take a default value. If the setting has not
2178 * been set, or the string value is not a number,
2179 * it throws {@link SettingNotFoundException}.
2181 * @param cr The ContentResolver to access.
2182 * @param name The name of the setting to retrieve.
2184 * @throws SettingNotFoundException Thrown if a setting by the given
2185 * name can't be found or the setting value is not an integer.
2187 * @return The setting's current value.
2189 public static int getInt(ContentResolver cr, String name)
2190 throws SettingNotFoundException {
2191 String v = getString(cr, name);
2193 return Integer.parseInt(v);
2194 } catch (NumberFormatException e) {
2195 throw new SettingNotFoundException(name);
2200 * Convenience function for updating a single settings value as an
2201 * integer. This will either create a new entry in the table if the
2202 * given name does not exist, or modify the value of the existing row
2203 * with that name. Note that internally setting values are always
2204 * stored as strings, so this function converts the given value to a
2205 * string before storing it.
2207 * @param cr The ContentResolver to access.
2208 * @param name The name of the setting to modify.
2209 * @param value The new value for the setting.
2210 * @return true if the value was set, false on database errors
2212 public static boolean putInt(ContentResolver cr, String name, int value) {
2213 return putString(cr, name, Integer.toString(value));
2217 * Convenience function for retrieving a single secure settings value
2218 * as a {@code long}. Note that internally setting values are always
2219 * stored as strings; this function converts the string to a {@code long}
2220 * for you. The default value will be returned if the setting is
2221 * not defined or not a {@code long}.
2223 * @param cr The ContentResolver to access.
2224 * @param name The name of the setting to retrieve.
2225 * @param def Value to return if the setting is not defined.
2227 * @return The setting's current value, or 'def' if it is not defined
2228 * or not a valid {@code long}.
2230 public static long getLong(ContentResolver cr, String name, long def) {
2231 String valString = getString(cr, name);
2234 value = valString != null ? Long.parseLong(valString) : def;
2235 } catch (NumberFormatException e) {
2242 * Convenience function for retrieving a single secure settings value
2243 * as a {@code long}. Note that internally setting values are always
2244 * stored as strings; this function converts the string to a {@code long}
2247 * This version does not take a default value. If the setting has not
2248 * been set, or the string value is not a number,
2249 * it throws {@link SettingNotFoundException}.
2251 * @param cr The ContentResolver to access.
2252 * @param name The name of the setting to retrieve.
2254 * @return The setting's current value.
2255 * @throws SettingNotFoundException Thrown if a setting by the given
2256 * name can't be found or the setting value is not an integer.
2258 public static long getLong(ContentResolver cr, String name)
2259 throws SettingNotFoundException {
2260 String valString = getString(cr, name);
2262 return Long.parseLong(valString);
2263 } catch (NumberFormatException e) {
2264 throw new SettingNotFoundException(name);
2269 * Convenience function for updating a secure settings value as a long
2270 * integer. This will either create a new entry in the table if the
2271 * given name does not exist, or modify the value of the existing row
2272 * with that name. Note that internally setting values are always
2273 * stored as strings, so this function converts the given value to a
2274 * string before storing it.
2276 * @param cr The ContentResolver to access.
2277 * @param name The name of the setting to modify.
2278 * @param value The new value for the setting.
2279 * @return true if the value was set, false on database errors
2281 public static boolean putLong(ContentResolver cr, String name, long value) {
2282 return putString(cr, name, Long.toString(value));
2286 * Convenience function for retrieving a single secure settings value
2287 * as a floating point number. Note that internally setting values are
2288 * always stored as strings; this function converts the string to an
2289 * float for you. The default value will be returned if the setting
2290 * is not defined or not a valid float.
2292 * @param cr The ContentResolver to access.
2293 * @param name The name of the setting to retrieve.
2294 * @param def Value to return if the setting is not defined.
2296 * @return The setting's current value, or 'def' if it is not defined
2297 * or not a valid float.
2299 public static float getFloat(ContentResolver cr, String name, float def) {
2300 String v = getString(cr, name);
2302 return v != null ? Float.parseFloat(v) : def;
2303 } catch (NumberFormatException e) {
2309 * Convenience function for retrieving a single secure settings value
2310 * as a float. Note that internally setting values are always
2311 * stored as strings; this function converts the string to a float
2314 * This version does not take a default value. If the setting has not
2315 * been set, or the string value is not a number,
2316 * it throws {@link SettingNotFoundException}.
2318 * @param cr The ContentResolver to access.
2319 * @param name The name of the setting to retrieve.
2321 * @throws SettingNotFoundException Thrown if a setting by the given
2322 * name can't be found or the setting value is not a float.
2324 * @return The setting's current value.
2326 public static float getFloat(ContentResolver cr, String name)
2327 throws SettingNotFoundException {
2328 String v = getString(cr, name);
2330 return Float.parseFloat(v);
2331 } catch (NumberFormatException e) {
2332 throw new SettingNotFoundException(name);
2337 * Convenience function for updating a single settings value as a
2338 * floating point number. This will either create a new entry in the
2339 * table if the given name does not exist, or modify the value of the
2340 * existing row with that name. Note that internally setting values
2341 * are always stored as strings, so this function converts the given
2342 * value to a string before storing it.
2344 * @param cr The ContentResolver to access.
2345 * @param name The name of the setting to modify.
2346 * @param value The new value for the setting.
2347 * @return true if the value was set, false on database errors
2349 public static boolean putFloat(ContentResolver cr, String name, float value) {
2350 return putString(cr, name, Float.toString(value));
2354 * The content:// style URL for this table
2356 public static final Uri CONTENT_URI =
2357 Uri.parse("content://" + AUTHORITY + "/secure");
2360 * Whether ADB is enabled.
2362 public static final String ADB_ENABLED = "adb_enabled";
2365 * Setting to allow mock locations and location provider status to be injected into the
2366 * LocationManager service for testing purposes during application development. These
2367 * locations and status values override actual location and status information generated
2368 * by network, gps, or other location providers.
2370 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2373 * A 64-bit number (as a hex string) that is randomly
2374 * generated on the device's first boot and should remain
2375 * constant for the lifetime of the device. (The value may
2376 * change if a factory reset is performed on the device.)
2378 public static final String ANDROID_ID = "android_id";
2381 * Whether bluetooth is enabled/disabled
2382 * 0=disabled. 1=enabled.
2384 public static final String BLUETOOTH_ON = "bluetooth_on";
2387 * Get the key that retrieves a bluetooth headset's priority.
2390 public static final String getBluetoothHeadsetPriorityKey(String address) {
2391 return ("bluetooth_headset_priority_" + address.toUpperCase());
2395 * Get the key that retrieves a bluetooth a2dp sink's priority.
2398 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2399 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2403 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2405 public static final String DATA_ROAMING = "data_roaming";
2408 * Setting to record the input method used by default, holding the ID
2409 * of the desired method.
2411 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2414 * Whether the device has been provisioned (0 = false, 1 = true)
2416 public static final String DEVICE_PROVISIONED = "device_provisioned";
2419 * List of input methods that are currently enabled. This is a string
2420 * containing the IDs of all enabled input methods, each ID separated
2423 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
2426 * List of system input methods that are currently disabled. This is a string
2427 * containing the IDs of all disabled input methods, each ID separated
2431 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
2434 * Host name and port for a user-selected proxy.
2436 public static final String HTTP_PROXY = "http_proxy";
2439 * Whether the package installer should allow installation of apps downloaded from
2440 * sources other than the Android Market (vending machine).
2442 * 1 = allow installing from other sources
2443 * 0 = only allow installing from the Android Market
2445 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
2448 * Comma-separated list of location providers that activities may access.
2450 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
2453 * Whether autolock is enabled (0 = false, 1 = true)
2455 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
2458 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
2460 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2463 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
2465 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2466 "lock_pattern_tactile_feedback_enabled";
2469 * Whether assisted GPS should be enabled or not.
2472 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2475 * The Logging ID (a unique 64-bit value) as a hex string.
2476 * Used as a pseudonymous identifier for logging.
2477 * @deprecated This identifier is poorly initialized and has
2478 * many collisions. It should not be used.
2481 public static final String LOGGING_ID = "logging_id";
2484 * User preference for which network(s) should be used. Only the
2485 * connectivity service should touch this.
2487 public static final String NETWORK_PREFERENCE = "network_preference";
2490 * Used to disable Tethering on a device - defaults to true
2493 public static final String TETHER_SUPPORTED = "tether_supported";
2496 * Used to require DUN APN on the device or not - defaults to a build config value
2497 * which defaults to false
2500 public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
2503 * Used to hold a gservices-provisioned apn value for DUN. If set, or the
2504 * corresponding build config values are set it will override the APN DB
2506 * Consists of a comma seperated list of strings:
2507 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
2508 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
2511 public static final String TETHER_DUN_APN = "tether_dun_apn";
2514 * No longer supported.
2516 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
2519 * No longer supported.
2521 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
2524 * No longer supported.
2526 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
2529 * Settings classname to launch when Settings is clicked from All
2530 * Applications. Needed because of user testing between the old
2531 * and new Settings apps.
2534 public static final String SETTINGS_CLASSNAME = "settings_classname";
2537 * USB Mass Storage Enabled
2539 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
2542 * If this setting is set (to anything), then all references
2543 * to Gmail on the device must change to Google Mail.
2545 public static final String USE_GOOGLE_MAIL = "use_google_mail";
2548 * If accessibility is enabled.
2550 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2553 * List of the enabled accessibility providers.
2555 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2556 "enabled_accessibility_services";
2559 * Setting to always use the default text-to-speech settings regardless
2560 * of the application settings.
2561 * 1 = override application settings,
2562 * 0 = use application settings (if specified).
2564 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2567 * Default text-to-speech engine speech rate. 100 = 1x
2569 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2572 * Default text-to-speech engine pitch. 100 = 1x
2574 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2577 * Default text-to-speech engine.
2579 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2582 * Default text-to-speech language.
2584 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2587 * Default text-to-speech country.
2589 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2592 * Default text-to-speech locale variant.
2594 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2597 * Space delimited list of plugin packages that are enabled.
2599 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
2602 * Whether to notify the user of open networks.
2604 * If not connected and the scan results have an open network, we will
2605 * put this notification up. If we attempt to connect to a network or
2606 * the open network(s) disappear, we remove the notification. When we
2607 * show the notification, we will not show it again for
2608 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2610 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2611 "wifi_networks_available_notification_on";
2614 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2615 * Connecting to a network will reset the timer.
2617 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2618 "wifi_networks_available_repeat_delay";
2621 * The number of radio channels that are allowed in the local
2622 * 802.11 regulatory domain.
2625 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
2628 * When the number of open networks exceeds this number, the
2629 * least-recently-used excess networks will be removed.
2631 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
2634 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2636 public static final String WIFI_ON = "wifi_on";
2639 * Ethernet related configurations
2641 public static final String ETHERNET_ON = "ethernet_on";
2642 public static final String ETHERNET_MODE = "ethernet_mode";
2643 public static final String ETHERNET_IP = "ethernet_ip";
2644 public static final String ETHERNET_MASK = "ethernet_netmask";
2645 public static final String ETHERNET_DNS = "ethernet_dns";
2646 public static final String ETHERNET_ROUTE = "ethernet_iproute";
2647 public static final String ETHERNET_CONF = "ethernet_conf";
2648 public static final String ETHERNET_IFNAME = "ethernet_ifname";
2651 * Used to save the Wifi_ON state prior to tethering.
2652 * This state will be checked to restore Wifi after
2653 * the user turns off tethering.
2657 public static final String WIFI_SAVED_STATE = "wifi_saved_state";
2664 public static final String WIFI_AP_SSID = "wifi_ap_ssid";
2671 public static final String WIFI_AP_SECURITY = "wifi_ap_security";
2678 public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
2681 * The acceptable packet loss percentage (range 0 - 100) before trying
2682 * another AP on the same network.
2684 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2685 "wifi_watchdog_acceptable_packet_loss_percentage";
2688 * The number of access points required for a network in order for the
2689 * watchdog to monitor it.
2691 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
2694 * The delay between background checks.
2696 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2697 "wifi_watchdog_background_check_delay_ms";
2700 * Whether the Wi-Fi watchdog is enabled for background checking even
2701 * after it thinks the user has connected to a good access point.
2703 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2704 "wifi_watchdog_background_check_enabled";
2707 * The timeout for a background ping
2709 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2710 "wifi_watchdog_background_check_timeout_ms";
2713 * The number of initial pings to perform that *may* be ignored if they
2714 * fail. Again, if these fail, they will *not* be used in packet loss
2715 * calculation. For example, one network always seemed to time out for
2716 * the first couple pings, so this is set to 3 by default.
2718 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2719 "wifi_watchdog_initial_ignored_ping_count";
2722 * The maximum number of access points (per network) to attempt to test.
2723 * If this number is reached, the watchdog will no longer monitor the
2724 * initial connection state for the network. This is a safeguard for
2725 * networks containing multiple APs whose DNS does not respond to pings.
2727 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
2730 * Whether the Wi-Fi watchdog is enabled.
2732 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2735 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
2737 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2740 * The number of pings to test if an access point is a good connection.
2742 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
2745 * The delay between pings.
2747 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
2750 * The timeout per ping.
2752 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
2755 * The maximum number of times we will retry a connection to an access
2756 * point for which we have failed in acquiring an IP address from DHCP.
2757 * A value of N means that we will make N+1 connection attempts in all.
2759 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
2762 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2763 * data connectivity to be established after a disconnect from Wi-Fi.
2765 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2766 "wifi_mobile_data_transition_wakelock_timeout_ms";
2769 * Whether background data usage is allowed by the user. See
2770 * ConnectivityManager for more info.
2772 public static final String BACKGROUND_DATA = "background_data";
2775 * Origins for which browsers should allow geolocation by default.
2776 * The value is a space-separated list of origins.
2778 public static final String ALLOWED_GEOLOCATION_ORIGINS
2779 = "allowed_geolocation_origins";
2782 * Whether mobile data connections are allowed by the user. See
2783 * ConnectivityManager for more info.
2786 public static final String MOBILE_DATA = "mobile_data";
2789 * The CDMA roaming mode 0 = Home Networks, CDMA default
2790 * 1 = Roaming on Affiliated networks
2791 * 2 = Roaming on any networks
2794 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2797 * The CDMA subscription mode 0 = RUIM/SIM (default)
2801 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2804 * The preferred network mode 7 = Global
2807 * 4 = CDMA / EvDo auto
2808 * 3 = GSM / WCDMA auto
2811 * 0 = GSM / WCDMA preferred
2814 public static final String PREFERRED_NETWORK_MODE =
2815 "preferred_network_mode";
2818 * The preferred TTY mode 0 = TTy Off, CDMA default
2824 public static final String PREFERRED_TTY_MODE =
2825 "preferred_tty_mode";
2829 * CDMA Cell Broadcast SMS
2830 * 0 = CDMA Cell Broadcast SMS disabled
2831 * 1 = CDMA Cell Broadcast SMS enabled
2834 public static final String CDMA_CELL_BROADCAST_SMS =
2835 "cdma_cell_broadcast_sms";
2838 * The cdma subscription 0 = Subscription from RUIM, when available
2839 * 1 = Subscription from NV
2842 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2843 "preferred_cdma_subscription";
2846 * Whether the enhanced voice privacy mode is enabled.
2847 * 0 = normal voice privacy
2848 * 1 = enhanced voice privacy
2851 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2854 * Whether the TTY mode mode is enabled.
2859 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
2862 * Controls whether settings backup is enabled.
2863 * Type: int ( 0 = disabled, 1 = enabled )
2866 public static final String BACKUP_ENABLED = "backup_enabled";
2869 * Controls whether application data is automatically restored from backup
2871 * Type: int ( 0 = disabled, 1 = enabled )
2874 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2877 * Indicates whether settings backup has been fully provisioned.
2878 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2881 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2884 * Component of the transport to use for backup/restore.
2887 public static final String BACKUP_TRANSPORT = "backup_transport";
2890 * Version for which the setup wizard was last shown. Bumped for
2891 * each release when there is new setup information to show.
2894 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
2897 * How frequently (in seconds) to check the memory status of the
2901 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2904 * Max frequency (in seconds) to log memory check stats, in realtime
2905 * seconds. This allows for throttling of logs when the device is
2906 * running for large amounts of time.
2909 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2910 "memcheck_log_realtime_interval";
2913 * Boolean indicating whether rebooting due to system memory checks
2917 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2920 * How many bytes the system process must be below to avoid scheduling
2921 * a soft reboot. This reboot will happen when it is next determined
2922 * to be a good time.
2925 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2928 * How many bytes the system process must be below to avoid scheduling
2929 * a hard reboot. This reboot will happen immediately.
2932 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2935 * How many bytes the phone process must be below to avoid scheduling
2936 * a soft restart. This restart will happen when it is next determined
2937 * to be a good time.
2940 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2943 * How many bytes the phone process must be below to avoid scheduling
2944 * a hard restart. This restart will happen immediately.
2947 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2950 * Boolean indicating whether restarting the phone process due to
2951 * memory checks is enabled.
2954 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2957 * First time during the day it is okay to kill processes
2958 * or reboot the device due to low memory situations. This number is
2959 * in seconds since midnight.
2962 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2965 * Last time during the day it is okay to kill processes
2966 * or reboot the device due to low memory situations. This number is
2967 * in seconds since midnight.
2970 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2973 * How long the screen must have been off in order to kill processes
2974 * or reboot. This number is in seconds. A value of -1 means to
2975 * entirely disregard whether the screen is on.
2978 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2981 * How much time there must be until the next alarm in order to kill processes
2982 * or reboot. This number is in seconds. Note: this value must be
2983 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2984 * always see an alarm scheduled within its time.
2987 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2990 * How frequently to check whether it is a good time to restart things,
2991 * if the device is in a bad state. This number is in seconds. Note:
2992 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2993 * the alarm to schedule the recheck will always appear within the
2994 * minimum "do not execute now" time.
2997 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
3000 * How frequently (in DAYS) to reboot the device. If 0, no reboots
3004 public static final String REBOOT_INTERVAL = "reboot_interval";
3007 * First time during the day it is okay to force a reboot of the
3008 * device (if REBOOT_INTERVAL is set). This number is
3009 * in seconds since midnight.
3012 public static final String REBOOT_START_TIME = "reboot_start_time";
3015 * The window of time (in seconds) after each REBOOT_INTERVAL in which
3016 * a reboot can be executed. If 0, a reboot will always be executed at
3017 * exactly the given time. Otherwise, it will only be executed if
3018 * the device is idle within the window.
3021 public static final String REBOOT_WINDOW = "reboot_window";
3024 * Threshold values for the duration and level of a discharge cycle, under
3025 * which we log discharge cycle info.
3028 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3029 "battery_discharge_duration_threshold";
3031 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
3034 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3035 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3036 * will never display the "Report" button.
3037 * Type: int ( 0 = disallow, 1 = allow )
3040 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3043 * Nonzero causes Log.wtf() to crash.
3046 public static final String WTF_IS_FATAL = "wtf_is_fatal";
3049 * Maximum age of entries kept by {@link android.os.IDropBox}.
3052 public static final String DROPBOX_AGE_SECONDS =
3053 "dropbox_age_seconds";
3055 * Maximum number of entry files which {@link android.os.IDropBox} will keep around.
3058 public static final String DROPBOX_MAX_FILES =
3059 "dropbox_max_files";
3061 * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
3064 public static final String DROPBOX_QUOTA_KB =
3067 * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
3070 public static final String DROPBOX_QUOTA_PERCENT =
3071 "dropbox_quota_percent";
3073 * Percent of total disk which {@link android.os.IDropBox} will never dip into.
3076 public static final String DROPBOX_RESERVE_PERCENT =
3077 "dropbox_reserve_percent";
3079 * Prefix for per-tag dropbox disable/enable settings.
3082 public static final String DROPBOX_TAG_PREFIX =
3085 * Lines of logcat to include with system crash/ANR/etc. reports,
3086 * as a prefix of the dropbox tag of the report type.
3087 * For example, "logcat_for_system_server_anr" controls the lines
3088 * of logcat captured with system server ANR reports. 0 to disable.
3091 public static final String ERROR_LOGCAT_PREFIX =
3096 * Screen timeout in milliseconds corresponding to the
3097 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3098 * possible screen timeout behavior.)
3101 public static final String SHORT_KEYLIGHT_DELAY_MS =
3102 "short_keylight_delay_ms";
3105 * The interval in minutes after which the amount of free storage left on the
3106 * device is logged to the event log
3109 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3110 "sys_free_storage_log_interval";
3113 * Threshold for the amount of change in disk free space required to report the amount of
3114 * free space. Used to prevent spamming the logs when the disk free space isn't changing
3118 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3119 "disk_free_change_reporting_threshold";
3123 * Minimum percentage of free storage on the device that is used to determine if
3124 * the device is running low on storage.
3125 * Say this value is set to 10, the device is considered running low on storage
3126 * if 90% or more of the device storage is filled up.
3129 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3130 "sys_storage_threshold_percentage";
3133 * The interval in milliseconds after which Wi-Fi is considered idle.
3134 * When idle, it is possible for the device to be switched from Wi-Fi to
3135 * the mobile data network.
3138 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3141 * The interval in milliseconds at which to check packet counts on the
3142 * mobile data interface when screen is on, to detect possible data
3143 * connection problems.
3146 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3147 "pdp_watchdog_poll_interval_ms";
3150 * The interval in milliseconds at which to check packet counts on the
3151 * mobile data interface when screen is off, to detect possible data
3152 * connection problems.
3155 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3156 "pdp_watchdog_long_poll_interval_ms";
3159 * The interval in milliseconds at which to check packet counts on the
3160 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3161 * outgoing packets has been reached without incoming packets.
3164 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3165 "pdp_watchdog_error_poll_interval_ms";
3168 * The number of outgoing packets sent without seeing an incoming packet
3169 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3170 * device is logged to the event log
3173 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3174 "pdp_watchdog_trigger_packet_count";
3177 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3178 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3179 * attempting data connection recovery.
3182 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3183 "pdp_watchdog_error_poll_count";
3186 * The number of failed PDP reset attempts before moving to something more
3187 * drastic: re-registering to the network.
3190 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3191 "pdp_watchdog_max_pdp_reset_fail_count";
3194 * Address to ping as a last sanity check before attempting any recovery.
3195 * Unset or set to "0.0.0.0" to skip this check.
3198 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
3201 * The "-w deadline" parameter for the ping, ie, the max time in
3202 * seconds to spend pinging.
3205 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
3208 * The interval in milliseconds at which to check gprs registration
3209 * after the first registration mismatch of gprs and voice service,
3210 * to detect possible data network registration problems.
3214 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3215 "gprs_register_check_period_ms";
3218 * The length of time in milli-seconds that automatic small adjustments to
3219 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3222 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3225 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3226 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3230 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3233 * The maximum reconnect delay for short network outages or when the network is suspended
3237 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3238 "sync_max_retry_delay_in_seconds";
3241 * The interval in milliseconds at which to check the number of SMS sent
3242 * out without asking for use permit, to limit the un-authorized SMS
3246 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3247 "sms_outgoing_check_interval_ms";
3250 * The number of outgoing SMS sent without asking for user permit
3251 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3254 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
3255 "sms_outgoing_check_max_count";
3258 * The number of promoted sources in GlobalSearch.
3261 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3263 * The maximum number of suggestions returned by GlobalSearch.
3266 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3268 * The number of suggestions GlobalSearch will ask each non-web search source for.
3271 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3273 * The number of suggestions the GlobalSearch will ask the web search source for.
3276 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3277 "search_web_results_override_limit";
3279 * The number of milliseconds that GlobalSearch will wait for suggestions from
3280 * promoted sources before continuing with all other sources.
3283 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3284 "search_promoted_source_deadline_millis";
3286 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3289 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3291 * The maximum number of milliseconds that GlobalSearch shows the previous results
3292 * after receiving a new query.
3295 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3297 * The maximum age of log data used for shortcuts in GlobalSearch.
3300 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3302 * The maximum age of log data used for source ranking in GlobalSearch.
3305 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3306 "search_max_source_event_age_millis";
3308 * The minimum number of impressions needed to rank a source in GlobalSearch.
3311 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3312 "search_min_impressions_for_source_ranking";
3314 * The minimum number of clicks needed to rank a source in GlobalSearch.
3317 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3318 "search_min_clicks_for_source_ranking";
3320 * The maximum number of shortcuts shown by GlobalSearch.
3323 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3325 * The size of the core thread pool for suggestion queries in GlobalSearch.
3328 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3329 "search_query_thread_core_pool_size";
3331 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3334 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3335 "search_query_thread_max_pool_size";
3337 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3340 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3341 "search_shortcut_refresh_core_pool_size";
3343 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3346 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3347 "search_shortcut_refresh_max_pool_size";
3349 * The maximun time that excess threads in the GlobalSeach thread pools will
3350 * wait before terminating.
3353 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3354 "search_thread_keepalive_seconds";
3356 * The maximum number of concurrent suggestion queries to each source.
3359 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3360 "search_per_source_concurrent_query_limit";
3363 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
3366 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
3369 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3372 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3375 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3378 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3381 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3384 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
3387 * If nonzero, ANRs in invisible background processes bring up a dialog.
3388 * Otherwise, the process will be silently killed.
3391 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
3394 * The {@link ComponentName} string of the service to be used as the voice recognition
3399 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
3402 * What happens when the user presses the Power button while in-call
3403 * and the screen is on.<br/>
3404 * <b>Values:</b><br/>
3405 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
3406 * 2 - The Power button hangs up the current call.<br/>
3410 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
3413 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
3416 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
3419 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
3422 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
3425 * INCALL_POWER_BUTTON_BEHAVIOR default value.
3428 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
3429 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
3432 * The current night mode that has been selected by the user. Owned
3433 * and controlled by UiModeManagerService. Constants are as per
3437 public static final String UI_NIGHT_MODE = "ui_night_mode";
3440 * Let user pick default install location.
3443 public static final String SET_INSTALL_LOCATION = "set_install_location";
3446 * Default install location value.
3447 * 0 = auto, let system decide
3452 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
3455 * The bandwidth throttle polling freqency in seconds
3458 public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3461 * The bandwidth throttle threshold (long)
3464 public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
3467 * The bandwidth throttle value (kbps)
3470 public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
3473 * The bandwidth throttle reset calendar day (1-28)
3476 public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3479 * The throttling notifications we should send
3482 public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3485 * Help URI for data throttling policy
3488 public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3491 * The length of time in Sec that we allow our notion of NTP time
3492 * to be cached before we refresh it
3495 public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3496 "throttle_max_ntp_cache_age_sec";
3502 public static final String[] SETTINGS_TO_BACKUP = {
3504 ALLOW_MOCK_LOCATION,
3505 PARENTAL_CONTROL_ENABLED,
3506 PARENTAL_CONTROL_REDIRECT_URL,
3507 USB_MASS_STORAGE_ENABLED,
3508 ACCESSIBILITY_ENABLED,
3509 BACKUP_AUTO_RESTORE,
3510 ENABLED_ACCESSIBILITY_SERVICES,
3516 TTS_DEFAULT_COUNTRY,
3517 TTS_ENABLED_PLUGINS,
3518 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3519 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
3520 WIFI_NUM_ALLOWED_CHANNELS,
3521 WIFI_NUM_OPEN_NETWORKS_KEPT,
3522 MOUNT_PLAY_NOTIFICATION_SND,
3523 MOUNT_UMS_AUTOSTART,
3525 MOUNT_UMS_NOTIFY_ENABLED,
3530 * Helper method for determining if a location provider is enabled.
3531 * @param cr the content resolver to use
3532 * @param provider the location provider to query
3533 * @return true if the provider is enabled
3535 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3536 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
3537 if (allowedProviders != null) {
3538 return (allowedProviders.equals(provider) ||
3539 allowedProviders.contains("," + provider + ",") ||
3540 allowedProviders.startsWith(provider + ",") ||
3541 allowedProviders.endsWith("," + provider));
3547 * Thread-safe method for enabling or disabling a single location provider.
3548 * @param cr the content resolver to use
3549 * @param provider the location provider to enable or disable
3550 * @param enabled true if the provider should be enabled
3552 public static final void setLocationProviderEnabled(ContentResolver cr,
3553 String provider, boolean enabled) {
3554 // to ensure thread safety, we write the provider name with a '+' or '-'
3555 // and let the SettingsProvider handle it rather than reading and modifying
3556 // the list of enabled providers.
3558 provider = "+" + provider;
3560 provider = "-" + provider;
3562 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3567 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3568 * Intent URL, allowing it to be either a web page or a particular
3569 * application activity.
3573 public static final class Bookmarks implements BaseColumns
3575 private static final String TAG = "Bookmarks";
3578 * The content:// style URL for this table
3580 public static final Uri CONTENT_URI =
3581 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3585 * <p>Type: INTEGER</p>
3587 public static final String ID = "_id";
3590 * Descriptive name of the bookmark that can be displayed to the user.
3591 * If this is empty, the title should be resolved at display time (use
3592 * {@link #getTitle(Context, Cursor)} any time you want to display the
3593 * title of a bookmark.)
3598 public static final String TITLE = "title";
3601 * Arbitrary string (displayed to the user) that allows bookmarks to be
3602 * organized into categories. There are some special names for
3603 * standard folders, which all start with '@'. The label displayed for
3604 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3605 * the folder name does not change so you can consistently query for
3606 * the folder regardless of the current locale.
3611 public static final String FOLDER = "folder";
3614 * The Intent URL of the bookmark, describing what it points to. This
3615 * value is given to {@link android.content.Intent#getIntent} to create
3616 * an Intent that can be launched.
3619 public static final String INTENT = "intent";
3622 * Optional shortcut character associated with this bookmark.
3623 * <P>Type: INTEGER</P>
3625 public static final String SHORTCUT = "shortcut";
3628 * The order in which the bookmark should be displayed
3629 * <P>Type: INTEGER</P>
3631 public static final String ORDERING = "ordering";
3633 private static final String[] sIntentProjection = { INTENT };
3634 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3635 private static final String sShortcutSelection = SHORTCUT + "=?";
3638 * Convenience function to retrieve the bookmarked Intent for a
3639 * particular shortcut key.
3641 * @param cr The ContentResolver to query.
3642 * @param shortcut The shortcut key.
3644 * @return Intent The bookmarked URL, or null if there is no bookmark
3645 * matching the given shortcut.
3647 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3649 Intent intent = null;
3651 Cursor c = cr.query(CONTENT_URI,
3652 sIntentProjection, sShortcutSelection,
3653 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3654 // Keep trying until we find a valid shortcut
3656 while (intent == null && c.moveToNext()) {
3658 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3659 intent = Intent.getIntent(intentURI);
3660 } catch (java.net.URISyntaxException e) {
3661 // The stored URL is bad... ignore it.
3662 } catch (IllegalArgumentException e) {
3664 Log.w(TAG, "Intent column not found", e);
3668 if (c != null) c.close();
3675 * Add a new bookmark to the system.
3677 * @param cr The ContentResolver to query.
3678 * @param intent The desired target of the bookmark.
3679 * @param title Bookmark title that is shown to the user; null if none
3680 * or it should be resolved to the intent's title.
3681 * @param folder Folder in which to place the bookmark; null if none.
3682 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3683 * this is non-zero and there is an existing bookmark entry
3684 * with this same shortcut, then that existing shortcut is
3685 * cleared (the bookmark is not removed).
3686 * @return The unique content URL for the new bookmark entry.
3688 public static Uri add(ContentResolver cr,
3695 // If a shortcut is supplied, and it is already defined for
3696 // another bookmark, then remove the old definition.
3697 if (shortcut != 0) {
3698 Cursor c = cr.query(CONTENT_URI,
3699 sShortcutProjection, sShortcutSelection,
3700 new String[] { String.valueOf((int) shortcut) }, null);
3702 if (c.moveToFirst()) {
3703 while (c.getCount() > 0) {
3704 if (!c.deleteRow()) {
3705 Log.w(TAG, "Could not delete existing shortcut row");
3710 if (c != null) c.close();
3714 ContentValues values = new ContentValues();
3715 if (title != null) values.put(TITLE, title);
3716 if (folder != null) values.put(FOLDER, folder);
3717 values.put(INTENT, intent.toURI());
3718 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3719 values.put(ORDERING, ordering);
3720 return cr.insert(CONTENT_URI, values);
3724 * Return the folder name as it should be displayed to the user. This
3725 * takes care of localizing special folders.
3727 * @param r Resources object for current locale; only need access to
3729 * @param folder The value found in the {@link #FOLDER} column.
3731 * @return CharSequence The label for this folder that should be shown
3734 public static CharSequence getLabelForFolder(Resources r, String folder) {
3739 * Return the title as it should be displayed to the user. This takes
3740 * care of localizing bookmarks that point to activities.
3742 * @param context A context.
3743 * @param cursor A cursor pointing to the row whose title should be
3744 * returned. The cursor must contain at least the {@link #TITLE}
3745 * and {@link #INTENT} columns.
3746 * @return A title that is localized and can be displayed to the user,
3747 * or the empty string if one could not be found.
3749 public static CharSequence getTitle(Context context, Cursor cursor) {
3750 int titleColumn = cursor.getColumnIndex(TITLE);
3751 int intentColumn = cursor.getColumnIndex(INTENT);
3752 if (titleColumn == -1 || intentColumn == -1) {
3753 throw new IllegalArgumentException(
3754 "The cursor must contain the TITLE and INTENT columns.");
3757 String title = cursor.getString(titleColumn);
3758 if (!TextUtils.isEmpty(title)) {
3762 String intentUri = cursor.getString(intentColumn);
3763 if (TextUtils.isEmpty(intentUri)) {
3769 intent = Intent.getIntent(intentUri);
3770 } catch (URISyntaxException e) {
3774 PackageManager packageManager = context.getPackageManager();
3775 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3776 return info != null ? info.loadLabel(packageManager) : "";
3781 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3782 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3783 * from the GoogleLoginService.
3785 * @param androidId The Android ID for this device.
3786 * @return The device ID that should be used when connecting to the mobile gtalk server.
3789 public static String getGTalkDeviceId(long androidId) {
3790 return "android-" + Long.toHexString(androidId);