Merge changes I547a33fc,I834fce6a
* changes:
Headset Client Profile AudioManager test
AVRCP Controller Audio Focus gain behavior
diff --git a/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java b/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java
index 94615c1..f901d27 100644
--- a/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java
+++ b/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java
@@ -111,7 +111,6 @@
}
switch (message.what) {
case SRC_STR_START:
- mStreamAvailable = true;
// Always request audio focus if on TV.
if (isTvDevice()) {
if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) {
@@ -126,7 +125,6 @@
case SRC_STR_STOP:
// Audio stream has stopped, maintain focus but stop avrcp updates.
- mStreamAvailable = false;
break;
case SNK_PLAY:
@@ -137,10 +135,12 @@
break;
case SNK_PAUSE:
+ mStreamAvailable = false;
// Local pause command, maintain focus but stop avrcp updates.
break;
case SRC_PLAY:
+ mStreamAvailable = true;
// Remote play command.
// If is an iot device gain focus and start avrcp updates.
if (isIotDevice() || isTvDevice()) {
@@ -156,6 +156,7 @@
break;
case SRC_PAUSE:
+ mStreamAvailable = false;
// Remote pause command, stop avrcp updates.
break;
@@ -202,6 +203,7 @@
if (mStreamAvailable) {
sendAvrcpPause();
mSentPause = true;
+ mStreamAvailable = false;
}
stopFluorideStreaming();
break;
diff --git a/src/com/android/bluetooth/hfpclient/HeadsetClientService.java b/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
index 039838c..08f0d2d 100644
--- a/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
+++ b/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
@@ -929,7 +929,7 @@
mSmFactory = factory;
}
- AudioManager getAudioManager() {
+ protected AudioManager getAudioManager() {
return mAudioManager;
}
}
diff --git a/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java b/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
index 334597b..45997e0 100644
--- a/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
+++ b/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
@@ -68,7 +68,7 @@
when(mAudioManager.getStreamVolume(anyInt())).thenReturn(2);
when(mAudioManager.getStreamMaxVolume(anyInt())).thenReturn(10);
when(mAudioManager.getStreamMinVolume(anyInt())).thenReturn(1);
- when(mHeadsetClientService.getSystemService(Context.AUDIO_SERVICE)).thenReturn(
+ when(mHeadsetClientService.getAudioManager()).thenReturn(
mAudioManager);
when(mHeadsetClientService.getResources()).thenReturn(mMockHfpResources);
when(mMockHfpResources.getBoolean(R.bool.hfp_clcc_poll_during_call)).thenReturn(true);