Embedded Flutter runtime targeting Embedded Linux with Wayland

Overview

ivi-homescreen

IVI Homescreen for Wayland

  • Strongly Typed (C++)
  • Lightweight
    • Clang 11 Release Stripped = 151k
    • GCC 9.3 Release Stripped = 168k
  • Source runs on Desktop and Yocto Linux
    • Ubuntu 18+
    • Fedora 33+
    • Yocto Dunfell+
  • Platform Channels enabled/disabled via CMake
  • OpenGL Texture Framework

x86_64 Desktop development notes

Ubuntu 16-18

Logging in

Log out if logged in Login screen Click on username field Right-click on the gear icon below username field, and select "Ubuntu on Wayland" Enter password and login

Ubuntu 20+ / Fedora 33+

Defaults to Wayland, no need to do anything special

Build steps

Required Packages

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt-get update -y
sudo apt-get -y install libwayland-dev wayland-protocols \
mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev mesa-utils \
libxkbcommon-dev

GCC/libstdc++ Build

git clone https://github.com/toyota-connected-na/ivi-homescreen.git
mkdir build && cd build
cmake .. -DCMAKE_STAGING_PREFIX=`pwd`/out/usr/local
make install -j

Clang/libc++ Build

git clone https://github.com/toyota-connected-na/ivi-homescreen.git
mkdir build && cd build
CC=/usr/lib/llvm-12/bin/clang CXX=/usr/lib/llvm-12/clang++ cmake .. -DCMAKE_STAGING_PREFIX=`pwd`/out/usr/local
make install -j

Clang Toolchain Setup

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12
sudo apt-get install -y libc++-12-dev libc++abi-12-dev libunwind-dev

CI Example

https://github.com/toyota-connected-na/ivi-homescreen/blob/main/.github/workflows/cmake.yml

Debian Package

make package -j
sudo apt install ./ivi-homescreen-1.0.0-Release-beta-Linux-x86_64.deb

Flutter Application

Build

Confirm flutter/bin is in the path using: flutter doctor -v

cd ~/development/my_flutter_app
flutter channel beta
flutter upgrade
flutter config --enable-linux-desktop
flutter create .
flutter build bundle

Install

loading path for application is: /usr/local/share/homescreen/bundle

This is used to leverage symlinks. Such as:

cd /usr/local/share/homescreen
sudo rm -rf bundle
sudo ln -sf ~/development/my_flutter_app/build/ bundle

Or

sudo mkdir -p /usr/local/share/homescreen/my_flutter_app/
sudo cp -r build/* /usr/local/share/homescreen/my_flutter_app/
sudo ln -sf /usr/local/share/homescreen/my_flutter_app/ bundle

Running on desktop

Copy a current icudtl.dat to /usr/local/share/flutter Copy libflutter_engine.so to /usr/local/lib or use LD_LIBRARY_PATH to point downloaded engine for build:

cd <homescreen build>
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
homescreen

Debug

cd to flutter app folder

flutter config --enable-linux-desktop
flutter create .
flutter attach --debug-port 41795 --host-vmservice-port 41795

CMAKE dependency paths

Path prefix used to determine required files is determined at build.

For desktop CMAKE_INSTALL_PREFIX defaults to /usr/local For target Yocto builds CMAKE_INSTALL_PREFIX defaults to /usr

Yocto recipes

https://github.com/jwinarske/meta-flutter
Comments
  • Rename embedder to something more suitable (running multiple instances of the embedder)

    Rename embedder to something more suitable (running multiple instances of the embedder)

    Presumably this change is a bit controversial, I'm merely suggesting a name change, not really sure the one that I picked is really good or not.

    Naming this homescreen doesn't really make sense in platforms where there are multiple instances of the embedder running so I suggested (re)naming it flutter-ed (flutter-embedder).

    Obviously the meta-flutter recipes also need changing, but I said to get the ball rolling and see how people feel about this.

    opened by mv0 12
  • Running on Desktop Ubuntu

    Running on Desktop Ubuntu

    I can build desktop ubuntu 20 just fine but when it comes to running Copy libflutter_engine.so to /usr/local/lib or use LD_LIBRARY_PATH to point downloaded engine for build:

    Question where do i get libflutter_engine.so from ? Do I try and build a copy using https://github.com/meta-flutter/flutter_embedded
    or Can i use one of my local copies created during flutter snap install maybe the release copy

    parallels > find /home/parallels/snap/flutter -type f -name "libflutter*.so" -print /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/android-x86/libflutter.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/android-x64/libflutter.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64/libflutter_linux_gtk.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64-release/libflutter_linux_gtk.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64-profile/libflutter_linux_gtk.so

    please advise regards

    opened by bernardcraddock 8
  • Redo the EGL window creation

    Redo the EGL window creation

    This patch series includes the ability start up correctly as maximized/fullscreen from the beginning on the AGL platform.

    Specifically this patch series:

    • groups together agl-shell protocol requests in the EglWindow constructor
    • makes part of the initial commit the set_toplevel request and the frame callback
    • redoes the EGL window/surface creation to allow starting up as maximized/fullscreen
    • paves the way to have regular applications starting up in various scenarios (compositor sending 0 values and apps need to chose a default value).

    With these changes I get the gallery application running on both swrast (llvmpipe) and HW accelerated drivers.

    LE: I've verified/tested this patch series on x86_64:

    • Debian testing with gnome-shell/mutter 4.20
    • Debian testing with weston main (post weston 10)
    • Debian testing with AGL compositor master
    • AGL platform (qemu x86_64) w/ a master from a few days ago (6 of May 2022). Together with https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27460 (an unrelated change to this patch series) we get a boot-up to flutter gallery application.
    opened by mv0 7
  • xdg_shell, multi-output, remove sprawl, cleanup

    xdg_shell, multi-output, remove sprawl, cleanup

    xdg_shell -replaces wl_shell for xdg_shell

    Multiple outputs -Adds support for saving state on multiple outputs -Enables deriving the buffer scaling factor

    Cleanup -Remove unused methods/variables -Remove unused headers -Initialize uninitialize variables -rename m_engine to m_flutter_engine in App class

    Remove sprawl option -Not required with xdg_shell

    Update README.md -Enabling flutter desktop causes App build issue. This has been the case for some time. Only use custom devices for debugging eLinux Flutter.

    FPS feature cleanup -Fix narrowing warnings -Update README for usage

    Remove pinch gesture references -Dart layer gesture detection being used. Not all targets have this protocol

    opened by jwinarske 4
  • How do I run release version of flutter app with ivi-homescreen ?

    How do I run release version of flutter app with ivi-homescreen ?

    Firs of all this is not an issue. I am not able to find steps to run release version of flutter apps.

    With this patch I was able to run debug version of the the apps with ivi-homescreen.

    diff --git a/shell/engine.cc b/shell/engine.cc
    index 5eb4205..7c979f1 100644
    --- a/shell/engine.cc
    +++ b/shell/engine.cc
    @@ -87,7 +87,7 @@ Engine::Engine(App* app, size_t index)
           }),
           m_renderer_config(
               {.type = kOpenGL,
    -           .open_gl = {
    +           .open_gl = FlutterOpenGLRendererConfig {
                    .struct_size = sizeof(FlutterOpenGLRendererConfig),
                    .make_current = [](void* userdata) -> bool {
                      auto e = reinterpret_cast<Engine*>(userdata);
    

    Above fix is probably only required for g++ & not clang++.

    $ g++ --version
    g++ (Ubuntu 11.2.0-7ubuntu2) 11.2.0
    

    However when I attempt to run release bundle I see an error about missing flutter_assets/kernel_blob.bin

    [INFO:display.cc(67)] No agl_shell extension present
    [INFO:display.cc(71)] WL_SHM_FORMAT_XRGB32 not available
    [INFO:display.cc(257)] Pointer Present
    [INFO:display.cc(266)] Keyboard Present
    [ERROR:/home/skamath/proactive/flutter/ivi-homescreen/shell/engine.cc(142)] (0) /usr/local/share/homescreen/bundle/flutter_assets/kernel_blob.bin missing Flutter Kernel
    
    opened by shrkamat 4
  • Minor parsing fixes for JSON configuration file

    Minor parsing fixes for JSON configuration file

    This patch series fixes some minor parsing isssues I've found while using the JSON config file.

    Specifically, app_id specified over the configuration is being ignored and found similar issue with debug_backend and disable_cursor.

    opened by mv0 3
  • Enable pixel_ratio arg from CLI

    Enable pixel_ratio arg from CLI

    Allows making pixel_ratio something other than 1.0 using optional command line arg.

    Examples --

    ./homescreen --w=640 --h=480 --r=2.0
    
    Screen Shot 2022-06-22 at 8 44 03 PM
    ./homescreen --w=640 --h=480 --r=0.5
    
    Screen Shot 2022-06-22 at 8 44 21 PM enhancement 
    opened by cmc5788 2
  • Simplify wayland mouse input translation

    Simplify wayland mouse input translation

    Addressing issue described in #56 and simplifying the previous wayland mouse input events to flutter pointer events translation in ivi-homescreen:

    Sanity checked implementation here against the official flutter linux shell's mouse input handling for motion, scrolling and button events. The relevant analogous code sections are linked below:

    Motion: https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L371-L372 motion events are either kMove or KHover, matching linux desktop: https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L383

    Scrolling (Axis in wayland): https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_scrolling_manager.cc#L67 Notice that for scrolling events the pointer phase is disregarded and kMove is chosen arbitrarily based on this comment https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_scrolling_manager.cc#L122-L123

    Button: https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L114-L115 Currently this PR does not drop redundant events but perhaps it should try to mimic such behavior. Another difference is that this PR does not keep track of previous button state and so only sends kUp or kDown events for button events, never kMove or KHover, it's unclear to me if this should behavior should be copied or not. https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L130-L148

    Tested this PR manually on the default flutter increment button app which no longer crashes with debug assertions described in Issue #56.

    opened by doesnotexist 2
  • Mouse pointer motion events sometimes violate debug assertion check for state.is_down

    Mouse pointer motion events sometimes violate debug assertion check for state.is_down

    On my ubuntu 20.04, wayland+weston+ivi-homescreen running the default flutter create "increment" button app with debug engine v2.10.3 arm64, I'm finding that the app often crashes when using mouse input because this assertion check fails.

    [FATAL:flutter/lib/ui/window/pointer_data_packet_converter.cc(189)] Check failed: !state.is_down. 
    

    https://github.com/flutter/engine/blob/main/lib/ui/window/pointer_data_packet_converter.cc#L190

    I believe this is a manifestation of a bug in translating wayland input events to flutter, specifically within Display::pointer_handle_motion() https://github.com/toyota-connected/ivi-homescreen/blob/main/shell/display.cc#L399

    Which calls getPointerPhase(), and in some instances the state can be such that p->buttons is not null and state == WL_POINTER_BUTTON_STATE_RELEASED which ends up translating the event to FlutterPointerPhase::kUp. https://github.com/toyota-connected/ivi-homescreen/blob/main/shell/display.cc#L337 However, if no kDown event is sent between this kUp event and some previous kUp event (say from releasing the mouse button) then the debug assert fails and the app crashes with the FATAL warning above.

    Based on what I've gathered from reading the comments in embedder.h https://github.com/flutter/engine/blob/main/shell/platform/embedder/embedder.h#L727-L743

    I propose that the wayland input event listener Display::pointer_handle_motion() should only translate to FlutterPointerPhase::kMove or FlutterPointerPhase::kHover depending on whether the left mouse button is currently pressed down or not during the motion event. PR that implements this change coming shortly.

    opened by doesnotexist 1
  • Why does ivi-homescreen the fixed flutter assets path(=`/usr/local/share/homescreen`)?

    Why does ivi-homescreen the fixed flutter assets path(=`/usr/local/share/homescreen`)?

    From my understanding, ivi-homescreen can launch the flutter aseets placed at /usr/local/share/homescreen only. How can I launch multiple flutter apps with ivi-homescreen?

    If ivi-homescreen accepts another flutter assets path from cmdline args like flutter-wayland(https://github.com/chinmaygarde/flutter_wayland), ivi-homescreen will become more flexible.

    What do you think of this idea?

    opened by WAKazuyoshiAkiyama 1
  • Widget Exception Fix

    Widget Exception Fix

    • Fixes: "The following _CastError was thrown while checking if the clipboard has strings: type 'bool' is not a subtype of type 'Map<String, dynamic>?' in type cast"

    Signed-off-by: Joel Winarske [email protected]

    opened by jwinarske 0
  • Add CodeQL workflow

    Add CodeQL workflow

    Hi toyota-connected/ivi-homescreen!

    This is not an automatic, 🤖-generated PR, as you can check in my GitHub profile, I work for GitHub and I am part of the GitHub Security Lab which is helping out with the migration of LGTM configurations to Code Scanning. You might have heard that we've integrated LGTM's underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by jorgectf 0
  • Multi-View Video Player

    Multi-View Video Player

    Only a single instance of Video Player is currently supported. The static plugin needs to be refactored to handle multiple views.

    Currently a low priority.

    opened by jwinarske 0
  • ivi-homescreen does not support keyboard repeat

    ivi-homescreen does not support keyboard repeat

    @jwinarske I tried to run my app to check the ivi-homescreen's features related to input envents, but, my app have not worked correctly. It seems ivi-homescreen cannot accept any keyboard events at least.

    The behavior of my app is the following.

    • When the up half of the window is clicked, the mid bar will become blue to indicate that the up half takes focus.
    • While the up half takes focus, TextField will start to work.
    • When A or B key is pressed, some messages like [A_KeyDown][A_Repeat][A_KeyUp] will be output in the low half of the window.
    • When other keys is pressed, a character of a pressed key is visible in TextField.

    When I use the official linux-desktop device, the app worked correctly, but, when I use ivi-homescreen for Desktop, even if I press any keys, the app has no reaction for any keys.

    Please see the video.

    How can I use keyboard inputs in ivi-homescreen? OR, keyboard inputs is the missing feature of ivi-homescreen?

    SIDE NOTES: ivi-homescreen causes core-dump when it is interrupted by Ctrl-C.

    $ ~/homescreen --a=build/flutter_assets
    [INFO:display.cc(50)] agl_shell extension not present
    [INFO:display.cc(280)] Pointer Present
    [INFO:display.cc(289)] Keyboard Present
    [INFO:engine.cc(200)] Runtime=debug
    [INFO:engine.cc(91)] flutter: The Dart VM service is listening on http://127.0.0.1:42187/ufLHlW6rddA=/
    [INFO:navigation.cc(33)] Navigation: Select Single Entry History
    [INFO:navigation.cc(47)] Navigation: Route Information Updated
    	location: /
    	state: 
    	replace: 0
    dddddddddddddddaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbb^C[FATAL:flutter/fml/thread_local.cc(30)] Check failed: false. pthread_setspecific failed (22): Invalid argument
    [1]    28678 abort (core dumped)  ~/homescreen --a=build/flutter_assets
    
    opened by WAKazuyoshiAkiyama 40
Owner
null
Techniques based on named pipes for pool overflow exploitation targeting the most recent (and oldest) Windows versions

Table of Contents Table of Contents Introduction Named-Pipes Introduction Exploitation Spraying the non-paged pool Memory Disclosure/Arbitrary Read Co

null 137 Oct 20, 2022
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.

SynnixOS Epic Hobby OS targeting x86_64 CPUs, it includes some hacked together functionality for most essential OSs although, with interactivity via Q

RaidTheWeb 42 Oct 28, 2022
Flutter plugins for embedded Linux (eLinux)

Flutter plugins for Embedded Linux (eLinux) This repo is a companion repo to the flutter-elinux. It contains the source code for Flutter plugins for e

Sony 27 Nov 18, 2022
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

AnTler 133 Nov 26, 2022
Flutter-Clock-and-Reminder-App - a highly functional clock and reminder app developed on flutter framework.

clock_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Umar Baloch 6 Aug 4, 2022
way-displays: Manage Your Wayland Displays

way-displays: Manage Your Wayland Displays Sets preferred mode or highest at maximum refresh Arranges left to right Auto scales based on DPI: 96 is a

Alexander Courtis 69 Oct 27, 2022
A friendly C++ library to create Wayland Compositors.

A friendly C++ library to create Wayland compositors that runs directly on top of DRM.

Eduardo Hopperdietzel 5 Nov 23, 2022
Extremely minimal raw Wayland greeter for greetd.

greetd-mini-wl-greeter An extremely simple raw Wayland greeter for greetd, inspired by lightdm-mini-greeter. Usage Follow the same steps as for e.g. g

Philip Jones 19 Nov 22, 2022
GTK-based lockscreen for Wayland

gtklock GTK-based lockscreen for Wayland. About gtklock is based on gtkgreet. It uses the wlr-layer-shell and wlr-input-inhibitor Wayland protocols an

Jovan Lanik 136 Nov 28, 2022
Adaptive Runtime AUTOSAR Linux Simulator

Adaptive-AUTOSAR Adaptive AUTOSAR is a simulated Adaptive Platform enviroment over Linux defined by AUTOSAR. The goal of this project is to implement

Armin Kassemi Langroodi 144 Nov 24, 2022
A C library for runtime-flippable feature flags on Linux/x86-64, with negligible overhead in the common case

Biased runtime-flippable flags, with cross-modifying code The dynamic_flag library is a two-file "C" library that offers efficient biased conditionals

Backtrace Labs 60 Nov 9, 2022
A place to collaborate on code for the Embedded.fm book club. Currently reading "STM32 ARM Programming for Embedded Systems".

Welcome to the Book Club Code site! This is a place for the Embedded.fm book club to collaborate and learn together. Repo Structure Guide Top-level fo

Peter Griffin 11 Jul 21, 2022
JavaScript runtime for Fastly [email protected]

Fastly [email protected] JS Runtime The JS Compute Runtime for Fastly's [email protected] platform provides the environment JavaScript is executed in when using

Fastly 119 Nov 25, 2022
A simple thread-safe implementation of runtime obfuscation for Win32 applications.

Thread-Safe Win32 Runtime Obfuscation A simple thread-safe implementation of runtime obfuscation for Win32 applications. The main use case for this is

Daniel 1 Mar 6, 2022
Simple EFI runtime driver that hooks GetVariable function and returns data expected by Windows to make it think that it's running with secure boot enabled (faking secure boot)

SecureFakePkg is a simple EFI runtime driver that hooks GetVariable function and returns data expected by Windows to make it think that it's running with secure boot enabled. In other words, it fakes secure boot status.

Samuel Tulach 80 Oct 20, 2022
Helper to create a SkeletalMeshComponent in UE4 at runtime.

Runtime Skeletal Mesh Generator for UE4 Helper to create a SkeletalMeshComponent in UE4 at runtime. This is a header only library that simplify the pr

Andrea Catania 32 Nov 2, 2022
VGG Runtime for loading design and running emulated apps.

VGG Runtime A design engine capable of loading design drafts as well as running design as an emulated app. Features Game-engine-like ECS architecture

Very Good Graphics 21 Nov 22, 2022
Resolve DOS MZ executable symbols at runtime

NtSymbol Resolve DOS MZ executable symbols at runtime Example You no longer have not have to use memory pattern scan inside your sneaky rootkit. Pass

Kento Oki 81 Nov 28, 2022
OCaml bytecode running on the nRF52840 board, using the OMicroB runtime with RIOT OS.

omicrob-riot-nrf52 This project gets OCaml bytecode running on the nRF52840 board. It uses OMicroB for the runtime and bytecode optimisation, and RIOT

Ben Andrew 7 Sep 23, 2022