[Paid Software Announcement and Discussion] seburton:
I use Appradio since a while now and i think it's time to share some practice that could help some of you.

Because tasker is a really powerfull tool, i always try to complete my goal using tasker instead of installing other apps.

So if you are not used to tasker it will be hard for you to understand this post.

1. Connection:

When tasker detect head-Unit connection, it run a shell to start Appradio services on my phone

am startservice mars.area51.arunchained/mars.area51.arunchained.unchainedservices.Commservice

2. Detect screen mirroring

When tasker detect head-unit connection, it activate an other tasker profile that will react to a specific intent related to screen-mirroring state change.

The intent receive event is the next one:

android.net.wifi.p2p.CONNECTION_STATE_CHANGE

thanks to this intent, tasker will detect if screen mirroring is connected or disconnected because the actual state of screen mirroring is stored in %networkinfo. It works with both miracast and chromecast.

3. Auto Unlock (need AutoInput plugin for tasker)

When tasker detect a head-unit connection, it activate auto-Unlock Profile. This profile is trigger when the screen is turned on.

It run two AutoInput gesture that simulate touch input:

- One that perform a swype from bottom to top to show pin code

- The second to enter my pin that will unlock the phone.

If the screen is connected to a mirroring device, tasker will stop here.

If screen mirroring is disconnected, tasker will launch the mirroring screen on the phone with this shell command:

am start -n com.android.settings/.settings\$WifiDisplaySettingsActivity

After that, an AutoInput action will try to touch on "Appradio" text (the name of mi miracast) every 10 seconds until the %networkinfo is connected (remember, tasker detect mirroring status when this one changes).

This is really powerfull if something goes wrong with mirroring during a drive. If connection brake,

tasker will detect it and the next time you will turn on screen, tasker will connect again to the screen.

Additional knowledge:

4. Turn off backlight

On AOSP, and OxygenOS, you can turn off backlight without locking the device using a tasker shell

echo 0 > /sys/class/backlight/panel/device/backlight/panel/brightness

After that, lock the file in read only to avoid android changing the value:

chmod 444 /sys/class/backlight/panel/device/backlight/panel/brightness

Remember to always reverse this change when you lock the screen with tasker event "display off" or your backlight will be blocked to 0 and you will need to reboot the phone to reverse the read only state.

chmod 644 /sys/class/backlight/panel/device/backlight/panel/brightness

5. Resolution size and density

With new smartphones, 16/9 is no more used but tasker can change the resolution to match the appradio 16/9 ratio. With a shell command again

wm size 1080*1920

wm density 420

(remember to run those shell before launching Appradio service or appradio calibration will not be good)

6. Appradio calibration

before posting this, i asked [MENTION=266368]area51[/MENTION] if he was ok. So big thanks to him.

i found the perfect calibration for my S10 by changing manually the preferences file stored in /data/data/mars.area51.arunchained/shared_prefs

here are the 4 lines that you need to change (of course, it can be different on your phone and you will not find the perfect values imediatly):

You can considere those two lines as the offset start screen point.

<float name="prefAX" value="200" />

<float name="prefAY" value="0" />

And those two lines as the size of the touchscreen area.

<float name="prefBX" value="0.05" />

<float name="prefBY" value="0.033" />

restard ARU app to save the changes you made.

Alternative:

you can use secondscreen app to change the size of your screen[url]https://play.google.com/store/apps/details?id=com.farmerbb.secondscreen.free&hl=fr[/URL]

you can use repetitouch to repeat touch input (usefull for unlock the phone)[url]https://play.google.com/store/apps/details?id=com.cygery.repetitouch.pro&hl=fr[/URL]

of course, those two apps can be called with tasker plugin

Hope this post will help you and don't hesitate to PM me if you need more informations :).

[MENTION=266368]area51[/MENTION], as i said in PM, i buyed my SPH in 2014 , i use ARU on Nexus 4, Galaxy S6, Nexus 5x, Oneplus 3, and now Galaxy s10.. went through android 4.4 to android 9.

I would never thought I had this longevity with your app. Huge thanks to you.