summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ioana Alexandru <aioana@google.com> 2024-01-12 17:35:01 +0100
committer Ioana Alexandru <aioana@google.com> 2024-02-09 16:08:46 +0100
commite1e623e7bd5cc10451c61855c2aedf5ca76642c2 (patch)
tree8c40747306b8dd1f262b7b686b031dad3b01a43a
parent7a92cfa37d409fd1b452374a00073766cb5b0443 (diff)
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
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java6
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.