summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatheesh Kumar Pallemoni <quic_spallemo@quicinc.com>2023-02-22 19:51:39 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2023-03-20 06:33:44 -0700
commit0ce5e39f9fb64cf8647a3b22db59e3b68d7d70fa (patch)
tree03bd5f74df2aede1d4065ce5b0ee20570925aedd
parent0fece8a14ed42c24ffe64b4ae21614a2f2dd7e37 (diff)
HFP: Handle LE-A Music and HFP Call synchronization(2/2).
- Handle LE-A Music and HFP Call synchronization. Change-Id: Ifb616d66920790ad820a070afd9d7c397a947940
-rw-r--r--src/com/android/bluetooth/hfp/HeadsetA2dpSync.java45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java b/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java
index fe54c22cd..5d5380929 100644
--- a/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java
+++ b/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java
@@ -47,6 +47,7 @@ import java.lang.reflect.*;
import com.android.bluetooth.apm.ApmConstIntf;
import com.android.bluetooth.apm.ActiveDeviceManagerServiceIntf;
import com.android.bluetooth.apm.CallAudioIntf;
+import com.android.bluetooth.acm.AcmService;
/**
* Defines methods used for synchronization between HFP and A2DP
@@ -156,6 +157,42 @@ public class HeadsetA2dpSync {
}
}
+ public void hfpCallBapMediaSync(boolean isBapMediaSuspend) {
+ Log.d(TAG,"hfpCallBapMediaSync(): isBapMediaSuspend: " + isBapMediaSuspend);
+ if (ApmConstIntf.getAospLeaEnabled()) {
+ ActiveDeviceManagerServiceIntf mActiveDeviceManager =
+ ActiveDeviceManagerServiceIntf.get();
+ int MediaProfile =
+ mActiveDeviceManager.getActiveProfile(ApmConstIntf.AudioFeatures.MEDIA_AUDIO);
+ int VoiceProfile =
+ mActiveDeviceManager.getActiveProfile(ApmConstIntf.AudioFeatures.CALL_AUDIO);
+ BluetoothDevice mMediaDevice =
+ mActiveDeviceManager.getActiveDevice(ApmConstIntf.AudioFeatures.MEDIA_AUDIO);
+ BluetoothDevice mVoiceDevice =
+ mActiveDeviceManager.getActiveDevice(ApmConstIntf.AudioFeatures.CALL_AUDIO);
+ Log.d(TAG,"hfpCallBapMediaSync(): MediaProfile: " + MediaProfile +
+ ", current active media device: " + mMediaDevice);
+ Log.d(TAG,"hfpCallBapMediaSync: VoiceProfile: " + VoiceProfile +
+ ", current active voice device: " + mVoiceDevice);
+
+ if (MediaProfile != ApmConstIntf.AudioProfiles.NONE &&
+ MediaProfile != ApmConstIntf.AudioProfiles.A2DP &&
+ VoiceProfile != ApmConstIntf.AudioProfiles.NONE &&
+ VoiceProfile == ApmConstIntf.AudioProfiles.HFP) {
+ AcmService mAcmService = AcmService.getAcmService();
+ if (mAcmService != null) {
+ if (isBapMediaSuspend) {
+ Log.d(TAG,"hfpCallBapMediaSync(): hfp call active, suspend bap Music ");
+ mAcmService.hfpCallBapMediaSync(true);
+ } else {
+ Log.d(TAG,"hfpCallBapMediaSync(): hfp call ended, resume bap Music ");
+ mAcmService.hfpCallBapMediaSync(false);
+ }
+ }
+ }
+ }
+ }
+
public boolean suspendA2DP(int reason, BluetoothDevice device) {
int a2dpState = isA2dpPlaying();
String a2dpSuspendStatus;
@@ -171,8 +208,10 @@ public class HeadsetA2dpSync {
return false;
}
- Log.d(TAG," suspendA2DP currPlayingState = "+ a2dpState + " for reason " + reason
- + "mA2dpSuspendTriggered = " + mA2dpSuspendTriggered + " for device " + device);
+ Log.d(TAG," suspendA2DP currPlayingState = "+ a2dpState +
+ " for reason = " + reason +
+ ", mA2dpSuspendTriggered = " + mA2dpSuspendTriggered +
+ " for device: " + device);
mBroadcastService = mAdapterService.getBroadcastService();
mBroadcastIsActive = mAdapterService.getBroadcastActive();
mBroadcastIsStreaming = mAdapterService.getBroadcastStreaming();
@@ -254,6 +293,7 @@ public class HeadsetA2dpSync {
mA2dpSuspendTriggered = reason;
updateSuspendState();
Log.d(TAG," A2DP Playing ,wait for suspend ");
+ hfpCallBapMediaSync(true);
return true;
}
return false;
@@ -295,6 +335,7 @@ public class HeadsetA2dpSync {
}
} else {
mSystemInterface.getAudioManager().setParameters("A2dpSuspended=false");
+ hfpCallBapMediaSync(false);
}
return true;
}