Unverified Commit a5049e29 authored by Jonas Heinrich's avatar Jonas Heinrich Committed by GitHub
Browse files

android-translation-layer: init at 0-unstable-2025-07-14 (#357220)

parents a0927de0 ca255779
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ in
  amazon-init-shell = runTest ./amazon-init-shell.nix;
  amazon-ssm-agent = runTest ./amazon-ssm-agent.nix;
  amd-sev = runTest ./amd-sev.nix;
  android-translation-layer = runTest ./android-translation-layer.nix;
  angie-api = runTest ./angie-api.nix;
  anki-sync-server = runTest ./anki-sync-server.nix;
  anubis = runTest ./anubis.nix;
+40 −0
Original line number Diff line number Diff line
{ pkgs, lib, ... }:
let
  # Example Android app
  demoApp = pkgs.fetchurl {
    url = "https://gitlab.com/android_translation_layer/atl_test_apks/-/raw/061e32a3172c8167b1746768d098f0e62d8f564b/demo_app.apk";
    hash = "sha256-aXxLZEAMNsL6nL4r2N9rVsbBPmf3+gFGmgo3kZjdo4s=";
  };
in
{
  name = "android-translation-layer";
  meta.maintainers = with pkgs.lib.maintainers; [ onny ];

  nodes.machine =
    { config, pkgs, ... }:
    {
      imports = [
        ./common/x11.nix
      ];

      services.xserver.enable = true;

      environment = {
        systemPackages = [ pkgs.android-translation-layer ];
      };
    };

  enableOCR = true;

  testScript = ''
    machine.wait_for_x()

    with subtest("launch android translation layer demo app"):
        machine.succeed("android-translation-layer ${demoApp} >&2 &")
        machine.sleep(10)
        machine.wait_for_text(r"hello PoC world!")
        machine.screenshot("atl_demo_app")

    machine.succeed("pkill -f android-translation-layer")
  '';
}
+13 −0
Original line number Diff line number Diff line
diff --git a/meson.build b/meson.build
index 8f525118..658cd9e5 100644
--- a/meson.build
+++ b/meson.build
@@ -178,7 +178,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
                                                                         extra_deps,
                                                                   	dependency('gtk4', version: '>=4.14'), dependency('gl'), dependency('egl'), dependency('wayland-client'), dependency('jni'),
                                                                   	dependency('libportal'), dependency('sqlite3'), dependency('libavcodec', version: '>=59'), dependency('libdrm'),
-                                                                  	dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'),
+                                                                  	dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'), dependency('gio-unix-2.0'),
                                                                   	libandroidfw_dep, wayland_protos_dep
                                                                   ],
                                                                   link_with: [ libandroid_so ],
+29 −0
Original line number Diff line number Diff line
diff --git a/meson.build b/meson.build
index 8f525118..c1761a2d 100644
--- a/meson.build
+++ b/meson.build
@@ -11,8 +11,8 @@ dir_base = meson.current_source_dir()
 builddir_base = meson.current_build_dir()
 # FIXME: make art install a pkgconfig file
 libart_dep = [
-	cc.find_library('art', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ]),
-     	cc.find_library('nativebridge', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ])
+	cc.find_library('art', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art', '@artStandalonePackageDir@' / get_option('libdir') / 'art' ]),
+     	cc.find_library('nativebridge', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art', '@artStandalonePackageDir@' / get_option('libdir') / 'art' ])
 ]
 libdl_bio_dep = [
 	cc.find_library('dl_bio')
@@ -21,10 +21,10 @@ libc_bio_dep = [
 	cc.find_library('c_bio')
 ]
 libandroidfw_dep = [
-	cc.find_library('androidfw', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ]),
+	cc.find_library('androidfw', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art', '@artStandalonePackageDir@' / 'lib' / 'art' ]),
 ]
-if fs.is_file('/usr' / get_option('libdir') / 'java/core-all_classes.jar')
-  bootclasspath_dir = '/usr' / get_option('libdir') / 'java'
+if fs.is_file('@artStandalonePackageDir@' / get_option('libdir') / 'java/core-all_classes.jar')
+  bootclasspath_dir = '@artStandalonePackageDir@' / get_option('libdir') / 'java'
 elif fs.is_file('/usr/local' / get_option('libdir') / 'java/core-all_classes.jar')
   bootclasspath_dir = '/usr/local' / get_option('libdir') / 'java'
 elif fs.is_file(get_option('prefix') / get_option('libdir') / 'java/core-all_classes.jar')
+12 −0
Original line number Diff line number Diff line
diff --git a/src/main-executable/main.c b/src/main-executable/main.c
index d7cfbfe8..c542c71a 100644
--- a/src/main-executable/main.c
+++ b/src/main-executable/main.c
@@ -311,6 +311,7 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h
 	} else {
 		dex_install_dir = "DIDN'T_GET_SO_PATH_WITH_dladdr_SUS"; // in case we print this as part of some other error, it should be clear what the real cause is
 	}
+	dex_install_dir = "@out@/lib/java/dex";
 
 	char *app_data_dir_base = getenv("ANDROID_APP_DATA_DIR");
 	if (!app_data_dir_base) {
Loading