diff options
author | John Spurlock <jspurlock@google.com> | 2013-10-25 11:59:29 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2013-10-29 10:47:07 -0400 |
commit | e0980501e9b0c5a4f481481f3c5cb2f78f08c5aa (patch) | |
tree | 159e1537e3ac7621d3ac6284a315df53253bf89c /services/java | |
parent | 2b5297a40024e9cf136919d3ea0e88cb4ccfa27c (diff) | |
download | frameworks_base-e0980501e9b0c5a4f481481f3c5cb2f78f08c5aa.zip frameworks_base-e0980501e9b0c5a4f481481f3c5cb2f78f08c5aa.tar.gz frameworks_base-e0980501e9b0c5a4f481481f3c5cb2f78f08c5aa.tar.bz2 |
Simplify IME policy and enforce in binder calls.
Revert the overly complicated bc7b6fc2a4b701596a2c8eecc4aeef522abeeafa.
Since setImeWindowStatus can be called externally, enforce similar keyguard
policy so that this is not a backdoor for IMEs bound under the keyguard to
drive IME visibility.
Policy is simplified, we keep track of whether the keyguard is locked
when the current IME switches.
This fixes b/7498792 (activity under lockscreen drives IME visibility
when lockscreen is rotated) and does not break b/11186297 (IME visible
when BT keyboard is attached).
Bug:7498792
Change-Id: Idd335cc8259c3532fa869449a9048b420f286e6d
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 562a50f..a996dbd 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -309,6 +309,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mShortcutInputMethodsAndSubtypes = new HashMap<InputMethodInfo, ArrayList<InputMethodSubtype>>(); + // Was the keyguard locked when this client became current? + private boolean mCurClientInKeyguard; + /** * Set to true if our ServiceConnection is currently actively bound to * a service (whether or not we have gotten its IBinder back yet). @@ -385,7 +388,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub private Locale mLastSystemLocale; private final MyPackageMonitor mMyPackageMonitor = new MyPackageMonitor(); private final IPackageManager mIPackageManager; - private boolean mInputBoundToKeyguard; class SettingsObserver extends ContentObserver { String mLastEnabled = ""; @@ -874,12 +876,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final boolean hardKeyShown = haveHardKeyboard && conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES; - final boolean isScreenLocked = - mKeyguardManager != null && mKeyguardManager.isKeyguardLocked(); - final boolean isScreenSecurelyLocked = - isScreenLocked && mKeyguardManager.isKeyguardSecure(); - final boolean inputShown = mInputShown && (!isScreenLocked || mInputBoundToKeyguard); - final boolean inputActive = !isScreenSecurelyLocked && (inputShown || hardKeyShown); + + final boolean isScreenLocked = isKeyguardLocked(); + final boolean inputActive = !isScreenLocked && (mInputShown || hardKeyShown); // We assume the softkeyboard is shown when the input is active as long as the // hard keyboard is not shown. final boolean inputVisible = inputActive && !hardKeyShown; @@ -1135,19 +1134,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mNoBinding; } - if (mCurClient == null) { - mInputBoundToKeyguard = mKeyguardManager != null && mKeyguardManager.isKeyguardLocked(); - if (DEBUG) { - Slog.v(TAG, "New bind. keyguard = " + mInputBoundToKeyguard); - } - } - if (mCurClient != cs) { + // Was the keyguard locked when switching over to the new client? + mCurClientInKeyguard = isKeyguardLocked(); // If the client is changing, we need to switch over to the new // one. unbindCurrentClientLocked(); if (DEBUG) Slog.v(TAG, "switching to client: client = " - + cs.client.asBinder()); + + cs.client.asBinder() + " keyguard=" + mCurClientInKeyguard); // If the screen is on, inform the new client it is active if (mScreenOn) { @@ -1499,6 +1493,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } + private boolean isKeyguardLocked() { + return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked(); + } + // Caution! This method is called in this class. Handle multi-user carefully @SuppressWarnings("deprecation") @Override @@ -1510,8 +1508,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Slog.w(TAG, "Ignoring setImeWindowStatus of uid " + uid + " token: " + token); return; } - synchronized (mMethodMap) { + // apply policy for binder calls + if (vis != 0 && isKeyguardLocked() && !mCurClientInKeyguard) { + vis = 0; + } mImeWindowVis = vis; mBackDisposition = backDisposition; if (mStatusBar != null) { |