From 15452a487a4c0274f4217cd060aa54446f30a8f3 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 28 Oct 2011 17:58:28 +0900 Subject: Hide ime switcher when the screen is turned off. Bug: 5481999 Change-Id: Ifc870f1350db2a67405c05f6de447a69dc050408 --- .../android/server/InputMethodManagerService.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'services') diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 03d6b41..17ea03b 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -374,6 +374,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mScreenOn = true; } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { mScreenOn = false; + setImeWindowVisibilityStatusHiddenLocked(); } else if (intent.getAction().equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) { hideInputMethodMenu(); return; @@ -468,8 +469,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // Uh oh, current input method is no longer around! // Pick another one... Slog.i(TAG, "Current input method removed: " + curInputMethodId); - mImeWindowVis = 0; - updateImeWindowStatusLocked(); + setImeWindowVisibilityStatusHiddenLocked(); if (!chooseNewDefaultIMELocked()) { changed = true; curIm = null; @@ -625,7 +625,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } - void updateImeWindowStatusLocked() { + private void setImeWindowVisibilityStatusHiddenLocked() { + mImeWindowVis = 0; + updateImeWindowStatusLocked(); + } + + private void updateImeWindowStatusLocked() { setImeWindowStatus(mCurToken, mImeWindowVis, mBackDisposition); } @@ -999,8 +1004,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub sessionState.session.finishSession(); } catch (RemoteException e) { Slog.w(TAG, "Session failed to close due to remote exception", e); - mImeWindowVis = 0; - updateImeWindowStatusLocked(); + setImeWindowVisibilityStatusHiddenLocked(); } } } @@ -1395,13 +1399,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (!mIWindowManager.inputMethodClientHasFocus(client)) { if (DEBUG) Slog.w(TAG, "Ignoring hideSoftInput of uid " + uid + ": " + client); - mImeWindowVis = 0; - updateImeWindowStatusLocked(); + setImeWindowVisibilityStatusHiddenLocked(); return false; } } catch (RemoteException e) { - mImeWindowVis = 0; - updateImeWindowStatusLocked(); + setImeWindowVisibilityStatusHiddenLocked(); return false; } } -- cgit v1.1