DeviceFarmer / minicap

Stream real-time screen capture data out of Android devices.
Other
295 stars 76 forks source link

Vector<> have different types XI AOMI MI_10 MIUI_12 Android 10 (SDK 29) #6

Open varundtsfi opened 4 years ago

varundtsfi commented 4 years ago

Hi, We are facing this issue in Xiaomi MIUI 11 and MIUI 12 too. As per my understanding It's not related with Android Version but related with Xiaomi MIUI Version. Previously it was coming in MIUI 11 but not it's there in 12 too. I tried to downgrade my xiaomi device from MIUI 11 to MIUI 10 then its started working. Below is the old reference (https://github.com/openstf/minicap/issues/169) (https://github.com/DeviceFarmer/minicap/issues/2) Previously It was coming in LG Got Resolved by @pcrepieux but Same binaries which is working fine for LG devices those are not working in Xiaomi. In Xiaomi It coming as a black screen.

Device Details:- [ro.product.model]: [Mi 10]

INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:240) Creating SurfaceComposerClient INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:243) Performing SurfaceComposerClient init check INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:254) Creating virtual display INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:260) Creating buffer queue INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:263) Setting buffer options INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:267) Creating CPU consumer INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:271) Creating frame waiter INFO: (external/MY_minicap/minicap/src/minicap_29.cpp:275) Publishing virtual display Vector<> have different types (this=0x7fd1f95480, rhs=0x73e7b4e030) aborted

issue-label-bot[bot] commented 4 years ago

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

dkw72n commented 4 years ago

I managed to make it work on my device(MI CC9 Pro, MIUI 11 20.3.9, Android 10) with one line added to the AOSP code

diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h
index f438eb3d0..98490849b 100644
--- a/libs/gui/include/gui/LayerState.h
+++ b/libs/gui/include/gui/LayerState.h
@@ -254,6 +254,7 @@ struct DisplayState {

     uint32_t width, height;

+    uint8_t _dummy[16];
     status_t write(Parcel& output) const;
     status_t read(const Parcel& input);
 };

It doesn't matter if the internal layout of this struct is exactly the same with MIUI's, as long as they shared the same size, it should work (of course for MIUI ONLY).

pcrepieux commented 4 years ago

Well done @dkw72n Thanks for sharing. FYI, there is an ongoing work to get rid of the AOSP compilation dependency but up until this is completed your tip might be helpful to some users. From the project perspective, I am not sure how to handle this properly. I might as well try to speed up the new implementation which hopefully is expected to be future proof (current minicap breaks at every new release).

man4567890 commented 4 years ago

Hi @dkw72n , Do you have the compiled binaries please, I do not have the ability to build and I do not know which file to change, I guess you have to change the source and build? Please correct me if I'm wrong

varundtsfi commented 4 years ago

@pcrepieux I have MI 10 device android 10 with MIUI 12. I will try with android 10 aosp using the suggested changes.

In the libs/gui/include/gui/LayerState.h file and by added this line

varundtsfi commented 4 years ago

@pcrepieux I have build the AOSP by adding the changes suggested by @dkw72n and It's working fine with MIUI 11 and 12.

There is an issue it's not generic as suggested by @dkw72n these binaries will be supported only for Xiaomi device having MIUI 11 and 12. WhatsApp Image 2020-11-01 at 11 09 02

Again @dkw72n thanks for your suggestion man. :smile:

varundtsfi commented 4 years ago

@man4567890 I will share the binaries very soon on my git branch.

man4567890 commented 4 years ago

@varundtsfi much appreciated!

chaooe commented 4 years ago

Does the aosp for the android system? I don't know where the file is /libs/gui/include/gui/LayerState.h

varundtsfi commented 4 years ago

Hi @chaooe It's in frameworks/native/include/gui/LayerState.h. and Yes AOSP is android system.

chaooe commented 4 years ago

@varundtsfi sorry, it's not easy to download the AOSP and compline it for me. Could you help to build the minicap.so to me? my device version is android29, and abi is arm64-v8a

pcrepieux commented 4 years ago

@chaooe I believe you'll find it here https://github.com/varundtsfi/Xiaomi_Vector_issue/tree/main/android-29/arm64-v8a thanks to @varundtsfi Hope this helps until we decide how to properly update the project.

chaooe commented 4 years ago

Thanks, it works. Mi 10 with Android 10. And the MIUI version is 12.08. Will try more Mi device which blocked me before.

man4567890 commented 4 years ago

Thanks @varundtsfi , I tried it on a LGE phone, but it still breaks, I guess it only works on Xiaomi

2020-11-03T08:38:03.776Z INF/device:plugins:touch 7166 [LMK920TM1f70231a] Reading minitouch banner
2020-11-03T08:38:03.818Z INF/device:plugins:touch 7166 [LMK920TM1f70231a] minitouch says: "Connection established"
2020-11-03T08:38:03.828Z INF/device:plugins:vnc 7166 [LMK920TM1f70231a] Starting VNC server on port 7470
2020-11-03T08:38:03.830Z INF/device:plugins:browser 7166 [LMK920TM1f70231a] Loading browser list
2020-11-03T08:38:03.868Z INF/device:plugins:browser 7166 [LMK920TM1f70231a] Updating browser list
2020-11-03T08:38:03.870Z INF/device:plugins:mute 7166 [LMK920TM1f70231a] Will not mute master volume
2020-11-03T08:38:04.143Z INF/device:resources:minirev 7166 [LMK920TM1f70231a] Installing "/usr/lib/node_modules/stf/vendor/minirev/arm64-v8a/minirev" as "/data/local/tmp/minirev"
2020-11-03T08:38:04.306Z INF/device:plugins:forward 7166 [LMK920TM1f70231a] Launching reverse port forwarding service
2020-11-03T08:38:04.333Z INF/device:plugins:forward 7166 [LMK920TM1f70231a] Connecting to reverse port forwarding service
2020-11-03T08:38:04.516Z INF/device 7166 [LMK920TM1f70231a] Fully operational
2020-11-03T08:41:30.959Z IMP/device:plugins:group 7166 [LMK920TM1f70231a] Now owned by ******
2020-11-03T08:41:30.960Z INF/device:plugins:group 7166 [LMK920TM1f70231a] Subscribing to group channel "27wYow6vQ7KHx53MvmzFQw=="
2020-11-03T08:41:33.145Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Setting frame producer projection to 865x865
2020-11-03T08:41:33.146Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Requesting frame producer to start
2020-11-03T08:41:33.147Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Launching screen service
2020-11-03T08:41:33.244Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "PID: 31995"
2020-11-03T08:41:33.245Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: Using projection 1080x2400@389x865/0"
2020-11-03T08:41:33.245Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:241) Creating SurfaceComposerClient"
2020-11-03T08:41:33.247Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Connecting to minicap service
2020-11-03T08:41:33.248Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:244) Performing SurfaceComposerClient init check"
2020-11-03T08:41:33.249Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:255) Creating virtual display"
2020-11-03T08:41:33.249Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:261) Creating buffer queue"
2020-11-03T08:41:33.249Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:264) Setting buffer options"
2020-11-03T08:41:33.250Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:268) Creating CPU consumer"
2020-11-03T08:41:33.250Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:272) Creating frame waiter"
2020-11-03T08:41:33.251Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:276) Publishing virtual display"
2020-11-03T08:41:33.252Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "Vector<> have different types (this=0x7ff5b517d0, rhs=0x7ff5b51920)"
2020-11-03T08:41:33.364Z WRN/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Shell keeping minicap running ended unexpectedly
2020-11-03T08:41:35.060Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Disconnecting from minicap service
2020-11-03T08:41:35.063Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Stopping minicap service
2020-11-03T08:41:35.064Z FTL/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Frame producer had an error FailError: Failure: 'closed'
    at /usr/lib/node_modules/stf/node_modules/adbkit/lib/adb/parser.js:183:29
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
2020-11-03T08:41:35.064Z FTL/util:lifecycle 7166 [LMK920TM1f70231a] Shutting down due to fatal error
2020-11-03T08:41:35.073Z INF/provider 12558 [*] Cleaning up device worker "LMK920TM1f70231a"
2020-11-03T08:41:35.073Z ERR/provider 12558 [*] Device worker "LMK920TM1f70231a" died with code 1
2020-11-03T08:41:35.074Z INF/provider 12558 [*] Restarting device worker "LMK920TM1f70231a"
2020-11-03T08:41:36.028Z INF/device:support:push 26999 [LMK920TM1f70231a] Sending output to "tcp://127.0.0.1:7116"
2020-11-03T08:41:36.033Z INF/device 26999 [LMK920TM1f70231a] Preparing device
2020-11-03T08:41:36.619Z INF/device:support:sub 26999 [LMK920TM1f70231a] Receiving input from "tcp://127.0.0.1:7114"
2020-11-03T08:41:36.621Z INF/device:support:sub 26999 [LMK920TM1f70231a] Subscribing to permanent channel "*ALL"
2020-11-03T08:41:36.715Z INF/device:support:properties 26999 [LMK920TM1f70231a] Loading properties
2020-11-03T08:41:36.798Z INF/device:support:sdk 26999 [LMK920TM1f70231a] Supports SDK 29
2020-11-03T08:41:36.799Z INF/device:support:abi 26999 [LMK920TM1f70231a] Supports ABIs arm64-v8a, armeabi-v7a, armeabi
pcrepieux commented 4 years ago

Indeed, that likely is devices specific. I wouldn't be surprised that applying the fix suggested by @dkw72n with another array size could make it work but I don't find it would be an appropriate solution. That's great for Xiaomi users but for other devices that are impacted, the only viable solution I can think of will come with the reimplementation of minicap.

varundtsfi commented 4 years ago

properly

@chaooe I believe you'll find it here https://github.com/varundtsfi/Xiaomi_Vector_issue thanks to @varundtsfi Hope this helps until we decide how to properly update the project.

@pcrepieux Thank you so much Actually I am building for Android 9 too and soon those will be available on my git.

varundtsfi commented 4 years ago

Indeed, that likely is devices specific. I wouldn't be surprised that applying the fix suggested by @dkw72n with another array size could make it work but I don't find it would be an appropriate solution. That's great for Xiaomi users but for other devices that are impacted, the only viable solution I can think of will come with the reimplementation of minicap.

I Agreed with you sir but by the time People can resume their work. I think Video streaming would be a good option as I am using scrcpy which is working fine on each and every device.

varundtsfi commented 4 years ago

Thanks, it works. Mi 10 with Android 10. And the MIUI version is 12.08. Will try more Mi device which blocked me before.

Here are the Prebuilt binaries for Android 9 with MIUI 11 and 12 too. @chaooe , @man4567890 and @pcrepieux

https://github.com/varundtsfi/Xiaomi_Vector_issue

varundtsfi commented 4 years ago

Thanks @varundtsfi , I tried it on a LGE phone, but it still breaks, I guess it only works on Xiaomi

2020-11-03T08:38:03.776Z INF/device:plugins:touch 7166 [LMK920TM1f70231a] Reading minitouch banner
2020-11-03T08:38:03.818Z INF/device:plugins:touch 7166 [LMK920TM1f70231a] minitouch says: "Connection established"
2020-11-03T08:38:03.828Z INF/device:plugins:vnc 7166 [LMK920TM1f70231a] Starting VNC server on port 7470
2020-11-03T08:38:03.830Z INF/device:plugins:browser 7166 [LMK920TM1f70231a] Loading browser list
2020-11-03T08:38:03.868Z INF/device:plugins:browser 7166 [LMK920TM1f70231a] Updating browser list
2020-11-03T08:38:03.870Z INF/device:plugins:mute 7166 [LMK920TM1f70231a] Will not mute master volume
2020-11-03T08:38:04.143Z INF/device:resources:minirev 7166 [LMK920TM1f70231a] Installing "/usr/lib/node_modules/stf/vendor/minirev/arm64-v8a/minirev" as "/data/local/tmp/minirev"
2020-11-03T08:38:04.306Z INF/device:plugins:forward 7166 [LMK920TM1f70231a] Launching reverse port forwarding service
2020-11-03T08:38:04.333Z INF/device:plugins:forward 7166 [LMK920TM1f70231a] Connecting to reverse port forwarding service
2020-11-03T08:38:04.516Z INF/device 7166 [LMK920TM1f70231a] Fully operational
2020-11-03T08:41:30.959Z IMP/device:plugins:group 7166 [LMK920TM1f70231a] Now owned by ******
2020-11-03T08:41:30.960Z INF/device:plugins:group 7166 [LMK920TM1f70231a] Subscribing to group channel "27wYow6vQ7KHx53MvmzFQw=="
2020-11-03T08:41:33.145Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Setting frame producer projection to 865x865
2020-11-03T08:41:33.146Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Requesting frame producer to start
2020-11-03T08:41:33.147Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Launching screen service
2020-11-03T08:41:33.244Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "PID: 31995"
2020-11-03T08:41:33.245Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: Using projection 1080x2400@389x865/0"
2020-11-03T08:41:33.245Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:241) Creating SurfaceComposerClient"
2020-11-03T08:41:33.247Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Connecting to minicap service
2020-11-03T08:41:33.248Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:244) Performing SurfaceComposerClient init check"
2020-11-03T08:41:33.249Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:255) Creating virtual display"
2020-11-03T08:41:33.249Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:261) Creating buffer queue"
2020-11-03T08:41:33.249Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:264) Setting buffer options"
2020-11-03T08:41:33.250Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:268) Creating CPU consumer"
2020-11-03T08:41:33.250Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:272) Creating frame waiter"
2020-11-03T08:41:33.251Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:276) Publishing virtual display"
2020-11-03T08:41:33.252Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] minicap says: "Vector<> have different types (this=0x7ff5b517d0, rhs=0x7ff5b51920)"
2020-11-03T08:41:33.364Z WRN/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Shell keeping minicap running ended unexpectedly
2020-11-03T08:41:35.060Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Disconnecting from minicap service
2020-11-03T08:41:35.063Z INF/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Stopping minicap service
2020-11-03T08:41:35.064Z FTL/device:plugins:screen:stream 7166 [LMK920TM1f70231a] Frame producer had an error FailError: Failure: 'closed'
    at /usr/lib/node_modules/stf/node_modules/adbkit/lib/adb/parser.js:183:29
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
2020-11-03T08:41:35.064Z FTL/util:lifecycle 7166 [LMK920TM1f70231a] Shutting down due to fatal error
2020-11-03T08:41:35.073Z INF/provider 12558 [*] Cleaning up device worker "LMK920TM1f70231a"
2020-11-03T08:41:35.073Z ERR/provider 12558 [*] Device worker "LMK920TM1f70231a" died with code 1
2020-11-03T08:41:35.074Z INF/provider 12558 [*] Restarting device worker "LMK920TM1f70231a"
2020-11-03T08:41:36.028Z INF/device:support:push 26999 [LMK920TM1f70231a] Sending output to "tcp://127.0.0.1:7116"
2020-11-03T08:41:36.033Z INF/device 26999 [LMK920TM1f70231a] Preparing device
2020-11-03T08:41:36.619Z INF/device:support:sub 26999 [LMK920TM1f70231a] Receiving input from "tcp://127.0.0.1:7114"
2020-11-03T08:41:36.621Z INF/device:support:sub 26999 [LMK920TM1f70231a] Subscribing to permanent channel "*ALL"
2020-11-03T08:41:36.715Z INF/device:support:properties 26999 [LMK920TM1f70231a] Loading properties
2020-11-03T08:41:36.798Z INF/device:support:sdk 26999 [LMK920TM1f70231a] Supports **SDK 29**
2020-11-03T08:41:36.799Z INF/device:support:abi 26999 [LMK920TM1f70231a] Supports ABIs arm64-v8a, armeabi-v7a, armeabi

I have the binaries for LGE SDK 28 (https://github.com/varundtsfi/Xiaomi_Vector_issue) but your device having SDK Level 29 so I need to build for 29 then only it will work and Yes those binaries only for Xiamoi device having Android 9 and 10 or MIUI having 11 or 12.

man4567890 commented 4 years ago

Thanks so much @varundtsfi

pcrepieux commented 4 years ago

Thanks @varundtsfi for your efforts to help users having this issue. The plan definitely is to upgrade minicap and I absolutely agree that scrcpy is a very nice tool. My current goal is to make minicap operate at a higher level (like they do) to decrease CPU arch, ABI, fragmentations issues because I am afraid that duplicating the minicap.so will be hard to maintain. Will try to publish some code shortly.

pcrepieux commented 4 years ago

I just started an experimental branch with the WIP code (mostly a proof of concept for now). Looks OK on pixel 4 running Android11 and a Mi 9 running Android 9 (that one used to have the "Vector<> have different types" error) Note: there is a directory named experimental in this branch which contains a kotlin implementation of minicap (at least partially).

$ cd experimental
$ ./gradlew assembleDebug
$ adb push ./app/build/outputs/apk/debug/minicap-0.1-debug.apk /data/local/tmp/
$ adb shell CLASSPATH=/data/local/tmp/minicap-0.1-debug.apk app_process /system/bin io.devicefarmer.minicap.Main

Will document this and continue the dev & integration with stf shortly

ii958 commented 4 years ago

it works

varundtsfi commented 4 years ago

I just started an experimental branch with the WIP code (mostly a proof of concept for now). Looks OK on pixel 4 running Android11 and a Mi 9 running Android 9 (that one used to have the "Vector<> have different types" error) Note: there is a directory named experimental in this branch which contains a kotlin implementation of minicap (at least partially).

$ cd experimental
$ ./gradlew assembleDebug
$ adb push ./app/build/outputs/apk/debug/minicap-0.1-debug.apk /data/local/tmp/
$ adb shell CLASSPATH=/data/local/tmp/minicap-0.1-debug.apk app_process /system/bin io.devicefarmer.minicap.Main

Will document this and continue the dev & integration with stf shortly

Hi @pcrepieux Your solution is working fine on Xiaomi Devices too.

wokring

pcrepieux commented 4 years ago

Thanks for the feedbacks @varundtsfi, @ii958 @man4567890 could you give it a try on your LG device ?

man4567890 commented 4 years ago

@pcrepieux ,could you provide me with the .so files please, I tried to build this, but got a bit confused, so I'm not sure if I have the correct binaries

pcrepieux commented 4 years ago

@man4567890, there is no more .so files.

The following instructions assumes MINICAP_SRC_PATH is the path where you cloned the experimental branch (those are pretty much the same as the original ones here).

1) Run minicap on the device

$ cd MINICAP_SRC_PATH/experimental
$ ./gradlew assembleDebug
$ adb push ./app/build/outputs/apk/debug/minicap-0.1-debug.apk /data/local/tmp/
$ adb shell CLASSPATH=/data/local/tmp/minicap-0.1-debug.apk app_process /system/bin io.devicefarmer.minicap.Main

2) Run the sample web application

$ cd MINICAP_SRC_PATH/example
$ adb forward tcp:1717 localabstract:minicap
$ node app.js

3) Open your web browser on http://localhost:9002

You should see your device screen in your browser.

man4567890 commented 4 years ago

Thanks @pcrepieux , let me see if I can mange this, will let you know

varundtsfi commented 4 years ago

@pcrepieux sure give me some time. I have to arrange the device but I will come back with results.

yusunan commented 4 years ago

@varundtsfi Could you share the android-27 file We have an Redmi 5 device It's android 8.1 and MIUI 11

man4567890 commented 4 years ago

./gradlew assembleDebug

Hi @pcrepieux , Unfortunately I cannot test this, my setup is different where STF runs on a main server and the phones are connected to mini PCs in different locations. I cannot install Gradle as I do not have enough memory on the mini PCs, see below

lib/gradle-launcher-6.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.5
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

I will have to wait for the STF implementation to test this, please let me know, I really need this to work and is willing to be a beta tester for this

man4567890 commented 4 years ago

@pcrepieux , I tried building it on one of my local servers, Centos8, but I think I failed somewhere :-( image

pcrepieux commented 4 years ago

@man4567890 thanks for giving it a try. That looks pretty good to me. Did you try to refresh the page in the browser ? if you launched the adb shell command after opening the webpage (provided that the node app is running), you need to reload the page so that it connects to the minicap socket (that's a basic demo app). Otherwise, it looks like there is a red dot in your browser dev console. That could maybe point out additional info to help identifying the issue.

man4567890 commented 4 years ago

Aaah yes, seems like localhost is hardcoded? This is a headless system, no gui, so I need to open it over the network

image

Let me see if I can set the IP to localhost

man4567890 commented 4 years ago

image

man4567890 commented 4 years ago

If I change it in the index.html, I get

[root@cerc111 example]# cat public/index.html | grep "var ws"
var ws = new WebSocket('ws://192.168.1.111:9002', 'minicap')
[root@cerc111 example]# 

[root@cerc111 example]# adb forward tcp:1717 localabstract:minicap
[root@cerc111 example]# node app.js
Listening on port 9002
Got a client
(node:32324) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/opt/temp/minicap/example/node_modules/ws/lib/Receiver.js:290
  if (mask != null && buf != null) bufferUtil.unmask(buf, mask);
                                              ^

TypeError: Cannot read property 'unmask' of undefined
    at Receiver.unmask (/opt/temp/minicap/example/node_modules/ws/lib/Receiver.js:290:47)
    at Receiver.finish (/opt/temp/minicap/example/node_modules/ws/lib/Receiver.js:459:25)
    at Receiver.expectHandler (/opt/temp/minicap/example/node_modules/ws/lib/Receiver.js:447:33)
    at Receiver.add (/opt/temp/minicap/example/node_modules/ws/lib/Receiver.js:91:24)
    at Socket.firstHandler (/opt/temp/minicap/example/node_modules/ws/lib/WebSocket.js:774:22)
    at Socket.emit (node:events:329:20)
    at addChunk (node:internal/streams/readable:304:12)
    at readableAddChunk (node:internal/streams/readable:279:9)
    at Socket.Readable.push (node:internal/streams/readable:218:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:192:23)
[root@cerc111 example]# 
varundtsfi commented 4 years ago

@yusunan allow me some more time. I am getting some errors during aosp building. Can you tell me device CPU arch so that I will build for required one only. Provide me device details with MIUI version .

As If now I have the same with MIUI 11 which is working fine. @yusunan vector issue will occurred in Xiaomi android version 9 and following versions devices starting with MIUI 11 and 12.

Redmi 5 should work with older binaries.

yusunan commented 4 years ago

@varundtsfi Yes,You are right.it working fine with older binaries. It some thing wrong in my code.Sorry.

pcrepieux commented 4 years ago

@man4567890 Integration within stf is on the way. Do you have an environment that lets you build from source ?

man4567890 commented 4 years ago

Hi @pcrepieux , I do have a docker deploy, but I can spin up a source environment in a couple of hours Whooo whoo, can't wait

pcrepieux commented 4 years ago

Here is the branch minicap-vm which at least looks OK when using SCREEN_GRABBER=minicap-apk bin/stf local on my laptop. The SCREEN_GRABBER environment variable here is to force the use of the new experimental minicap. An alpha release of the minicap package with the new apk included is available here Let me know the results 🤞

man4567890 commented 4 years ago

Thanks @pcrepieux , I will start setting up the test environment

man4567890 commented 4 years ago

Hi @pcrepieux , Are there any instructions how to build this, I unzipped the file from git, tried to do npm install

[root@cerc111 stf-minicap-vm]# npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @devicefarmer/stf@3.5.0
npm ERR! Found: webpack@1.15.0
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^1.12.11" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from webpack-dev-server@3.1.11
npm ERR! node_modules/webpack-dev-server
npm ERR!   dev webpack-dev-server@"^3.1.11" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-30T09_10_54_608Z-debug.log
[root@cerc111 stf-minicap-vm]# 

Tried to run it as it is unzipped

[root@cerc111 bin]# ./stf local --public-ip 192.168.1.111
node:internal/modules/cjs/loader:922
  throw err;
  ^

Error: Cannot find module 'please-update-dependencies'
Require stack:
- /usr/lib/node_modules/stf-minicap-vm/lib/cli/please.js
- /usr/lib/node_modules/stf-minicap-vm/bin/stf
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
    at Function.Module._load (node:internal/modules/cjs/loader:763:27)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/usr/lib/node_modules/stf-minicap-vm/lib/cli/please.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/lib/node_modules/stf-minicap-vm/lib/cli/please.js',
    '/usr/lib/node_modules/stf-minicap-vm/bin/stf'
  ]
}
[root@cerc111 bin]# cd ..
[root@cerc111 stf-minicap-vm]# ls -ltr
total 492
-rw-r--r--. 1 root root 395651 Nov 26 15:45 yarn.lock
-rw-r--r--. 1 root root   3926 Nov 26 15:45 webpack.config.js
drwxr-xr-x. 4 root root     39 Nov 26 15:45 vendor
-rw-r--r--. 1 root root    980 Nov 26 15:45 TESTING.md
drwxr-xr-x. 5 root root     59 Nov 26 15:45 test
drwxr-xr-x. 7 root root     91 Nov 26 15:45 res
-rw-r--r--. 1 root root  34445 Nov 26 15:45 README.md
-rw-r--r--. 1 root root   4798 Nov 26 15:45 package.json
-rw-r--r--. 1 root root    626 Nov 26 15:45 LICENSE
drwxr-xr-x. 7 root root     64 Nov 26 15:45 lib
-rw-r--r--. 1 root root    498 Nov 26 15:45 ISSUE_TEMPLATE.md
-rw-r--r--. 1 root root   6381 Nov 26 15:45 gulpfile.js
-rw-r--r--. 1 root root   2344 Nov 26 15:45 Dockerfile-debian-x86_64
-rw-r--r--. 1 root root   2462 Nov 26 15:45 Dockerfile-debian-armhf
-rw-r--r--. 1 root root   2494 Nov 26 15:45 Dockerfile
drwxr-xr-x. 4 root root     34 Nov 26 15:45 docker
drwxr-xr-x. 3 root root    249 Nov 26 15:45 doc
-rw-r--r--. 1 root root   1305 Nov 26 15:45 CONTRIBUTING.md
-rw-r--r--. 1 root root  14745 Nov 26 15:45 CHANGELOG.md
-rw-r--r--. 1 root root   1496 Nov 26 15:45 bower.json
drwxr-xr-x. 2 root root     17 Nov 26 15:45 bin
[root@cerc111 stf-minicap-vm]# 

I'm doing something stupid no doubt, please could you give me some instruction

pcrepieux commented 3 years ago

Sorry for the delay. I've been busy with another topic lately. The fix is 2 fold.

Will prepare the pull request to have it merged as soon as possible.

EdwardCheck commented 3 years ago

@varundtsfi you shared minicap.so just work on Xiaomi,sdk=29, miui12。 can you share the detailed steps of how you compile minicap.so (minicap-shared)? tks

yusunan commented 3 years ago

@pcrepieux @varundtsfi Share some informations ,We got a new MIUI device as follow IMAGE 下载 (4) And it's not has this aborted issue,So we tested more MIUI devices and We came to a conclusion: XIAOMI has fixed this issue since the device's [Android security patch level] is [2020-09-01 ] So this kind of devices should use the original minicap.so file.

@pcrepieux By the way I had try the 2.60 minicap.apk ,it works fine in other devices but will failed in this device. And its work fine with original minicap and minicap.so file.

截屏2020-12-09 上午10 37 08
PengJunchen commented 3 years ago

@pcrepieux I also try 2.60, but still got failure for MIUI 11.0.23, has that version fixed the issue which mentioned by @varundtsfi ?

varundtsfi commented 3 years ago

@EdwardCheck Yes sure I will share the steps very soon just allow me some time. My Laptop got crashed 3 days back because of that I am not able to do anything.

Lua12138 commented 3 years ago

@EdwardCheck Yes sure I will share the steps very soon just allow me some time. My Laptop got crashed 3 days back because of that I am not able to do anything.

Is there anything new ?

ZGrauer commented 3 years ago

I'm having some issues with setting the projection virtual width and height to reduced values from the real width and height using the minicap-0.1-debug.apk.

The normal minicap.so files are not working for this LG V60 ThinQ 5G device with SDK 29. Every version of minicap.so provided doesn't work and results in vector<> errors. This experimental apk successfully streams the screen but not at the requested size.

Is this a known issue, or am I missing params or not using the APK correctly?

Starting minicap:

[ro.product.build.version.incremental]: [2013217264e42]
[ro.product.build.version.release]: [10]
[ro.product.build.version.sdk]: [29]
[ro.product.cpu.abi]: [arm64-v8a]
adb.exe -s LMV600TMbc31ad40 shell CLASSPATH=/data/local/tmp/minicap-0.1-debug.apk app_process /system/bin io.devicefarmer.minicap.Main -P 1080x2460@360x820/0 
PID: 4120
Listening on minicap
chunk(length=24)
banner {
  version: 1,
  length: 24,
  pid: 26916,
  realWidth: 1080,
  realHeight: 2460,
  virtualWidth: 1080,
  virtualHeight: 2460,
  orientation: 0,
  quirks: 2
}
chunk(length=36544)
headerbyte1(val=1)
headerbyte2(val=10497)
headerbyte3(val=338177)
headerbyte4(val=338177)
body(len=36540)
chunk(length=65495)
body(len=65495)
chunk(length=65536)

image