Merge "Make IInputMethodManager#reportActivityViewAsync() truly async" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-01 07:51:21 +00:00
committed by Android (Google) Code Review
4 changed files with 16 additions and 13 deletions

View File

@@ -3106,10 +3106,7 @@ public final class InputMethodManager {
matrixValues = new float[9];
matrix.getValues(matrixValues);
}
final Completable.Void value = Completable.createVoid();
mService.reportActivityView(
mClient, childDisplayId, matrixValues, ResultCallbacks.of(value));
Completable.getResult(value);
mService.reportActivityViewAsync(mClient, childDisplayId, matrixValues);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -88,8 +88,8 @@ interface IInputMethodManager {
// TODO(Bug 113914148): Consider removing this.
oneway void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback);
oneway void reportActivityView(in IInputMethodClient parentClient, int childDisplayId,
in float[] matrixValues, in IVoidResultCallback resultCallback);
oneway void reportActivityViewAsync(in IInputMethodClient parentClient, int childDisplayId,
in float[] matrixValues);
oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible);
/** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */

View File

@@ -4046,9 +4046,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
@Override
public void reportActivityView(IInputMethodClient parentClient, int childDisplayId,
float[] matrixValues, IVoidResultCallback resultCallback) {
CallbackUtils.onResult(resultCallback, () -> {
public void reportActivityViewAsync(IInputMethodClient parentClient, int childDisplayId,
float[] matrixValues) {
try {
final DisplayInfo displayInfo = mDisplayManagerInternal.getDisplayInfo(childDisplayId);
if (displayInfo == null) {
throw new IllegalArgumentException(
@@ -4127,7 +4127,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
displayId = info.mParentClient.selfReportedDisplayId;
}
}
});
} catch (Throwable t) {
if (parentClient != null) {
try {
parentClient.throwExceptionFromSystem(t.toString());
} catch (RemoteException e) {
}
}
}
}
@Override

View File

@@ -1864,10 +1864,9 @@ public final class MultiClientInputMethodManagerService {
@BinderThread
@Override
public void reportActivityView(IInputMethodClient parentClient, int childDisplayId,
float[] matrixValues, IVoidResultCallback resultCallback) {
public void reportActivityViewAsync(IInputMethodClient parentClient, int childDisplayId,
float[] matrixValues) {
reportNotSupported();
CallbackUtils.onResult(resultCallback, () -> { });
}
@BinderThread