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

Commit 19dd867e authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Android Build Coastguard Worker
Browse files

Add ATT MTU preference for Tesla app

Test: mmm packages/modules/Bluetooth
Flag: EXEMPT IOP fix
Bug: 369329192
(cherry picked from https://android-review.googlesource.com/q/commit:ea9b83648dcb3ebc21e2e0700d70d748996dfd33)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:36dc6f8c3ddbc8544375c68a292620e70a432031)
Merged-In: Ie173cc15e888bb989f006c40f9562c6f30a6a7fa
Change-Id: Ie173cc15e888bb989f006c40f9562c6f30a6a7fa
parent 33a3081a
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -142,6 +142,15 @@ public class GattService extends ProfileService {
                "0201061AFF4C000215426C7565436861726D426561636F6E730EFE1355C509168020691E0EFE13551109426C7565436861726D5F31363936383500000000",
            };

<<<<<<< HEAD   (9f43bf Send preferred MTU from GattService to native GATT module)
=======
    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);

    @VisibleForTesting static final int GATT_CLIENT_LIMIT_PER_APP = 32;

>>>>>>> CHANGE (ea9b83 Add ATT MTU preference for Tesla app)
    public final TransitionalScanHelper mTransitionalScanHelper =
            new TransitionalScanHelper(this, this::isTestModeEnabled);

@@ -2141,6 +2150,19 @@ public class GattService extends ProfileService {
                -1);

        int preferredMtu = 0;

        // 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);
            Log.i(
                    TAG,
                    "Early MTU exchange preference ("
                            + preferredMtu
                            + ") requested for "
                            + packageName);
        }

        mNativeInterface.gattClientConnect(
                clientIf, address, addressType, isDirect, transport, opportunistic, phy, preferredMtu);
    }