Log.wtf when expanding a goup that's not attached
This seems like it can happen very rarely, though we're not quite sure
how. It's not really an issue since we can just ignore the expansion, so
it shouldn't crash sysui, but made it a Log.wtf so we can still keep an
eye on it.
Bug: 318317068
Test: GroupExpansionManagerTest
Flag: NONE
Change-Id: I16a3f6ced860fee337ccfc8468738ab7cf7b7fca
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 0c7ce97..288c083 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.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 @@
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 3cdb2cd..d1aff80 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 @@
*/
@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 @@
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.