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

Commit 9868947b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Permanently and immediately binds the augmented autofill service."

parents 91240cec ae93a011
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
@@ -1179,6 +1179,7 @@ final class AutofillManagerServiceImpl
                if (mMaster.verbose) Slog.v(TAG, "whitelisting augmented packages: " + packages);
                mWhitelistedAugmentAutofillPackages.addAll(packages);
            }
            mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
        }
    }

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

        // Bind right away.
        scheduleBind();
    }

    @Nullable
@@ -82,6 +85,22 @@ final class RemoteAugmentedAutofillService
        return new Pair<>(serviceInfo, 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);