diff options
| author | 2024-02-12 15:22:23 +0000 | |
|---|---|---|
| committer | 2024-02-12 15:22:23 +0000 | |
| commit | ccc8c1981f7e69edf675313929659891e49b43e9 (patch) | |
| tree | e213d5189760ae6b6ee69d7b3771d2dff4967f76 | |
| parent | 6d92ca2277284a616be079b1fe37f2dfb7920dff (diff) | |
| parent | e1e623e7bd5cc10451c61855c2aedf5ca76642c2 (diff) | |
Merge "Log.wtf when expanding a goup that's not attached" into main
2 files changed, 11 insertions, 5 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt index 0c7ce970cf3a..288c0832170f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt @@ -16,10 +16,12 @@ package com.android.systemui.statusbar.notification.collection.render +import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.dump.DumpManager +import com.android.systemui.log.assertLogsWtf import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder import com.android.systemui.statusbar.notification.collection.ListEntry import com.android.systemui.statusbar.notification.collection.NotifPipeline @@ -30,7 +32,7 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import org.junit.Assert.assertThrows +import org.junit.Assume import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -116,9 +118,9 @@ class GroupExpansionManagerTest : SysuiTestCase() { underTest.setGroupExpanded(summary1, false) // Expanding again should throw. - assertThrows(IllegalArgumentException::class.java) { - underTest.setGroupExpanded(summary1, true) - } + // TODO(b/320238410): Remove this check when robolectric supports wtf assertions. + Assume.assumeFalse(Build.FINGERPRINT.contains("robolectric")) + assertLogsWtf { underTest.setGroupExpanded(summary1, true) } } @Test diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java index 3cdb2cd9b5c6..d1aff80b4e7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.collection.render; +import android.util.Log; + import androidx.annotation.NonNull; import com.android.systemui.Dumpable; @@ -40,6 +42,8 @@ import javax.inject.Inject; */ @SysUISingleton public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpable { + private static final String TAG = "GroupExpansionaManagerImpl"; + private final DumpManager mDumpManager; private final GroupMembershipManager mGroupMembershipManager; private final Set<OnGroupExpansionChangeListener> mOnGroupChangeListeners = new HashSet<>(); @@ -100,7 +104,7 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Dumpabl NotificationEntry groupSummary = mGroupMembershipManager.getGroupSummary(entry); if (entry.getParent() == null) { if (expanded) { - throw new IllegalArgumentException("Cannot expand group that is not attached"); + Log.wtf(TAG, "Cannot expand group that is not attached"); } else { // The entry is no longer attached, but we still want to make sure we don't have // a stale expansion state. |