Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 723dac69 authored by qing's avatar qing Committed by Eric Rahm
Browse files

Prevent BadParcelableException in InCallService

When call detail extra contains non-framework class object, the system classloader will not be able to unmarshall the object hence the process which holds IncallService will crash.

Test: manual test by inserting a test parcel into CompanionClientConnectionService.
Bug: 253967348
Change-Id: I3abd2868c532a65ad53d559ce6eca6cc9cf6c25e
(cherry picked from commit 7f6e5de7bc05dff6a5b673dfa17d99160772cbb4)
parent 692ad9d0
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.pm.ServiceInfo;
import android.net.Uri;
import android.os.BadParcelableException;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -2951,11 +2952,14 @@ public final class Call {

        for(String key : bundle.keySet()) {
            if (key != null) {
                final Object value = bundle.get(key);
                final Object newValue = newBundle.get(key);
                if (!newBundle.containsKey(key)) {
                    return false;
                }
                // In case new call extra contains non-framework class objects, return false to
                // force update the call extra
                try {
                    final Object value = bundle.get(key);
                    final Object newValue = newBundle.get(key);
                    if (value instanceof Bundle && newValue instanceof Bundle) {
                        if (!areBundlesEqual((Bundle) value, (Bundle) newValue)) {
                            return false;
@@ -2968,6 +2972,9 @@ public final class Call {
                    } else if (!Objects.equals(value, newValue)) {
                        return false;
                    }
                } catch (BadParcelableException e) {
                    return false;
                }
            }
        }
        return true;