From 87cc2e19e56e8e8a61cc7bd4ae7e6e8fcdede112 Mon Sep 17 00:00:00 2001 From: Syaoran Kuo Date: Fri, 7 May 2021 18:49:26 +0800 Subject: [PATCH] Add more log for debugging resource id issue. Bug: 187485845 Test: atest SettingsComponentTests Change-Id: I6268809eca172b0b4aa9f1a252e0d519ad758083 --- tests/componenttests/Android.bp | 4 +++- .../notification/AppNotificationComponentTest.java | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/componenttests/Android.bp b/tests/componenttests/Android.bp index 44158c72fc4..7d9c4b26c5f 100644 --- a/tests/componenttests/Android.bp +++ b/tests/componenttests/Android.bp @@ -27,6 +27,8 @@ android_test { ], test_suites: ["device-tests"], - + optimize: { + enabled: false, + }, instrumentation_for: "Settings", } diff --git a/tests/componenttests/src/com/android/settings/notification/AppNotificationComponentTest.java b/tests/componenttests/src/com/android/settings/notification/AppNotificationComponentTest.java index e08a8acfc6b..06075585b06 100644 --- a/tests/componenttests/src/com/android/settings/notification/AppNotificationComponentTest.java +++ b/tests/componenttests/src/com/android/settings/notification/AppNotificationComponentTest.java @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Instrumentation; import android.content.Intent; import android.provider.Settings; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; @@ -63,6 +64,14 @@ public class AppNotificationComponentTest { activity -> { View rv = activity.findViewById(R.id.recycler_view); + if (rv == null) { + Log.d("UI_UTILS", + "Target not found: R.id.recycler_view #" + Integer.toHexString( + R.id.recycler_view)); + UiUtils.dumpView(UiUtils.getFirstViewFromActivity(activity)); + assertThat(Boolean.TRUE).isFalse(); + } + UiUtils.waitUntilCondition(5000, () -> rv.findViewById(R.id.main_switch_bar) != null);