summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-11-21 23:57:15 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-11-21 23:57:15 +0000
commit14c651bb7bd43796d05cdc7deebeca21159e82e9 (patch)
treefe371bae3a7c030e8791ded9f2f11b63109e9490
parentb08ce064b7c03032b368fd91a50909bb1f24b8f2 (diff)
parente579033d768234f9951527ff5be6e7adc29ed1bb (diff)
Merge "Notify AutofillManager in onResume() IFF activity was not recreated."
-rw-r--r--core/java/android/app/Activity.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 553acc8dcbd3..83fab7e5a45d 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -1432,7 +1432,15 @@ public class Activity extends ContextThemeWrapper
if (mAutoFillResetNeeded) {
if (!mAutoFillIgnoreFirstResumePause) {
View focus = getCurrentFocus();
- if (focus != null && focus.canNotifyAutofillEnterExitEvent()) {
+ // On Activity rotation situation (mRestoredFromBundle is true),
+ // we should not call on AutofillManager in onResume()
+ // since the next Layout pass will do that.
+ // However, there are both cases where Activity#getCurrentFocus()
+ // will return null (window not preserved) and not null (window IS
+ // preserved), so we need to explicitly check for mRestoredFromBundle
+ // here.
+ if (!mRestoredFromBundle && focus != null
+ && focus.canNotifyAutofillEnterExitEvent()) {
// TODO: in Activity killed/recreated case, i.e. SessionLifecycleTest#
// testDatasetVisibleWhileAutofilledAppIsLifecycled: the View's initial
// window visibility after recreation is INVISIBLE in onResume() and next frame