Skip to content

Commit 7ec1d1a

Browse files
luca020400kawaaii
authored andcommitted
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
1 parent 0e664c2 commit 7ec1d1a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import android.content.Context
2222
import android.graphics.drawable.Icon
2323
import android.media.session.MediaController
2424
import android.media.session.PlaybackState
25+
import android.os.BadParcelableException
2526
import android.util.Log
2627
import com.android.systemui.Flags.mediaControlsPostsOptimization
2728
import com.android.systemui.biometrics.Utils.toBitmap
@@ -109,7 +110,12 @@ private fun areCustomActionsEqual(
109110
}
110111
if (firstAction.extras != null) {
111112
firstAction.extras.keySet().forEach { key ->
112-
if (firstAction.extras[key] != secondAction.extras[key]) {
113+
try {
114+
if (firstAction.extras[key] != secondAction.extras[key]) {
115+
return false
116+
}
117+
} catch (e: BadParcelableException) {
118+
Log.e(TAG, "Cannot unparcel extras", e)
113119
return false
114120
}
115121
}

0 commit comments

Comments
 (0)