Page 1 of 1

grayscale tiles

Posted: 23 Feb 2019 19:13
by yxd0018
I installed liquidRemix rom to replace los16 and it's been crash-free and has tons of customization.
I play a bit with quick setting trigger and action "update quick setting tile". It seems automagic insert 5 custom tiles by default (Tile1 - 5).
1. I create a flow to triggered by "quick settings tile selected" by Tile1, followed up by "update quick settings tile". But execution always yield error "tile is not available, please enable the trigger for this tile first".
flow_Tile1_20190223_140346.xml
(1.76 KiB) Downloaded 135 times
EDIT: fitured out, the flow must be enabled to work and can't be tested alone.

2. LiquidRemix rom has a grayscale in the digital wellness section and also a builtin grayscale tile in the quick setting. The grayscale tile's target is custom(com.google.android.apps.wellbeing/.screen.ui.GrayscaleTileService). It doesn't work with click() or clickById(). Any idea how to toggle it?

Re: grayscale tiles

Posted: 13 Jun 2019 06:17
by Pepy
For number 2, a click(); command does the trick for me to toggle the Digital Wellbeing's Grayscale tile.

Code: Select all

quickSettings();
sleep(500);
click("Grayscale");

Re: grayscale tiles

Posted: 14 Jun 2019 10:35
by yxd0018
Thanks. quicksettings() is inside controlUI. When I combined with app start/stop, the flow flips focus to the quick setting. When I close quick setting, app start trigger fires again, then quick setting again. Thus never get into the app. Should I disable the flow inside itself and enable strat flow in the stop flow?

EDIT: I wonder if there is a way to trigger controlUI away then back to the app without triggering app start trigger again.

Re: grayscale tiles

Posted: 14 Jun 2019 21:21
by Pepy
If you want to exit out of quick settings and back into the app, just put an additional back() function into your Control UI script.

Re: grayscale tiles

Posted: 15 Jun 2019 16:53
by Desmanto
In oreo above, pulling down quick setting will trigger App Task Started SystemUI and App Task Ended for the last app. When you close the quick setting, it will trigger App Task Ended for SystemUI and App Task Started for the last app you have. Hence the flow got triggered again.

1. If you combine the trigger into the same flow and the Control UI doing the things is in the same flow too, you can simply use AEP - Skip. This will make sure when the flow is running,perfoming the Control UI and back to the app, App Task Started won't be trigger. Of course you have to add some sleep at the end of the flow, to make sure it is protected properly. See : viewtopic.php?f=3&t=6985
2. You can also protect the flow by separating the trigger App Task Start/stop to different flow. When executing the Control UI to the quick setting, disable the App task started flow first, then enabled it back after the Control UI finish. However, you will have to disable/enable the flow everytime it is running. Seems unnecessary.
3. Another method is to set a separate glovar as the state. Create a condition to check if global_cui_running == true. False, go to main branch; true, do nothing. When the flow first triggered, this is false, so it will continue to the main branch. set the global_cui_running to true, do all the stuff, then at the end of the flow set it back to false. When the same flow is running, if the flow trigger again during the first run, the value global_cui_running is still true, so it will continue to false branch, ended up doing nothing, protecting your main branch.

It seems the first solution is still the easiest. I just provide another solution as example if somehow you can't use the AEP - Skip for certain cases.

Re: grayscale tiles

Posted: 16 Jun 2019 13:59
by yxd0018
Single back() only collapse the setting, but I managed to do it by combining back and sleep for 2 times. Thanks.
Pepy wrote:
14 Jun 2019 21:21
If you want to exit out of quick settings and back into the app, just put an additional back() function into your Control UI script.

Re: grayscale tiles

Posted: 16 Jun 2019 14:29
by yxd0018
I set AEP-skip in flow option and 2 back() to exit the quick setting (first back just collapse settings, 2nd after the sleep exit settings). I set app start/app stop trigger by the same app. But the quick setting was triggered 3- 6 times before finally stops. In the log, I saw start/stop get triggered multiple times. So I remove the stop trigger. With only start trigger, I still see quick setting get triggered multiple times. Considering I might switch to other apps (ex: browser for links) I gave up the idea of automating the greyscale, so this is just learning experience now. I wonder why AEP-skip didn't work.
My flow is attached.
flow_Greyscale_Mode_App[1].xml
(2.03 KiB) Downloaded 38 times

Re: grayscale tiles

Posted: 16 Jun 2019 17:01
by Desmanto
@yxd0018 : Try sleep(2000) at the end of the Control UI, instead of 500 only. It works at mine.