Loading android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java +0 −10 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.os.Looper; import android.os.SystemProperties; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import com.android.bluetooth.BluetoothEventLogger; import com.android.bluetooth.Utils; Loading Loading @@ -672,14 +671,6 @@ public class MediaPlayerList { sendMediaUpdate(data); } // TODO (apanicke): Add logging for media key events in dumpsys public void sendMediaKeyEvent(int key, boolean pushed) { d("sendMediaKeyEvent: key=" + key + " pushed=" + pushed); int action = pushed ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP; KeyEvent event = new KeyEvent(action, AvrcpPassthrough.toKeyCode(key)); mAudioManager.dispatchMediaKeyEvent(event); } private void sendFolderUpdate(boolean availablePlayers, boolean addressedPlayers, boolean uids) { d("sendFolderUpdate"); Loading Loading @@ -961,7 +952,6 @@ public class MediaPlayerList { sb.append("\n"); mAudioPlaybackStateLogger.dump(sb); sb.append("\n"); // TODO (apanicke): Add last sent data } private static void e(String message) { Loading android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java +17 −7 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.UserManager; import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import com.android.bluetooth.BluetoothEventLogger; import com.android.bluetooth.BluetoothMetricsProto; Loading Loading @@ -451,15 +452,24 @@ public class AvrcpTargetService extends ProfileService { mMediaPlayerList.playItem(playerId, nowPlaying, mediaId); } // TODO (apanicke): Handle key events here in the service. Currently it was more convenient to // handle them there but logically they make more sense handled here. void sendMediaKeyEvent(int event, boolean pushed) { void sendMediaKeyEvent(int key, boolean pushed) { BluetoothDevice activeDevice = getA2dpActiveDevice(); MediaPlayerWrapper player = mMediaPlayerList.getActivePlayer(); mMediaKeyEventLogger.logd(DEBUG, TAG, "getMediaKeyEvent:" + " device=" + activeDevice + " event=" + event + " pushed=" + pushed + " to " + (player == null ? null : player.getPackageName())); mMediaPlayerList.sendMediaKeyEvent(event, pushed); mMediaKeyEventLogger.logd( DEBUG, TAG, "sendMediaKeyEvent:" + " device=" + activeDevice + " key=" + key + " pushed=" + pushed + " to " + (player == null ? null : player.getPackageName())); int action = pushed ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP; KeyEvent event = new KeyEvent(action, AvrcpPassthrough.toKeyCode(key)); mAudioManager.dispatchMediaKeyEvent(event); } void setActiveDevice(BluetoothDevice device) { Loading android/app/src/com/android/bluetooth/audio_util/helpers/AvrcpPassthrough.java→android/app/src/com/android/bluetooth/avrcp/helpers/AvrcpPassthrough.java +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ package com.android.bluetooth.audio_util; package com.android.bluetooth.avrcp; import android.bluetooth.BluetoothAvrcp; import android.view.KeyEvent; Loading android/app/tests/unit/src/com/android/bluetooth/audio_util/AvrcpPassthroughTest.java→android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java +1 −1 Original line number Diff line number Diff line package com.android.bluetooth.audio_util; package com.android.bluetooth.avrcp; import static com.google.common.truth.Truth.assertThat; Loading Loading
android/app/src/com/android/bluetooth/audio_util/MediaPlayerList.java +0 −10 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.os.Looper; import android.os.SystemProperties; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import com.android.bluetooth.BluetoothEventLogger; import com.android.bluetooth.Utils; Loading Loading @@ -672,14 +671,6 @@ public class MediaPlayerList { sendMediaUpdate(data); } // TODO (apanicke): Add logging for media key events in dumpsys public void sendMediaKeyEvent(int key, boolean pushed) { d("sendMediaKeyEvent: key=" + key + " pushed=" + pushed); int action = pushed ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP; KeyEvent event = new KeyEvent(action, AvrcpPassthrough.toKeyCode(key)); mAudioManager.dispatchMediaKeyEvent(event); } private void sendFolderUpdate(boolean availablePlayers, boolean addressedPlayers, boolean uids) { d("sendFolderUpdate"); Loading Loading @@ -961,7 +952,6 @@ public class MediaPlayerList { sb.append("\n"); mAudioPlaybackStateLogger.dump(sb); sb.append("\n"); // TODO (apanicke): Add last sent data } private static void e(String message) { Loading
android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java +17 −7 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.UserManager; import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import com.android.bluetooth.BluetoothEventLogger; import com.android.bluetooth.BluetoothMetricsProto; Loading Loading @@ -451,15 +452,24 @@ public class AvrcpTargetService extends ProfileService { mMediaPlayerList.playItem(playerId, nowPlaying, mediaId); } // TODO (apanicke): Handle key events here in the service. Currently it was more convenient to // handle them there but logically they make more sense handled here. void sendMediaKeyEvent(int event, boolean pushed) { void sendMediaKeyEvent(int key, boolean pushed) { BluetoothDevice activeDevice = getA2dpActiveDevice(); MediaPlayerWrapper player = mMediaPlayerList.getActivePlayer(); mMediaKeyEventLogger.logd(DEBUG, TAG, "getMediaKeyEvent:" + " device=" + activeDevice + " event=" + event + " pushed=" + pushed + " to " + (player == null ? null : player.getPackageName())); mMediaPlayerList.sendMediaKeyEvent(event, pushed); mMediaKeyEventLogger.logd( DEBUG, TAG, "sendMediaKeyEvent:" + " device=" + activeDevice + " key=" + key + " pushed=" + pushed + " to " + (player == null ? null : player.getPackageName())); int action = pushed ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP; KeyEvent event = new KeyEvent(action, AvrcpPassthrough.toKeyCode(key)); mAudioManager.dispatchMediaKeyEvent(event); } void setActiveDevice(BluetoothDevice device) { Loading
android/app/src/com/android/bluetooth/audio_util/helpers/AvrcpPassthrough.java→android/app/src/com/android/bluetooth/avrcp/helpers/AvrcpPassthrough.java +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ package com.android.bluetooth.audio_util; package com.android.bluetooth.avrcp; import android.bluetooth.BluetoothAvrcp; import android.view.KeyEvent; Loading
android/app/tests/unit/src/com/android/bluetooth/audio_util/AvrcpPassthroughTest.java→android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java +1 −1 Original line number Diff line number Diff line package com.android.bluetooth.audio_util; package com.android.bluetooth.avrcp; import static com.google.common.truth.Truth.assertThat; Loading