Fixed
Status Update
Comments
su...@google.com <su...@google.com>
su...@google.com <su...@google.com> #2
Jeewna, do you have any updates?
su...@google.com <su...@google.com> #3
For work load balancing, passing this to gyumin@.
kl...@google.com <kl...@google.com> #4
Is there any update on this?
su...@google.com <su...@google.com> #5
Is there any update on this?
gy...@google.com <gy...@google.com>
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit ccc903ffe73241ef16b77f1303469e4908b2aa96
Author: Gyumin Sim <gyumin@google.com>
Date: Tue Aug 17 21:54:37 2021
Don't start MediaSessionService as foreground for ACTION_STOP
Bug: 148011394
Relnote: Fixed ANR when dismissing media notification
Test: Manually tested with integration testapp
Change-Id: Ifdcc20bba122c235cd977a5049ce84cecc2f55b1
M media2/media2-session/src/main/java/androidx/media2/session/MediaNotificationHandler.java
https://android-review.googlesource.com/1797988
Branch: androidx-main
commit ccc903ffe73241ef16b77f1303469e4908b2aa96
Author: Gyumin Sim <gyumin@google.com>
Date: Tue Aug 17 21:54:37 2021
Don't start MediaSessionService as foreground for ACTION_STOP
Bug: 148011394
Relnote: Fixed ANR when dismissing media notification
Test: Manually tested with integration testapp
Change-Id: Ifdcc20bba122c235cd977a5049ce84cecc2f55b1
M media2/media2-session/src/main/java/androidx/media2/session/MediaNotificationHandler.java
Description
When I dismiss the default notification created by MediaNotificationHandler, I get the following ANR:
Context.startForegroundService() did not then call Service.startForeground()
As far as I can tell the problem is that notification is created with a PendingIntent#getForegroundService() for delete intent, so after I dismiss the notification the service is started again as a foreground, but since the command is ACTION_STOP, nothing happens afterwards and we get the ANR.
If I understood correctly, the ACTION_PAUSE is handled correctly, so that its pending intent will start a regular service instead of a foreground one.
MediaNotificationHandler#206
if (Build.VERSION.SDK_INT >= 26 && action != ACTION_PAUSE) {
return PendingIntent.getForegroundService(
mServiceInstance, keyCode /* requestCode */, intent, 0 /* flags */);
} else {
return PendingIntent.getService(
mServiceInstance, keyCode /* requestCode */, intent, 0 /* flags */);
}
So I guess we should do the same for ACTION_STOP.