Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e702c9d3 authored by Wilson Wu's avatar Wilson Wu
Browse files

Make IInputMethodPrivilegedOperations to async (5/N)

-. Remove VoidResultCallback of notifyUserAction.
   and let it be truly asynchronous.
-. Rename this method to notifyUserActionAsync.

Bug: 183587528
Test: atest CtsInputMethodTestCases
Change-Id: I384fd689b6bd1d418ff5208444fbba2c1eac6f85
parent f98e690f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3313,7 +3313,7 @@ public class InputMethodService extends AbstractInputMethodService {
            if (mNotifyUserActionSent) {
                return;
            }
            mPrivOps.notifyUserAction();
            mPrivOps.notifyUserActionAsync();
            mNotifyUserActionSent = true;
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -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);
}
+3 −5
Original line number Diff line number Diff line
@@ -365,18 +365,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();
        }
+2 −2
Original line number Diff line number Diff line
@@ -6069,8 +6069,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