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

Commit d7404e4f authored by Yiyi Shen's avatar Yiyi Shen
Browse files

[Audiosharing] Enable audio sharing feature when preview option on.

Test: atest
Bug: 368401233
Flag: com.android.settingslib.flags.audio_sharing_developer_option
Change-Id: I41ad6c570a6c42c498efe5a9a261d929aeff2da6
parent a8afad14
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ public class BluetoothEventManager {
        // audio sharing is enabled.
        if (bluetoothProfile == BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT
                && state == BluetoothAdapter.STATE_DISCONNECTED
                && BluetoothUtils.isAudioSharingEnabled()) {
                && BluetoothUtils.isAudioSharingUIAvailable(mContext)) {
            LocalBluetoothProfileManager profileManager = mBtManager.getProfileManager();
            if (profileManager != null
                    && profileManager.getLeAudioBroadcastProfile() != null
+1 −1
Original line number Diff line number Diff line
@@ -1245,7 +1245,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
     */
    public String getConnectionSummary(boolean shortSummary) {
        CharSequence summary = null;
        if (BluetoothUtils.isAudioSharingEnabled()) {
        if (BluetoothUtils.isAudioSharingUIAvailable(mContext)) {
            if (mBluetoothManager == null) {
                mBluetoothManager = LocalBluetoothManager.getInstance(mContext, null);
            }
+8 −6
Original line number Diff line number Diff line
@@ -383,12 +383,8 @@ public class CsipDeviceManager {
                preferredMainDevice.refresh();
                hasChanged = true;
            }
            if (isWorkProfile()) {
                log("addMemberDevicesIntoMainDevice: skip sync source for work profile");
            } else {
            syncAudioSharingSourceIfNeeded(preferredMainDevice);
        }
        }
        if (hasChanged) {
            log("addMemberDevicesIntoMainDevice: After changed, CachedBluetoothDevice list: "
                    + mCachedDevices);
@@ -402,8 +398,12 @@ public class CsipDeviceManager {
    }

    private void syncAudioSharingSourceIfNeeded(CachedBluetoothDevice mainDevice) {
        boolean isAudioSharingEnabled = BluetoothUtils.isAudioSharingEnabled();
        boolean isAudioSharingEnabled = BluetoothUtils.isAudioSharingUIAvailable(mContext);
        if (isAudioSharingEnabled) {
            if (isWorkProfile()) {
                log("addMemberDevicesIntoMainDevice: skip sync source for work profile");
                return;
            }
            boolean hasBroadcastSource = BluetoothUtils.isBroadcasting(mBtManager)
                    && BluetoothUtils.hasConnectedBroadcastSource(
                    mainDevice, mBtManager);
@@ -433,6 +433,8 @@ public class CsipDeviceManager {
                    }
                }
            }
        } else {
            log("addMemberDevicesIntoMainDevice: skip sync source, flag disabled");
        }
    }