Decrease default longpress timeout to 400ms.
If the device being upgraded happens to have a timeout of
500ms it will be reset to 400. If the value is something
else it will be left alone upon upgrade.
Bug: 30159825
Change-Id: Ifec70e458ce0199b61d36f7504aea02b4a974990
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 1928f92..4d3e3e5 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2085,7 +2085,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 129;
+ private static final int SETTINGS_VERSION = 130;
private final int mUserId;
@@ -2376,6 +2376,32 @@
currentVersion = 129;
}
+ if (currentVersion == 129) {
+ // default longpress timeout changed from 500 to 400. If unchanged from the old
+ // default, update to the new default.
+ final SettingsState systemSecureSettings =
+ getSecureSettingsLocked(userId);
+ final String oldValue = systemSecureSettings.getSettingLocked(
+ Settings.Secure.LONG_PRESS_TIMEOUT).getValue();
+ if (TextUtils.equals("500", oldValue)) {
+ systemSecureSettings.insertSettingLocked(
+ Settings.Secure.LONG_PRESS_TIMEOUT,
+ String.valueOf(getContext().getResources().getInteger(
+ R.integer.def_long_press_timeout_millis)),
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ currentVersion = 130;
+ }
+
+ if (currentVersion != newVersion) {
+ Slog.w("SettingsProvider", "warning: upgrading settings database to version "
+ + newVersion + " left it at "
+ + currentVersion + " instead; this is probably a bug", new Throwable());
+ if (DEBUG) {
+ throw new RuntimeException("db upgrade error");
+ }
+ }
+
// vXXX: Add new settings above this point.
// Return the current version.