urbandroid-team / dont-kill-my-app

Android vendors, don't kill my app!
Creative Commons Attribution 4.0 International
1.25k stars 2.68k forks source link

Motorola's "Improve battery while inactive" feature kills apps in background every hour no matter if the settings is enabled #1142

Open thunder-coding opened 2 months ago

thunder-coding commented 2 months ago

I'm not sure what Motorola devices are affected, but mine surely is. Moto G64 5G comes with the following packages installed by default:

package:com.motorola.batterycare.overlay.settings.cancunf.retin
package:com.motorola.batterycare.overlay.appside
package:com.motorola.batterycare
package:com.motorola.batterycare.overlay
package:com.motorola.android.providers.settings.overlay.batterycare.retin

This batterycare app adds another "Improve battery while inactive" option to Settings > Battery. July security patch for Android 14 which I recieved a few days ago seems to have introduced an update to Motorola's batterycare app as well. Earlier apps weren't killed, but after the update apps are killed every hh:00 (atleast Termux is killed, I didn't test for other apps).

A fix is to uninstall the com.motorola.batterycare package using adb: adb shell pm uninstall -k --user 0 com.motorola.batterycare, this also removes the additional "Improve battery while inactive" setting Settings > Battery. It doesn't matter if this switch is on or off, apps seem to get killed. Removing batterycare fixes the issue.

"Improve battery while inactive" setting in Settings > Battery when the app is installed (which by default it is: image

When batterycare is uninstalled using adb: Screenshot_20240804-095318

Output of adb shell dumpsys activity exit-info com.termux just after the app was killed:

ACTIVITY MANAGER PROCESS EXIT INFO (dumpsys activity exit-info)
Last Timestamp of Persistence Into Persistent Storage: 2024-08-03 22:48:35.917
  package: com.termux
    Historical Process Exit for uid=10352
        ApplicationExitInfo #0:
          timestamp=2024-08-03 23:00:00.301 pid=13779 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=100 pss=40MB rss=176MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #1:
          timestamp=2024-08-03 22:00:00.643 pid=31930 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=51MB rss=191MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #2:
          timestamp=2024-08-03 21:00:32.755 pid=5737 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=49MB rss=182MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #3:
          timestamp=2024-08-03 19:00:00.472 pid=6340 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=44MB rss=164MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #4:
          timestamp=2024-08-03 18:00:00.201 pid=26213 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=47MB rss=167MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #5:
          timestamp=2024-08-03 17:00:00.212 pid=3982 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=75MB rss=183MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #6:
          timestamp=2024-08-01 15:00:00.630 pid=21014 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=29MB rss=146MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #7:
          timestamp=2024-08-01 14:00:01.438 pid=19421 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=27MB rss=144MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #8:
          timestamp=2024-08-01 12:00:00.247 pid=11286 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=100 pss=81MB rss=199MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #9:
          timestamp=2024-08-01 09:00:00.259 pid=19718 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=28MB rss=145MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #10:
          timestamp=2024-08-01 08:09:43.176 pid=13282 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=100 pss=40MB rss=156MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #11:
          timestamp=2024-08-01 00:38:17.751 pid=9772 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=38MB rss=151MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #12:
          timestamp=2024-07-31 23:00:00.472 pid=6187 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=39MB rss=159MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #13:
          timestamp=2024-07-31 22:00:00.290 pid=21545 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=31MB rss=146MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #14:
          timestamp=2024-07-31 21:05:10.754 pid=9680 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=53MB rss=162MB description=SleepMode state=empty trace=null
        ApplicationExitInfo #15:
          timestamp=2024-07-31 20:00:00.435 pid=27045 realUid=10352 packageUid=10352 definingUid=10352 user=0
          process=com.termux reason=13 (OTHER KILLS BY SYSTEM) subreason=11 (KILL UID) status=0
          importance=125 pss=50MB rss=175MB description=SleepMode state=empty trace=null

I'll try to see if I can obtain some logcat output as well related to the same.

I was quite shocked when I found that it was indeed a motorola service that was messing with background apps, generally I've found Motorola to ship mostly stock android with an app that gives a really nice introduction to the phone and quick gestures.

rl885 commented 2 months ago

Hi @thunder-coding, I am just about to create a new section for Motorola phones, as the evidence is mounting... sad to see Motorola joining the dark side.

Do you have any experience with the Adaptive battery? Does it make any difference on this phone to have it on/off?

I have a report about "managing background apps" - the user was not able to locate this "optimization" in the layout, but found it with the search tool.