Loading core/java/android/view/IWindowManager.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ interface IWindowManager IWindowSession openSession(in IWindowSessionCallback callback, in IInputMethodClient client, in IInputContext inputContext); boolean inputMethodClientHasFocus(IInputMethodClient client); void getInitialDisplaySize(int displayId, out Point size); void getBaseDisplaySize(int displayId, out Point size); Loading services/core/java/com/android/server/InputMethodManagerService.java +21 −32 Original line number Diff line number Diff line Loading @@ -2523,19 +2523,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub synchronized (mMethodMap) { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { try { // We need to check if this is the current client with // focus in the window manager, to allow this call to // be made before input is started in it. if (!mIWindowManager.inputMethodClientHasFocus(client)) { if (!mWindowManagerInternal.inputMethodClientHasFocus(client)) { Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client); return false; } } catch (RemoteException e) { return false; } } if (DEBUG) Slog.v(TAG, "Client requesting input be shown"); return showCurrentInputLocked(flags, resultReceiver); } Loading Loading @@ -2608,16 +2603,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub synchronized (mMethodMap) { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { try { // We need to check if this is the current client with // focus in the window manager, to allow this call to // be made before input is started in it. if (!mIWindowManager.inputMethodClientHasFocus(client)) { if (DEBUG) Slog.w(TAG, "Ignoring hideSoftInput of uid " + uid + ": " + client); return false; if (!mWindowManagerInternal.inputMethodClientHasFocus(client)) { if (DEBUG) { Slog.w(TAG, "Ignoring hideSoftInput of uid " + uid + ": " + client); } } catch (RemoteException e) { return false; } } Loading Loading @@ -2732,8 +2724,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub + client.asBinder()); } try { if (!mIWindowManager.inputMethodClientHasFocus(cs.client)) { if (!mWindowManagerInternal.inputMethodClientHasFocus(cs.client)) { // Check with the window manager to make sure this client actually // has a window with focus. If not, reject. This is thread safe // because if the focus changes some time before or after, the Loading @@ -2745,8 +2736,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return InputBindResult.NOT_IME_TARGET_WINDOW; } } catch (RemoteException e) { } if (!calledFromValidUser) { Slog.w(TAG, "A background user is requesting window. Hiding IME."); Loading services/core/java/com/android/server/wm/WindowManagerInternal.java +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.view.InputChannel; import android.view.MagnificationSpec; import android.view.WindowInfo; import com.android.internal.view.IInputMethodClient; import com.android.server.input.InputManagerService; import com.android.server.policy.WindowManagerPolicy; Loading Loading @@ -441,4 +442,9 @@ public abstract class WindowManagerInternal { * Returns {@code true} if a Window owned by {@code uid} has focus. */ public abstract boolean isUidFocused(int uid); /** * Returns {@code true} if a process that is identified by {@code client} has IME focus. */ public abstract boolean inputMethodClientHasFocus(IInputMethodClient client); } services/core/java/com/android/server/wm/WindowManagerService.java +24 −24 Original line number Diff line number Diff line Loading @@ -5039,30 +5039,6 @@ public class WindowManagerService extends IWindowManager.Stub return session; } @Override public boolean inputMethodClientHasFocus(IInputMethodClient client) { synchronized (mWindowMap) { // TODO: multi-display if (getDefaultDisplayContentLocked().inputMethodClientHasFocus(client)) { return true; } // Okay, how about this... what is the current focus? // It seems in some cases we may not have moved the IM // target window, such as when it was in a pop-up window, // so let's also look at the current focus. (An example: // go to Gmail, start searching so the keyboard goes up, // press home. Sometimes the IME won't go down.) // Would be nice to fix this more correctly, but it's // way at the end of a release, and this should be good enough. if (mCurrentFocus != null && mCurrentFocus.mSession.mClient != null && mCurrentFocus.mSession.mClient.asBinder() == client.asBinder()) { return true; } } return false; } @Override public void getInitialDisplaySize(int displayId, Point size) { synchronized (mWindowMap) { Loading Loading @@ -7432,6 +7408,30 @@ public class WindowManagerService extends IWindowManager.Stub return mCurrentFocus != null ? uid == mCurrentFocus.getOwningUid() : false; } } @Override public boolean inputMethodClientHasFocus(IInputMethodClient client) { synchronized (mWindowMap) { // TODO: multi-display if (getDefaultDisplayContentLocked().inputMethodClientHasFocus(client)) { return true; } // Okay, how about this... what is the current focus? // It seems in some cases we may not have moved the IM // target window, such as when it was in a pop-up window, // so let's also look at the current focus. (An example: // go to Gmail, start searching so the keyboard goes up, // press home. Sometimes the IME won't go down.) // Would be nice to fix this more correctly, but it's // way at the end of a release, and this should be good enough. if (mCurrentFocus != null && mCurrentFocus.mSession.mClient != null && mCurrentFocus.mSession.mClient.asBinder() == client.asBinder()) { return true; } } return false; } } void registerAppFreezeListener(AppFreezeListener listener) { Loading Loading
core/java/android/view/IWindowManager.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ interface IWindowManager IWindowSession openSession(in IWindowSessionCallback callback, in IInputMethodClient client, in IInputContext inputContext); boolean inputMethodClientHasFocus(IInputMethodClient client); void getInitialDisplaySize(int displayId, out Point size); void getBaseDisplaySize(int displayId, out Point size); Loading
services/core/java/com/android/server/InputMethodManagerService.java +21 −32 Original line number Diff line number Diff line Loading @@ -2523,19 +2523,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub synchronized (mMethodMap) { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { try { // We need to check if this is the current client with // focus in the window manager, to allow this call to // be made before input is started in it. if (!mIWindowManager.inputMethodClientHasFocus(client)) { if (!mWindowManagerInternal.inputMethodClientHasFocus(client)) { Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client); return false; } } catch (RemoteException e) { return false; } } if (DEBUG) Slog.v(TAG, "Client requesting input be shown"); return showCurrentInputLocked(flags, resultReceiver); } Loading Loading @@ -2608,16 +2603,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub synchronized (mMethodMap) { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { try { // We need to check if this is the current client with // focus in the window manager, to allow this call to // be made before input is started in it. if (!mIWindowManager.inputMethodClientHasFocus(client)) { if (DEBUG) Slog.w(TAG, "Ignoring hideSoftInput of uid " + uid + ": " + client); return false; if (!mWindowManagerInternal.inputMethodClientHasFocus(client)) { if (DEBUG) { Slog.w(TAG, "Ignoring hideSoftInput of uid " + uid + ": " + client); } } catch (RemoteException e) { return false; } } Loading Loading @@ -2732,8 +2724,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub + client.asBinder()); } try { if (!mIWindowManager.inputMethodClientHasFocus(cs.client)) { if (!mWindowManagerInternal.inputMethodClientHasFocus(cs.client)) { // Check with the window manager to make sure this client actually // has a window with focus. If not, reject. This is thread safe // because if the focus changes some time before or after, the Loading @@ -2745,8 +2736,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return InputBindResult.NOT_IME_TARGET_WINDOW; } } catch (RemoteException e) { } if (!calledFromValidUser) { Slog.w(TAG, "A background user is requesting window. Hiding IME."); Loading
services/core/java/com/android/server/wm/WindowManagerInternal.java +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.view.InputChannel; import android.view.MagnificationSpec; import android.view.WindowInfo; import com.android.internal.view.IInputMethodClient; import com.android.server.input.InputManagerService; import com.android.server.policy.WindowManagerPolicy; Loading Loading @@ -441,4 +442,9 @@ public abstract class WindowManagerInternal { * Returns {@code true} if a Window owned by {@code uid} has focus. */ public abstract boolean isUidFocused(int uid); /** * Returns {@code true} if a process that is identified by {@code client} has IME focus. */ public abstract boolean inputMethodClientHasFocus(IInputMethodClient client); }
services/core/java/com/android/server/wm/WindowManagerService.java +24 −24 Original line number Diff line number Diff line Loading @@ -5039,30 +5039,6 @@ public class WindowManagerService extends IWindowManager.Stub return session; } @Override public boolean inputMethodClientHasFocus(IInputMethodClient client) { synchronized (mWindowMap) { // TODO: multi-display if (getDefaultDisplayContentLocked().inputMethodClientHasFocus(client)) { return true; } // Okay, how about this... what is the current focus? // It seems in some cases we may not have moved the IM // target window, such as when it was in a pop-up window, // so let's also look at the current focus. (An example: // go to Gmail, start searching so the keyboard goes up, // press home. Sometimes the IME won't go down.) // Would be nice to fix this more correctly, but it's // way at the end of a release, and this should be good enough. if (mCurrentFocus != null && mCurrentFocus.mSession.mClient != null && mCurrentFocus.mSession.mClient.asBinder() == client.asBinder()) { return true; } } return false; } @Override public void getInitialDisplaySize(int displayId, Point size) { synchronized (mWindowMap) { Loading Loading @@ -7432,6 +7408,30 @@ public class WindowManagerService extends IWindowManager.Stub return mCurrentFocus != null ? uid == mCurrentFocus.getOwningUid() : false; } } @Override public boolean inputMethodClientHasFocus(IInputMethodClient client) { synchronized (mWindowMap) { // TODO: multi-display if (getDefaultDisplayContentLocked().inputMethodClientHasFocus(client)) { return true; } // Okay, how about this... what is the current focus? // It seems in some cases we may not have moved the IM // target window, such as when it was in a pop-up window, // so let's also look at the current focus. (An example: // go to Gmail, start searching so the keyboard goes up, // press home. Sometimes the IME won't go down.) // Would be nice to fix this more correctly, but it's // way at the end of a release, and this should be good enough. if (mCurrentFocus != null && mCurrentFocus.mSession.mClient != null && mCurrentFocus.mSession.mClient.asBinder() == client.asBinder()) { return true; } } return false; } } void registerAppFreezeListener(AppFreezeListener listener) { Loading