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

Commit fdd354d5 authored by TYM Tsai's avatar TYM Tsai
Browse files

Protected the pointer for multiple threads

Keeps the mCurrentViewId to prevent it is cleared on multiple threads.

Bug: 146219127
Test: atest CtsAutoFillServiceTestCases
Change-Id: I679fde773fbe8c1c3a647383aa137de972f32243
parent b8bf014c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -336,7 +336,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                        + "mForAugmentedAutofillOnly: %s", mForAugmentedAutofillOnly);
                return;
            }
            if (mCurrentViewId == null) {
            // Keeps to prevent it is cleared on multiple threads.
            final AutofillId currentViewId = mCurrentViewId;
            if (currentViewId == null) {
                Slog.w(TAG, "No current view id - session might have finished");
                return;
            }
@@ -410,7 +412,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                if (mContexts == null) {
                    mContexts = new ArrayList<>(1);
                }
                mContexts.add(new FillContext(requestId, structure, mCurrentViewId));
                mContexts.add(new FillContext(requestId, structure, currentViewId));

                cancelCurrentRequestLocked();