minicap icon indicating copy to clipboard operation
minicap copied to clipboard

How to build minicap.so for android 11 ?

Open wull8 opened this issue 4 years ago • 27 comments

Anyone started playing with android 11?

wull8 avatar Mar 31 '20 07:03 wull8

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 avatar Apr 02 '20 15:04 varundtsfi

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

varundtsfi avatar Apr 07 '20 13:04 varundtsfi

@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.

entomber avatar May 06 '20 22:05 entomber

@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 avatar May 21 '20 17:05 varundtsfi

@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...

varundtsfi avatar May 26 '20 14:05 varundtsfi

@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 :)

wull8 avatar Jun 11 '20 08:06 wull8

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.

varundtsfi avatar Jun 16 '20 05:06 varundtsfi

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:

  • wait ...
  • figure out the API change by inspecting the libgui.so and dynamically load and call the new method.

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.

pcrepieux avatar Jun 22 '20 09:06 pcrepieux

@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.

varundtsfi avatar Jun 22 '20 09:06 varundtsfi

Any update on android 11 support ?

kotini avatar Jul 06 '20 13:07 kotini

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.

pcrepieux avatar Jul 07 '20 12:07 pcrepieux

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,

WeiPeiXian avatar Jul 08 '20 03:07 WeiPeiXian

@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 :-)

pcrepieux avatar Jul 08 '20 04:07 pcrepieux

@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

WeiPeiXian avatar Jul 08 '20 06:07 WeiPeiXian

@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

siva-kranthi avatar Aug 23 '20 06:08 siva-kranthi

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

pcrepieux avatar Aug 23 '20 07:08 pcrepieux

@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.

varundtsfi avatar Aug 31 '20 05:08 varundtsfi

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

WeiPeiXian avatar Sep 07 '20 02:09 WeiPeiXian

@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.

varundtsfi avatar Sep 07 '20 17:09 varundtsfi

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"...

Maciejszuchta avatar Sep 09 '20 08:09 Maciejszuchta

@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.

PengJunchen avatar Sep 10 '20 08:09 PengJunchen

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?

stoefln avatar Oct 08 '20 10:10 stoefln

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

PengJunchen avatar Oct 15 '20 06:10 PengJunchen

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

maykonpacheco avatar Dec 07 '22 04:12 maykonpacheco

@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.

varundtsfi avatar Dec 07 '22 15:12 varundtsfi

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

maykonpacheco avatar Dec 07 '22 22:12 maykonpacheco

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

varundtsfi avatar Dec 12 '22 16:12 varundtsfi