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

Add position parameter to mobileInjectEmulatorCameraImage #940

Closed
hadalin opened this issue Jun 21, 2024 · 9 comments
Closed

Add position parameter to mobileInjectEmulatorCameraImage #940

hadalin opened this issue Jun 21, 2024 · 9 comments

Comments

@hadalin
Copy link

hadalin commented Jun 21, 2024

The mobileInjectEmulatorCameraImage is very useful, thank you.

Would it be possible to add position parameter, along with the payload that would allow setting the position of the injected image?

@mykola-mokhnach
Copy link
Contributor

It is possible to add such argument, however I don't think it is going to work seamlessly. You'd need to restart the whole emulator in order for it to be picked up. The reason for that is that Google provides no way to change virtual scene params over the telnet interface except of for images themselves (I mean the virtualscene-image utility command).

Other settings need to be loaded from the config file directly, which requires the media service to be restarted. And since it is not possible to do that without having the root access, the only way would be to restart the emulator completely.

@hadalin
Copy link
Author

hadalin commented Jun 21, 2024

If I understand correctly, this config gets passed to the virtualscene-image command. Perhaps I'm missing something, but wouldn't changing position affect the position of the injected image without the need to change virtual scene params?

@hadalin
Copy link
Author

hadalin commented Jun 21, 2024

I think I get it. You'd need to restart the emulator for CONFIG changes to be applied.

@mykola-mokhnach
Copy link
Contributor

I think I get it. You'd need to restart the emulator for CONFIG changes to be applied.

Right. The whole emulator must be restarted in order for virtual scene to pick up the changes

@hadalin hadalin closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
@hadalin
Copy link
Author

hadalin commented Jun 21, 2024

Also, when I used mobileInjectEmulatorCameraImage for the first time to inject the image (in appium-uiautomator2-driver), the image didn't appear in the virtual scene. It appeared later on. I'm not sure when, but probably after I restarted the emulator. Could that be the case?

@mykola-mokhnach
Copy link
Contributor

yes, it could be the case. https://github.com/appium/appium-uiautomator2-driver?tab=readme-ov-file#mobile-injectemulatorcameraimage mentions that camera service needs to be restarted after the config is changed for the very first time, although it is probably not very obvious. I'll update it to be clear about emulator restart.

@mykola-mokhnach
Copy link
Contributor

@hadalin Maybe try appium/appium-uiautomator2-driver#798 after it is merged. It still needs to restart the emulator, but it's probably ok, since the action is anyway automated

@hadalin
Copy link
Author

hadalin commented Jun 22, 2024

What could be done, though, is to split the functionality into two methods. The first one would be something like mobileSetupEmulatorCameraImage that would require a restart. It could also take size and position parameters. The second one would be mobileInjectEmulatorCameraImage as it is. It would possibly be more obvious there's a "setup" phase involved here.

@mykola-mokhnach
Copy link
Contributor

I assume it would be painful to do emulator restart mid-session. the reason for it is that the uia2 server must be running there. By restarting the emulator we have to kill it and then restore the session seamlessly. Currently it is not possible without major architecture changes in the server package.

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

No branches or pull requests

2 participants