Merge "Make IInputMethodPrivilegedOperations to async (5/N)" into sc-dev

This commit is contained in:
Yohei Yukawa
2021-04-29 00:45:17 +00:00
committed by Android (Google) Code Review
4 changed files with 7 additions and 9 deletions

View File

@@ -3319,7 +3319,7 @@ public class InputMethodService extends AbstractInputMethodService {
if (mNotifyUserActionSent) {
return;
}
mPrivOps.notifyUserAction();
mPrivOps.notifyUserActionAsync();
mNotifyUserActionSent = true;
}
}

View File

@@ -43,7 +43,7 @@ oneway interface IInputMethodPrivilegedOperations {
void switchToPreviousInputMethod(in IBooleanResultCallback resultCallback);
void switchToNextInputMethod(boolean onlyCurrentIme, in IBooleanResultCallback resultCallback);
void shouldOfferSwitchingToNextInputMethod(in IBooleanResultCallback resultCallback);
void notifyUserAction(in IVoidResultCallback resultCallback);
void notifyUserActionAsync();
void applyImeVisibility(IBinder showOrHideInputToken, boolean setVisible,
in IVoidResultCallback resultCallback);
}

View File

@@ -359,18 +359,16 @@ public final class InputMethodPrivilegedOperations {
}
/**
* Calls {@link IInputMethodPrivilegedOperations#notifyUserAction(IVoidResultCallback)}
* Calls {@link IInputMethodPrivilegedOperations#notifyUserActionAsync()}
*/
@AnyThread
public void notifyUserAction() {
public void notifyUserActionAsync() {
final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull();
if (ops == null) {
return;
}
try {
final Completable.Void value = Completable.createVoid();
ops.notifyUserAction(ResultCallbacks.of(value));
Completable.getResult(value);
ops.notifyUserActionAsync();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -6117,8 +6117,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
@BinderThread
@Override
public void notifyUserAction(IVoidResultCallback resultCallback) {
CallbackUtils.onResult(resultCallback, () -> mImms.notifyUserAction(mToken));
public void notifyUserActionAsync() {
mImms.notifyUserAction(mToken);
}
@BinderThread