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

Commit a6cc5626 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix fillwindow destory() throwing IllegalStateException if update is never called."

parents 8e3967e1 cb9c96ae
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ public final class FillWindow implements AutoCloseable {
    @GuardedBy("mLock")
    private Rect mBounds;

    @GuardedBy("mLock")
    private boolean mUpdateCalled;
    @GuardedBy("mLock")
    private boolean mDestroyed;

@@ -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;
            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");