Attempting to Interact with the UI

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Attempting to Interact with the UI

Post by sitruk » 01 May 2018 12:22

Hello, I have a VPN app that I would like to perform some mild automation with. I am able to launch it and have it automatically connect. However, disconnecting is another story. It appears the best case scenario would be to launch the VPN app and control the UI to tap the disconnect button. I have tried a few options including root command to click a location on the screen. If I use "Control UI: click(720, 1093) the flow completes without error, but nothing happens.

Can anyone shed any insight on my issue and maybe guide me in the right direction?
Attachments
Screenshot_20180501-075338.png
This shows the element I wish to tap
Screenshot_20180501-075338.png (207.29 KiB) Viewed 18578 times
Screenshot_20180501-075332.png
This shows the available actions
Screenshot_20180501-075332.png (123.36 KiB) Viewed 18578 times

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

Re: Attempting to Interact with the UI

Post by Desmanto » 01 May 2018 13:07

I assumed you have tried clickById();

Code: Select all

clickByld("com.privateinternetaccess.android:id/fragment_connect_slider");
If yes, then probably the problem is the timing. Try to add sleep(1000) or longer at the control UI script.
Remember, the Control UI must come after the launch app/shortcut action, so it will execute after it, not at the same time.

Code: Select all

sleep(1000);
clickByld("com.privateinternetaccess.android:id/fragment_connect_slider");
If it works, you can try lower value to see if it still works, such 500 or 200.
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.

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Attempting to Interact with the UI

Post by sitruk » 01 May 2018 13:32

Desmanto wrote:I assumed you have tried clickById();

Code: Select all

clickByld("com.privateinternetaccess.android:id/fragment_connect_slider");
If yes, then probably the problem is the timing. Try to add sleep(1000) or longer at the control UI script.
Remember, the Control UI must come after the launch app/shortcut action, so it will execute after it, not at the same time.

Code: Select all

sleep(1000);
clickByld("com.privateinternetaccess.android:id/fragment_connect_slider");
If it works, you can try lower value to see if it still works, such 500 or 200.
Yes, I did in fact try the clickByld option. I also added a sleep step but it doesn't seem to help. I added the sleep step into the script at 1000 as well as 5000 and there is no difference.

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

Re: Attempting to Interact with the UI

Post by Desmanto » 01 May 2018 16:50

Maybe the app has the secured flag on. It prohibits any accessibility access. But root command should have bypassed it. Try to use control UI with other element to make sure the Control UI works at the app. Try to click that hamburger menu at top left. It seems the app doesn't support automation/intent plugin so no way to stop it using intent.

Since you are on nougat, you can try to use gesture and try to swipe the toggle to left.
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.

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Attempting to Interact with the UI

Post by sitruk » 01 May 2018 18:50

Desmanto wrote:Maybe the app has the secured flag on. It prohibits any accessibility access. But root command should have bypassed it. Try to use control UI with other element to make sure the Control UI works at the app. Try to click that hamburger menu at top left. It seems the app doesn't support automation/intent plugin so no way to stop it using intent.

Since you are on nougat, you can try to use gesture and try to swipe the toggle to left.

Thank you for your guidance. You were right, it appears this app is not accepting any kind of UI Control. However, I tried the gesture option as you suggested and just using a simple tap gesture did the trick. Thank you again!

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Attempting to Interact with the UI

Post by digitalstone » 01 May 2018 19:39

On a sidenote:
Isn't the code behind the "Control UI" element getting discontinued by Google?
I also want to dive into the Control UI, but if it goes "away" then it might not be worth to build anything with it.
I haven't read any news on that lately (or i might be looking with my butt).

-- EDIT --
Sorry to "hijack" this topic, but it seemed a proper subject + it reminded me.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

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

Re: Attempting to Interact with the UI

Post by Desmanto » 02 May 2018 10:38

@sitruk : That VPN app is way too secured :D But I just realize the can gesture can be used that way too. (I am still using LP 5.1, waiting for the next phone with Oreo).

@digitalstone : The status now is undefined, someone have linked the group discussion as "Won't Fix", but can't find it anywhere now. So far, google haven't made any drastic move, but keep pushing dev behind the stage. It seems all dev must comply to certain set of accessibility term of usage if they want to keep their app. Considering no big news yet lately, it seems there is no further restriction from google yet (but I don't know what happened behind the scene).

CUI is one of my top 3 most used actions, it accounts for 64 usages, or about 7% of total actions; after script (206) and notification on screen (92). Well, not all are in use, but I can say at least 50 above are inside working flows. Removing this accessibility feature will really create a deep impact on someone who has "laziness disability" like me. :lol:
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.

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Attempting to Interact with the UI

Post by sitruk » 02 May 2018 10:57

Desmanto wrote:@sitruk : That VPN app is way too secured :D But I just realize the can gesture can be used that way too. (I am still using LP 5.1, waiting for the next phone with Oreo).

@digitalstone : The status now is undefined, someone have linked the group discussion as "Won't Fix", but can't find it anywhere now. So far, google haven't made any drastic move, but keep pushing dev behind the stage. It seems all dev must comply to certain set of accessibility term of usage if they want to keep their app. Considering no big news yet lately, it seems there is no further restriction from google yet (but I don't know what happened behind the scene).

CUI is one of my top 3 most used actions, it accounts for 64 usages, or about 7% of total actions; after script (206) and notification on screen (92). Well, not all are in use, but I can say at least 50 above are inside working flows. Removing this accessibility feature will really create a deep impact on someone who has "laziness disability" like me. :lol:
HAH! Yea it appears to be that way.

I am just now starting to delve into CUI and I am dying to find more reasons to use it now. Does the screen need to be on and unlocked in order for some or all CUI functions?

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

Re: Attempting to Interact with the UI

Post by Desmanto » 02 May 2018 11:06

sitruk wrote: HAH! Yea it appears to be that way.

I am just now starting to delve into CUI and I am dying to find more reasons to use it now. Does the screen need to be on and unlocked in order for some or all CUI functions?
You will find a lot of interesting things it can do. Yes, the screen must be on and unlocked, so you need to coupled it with turn screen on and set keyguard off (or dismiss keyguard). Locked screen will cause all CUI function fail without any error shown.
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.

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Attempting to Interact with the UI

Post by sitruk » 02 May 2018 11:11

Desmanto wrote:
sitruk wrote: HAH! Yea it appears to be that way.

I am just now starting to delve into CUI and I am dying to find more reasons to use it now. Does the screen need to be on and unlocked in order for some or all CUI functions?
You will find a lot of interesting things it can do. Yes, the screen must be on and unlocked, so you need to coupled it with turn screen on and set keyguard off (or dismiss keyguard). Locked screen will cause all CUI function fail without any error shown.
Ok I kind of discovered that through trial and error but I just wanted to hear it for sure. Thank you

Post Reply