From add468c01205fd3ef4e0bd67d2c5662be289c0b5 Mon Sep 17 00:00:00 2001 From: TYM Tsai Date: Fri, 31 Jul 2020 14:21:20 +0800 Subject: [PATCH] Fix the save UI does not restore The new behavior of preesing the back key will move the activity task to the background, but the activity has not yet been finished. This will break some behaviors base on the onFinish() method when the back key is pressed. Make sure to restore the save UI after processing the back key event. Fixes: 162203720 Test: atest CtsAutoFillServiceTestCases Change-Id: I028056cadaa467cf1f795b0b76c88d24e0ba1955 --- core/java/android/app/Activity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 4a982dd1a4115..3821f73a6929d 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3825,6 +3825,12 @@ public class Activity extends ContextThemeWrapper } catch (RemoteException e) { finishAfterTransition(); } + + // Activity was launched when user tapped a link in the Autofill Save UI - Save UI must + // be restored now. + if (mIntent != null && mIntent.hasExtra(AutofillManager.EXTRA_RESTORE_SESSION_TOKEN)) { + restoreAutofillSaveUi(); + } } /**