What is Android process "ash" & how to prevent it from hibernating my app? (Android 7.0 doze mode)

862 views Asked by At

I wrote an app that needs to wake up once per minute as long as it's running using a broadcast receiver declared in the manifest and triggered by AlarmManager.setAlarmClock() since it's the only exact solution that seems to be working on Android 7+ without restrictions on alarm repetition.

I feel like I've followed literally every hint on the net (and especially SO) to keep my app running, but sooner or later it is moved to doze or hibernation state, even though I whitelisted my app using Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS and I'm using a wake lock inside the receiver when scheduling the next alarm.

The process responsible for "freezing" my app is "ash". Where can I find more information on this process? Is it specific to the manufacturer's OS?

How do I disable dozing / hibernating of my app? I cannot for the life of me get this darn app to keep running continuously. Any hint is appreciated!

The device used is a Huawei P8 lite 2017 with Android 7.0. Since the source code has gotten fairly complex, plus I think I'm doing everything right code-wise, I'm not posting any code here right now. (I will, however, provide the corresponding code samples on request.)

The matter at hand seems to be a general problem of the OS itself, since I read about many people not getting this to work. (Which is ridiculous ... trading the abilitiy to set exact timers for slightly improved battery life. WHY, Google?)

The following catlog output shows the action of "ash"; in this case, it froze my app for about half an hour, after having worked properly for about half an hour also. I guess when I turned on and unlocked the phone again, the app continued working again.

06-06 22:37:33.122 I/ash     ( 1772): de.paulwilhelm.limon send broadcast: notify package: de.paulwilhelm.limon, pid: -1
06-06 22:37:33.122 I/ash     ( 1772): screen off de.paulwilhelm.limon H to D, reason:bc_notify_
06-06 22:37:33.122 I/ash     ( 1772): de.paulwilhelm.limon { hibernation duration=60527 } transition to: doze reason:bc_notify_
06-06 22:37:33.155 I/ash     ( 1772): Unfreeze de.paulwilhelm.limon OK !
06-06 22:37:33.160 I/ash     ( 1772): unproxy de.paulwilhelm.limon broadcast OK !
06-06 22:37:33.167 I/ash     ( 1772): Unpending de.paulwilhelm.limon alarm OK !
06-06 22:37:33.169 I/ash     ( 1772): unproxy app:de.paulwilhelm.limon,uid:10118,result:true
06-06 22:37:33.175 I/ash     ( 1772): front app: de.paulwilhelm.limon goes to H
06-06 22:37:33.176 I/ash     ( 1772): ignore front app :de.paulwilhelm.limon screen off:523907ms
06-06 22:37:33.176 I/ash     ( 1772): de.paulwilhelm.limon  is front app
06-06 22:37:33.176 I/ash     ( 1772): ignore front app :de.paulwilhelm.limon screen off:523907ms
06-06 22:37:33.179 I/ash     ( 1772): de.paulwilhelm.limon { doze duration=10 } transition to: hibernation reason:
06-06 22:37:33.180 I/ash     ( 1772): Pending de.paulwilhelm.limon alarm OK !
06-06 22:37:33.181 I/ash     ( 1772): proxy de.paulwilhelm.limon broadcast OK !
06-06 22:37:33.183 I/ash     ( 1772): proxy app:de.paulwilhelm.limon,uid:10118,result:true
06-06 22:37:33.184 I/ash     ( 1772): Freeze de.paulwilhelm.limon OK !
06-06 22:37:33.185 I/ash     ( 1772): add listener de.paulwilhelm.limon net packet OK !,uid:10118
06-06 22:37:33.188 I/ash     ( 1772): has wakelock app: de.paulwilhelm.limon, uid: 10118
1

There are 1 answers

1
Furkan Yurdakul On

As a HUAWEI user myself, I also suffered this process "ash" and hibernation mode. What definitely extended (or probably even solved) is using a foreground service (which is probably what you are doing), raising the importance of your notification to IMPORTANCE_MAX, and most importantly, let HUAWEI manage your app's power manually, by going under Settings --> Battery --> Launch. Find your app there, click on it, open every option (which also includes "Run in background") and let it say "Manage manually".

This is what solved my issue, hopefully it will solve yours too.