@@ -374,6 +374,7 @@ public void onReceive(Context context, Intent intent) {
374374 mScreenOn = true ;
375375 } else if (intent .getAction ().equals (Intent .ACTION_SCREEN_OFF )) {
376376 mScreenOn = false ;
377+ setImeWindowVisibilityStatusHiddenLocked ();
377378 } else if (intent .getAction ().equals (Intent .ACTION_CLOSE_SYSTEM_DIALOGS )) {
378379 hideInputMethodMenu ();
379380 return ;
@@ -468,8 +469,7 @@ public void onSomePackagesChanged() {
468469 // Uh oh, current input method is no longer around!
469470 // Pick another one...
470471 Slog .i (TAG , "Current input method removed: " + curInputMethodId );
471- mImeWindowVis = 0 ;
472- updateImeWindowStatusLocked ();
472+ setImeWindowVisibilityStatusHiddenLocked ();
473473 if (!chooseNewDefaultIMELocked ()) {
474474 changed = true ;
475475 curIm = null ;
@@ -625,7 +625,12 @@ public void systemReady(StatusBarManagerService statusBar) {
625625 }
626626 }
627627
628- void updateImeWindowStatusLocked () {
628+ private void setImeWindowVisibilityStatusHiddenLocked () {
629+ mImeWindowVis = 0 ;
630+ updateImeWindowStatusLocked ();
631+ }
632+
633+ private void updateImeWindowStatusLocked () {
629634 setImeWindowStatus (mCurToken , mImeWindowVis , mBackDisposition );
630635 }
631636
@@ -999,8 +1004,7 @@ private void finishSession(SessionState sessionState) {
9991004 sessionState .session .finishSession ();
10001005 } catch (RemoteException e ) {
10011006 Slog .w (TAG , "Session failed to close due to remote exception" , e );
1002- mImeWindowVis = 0 ;
1003- updateImeWindowStatusLocked ();
1007+ setImeWindowVisibilityStatusHiddenLocked ();
10041008 }
10051009 }
10061010 }
@@ -1395,13 +1399,11 @@ public boolean hideSoftInput(IInputMethodClient client, int flags,
13951399 if (!mIWindowManager .inputMethodClientHasFocus (client )) {
13961400 if (DEBUG ) Slog .w (TAG , "Ignoring hideSoftInput of uid "
13971401 + uid + ": " + client );
1398- mImeWindowVis = 0 ;
1399- updateImeWindowStatusLocked ();
1402+ setImeWindowVisibilityStatusHiddenLocked ();
14001403 return false ;
14011404 }
14021405 } catch (RemoteException e ) {
1403- mImeWindowVis = 0 ;
1404- updateImeWindowStatusLocked ();
1406+ setImeWindowVisibilityStatusHiddenLocked ();
14051407 return false ;
14061408 }
14071409 }
0 commit comments