Loading android/app/src/com/android/bluetooth/newavrcp/GPMWrapper.java +0 −14 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.bluetooth.avrcp; import android.media.MediaMetadata; import android.media.session.MediaSession; import android.util.Log; Loading @@ -29,8 +28,6 @@ class GPMWrapper extends MediaPlayerWrapper { private static final String TAG = "NewAvrcpGPMWrapper"; private static final boolean DEBUG = true; private static final String GPM_KEY = "com.google.android.music.mediasession.music_metadata"; @Override boolean isMetadataSynced() { // Check if currentPlayingQueueId is in the queue Loading @@ -57,15 +54,4 @@ class GPMWrapper extends MediaPlayerWrapper { return true; } @Override MediaMetadata queueItemToMetadata(MediaSession.QueueItem item) { MediaMetadata gpmdata = (MediaMetadata) item.getDescription().getExtras().get(GPM_KEY); MediaMetadata.Builder newMetadata = new MediaMetadata.Builder(gpmdata); newMetadata.putString(MediaMetadata.METADATA_KEY_TITLE, item.getDescription().getTitle().toString()); return newMetadata.build(); } } android/app/src/com/android/bluetooth/newavrcp/MediaPlayerWrapper.java +12 −8 Original line number Diff line number Diff line Loading @@ -96,8 +96,8 @@ class MediaPlayerWrapper { newWrapper.mPackageName = controller.getPackageName(); newWrapper.mLooper = looper; newWrapper.mCurrentData.queue = newWrapper.getQueue(); newWrapper.mCurrentData.metadata = newWrapper.getMetadata(); newWrapper.mCurrentData.queue = Util.toMetadataList(newWrapper.getQueue()); newWrapper.mCurrentData.metadata = Util.toMetadata(newWrapper.getMetadata()); newWrapper.mCurrentData.state = newWrapper.getPlaybackState(); return newWrapper; } Loading @@ -113,22 +113,23 @@ class MediaPlayerWrapper { return mPackageName; } List<MediaSession.QueueItem> getQueue() { protected List<MediaSession.QueueItem> getQueue() { return mMediaController.getQueue(); } MediaMetadata getMetadata() { protected MediaMetadata getMetadata() { return mMediaController.getMetadata(); } protected PlaybackState getPlaybackState() { return mMediaController.getPlaybackState(); } long getActiveQueueID() { if (mMediaController.getPlaybackState() == null) return -1; return mMediaController.getPlaybackState().getActiveQueueItemId(); } PlaybackState getPlaybackState() { return mMediaController.getPlaybackState(); } MediaData getCurrentMediaData() { return mCurrentData; Loading Loading @@ -303,7 +304,10 @@ class MediaPlayerWrapper { } } MediaData newData = new MediaData(getMetadata(), getPlaybackState(), getQueue()); MediaData newData = new MediaData( Util.toMetadata(getMetadata()), getPlaybackState(), Util.toMetadataList(getQueue())); if (newData.equals(mCurrentData)) { // This may happen if the controller is fully synced by the time the Loading android/app/src/com/android/bluetooth/newavrcp/helpers/Folder.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.avrcp; class Folder implements Cloneable { public String mediaId; public boolean isPlayable; public String title; Folder(String i, boolean p, String t) { mediaId = i; isPlayable = p; title = t; } @Override public Folder clone() { return new Folder(mediaId, isPlayable, title); } } android/app/src/com/android/bluetooth/newavrcp/helpers/ListItem.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.avrcp; class ListItem implements Cloneable { public boolean isFolder = false; public Folder folder; public Metadata song; ListItem(Folder f) { isFolder = true; folder = f; } ListItem(Metadata s) { isFolder = false; song = s; } @Override public ListItem clone() { if (isFolder) { return new ListItem(folder.clone()); } else { return new ListItem(song.clone()); } } } android/app/src/com/android/bluetooth/newavrcp/helpers/MediaData.java +3 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.bluetooth.avrcp; import android.media.MediaMetadata; import android.media.session.MediaSession; import android.media.session.PlaybackState; import java.util.List; Loading @@ -27,11 +25,11 @@ import java.util.Objects; * Helper class to transport metadata around AVRCP */ class MediaData { public List<MediaSession.QueueItem> queue; public List<Metadata> queue; public PlaybackState state; public MediaMetadata metadata; public Metadata metadata; MediaData(MediaMetadata m, PlaybackState s, List<MediaSession.QueueItem> q) { MediaData(Metadata m, PlaybackState s, List<Metadata> q) { metadata = m; state = s; queue = q; Loading Loading
android/app/src/com/android/bluetooth/newavrcp/GPMWrapper.java +0 −14 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.bluetooth.avrcp; import android.media.MediaMetadata; import android.media.session.MediaSession; import android.util.Log; Loading @@ -29,8 +28,6 @@ class GPMWrapper extends MediaPlayerWrapper { private static final String TAG = "NewAvrcpGPMWrapper"; private static final boolean DEBUG = true; private static final String GPM_KEY = "com.google.android.music.mediasession.music_metadata"; @Override boolean isMetadataSynced() { // Check if currentPlayingQueueId is in the queue Loading @@ -57,15 +54,4 @@ class GPMWrapper extends MediaPlayerWrapper { return true; } @Override MediaMetadata queueItemToMetadata(MediaSession.QueueItem item) { MediaMetadata gpmdata = (MediaMetadata) item.getDescription().getExtras().get(GPM_KEY); MediaMetadata.Builder newMetadata = new MediaMetadata.Builder(gpmdata); newMetadata.putString(MediaMetadata.METADATA_KEY_TITLE, item.getDescription().getTitle().toString()); return newMetadata.build(); } }
android/app/src/com/android/bluetooth/newavrcp/MediaPlayerWrapper.java +12 −8 Original line number Diff line number Diff line Loading @@ -96,8 +96,8 @@ class MediaPlayerWrapper { newWrapper.mPackageName = controller.getPackageName(); newWrapper.mLooper = looper; newWrapper.mCurrentData.queue = newWrapper.getQueue(); newWrapper.mCurrentData.metadata = newWrapper.getMetadata(); newWrapper.mCurrentData.queue = Util.toMetadataList(newWrapper.getQueue()); newWrapper.mCurrentData.metadata = Util.toMetadata(newWrapper.getMetadata()); newWrapper.mCurrentData.state = newWrapper.getPlaybackState(); return newWrapper; } Loading @@ -113,22 +113,23 @@ class MediaPlayerWrapper { return mPackageName; } List<MediaSession.QueueItem> getQueue() { protected List<MediaSession.QueueItem> getQueue() { return mMediaController.getQueue(); } MediaMetadata getMetadata() { protected MediaMetadata getMetadata() { return mMediaController.getMetadata(); } protected PlaybackState getPlaybackState() { return mMediaController.getPlaybackState(); } long getActiveQueueID() { if (mMediaController.getPlaybackState() == null) return -1; return mMediaController.getPlaybackState().getActiveQueueItemId(); } PlaybackState getPlaybackState() { return mMediaController.getPlaybackState(); } MediaData getCurrentMediaData() { return mCurrentData; Loading Loading @@ -303,7 +304,10 @@ class MediaPlayerWrapper { } } MediaData newData = new MediaData(getMetadata(), getPlaybackState(), getQueue()); MediaData newData = new MediaData( Util.toMetadata(getMetadata()), getPlaybackState(), Util.toMetadataList(getQueue())); if (newData.equals(mCurrentData)) { // This may happen if the controller is fully synced by the time the Loading
android/app/src/com/android/bluetooth/newavrcp/helpers/Folder.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.avrcp; class Folder implements Cloneable { public String mediaId; public boolean isPlayable; public String title; Folder(String i, boolean p, String t) { mediaId = i; isPlayable = p; title = t; } @Override public Folder clone() { return new Folder(mediaId, isPlayable, title); } }
android/app/src/com/android/bluetooth/newavrcp/helpers/ListItem.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.avrcp; class ListItem implements Cloneable { public boolean isFolder = false; public Folder folder; public Metadata song; ListItem(Folder f) { isFolder = true; folder = f; } ListItem(Metadata s) { isFolder = false; song = s; } @Override public ListItem clone() { if (isFolder) { return new ListItem(folder.clone()); } else { return new ListItem(song.clone()); } } }
android/app/src/com/android/bluetooth/newavrcp/helpers/MediaData.java +3 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.bluetooth.avrcp; import android.media.MediaMetadata; import android.media.session.MediaSession; import android.media.session.PlaybackState; import java.util.List; Loading @@ -27,11 +25,11 @@ import java.util.Objects; * Helper class to transport metadata around AVRCP */ class MediaData { public List<MediaSession.QueueItem> queue; public List<Metadata> queue; public PlaybackState state; public MediaMetadata metadata; public Metadata metadata; MediaData(MediaMetadata m, PlaybackState s, List<MediaSession.QueueItem> q) { MediaData(Metadata m, PlaybackState s, List<Metadata> q) { metadata = m; state = s; queue = q; Loading