Keep focus on proper screen with Control UI

Post your questions and help other users.

Moderator: Martin

Post Reply
Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Keep focus on proper screen with Control UI

Post by Econdoc » 16 Jun 2019 15:11

I am trying to use Control UI with quickSettings or with Launch App to change a setting. Generally, this works okay as a stand alone flow. However, when other flows are triggered and run in the background, the focus on quickSettiings or on the window opened in Launch App is lost. How can I keep the focus long enough to click on the icon or slide bar?

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

Re: Keep focus on proper screen with Control UI

Post by Desmanto » 16 Jun 2019 17:10

You can use the focus() function variant to focus on the quicksetting menu first. And if it is possible, try to test the function that don't require focus, but still work with your slide bar.
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.

Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Re: Keep focus on proper screen with Control UI

Post by Econdoc » 16 Jun 2019 18:56

Thanks for the help. focus() does not seem to work. I tried focus() for an element of quickSettings() that I did not want to change. [focus() does not even exist for the setting that I want to toggle (NFC).]

This tactic had some success: Before opening quickSettings(), issue a home(). I don't know why this works or if is is reliable.

I tried a similar thing by issuing home() in Control UI before starting Launch App. That seemed to work too, although I don't know if I can rely on it to continue working. I was hoping there was some way of stopping other flows from interfering until my Control UI was complete.

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

Re: Keep focus on proper screen with Control UI

Post by Desmanto » 17 Jun 2019 16:57

I never actually encounter the event where my control UI is broken because of other flows triggered. Is it always the same flow that interefere with the Control UI? If yes, then you can simply add a condition at the intefering flow, check if the Control UI flow is executing. If yes, loop sleep 5 seconds and check back again later before continuing to the main branch.
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.

Post Reply