From 71db09dfeb4ff55f1a95219be550708d4524c47d Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Wed, 27 Jul 2022 19:19:58 -0400 Subject: ivi-homescreen: improve AGL integration Changes: - For now add local patches for three changes that Marius has submitted upstream that fix issues with respect to running as a normal application against agl-compositor and configuration via the JSON configuration file. The first of these patches has been merged upstream, but bumping the level of meta-flutter to get it brings other rework that it seems perhaps better to wait on a tagged upstream release for. - Add another patch to add a '--app-id' command-line option to the embedder. This avoids needing to use a JSON configuration file for simple (i.e. non-homescreen) applications when running multiple apps against agl-compositor. The use of the example JSON file for the ivi-homescreen recipe itself has been left alone for now since it provides a reference for doing so. - Rename the embedder binary from "homescreen" to "flutter" to avoid collision with the existing Qt homescreen application in meta-agl-demo. This allows integrating Flutter applications into images using the Qt homescreen for testing in the period while a Flutter replacement is worked on. Discussion about possibly renaming the embedder to something more generic along these lines has started with upstream. - Split the embedder binary into a separate package from the ivi-homescreen package that contains the systemd unit file. We do not want the "homescreen" systemd unit when using the embedder in other images that use applaunchd, so this split seems the most straightforward way to avoid pulling it in. - Remove installing the "homescreen" system level systemd unit, as it does not get used in agl-image-flutter (it is installed as a user unit instead). Bug-AGL: SPEC-4485 Signed-off-by: Scott Murray Change-Id: I9f02f4312cf8c77ab224a3de8114c7fc3f4f6d36 --- .../toyota/ivi-homescreen_aglflutter.inc | 48 +++++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'meta-agl-flutter/recipes-graphics/toyota/ivi-homescreen_aglflutter.inc') diff --git a/meta-agl-flutter/recipes-graphics/toyota/ivi-homescreen_aglflutter.inc b/meta-agl-flutter/recipes-graphics/toyota/ivi-homescreen_aglflutter.inc index 48ba9d1d..3fea926e 100644 --- a/meta-agl-flutter/recipes-graphics/toyota/ivi-homescreen_aglflutter.inc +++ b/meta-agl-flutter/recipes-graphics/toyota/ivi-homescreen_aglflutter.inc @@ -1,18 +1,36 @@ -# Upstream is now pinning ivi-homescreen +FILESEXTRAPATHS:append := "${THISDIR}/files:" + +SRC_URI += " \ + file://0001-Allow-the-embedder-to-run-as-a-regular-normal-applic.patch \ + file://0002-shell-configuration-Obey-json-configuration-file.patch \ + file://0003-shell-configuration-Fixes-to-general-options.patch \ + file://0004-Add-app-id-command-line-argument.patch \ + file://config.json \ +" + +# Upstream is now pinning ivi-homescreen, but if it did need to be pinned +# it can be done here. #SRCREV = "" # For now disable gstreamer to avoid needing to enable "commercial" # licenses for the stated ffmpeg dependency. PACKAGECONFIG:remove = "gstreamer" -FILESEXTRAPATHS:append := "${THISDIR}/files:" -SRC_URI += "file://config.json" - +# # AGL specifics +# + IVI_HOMESCREEN_APP_OVERRIDE = "--b=/usr/share/flutter/gallery --j=/usr/share/flutter/config.json" SERVICE_UNIT = "Requires=agl-compositor.service\nAfter=agl-compositor.service" SERVICE_INSTALL = "WantedBy=agl-session.target" + +# The "homescreen" naming of the embedder binary conflicts with the +# Qt homescreen in meta-agl-demo. At least for now, rename it to +# allow running Flutter apps in an image that uses the Qt homescreen +# and launcher for testing. +SERVICE_EXEC_START = "ExecStart=/usr/bin/flutter --f ${IVI_HOMESCREEN_APP_OVERRIDE} ${SERVICE_EXEC_START_PARAMS}" + # we have a regular/agl-driver user, so avoid setting one SERVICE_ENVIRONMENT = "" SERVICE_USER_GROUP = "" @@ -20,10 +38,28 @@ SERVICE_RESTART = "Restart=on-failure" # we need to install as user session, not root. do_install:append() { + # The system level systemd unit is not required in AGL + rm -f ${D}{systemd_system_unitdir}/homescreen.service + install -d ${D}${systemd_user_unitdir}/agl-session.target.wants install -D -m 0644 ${WORKDIR}/config.json ${D}${datadir}/flutter/config.json - install -m0644 ${WORKDIR}/homescreen.service ${D}${systemd_user_unitdir}/homescreen.service + install -m 0644 ${WORKDIR}/homescreen.service ${D}${systemd_user_unitdir}/homescreen.service ln -s ../homescreen.service ${D}${systemd_user_unitdir}/agl-session.target.wants/homescreen.service + + # Rename embedder binary, see explanation above + mv ${D}${bindir}/homescreen ${D}${bindir}/flutter } -FILES:${PN} += " ${systemd_user_unitdir} ${datadir}/flutter/config.json" +# Split the embedder binary into a separate package to allow reusing it +# without the generated upstream systemd unit that ATM is still useful +# for testing with the agl-image-flutter image. AGL will use either +# the applaunchd systemd template or custom units in meta-agl-demo. +PACKAGE_BEFORE_PN = "flutter-embedder-${FLUTTER_RUNTIME}" + +FILES:flutter-embedder-${FLUTTER_RUNTIME} = "${bindir}" + +FILES:${PN} += "${systemd_user_unitdir} ${datadir}/flutter/config.json" + +RDEPENDS:${PN} += "flutter-embedder-${FLUTTER_RUNTIME}" + +RDEPENDS:flutter-embedder-${FLUTTER_RUNTIME} += "flutter-engine-${FLUTTER_RUNTIME}" -- cgit 1.2.3-korg