virresh / matvt

Virtual Mouse for Android TV that can be controlled via remote itself.
GNU General Public License v3.0
211 stars 35 forks source link

click button does not work on chromecast 4k control- Android 12 #55

Open Litorti opened 1 year ago

Litorti commented 1 year ago

Hello this issue is for Android 12 update

dikod commented 1 year ago

Hey @virresh Does it make sense for you to add a "Export logs" option in the configuration section? This way you can make sure it exports all required log items. If it's multiple log files, you can also zip them together to a single file. You can just save it to the downloads folder so it's easy to pull the file and add it here.

Just trying to make sure you have more people helping out with easy access to all the info you need to troubleshoot.

virresh commented 1 year ago

Thanks a ton @kokotas89 , Those are exactly the one's I was hoping to get.

After going through them, one last thing - Can you run adb shell pm list features and share it's output?

My primary suspect is that the device would declare not to support feature:android.hardware.faketouch or feature:android.hardware.touchscreen in it. If this is the case, our next best bet would be some fixes in adb-based engine (or some hacks to make the TV report that it has this feature).

virresh commented 1 year ago

"Export logs" option in the configuration section

Thanks for the suggestion @dikod I hadn't really thought about it, but now that I do think about it, looks like this won't suffice either. Android apps are sandboxed usually and I would not be able to export any System level logs from within the app itself. Would need an external hook like another PC or something. I think there are some hacks that will help me get the logs, but not trivial for now (especially with increased security features being launched with every release).

kokotas89 commented 1 year ago

My pleasure @virresh! Glad you got the output you wanted. Here's the ccwgtv android 12 feature list:

feature:reqGlEsVersion=0x30002 feature:android.hardware.audio.output feature:android.hardware.bluetooth feature:android.hardware.bluetooth_le feature:android.hardware.ethernet feature:android.hardware.gamepad feature:android.hardware.hardware_keystore=100 feature:android.hardware.hdmi.cec feature:android.hardware.location feature:android.hardware.location.network feature:android.hardware.opengles.aep feature:android.hardware.ram.normal feature:android.hardware.screen.landscape feature:android.hardware.security.model.compatible feature:android.hardware.type.television feature:android.hardware.usb.host feature:android.hardware.vulkan.compute feature:android.hardware.vulkan.level=1 feature:android.hardware.vulkan.version=4198400 feature:android.hardware.wifi feature:android.hardware.wifi.direct feature:android.hardware.wifi.passpoint feature:android.software.activities_on_secondary_displays feature:android.software.adoptable_storage feature:android.software.app_enumeration feature:android.software.app_widgets feature:android.software.autofill feature:android.software.backup feature:android.software.cant_save_state feature:android.software.cts feature:android.software.device_admin feature:android.software.file_based_encryption feature:android.software.input_methods feature:android.software.ipsec_tunnels feature:android.software.leanback feature:android.software.leanback_only feature:android.software.live_tv feature:android.software.opengles.deqp.level=132449025 feature:android.software.securely_removes_users feature:android.software.verified_boot feature:android.software.voice_recognizers feature:android.software.vulkan.deqp.level=132449025 feature:android.software.webview feature:com.google.android.feature.AMATI_EXPERIENCE feature:com.google.android.feature.GLOBAL_ASSIST_TRIGGERING feature:com.google.android.feature.GOOGLE_BUILD feature:com.google.android.feature.GOOGLE_EXPERIENCE feature:com.google.android.feature.tv.BBC feature:droidlogic.software.netflix feature:nrdp.modelgroup

virresh commented 1 year ago

Thanks for the list.

Our suspicions have turned out to be correct. Both faketouch and touchscreen are not supported on the newer versions. I'll do some changes in ADB version and drop them for testing in some time. Unfortunately experience with ADB has been pretty buggy and not reliable, but will add that as a stop gap at-least.

Will explore some alternate methods after the adb fix.

virresh commented 1 year ago

Hi @kokotas89

Can you test this https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk with both the untrusted touch enabled and untrusted touch disabled?

adb shell settings put global block_untrusted_touches 0

and

adb shell settings put global block_untrusted_touches 1

If this also fails, I am out of ideas on what can be done to make the mouse usable on devices that don't support faketouch...

kokotas89 commented 1 year ago

Hello @virresh ! Yeees, this one actually worked. Clicking works just fine and scrolling does too but scrolling needs refining. It's very choppy and there's a lot of latency between the press of the button and the scroll. So if you hold the button for longer than required you will end up with a lot of choppy scroll sequences which take a while to finish. If you need logs let me know.

Blocking untrusted touches made no difference. On or off, matvt behaves the same.

sujhran commented 1 year ago

Hi @kokotas89

Can you test this https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk with both the untrusted touch enabled and untrusted touch disabled?

adb shell settings put global block_untrusted_touches 0

and

adb shell settings put global block_untrusted_touches 1

If this also fails, I am out of ideas on what can be done to make the mouse usable on devices that don't support faketouch...

You did it @virresh

I can confirm it is working for chromecast HD and 4K android 12 😀

MOUSE Speed and click is normal for me. Scrolling have latency. Good work 👏.

virresh commented 1 year ago

Great news.

Sadly cannot lower the latency of ADB by a large margin because it waits to receive the full input before executing it. This is so that we don't keep pressing the down button when we want continuous scroll. So I have to cut off the full swipe in chunks and cancel it when button is released, but by that time some scroll events have already been issued.

I'll try to find some time and see if a workaround is available. The worst case would require writing a custom ADB lib and seeing how much latency gain that gets, but it's a lot of code (involves rewriting lots of parts of adb, and I haven't worked with native libs in a long while). This could take a while though, no promises on when it'll be ready.

kokotas89 commented 1 year ago

@virresh Hmm, maybe you could replace the scrolling mode with a different method then? For example, tvquickactions uses double click for a single swipe step. Not so much precision for small swipes but at least it feels smoother.

Also I noticed that on the twitch app, click still doesn't register except for highlighted items. I captured a log maybe it can help finetune something.

logcat.txt

virresh commented 1 year ago

Interesting, I'm not sure exactly what the issue is with twitch, not clear in current logs. I'll try the twitch app with emulator once though to see if this is replicable.

For the scroll, good idea, though it'll be very hard to scroll a very long list of items as it'd require much more button presses. I'll try to implement something similar as an alternate and provide a checkbox so users can choose what scroll behavior they want. Thanks!

dikodahan commented 1 year ago

I can also confirm a similar type of behavior on the Google Chromecast with ATV 12. Unfortunately, on ATV 11 devices it is still not usable.

kokotas89 commented 1 year ago

Interesting, I'm not sure exactly what the issue is with twitch, not clear in current logs. I'll try the twitch app with emulator once though to see if this is replicable.

For the scroll, good idea, though it'll be very hard to scroll a very long list of items as it'd require much more button presses. I'll try to implement something similar as an alternate and provide a checkbox so users can choose what scroll behavior they want. Thanks!

Yeah it's interesting. Not that it really matters for twitch since it's an Android TV native app so matvt is not required at all... But I wonder why it behaves differently. BTW scroll is working, it's only the click that doesn't register when selecting games or streams to watch. Menu items can be clicked fine.

As for scrolling through long lists of items, yeah that's a good point. It's just that I never had to scroll so much that I would need infinite scrolling but different users different needs. It would certainly be useful to keep it as an option.

TaniaAli268 commented 1 year ago

Tysm for this fix @virresh I got an easy fix to this scroll issue ...

(Not sure how it works on other devices) Remove the scroll feature completely, that way its easier to switch between mouse & D-pad mode which offers a much better scrolling experience. 😃

Moksh99 commented 1 year ago

Hi @virresh, how do I install this app with instructions mentioned above on Google chromecast 4k ? Specifically this part is not clear with both the untrusted touch enabled and untrusted not sure how can I do this on Google chromecast device. Can you please provide more detailed instructions for people who doesn’t know much about command line and how to execute them ? Is there any other way from UI to enable/disable untrusted touch rather than executing commands.

kokotas89 commented 1 year ago

@Moksh99 That adb command is not required. It was for testing purposes and at least to my experience it didn't make any difference. You should ignore that part for now.

To send adb commands to Chromecast you will need to setup adb wireless debugging. Sorry I can't provide details here, but it should be easy enough if you look up videos on YouTube.

Moksh99 commented 1 year ago

Thanks @kokotas89 for reply. I installed v1.0.7 pre apk but it’s still the same issue. It’s not able to click an item which doesn’t have focus selected. Is this something that should have worked with pre version ?

kokotas89 commented 1 year ago

@Moksh99 Did you do a clean installation?

Moksh99 commented 1 year ago

@Moksh99 Did you do a clean installation?

Yes, I did uninstall previous version and then install this new pre.apk and configured key 3 as mouse and tried scenario using chromecast 4k remote. This is latest chromecast 4k tv with Android 12.

kokotas89 commented 1 year ago

@Moksh99 I see... I and two other users confirmed that the latest pre has scrolling and clicking working. But in my case when I tried matvt on twitch tv app, I could only click on highlighted streams. In every other app and Chromecast menu clicking worked as expected though.

Try setting up wireless adb debugging and provide a log.

virresh commented 1 year ago

+1 to everything @kokotas89 said.

@Moksh99 Just wanted to check if you're using the adb pre release version ?

There were three variants in the pre-release post of which two don't work I've removed the two that don't work to avoid confusion now.

virresh commented 1 year ago

Also on the scroll issue, I remember there was a community contribution which enabled bordered window and scroll on hitting border sides. Maybe that offers a better experience?

In case you try that, let me know the experience / improvements you think in a separate issue. Let's limit future discussions here to Android 12 issues :D

sujhran commented 1 year ago

+1 to everything @kokotas89 said.

@Moksh99 Just wanted to check if you're using the adb pre release version ?

There were three variants in the pre-release post of which two don't work I've removed the two that don't work to avoid confusion now. @Moksh99 uninstall previous version and install adb version. Mouse Click will work.

https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk

Moksh99 commented 1 year ago

Hi all,

I did uninstall previous version and again installed adb pre version using above link, but still same issue. It doesn’t click on the screen if the item doesn’t have focus selected. Not sure if I have to enable any other setting here. I did give special app permissions to display over other app and also enabled mouse toggle service as soon as I installed adb pre version. I did restart google tv once to see if it fixes the issue but still same behavior.

MailYouLater commented 1 year ago

Did you enable wireless adb debugging in Developer Options? While the adb commands that were being discussed earlier may or may not be required, I'm fairly certain that the 'adb' test version of the app uses the loopback interface to send adb commands to the device for some functions.

Moksh99 commented 1 year ago

Hi All,

I did enable ADB debugging by following this article here - https://www.reddit.com/r/Chromecast/comments/s96moi/how_to_connect_to_ccwgtv_via_adb_using_only_wifi/

After I allowed debugging prompt and always allow first time, it didn’t work. Then I fired command - adb shell settings put global block_untrusted_touches 0 and adb shell settings put global block_untrusted_touches 1 one after another.

After this, mouse started clicking items, even if it’s not selected, woo hoo …. Scroll is however not working as expected, once scroll is enabled, it randomly scrolls and very weird behavior, so had to come out of it to use CCwGTv properly again.

Just for my own satisfaction, After all this, I disabled usb debugging option again and tried mouse operations but it didn’t work, same problem as before. Once I enabled usb debugging again, it started working. Once you enable, it will again ask for allow and check box as well which one has to allow and check the box.

Summary - use the adb-pre.apk shared by virresh but also make sure that usb debugging is enabled following the link below - https://www.reddit.com/r/Chromecast/comments/s96moi/how_to_connect_to_ccwgtv_via_adb_using_only_wifi/ and make sure you check the box and always allow, when it asks first time.

Thank you @virresh , @sujhran, @kokotas89 and @MailYouLater for guiding throughout this and special thanks to @virresh for enabling this app to users like me. Liked working with you all, cheers 👍🏻 Happy new year in advance !!!

hellemmm commented 1 year ago

Hi, i have same issue! I press left-click but nothing happens... But it is clickable with hardware mouse... I use philips 65PUS8506/60 tv, android TV 11 I use MATVT 1.0.6 Any help?

virresh commented 1 year ago

@hellemmm Try MATVT v1.0.7-pre release - https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk

There are known issues on Android 11. See https://github.com/virresh/matvt/issues/28 for details.

hellemmm commented 1 year ago

Thnky you for fast reply!) I have uninstalled 1.0.6, and uninstalled 1.0.7,  have tried 1.0.7 abd pre - same result.. Mouse clicking works sometimes, but not works in same cases with 1.0.6 version What should i try next? Thank you)

Отправлено из Mail.ru для Android суббота, 04 февраля 2023г., 08:21 +03:00 от Viresh Gupta @.*** :

@hellemmm Try MATVT v1.0.7-pre release - https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk There are known issues on Android 11. See #28 for details. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned. Message ID: @ github . com>

hellemmm commented 1 year ago

Hi, once again! I have tried restart and enabling developer options, usb debugging on, and now left click worked for 1 time.. it asked to allow debug from this device, and then 1 clock worked, and no more clicking works ... ((((( Also dpad become stucky sometimes.....

Отправлено из Mail.ru для Android суббота, 04 февраля 2023г., 08:21 +03:00 от Viresh Gupta @.*** :

@hellemmm Try MATVT v1.0.7-pre release - https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk There are known issues on Android 11. See #28 for details. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned. Message ID: @ github . com>

hellemmm commented 1 year ago

Hi again) it now working!! Hooooooray!))))))

Отправлено из Mail.ru для Android суббота, 04 февраля 2023г., 08:21 +03:00 от Viresh Gupta @.*** :

@hellemmm Try MATVT v1.0.7-pre release - https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk There are known issues on Android 11. See #28 for details. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned. Message ID: @ github . com>

jtc1953 commented 1 year ago

Hi. After I got the MA VT v1.0.7-pre release installed I finally able to click with center button. (Google TV Android12). I have a suggestion.: It would be nice with an option when the mouse pointer reach a side (border mode enabled) automatically turns into scroll mode. Btw. Sometimes I get a promt to allow a RSA-key ???

virresh commented 1 year ago

Btw. Sometimes I get a promt to allow a RSA-key ???

Yup, the RSA key prompt is because we use ADB under the hood. aquirozc have contributed some improvements in how adb engine works, that should automatically save the RSA key. If you're interested in trying that out, check out the interim release they created at https://github.com/aquirozc/matvt/releases/download/v1.0.7-internal-pre-release05/MATVT.1.0.7-rs_adbserver_testbranch-main_lab-test25.apk

It would be nice with an option when the mouse pointer reach a side

Noted.

ferengialliance commented 1 year ago

I'm a bit late to this party! Firstly thank you Virresh for your efforts! I have been unable to get the 4k CCWGTV remote centre button to mouse click since the V12 upgrade. I have read through the above and think I understand the issue, but am struggling with implementing the fix. I have installed MATVT 1.07 3 times now (by creating a tinyurl and sticking it in downloader app) First I uninstalled v1.0.6 then tried : matvt-app-release-1.0.7-pre2.apk this is the Android 12 version? I enabled both permissions - didn't work - enabled USB debugging in developer options (i don't see any mention of ADB in there) - restarted - no joy. So I started again... Same process with the ADB version and finally the lab test version above.

Is there something daft I am doing/not doing? Happy to be told I am :)

virresh commented 1 year ago

Hey @ferengialliance Sorry for the confusion, I haven't really got around to finishing refactoring of code which will remove two different versions unite them in one apk.

The pre2 apk is for devices that still support faketouch (e.g https://github.com/virresh/matvt/issues/61). It offers better precision and latency, but there are many devices that do not work with the gesture api because of faketouch.

As a workaround, there is an adb pre-release which should work in this case - https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-adb-pre.apk

Let us know if this works for you. This has latency issues though. Also feel free to try https://github.com/aquirozc/matvt/releases/download/v1.0.7-internal-pre-release05/MATVT.1.0.7-rs_adbserver_testbranch-main_lab-test25.apk This is community contributed adb version by aquirozc, has a lot of improvements, like fixes in scrolling behaviour and automatically saving the rsa key so you don't have to deal with RSA checkboxes everytime. It'll make it's way into the next release, dependent on whenever I get time to finish combining different engines 😅.

ferengialliance commented 1 year ago

Thanks @virresh I got around to installing the aquirozc version and all is good now , I may have missed the supplemental pop up for allowing usb debugging the first time I installed??, although I did it in developer settings manually 🤷🏽 - in any case it works! Good stuff!