Easily Restart MacroDroid

ksec

New member
I'd like a simple way (like a tile on the home view) to completely restart MacroDroid, including related services (accessibility).

I'm asking this as a workaround for a battery-drain issue that I don't have any other solution for. I'd be happy to consider another solution, but I'd imagine it could be pretty difficult to trace the actual cause.

Background:
Right after installing v5.35 (July 2023), my battery's been draining faster when the screen is off. I can tell because I have an app that tracks battery usage history. Original drain was about 25 mA, new drain was 48-50 mA (about twice as much). I haven't made any significant changes to my macros recently, and the increase in drain was large and very sudden.

I checked for CPU wakelocks, and though MacroDroid woke the phone from deep sleep very often (thousands of times), the total time spent was relatively short (about 8 minutes over the course of a 16h day).
Another symptom seemed to be that my phone would get warmer than previously, even during extended screen-off periods. An app reported battery temp was 35 C which is not normal

Key discovery:
I had the idea to try restarting MacroDroid once a day (right before bed). After starting this practice, screen-off drain went back to ~25 mA.
Some times I need to restart MD during the day when I notice the screen-off drain / battery temp increasing - it noticeably solves both issues.
I haven't gathered enough "data" to know how v5.36 is behaving, but it seems like the problem still exists, possibly to a lesser degree.

My shot-in-the-dark guess is that there's some kind of resource leak that gets worse over time. I realize how difficult it can be to uncover the root cause of issues like this, which is why I'm asking for this workaround.

Why can't I just reboot? Because this takes my phone out of commission for several minutes while my phone boots up, and uses up even more battery power.

How I currently restart MacroDroid:
1. Disable MD accessibility service
2. Disable MD device admin access (needed so force stop is allowed)
3. Disable MD via home screen toggle (not sure if this is needed, but I don't want to interrupt MD if it's doing something)
4. Force stop MD
5. Enable MD accessibility service
6. Enable MD device admin access
7. Enable MD via home screen toggle

I have no idea how many of the above steps are necessary, but even trying to track this problem down has been exhausting - all I know is that this method works.
➡️ Having a 1 step process to do this would be a huge time saver. ⬅️

My device info:
Pixel 3a, Android 11

My phone's free memory, when I check it, tends to be about 3.1 GB (out of 3.8).

MD's memory usage seems to grow from 76 MB to 150 MB over the course of the day (I don't have detailed stats, only the average & maximum). This isn't a lot compared to some other apps, but I wonder about the increase.
 
Top