Page 1 of 1

Windows Recognizer

Posted: 26 Aug 2017 17:33
by Desmanto
There are 2 flows and 1 widget in this xml. http://automagic4android.com/flow.php?i ... 7c51be9366

The function of this project is to detect app name, package name and class name from the app that shows up on the foreground. This is mostly used for trobleshooting. Example : suddenly there is a full screen interstitial ads that shows up intermittently. You wanna know which app cause it. By using this project, you can know exactly which app is the criminal; without going thru the painful process of uninstalling several suspected apps.

Or maybe you use it to help you in creating the flow. So you can use the correct app name for the UI Event/Control UI, app task started/ended.

Toggle WinRec
Toggle WinRec is shortcut to trigger the whole process, add it as a shortcut to your home screen. Please enable this first. You don't need to enable the Windows Recognizer flow, as it will be enabled from this Toggle WinRec.

Toggle WinRec will check if the Windows Recognizer flow is enabled or not. If not enabled (first execution), it will enable the flow and set GloVar global_infobar to list with 3 null elements (reset the value).

If it is enabled, then it will disable the flow, hide the widget and show toast message that the Windows Recognizer has been stopped.

Windows Recognizer
This flow use UI event to detect all Window opened event from all apps (matches glob *). It is designed to be enabled from Toggle WinRec, so it doesn't have to be active the whole, only when needed.

There will be a expression to check if the apps you wanna exclude from the detection are there, then it will not show them. In my case, they are Automagic and Nova Launcher (my default launcher). You can add your own if you want, just put them inside the list. If you want the windows recognizer in every app, just remove this condition. But you will be spammed a lot by the home launcher, as most of us goes to home screen/app drawer first before navigating to other app.

Next script action will get the app name, package name and class name of the opened window. Add it to the GloVar, and trim it if the elements is more than 3.

It will then show the GloVar as widget at the bottom of the screen. I make this in 1080x1920 resolution, so the default value there is 1080x384. If you are using other resolution, please change the width/height accordingly.
720x1280 >> 720x256
1080x1920 >> 1080x384
1440x2560 >> 1440x512

For other resolution, just make it scale to your resolution (I believe most power users who use automagic can't withstand using phone lower than 720p resolution :))

There is a sleep 5 seconds before the flow will hide the widget. You can change the time, this will be the delay before the widget disappear. This flow use "Stop the currently ...." Flow execution policy. It means if the flow is triggered, the sleep 5 seconds will be stop and restarted from 0. Thus the widget will kept refresh. One weakness is if the trigger is from the excluded apps, then the widget will kept refresh but not showing any new information.

Widget Info Bar
Widget contains 3 text, which takes the value from 3 elements of the GloVar. You don't need to change anything here, but you can change the color or style if you want. I have make sure it fits 2 lines for most app, and have additional space for 3 lines (in case the package name/class name is very long). The widget has no action at all, so you can safely click pass thru it when it shows up.

This project actually can use Notification on Screen instead of Widget. But UI event triggered so often if we open the app quickly. The toast message will stacked up too fast and it is so painful to see the delay per message.

Re: Windows Recognizer

Posted: 01 Sep 2017 08:14
by Bluscre
I made something similar because i didn't know of your flow by that time. Mine displays a notificarion instead of an overlay tho ^^

Preview: Github | AutoMagic

Download: Github (recommended) | AutoMagic

Source: Github

Re: Windows Recognizer

Posted: 06 Sep 2017 05:52
by Desmanto
Using notification will be impractical. We have to swipe down again to check the value. Widget is better for quick view.

Re: Windows Recognizer

Posted: 06 Sep 2017 10:11
by Bluscre
Desmanto wrote:Using notification will be impractical. We have to swipe down again to check the value. Widget is better for quick view.
In my case notification is more practical because it doesn't take much space and has the extra buttons

Re: Windows Recognizer

Posted: 06 Sep 2017 11:55
by Desmanto
So it is back to the need then :) I can add the button for the widget or swipe. But I prefer the widget to be click-thru, so not to interfere with navigation but preserve the information.