From 14343ee4c3bf71789683c322ff2796445d7e6d26 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 11 Aug 2017 09:24:41 -0700 Subject: [PATCH] Catch BadParcelableException in RemoteConnection when setting extras. Unlike the code in Telecom which can use Bundle.setDefusable(..), this framework code is used within a Connection Manager's code space, so the setDefusable method does not work. To prevent crashing the Connection Manager's app, catching the exception and ignoring extras in this case (not much else we can do). I've also filed a bug against the offending component known for putting bad parcelables into the extras. Test: Modified code to force this scenario. Bug: 64499462 Change-Id: If44ad2e2c8e285d513969c6babe5a798242da53d --- telecomm/java/android/telecom/RemoteConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 57fc9ced91aea..f30d7bdef810a 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -25,6 +25,7 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.hardware.camera2.CameraManager; import android.net.Uri; +import android.os.BadParcelableException; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -1464,7 +1465,11 @@ public final class RemoteConnection { if (mExtras == null) { mExtras = new Bundle(); } - mExtras.putAll(extras); + try { + mExtras.putAll(extras); + } catch (BadParcelableException bpe) { + Log.w(this, "putExtras: could not unmarshal extras; exception = " + bpe); + } notifyExtrasChanged(); }