Hi, posting here again, as I couldn't find the answer to this searching around in the forum. As I mentioned in the previous topic I made, I recently upgraded from Android 8 to 9. In the previous version, I found out that everytime I removed an app from the multitask, an Announcement was made by the system, which could be detected by trigger UI Event, and due to its straight forward format ("[app_name] dismissed"), I could exactly know which app was removed. This served for me the purpose to know when certain apps I opened before that required to disable root access, were no longer running in the background, and so allowed to, after closing them, enabling root access again.
Now in Android 9, that announcement is no longer made or it's just empty, and other UI Events don't help either. So I guess I had to look for another and maybe better method. I read that I could use a root command to check if an app process is running, so I could run that whenever I swiped away an app, and so know if that app was the one I wanted. But as I said, by that moment Automagic wouldn't be able to run any root related actions, so I'm stuck and maybe hope you can help me.
As always, thanks.
Detect when apps are manually removed from memory
Moderator: Martin
Re: Detect when apps are manually removed from memory
I just knew that swiping recent create UI event. I tried it in RR 7.0.1 pie, with oreo recent style, it still give the announcement. If your ROM support oreo recent style, you can try to change to that. Other method is to freeze the default launcher and use other launcher that has oreo recent style, such as nova.
You can check the app is running foreground using App Task Started/Ended. But you can't use it with the background app. It requires continuous probing to the dumpsys to check for recent app.
You can check the app is running foreground using App Task Started/Ended. But you can't use it with the background app. It requires continuous probing to the dumpsys to check for recent app.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.