3

Just yesterday I bought noname device called Hisense U30 with Android 9 and it works bad. It killing background apps VERY AGGRESSIVELY. Like I start music in Yandex.Music (russian analog Spotify), switch off screen and in 1-2 minutes something kills player. It kills everything.

What I already tried:

  1. Disable every preinstalled battery savers;
  2. Disable battery optimization for certain apps;
  3. Tried everything from Background apps get killed (by something other than battery optimization)

Nothing. Player still get killed. OS looks pretty close to stock Android (at least not much preinstalled apps). So my guess is that OS is somehow incorrectly configured.

I looked into logcat and what I got:

  1. It starts with MemoryDetectService like this
MemoryDetectService: onStartCommand()---> action = screen_off_app_clear
MemoryDetectService: AutoClearState -----> begin

  1. Then this service scan through all (I presume) running apps and find mine player too
MemoryDetectService: getRunningAppPackageName()---> begin
...
MemoryDetectService: RunningAppProcessInfo: cur.processName = ru.yandex.music:Metrica, pkgName = ru.yandex.music, uid = 10123, uid % 10000 = 123
MemoryDetectService: RunningPkgList---> pkgName = ru.yandex.music
...
MemoryDetectService: getCurrentHomePackages(): recentTasks = ru.yandex.music
  1. And then, SOMEHOW, decide to kill my player
MemoryDetectService: mRunningPkgList: pkgName = ru.yandex.music
MemoryDetectService: mNeedForceStopPkgList---> pkgName = ru.yandex.music
...
MemoryDetectService: currentPkgName---> ru.yandex.music
MemoryDetectService: hasPkgNeedClean(): currentPkgName(New Method: mRecent2PkgList.get(0)) = ru.yandex.music
MemoryDetectService: getWhiteListFromFile: String = null
MemoryDetectService: hasPkgNeedClean(): memBefore = 3894, mWhiteListStr = 
  1. And then it start to kill processes
MemoryDetectService: clearMemory-----> begin
MemoryDetectService: clearMemory(): sendBroadcast hmct.intent.action.CLEAR_CACHE: null;
MemoryDetectService: screen on cleaning open = true ,  screen off cleaning open = true
MemoryDetectService: killPackage---> begin
...
MemoryDetectService: forceStopPackage---> begin
MemoryDetectService: clearMemory(forceStopPackage): isScreenOn = false
ActivityManager: Force stopping ru.yandex.music appid=10123 user=0: from pid 1972
ANDR-IOP: IOP HAL: Received pkg_name = ru.yandex.music pid = 0
ActivityManager: kill app.info.packageName=ru.yandex.music minOomAdj=-10000 packageName=ru.yandex.music
ActivityManager: kill app.info.packageName=ru.yandex.music minOomAdj=-10000 packageName=ru.yandex.music
ActivityManager: Killing 6673:ru.yandex.music:Metrica/u0a123 (adj 200): stop ru.yandex.music
ANDR-IOP: IOP HAL: Received pkg_name = ru.yandex.music:Metrica pid = 0
ActivityManager: Scheduling restart of crashed service ru.yandex.music/com.yandex.metrica.MetricaService in 20937ms
Zygote  : Process 7489 exited due to signal (9)
...
ActivityManager: Killing 6616:ru.yandex.music/u0a123 (adj 200): stop ru.yandex.music
ANDR-IOP: IOP HAL: Received pkg_name = ru.yandex.music pid = 0
libprocessgroup: kill(-7799, 9) failed: No such process
ActivityManager: Scheduling restart of crashed service ru.yandex.music/.common.service.player.MediaSessionService in 20929ms
ActivityManager: Scheduling restart of crashed service ru.yandex.music/.common.service.player.AppForegrounderService in 20929ms
...
ActivityManager:   Force finishing activity ActivityRecord{ba18734 u0 ru.yandex.music/.main.MainScreenActivity t248}
MemoryDetectService: setPackageAliveState start----packageName = ru.yandex.music
MemoryDetectService: setPackageAliveState end----packageName = ru.yandex.music, aInfo.processName = ru.yandex.music
MemoryDetectService: mClearAppList---> pkgName = ru.yandex.music, mClearApp++--->1

Any idea how to fix this?

P.S. AFAIK there is no other ROM like Linage OS for my phone, and I am not a big fan of root cuz this will break Google Pay, so it would be great to deal with it without rooting device.

Update 1

I looked up for this service in dumpsys, and I have an idea: disable this service via adb shell am stopservice com.android.systemui/com.hmct.systemui.taskmanager.detectmemory.MemoryDetectService. Will be back with results.

2

As I mentioned, I tried to disable MemoryDetectService via adb (adb shell am stopservice com.android.systemui/com.hmct.systemui.taskmanager.detectmemory.MemoryDetectService), and it looks like it worked. One day, none of my apps is killed while I using them, battery drain is the same (~25% from max yesterday, ~25% today).

From the name of the service I assume that this is service, written by Hisense themselves (if they even can modify SystemUI).

However, still few concerns:

  1. Everything looks fine, but disable some system service is dangerous, so need to be prepared for any s**t;
  2. I'm not sure, will this service remain disabled, if I gonna reboot my phone.

Anyway, I will consider this problem solved.

UPDATE

Yes, as I expected, this fix is not persist after reboot, but I managed to write bash script and run it manually after each reboot via Termux:

#!/bin/bash

am stopservice com.android.systemui/com.hmct.systemui.taskmanager.detectmemory.MemoryDetectService

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.