Catch BadParcelableException when checking extras
The extras found in CustomAction are provided by user apps
when they want to add custom commands to the session with
extra information.
To avoid unneeded updates the actions compared to the
currently known actions, along with their extras,
but those may not have a Parcelable implementation
thus will fail to be un-parcelled.
Simply catch the exception when comparing the extras
as those aren't used anywhere else in code and only
sent back to the user-side session.
Test: m; media 3 app
Change-Id: I5f755d6a09266372ea724b08c97a11e3ca913569
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt
index 2bdee67..ba135f9 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt
@@ -22,6 +22,7 @@
import android.graphics.drawable.Icon
import android.media.session.MediaController
import android.media.session.PlaybackState
+import android.os.BadParcelableException
import android.util.Log
import com.android.systemui.Flags.mediaControlsPostsOptimization
import com.android.systemui.biometrics.Utils.toBitmap
@@ -109,7 +110,12 @@
}
if (firstAction.extras != null) {
firstAction.extras.keySet().forEach { key ->
- if (firstAction.extras[key] != secondAction.extras[key]) {
+ try {
+ if (firstAction.extras[key] != secondAction.extras[key]) {
+ return false
+ }
+ } catch (e: BadParcelableException) {
+ Log.e(TAG, "Cannot unparcel extras", e)
return false
}
}