Loading core/java/android/view/inputmethod/InputMethodManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -2841,7 +2841,7 @@ public final class InputMethodManager { @UnsupportedAppUsage public int getInputMethodWindowVisibleHeight() { try { return mService.getInputMethodWindowVisibleHeight(); return mService.getInputMethodWindowVisibleHeight(mClient); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading core/java/com/android/internal/view/IInputMethodManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ interface IInputMethodManager { void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); // This is kept due to @UnsupportedAppUsage. // TODO(Bug 113914148): Consider removing this. int getInputMethodWindowVisibleHeight(); int getInputMethodWindowVisibleHeight(in IInputMethodClient client); void reportActivityView(in IInputMethodClient parentClient, int childDisplayId, in float[] matrixValues); Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +52 −17 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.view.ContextThemeWrapper; import android.view.DisplayInfo; import android.view.IWindowManager; Loading Loading @@ -303,6 +304,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final InputMethodSettings mSettings; final SettingsObserver mSettingsObserver; final IWindowManager mIWindowManager; private final SparseBooleanArray mLoggedDeniedGetInputMethodWindowVisibleHeightForUid = new SparseBooleanArray(0); final WindowManagerInternal mWindowManagerInternal; private final DisplayManagerInternal mDisplayManagerInternal; final HandlerCaller mCaller; Loading Loading @@ -1219,6 +1222,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub clearPackageChangeState(); } @Override public void onUidRemoved(int uid) { synchronized (mMethodMap) { mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.delete(uid); } } private void clearPackageChangeState() { // No need to lock them because we access these fields only on getRegisteredHandler(). mChangedPackages.clear(); Loading Loading @@ -2754,21 +2764,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } final long ident = Binder.clearCallingIdentity(); try { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { // 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. final ClientState cs = mClients.get(client.asBinder()); if (cs == null) { throw new IllegalArgumentException("unknown client " + client.asBinder()); } if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid, cs.selfReportedDisplayId)) { Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client); if (!canInteractWithImeLocked(uid, client, "showSoftInput")) { return false; } } if (DEBUG) Slog.v(TAG, "Client requesting input be shown"); return showCurrentInputLocked(flags, resultReceiver); } finally { Loading Loading @@ -3462,9 +3460,46 @@ public class InputMethodManagerService extends IInputMethodManager.Stub * @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight()} */ @Override public int getInputMethodWindowVisibleHeight() { // TODO(yukawa): Should we verify the display ID? return mWindowManagerInternal.getInputMethodWindowVisibleHeight(mCurTokenDisplayId); @Deprecated public int getInputMethodWindowVisibleHeight(@NonNull IInputMethodClient client) { int callingUid = Binder.getCallingUid(); return Binder.withCleanCallingIdentity(() -> { final int curTokenDisplayId; synchronized (mMethodMap) { if (!canInteractWithImeLocked(callingUid, client, "getInputMethodWindowVisibleHeight")) { if (!mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.get(callingUid)) { EventLog.writeEvent(0x534e4554, "204906124", callingUid, ""); mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.put(callingUid, true); } return 0; } // This should probably use the caller's display id, but because this is unsupported // and maintained only for compatibility, there's no point in fixing it. curTokenDisplayId = mCurTokenDisplayId; } return mWindowManagerInternal.getInputMethodWindowVisibleHeight(curTokenDisplayId); }); } private boolean canInteractWithImeLocked(int callingUid, IInputMethodClient client, String method) { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { // 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. final ClientState cs = mClients.get(client.asBinder()); if (cs == null) { throw new IllegalArgumentException("unknown client " + client.asBinder()); } if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid, cs.selfReportedDisplayId)) { Slog.w(TAG, "Ignoring " + method + " of uid " + callingUid + ": " + client); return false; } } return true; } @Override Loading services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1694,7 +1694,7 @@ public final class MultiClientInputMethodManagerService { @BinderThread @Override public int getInputMethodWindowVisibleHeight() { public int getInputMethodWindowVisibleHeight(IInputMethodClient client) { reportNotSupported(); return 0; } Loading Loading
core/java/android/view/inputmethod/InputMethodManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -2841,7 +2841,7 @@ public final class InputMethodManager { @UnsupportedAppUsage public int getInputMethodWindowVisibleHeight() { try { return mService.getInputMethodWindowVisibleHeight(); return mService.getInputMethodWindowVisibleHeight(mClient); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
core/java/com/android/internal/view/IInputMethodManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ interface IInputMethodManager { void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); // This is kept due to @UnsupportedAppUsage. // TODO(Bug 113914148): Consider removing this. int getInputMethodWindowVisibleHeight(); int getInputMethodWindowVisibleHeight(in IInputMethodClient client); void reportActivityView(in IInputMethodClient parentClient, int childDisplayId, in float[] matrixValues); Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +52 −17 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.view.ContextThemeWrapper; import android.view.DisplayInfo; import android.view.IWindowManager; Loading Loading @@ -303,6 +304,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final InputMethodSettings mSettings; final SettingsObserver mSettingsObserver; final IWindowManager mIWindowManager; private final SparseBooleanArray mLoggedDeniedGetInputMethodWindowVisibleHeightForUid = new SparseBooleanArray(0); final WindowManagerInternal mWindowManagerInternal; private final DisplayManagerInternal mDisplayManagerInternal; final HandlerCaller mCaller; Loading Loading @@ -1219,6 +1222,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub clearPackageChangeState(); } @Override public void onUidRemoved(int uid) { synchronized (mMethodMap) { mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.delete(uid); } } private void clearPackageChangeState() { // No need to lock them because we access these fields only on getRegisteredHandler(). mChangedPackages.clear(); Loading Loading @@ -2754,21 +2764,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } final long ident = Binder.clearCallingIdentity(); try { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { // 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. final ClientState cs = mClients.get(client.asBinder()); if (cs == null) { throw new IllegalArgumentException("unknown client " + client.asBinder()); } if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid, cs.selfReportedDisplayId)) { Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client); if (!canInteractWithImeLocked(uid, client, "showSoftInput")) { return false; } } if (DEBUG) Slog.v(TAG, "Client requesting input be shown"); return showCurrentInputLocked(flags, resultReceiver); } finally { Loading Loading @@ -3462,9 +3460,46 @@ public class InputMethodManagerService extends IInputMethodManager.Stub * @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight()} */ @Override public int getInputMethodWindowVisibleHeight() { // TODO(yukawa): Should we verify the display ID? return mWindowManagerInternal.getInputMethodWindowVisibleHeight(mCurTokenDisplayId); @Deprecated public int getInputMethodWindowVisibleHeight(@NonNull IInputMethodClient client) { int callingUid = Binder.getCallingUid(); return Binder.withCleanCallingIdentity(() -> { final int curTokenDisplayId; synchronized (mMethodMap) { if (!canInteractWithImeLocked(callingUid, client, "getInputMethodWindowVisibleHeight")) { if (!mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.get(callingUid)) { EventLog.writeEvent(0x534e4554, "204906124", callingUid, ""); mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.put(callingUid, true); } return 0; } // This should probably use the caller's display id, but because this is unsupported // and maintained only for compatibility, there's no point in fixing it. curTokenDisplayId = mCurTokenDisplayId; } return mWindowManagerInternal.getInputMethodWindowVisibleHeight(curTokenDisplayId); }); } private boolean canInteractWithImeLocked(int callingUid, IInputMethodClient client, String method) { if (mCurClient == null || client == null || mCurClient.client.asBinder() != client.asBinder()) { // 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. final ClientState cs = mClients.get(client.asBinder()); if (cs == null) { throw new IllegalArgumentException("unknown client " + client.asBinder()); } if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid, cs.selfReportedDisplayId)) { Slog.w(TAG, "Ignoring " + method + " of uid " + callingUid + ": " + client); return false; } } return true; } @Override Loading
services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1694,7 +1694,7 @@ public final class MultiClientInputMethodManagerService { @BinderThread @Override public int getInputMethodWindowVisibleHeight() { public int getInputMethodWindowVisibleHeight(IInputMethodClient client) { reportNotSupported(); return 0; } Loading