Loading core/java/android/view/inputmethod/InputMethodManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -3251,10 +3251,11 @@ public final class InputMethodManager { * @return Something that is not well-defined. * @hide */ @UnsupportedAppUsage @UnsupportedAppUsage(trackingBug = 204906124, maxTargetSdk = Build.VERSION_CODES.TIRAMISU, publicAlternatives = "Use {@link android.view.WindowInsets} instead") 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); oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible); /** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */ Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +30 −7 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.proto.ProtoOutputStream; import android.view.IWindowManager; import android.view.InputChannel; Loading Loading @@ -274,6 +275,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final InputMethodSettings mSettings; final SettingsObserver mSettingsObserver; final IWindowManager mIWindowManager; private final SparseBooleanArray mLoggedDeniedGetInputMethodWindowVisibleHeightForUid = new SparseBooleanArray(0); final WindowManagerInternal mWindowManagerInternal; final PackageManagerInternal mPackageManagerInternal; final InputManagerInternal mInputManagerInternal; Loading Loading @@ -1378,6 +1381,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub clearPackageChangeState(); } @Override public void onUidRemoved(int uid) { synchronized (ImfLock.class) { mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.delete(uid); } } private void clearPackageChangeState() { // No need to lock them because we access these fields only on getRegisteredHandler(). mChangedPackages.clear(); Loading Loading @@ -4150,13 +4160,26 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub * @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight(int)} */ @Override public int getInputMethodWindowVisibleHeight() { // TODO(yukawa): Should we verify the display ID? @Deprecated public int getInputMethodWindowVisibleHeight(@NonNull IInputMethodClient client) { int callingUid = Binder.getCallingUid(); return Binder.withCleanCallingIdentity(() -> { final int curTokenDisplayId; synchronized (ImfLock.class) { 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); }); } @Override Loading Loading
core/java/android/view/inputmethod/InputMethodManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -3251,10 +3251,11 @@ public final class InputMethodManager { * @return Something that is not well-defined. * @hide */ @UnsupportedAppUsage @UnsupportedAppUsage(trackingBug = 204906124, maxTargetSdk = Build.VERSION_CODES.TIRAMISU, publicAlternatives = "Use {@link android.view.WindowInsets} instead") 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); oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible); /** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */ Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +30 −7 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.proto.ProtoOutputStream; import android.view.IWindowManager; import android.view.InputChannel; Loading Loading @@ -274,6 +275,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final InputMethodSettings mSettings; final SettingsObserver mSettingsObserver; final IWindowManager mIWindowManager; private final SparseBooleanArray mLoggedDeniedGetInputMethodWindowVisibleHeightForUid = new SparseBooleanArray(0); final WindowManagerInternal mWindowManagerInternal; final PackageManagerInternal mPackageManagerInternal; final InputManagerInternal mInputManagerInternal; Loading Loading @@ -1378,6 +1381,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub clearPackageChangeState(); } @Override public void onUidRemoved(int uid) { synchronized (ImfLock.class) { mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.delete(uid); } } private void clearPackageChangeState() { // No need to lock them because we access these fields only on getRegisteredHandler(). mChangedPackages.clear(); Loading Loading @@ -4150,13 +4160,26 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub * @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight(int)} */ @Override public int getInputMethodWindowVisibleHeight() { // TODO(yukawa): Should we verify the display ID? @Deprecated public int getInputMethodWindowVisibleHeight(@NonNull IInputMethodClient client) { int callingUid = Binder.getCallingUid(); return Binder.withCleanCallingIdentity(() -> { final int curTokenDisplayId; synchronized (ImfLock.class) { 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); }); } @Override Loading