summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-07 07:41:25 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-07 07:41:25 -0800
commit623db3ceac6463866d0b88e84c9381c00c4108f7 (patch)
tree2ffdab22aaea125564e78b1783966af1270b98b3
parent91a4647e4f1048c00e93e9b3a0c85de5d81ec107 (diff)
parent0e7d837c98e18c03dc537fa41198d603d9461855 (diff)
Merge changes I97552d0a,Ic77e586f into main
* changes: Fail any SysuiTestCase that leaks a Log.wtf Prevent more unexpected Log.wtf calls
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationCustomContentMemoryVerifierTest.java7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java3
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java3
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/log/LogAssert.kt17
8 files changed, 18 insertions, 26 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
index f54c28f4295b..72b003f9f463 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
@@ -82,7 +82,6 @@ import com.android.systemui.flags.DisableSceneContainer;
import com.android.systemui.flags.EnableSceneContainer;
import com.android.systemui.flags.FakeFeatureFlagsClassic;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
-import com.android.systemui.log.LogWtfHandlerRule;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.recents.LauncherProxyService;
import com.android.systemui.settings.UserTracker;
@@ -108,7 +107,6 @@ import kotlinx.coroutines.flow.StateFlow;
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -207,8 +205,6 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
private final FakeExecutor mBackgroundExecutor = new FakeExecutor(mFakeSystemClock);
private final Executor mMainExecutor = Runnable::run; // Direct executor
- @Rule public final LogWtfHandlerRule wtfHandlerRule = new LogWtfHandlerRule();
-
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt b/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt
index 155059ea5ed9..e0118b18ff64 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt
@@ -244,7 +244,7 @@ class LauncherProxyServiceTest : SysuiTestCase() {
`when`(userManager.isVisibleBackgroundUsersSupported()).thenReturn(true)
`when`(userManager.isUserForeground()).thenReturn(true)
val spyContext = spy(context)
- val ops = createLauncherProxyService(spyContext)
+ val ops = assertLogsWtf { createLauncherProxyService(spyContext) }.result
ops.startConnectionToCurrentUser()
verify(spyContext, times(0)).bindServiceAsUser(any(), any(), anyInt(), any())
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt
index 51bb38fa5ba9..f72645eb8596 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt
@@ -51,6 +51,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
+import com.android.systemui.log.assertLogsWtf
import com.android.systemui.qs.flags.QSComposeFragment
import com.android.systemui.res.R
import com.android.systemui.scene.ui.view.WindowRootViewKeyEventHandler
@@ -413,7 +414,9 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) :
// THEN move is ignored, down is handled, and window is notified
assertThat(interactionEventHandler.handleDispatchTouchEvent(MOVE_EVENT)).isFalse()
- assertThat(interactionEventHandler.handleDispatchTouchEvent(DOWN_EVENT)).isTrue()
+ assertLogsWtf {
+ assertThat(interactionEventHandler.handleDispatchTouchEvent(DOWN_EVENT)).isTrue()
+ }
verify(notificationShadeWindowController).setLaunchingActivity(false)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index 4315c0f638ac..84f39be2eeed 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.row;
import static android.app.Flags.FLAG_NOTIFICATIONS_REDESIGN_TEMPLATES;
+import static com.android.systemui.log.LogAssertKt.assertRunnableLogsWtf;
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_ALL;
import static com.android.systemui.statusbar.notification.row.NotificationTestHelper.PKG;
import static com.android.systemui.statusbar.notification.row.NotificationTestHelper.USER_HANDLE;
@@ -1147,7 +1148,7 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
public void hasStatusBarChipDuringHeadsUpAnimation_flagOff_false() throws Exception {
final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
- row.setHasStatusBarChipDuringHeadsUpAnimation(true);
+ assertRunnableLogsWtf(() -> row.setHasStatusBarChipDuringHeadsUpAnimation(true));
assertThat(row.hasStatusBarChipDuringHeadsUpAnimation()).isFalse();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationCustomContentMemoryVerifierTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationCustomContentMemoryVerifierTest.java
index 1cadb3c0a909..e1bab8ec47e6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationCustomContentMemoryVerifierTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationCustomContentMemoryVerifierTest.java
@@ -46,6 +46,7 @@ import androidx.test.filters.SmallTest;
import com.android.server.notification.Flags;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.log.LogAssertKt;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
@@ -173,8 +174,10 @@ public class NotificationCustomContentMemoryVerifierTest extends SysuiTestCase {
public void satisfiesMemoryLimits_viewWithoutCustomNotificationRoot_returnsTrue() {
NotificationEntry entry = new NotificationEntryBuilder().build();
View view = new FrameLayout(mContext);
- assertThat(NotificationCustomContentMemoryVerifier.satisfiesMemoryLimits(view, entry))
- .isTrue();
+ LogAssertKt.assertRunnableLogsWtf(() -> {
+ assertThat(NotificationCustomContentMemoryVerifier.satisfiesMemoryLimits(view, entry))
+ .isTrue();
+ });
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
index 8de931a7af40..0d7ce5353cd4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
@@ -2055,6 +2055,9 @@ public class BubblesTest extends SysuiTestCase {
@Test
public void testShowStackEdu_isConversationBubble() {
+ // TODO(b/401025577): Prevent this test from raising a WTF, and remove this exemption
+ mLogWtfRule.addFailureLogExemption(log-> log.getTag().equals("FloatingCoordinator"));
+
// Setup
setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, false);
BubbleEntry bubbleEntry = createBubbleEntry();
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java
index 252c70a61b86..e550e88b7bc7 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java
@@ -46,6 +46,7 @@ import androidx.test.uiautomator.UiDevice;
import com.android.internal.protolog.ProtoLog;
import com.android.systemui.broadcast.FakeBroadcastDispatcher;
import com.android.systemui.flags.SceneContainerRule;
+import com.android.systemui.log.LogWtfHandlerRule;
import org.junit.After;
import org.junit.AfterClass;
@@ -127,6 +128,8 @@ public abstract class SysuiTestCase {
@Rule public final SetFlagsRule mSetFlagsRule =
isRobolectricTest() ? new SetFlagsRule() : mSetFlagsClassRule.createSetFlagsRule();
+ @Rule public final LogWtfHandlerRule mLogWtfRule = new LogWtfHandlerRule();
+
@Rule(order = 10)
public final SceneContainerRule mSceneContainerRule = new SceneContainerRule();
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/log/LogAssert.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/log/LogAssert.kt
index b41ceff5f581..a42f2025cdaa 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/log/LogAssert.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/log/LogAssert.kt
@@ -18,7 +18,6 @@ package com.android.systemui.log
import android.util.Log
import android.util.Log.TerribleFailureHandler
import com.google.common.truth.Truth.assertWithMessage
-import java.util.concurrent.Callable
/** Asserts that [notLoggingBlock] does not make a call to [Log.wtf] */
fun <T> assertDoesNotLogWtf(
@@ -65,15 +64,6 @@ fun <T> assertLogsWtf(
return WtfBlockResult(caught, result)
}
-/** Assert that [loggingCallable] makes a call to [Log.wtf] */
-@JvmOverloads
-fun <T> assertLogsWtf(
- message: String = "Expected Log.wtf to be called",
- allowMultiple: Boolean = false,
- loggingCallable: Callable<T>,
-): WtfBlockResult<T> =
- assertLogsWtf(message = message, allowMultiple = allowMultiple, loggingCallable::call)
-
/** Assert that [loggingBlock] makes at least one call to [Log.wtf] */
@JvmOverloads
fun <T> assertLogsWtfs(
@@ -81,13 +71,6 @@ fun <T> assertLogsWtfs(
loggingBlock: () -> T,
): WtfBlockResult<T> = assertLogsWtf(message, allowMultiple = true, loggingBlock)
-/** Assert that [loggingCallable] makes at least one call to [Log.wtf] */
-@JvmOverloads
-fun <T> assertLogsWtfs(
- message: String = "Expected Log.wtf to be called once or more",
- loggingCallable: Callable<T>,
-): WtfBlockResult<T> = assertLogsWtf(message, allowMultiple = true, loggingCallable)
-
/** The data passed to [TerribleFailureHandler.onTerribleFailure] */
data class TerribleFailureLog(
val tag: String,