What is Shashlik
The goal of Shashlik is to provide a way to run Android applications on a standard Linux desktop as easily and simply as possible.
Under the hood
The easiest way to run an Android app correctly is to simply run Android. It’s a linux base that we can nest inside our session. OpenGL and graphics are all rendered on the host ensuring fast performance.
Shashlik provides an incredibly stripped down Android base which boots directly into the loaded app, but with a running activity manager and daemons so that intents still work correctly.
Building
Prerequisites
First download and install “repo”. A tool that makes it easier to work with multiple git repositories at once.
$ mkdir ~/bin
$ PATH=~/bin:$PATH
Download the repo tool and make it executable
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
##Getting the code
Create a new directory, and start a repo sync with our manifest
mkdir shashlik
cd shashlik
repo init -u https://github.com/shashlik/shashlik-manifest
repo sync
Note: The code base is huge. As in, really huge.
Learn more about repo at https://source.android.com/source/using-repo.html
Compiling
Source a script containing env vars and setup, and hit make
source build/envsetup.sh
make
Installation
Installation is currently a manual process as the state changes rapidly.
It’s fairly obvious from the debian files which files are needed where.
Shashlik Components
Manifest
This contains an XML file of all repos to fetch to build an android image.
It contains a seriously stripped down Lollipop base plus Shashlik modifications and additional modules.
Shashlikd
This runs in Android space and is responsible for a few things
* Drawing a custom bootsplash. We override the stock one with a version that shows the icon of the app to be launched
* Drawing the back buttons (normally done by Android’s SystemUI, but we don’t want all the overhead of that)
* Notification recieving and passing to the host (WIP)
Shashlik-runtime
This is the desktop side of integration layer. It provides small scripts to install APKs, extracting the icon and such into a desktop menu and copying the relevant files.
It also provides the startup script which launched the emulator installing the APK,
Qemu fork
As the name suggests this contains a fork of the android emulator from the SDK.
It is modified to show the window icon and title of the app we’re running, not look like an emulator.
The other repos
These come from a former approach which tried to target running Android at a lower level. They should be ignored.
Overall plans
Near Future
* Drop manual aapt parsing. Approach depends a bit on whether I stick with the prototype python, or switch it to a small Qt app.
* Drop adb. Shashlikd can communicate out to our host over HTTP. Client fetching from host is better than host pushing to client as we avoid startup races.
* Fix network.
* Release as user builds rather than userdebug. Self explanatory. Saves some Mbs.
* Predex?
* Continue cutting down on the manifest to be constantly smaller.
* Simple window resizing. Keep aspect ratio, just adjust the window scale.
* More integration with notification and things. We can
* Handle device rotation. Apps signal whether they are drawing horizontally to the WM. It’s “just” a case of forwarding that.
* Files… qemu has virtfs, android also has Fuse. Lots of options. We can also go with; Fake SD card, a fileProvider intent, or something else…dunno.
* Tidy up packaging. Maybe split manifests for Client and Host sides? Then packagers can build one easily, and I can fetch host isos easily.
Longer Future
We only need the VM because we need a kernel with binder.
If we can rewrite libbinder in userspace (it’s just a socket…how hard can it be?) then we can move the Shashlik world into simly being a container.
Graphics and devices can still work the same way proxying openGL through a socket between client and env base.
Contributing
Removing a module
The main thing we’re doing in Shashlik at the moment is stripping Android down.
There are 3 ways to remove a module:
- Remove it from the manifest. If possible do this, as it saves downloading and parsing the makefile
- add LOCAL_MODULE_OVERRIDES into a different module. shashlikd does this to replace systemui for example
- Remove it from the PRODUCT_PACKAGES list in the shashlik product in build.
Ideally we want our delta with Android to be as small as possible with regards to packages and frameworks.
Some modules are subjective; For example the Camera app seems like a useless thing to include.
However some apps (Dulux paint app for example) will use a camera intent to get a photo; that requires the app running.
Merging changes
Open a pull request, standard github procedure.
