openstf / minicap

Stream real-time screen capture data out of Android devices.
Other
1.72k stars 622 forks source link

How to build minicap.so for android 11 ? #208

Open wull8 opened 4 years ago

wull8 commented 4 years ago

Anyone started playing with android 11?

varundtsfi commented 4 years ago

Hi @wull8 I am trying to build android-r-preview-2 but initially I am getting below errors. But once these errors fixed I can come up with some data.If you have any idea why above errors are there then your suggestions are welcome.

error: external/linux-kselftest/Android.bp:53:13: unrecognized property "arch.mips" error: external/linux-kselftest/Android.bp:56:15: unrecognized property "arch.mips64" error: external/seccomp-tests/Android.bp:20:13: unrecognized property "arch.mips" error: external/seccomp-tests/Android.bp:23:15: unrecognized property "arch.mips64"

repo init -u https://android.googlesource.com/platform/manifest -b android-r-preview-1 My System details :- Ubuntu 16.04 LTS Python -3.5.2 Java 1.8

varundtsfi commented 4 years ago

I have tried by taking the latest repo

repo init -u https://android.googlesource.com/platform/manifest -b android-r-preview-2 and getting below error. [100% 268/268] writing build rules ... FAILED: build/make/core/base_rules.mk:491: error: overriding commands for target `out/target/product/generic_arm64/system/bin/chattr', previously defined at build/make/core/base_rules.mk:467 18:28:48 ckati failed with: exit status 1

I have put the same logs over google community. If I found something then I will post

entomber commented 4 years ago

@varundtsfi I got it to build on android-r-preview-3 by commenting out the following in external/linux-kselftest/Android.bp and external/seccomp-tests/Android.bp:

/*
    arch: {
        mips: {
            enabled: false,
        },
        mips64: {
            enabled: false,
        },
    },
*/

Doesn't work with STF though.

varundtsfi commented 4 years ago

@varundtsfi I got it to build on android-r-preview-3 by commenting out the following in external/linux-kselftest/Android.bp and external/seccomp-tests/Android.bp:

/*
    arch: {
        mips: {
            enabled: false,
        },
        mips64: {
            enabled: false,
        },
    },
*/

Doesn't work with STF though.

Hi @entomber Due to some other stuffs I was busy but today only I have downloaded the android-r-preview-4. I will build the OS and share the results.

varundtsfi commented 4 years ago

@entomber I have build android-r-preview-4 successfully but when I push mimicap in external directory and again build then not getting generated minicap.so file. Do you have any idea...

wull8 commented 4 years ago

@varundtsfi @pcrepieux

Hello all,

Thanks for your information !

I managed to build minicap.so with "android-r-preview-4". But when I run it on mobile device, I got below error:

Check error CANNOT LINK EXECUTABLE "/data/local/tmp/minicap": cannot locate symbol "_ZN7android21SurfaceComposerClient17getDisplayConfigsERKNS_2spINS_7IBinderEEEPNS_6VectorINS_11DisplayInfoEEE"

Any idea about this issue ? (I guess android-r-preview-4 still uses "minicap_29.cpp").

Thanks :)

varundtsfi commented 4 years ago

Hi @entomber and @wull8

I am also getting the same error CANNOT LINK EXECUTABLE "/data/local/tmp/minicap": cannot locate symbol "_ZN7android21SurfaceComposerClient17getDisplayConfigsERKNS_2spINS_7IBinderEEEPNS_6VectorINS_11DisplayInfoEEE" referenced by "/data/local/tmp/minicap.so"...

But I have verified SurfaceComposerClient and ISurfaceComposerClient files in android 10 and 11 both are identical. Screenshot from 2020-06-16 10-32-52 Screenshot from 2020-06-16 10-31-51

Now I will try another approach If I got something I will post immediately over here.

@pcrepieux Any suggestion please.

pcrepieux commented 4 years ago

That's a recurring issue. The AOSP source code is currently not fully sync'ed with preview/beta builds. There is only 2 options I can think of with the current codebase:

I'll try to look at this issue in the coming days. If I find a way to make it work, I'll keep you posted.

varundtsfi commented 4 years ago

@pcrepieux which file we have to compare.

Dynamically load and call the new method this activity we have done in android 10 support also.

I am working on second option. Whatever would be the output I will post it here.

kotini commented 4 years ago

Any update on android 11 support ?

pcrepieux commented 4 years ago

Will check again shortly if the the current AOSP source code can help. The main blocker is that android::SurfaceComposerClient::Transaction::setDisplayProjection(android::sp<android::IBinder> const&, unsigned int, android::Rect const&, android::Rect const&) changed to android::SurfaceComposerClient::Transaction::setDisplayProjection(android::sp<android::IBinder> const&, android::ui::Rotation, android::Rect const&, android::Rect const&) The unsigned int specifying rotation has become a ui::Rotation. Even knowing that (by comparing screenrecord binary or libgui.so), without the source code, it's a bit hard to fix :-/ I've seen someone commenting, he managed to do it (unfortunately, I don't see this comment anymore). That would be interesting to know which branch/tag from AOSP (or other repo ...??? ... ) has been used.

WeiPeiXian commented 4 years ago

my code is different from aosp, it can be only used to xiaomi device maybe the code below can be helpful #include <ui/Rotation.h> at line 279 t.setDisplayProjection(mVirtualDisplay, android::ui::toRotation(android::DISPLAY_ORIENTATION_0), layerStackRect, visibleRect);

in my code , the code of getDisplayinfo method is different from aosp, so i delete my comment, it just can be used to xiaomi device for other device here is my code, i think only line 279 will be helpful to build minicap.so for to build minicap.so for aosp https://github.com/WeiPeiXian/minicap/blob/master/jni/minicap-shared/aosp/src/minicap_30.cpp,

pcrepieux commented 4 years ago

@WeiPeiXian I agree using this fonction would make it work but where did you get this header file ui/Rotation.h ? Could you explain how you managed to build minicap-shared ? Maybe I am missing a little something but, while I understand what are the required changes, I couldn't find the required sources to compile it. Any link, branch name/tag, ... would be appreciated :-)

WeiPeiXian commented 4 years ago

@pcrepieux I also can't find Rotation.h at aosp I use company internal code compilation to build it instead of AOSP so nothing help can be given to build it on aosp branch maybe we should wait ... , the beta branch may contains Rotation.h

siva-kranthi commented 4 years ago

@pcrepieux @wull8 @varundtsfi @entomber @WeiPeiXian Can you please let me know the steps to build the so files for Android 11 without docker as I have access to the full R code from OEM. Didn't understand much from this https://github.com/openstf/minicap/blob/master/jni/minicap-shared/README.md

pcrepieux commented 4 years ago

Here is a comment in an older discussion that will maybe provide you the step you are looking for : https://github.com/openstf/minicap/issues/168#issuecomment-487625372

varundtsfi commented 4 years ago

@WeiPeiXian Is it possible that you can share minicap.so files for Android 11 for Xiaomi Devices. Please share if you don't have any issue.

WeiPeiXian commented 4 years ago

https://github.com/WeiPeiXian/minicap/tree/master/minicap.so Here is the minicap.so files for Android 11 best wishes

varundtsfi commented 4 years ago

@WeiPeiXian Thanks for sharing the binaries. I have tested it on Xiaomi Android 11 It's working.

INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:248) Creating SurfaceComposerClient INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:251) Performing SurfaceComposerClient init check INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:262) Creating virtual display INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:268) Creating buffer queue INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:271) Setting buffer options INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:275) Creating CPU consumer INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:279) Creating frame waiter INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:283) Publishing virtual display BBBB: INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:289) Starting apply INFO: (packages/apps/SYSOPT/minicap/so/src/minicap_30.cpp:291) Ending apply

@pcrepieux Here is a good information about these binaries. These binaries are working for Google Pixel 2(Android 11) Also.

Maciejszuchta commented 4 years ago

https://github.com/WeiPeiXian/minicap/tree/master/minicap.so Here is the minicap.so files for Android 11 best wishes

Which minicap file do you use for android 11? I used the ones I got by default from building minicap and repaced only minicap.so file that you provided but now I get CANNOT LINK EXECUTABLE "/data/local/tmp/minicap": cannot locate symbol "_ZN7android21SurfaceComposerClient22getActiveDisplayConfigERKNS_2spINS_7IBinderEEEPNS_13DisplayConfigE" referenced by "/data/local/tmp/minicap.so"...

PengJunchen commented 4 years ago

@WeiPeiXian

I try to use your forked branch to build the library, but the size of the built library is only 2KB, would you please tell me what kind of things missing? The manifest I used is android-11.0.0_r3.

stoefln commented 4 years ago

https://github.com/WeiPeiXian/minicap/tree/master/minicap.so Here is the minicap.so files for Android 11 best wishes @WeiPeiXian I am missing the x86 binary. Would you be able to provide it?

PengJunchen commented 4 years ago

https://github.com/WeiPeiXian/minicap/tree/master/minicap.so Here is the minicap.so files for Android 11 best wishes @WeiPeiXian I am missing the x86 binary. Would you be able to provide it?

It has been provided in official support: https://github.com/DeviceFarmer/minicap

maykonpacheco commented 1 year ago

@pcrepieux, @varundtsfi To make the minicap work, does my cell phone use adb?

varundtsfi commented 1 year ago

@pcrepieux, @varundtsfi To make the minicap work, does my cell phone use adb? Hi @maykonpacheco ,

Yes it does(actually your local system uses to communicate with your device ) To cast the screen from your mobile device to your local system.

It uses adb forward command and many more to get the device details.

maykonpacheco commented 1 year ago

Hi, @varundtsfi , I'm trying to follow that instruction from @pcrepieux to add the minicap to my LG G7. Even though I use adb, I'm having a hard time understanding it. How do I add the minicap to my device? https://github.com/openstf/minicap/issues/169 image

varundtsfi commented 1 year ago

What is the android version of LG G7 you are using So that I will try to download the aosp to build .