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

Commit 16539f33 authored by Felipe Leme's avatar Felipe Leme
Browse files

Two fixes on autofill save.

1.Fixed race condition on save request - if the service was unbound, it would
  mark the RemoteFillService as completed and the retry would be dropped.
2.Removed session when save request is canceled.

Change-Id: Ib71514cdcfecc38c07dd7656174d0db68ed758d1
Fixes: 36001206
Test: CtsAutoFillServiceTestCases pass
parent 18f805e7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -728,6 +728,14 @@ final class AutoFillManagerServiceImpl {
                    .sendToTarget();
        }

        // AutoFillUiCallback
        @Override
        public void cancelSave() {
            mHandlerCaller.getHandler().post(() -> {
                removeSelf();
            });
        }

        // AutoFillUiCallback
        @Override
        public void onEvent(AutoFillId id, int event) {
+4 −4
Original line number Diff line number Diff line
@@ -182,11 +182,8 @@ final class RemoteFillService implements DeathRecipient {
        if (mDestroyed || mCompleted) {
            return;
        }
        if (pendingRequest.isFinal()) {
            mCompleted = true;
        }
        if (!isBound()) {
            if (mPendingRequest != null) {
            if (mPendingRequest != null && mPendingRequest != pendingRequest) {
                mPendingRequest.cancel();
            }
            mPendingRequest = pendingRequest;
@@ -196,6 +193,9 @@ final class RemoteFillService implements DeathRecipient {
                Slog.d(LOG_TAG, "[user: " + mUserId + "] handlePendingRequest()");
            }
            pendingRequest.run();
            if (pendingRequest.isFinal()) {
                mCompleted = true;
            }
        }
    }

+4 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public final class AutoFillUI {
        void authenticate(@NonNull IntentSender intent);
        void fill(@NonNull Dataset dataset);
        void save();
        void cancelSave();
        void onEvent(AutoFillId id, int event);
    }

@@ -220,6 +221,9 @@ public final class AutoFillUI {
                                    + listener, e);
                        }
                    }
                    if (mCallback != null) {
                        mCallback.cancelSave();
                    }
                }
            }, mSaveTimeoutMs);
        });