summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/InputMethodManagerService.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java44
1 files changed, 31 insertions, 13 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index c9ff595..94e0bd4 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -386,6 +386,7 @@ 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 {
SettingsObserver(Handler handler) {
@@ -443,7 +444,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final int userId = getChangingUserId();
final boolean retval = userId == mSettings.getCurrentUserId();
if (DEBUG) {
- Slog.d(TAG, "--- ignore this call back from a background user: " + userId);
+ if (!retval) {
+ Slog.d(TAG, "--- ignore this call back from a background user: " + userId);
+ }
}
return retval;
}
@@ -657,7 +660,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} catch (RemoteException e) {
Slog.w(TAG, "Couldn't get current user ID; guessing it's 0", e);
}
- mMyPackageMonitor.register(mContext, null, true);
+ mMyPackageMonitor.register(mContext, null, UserHandle.ALL, true);
// mSettings should be created before buildInputMethodListLocked
mSettings = new InputMethodSettings(
@@ -877,10 +880,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final boolean hardKeyShown = haveHardKeyboard
&& conf.hardKeyboardHidden
!= Configuration.HARDKEYBOARDHIDDEN_YES;
- final boolean isScreenLocked = mKeyguardManager != null
- && mKeyguardManager.isKeyguardLocked()
- && mKeyguardManager.isKeyguardSecure();
- mImeWindowVis = (!isScreenLocked && (mInputShown || hardKeyShown)) ?
+ final boolean isScreenLocked =
+ mKeyguardManager != null && mKeyguardManager.isKeyguardLocked();
+ final boolean isScreenSecurelyLocked =
+ isScreenLocked && mKeyguardManager.isKeyguardSecure();
+ final boolean inputShown = mInputShown && (!isScreenLocked || mInputBoundToKeyguard);
+ mImeWindowVis = (!isScreenSecurelyLocked && (inputShown || hardKeyShown)) ?
(InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE) : 0;
updateImeWindowStatusLocked();
}
@@ -1124,6 +1129,13 @@ 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) {
// If the client is changing, we need to switch over to the new
// one.
@@ -1814,9 +1826,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
public InputBindResult windowGainedFocus(IInputMethodClient client, IBinder windowToken,
int controlFlags, int softInputMode, int windowFlags,
EditorInfo attribute, IInputContext inputContext) {
- if (!calledFromValidUser()) {
- return null;
- }
+ // Needs to check the validity before clearing calling identity
+ final boolean calledFromValidUser = calledFromValidUser();
+
InputBindResult res = null;
long ident = Binder.clearCallingIdentity();
try {
@@ -1846,6 +1858,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} catch (RemoteException e) {
}
+ if (!calledFromValidUser) {
+ Slog.w(TAG, "A background user is requesting window. Hiding IME.");
+ Slog.w(TAG, "If you want to interect with IME, you need "
+ + "android.permission.INTERACT_ACROSS_USERS_FULL");
+ hideCurrentInputLocked(0, null);
+ return null;
+ }
+
if (mCurFocusedWindow == windowToken) {
Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client
+ " attribute=" + attribute + ", token = " + windowToken);
@@ -2486,10 +2506,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
map.put(id, p);
// Valid system default IMEs and IMEs that have English subtypes are enabled
- // by default, unless there's a hard keyboard and the system IME was explicitly
- // disabled
- if ((isValidSystemDefaultIme(p, mContext) || isSystemImeThatHasEnglishSubtype(p))
- && (!haveHardKeyboard || disabledSysImes.indexOf(id) < 0)) {
+ // by default
+ if ((isValidSystemDefaultIme(p, mContext) || isSystemImeThatHasEnglishSubtype(p))) {
setInputMethodEnabledLocked(id, true);
}