Closing recent() apps

Post your questions and help other users.

Moderator: Martin

Post Reply
Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Closing recent() apps

Post by Lucy » 16 Nov 2019 11:53

Heya. I tried using the control ui script that someone put in the forum to clear my recents but it executes the script as it should until the "click" part. It then just nags and hangs there with the script still active but unable to stop. What am i doing wrong? I thought maybe the button label but i changed that and still not completing.

The script i downloaded:
//////////////////////////////////

recents();
while (NOT existsElementById("com.android.systemui:id/recents_container"))
{
sleep(10);
}
while (existsElementById("com.android.systemui:id/app_thumbnail"))
{
longclickById("com.android.systemui:id/app_thumbnail");
while (NOT existsElementById("android:id/title"))
{
sleep(10);
}
click("CLOSE ALL");
clicked = click("CLOSE ALL");
if(not clicked)
{
home();
}}

(The last 6 lines is my slight modification)
My recents() clear button:
//////////////////////////////////
Screenshot_20191116-223856.jpg

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Closing recent() apps

Post by Lucy » 16 Nov 2019 11:55

Sorry. Attachment didnt work.
Here is my recent() here
Screenshot_20191116-223856.jpg
Screenshot_20191116-223856.jpg (337.27 KiB) Viewed 9637 times

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Closing recent() apps

Post by Lucy » 16 Nov 2019 12:58

Lol i tried a lot of variations and yes i used the overlay in control ui to determine what is available. This is my final attempt. I just cant doit😭

//////////////////////////SCRIPT/////////////////////////////


recents();
while (NOT existsElementById("com.android.systemui:id/recents_container"))
{
sleep(10);
}
while (existsElementById("com.android.systemui:id/app_thumbnail"))
{
longclickById("com.android.systemui:id/app_thumbnail");
while (NOT existsElementById("android:id/title"))
{
sleep(10);
}
value = existsElementById("com.android.systemui:id/recents_close_all_button");
sleep(10);
focus("CLOSE ALL");
sleep(10);
focus(540, 1839);
sleep(10);
click(540, 1839);
sleep(10);
click("CLOSE ALL");
sleep(10);
clickById("com.android.systemui:id/recents_close_all_button");
bounds = getBoundsById("com.android.systemui:id/dismiss_task");
sleep(10);
bounds = getBoundsByIdAndIndex("com.android.systemui:id/dismiss_task", 1);
sleep(10);
clickById("com.android.systemui:id/dismiss_task");
sleep(10);
clickByIdAndIndex("com.android.systemui:id/dismiss_task", 1);
sleep(10);
scrollForwardById("com.android.systemui:id/dismiss_task");
scrollForward(934, 1376);
scrollBackward("Close appname");
scrollBackward(540, 1101);
focus("Close appname");
click("Close appnsme");
clicked = click("Close appname");
if(not clicked)
{
back();
}}

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Closing recent() apps

Post by Lucy » 16 Nov 2019 15:19

Ok so aftet a lot of messing around. I have finaly got the script to do the job... all is good🤙

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Closing recent() apps

Post by Desmanto » 22 Nov 2019 17:30

CLOSE ALL is the nuke button you have there. It is strongly advised not to do this. I have that kind of nuke button too, but I don't event want to touch it. In my previous MIUI ROM, that button will kill Automagic Accessibility services. The Acc service seems to be enabled, but actually have been slayed and can't perform any UI related action anymore.

Jsut leave all your recent app alone. Android nowadays is smart enought to manage the RAM usage. Only at some certain special cases that you need to kill manually. And that doesn't even require kill all. It is better to reboot to refresh all service at once.
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.

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Closing recent() apps

Post by Lucy » 22 Nov 2019 21:18

Thanks darlin

Post Reply