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

Commit d2d3c567 authored by Betty Chang's avatar Betty Chang Committed by Automerger Merge Worker
Browse files

Merge "[LE Audio] Add try catch for bluetooth device address fail" into udc-dev am: 2807255e

parents 8e2f15a4 2807255e
Loading
Loading
Loading
Loading
+22 −17
Original line number Original line Diff line number Diff line
@@ -261,10 +261,12 @@ public class LocalBluetoothLeBroadcastMetadata {
        Pattern pattern = Pattern.compile(PATTERN_BT_BROADCAST_METADATA);
        Pattern pattern = Pattern.compile(PATTERN_BT_BROADCAST_METADATA);
        Matcher match = pattern.matcher(qrCodeString);
        Matcher match = pattern.matcher(qrCodeString);
        if (match.find()) {
        if (match.find()) {
            try {
                mSourceAddressType = Integer.parseInt(match.group(MATCH_INDEX_ADDRESS_TYPE));
                mSourceAddressType = Integer.parseInt(match.group(MATCH_INDEX_ADDRESS_TYPE));
                mSourceDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(
                mSourceDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(
                    match.group(MATCH_INDEX_DEVICE));
                    match.group(MATCH_INDEX_DEVICE));
            mSourceAdvertisingSid = Integer.parseInt(match.group(MATCH_INDEX_ADVERTISING_SID));
                mSourceAdvertisingSid = Integer.parseInt(
                    match.group(MATCH_INDEX_ADVERTISING_SID));
                mBroadcastId = Integer.parseInt(match.group(MATCH_INDEX_BROADCAST_ID));
                mBroadcastId = Integer.parseInt(match.group(MATCH_INDEX_BROADCAST_ID));
                mPaSyncInterval = Integer.parseInt(match.group(MATCH_INDEX_SYNC_INTERVAL));
                mPaSyncInterval = Integer.parseInt(match.group(MATCH_INDEX_SYNC_INTERVAL));
                mIsEncrypted = Boolean.valueOf(match.group(MATCH_INDEX_IS_ENCRYPTED));
                mIsEncrypted = Boolean.valueOf(match.group(MATCH_INDEX_IS_ENCRYPTED));
@@ -296,10 +298,13 @@ public class LocalBluetoothLeBroadcastMetadata {
                    .setPresentationDelayMicros(mPresentationDelayMicros)
                    .setPresentationDelayMicros(mPresentationDelayMicros)
                    .addSubgroup(mSubgroup)
                    .addSubgroup(mSubgroup)
                    .build();
                    .build();
            } catch (IllegalArgumentException e) {
                Log.d(TAG, "IllegalArgumentException when convert : " + e);
                return null;
            }
        } else {
        } else {
            if (DEBUG) {
            if (DEBUG) {
                Log.d(TAG,
                Log.d(TAG, "The match fail, can not convert it to BluetoothLeBroadcastMetadata.");
                        "The match fail, can not convert it to BluetoothLeBroadcastMetadata.");
            }
            }
            return null;
            return null;
        }
        }