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

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

Merge "[Audiosharing] Add utils to check profile connection" into main

parents 6f134513 9456e378
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1916,6 +1916,25 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
                BluetoothProfile.STATE_CONNECTED;
    }

    /**
     * @return {@code true} if {@code cachedBluetoothDevice} supports broadcast assistant profile
     */
    public boolean isConnectedLeAudioBroadcastAssistantDevice() {
        LocalBluetoothLeBroadcastAssistant leBroadcastAssistant =
                mProfileManager.getLeAudioBroadcastAssistantProfile();
        return leBroadcastAssistant != null && leBroadcastAssistant.getConnectionStatus(mDevice)
                == BluetoothProfile.STATE_CONNECTED;
    }

    /**
     * @return {@code true} if {@code cachedBluetoothDevice} supports volume control profile
     */
    public boolean isConnectedVolumeControlDevice() {
        VolumeControlProfile volumeControl = mProfileManager.getVolumeControlProfile();
        return volumeControl != null && volumeControl.getConnectionStatus(mDevice)
                == BluetoothProfile.STATE_CONNECTED;
    }

    private boolean isConnectedSapDevice() {
        SapProfile sapProfile = mProfileManager.getSapProfile();
        return sapProfile != null && sapProfile.getConnectionStatus(mDevice)