summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-06-18 16:36:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-18 16:36:10 +0000
commitc5c35fc376e604a1f12f7d5aff3fef363bfe8a7b (patch)
tree12df088f78bfd0a71554994209509939b1af2797 /core/java
parent2ad10d0dde69fa799d7d89931a1c6215baca3788 (diff)
parentd0bd08b4b91d290bbebc760802b28a11c17fcd36 (diff)
Merge "Add try-catch for the augmented autofill UI to avoid crashing" into rvc-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/service/autofill/augmented/FillWindow.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/core/java/android/service/autofill/augmented/FillWindow.java b/core/java/android/service/autofill/augmented/FillWindow.java
index 077df6cf16ef..8e866466e8df 100644
--- a/core/java/android/service/autofill/augmented/FillWindow.java
+++ b/core/java/android/service/autofill/augmented/FillWindow.java
@@ -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.");
+ }
}
}
}