summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-05-04 09:45:52 -0700
committerAbhisek Devkota <ciwrl@cyanogenmod.com>2016-05-04 09:54:03 -0700
commit5aaa6203f124676957bf7acbc0d310d9b17f18fd (patch)
treeb878e26ed4a3de7844ea997a8406eef59a0a57ba
parent4dab6b0f5a2cf24908bb9b691cc700d9168b3eba (diff)
downloadandroid_packages_apps_Bluetooth-5aaa6203f124676957bf7acbc0d310d9b17f18fd.tar.gz
android_packages_apps_Bluetooth-5aaa6203f124676957bf7acbc0d310d9b17f18fd.tar.bz2
android_packages_apps_Bluetooth-5aaa6203f124676957bf7acbc0d310d9b17f18fd.zip
Bluetooth: split out AVRCP remote interfaces (2/2)
android.media.cts.RemoteControllerTest#testOnClientUpdateListenerUnchanged will fail because it expects no extra methods to be added to the listeners and the current AVRCP impl simply appended methods to that listener. In 13 this was fixed by creating a separate listener for those callbacks. Backport that listener to fix the test. Ticket: HAM-1300 CYNGNOS-2716 Change-Id: I063cc5c121beada981d5b97b3052acd6638e3a9a Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r--src/com/android/bluetooth/avrcp/Avrcp.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/com/android/bluetooth/avrcp/Avrcp.java b/src/com/android/bluetooth/avrcp/Avrcp.java
index cdf26f92b..af27c3e34 100644
--- a/src/com/android/bluetooth/avrcp/Avrcp.java
+++ b/src/com/android/bluetooth/avrcp/Avrcp.java
@@ -79,6 +79,7 @@ public final class Avrcp {
private AvrcpMessageHandler mHandler;
private RemoteController mRemoteController;
private RemoteControllerWeak mRemoteControllerCb;
+ private AvrcpRemoteControllerWeak mAvrcpRemoteControllerCb;
private Metadata mMetadata;
private int mTransportControlFlags;
private int mCurrentPlayState;
@@ -374,7 +375,9 @@ public final class Avrcp {
}
registerMediaPlayers();
mRemoteControllerCb = new RemoteControllerWeak(mHandler);
- mRemoteController = new RemoteController(mContext, mRemoteControllerCb);
+ mAvrcpRemoteControllerCb = new AvrcpRemoteControllerWeak(mHandler);
+ mRemoteController = new RemoteController(mContext, mRemoteControllerCb,
+ null, mAvrcpRemoteControllerCb);
mAudioManager.registerRemoteController(mRemoteController);
mRemoteController.setSynchronizationMode(RemoteController.POSITION_SYNCHRONIZATION_CHECK);
}
@@ -650,6 +653,15 @@ public final class Avrcp {
handler.obtainMessage(MSG_SET_METADATA, 0, 0, metadataEditor).sendToTarget();
}
}
+ }
+
+ private static class AvrcpRemoteControllerWeak implements
+ RemoteController.OnClientAvrcpUpdateListener {
+ private final WeakReference<Handler> mLocalHandler;
+
+ public AvrcpRemoteControllerWeak(Handler handler) {
+ mLocalHandler = new WeakReference<Handler>(handler);
+ }
@Override
public void onClientFolderInfoBrowsedPlayer(String stringUri) {
@@ -660,7 +672,7 @@ public final class Avrcp {
if (ExternalPath.length < 4) {
Log.d(TAG, "Wrong entries.");
handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, 0, 0, null)
- .sendToTarget();
+ .sendToTarget();
return;
}
Uri uri = Uri.parse(stringUri);
@@ -676,14 +688,14 @@ public final class Avrcp {
}
mMediaUri = uri;
if (handler != null) {
- // Don't send the complete path to CK as few gets confused by that
+ // Don't send the complete path to CK as few gets confused by that
// Send only the name of the root folder
handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, NUM_ROOT_ELEMENTS,
- 1, SplitPath).sendToTarget();
+ 1, SplitPath).sendToTarget();
}
} else {
handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, 0, 0, null)
- .sendToTarget();
+ .sendToTarget();
}
}
@@ -693,7 +705,7 @@ public final class Avrcp {
Handler handler = mLocalHandler.get();
if (handler != null) {
handler.obtainMessage(MSG_NOW_PLAYING_ENTRIES_RECEIVED, 0, 0,
- playList).sendToTarget();
+ playList).sendToTarget();
}
}
@@ -712,7 +724,7 @@ public final class Avrcp {
Handler handler = mLocalHandler.get();
if (handler != null) {
handler.obtainMessage(MSG_PLAY_ITEM_RESPONSE, 0, 0, new Boolean(success))
- .sendToTarget();
+ .sendToTarget();
}
}
}