New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some suggestions for future releases #153
Comments
@twaik Wow, thanks as always for your hard work digging into the source and figuring out how we can make Maru better, especially from the very early days of this project! I really appreciate your support. Yes, pretty much all of these suggestions would be amazing to have in Maru. Anything we can do to reduce Maru's custom patches and bring it as close as possible to clean AOSP/Lineage with GSI would make this project so much easier to maintain, develop, and port. As I think you already know, nowadays I do not have as much time to work on Maru like I used to in 2016-2017 so these suggestions would make my life much easier 😄. Speaking of next steps, if you can get a prototype of the Android app with Xorg (2A-2D) working that I can try out I would be very happy to test it out thoroughly on my devices and work with you to get it integrated into Maru's next major release. I think this is a standalone chunk of work that can replace mclient / mflinger, but still use udev and our frameworks patches for input handling. After that's done, we can start looking at 2E, etc. to eliminate our input related patches. @utzcoz has also done work to separate out our Settings patches into a standalone app that I have yet to merge in (sorry @utzcoz, I will get to it as soon as I get some time!). We are also discussing how we can just download desktop images from our build server instead of shipping it on the system image. So as you can see, we are already pushing in the direction of minimizing our modifications to AOSP / Lineage as much as possible. By the way, I really hope you can get your hands on at least a Chromecast so you can easily test Maru with whatever test device you have around so you don't need to worry about having wired external display support. If you can get your hands on a cheap used Nexus 5 or HTC10, those devices have good wired external display support and work with Maru right now. But hopefully you can at least pick up a miracast / chromecast adapter for now. |
Bad news. We can not create system overlay which will intercept and filter events before dispatching. That is impossible due to Android's security. Only system services can do that. |
Looks like I found a solution.
|
Another solution is to use libinputflinger used by SystemServer/.InputService to get input inside application. I think writing my own NativeInputManager will be enough. We will be able to disable external input devices in Android InputService and enable them in MaruService with code like that
|
@pdsouza , the @twaik 's solution to remove dynamic input patch from base to a single system service can be a good choice to consider. From the Android 10 code, |
@utzcoz You are right. If you want you can remove dynamic input dropping now and disable input devices from Maru Interactive mode tile code. |
Looks like my phone is bricked :) I've flashed wrong firmware and now it is only vibrating. |
Okay, I will try it when I have enough free time. And I will give feedback to this issue. |
Hi. I do not have any physical device to test it so I need somebody who have Android 9 device. It should respond to
I can build MaruInputTest on my PC for you, but I need to know target arch (arm64, armhf, x86, x86_64). |
@utzcoz Wow, it would be great if we could use |
@pdsouza hi. Looks like I have built bionic version of libX11.so. If you want to merge mclient and mflinger into one program you can use it. It can be the way to avoid pathching frameworks_base to provide copying screen content using GraphicBuffer/Surface hacks. |
Looks like I have Xorg and its dependencies sources that can be built using NDK/AOSP build systems. I still did not test it but it will work. This work is based on old project that worked.
|
Also I found out that it is possible to add QuickSettings tiles even without modifying system app:
We even can execute these comands on first startup on device. Or just put a button in app (2) which will trigger comandexecuting in Java service (1). PS. I checked getting and putting qs tiles. The put comand allows us to add or remove tiles in real time, without reboot. |
Well, my Xorg build (NDK) works. I checked it with x11vnc+fluxbox+pcmanfm. I am starting to write input and output drivers. |
About mflinger. Looks like you do not need to create virtual display using modified framework, you can create it using VirtualDisplay API and then draw on it using Surface (you can pull and push GraphicBuffers and draw on them, use dequeue/queueBuffer on surface to draw GraphicBuffer). VirtualDisplay's backend is Surface too so it can be drawn on external display. |
@twaik Thanks for pointing out it. I have used |
About that. You can write a daemon which adds all users mentioned in container's |
Hi guys. I found out that you cloned
I think after adding this code you can get rid of android_platform_frameworks_base. |
About A few
After finishing all of those we can get rid of cloned |
@twaik Thanks for those brilliant insights. The MaruOS has a long-term plan to move most of modifications of frameworks/base and frameworks/native to a single system app, and prepare Linux's window combination with Android's native window. I have did some early work on MaruSettings, and I think you have noticed it. IMO, we can remove modifications from frameworks/native and many of frameworks/base when working for a single system app from my previous experience about ROM customization. We really appreciate your suggestion to module MaruOS, thanks again for it. We decide to continue maru-0.7 at the mid of this year, and let's discuss more about when and which part of those great suggestion will be envolved into maru-0.7 or later versions. :) |
@utzcoz what do you think about using Magisk to patch existing system instead of patching AOSP/Lineage? |
Patching system classpath can be a bit more complicated so we can try to make Magisk module containing needed changes. |
It looks like Magisk is unneeded here, we can simply inject some code using Riru. But it will interfere with current LSPosed implementation. |
About mflinger. I advised to use About SystemServiceRegistry. I think all of it can be placed in vendor image. But I am not sure about init.rc. Also you can pack mflinger (Java/native version started using app_process), |
I have good news. I found out that XCB can be connected with fd (using P.S. One more question. Will you mind if I use this code in my app? |
After implementing this you only will need to move |
I already have some code which will add to server exact resolution of screen. And user will be able to choose smaller resolution in the case if screen is hidpi. Link. |
I have a code to implement full client with changing resolution and polling with android ndk (CMake buildscript) if you need. It can be modified to do the same thing mflinger does. Check termux-x11 project. The only thing I do not implement is polling cursor coordinates, but it can be implemented easily. |
@twaik Thanks for your work and suggestions. I will learn it this weekend and give response here. |
Pay attention that with this you can use it even without |
Thanks so much twaik for continuing to keep us posted on this. Really
appreciate your contributions and insight since the beginning of the
project!
…On Thu, Mar 9, 2023, 2:22 AM Twaik Yont ***@***.***> wrote:
Pay attention that with this you can use it even without lockWithHandle
solution. Or if you want you can use this
<#153 (comment)> and
send this fd directly to X server using xcb_shm_attach_fd call (and it
will be a bit faster, because it will be zero-copy solution).
Also you can check how we did hardware acceleration inside Termux project.
Link <termux/termux-packages#14517>. It is much
better then using llvmpipe.
—
Reply to this email directly, view it on GitHub
<#153 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACMM4XMBVNP5TDR6EHUAPLW3C55XANCNFSM4S7WUMXA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sound great. I used
Sound great too.
There are some SELinux and Kernel configs limitations that other ROM can't run MaruOS directly without any custom modifications.
For X11, it sound great.
I agree this method too. We can rename @twaik Thanks for your suggestions. |
Using |
Hi, Preetam @pdsouza . What's up?
I have some notes about future MaruOS releases. I hope they will be usefull.
I had some time to analize MaruOS commits and found out that MaruOS is:
0. MaruOS structure
A. You can patch useradd/adduser to add every single user created inside container to all needed Android groups to avoid permissions problems. This will fix issues like no socket permission for sql servers.
B. You can place all MaruOS scripts and patches applied to Debian in blueprint builder in .deb packages. It will let us update Debian part separately from Android part.
C. You can use apt pinning to disallow replacing your packages with most recent versions from Debian official repos.
D. At the moment the default username/password are maru/maru.
OEM vendors use DebianInstaller/Ubiquiti/Calamares to personalize build on first startup. You can use them or add some settings for that in app from item 2.
E. I/We can write some systemtray menus to control wireless connections (WiFi, BT, Mobile Data, GPS, Hotspot mode, Flight mode), show Android notifications (smth likebKDE Connect ) or other options. Maybe making calls and sms app. These programs will work using some api from a service in item 2's app.
F. I do not know if it really possible but maybe we can try to make Android apps windows appear in Xorg using freeform feature. Maybe we will need to patch framework. Or maybe system service will be enough for that ( Add a MobilePhone View #2 ).
G. We can ovverride logout/shut down/reboot actions and make them restart or shut down only a container.
At the moment you are using mflinger as graphics output, Xorg with udev hotplugging enabled, xf86-video-dummy driver and input drivers for external input. And a set of patches to enable/disable input drop for Android, external display connection detection, other stuff.
I think it can be replaced with one simple system service. All of it.
You are using Xorg with udev because it can detect hotplugged input devices.
Mflinger is cool, but it is a bit slow. Instead of sending process like X11Client=>Xserver=>Driver=>AndroidSurface you send it like X11Client=>Xserver=>DummyDriver===>X11Client=>AndroidSurface.
My suggestion is to replace all of it with Android app that:
A. Has Xorg builtin as jni library. It will be started inside as one of threads.
B. Has modified xf86-video-dummy driver for graphics output. It will pass an image to native window from item 2.D.
C. Has modified xf86-input-sparkle driver that will take input events from 2.D.
D. Android service that starts Xorg in thread and creates SurfaceView that we can pass to modified dummy driver. And, of cource, one more for a cursor.
Also it will create transparent focusable overlay window that will cover the whole screen. It will catch all input events, filter externals and pass them to Xorg's driver from 2.3. Returning false on all types of events will pass these events to underlying layers.
E. We can try to use Pointer Capture API to capture mouse and keyboard input and pass them to Debian when a mouse reaches right corner. Something like multiscreen configuration on normal desktops.
This way user will not need to choose what OS receives external devices input in interactive mode.
F. Some stuff of items 1.D, 1.E, 1.F.
G. Wakelock to keep Maru Interactive running and something to disable screen and touch after screen dim timeout (to optimize use of power).
H. We can use overlay window described in 2.4 as output for Maru Interactive Mode with no need to use external display, google cast, miracast, displaylink or another types of devices. It is a bit complicated because we will also need to implement popup menu with Interactive Mode disable button and Virtual Keyboard caller. And maybe we will need to reimplement xf86-input-synaptics driver to let people use touchscreen as touchpad.
I. We can keep this app update in the repo we keep debian packages. And install new version if it is available. We will need to use app install permission to update it. Keeping it in Google Play is not recommended because it does not fit to all devices.
A.We can patch bionic to let us use EGL/GLES inside container and effectively use it. But we need to check if the patches crash Android and why. Also we can make EGL/GLES packages for Debian. (Bionic patch moves slome TLS slots to let us use libs without Segfaults in glibc container)
B. If you do not need to use bionic pulseaudio I can write libhybris library that passes Android's SLES to Debian and then we will be able to use Termux's SLES or AAudio sink.
I alredy did implement 2.A, but the project was abandoned and erased because it couldn't be whitelisted in oom killer's settings on Xiaomi and some other devices.
I can implement 1.E, 2.A, 2.B, 2.C, 2.D, 2.E, 2.G, maybe 2.H.
Bionic pulseaudio and SLES/AAudio sink as already implemented, everything you need is to add them to vendor_maruos repo.
Everything else only you can do. Or I can try it when I will have MaruOS compatible device or MaruOS port for one of my devices.
But I have no devices that support external displays, have no displaylink, google cast or miracast adapters. Everything I can do is to make it work with Presentation API which can be shown to Clockworkmod's Screen recording and mirror and Allcast Receiver. I can try to implement Interactive Mode without external screen (as described in 2.H) with ability to use Presentation API (without DisplayManager.DisplayListener). It will let us use Dex Mode even without external display (Windows and Android versions of Dex already implemented it).
If you follow all of these suggestions (maybe except 1.F) you will have compact vendor_maruos repo, patched bionic, some selinux rules patched and rest of the system unchanged. Debian can be deployed on device itself using something automatical like Linux Deploy (opensource) or prebuilt on your build server. And also you will have Debian repository with override and MaruOS specific packages and, of cource, the app update source. Debian update repository can be a simple http server I do not think you will have problems with it.
It will be [almost] clean AOSP/Lineage/etc GSI distro with no need to maintain a full ROM. Device porters will only need to rebuild kernel with some features enabled and disabled kernel module version checking (to keep vendor modules).
About an app (item 2): we need to check if all the types of input events can be dropped by overlay window. The test app does not need to be a system/vendor app, we can use Android SDK to build it. If it fail we need to use another type of dropping (like sending events from inputflinger directly to Xorg). But it is still a solution.
I can split all the list into stages and make git todo list. But I think 0 stage will be testing Android's invisible overlay window capabilities including event dropping.
For now I have no PC but maybe the next week I will have it and will be able to develop.
Let me know if you are in.
The text was updated successfully, but these errors were encountered: