Merge "Add try-catch for the augmented autofill UI to avoid crashing" into rvc-dev am: c5c35fc376 am: 19ccb788ca am: 57d3e7d12f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11863064

Change-Id: I935f83d69248aa79c1e2287a6df6aff4ccbd23c8
This commit is contained in:
TreeHugger Robot
2020-06-18 17:04:34 +00:00
committed by Automerger Merge Worker

View File

@@ -208,12 +208,18 @@ public final class FillWindow implements AutoCloseable {
if (sDebug) Log.d(TAG, "handleShow()");
synchronized (mLock) {
if (mWm != null && mFillView != null) {
p.flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
if (!mShowing) {
mWm.addView(mFillView, p);
mShowing = true;
} else {
mWm.updateViewLayout(mFillView, p);
try {
p.flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
if (!mShowing) {
mWm.addView(mFillView, p);
mShowing = true;
} else {
mWm.updateViewLayout(mFillView, p);
}
} catch (WindowManager.BadTokenException e) {
if (sDebug) Log.d(TAG, "Filed with token " + p.token + " gone.");
} catch (IllegalStateException e) {
if (sDebug) Log.d(TAG, "Exception showing window.");
}
}
}
@@ -223,8 +229,12 @@ public final class FillWindow implements AutoCloseable {
if (sDebug) Log.d(TAG, "handleHide()");
synchronized (mLock) {
if (mWm != null && mFillView != null && mShowing) {
mWm.removeView(mFillView);
mShowing = false;
try {
mWm.removeView(mFillView);
mShowing = false;
} catch (IllegalStateException e) {
if (sDebug) Log.d(TAG, "Exception hiding window.");
}
}
}
}