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

Commit c054c5d4 authored by lpeter's avatar lpeter
Browse files

Notify AutofillManager that activity is finishing on onDestroy().

It will show the autofill save dialog when the activity is no longer
visible to the user and really to be finished. In current design, it
checks if activity is finishing on onStop(). When activity finishes
through CLEAR_TOP/SINGLE_TOP, it will not trigger autofill save dialog.
So moving the logic to onDestroy().

Bug: 137796463
Test: atest CtsAutoFillServiceTestCases
Test: manual verification with DebugService
Change-Id: Ic751785cfc6d436d74f2ae0f8a0f8292bf68f116
parent 2cd85a8a
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -2469,10 +2469,7 @@ public class Activity extends ContextThemeWrapper
            getAutofillManager().onInvisibleForAutofill();
        }

        if (isFinishing()) {
            if (mAutoFillResetNeeded) {
                getAutofillManager().onActivityFinishing();
            } else if (mIntent != null
        if (isFinishing() && !mAutoFillResetNeeded && mIntent != null
                && mIntent.hasExtra(AutofillManager.EXTRA_RESTORE_SESSION_TOKEN)) {
            // Activity was launched when user tapped a link in the Autofill Save UI - since
            // user launched another activity, the Save UI should not be restored when this
@@ -2480,7 +2477,6 @@ public class Activity extends ContextThemeWrapper
            getAutofillManager().onPendingSaveUi(AutofillManager.PENDING_UI_OPERATION_CANCEL,
                    mIntent.getIBinderExtra(AutofillManager.EXTRA_RESTORE_SESSION_TOKEN));
        }
        }
        mEnterAnimationComplete = false;
    }

@@ -2517,6 +2513,10 @@ public class Activity extends ContextThemeWrapper
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onDestroy " + this);
        mCalled = true;

        if (isFinishing() && mAutoFillResetNeeded) {
            getAutofillManager().onActivityFinishing();
        }

        // dismiss any dialogs we are managing.
        if (mManagedDialogs != null) {
            final int numDialogs = mManagedDialogs.size();