[Audiosharing] Add log for debugging.
Test: atest -c com.android.settings.connecteddevice.audiosharing.audiostreams Bug: 347605485 Flag: com.android.settingslib.flags.enable_le_audio_qr_code_private_broadcast_sharing Change-Id: I319747652837c08ffcbbd5980609a0f8f35e3c24
This commit is contained in:
@@ -74,6 +74,10 @@ public class AudioStreamMediaService extends Service {
|
|||||||
public void onSourceLost(int broadcastId) {
|
public void onSourceLost(int broadcastId) {
|
||||||
super.onSourceLost(broadcastId);
|
super.onSourceLost(broadcastId);
|
||||||
if (broadcastId == mBroadcastId) {
|
if (broadcastId == mBroadcastId) {
|
||||||
|
Log.d(TAG, "onSourceLost() : stopSelf");
|
||||||
|
if (mNotificationManager != null) {
|
||||||
|
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +89,10 @@ public class AudioStreamMediaService extends Service {
|
|||||||
&& mAudioStreamsHelper.getAllConnectedSources().stream()
|
&& mAudioStreamsHelper.getAllConnectedSources().stream()
|
||||||
.map(BluetoothLeBroadcastReceiveState::getBroadcastId)
|
.map(BluetoothLeBroadcastReceiveState::getBroadcastId)
|
||||||
.noneMatch(id -> id == mBroadcastId)) {
|
.noneMatch(id -> id == mBroadcastId)) {
|
||||||
|
Log.d(TAG, "onSourceRemoved() : stopSelf");
|
||||||
|
if (mNotificationManager != null) {
|
||||||
|
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,6 +103,10 @@ public class AudioStreamMediaService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void onBluetoothStateChanged(int bluetoothState) {
|
public void onBluetoothStateChanged(int bluetoothState) {
|
||||||
if (BluetoothAdapter.STATE_OFF == bluetoothState) {
|
if (BluetoothAdapter.STATE_OFF == bluetoothState) {
|
||||||
|
Log.d(TAG, "onBluetoothStateChanged() : stopSelf");
|
||||||
|
if (mNotificationManager != null) {
|
||||||
|
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,6 +131,10 @@ public class AudioStreamMediaService extends Service {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (mDevices == null || mDevices.isEmpty()) {
|
if (mDevices == null || mDevices.isEmpty()) {
|
||||||
|
Log.d(TAG, "onProfileConnectionStateChanged() : stopSelf");
|
||||||
|
if (mNotificationManager != null) {
|
||||||
|
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,21 +261,27 @@ public class AudioStreamMediaService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
Log.d(TAG, "onDestroy()");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
if (!AudioSharingUtils.isFeatureEnabled()) {
|
if (!AudioSharingUtils.isFeatureEnabled()) {
|
||||||
|
Log.d(TAG, "onDestroy() : skip due to feature not enabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mLocalBtManager != null) {
|
if (mLocalBtManager != null) {
|
||||||
|
Log.d(TAG, "onDestroy() : unregister mBluetoothCallback");
|
||||||
mLocalBtManager.getEventManager().unregisterCallback(mBluetoothCallback);
|
mLocalBtManager.getEventManager().unregisterCallback(mBluetoothCallback);
|
||||||
}
|
}
|
||||||
if (mLeBroadcastAssistant != null) {
|
if (mLeBroadcastAssistant != null) {
|
||||||
|
Log.d(TAG, "onDestroy() : unregister mBroadcastAssistantCallback");
|
||||||
mLeBroadcastAssistant.unregisterServiceCallBack(mBroadcastAssistantCallback);
|
mLeBroadcastAssistant.unregisterServiceCallBack(mBroadcastAssistantCallback);
|
||||||
}
|
}
|
||||||
if (mVolumeControl != null) {
|
if (mVolumeControl != null) {
|
||||||
|
Log.d(TAG, "onDestroy() : unregister mVolumeControlCallback");
|
||||||
mVolumeControl.unregisterCallback(mVolumeControlCallback);
|
mVolumeControl.unregisterCallback(mVolumeControlCallback);
|
||||||
}
|
}
|
||||||
if (mLocalSession != null) {
|
if (mLocalSession != null) {
|
||||||
|
Log.d(TAG, "onDestroy() : release mLocalSession");
|
||||||
mLocalSession.release();
|
mLocalSession.release();
|
||||||
mLocalSession = null;
|
mLocalSession = null;
|
||||||
}
|
}
|
||||||
@@ -272,6 +294,9 @@ public class AudioStreamMediaService extends Service {
|
|||||||
mBroadcastId = intent != null ? intent.getIntExtra(BROADCAST_ID, -1) : -1;
|
mBroadcastId = intent != null ? intent.getIntExtra(BROADCAST_ID, -1) : -1;
|
||||||
if (mBroadcastId == -1) {
|
if (mBroadcastId == -1) {
|
||||||
Log.w(TAG, "Invalid broadcast ID. Service will not start.");
|
Log.w(TAG, "Invalid broadcast ID. Service will not start.");
|
||||||
|
if (mNotificationManager != null) {
|
||||||
|
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
@@ -281,6 +306,9 @@ public class AudioStreamMediaService extends Service {
|
|||||||
}
|
}
|
||||||
if (mDevices == null || mDevices.isEmpty()) {
|
if (mDevices == null || mDevices.isEmpty()) {
|
||||||
Log.w(TAG, "No device. Service will not start.");
|
Log.w(TAG, "No device. Service will not start.");
|
||||||
|
if (mNotificationManager != null) {
|
||||||
|
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user