BT: Implementation for Bluetooth silence mode in BT Stack (2/2)
Restore the Play position notification response to INTERIM if
DUT is not able to send CHANGED response to the Remote device
because of being in Silent mode.
Change-Id: I99b1ac9b1d29ccdf9713c173ba328dd77e3daf83
diff --git a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
index dd91d2c..25cf2a4 100644
--- a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
+++ b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
@@ -2790,10 +2790,19 @@
if (requested || ((deviceFeatures[i].mLastReportedPosition != playPositionMs) &&
((playPositionMs >= deviceFeatures[i].mNextPosMs) ||
(playPositionMs <= deviceFeatures[i].mPrevPosMs))) && deviceFeatures[i].isActiveDevice) {
- if (!requested) deviceFeatures[i].mPlayPosChangedNT = AvrcpConstants.NOTIFICATION_TYPE_CHANGED;
- if (deviceFeatures[i].mCurrentDevice != null)
- registerNotificationRspPlayPosNative(deviceFeatures[i].mPlayPosChangedNT,
- (int)playPositionMs, getByteAddress(deviceFeatures[i].mCurrentDevice));
+ if (!requested)
+ deviceFeatures[i].mPlayPosChangedNT = AvrcpConstants.NOTIFICATION_TYPE_CHANGED;
+ if (deviceFeatures[i].mCurrentDevice != null) {
+ if (!registerNotificationRspPlayPosNative(deviceFeatures[i].mPlayPosChangedNT,
+ (int)playPositionMs, getByteAddress(deviceFeatures[i].mCurrentDevice))) {
+ Log.w(TAG,"Fail to send rsp to remote, restore to interim if change rsp fail");
+ if (!requested) {
+ deviceFeatures[i].mPlayPosChangedNT =
+ AvrcpConstants.NOTIFICATION_TYPE_INTERIM;
+ return;
+ }
+ }
+ }
deviceFeatures[i].mLastReportedPosition = playPositionMs;
if (playPositionMs != PlaybackState.PLAYBACK_POSITION_UNKNOWN) {
deviceFeatures[i].mNextPosMs = playPositionMs + deviceFeatures[i].mPlaybackIntervalMs;