Mucke sometimes gets killed by the ActivityManager for using too much CPU
I haven't found a pattern on when this happens yet. Here is the logcat output:
01-05 19:48:09.072 1519 1626 I ActivityManager: Start proc 14062:rocks.mucke/u0a426 for pre-top-activity {rocks.mucke/com.ryanheise.audioservice.AudioServiceActivity}
01-05 19:48:26.246 1519 7696 E ClipboardService: Denying clipboard access to rocks.mucke, application is not in focus nor is it a system service for user 0
01-05 19:52:13.593 1519 6358 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=rocks.mucke/com.ryanheise.audioservice.AudioServiceActivity bnds=[35,1171][237,1515]} from uid 10170
01-05 19:52:13.616 1519 6358 E ClipboardService: Denying clipboard access to rocks.mucke, application is not in focus nor is it a system service for user 0
01-05 19:52:41.144 1519 8816 W ActivityManager: Background started FGS: Disallowed [callingPackage: rocks.mucke; callingUid: 10426; uidState: CAC ; intent: Intent { cmp=rocks.mucke/com.ryanheise.audioservice.AudioService }; code:DENIED; tempAllowListReason:<null>; targetSdkVersion:31; callerTargetSdkVersion:31; startForegroundCount:2; bindFromPackage:null]
01-05 19:52:41.147 1519 8816 W ActivityManager: startForegroundService() not allowed due to mAllowStartForeground false: service rocks.mucke/com.ryanheise.audioservice.AudioService
01-05 19:56:13.059 1829 1829 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke
01-05 19:56:13.293 8844 9032 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke
01-05 19:56:25.288 1829 1829 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke
01-05 19:56:25.532 8844 9032 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke
01-05 19:59:52.440 1829 1829 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke
01-05 19:59:52.688 8844 9032 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke
01-05 20:00:04.182 1829 1829 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke
01-05 20:00:04.433 8844 9032 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke
01-05 20:03:23.626 1829 1829 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke
01-05 20:03:23.882 8844 9032 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke
01-05 20:03:27.518 1519 1625 I ActivityManager: Killing 14062:rocks.mucke/u0a426 (adj 900): excessive cpu 52860 during 300071 dur=664073 limit=10
01-05 20:03:27.695 1519 1923 V MediaSessionRecord: Removing dead callback in pushSessionDestroyed, this=rocks.mucke/media-session (userId=0), callback package=rocks.mucke, exception=android.os.DeadObjectException
01-05 20:03:27.696 1519 1823 I WindowManager: WIN DEATH: Window{6e38f83 u0 rocks.mucke/com.ryanheise.audioservice.AudioServiceActivity}
01-05 20:03:27.696 8844 8844 D MediaTimeout: Session destroyed for 0|rocks.mucke|1124|null|10426
01-05 20:03:27.697 1519 1823 W InputManager-JNI: Input channel object '6e38f83 rocks.mucke/com.ryanheise.audioservice.AudioServiceActivity (client)' was disposed without first being removed with the input manager!
01-05 20:03:27.698 1829 1829 W AudioMediaPlayerWrapper: The session was destroyed rocks.mucke
01-05 20:03:27.698 1829 1829 D MediaPlayerList: sessionUpdatedCallback(): packageName: rocks.mucke
01-05 20:03:27.699 1829 1829 D MediaPlayerList: Removing media player rocks.mucke
01-05 20:03:27.699 1829 1829 D MediaPlayerList: rocks.mucke doesn't have a browse service. Recycle player ID.
01-05 20:03:27.707 1519 1624 W UsageStatsService: Unexpected activity event reported! (rocks.mucke/com.ryanheise.audioservice.AudioServiceActivity event : 23 instanceId : 188649197)
01-05 20:03:27.903 8844 9032 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke
Ok, this looks bad. I had random crashes before, but the last time must have been in 2021 I think. When I had the issues, I couldn't figure out a pattern either. Happened with long and short queues, after short and long runtimes, and with random songs. For me, the issues suddenly stopped with a dependency update (I think).
Since I haven't had any crashes for the whole last year, I'm not certain how to reproduce this issue. My best guess for a solution would be to look into Android battery settings and disable optimization for mucke.
Do you have a rough estimate on how often the app crashes, e.g. multiple times a day or every few days? To further investigate this issue, I'd probably have to set up more comprehensive logging and enable an easy way for you to share the logs with me.
Feel free to add new logcat outputs when the app crashes again. Maybe we can find a pattern there.
It happens at random. I've had only ~10 crashes in my time using Mucke and I've been using it since November.
Hm, ok. That's not too bad, but still annoying. What phone and OS do you use? And can you check the permission of the app?
01-05 19:52:41.144 1519 8816 W ActivityManager: Background started FGS: Disallowed ...
This line doesn't look good to me. Maybe the permission to run a foreground service is missing in your case (for whatever reason).
Hmm weird. I'm using Android 12 (LineageOS). The app permission screen shows me "no permissions denied". I've had battery optimizations on default. I will see if it happens again with unrestricted battery usage.
I have a new phone now and I'm still getting crashes. It's a OnePlus 8T with /e/ OS 1.9 (Android 12). /e/ OS is a fork of Lineage OS so maybe it's an issue related to Lineage OS. Here's the log:
04-22 12:50:02.835 1434 1628 W NotifHistoryProto: notification package name (rocks.mucke.github) not found in string cache
04-22 12:50:02.835 1434 1628 W NotifHistoryProto: notification channel name (mucke) not found in string cache
04-22 12:50:02.835 1434 1628 W NotifHistoryProto: notification channel id (rocks.mucke.github.channel) not found in string cache
04-22 12:51:53.832 1434 1938 D MediaSessionService: Adjusting rocks.mucke.github/media-session (userId=0) by -1. flags=4096, suggestedStream=-2147483648, preferSuggestedStream=false
04-22 12:51:54.479 1434 1938 D MediaSessionService: Adjusting rocks.mucke.github/media-session (userId=0) by 0. flags=4096, suggestedStream=-2147483648, preferSuggestedStream=false
04-22 12:51:55.992 22365 22365 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke.github
04-22 12:51:56.205 21814 21835 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke.github
04-22 12:52:46.395 22365 22365 V AudioMediaPlayerWrapper: trySendMediaUpdate(): Metadata has been updated for rocks.mucke.github
04-22 12:52:46.624 21814 21835 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke.github
04-22 12:55:41.740 1434 1637 I ActivityManager: Killing 22443:rocks.mucke.github/u0a219 (adj 940): excessive cpu 30500 during 300003 dur=648075 limit=10
04-22 12:55:41.801 22365 22365 D MediaPlayerList: onActiveSessionsChanged: controller: rocks.mucke.github
04-22 12:55:41.801 22365 22365 D MediaPlayerList: Already have a controller for the player: rocks.mucke.github, updating instead
04-22 12:55:41.815 1434 9041 I WindowManager: WIN DEATH: Window{50917de u0 rocks.mucke.github/com.ryanheise.audioservice.AudioServiceActivity}
04-22 12:55:41.815 1434 9041 W InputManager-JNI: Input channel object '50917de rocks.mucke.github/com.ryanheise.audioservice.AudioServiceActivity (client)' was disposed without first being removed with the input manager!
04-22 12:55:41.817 1434 2080 V MediaSessionRecord: Removing dead callback in pushSessionDestroyed, this=rocks.mucke.github/media-session (userId=0), callback package=rocks.mucke.github, exception=android.os.DeadObjectException
04-22 12:55:41.817 22365 22365 I MediaPlayerList: onMediaKeyEventSessionChanged: packageName=rocks.mucke.github
04-22 12:55:41.817 22365 22365 W MediaPlayerList: rocks.mucke.github is already the active player
04-22 12:55:41.817 21814 21814 D MediaTimeout: Session destroyed for 0|rocks.mucke.github|1124|null|10219
04-22 12:55:41.818 22365 22365 W AudioMediaPlayerWrapper: The session was destroyed rocks.mucke.github
04-22 12:55:41.818 22365 22365 D MediaPlayerList: sessionUpdatedCallback(): packageName: rocks.mucke.github
04-22 12:55:41.819 22365 22365 D MediaPlayerList: Removing media player rocks.mucke.github
04-22 12:55:41.819 22365 22365 D MediaPlayerList: rocks.mucke.github doesn't have a browse service. Recycle player ID.
04-22 12:55:41.855 1434 1636 W UsageStatsService: Unexpected activity event reported! (rocks.mucke.github/com.ryanheise.audioservice.AudioServiceActivity event : 23 instanceId : 156875672)
04-22 12:55:41.856 21814 21835 D PeopleSpaceWidgetMgr: Sbn doesn't contain valid PeopleTileKey: null/0/rocks.mucke.github