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

Commit 108aa4d7 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Match package prefix instead of complete package name

Tesla app may have different package names for internal testing and service centers

Test: mmm packages/modules/Bluetooth
Flag: EXEMPT IOP fix
Bug: 369329192
Change-Id: I560beee7947b699e3a63df998f5733ce558041d6
parent a02e60fa
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ public class GattService extends ProfileService {

    private static final Integer GATT_MTU_MAX = 517;
    private static final Map<String, Integer> EARLY_MTU_EXCHANGE_PACKAGES =
            Map.of("com.teslamotors.tesla", GATT_MTU_MAX);
            Map.of("com.teslamotors", GATT_MTU_MAX);

    @VisibleForTesting static final int GATT_CLIENT_LIMIT_PER_APP = 32;

@@ -2161,14 +2161,19 @@ public class GattService extends ProfileService {

        // Some applications expect MTU to be exchanged immediately on connections
        String packageName = attributionSource.getPackageName();
        if (packageName != null && EARLY_MTU_EXCHANGE_PACKAGES.containsKey(packageName)) {
            preferredMtu = EARLY_MTU_EXCHANGE_PACKAGES.get(packageName);
        if (packageName != null) {
            for (Map.Entry<String, Integer> entry : EARLY_MTU_EXCHANGE_PACKAGES.entrySet()) {
                if (packageName.contains(entry.getKey())) {
                    preferredMtu = entry.getValue();
                    Log.i(
                            TAG,
                            "Early MTU exchange preference ("
                                    + preferredMtu
                                    + ") requested for "
                                    + packageName);
                    break;
                }
            }
        }

        mNativeInterface.gattClientConnect(