Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show touch #44

Open
AndroidDeveloperLB opened this issue Mar 11, 2018 · 35 comments
Open

Show touch #44

AndroidDeveloperLB opened this issue Mar 11, 2018 · 35 comments

Comments

@AndroidDeveloperLB
Copy link

In developer options, there is an option "show taps", that whenever you touch the screen, a white circle appears.
For some reason, it doesn't appear when using this app.
Please let us have it.
It can be useful for screenshots and screen-video capture.

@rom1v rom1v changed the title Request: show touch Show touch Mar 11, 2018
@rom1v
Copy link
Collaborator

rom1v commented Mar 11, 2018

For some reason, it doesn't appear when using this app.

Yes, injecting events does not display the circle. It is probably triggered at lower level. Nothing we can do IMO. So I'm closing.

Feel free to reopen if there is a technical solution.

@rom1v rom1v closed this as completed Mar 11, 2018
@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Mar 11, 2018

@AndroidDeveloperLB
Copy link
Author

Please re-consider

@rom1v rom1v reopened this Mar 12, 2018
@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2018

In developer options, there is an option "show taps", that whenever you touch the screen, a white circle appears.

At least, I added an option to enable show touches while scrcpy is running: #96.

@AndroidDeveloperLB
Copy link
Author

I have 1.1, and I don't see "touches" of the mouse. Only when I touch the screen myself (with the finger).

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2018

I have 1.1, and I don't see "touches" of the mouse. Only when I touch the screen myself (with the finger).

  1. It only enable the show touches option in developer settings (so you will only see physical touches, not mouse clicks, technically it is probably implemented in some code that event injection does not trigger).
  2. it's implemented in dev (not released yet).
  3. The application must be started with scrcpy --show-touches.

@AndroidDeveloperLB
Copy link
Author

Well I have it enabled anyway in the settings of the OS...
But what I wrote here, is that I'd like to see the touches indications (and maybe even customize them and have new ones, like the links of material design I've shown) on the PC app itself.

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2018

Yes, I got it.

I just notified that I added an option to automatically enable/disable the setting in developers options, because it is somehow related.

I didn't say I implemented what you requested (that's why I left the issue open).

@AndroidDeveloperLB
Copy link
Author

I see.
Say, is it possible to somehow be notified of new versions of this tool?
Maybe a specific website URL that I can monitor via this website:
https://www.changedetection.com/login.html
?
I just think it's such a nice tool. I wish it would have been a part of the IDE itself.

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2018

Say, is it possible to somehow be notified of new versions of this tool?

I don't know, maybe: https://github.com/Genymobile/scrcpy/releases.atom

In the future, I hope it will be packaged in distributions (it is already packaged for Arch Linux and Homebrew for MacOS, so the update is automatic).

@AndroidDeveloperLB
Copy link
Author

I use Windows...
And the website url you've provided is blocked, because it has "robots.txt" file.
:(

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2018

I use Windows...

Sorry for you :trollface:

And the website url you've provided is blocked, because it has "robots.txt" file.

The URL is an rss/atom feed, you can use any feed reader.

@AndroidDeveloperLB
Copy link
Author

Haha. I like Linux only for development (and I hate the UX of MacOS), and I used it a very long time ago.
But for the past years I got Windows at the office.

About rss/atom, ok.

@AndroidDeveloperLB
Copy link
Author

I've now registered to this for the Atom/Rss of github:
https://ifttt.com/applets/400948p-get-notifications-about-github-releases

I hope it works.

@AndroidDeveloperLB
Copy link
Author

I've noticed this is possible now:

image

But when I try it , I still don't see it:

image

@rom1v
Copy link
Collaborator

rom1v commented May 29, 2018

This is just #44 (comment)

@AndroidDeveloperLB
Copy link
Author

@rom1v Isn't it a new feature? If not, why mention it?
I can see v1.2 was out just some hours ago:

image

@rom1v
Copy link
Collaborator

rom1v commented May 29, 2018

Isn't it a new feature? If not, why mention it?

The feature was implemented 2 months ago in the dev branch, but it was after the last release v1.1. This is the first time it is released.

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented May 29, 2018

Well it doesn't work for me.
In fact it disabled the touch indication I had before

@rom1v
Copy link
Collaborator

rom1v commented May 29, 2018

It enables it on start, and disable it on stop. If you let it enabled, just don't use the option.

When you touch the screen with your finger, it should show touches.

@AndroidDeveloperLB
Copy link
Author

@rom1v I've removed the flag. Still can't see the touches using the mouse.
See video:

ice_video_20180529-094117.zip

Also, almost sure it's because of this app: On first run, the mouse couldn't get to reach the taskbar of the Windows OS itself. Instead it gets hidden. On next runs, it didn't happen.
Weird thing is that I didn't see it on a different PC, so not 100% sure it's because of this.

@rom1v
Copy link
Collaborator

rom1v commented May 29, 2018

I've removed the flag. Still can't see the touches using the mouse.

I'm not sure you understand what the feature does.

From scrcpy --help:

    -t, --show-touches
        Enable "show touches" on start, disable on quit.
        It only shows physical touches (not clicks from scrcpy).

So:

  • if you don't pass the flag, it does not change the "show touches" option (if it was enabled, it stays enabled)
  • if you pass the flag, it enable it on start, and disable it on quit
  • the "show touches" option only display physical touches

ice_video_20180529-094117.zip

(don't zip videos 😉)

On first run, the mouse couldn't get to reach the taskbar of the Windows OS itself. Instead it gets hidden. On next runs, it didn't happen.

Weird.

@AndroidDeveloperLB
Copy link
Author

So it doesn't show touches for the PC app. Only touches on the phone itself.
Please add feature to show mouse "touches".
Now that I re-read what I wrote here (sorry I forgot about it), it's the same as I wrote originally on this thread.

About uploading videos, Github doesn't allow to upload them directly. It can only allow specific files types.

@rom1v rom1v added the showtaps label Sep 19, 2018
@williamfzc
Copy link

williamfzc commented Dec 13, 2018

+1

This feature will be very useful in automation. Without this, it's really hard to get touch position from video or picture. But it's not an easy job I think :(

minitouch is an available option (maybe).

@AndroidDeveloperLB
Copy link
Author

@rom1v If it's impossible to cause the touch indicators appear on the device itself, it could be nice to show them just on the window of ScrCpy alone.
Have a flag for this, as some people might not want it.

@twaik
Copy link

twaik commented Oct 11, 2022

IMHO we can close this since we have -t, --show-touches option.
@rom1v .

@AndroidDeveloperLB
Copy link
Author

@twaik No, I already wrote about this:
#44 (comment)

@allco
Copy link

allco commented Feb 16, 2023

I always spread scrcpy among all the devs that I work with.
And this is something that we really need on daily basis - like to show something on my screen during a video call or record the screen video.

Looking forward to get this function working.
I would be really useful.

-t does not work for me

@AndroidDeveloperLB
Copy link
Author

@allco He talks about real touches. The request I made is for "simulated" touches (by the mouse).

@jinktet
Copy link

jinktet commented Aug 29, 2023

Have you found a solution to your problem yet? I am also having the same problem as you.

@zguig52
Copy link

zguig52 commented Dec 1, 2023

Hi there, don't know if it is the right place to talk about this.
It would be nice also to have the option to customize the icon used to show touch event (being on the device only, on the screen only or on both).

@pshbot
Copy link

pshbot commented Feb 16, 2024

Interestingly, the related option "Pointer location" in Android's Developer options does work with simulated events from scrcpy.

image

It's not pretty, and I would much prefer "Show taps" to work, but it is better than nothing.

@robertkirkman
Copy link

robertkirkman commented Jun 20, 2024

Hello, I have created a workaround for a subset of this issue.
My workaround can be used on any device for which you can already successfully compile, install and boot a custom ROM.

Caution

Unfortunately, I think my method is not possible on devices that have locked bootloaders.

I have done this by editing the internal source code of the Android operating system and then recompiling and reinstalling it. This is the first Android custom ROM I have ever written.

Here is a demo recording of what my workaround does for scrcpy. Watch to the end to see the workaround in action.

redroid-dot.webm

The strategy behind my code is, since the "Show taps" backend only responds to physical touchscreen devices,
but the "Pointer location", which uses an entirely different codepath, responds to both scrcpy and touchscreen,
I copied and pasted the texture loading code that "Show taps" invokes to fetch its texture, into the source code that renders "Pointer location", to force it to render that same texture instead of its ugly official renderer, and as it turns out, doing that does in fact work.

Here is a full commands list to reproduce what my demo video shows. The custom ROM I forked is redroid, the Android docker container; however, the code file I edited was not previously edited by any redroid-specific changes, leading me to assume that my code should also apply cleanly and work on any Android 14 based custom ROM. I imagine it is hopefully also not too difficult for people to backport to Android 13 or older for at least any versions in which the PointerLocationView.java remains relatively similar to the one I found in Android 14.

Prerequisites to reproduce my demo

Warning

Normal Debian 12 bookworm does not provide sufficient versions of all of these by default so you would need to find ways to install a new enough version of each one into your distro. Compare your versions with the version numbers I show in my demo video if you encounter any problem.

  • amd64 host system with root and unlocked bootloader to boot custom kernel
  • up to date version of docker
  • up to date version of scrcpy
  • up to date version of repo
  • up to date version of git with a name and email set
  • up to date version of git lfs
  • up to date kernel with these build flags enabled:
    • CONFIG_DMABUF_HEAPS=y
    • CONFIG_DMABUF_HEAPS_SYSTEM=y
    • CONFIG_ANDROID_BINDER_IPC=y
    • CONFIG_ANDROID_BINDERFS=y
    • CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
  • 250 GB free space in storage drive

Commands I used

Warning

Copy and paste each command one by one instead of clicking the github "copy" button and trying to run this as a script.

git clone https://github.com/remote-android/redroid-patches.git
mkdir redroid-src
cd redroid-src
repo init -u https://android.googlesource.com/platform/manifest --git-lfs --depth=1 -b android-14.0.0_r45
git clone https://github.com/remote-android/local_manifests.git .repo/local_manifests -b 14.0.0
repo sync -c -j$(nproc)
../redroid-patches/apply-patch.sh $(pwd)
(curl https://gist.githubusercontent.com/robertkirkman/21ae17b3aa0e1b48ca67864f7cb0c158/raw/595f739b3b260c20874dd510abdd17292affc624/pointerlocationisshowtapsclone.patch && echo) | git apply -v -C frameworks/base
wget https://raw.githubusercontent.com/remote-android/redroid-doc/master/android-builder-docker/Dockerfile
docker buildx create --use
docker buildx build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder --load .
docker run -it --privileged --rm --hostname redroid-builder --name redroid-builder -v $(pwd):/src redroid-builder
cd /src
. build/envsetup.sh
lunch redroid_x86_64_only-userdebug
m -j$(nproc)
exit
cd out/target/product/redroid_x86_64_only/
sudo mount system.img system -o ro
sudo mount vendor.img vendor -o ro
sudo tar --xattrs -c vendor -C system --exclude="./vendor" . | docker import --platform=linux/amd64 -c 'ENTRYPOINT ["/init", "qemu=1", "androidboot.hardware=redroid", "androidboot.redroid_fps=30", "androidboot.redroid_width=1280", "androidboot.redroid_height=720", "androidboot.redroid_gpu_mode=host"]' - redroid-dot
sudo umount system vendor
docker run -itd --privileged --name redroid-dot -v ~/redroid-dot-data:/data -p 8022:8022 -p 5555:5555 redroid-dot
adb connect localhost
scrcpy

Here is a direct link to the Java code patch implementation of my workaround, which applies to the Android 14 source code file frameworks/base/core/java/com/android/internal/widget/PointerLocationView.java. You can see it applied in my example commands right after I sync the Android repository and apply other vendor patches.

@twaik
Copy link

twaik commented Jun 21, 2024

Probably there could be other, more universal solution. Since app is running in adb it could use SurfaceTransactions via parts of licfsurface code and draw circle in emulated tap locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants