Commit 9b07d71f by bachinger Committed by Ian Baker

Remove all handler messages when controller is released

Issue: androidx/media#74
PiperOrigin-RevId: 448205908
parent efb49f28
...@@ -89,6 +89,8 @@ ...@@ -89,6 +89,8 @@
([#59](https://github.com/androidx/media/pull/59)) ([#59](https://github.com/androidx/media/pull/59))
* Update session position info on timeline * Update session position info on timeline
change([#51](https://github.com/androidx/media/issues/51)) change([#51](https://github.com/androidx/media/issues/51))
* Fix NPE in MediaControllerImplBase after releasing controller
([#74](https://github.com/androidx/media/issues/74))
* Data sources: * Data sources:
......
...@@ -309,6 +309,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; ...@@ -309,6 +309,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
serviceConnection = null; serviceConnection = null;
} }
connectedToken = null; connectedToken = null;
flushCommandQueueHandler.removeCallbacksAndMessages(/* token= */ null);
this.iSession = null; this.iSession = null;
controllerStub.destroy(); controllerStub.destroy();
if (iSession != null) { if (iSession != null) {
...@@ -3046,9 +3047,9 @@ import org.checkerframework.checker.nullness.qual.NonNull; ...@@ -3046,9 +3047,9 @@ import org.checkerframework.checker.nullness.qual.NonNull;
} }
public void sendFlushCommandQueueMessage() { public void sendFlushCommandQueueMessage() {
if (iSession != null && !hasMessages(MSG_FLUSH_COMMAND_QUEUE)) {
// Send message to notify the end of the transaction. It will be handled when the current // Send message to notify the end of the transaction. It will be handled when the current
// looper iteration is over. // looper iteration is over.
if (!hasMessages(MSG_FLUSH_COMMAND_QUEUE)) {
sendEmptyMessage(MSG_FLUSH_COMMAND_QUEUE); sendEmptyMessage(MSG_FLUSH_COMMAND_QUEUE);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment