[Audiosharing] Set visibility by active device.
Also created header and button controller for detail page. Bug: 305620450 Test: manual Change-Id: I5e468a0fb9ce49ef0fd9a0b00b51084cfd416ce0
This commit is contained in:
@@ -80,8 +80,8 @@ class AudioStreamsHelper {
|
||||
});
|
||||
}
|
||||
|
||||
/** Removes all sources from LE broadcasts associated for all active sinks. */
|
||||
void removeSource() {
|
||||
/** Removes sources from LE broadcasts associated for all active sinks based on broadcast Id. */
|
||||
void removeSource(int broadcastId) {
|
||||
if (mLeBroadcastAssistant == null) {
|
||||
Log.w(TAG, "removeSource(): LeBroadcastAssistant is null!");
|
||||
return;
|
||||
@@ -93,14 +93,17 @@ class AudioStreamsHelper {
|
||||
if (DEBUG) {
|
||||
Log.d(
|
||||
TAG,
|
||||
"removeSource(): remove all sources from sink : "
|
||||
"removeSource(): remove all sources with broadcast id :"
|
||||
+ broadcastId
|
||||
+ " from sink : "
|
||||
+ sink.getAddress());
|
||||
}
|
||||
var sources = mLeBroadcastAssistant.getAllSources(sink);
|
||||
if (!sources.isEmpty()) {
|
||||
mLeBroadcastAssistant.removeSource(
|
||||
sink, sources.get(0).getSourceId());
|
||||
}
|
||||
mLeBroadcastAssistant.getAllSources(sink).stream()
|
||||
.filter(state -> state.getBroadcastId() == broadcastId)
|
||||
.forEach(
|
||||
state ->
|
||||
mLeBroadcastAssistant.removeSource(
|
||||
sink, state.getSourceId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -121,6 +124,12 @@ class AudioStreamsHelper {
|
||||
return mLeBroadcastAssistant;
|
||||
}
|
||||
|
||||
static boolean isConnected(BluetoothLeBroadcastReceiveState state) {
|
||||
return state.getPaSyncState() == BluetoothLeBroadcastReceiveState.PA_SYNC_STATE_SYNCHRONIZED
|
||||
&& state.getBigEncryptionState()
|
||||
== BluetoothLeBroadcastReceiveState.BIG_ENCRYPTION_STATE_DECRYPTING;
|
||||
}
|
||||
|
||||
private static List<BluetoothDevice> getActiveSinksOnAssistant(
|
||||
@Nullable LocalBluetoothManager manager) {
|
||||
if (manager == null) {
|
||||
|
Reference in New Issue
Block a user