diff options
| author | 2019-09-11 18:14:56 +0800 | |
|---|---|---|
| committer | 2019-09-11 18:14:56 +0800 | |
| commit | c054c5d4a0bc3ae45830ddfbb3d0af8a453a0f5b (patch) | |
| tree | 74b0b1294dd9a9ba9813827557cbbdd0f9e9e0db | |
| parent | 2cd85a8ae055a79e7557deb06e776b4acb628b53 (diff) | |
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
| -rw-r--r-- | core/java/android/app/Activity.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 287a289a7293..1761c4b04abf 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2469,17 +2469,13 @@ public class Activity extends ContextThemeWrapper getAutofillManager().onInvisibleForAutofill(); } - if (isFinishing()) { - if (mAutoFillResetNeeded) { - getAutofillManager().onActivityFinishing(); - } else if (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 - // activity is finished. - getAutofillManager().onPendingSaveUi(AutofillManager.PENDING_UI_OPERATION_CANCEL, - mIntent.getIBinderExtra(AutofillManager.EXTRA_RESTORE_SESSION_TOKEN)); - } + 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 + // activity is finished. + 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(); |