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

Commit ae93a011 authored by Adam He's avatar Adam He
Browse files

Permanently and immediately binds the augmented autofill service.

Fixes: 124456706
Test: manual verification
Change-Id: I01a2035f405b9ed659412828de9ff08937bc673d
parent 1671308c
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -84,6 +84,18 @@ public abstract class AugmentedAutofillService extends Service {

    private final IAugmentedAutofillService mInterface = new IAugmentedAutofillService.Stub() {

        @Override
        public void onConnected() {
            mHandler.sendMessage(obtainMessage(AugmentedAutofillService::handleOnConnected,
                    AugmentedAutofillService.this));
        }

        @Override
        public void onDisconnected() {
            mHandler.sendMessage(obtainMessage(AugmentedAutofillService::handleOnDisconnected,
                    AugmentedAutofillService.this));
        }

        @Override
        public void onFillRequest(int sessionId, IBinder client, int taskId,
                ComponentName componentName, AutofillId focusedId, AutofillValue focusedValue,
@@ -174,6 +186,14 @@ public abstract class AugmentedAutofillService extends Service {
    public void onDisconnected() {
    }

    private void handleOnConnected() {
        onConnected();
    }

    private void handleOnDisconnected() {
        onDisconnected();
    }

    private void handleOnFillRequest(int sessionId, @NonNull IBinder client, int taskId,
            @NonNull ComponentName componentName, @NonNull AutofillId focusedId,
            @Nullable AutofillValue focusedValue, long requestTime,
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ import java.util.List;
 * @hide
 */
oneway interface IAugmentedAutofillService {

    void onConnected();
    void onDisconnected();
    void onFillRequest(int sessionId, in IBinder autofillManagerClient, int taskId,
                       in ComponentName activityComponent, in AutofillId focusedId,
                       in AutofillValue focusedValue, long requestTime, in IFillCallback callback);
+1 −0
Original line number Diff line number Diff line
@@ -1071,6 +1071,7 @@ final class AutofillManagerServiceImpl
                mRemoteAugmentedAutofillService.destroy();
                mRemoteAugmentedAutofillService = null;
            }
            mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
        }
    }

+19 −0
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ final class RemoteAugmentedAutofillService
            boolean bindInstantServiceAllowed, boolean verbose) {
        super(context, AugmentedAutofillService.SERVICE_INTERFACE, serviceName, userId, callbacks,
                bindInstantServiceAllowed, verbose);

        // Bind right away.
        scheduleBind();
    }

    @Nullable
@@ -81,6 +84,22 @@ final class RemoteAugmentedAutofillService
        return serviceComponent;
    }

    @Override // from RemoteService
    protected void handleOnConnectedStateChanged(boolean state) {
        if (state && getTimeoutIdleBindMillis() != PERMANENT_BOUND_TIMEOUT_MS) {
            scheduleUnbind();
        }
        try {
            if (state) {
                mService.onConnected();
            } else {
                mService.onDisconnected();
            }
        } catch (Exception e) {
            Slog.w(mTag, "Exception calling onConnectedStateChanged(" + state + "): " + e);
        }
    }

    @Override // from AbstractRemoteService
    protected IAugmentedAutofillService getServiceInterface(IBinder service) {
        return IAugmentedAutofillService.Stub.asInterface(service);