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

Jooose25 commented 1 year ago

Tengo el mismo problema con la última actualización a Android 12

andresflorentin commented 1 year ago

Yo también tengo el mismo problema, no funciona el mouse matvt en el chromecast 4 Google tv con Android 12

Nardokrazy2x commented 1 year ago

I am also having this issue

virresh commented 1 year ago

Hi, Thanks for reporting. Can someone send a log report for me to look at? I don't have a chromecast and can't deduce what the issue is by the above comments.

Nardokrazy2x commented 1 year ago

How do it send a log I am on mine

Tbo29 commented 1 year ago

Yes, click only works if the item you want to click has focus.

andresflorentin commented 1 year ago

Button click and scroll mode don't work

RNavarro3000 commented 1 year ago

I have an Onn 4k device running Android 12 with the same problem as OP. Here is logcat output with just the MATVT info. logcat.txt

virresh commented 1 year ago

Thanks @RNavarro3000 for the log. I can see events being read just fine. I suppose this is a problem at kernel level of discarding click events that did not come from system itself.

Can you try looking at the other logs and see if you see any warnings from the kernel about rejecting input or something. Also, I have a beta version that uses ADB instead of accessibility service - https://github.com/virresh/matvt/releases/tag/v1.06-pre-release

It's not pretty, but it should work as a stop-gap. I don't see how it can be improved in user experience though. Let me know if it works, that'll confirm that we have a fix for this new issue (whatever it is).

Tbo29 commented 1 year ago

Sorry to say, the beta adb release also does not work. Tried with a bluetooth mouse connected. Also does not click. Doesn't look too good.

RNavarro3000 commented 1 year ago

@virresh Attached is unfiltered logcat output from another event. If this doesn't help, let me know specifically what files or output you need captured as I'm not too familiar where Android keeps things. logcat2.txt

virresh commented 1 year ago

Thanks @RNavarro3000 I see the logs are for official release version. They show similar symptoms to what I saw when Android 11 was released, although @Tbo29 mentioned that that the ADB version isn't working either. In the logs, MATVT is able to read views from the screen just fine, but the input events fail and get eaten up (as if the gesture dispatch api didn't exist at all).

Can one of you also give logs for the adb version if possible?

st-ivan commented 1 year ago

Thanks @RNavarro3000 I see the logs are for official release version. They show similar symptoms to what I saw when Android 11 was released, although @Tbo29 mentioned that that the ADB version isn't working either. In the logs, MATVT is able to read views from the screen just fine, but the input events fail and get eaten up (as if the gesture dispatch api didn't exist at all).

Can one of you also give logs for the adb version if possible?

Hi, just tried the adb version and its not working. Id be happy to provide logs if you tell me how to export them.

RNavarro3000 commented 1 year ago

@virresh Installed the ADB version and click button is working OK for me now on LineageOS Android TV 12. Attached is logs for the session, maybe it will help with diagnosing the official release version.

logcat3.txt

https://user-images.githubusercontent.com/121646/201586325-dbeabd38-4047-43da-9135-9aeabd8f983a.mp4

titti2000 commented 1 year ago

Hi all, I have the same problem on the new Chromecast hd, even with the ADB version; the click works only on what is already selected. I'd like to help you with the log, but I don't know how to do it; No debug app appears in developer options.

Tbo29 commented 1 year ago

Seems that ADB is the way to go. The dev from tvQuickActions released an update (2.9.2) which uses ADB to fix the mouse toggle on Android TV 12. Regretfully I don't have it, but users confirmed that the mouse toggle from tvQuickActions is working now on the Chromecast with Google TV and the latest update. Let's see if the dev from Zank Remote will release an update soon, as he said he found the solution.

st-ivan commented 1 year ago

Seems that ADB is the way to go. The dev from tvQuickActions released an update (2.9.2) which uses ADB to fix the mouse toggle on Android TV 12. Regretfully I don't have it, but users confirmed that the mouse toggle from tvQuickActions is working now on the Chromecast with Google TV and the latest update. Let's see if the dev from Zank Remote will release an update soon, as he said he found the solution.

thanks for the info. Link to the 2.9.2 version pleae? i just found out about this app and seems very helpful, if it works fine i may even buy it.

Tbo29 commented 1 year ago

It's on the Playstore. Thinking of buying it too. Only $2.0. I have an older version. Works better than Button Mapper.

st-ivan commented 1 year ago

It's on the Playstore. Thinking of buying it too. Only $2.0. I have an older version. Works better than Button Mapper.

thanks.. yeah talked to the developer via telegram, he says it works 100% confirmed. So im buying it. Not only bc of the mouse toggle feature but the 1 button (5 functions) mann thats a game changer for ccwgtv

laopewastaken commented 1 year ago

adb version doesnt work.

any news on a fix for ccwgtv/android 12?

st-ivan commented 1 year ago

ended up buying tvQuickActions which has lots of more features and mouse toggle works .

Tbo29 commented 1 year ago

ended up buying tvQuickActions which has lots of more features and mouse toggle works .

Bluetooth Keyboard and Mouse from phone also does work latest version. Means that devs are finding the solution.

virresh commented 1 year ago

Thanks for the logs folks!

I got time today to test out the official Google TV emulator image for Android 12, and I found the issue.

The problem is caused because of a fancy new security feature on Android 12+. Explained in detail - https://medium.com/androiddevelopers/untrusted-touch-events-2c0e0b9c374c

I will be updating the official version with a fix for the same and this should work without the ADB. Thanks for your patience, will update here to test out the fix.

virresh commented 1 year ago

Please test https://github.com/virresh/matvt/releases/tag/v1.0.7-pre and let me know if this solves problems on Android 12 (click and scroll should now be working).

Based on feedback, I'll add this along with a couple other planned features and release v1.0.7.

dikodahan commented 1 year ago

Hey @virresh I just tested it on an android 11 TV box and I am still having the same issue. No problem with getting it to work and show the mouse on screen, however, the "Select" button does not seem to take effect... I also noticed that when switching to scroll mode it did not scroll the screen for me.

For context: I am running on a Mecool KM7 device with Android TV 11 on it.

virresh commented 1 year ago

@dikodahan pls note this is only for Android 12 For Android 11, you'll have to use the adb version. There is a known issue (only in Android 11) which has been fixed in subsequent versions.

Litorti commented 1 year ago

Click only works if focused. Scroll doesn't work

dikodahan commented 1 year ago

@dikodahan pls note this is only for Android 12 For Android 11, you'll have to use the adb version. There is a known issue (only in Android 11) which has been fixed in subsequent versions.

Hey @virresh Thanks for the reply. As stated in your notes for that release, it is EXTREMELY buggy. Once the ADB permission is enabled, even with the mouse functionality not enabled (D-Pad mode), the system is jumping all around in the menu with the remote and is almost unusable. The only option to bring the system back to normal operation is to uninstall that version. If you're planning to release an updated 1.07 version, I am happy to test an ADB version of it on Android 11. The current one is not usable.

Again, thanks for all the effort into this project!

sujhran commented 1 year ago

Hi @virresh

I have tested 1.0.7 on google chromecast 12 and response is same. Click mouse click didn't work, however it only work for the selected item. For example if i am on the setting tab and if i turned on the toggle and click. it will work one time for the selected item but then didn't work.

So i can say that it is the same experience like 1.0.6.

dikodahan commented 1 year ago

Hi @virresh

I have tested 1.0.7 on google chromecast 12 and response is same. Click mouse click didn't work, however it only work for the selected item. For example if i am on the setting tab and if i turned on the toggle and click. it will work one time for the selected item but then didn't work.

So i can say that it is the same experience like 1.0.6.

BTW, Unrelated to the above issue I mentioned on Android 11, I also tested on my Google Chromecast with Google TV with the updated Android 12 version and I am also getting the same as @sujhran with the 1.07 version. Click and scroll did not work for me.

sujhran commented 1 year ago

Hi @virresh , please let me know if more information is required to fix the mouse click issue for chromecast android 12. I have two devices, and I can be part of UAT.

linekona commented 1 year ago

Hi @virresh

I have tested 1.0.7 on google chromecast 12 and response is same. Click mouse click didn't work, however it only work for the selected item. For example if i am on the setting tab and if i turned on the toggle and click. it will work one time for the selected item but then didn't work.

So i can say that it is the same experience like 1.0.6.

I have same issue on CCWGTV running Android 12. Still not working.

TerryUK commented 1 year ago

Ditto with the pre release of 1.07. Any news.

virresh commented 1 year ago

Ah okay. That's unfortunate. I don't have actual hardware to test on so don't think I'll be able to uncover any more secrets about this just from the emulator image. Already did the fixes required to get it running on official Google TV Android 12 emulator image (AOSP TV x86 image, May 1 2022 security patch, 5.10.66 kernel version released on 10th Dec 2021). Mentioned the full version and kernel details just in case it rings any bells to anyone.

If anyone has ready access to an Android emulator image that replicates the issue that'll be extremely helpful.

Apart from that, if anyone here can get full logs for the 1.0.7-prerelease version (including system events) from actual hardware that displays the problem, that'll be much appreciated too. (Even better if anyone has ideas on what other security policies were introduced and which other one might be interfering).

TerryUK commented 1 year ago

I got TVQuickActions to work but needed quite a bit of Googling to set it up. Mouse movement is jumpy left to right on ES Explorer causing to to page. You have to take it slowly. So even that isn't perfect but handy when you need the odd click on an item.

Virresh you need to splash out on the device.

virresh commented 1 year ago

Virresh you need to splash out on the device.

The project itself doesn't generate any revenue. It is not just free, but open source as well. Also, a not-so-popular fact is that I've already had people stealing this open-source project and selling it to innocent folks who need it without any credit, framing the open-source project as fake / pirated in the past.

Even if I fund this project by myself for this one purchase, I can't possibly keep doing it for all future releases of Android sustainably. I don't need so many Android TVs (and they're pretty expensive around my area as well). I'm happy to volunteer my free time to this project though as I built it out of passion for tinkering and technology.

Edit: Just in case anyone thinks the donations would suffice, just checkout the ko-fi page and see for yourself how many donations are there in a span of ~3 years. [To save you some time, it's 0].

TerryUK commented 1 year ago

👍one guy on a Chromecast Google TV channel on YouTube claims his guy is working with you. Least in the video seems he's the one to investigate for you. The video doesn't currently doesnt work due to the issue.... so his guy needs to talk to you. "Swing Wolf" seems to be the guys name.

https://m.youtube.com/watch?v=UC7bPw2tG4c

virresh commented 1 year ago

That's TDUK's channel and I believe you're referring to SweenWolf.

I'm not sure if @sweenwolf gets any compensation for his contributions and is the content creator's "guy". The fact is we met on XDA forums and he took interest in this project and contributed a few features (you can see exactly who contributed what here - https://github.com/virresh/matvt/commits/master, and I have appropriately credited every person involved in the credits section here - https://github.com/virresh/matvt#credits).

To be clear, I've requested TDUK to be explicit about the fact that they are just curating knowledge about an open source project and this is not sponsored by them. Have also asked them over an email to at least put a reference to the project (which they replied they've put up somewhere on their website).

It's unfortunate this looks like how it is though, but to be absolutely explicit, the only conversations regarding this project ongoing are all listed as issues on this repository. I've tried commenting on the YT video with updates but my comments on the followup video end up getting deleted (probably some spam filter because I don't comment much?) so I've stopped bothering.

TerryUK commented 1 year ago

Fingers crossed you will get some assistance.

Tbo29 commented 1 year ago

Log_2022-12-04_16-24-33.txt

Hi virresh. I did a specific log for matvt. Was not so easy as the app for logging was not suited for the Chromecast with Google TV. However here it is.

When activating scrolling, it does not issue any event. Only when I click. Maybe this log could be usefull.

Btw the Android TV 12 image you have differs from the real Android TV 12 on the CCWGTV. That's why your app works on it and not on the real device.

minimeh commented 1 year ago

That's TDUK's channel and I believe you're referring to SweenWolf.

I'm not sure if @sweenwolf gets any compensation for his contributions and is the content creator's "guy". The fact is we met on XDA forums and he took interest in this project and contributed a few features (you can see exactly who contributed what here - https://github.com/virresh/matvt/commits/master, and I have appropriately credited every person involved in the credits section here - https://github.com/virresh/matvt#credits).

To be clear, I've requested TDUK to be explicit about the fact that they are just curating knowledge about an open source project and this is not sponsored by them. Have also asked them over an email to at least put a reference to the project (which they replied they've put up somewhere on their website).

It's unfortunate this looks like how it is though, but to be absolutely explicit, the only conversations regarding this project ongoing are all listed as issues on this repository. I've tried commenting on the YT video with updates but my comments on the followup video end up getting deleted (probably some spam filter because I don't comment much?) so I've stopped bothering.

@virresh: TDUK has a habit of saying that "his guy" or "his programmer" is working on his behalf. Even @sweenwolf has made clarifications that he is not TDUK's programmer. This guy just scours the internet and conscripts other's work, sometimes rebranding it, and offering it as his product.

But anyway, with regards to the mouse-click issue on CCGTV in Android 12: I have identified the reason for it and a work-around. It's not just something with your app, but actually every app and any mouse, even mice physically connected using USB or Bluetooth connections.

Refer to the following for details: https://developer.android.com/about/versions/12/behavior-changes-all#untrusted-touch-events

To restore mouse functionality:

# A specific app
adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES com.example.app

# All apps
# If you'd still like to see a Logcat message warning when a touch would be
# blocked, use 1 instead of 0.
adb shell settings put global block_untrusted_touches 0

I haven't actually tried this with your app, but I can vouch that my Bluetooth mouse works normally after using the above adb command for all apps.

Before I got a Bluetooth mouse, your app saved my bacon and allowed me to use apps that absolutely require a mouse for some things. For that I thank you and really appreciate your great work!

virresh commented 1 year ago

Thanks @minimeh That is indeed exactly the problem for which I've made the cursor sufficiently transparent to pass the trust threshhold.

Disabling the trust checks altogether would work for sure! In case anyone on this thread wants to try out what minimeh is suggesting, following is the command to disable trust check only for MATVT 1.0.7-pre:

adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES io.github.virresh.matvt

and they've already mentioned disabling the trust check globally.

I'm looking into a more longer term solution as I feel most ppl wouldn't bother doing this.

@Tbo29 thanks for the log, but they seem to be missing startup logs (e.g this one) and system logs (like Untrusted touch due to occlusion by)

And yes, I'm aware the image I'm using might not be exactly same as the commercial version, and probably will never be because every manufacturer has their own different image which is proprietary and cannot be accessed easily, but if there is any open source equivalent of the CCGTV image, that'll be more helpful.

virresh commented 1 year ago

Folks, can someone test with https://github.com/virresh/matvt/releases/download/v1.0.7-pre/matvt-app-release-1.0.7-pre2.apk ?

This has a different set of fixes for the android platform trust issues. This also has more advanced and detailed logs, so hoping to get more information from them.

EDIT: Please completely uninstall before trying with this. Some changes may not take effect if the old service isn't completely shut down (completely erased from RAM and all caches, for which uninstalling is the quickest and fastest way).

TerryUK commented 1 year ago

On pointers TVQuickActions uses a blob not an arrow, very similar to the Android TV Downloader app. Good enough I reckon rather than a pointer least for a TV screen.

kokotas89 commented 1 year ago

Tried the latest pre release on ccwgtv on Android tv os 12 but unfortunately nothing's changed. Scrolling and clicking still not working.

sujhran commented 1 year ago

I have tried 1.0.7 Pre 2 apk on chromecast 4K Android 12 so this time mouse click does not work at all. In previous release we were able to click one time on the selected tab but if we move mouse doesn't click anywhere else.

virresh commented 1 year ago

Unfortunate.

The pointers in matvt are customisable, so you can use the orb if you want instead of pointer.

I have removed the fallback click mechanism due to which clicking on focused elements no longer works.

Could someone post logs as well?

kokotas89 commented 1 year ago

Here are the logs from my device. Hope it helps you out. logcat.txt

BTW trying to disable the trust checks via the adb command you posted throws this error: "Cannot override a change on a non-debuggable app and user build."

Global command did work but same results... Still can't click or scroll. This was only tested on 1.0.7 pre2.

Edit: A more complete log with startup info as well logcat2.txt

And a last one using '-b all' option and filtered by pid: logcat5.txt

sujhran commented 1 year ago

Can someone help me, how to get the logs from chromecast 4k (google TV).

I feel like I am lost.

kokotas89 commented 1 year ago

@sujhran You basically connect to your chromecast remotely via ADB and write the logcat info to your PC or phone.

adb connect 192.168.X.X:5555 (chromecast's IP address) adb -s 192.168.X.X:5555 logcat -d > /sdcard/logcat.txt

I won't get into specifics here but you can look up adb network debugging to figure it out.