maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [SFOS] [DEV] sfdroid: run android in a window (https://talk.maemo.org/showthread.php?t=95631)

liar 2015-06-17 14:10

[DEV] sfdroid: run android in a window
 
Update from the field:

https://www.youtube.com/watch?v=78N1C2-6t3I

This will be released soon :).

Instructions are on wiki.merproject.org

https://wiki.merproject.org/wiki/Ada...for_hammerhead

https://wiki.merproject.org/wiki/Ada...ishOS_for_mako

Old instructions:

Code:

Don't flash this if you're not able to recover from it. It breaks some things. I hope i can make it better. ONLY FLASH ON A ROM YOU DON'T NEED.

Instructions:
Backup /init.rc from your sfos installation.
$ devel-su
# cp /init.rc /home/nemo/init.rc.bak

Flash with recovery on top of SailfishOS (gapps can be flashed too).
(Multirom: Recovery->Advanced->Multirom->List Roms->your rom->Flash Zip). Then install SDL2:
$ devel-su
# pkcon install SDL2

[hammerhead]
$ devel-su
# usermod -G net_bt_stack -a nemo

Downloads:
v0.9
[Nexus 4/mako] https://www.dropbox.com/s/qspp5s4rvf...-mako.zip?dl=0
CHECK THAT YOU'RE USING SFOS 2.0.0.10 beta9!!! AND CM10.1.3 AS BASE.

v0.9
[Nexus 5/hammerhead] https://www.dropbox.com/s/hwt3tjceom...rhead.zip?dl=0
CHECK THAT YOU'RE USING SFOS 2.0.0.10 AND CM11 AS BASE

changelog v0.9: https://bpaste.net/show/00d571f0b3f0

Remember! Flash on a rom you don't need to test it first.
If you're experiencing any problems with sfos, neutralize sfdroid and see if it works again, then report here.

NEUTRALIZE (disable):
$ devel-su
# cp /home/nemo/init.rc.bak /init.rc

UPDATE flash the new zip.

WHATSAPP: https://www.youtube.com/watch?v=OA4KTPt2wgY


       
Code:

       
surfaceflinger buffer <-> unix domain socket <-> sfdroid -> GLES
libinputservice <- uinput <- sfdroid
wifi, hack
most HAL modules disabled (inside android: no sensors, no gps, no bluetooth,...)



irc.freenode.net -> krnlyng

Jeffrey04 2015-06-17 14:21

Re: Idea for an Android Compatibility Layer
 
just out of curiousity, would the use of lxc/docker help?

liar 2015-06-17 15:40

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by Jeffrey04 (Post 1473849)
just out of curiousity, would the use of lxc/docker help?

probably not, as far as i know they try to isolate the target from the host, but we want to be able to have a tcp connection between the renderer app and the chroot

pycage 2015-06-17 17:23

Re: Idea for an Android Compatibility Layer
 
I wonder why a TCP connection. Shouldn't a local Unix datagram socket be good enough but without the additional overhead of network and TCP?

liar 2015-06-17 17:30

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by pycage (Post 1473862)
I wonder why a TCP connection. Shouldn't a local Unix datagram socket be good enough but without the additional overhead of network and TCP?

the main reason why tcp is because that is already implemented.. but if you would like to change it please do so :)

liar 2015-06-17 18:38

Re: Idea for an Android Compatibility Layer
 
update:

surfaceflinger does not crash anymore:
https://bpaste.net/show/5520d6e5bc9b

but rendering does not work yet...
initializing renderer process
listening on port 22468
renderer process started
creating sub window
created sub window
FrameBuffer::post
accepted client
accepted client

hedayat 2015-06-18 01:32

Re: Idea for an Android Compatibility Layer
 
Thanks! Does the chroot work(run!) on N9 or it should be compiled from sources?

Vento 2015-06-18 07:46

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by liar (Post 1473857)
probably not, as far as i know they try to isolate the target from the host, but we want to be able to have a tcp connection between the renderer app and the chroot

yes, but you can tell to isolate less :) I'm not know acl stuff but I use docker for work every day so if you want some help.

liar 2015-06-18 10:15

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by hedayat (Post 1473912)
Thanks! Does the chroot work(run!) on N9 or it should be compiled from sources?

the chroot which i uploaded contains a bug which will make surfaceflinger crash (both on n9 and sailfish, i will update it sometime today)
i fear we wont get it to work on the n9 though, because the renderer requires some egl/gles features which we don't have on the n9

liar 2015-06-18 10:27

Re: Idea for an Android Compatibility Layer
 
current issue, please help, eglCreateContext from libhybris segfaults if share_context != EGL_NO_CONTEXT

it crashes inside the adreno blobs, can we do it without that pbuffer context?

hedayat 2015-06-18 12:13

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by liar (Post 1473952)
the chroot which i uploaded contains a bug which will make surfaceflinger crash (both on n9 and sailfish, i will update it sometime today)
i fear we wont get it to work on the n9 though, because the renderer requires some egl/gles features which we don't have on the n9

So, it is be binary compatible with N9 harmattan, right?
About the missing egl/gles features, isn't it possible to work around them somehow (e.g. providing a software implementation using available features?)?

liar 2015-06-18 12:31

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by hedayat (Post 1473968)
So, it is be binary compatible with N9 harmattan, right?
About the missing egl/gles features, isn't it possible to work around them somehow (e.g. providing a software implementation using available features?)?

probably, if someone with more experience can do it

liar 2015-06-18 17:24

Re: Idea for an Android Compatibility Layer
 
i have updated the chroot, this one does not segfault anymore in surfaceflinger, and i have uploaded the renderer sources to github so you can contribute :)

liar 2015-06-18 18:07

Re: Idea for an Android Compatibility Layer
 
current issue (the eglCreateContext one is still there, but i think this one is more pressing):
rcFBPost is never called

EDIT: fixed, current issues:
1) how to create subwindows in wayland 1.3
2) how to make the wayland window appear on screen

liar 2015-06-18 19:19

Re: Idea for an Android Compatibility Layer
 
ok i updated the original post, there are two files which you can copy over the current chroot (if you have the most recent one) init.rc will fix usb problems and gralloc.default.so will make it use the correct gralloc version.

now we have to figure out why the sdl window does not appear

itdoesntmatt 2015-06-18 19:26

Re: Idea for an Android Compatibility Layer
 
sorry but i did not understood. it is a way to using android app on sailfish for nexus 5? is viable? have u tryed to suggest it on #sailfish-porters?

liar 2015-06-18 19:29

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by itdoesntmatt (Post 1474072)
sorry but i did not understood. it is a way to using android app on sailfish for nexus 5? is viable? have u tryed to suggest it on #sailfish-porters?

yes i have suggested it in #sailfishos-porters, yes it can be used to start android apps on sailfishos, we have tested but it doesn't work on the nexus 5 yet, someone needs to dig into it and find the cause (i don't have a nexus 5)

itdoesntmatt 2015-06-18 19:34

Re: Idea for an Android Compatibility Layer
 
i have a n5, i m not skilled but if u tell me what to do i could try,maybe in next week

liar 2015-06-18 19:43

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by itdoesntmatt (Post 1474077)
i have a n5, i m not skilled but if u tell me what to do i could try,maybe in next week

build the android_renderer sources and figure out why it crashes

itdoesntmatt 2015-06-18 20:12

Re: Idea for an Android Compatibility Layer
 
maybe u dont know with who u are speaking...i m completely noob,so u have to followme step by step..ahahhaah

hedayat 2015-06-18 21:45

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by liar (Post 1474068)
ok i updated the original post, there are two files which you can copy over the current chroot (if you have the most recent one) init.rc will fix usb problems and gralloc.default.so will make it use the correct gralloc version.

now we have to figure out why the sdl window does not appear

The gralloc.default.so link is wrong (it is the same link as the init.rc one).

And another question: The EGL/GLES problem with N9 you mentioned is with N9 itself or with Harmattan? (will it work on SFOS port on N9?)

Regards

liar 2015-06-19 05:17

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by hedayat (Post 1474097)
The gralloc.default.so link is wrong (it is the same link as the init.rc one).

And another question: The EGL/GLES problem with N9 you mentioned is with N9 itself or with Harmattan? (will it work on SFOS port on N9?)

Regards

i am not 100% sure but i think SFOS on the n9 uses the same EGL/GLES libs as harmattan, so there we have the same problem...

Astaoth 2015-06-19 08:45

Re: Idea for an Android Compatibility Layer
 
You should say in the first post that you are working only for the N9 and Sailfish, but not the N900 ! :'(

Few months ago, I discovered DebianKit, which aims to install a full classical Debian directly in parallel with the existing Android install. Since Harmattan is more or less a Debian and Sailfish is still GNU/Linux, maybe something like that could be achieved for using Android apps (in addition, if it works with Harmattan, we will be able to do the same on the N(eo)900).

liar 2015-06-19 10:39

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by Astaoth (Post 1474139)
You should say in the first post that you are working only for the N9 and Sailfish, but not the N900 ! :'(

Few months ago, I discovered DebianKit, which aims to install a full classical Debian directly in parallel with the existing Android install. Since Harmattan is more or less a Debian and Sailfish is still GNU/Linux, maybe something like that could be achieved for using Android apps (in addition, if it works with Harmattan, we will be able to do the same on the N(eo)900).

i don't limit this to the n9 or sailfish, but i cannot work on a phone which i don't own (anymore), but it is open source and i wish to keep it this way, so n900 fans start coding :P

liar 2015-06-19 14:36

Re: Idea for an Android Compatibility Layer
 
https://bpaste.net/show/5338d7a8aafe

this is a current log with some debug info, wl_surface.attach is never called, this is the current issue

liar 2015-06-19 16:08

Re: Idea for an Android Compatibility Layer
 
current state: i talked to the #wayland guys and it seems egl pbuffers are not supported in conjunction with wayland...

EDIT: maybe it is a bug on my end...

itdoesntmatt 2015-06-19 16:27

Re: Idea for an Android Compatibility Layer
 
so what it means for common mortals?

liar 2015-06-19 17:37

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by itdoesntmatt (Post 1474216)
so what it means for common mortals?

it means i need to change more stuff and hope that it works...

itdoesntmatt 2015-06-19 18:07

Re: Idea for an Android Compatibility Layer
 
no way to connect those systems? u have to look for a different solution?

liar 2015-06-20 10:23

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by itdoesntmatt (Post 1474220)
no way to connect those systems? u have to look for a different solution?

i think it is a bug on my end, something with wayland window creation

EDIT: i added some contact information on the first post

liar 2015-06-20 15:16

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by pycage (Post 1473862)
I wonder why a TCP connection. Shouldn't a local Unix datagram socket be good enough but without the additional overhead of network and TCP?

in the end i might write a kernel module which does the communication between the host and the chroot, which seems to be a nice solution, or does somebody have a better idea?

hedayat 2015-06-20 19:23

Re: Idea for an Android Compatibility Layer
 
hmm...sorry, what is the advantage of using your own module over using unix local sockets (or even FIFOs). If both ends of the communication are in userspace, I wonder if a custom kernel module will be faster than unix sockets?

liar 2015-06-20 21:45

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by hedayat (Post 1474282)
hmm...sorry, what is the advantage of using your own module over using unix local sockets (or even FIFOs). If both ends of the communication are in userspace, I wonder if a custom kernel module will be faster than unix sockets?

i haven't fully thought this through but the module could have some sort of shared memory between the chroot and the host renderer, which might make it faster because nothing has to be sent...

liar 2015-06-20 21:54

Re: Idea for an Android Compatibility Layer
 
okay i am facing a pretty weird bug... no window is displayed... i tried to make an application which des exactly the same as the renderer and that works... then i tried to copy this application into the renderer and that still does not display a window! :O???

liar 2015-06-20 23:06

Re: Idea for an Android Compatibility Layer
 
once i link against utils the test application fails, but i don't know why yet...

liar 2015-06-20 23:34

Re: Idea for an Android Compatibility Layer
 
ok the window does appear now :) but it renders garbage

HtheB 2015-06-21 00:12

Re: Idea for an Android Compatibility Layer
 
https://www.youtube.com/watch?v=1NprEtCBVKQ

hedayat 2015-06-21 06:39

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by liar (Post 1474291)
i haven't fully thought this through but the module could have some sort of shared memory between the chroot and the host renderer, which might make it faster because nothing has to be sent...

Yeah, that might be faster. Again, you probably doesn't need a kernel module for it. It should be easy enough to have a shared memory accessible by both main OS and chroot one.

endsormeans 2015-06-21 16:01

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by HtheB (Post 1474305)

hahahaha...durn made me laugh with that .. HtheB :D

liar 2015-06-22 05:41

Re: Idea for an Android Compatibility Layer
 
Quote:

Originally Posted by hedayat (Post 1474317)
Yeah, that might be faster. Again, you probably doesn't need a kernel module for it. It should be easy enough to have a shared memory accessible by both main OS and chroot one.

i am not sure if this is possible, because bionic probably has it's own implementation of mmap and so on, although if mmap is called through the kernel it might be possible

EDIT: current issue: GL_INVALID_OPERATION, this error comes from the blob drivers when the chroot calls glCopyTexImage2D, what is weird though, i added printfs in the decoder methods and it seems glCopyTexImage2D is never called on the host


All times are GMT. The time now is 02:54.

vBulletin® Version 3.8.8