diff options
author | satok <satok@google.com> | 2011-01-31 22:14:32 +0900 |
---|---|---|
committer | satok <satok@google.com> | 2011-02-01 09:01:58 +0900 |
commit | 4d733290a112fbe7ca5631ee870094b538f39d80 (patch) | |
tree | 139cd58c159b2e74030a6c41fb135d59595d5fe3 /services | |
parent | 11f9647e03d4e1141bc4312626c8dc9116f1f470 (diff) | |
download | frameworks_base-4d733290a112fbe7ca5631ee870094b538f39d80.zip frameworks_base-4d733290a112fbe7ca5631ee870094b538f39d80.tar.gz frameworks_base-4d733290a112fbe7ca5631ee870094b538f39d80.tar.bz2 |
Not to update IME when Settings version is older than the last updated version.
- Check if just old version or not.
- Sometimes, ContentObserver.onChange is called before finishing to save the actual value.
This can be verified by checking the system settings version. If the version is not updated,
cached value will be returned from Settings.Secure, and this should not be handled.
Bug: 3406300
Change-Id: Ie3f5b484b5574e10a41dfc209ed31271a474b828
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 586d222..6636fb7 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -60,6 +60,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.SystemProperties; import android.provider.Settings; import android.provider.Settings.Secure; import android.provider.Settings.SettingNotFoundException; @@ -314,6 +315,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT; int mImeWindowVis; + long mOldSystemSettingsVersion; AlertDialog.Builder mDialogBuilder; AlertDialog mSwitchingDialog; @@ -486,6 +488,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub handleMessage(msg); } }); + // Initialize the system settings version to undefined. + mOldSystemSettingsVersion = -1; (new MyPackageMonitor()).register(mContext, true); @@ -1007,7 +1011,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } + // TODO: Investigate and fix why are settings changes getting processed before the settings seq + // number is updated? + // TODO: Change this stuff to not rely on modifying settings for normal user interactions. void updateFromSettingsLocked() { + long newSystemSettingsVersion = getSystemSettingsVersion(); + // This is a workaround to avoid a situation that old cached value in Settings.Secure + // will be handled. + if (newSystemSettingsVersion == mOldSystemSettingsVersion) return; + // We are assuming that whoever is changing DEFAULT_INPUT_METHOD and // ENABLED_INPUT_METHODS is taking care of keeping them correctly in // sync, so we will never have a DEFAULT_INPUT_METHOD that is not @@ -1958,6 +1970,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub private void setSelectedInputMethodAndSubtypeLocked(InputMethodInfo imi, int subtypeId, boolean setSubtypeOnly) { + mOldSystemSettingsVersion = getSystemSettingsVersion(); // Update the history of InputMethod and Subtype saveCurrentInputMethodAndSubtypeToHistory(); @@ -2207,6 +2220,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } + private static long getSystemSettingsVersion() { + return SystemProperties.getLong(Settings.Secure.SYS_PROP_SETTING_VERSION, 0); + } + /** * @return Return the current subtype of this input method. */ |