Remove callback upon MediaSession#release
This change prevents all callbacks from MediaSession after the app calls MediaSession#release. Concretely, this change fixes flakiness in MediaControllerTest, where the callback implementation tries to access the media session after its corresponding field has been set to null. Bug: 294178159 Test: atest CtsMediaBetterTogetherTestCases Change-Id: I112fa5df6aafdb2774ed65c2d08ab1eb680e6b47
This commit is contained in:
@@ -442,6 +442,7 @@ public final class MediaSession {
|
||||
* but it must be released if your activity or service is being destroyed.
|
||||
*/
|
||||
public void release() {
|
||||
setCallback(null);
|
||||
try {
|
||||
mBinder.destroySession();
|
||||
} catch (RemoteException e) {
|
||||
|
||||
Reference in New Issue
Block a user