From 512f8bf33e48ac7e35f36b7fa1400b2d1a0a253d Mon Sep 17 00:00:00 2001 From: Beth Thibodeau Date: Mon, 7 Nov 2022 16:54:56 -0600 Subject: [PATCH] Change exception to log This can occur in usage, so avoid crashing SystemUI when it happens. Relevant tests are already marked `@Ignore` and will be addressed in a follow-up change. Bug: 257573640 Test: atest SystemUITests, does not crash on MediaCarouselController Change-Id: I629157708f31c438613de40796ee891730e36c01 --- .../systemui/media/controls/ui/MediaCarouselController.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt index baeee9fc4f748..8aaee81a57ddb 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt @@ -610,7 +610,8 @@ constructor( // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { - throw IllegalStateException( + Log.e( + TAG, "Size of players list and number of views in carousel are out of sync. " + "Players size is ${MediaPlayerData.players().size}. " + "View count is ${mediaContent.childCount}." @@ -671,7 +672,8 @@ constructor( // are // elements in mediaPlayers. if (MediaPlayerData.players().size != mediaContent.childCount) { - throw IllegalStateException( + Log.e( + TAG, "Size of players list and number of views in carousel are out of sync. " + "Players size is ${MediaPlayerData.players().size}. " + "View count is ${mediaContent.childCount}."