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

Commit 0131dc87 authored by Yiyi Shen's avatar Yiyi Shen Committed by Android (Google) Code Review
Browse files

Merge "[Audiosharing] Check broadcast id before return cached metadata" into main

parents 23876b63 0e455aa5
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -724,7 +724,10 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
            Log.d(TAG, "The BluetoothLeBroadcast is null");
            return null;
        }
        if (mBluetoothLeBroadcastMetadata == null) {
        if (mBluetoothLeBroadcastMetadata == null
                // mBroadcastId is updated when onBroadcastStarted, which is always before
                // onBroadcastMetadataChanged, so mBroadcastId is always the latest broadcast info
                || mBluetoothLeBroadcastMetadata.getBroadcastId() != mBroadcastId) {
            final List<BluetoothLeBroadcastMetadata> metadataList =
                    mServiceBroadcast.getAllBroadcastMetadata();
            mBluetoothLeBroadcastMetadata =
@@ -732,6 +735,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
                            .filter(i -> i.getBroadcastId() == mBroadcastId)
                            .findFirst()
                            .orElse(null);
            Log.d(TAG, "getLatestBluetoothLeBroadcastMetadata for broadcast id " + mBroadcastId);
        }
        return mBluetoothLeBroadcastMetadata;
    }