openstf / stf

Control and manage Android devices from your browser.
https://openstf.io
Other
13.17k stars 2.71k forks source link

Android O compatibility #562

Closed sorccu closed 6 years ago

sorccu commented 7 years ago

This is a tracking issue for Android O and will be kept open until the final version is released.

Android O Developer Preview 3:

Not working. Same status as Developer Preview 2.

Android O Developer Preview 2:

Not working. This is more trouble than usual, STFService.apk may need a somewhat large refactor. There are also symbol issues with minicap, the code running on Nexus 5X doesn't match the released android-o-preview-2 AOSP branch.

Android O Developer Preview 1:

The master branch works as of 43f0341297fea60de8f4dc30e922d9c343b359a1. Either use the openstf/stf:latest docker image or install from source.

bgcelite commented 7 years ago

Android O source code already release: https://android.googlesource.com/platform/external/selinux/+/android-o-preview-1

sorccu commented 7 years ago

Thanks, I'll try to check during the weekend! On Fri, Apr 7, 2017 at 13:14 bgcelite notifications@github.com wrote:

Android O source code already release:

https://android.googlesource.com/platform/external/selinux/+/android-o-preview-1

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openstf/stf/issues/562#issuecomment-292429826, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_cH8At2aUxJY1GBHxP_eNofS6A-Sks5rtbgrgaJpZM4Mkn-0 .

sorccu commented 7 years ago

Well, I was able to compile it with some minor changes. However, the error remains the same:

CANNOT LINK EXECUTABLE "/data/local/tmp/minicap-devel/minicap": cannot locate symbol "_ZN7android11BufferQueue17createBufferQueueEPNS_2spINS_22IGraphicBufferProducerEEEPNS1_INS_22IGraphicBufferConsumerEEERKNS1_INS_19IGraphicBufferAllocEEE" referenced by "/data/local/tmp/minicap-devel/minicap.so"... Aborted

Unfortunately this means that the device does not run the exact android-o-preview-1 branch that was published. I'm using the bullhead-opp1.170223.012-factory-338a95b1 build for my Nexus 5X.

sorccu commented 7 years ago

It seems like the symbol on the device is:

_ZN7android11BufferQueue17createBufferQueueEPNS_2spINS_22IGraphicBufferProducerEEEPNS1_INS_22IGraphicBufferConsumerEEERKNS1_INS_19IGraphicBufferAllocEEEb

Which translates to:

android::BufferQueue::createBufferQueue(android::sp<android::IGraphicBufferProducer>*, android::sp<android::IGraphicBufferConsumer>*, android::sp<android::IGraphicBufferAlloc> const&, bool)

Whereas in android-o-preview-1, it's:

_ZN7android11BufferQueue17createBufferQueueEPNS_2spINS_22IGraphicBufferProducerEEEPNS1_INS_22IGraphicBufferConsumerEEERKNS1_INS_19IGraphicBufferAllocEEE

android::BufferQueue::createBufferQueue(android::sp<android::IGraphicBufferProducer>*, android::sp<android::IGraphicBufferConsumer>*, android::sp<android::IGraphicBufferAlloc> const&)

So there's a new boolean flag. Wonder what it is.

sorccu commented 7 years ago

It's definitely not there in the AOSP source. Not in master branch either.

sorccu commented 7 years ago

I was able to get use an ugly trick to access the symbol. However, it seems that SurfaceComposerClient's memory layout is different from AOSP and that's causing a segfault.

sorccu commented 7 years ago

I have it working now :)

sorccu commented 7 years ago

The master branch now supports Android O.

sorccu commented 7 years ago

As of Developer Preview 2 everything's broken. Minicap needs a recompile but they haven't released the actual source code they use, the symbols are incorrect. STFService is having weird issues where connections and listeners keep dying.

kennethzhu commented 7 years ago

Developer Preview 2 released. https://android.googlesource.com/platform/external/selinux/+/android-o-preview-2

sorccu commented 7 years ago

Thanks, I'll clone it and see how things go.

sorccu commented 7 years ago

Hmm, nope. Their released source code doesn't match what's actually on the devices (Nexus 5X in my case). Seems like a class may have changed and the vtable is different. Specifically, one of these causes a segfault:

mBufferConsumer->setDefaultBufferSize(targetWidth, targetHeight);
mBufferConsumer->setDefaultBufferFormat(android::PIXEL_FORMAT_RGBA_8888);
05-26 15:27:16.680  9374  9374 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x438 in tid 9374 (minicap)
05-26 15:27:16.718  9379  9379 W crash_dump64: type=1400 audit(0.0:561): avc: denied { search } for name="tmp" dev="dm-2" ino=654082 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
05-26 15:27:16.721  9379  9379 W crash_dump64: type=1400 audit(0.0:562): avc: denied { search } for name="tmp" dev="dm-2" ino=654082 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
05-26 15:27:16.726  9379  9379 I crash_dump64: obtaining output fd from tombstoned
05-26 15:27:16.727   601   601 I /system/bin/tombstoned: received crash request for pid 9374
05-26 15:27:16.731  9379  9379 I crash_dump64: performing dump of process 9374 (target tid = 9374)
05-26 15:27:16.731  9379  9379 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-26 15:27:16.731  9379  9379 F DEBUG   : Build fingerprint: 'google/bullhead/bullhead:O/OPP2.170420.019/4021594:user/release-keys'
05-26 15:27:16.731  9379  9379 F DEBUG   : Revision: 'rev_1.0'
05-26 15:27:16.731  9379  9379 F DEBUG   : ABI: 'arm64'
05-26 15:27:16.731  9379  9379 F DEBUG   : pid: 9374, tid: 9374, name: minicap  >>> /data/local/tmp/minicap-devel/minicap <<<
05-26 15:27:16.731  9379  9379 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x438
05-26 15:27:16.731  9379  9379 F DEBUG   : Cause: null pointer dereference
05-26 15:27:16.732  9379  9379 F DEBUG   :     x0   0000000000000000  x1   0000000000000081  x2   000000007fffffff  x3   0000000000000000
05-26 15:27:16.732  9379  9379 F DEBUG   :     x4   0000000000000000  x5   0000000000000000  x6   0000000000000000  x7   0000000000000000
05-26 15:27:16.732  9379  9379 F DEBUG   :     x8   0000000000000000  x9   0000000000000088  x10  0000000000000001  x11  0000007d8e0552a8
05-26 15:27:16.732  9379  9379 F DEBUG   :     x12  8000000000000000  x13  8000000000000000  x14  0000000000000000  x15  0000000000000000
05-26 15:27:16.732  9379  9379 F DEBUG   :     x16  0000007d8e9774c8  x17  0000007d8eb5a81c  x18  0000007d8eaf2b00  x19  0000000000000438
05-26 15:27:16.732  9379  9379 F DEBUG   :     x20  0000007d8e054008  x21  0000007d8e0391e0  x22  0000007d8e976000  x23  0000007d8e03f868
05-26 15:27:16.732  9379  9379 F DEBUG   :     x24  0000007d8ef76030  x25  ffffffffffffffff  x26  0000000000001268  x27  0000007d8e054000
05-26 15:27:16.732  9379  9379 F DEBUG   :     x28  0000007d8eaf01fc  x29  0000007ffadb0ae0  x30  0000007d8e90ef08
05-26 15:27:16.732  9379  9379 F DEBUG   :     sp   0000007ffadb0a90  pc   0000007d8e90ef64  pstate 0000000060000000
05-26 15:27:16.741  9379  9379 W crash_dump64: type=1400 audit(0.0:563): avc: denied { search } for name="tmp" dev="dm-2" ino=654082 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
05-26 15:27:16.746  9379  9379 F DEBUG   :
05-26 15:27:16.746  9379  9379 F DEBUG   : backtrace:
05-26 15:27:16.746  9379  9379 F DEBUG   :     #00 pc 0000000000067f64  /system/lib64/libgui.so (_ZN7android19BufferQueueConsumer18getReleasedBuffersEPm+308)
05-26 15:27:16.746  9379  9379 F DEBUG   :     #01 pc 0000000000002728  /data/local/tmp/minicap-devel/minicap.so
05-26 15:27:16.746  9379  9379 F DEBUG   :     #02 pc 000000000000afc0  /data/local/tmp/minicap-devel/minicap
05-26 15:27:16.746  9379  9379 F DEBUG   :     #03 pc 000000000001b5dc  /system/lib64/libc.so (__libc_init+88)
05-26 15:27:16.746  9379  9379 F DEBUG   :     #04 pc 000000000000bc6c  /data/local/tmp/minicap-devel/minicap
sorccu commented 7 years ago

It seems that IWindowManager.watchRotation() (which STFService uses) no longer works, the watcher never gets called.

kennethzhu commented 6 years ago

The news said that Android O Preview 3 released. Wish that STF could support this release. ^^

sorccu commented 6 years ago

I'm a bit husy now but I'll check when I can. On Mon, Jun 12, 2017 at 12:43 kennethzhu notifications@github.com wrote:

The news said that Android O Preview 3 released. Wish that STF could support this release. ^^

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openstf/stf/issues/562#issuecomment-307683619, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_YNwueDku3CQpmdiyttYPbzFlgxGks5sDLPDgaJpZM4Mkn-0 .

sorccu commented 6 years ago

No changes since Preview 2, Preview 3 is still broken. Guess we have to start looking into adding workarounds.

kennethzhu commented 6 years ago

Thank you very much for your investigation. I browse this page every day and expect a good news. It's too hard for me to solve this issue by myself - :'(

kennethzhu commented 6 years ago

Dear Simo, is it possible to provide a limited edition of STFService.apk to support Android O Developer Preview 3? ありがとうございます.

WolfAllen commented 6 years ago

um...not work on o preview .... looking forward it .....

bgcelite commented 6 years ago

Developer Preview 3 released. https://android.googlesource.com/platform/external/selinux/+/android-o-preview-3

kennethzhu commented 6 years ago

https://android.googlesource.com/platform/external/selinux/+/o-preview-4, it's almost the final official release.

thinkhy commented 6 years ago

I got the final official image of Android O and flush it into my Pixel. There are two problems til now:

  1. In STFService.apk/app/src/main/java/jp/co/cyberagent/stf/monitor/RotationMonitor.java

    • This line report(writer, wm.getRotation()); ==> wm is invalid, so the invocation of wm.getRotation() will cause connection stopping and stf device component attempt to restart service recursively until timeout.
      • Work around is to comment out the line of addMonitor(new RotationMonitor(this, writers)); in STFService.apk/app/src/main/java/jp/co/cyberagent/stf/Service.java
  2. minicap doesn't work for Andriod O, it's a known issue

    • minicap error: "ERROR: (external/MY_minicap/src/minicap_26.cpp:281: errno: None) Unable to find neither AOSP nor O Developer Preview 1 BufferQueue::createBufferQueue"

Anyway, I'll try my best to resolve the problem of minicap on Android O

sorccu commented 6 years ago

It will be at least several days before I can look into this, but @thinkhy your findings are correct. In the past I did manage to update minicap for newer developer previews, however that required removing a few lines that are relatively important, so I stopped.

sorccu commented 6 years ago

Minicap now works as of the latest release, but STFService is still an issue.

sorccu commented 6 years ago

Figured out a way to hack STFService a bit to make it happy. Latest master and 3.1.0 now support Android 8.0.