Make removeImeSurfaceFromWindow to one-way
We introduced IVoidResultCallback mechanism to removeImeSurfaceFromWindow in CL[1] to simulate two-way behavior before it become truly one-way. InputMethodManagerService#removeImeSurfaceFromWindow() simply post the task into its message queue hence we should able to safely convert this method into one-way. -. Remove IVoidResultCallback for this method -. Rename it to removeImeSurfaceFromWindowAsync [1]: Icb396ae5d74060af69c4ecb16723b2e37b9f2067 Bug: 179668859 Bug: 185277968 Test: Manual test with b/179668859 steps, and works fine Test: atest CtsInputMethodTestCases Change-Id: Id28698e263a23ec4a6e4f89438eba5d19bbbabbb
This commit is contained in:
@@ -2230,9 +2230,7 @@ public final class InputMethodManager {
|
||||
public void removeImeSurface(IBinder windowToken) {
|
||||
synchronized (mH) {
|
||||
try {
|
||||
final Completable.Void value = Completable.createVoid();
|
||||
mService.removeImeSurfaceFromWindow(windowToken, ResultCallbacks.of(value));
|
||||
Completable.getResult(value);
|
||||
mService.removeImeSurfaceFromWindowAsync(windowToken);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -89,8 +89,7 @@ interface IInputMethodManager {
|
||||
/** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */
|
||||
oneway void removeImeSurface(in IVoidResultCallback resultCallback);
|
||||
/** Remove the IME surface. Requires passing the currently focused window. */
|
||||
oneway void removeImeSurfaceFromWindow(in IBinder windowToken,
|
||||
in IVoidResultCallback resultCallback);
|
||||
oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken);
|
||||
oneway void startProtoDump(in byte[] protoDump, int source, String where,
|
||||
in IVoidResultCallback resultCallback);
|
||||
oneway void isImeTraceEnabled(in IBooleanResultCallback resultCallback);
|
||||
|
||||
@@ -4100,13 +4100,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeImeSurfaceFromWindow(IBinder windowToken,
|
||||
IVoidResultCallback resultCallback) {
|
||||
CallbackUtils.onResult(resultCallback, () -> {
|
||||
// No permission check, because we'll only execute the request if the calling window is
|
||||
// also the current IME client.
|
||||
mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE_FROM_WINDOW, windowToken).sendToTarget();
|
||||
});
|
||||
public void removeImeSurfaceFromWindowAsync(IBinder windowToken) {
|
||||
// No permission check, because we'll only execute the request if the calling window is
|
||||
// also the current IME client.
|
||||
mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE_FROM_WINDOW, windowToken).sendToTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1510,10 +1510,8 @@ public final class MultiClientInputMethodManagerService {
|
||||
|
||||
@BinderThread
|
||||
@Override
|
||||
public void removeImeSurfaceFromWindow(IBinder windowToken,
|
||||
IVoidResultCallback resultCallback) {
|
||||
public void removeImeSurfaceFromWindowAsync(IBinder windowToken) {
|
||||
reportNotSupported();
|
||||
CallbackUtils.onResult(resultCallback, () -> { });
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
|
||||
Reference in New Issue
Block a user