Temporarily ignore RuntimeException when displaying the UI.

Change-Id: Ia01f9204736418a8f1e5027aef755d0855feab04
Fixes: 36392498
Test: manual verification by forcing an exception
This commit is contained in:
Felipe Leme
2017-03-23 15:41:21 -07:00
committed by Svetoslav Ganov
parent 2204abdca9
commit 6078588008
2 changed files with 17 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ package com.android.server.autofill.ui;
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_HIDDEN;
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_SHOWN;
import static com.android.server.autofill.ui.Helper.DEBUG;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
@@ -160,7 +162,11 @@ public final class AutoFillUI {
*/
public void showFillUi(@NonNull AutofillId focusedId, @NonNull FillResponse response,
@NonNull Rect anchorBounds, @Nullable String filterText, @NonNull String packageName) {
LogMaker log = (new LogMaker(MetricsProto.MetricsEvent.AUTOFILL_FILL_UI))
if (DEBUG) {
Slog.d(TAG, "showFillUi(): id=" + focusedId + ", bounds=" + anchorBounds + " filter="
+ filterText);
}
final LogMaker log = (new LogMaker(MetricsProto.MetricsEvent.AUTOFILL_FILL_UI))
.setPackageName(packageName)
.addTaggedData(MetricsProto.MetricsEvent.FIELD_AUTOFILL_FILTERTEXT_LEN,
filterText == null ? 0 : filterText.length())

View File

@@ -326,6 +326,16 @@ final class FillUi {
}
public void show(int desiredWidth, int desiredHeight, Rect anchorBounds) {
try {
// TODO: temporary workaround to avoud system_server crashes.
unsafelyShow(desiredWidth, desiredHeight, anchorBounds);
} catch (RuntimeException e) {
Slog.w(TAG, "Error showing Anchored window: w=" + desiredWidth + ", h="
+ desiredHeight + ", b=" + anchorBounds, e);
}
}
private void unsafelyShow(int desiredWidth, int desiredHeight, Rect anchorBounds) {
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.setTitle("FillUi");