update README and doc/

This commit is contained in:
Mis012
2024-05-31 18:31:11 +02:00
parent debbded4c5
commit babbf441da
2 changed files with 38 additions and 5 deletions

View File

@@ -34,6 +34,33 @@ For custom data dir:
ANDROID_APP_DATA_DIR=[data dir] android-translation-layer [path to apk] [-l activity to launch]
```
### App data
As mentioned, the default data dir is `~/.local/share/android_translation_layer/`. The data for each
app is then stored in `~/.local/share/android_translation_layer/[apk-name]_`. What this means
in practice is that:
- we pass this directory to the app where AOSP would pass `/data/data/[app-id]`, and extract native
libs in `lib/`
- we pass this directory to the app where AOSP would pass `/storage/emulated/0` (this means OBBs
will be under `Android/obb/[app-id]/`, and various litter that the app would happily dump on the
"sdcard" on AOSP will end up here as well)
- we pass this directory as an additional resource directory to `libandroidfw`, so you can
for example put something in `assets/file.txt` and if the app tries to load `assets/file.txt` from
it's apk file, it will be preferentially loaded from here instead (do note that some apps read files
from the apk by themselves, and some apps do weird things like only load the file in order to find
it's offset in the apk to then read it out by themselves, so not only will this not always work but
you will sometimes find out by having the app crash)
- we extract some additional files from the apk here for our purposes
The reason that we don't use `[app-id]` for the directory name is simply that we don't have access
to the app id at an early enough point. However, this also allows you to have multiple versions
of the same app not clash. Feel free to rename the apk to `[app-id]_[version].apk`, or simply
`[app-id].apk` if you wish to replace it with a different version later and reuse the data dir.
### "install" an apk
You can pass `--install` on the cmdline to "install" an apk instead of launching it. This will copy
the apk to `_installed_apks_` in the data dir (`~/.local/share/android_translation_layer/` by default),
and use the xdp portal to install a `.desktop` file.
### Tweaks
##### Resolution Changes
Some apps don't like runtime changes to resolution. To sidestep this, we allow for specifying the initial resolution.
@@ -42,9 +69,15 @@ example with custom width/height:
android-translation-layer path/to/org.happysanta.gd_29.apk -l org/happysanta/gd/GDActivity -w 540 -h 960
```
#### GLX on X11
On X11, Gtk might decide to use GLX, which completely messes up our EGL-dependent code.
#### Potential issues
- On X11, Gtk might decide to use GLX, which completely messes up our EGL-dependent code.
Use GDK_DEBUG=gl-egl to force the use of EGL.
- On Apple Silicon, the page size is non-standard. Upstream ART is only recently getting patches
to support such non-standard page size, so the version we use obviously doesn't have any. While there
will probably still be some issues with native libraries, you can work around the issue of AOT-compiled
code not working by adding `-X '-Xnoimage-dex2oat' -X '-Xusejit:false'` to the atl cmdline, which will
force the use of an interpreter. Make sure to clear `~/.cache/art/` since AOT-compiled oat files will
still be used if they were generated previously.
### Contribute
If you are trying to launch a random app, chances are that we are missing implementations for some stuff that it needs, and we also don't have (sufficiently real looking) stubs for the stuff it says it needs but doesn't really.

View File

@@ -20,8 +20,8 @@ cd skia
cp build/linux-self-hosted/DEPS DEPS
python3 tools/git-sync-deps
export arch=x64
gn gen 'out/linux/$arch' --args='is_official_build=true skia_enable_tools=false target_os="linux" target_cpu="$arch" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_system_harfbuzz=true skia_use_system_expat=true skia_use_system_freetype2=true skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_libwebp=true skia_use_system_zlib=true skia_enable_gpu=true extra_cflags=[ "-DSKIA_C_DLL" ] linux_soname_version="99.9"'
ninja -C 'out/linux/$arch' SkiaSharp
gn gen "out/linux/$arch" --args='is_official_build=true skia_enable_tools=false target_os="linux" target_cpu="$arch" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_system_harfbuzz=true skia_use_system_expat=true skia_use_system_freetype2=true skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_libwebp=true skia_use_system_zlib=true skia_enable_gpu=true extra_cflags=[ "-DSKIA_C_DLL" ] linux_soname_version="99.9"'
ninja -C "out/linux/$arch" SkiaSharp
sudo cp out/linux/$arch/libSkiaSharp.so.99.9 /usr/local/lib64/
sudo ln -s /usr/local/lib64/libSkiaSharp.so.99.9 /usr/local/lib64/libSkiaSharp.so
```