summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-05-04 09:45:52 -0700
committerRoman Birg <roman@cyngn.com>2016-05-04 19:32:53 -0700
commit689804aa2f03c723dae2f86a4af1e6440b9aed34 (patch)
treeeaafc1497e2d0bbb536f77a2247bb9ff5f89ed55
parent5ad461b642bdc82a4c86593b4b72267367c47ff6 (diff)
downloadandroid_packages_apps_Bluetooth-689804aa2f03c723dae2f86a4af1e6440b9aed34.tar.gz
android_packages_apps_Bluetooth-689804aa2f03c723dae2f86a4af1e6440b9aed34.tar.bz2
android_packages_apps_Bluetooth-689804aa2f03c723dae2f86a4af1e6440b9aed34.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> (cherry picked from commit 5aaa6203f124676957bf7acbc0d310d9b17f18fd)
-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();
}
}
}