summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-02-25 23:16:16 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-25 23:16:16 +0000
commita6cc562629960a5be9ddbb561baabbc4424df2cc (patch)
tree17c1b085a29817233f197bdac41ac7d68ec4f082
parent8e3967e1d59bd665e937b76d4cdea1c3765b0241 (diff)
parentcb9c96ae96af6b5c74ad1b1bf89844015d5be665 (diff)
Merge "Fix fillwindow destory() throwing IllegalStateException if update is never called."
-rw-r--r--core/java/android/service/autofill/augmented/FillWindow.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/service/autofill/augmented/FillWindow.java b/core/java/android/service/autofill/augmented/FillWindow.java
index 6e06754e7b8a..bd532a32035c 100644
--- a/core/java/android/service/autofill/augmented/FillWindow.java
+++ b/core/java/android/service/autofill/augmented/FillWindow.java
@@ -82,6 +82,8 @@ public final class FillWindow implements AutoCloseable {
private Rect mBounds;
@GuardedBy("mLock")
+ private boolean mUpdateCalled;
+ @GuardedBy("mLock")
private boolean mDestroyed;
private AutofillProxy mProxy;
@@ -103,6 +105,7 @@ public final class FillWindow implements AutoCloseable {
}
// TODO(b/123100712): add test case for null
Preconditions.checkNotNull(area);
+ Preconditions.checkNotNull(area.proxy);
Preconditions.checkNotNull(rootView);
// TODO(b/123100712): must check the area is a valid object returned by
// SmartSuggestionParams, throw IAE if not
@@ -149,6 +152,7 @@ public final class FillWindow implements AutoCloseable {
if (DEBUG) {
Log.d(TAG, "Created FillWindow: params= " + smartSuggestion + " view=" + rootView);
}
+ mUpdateCalled = true;
mDestroyed = false;
mProxy.setFillWindow(this);
return true;
@@ -237,8 +241,10 @@ public final class FillWindow implements AutoCloseable {
}
synchronized (mLock) {
if (mDestroyed) return;
- hide();
- mProxy.report(AutofillProxy.REPORT_EVENT_UI_DESTROYED);
+ if (mUpdateCalled) {
+ hide();
+ mProxy.report(AutofillProxy.REPORT_EVENT_UI_DESTROYED);
+ }
mDestroyed = true;
mCloseGuard.close();
}
@@ -266,6 +272,7 @@ public final class FillWindow implements AutoCloseable {
public void dump(@NonNull String prefix, @NonNull PrintWriter pw) {
synchronized (this) {
pw.print(prefix); pw.print("destroyed: "); pw.println(mDestroyed);
+ pw.print(prefix); pw.print("updateCalled: "); pw.println(mUpdateCalled);
if (mFillView != null) {
pw.print(prefix); pw.print("fill window: ");
pw.println(mShowing ? "shown" : "hidden");