add touch events handling

This commit is contained in:
2026-01-08 22:35:59 +01:00
parent 1074a1e59a
commit c101d647dd
23 changed files with 435 additions and 818 deletions

View File

@@ -244,6 +244,18 @@
<option name="screenX" value="1080" /> <option name="screenX" value="1080" />
<option name="screenY" value="2340" /> <option name="screenY" value="2340" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="36" />
<option name="brand" value="samsung" />
<option name="codename" value="a35x" />
<option name="id" value="a35x" />
<option name="labId" value="google" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="A35" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="35" /> <option name="api" value="35" />
<option name="brand" value="samsung" /> <option name="brand" value="samsung" />
@@ -942,9 +954,9 @@
<option name="labId" value="google" /> <option name="labId" value="google" />
<option name="manufacturer" value="Samsung" /> <option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S25 Ultra" /> <option name="name" value="Galaxy S25 Ultra" />
<option name="screenDensity" value="600" /> <option name="screenDensity" value="450" />
<option name="screenX" value="1440" /> <option name="screenX" value="1080" />
<option name="screenY" value="3120" /> <option name="screenY" value="2340" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="36" /> <option name="api" value="36" />
@@ -954,9 +966,9 @@
<option name="labId" value="google" /> <option name="labId" value="google" />
<option name="manufacturer" value="Samsung" /> <option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S25 Ultra" /> <option name="name" value="Galaxy S25 Ultra" />
<option name="screenDensity" value="600" /> <option name="screenDensity" value="450" />
<option name="screenX" value="1440" /> <option name="screenX" value="1080" />
<option name="screenY" value="3120" /> <option name="screenY" value="2340" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="33" /> <option name="api" value="33" />
@@ -1044,6 +1056,18 @@
<option name="screenX" value="1080" /> <option name="screenX" value="1080" />
<option name="screenY" value="2340" /> <option name="screenY" value="2340" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="36" />
<option name="brand" value="samsung" />
<option name="codename" value="r9q-SM-G990U" />
<option name="id" value="r9q-SM-G990U" />
<option name="labId" value="google" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S21 FE 5G" />
<option name="screenDensity" value="480" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="36" /> <option name="api" value="36" />
<option name="brand" value="google" /> <option name="brand" value="google" />

View File

@@ -2,9 +2,6 @@
<project version="4"> <project version="4">
<component name="deploymentTargetSelector"> <component name="deploymentTargetSelector">
<selectionStates> <selectionStates>
<SelectionState runConfigName="NativeService">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
<SelectionState runConfigName="MosisService"> <SelectionState runConfigName="MosisService">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
</SelectionState> </SelectionState>

1
.idea/gradle.xml generated
View File

@@ -6,6 +6,7 @@
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" /> <option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\gradle-8.13" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" /> <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules"> <option name="modules">
<set> <set>

View File

@@ -0,0 +1,50 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewDeviceShouldUseNewSpec" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewParameterProviderOnFirstParameter" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
</profile>
</component>

View File

@@ -4,8 +4,9 @@ plugins {
alias(libs.plugins.kotlin.compose) alias(libs.plugins.kotlin.compose)
} }
val vcpkgHome = "/Users/omar/vcpkg" val sdkHome = System.getenv("ANDROID_HOME") as String
val ndkHome = "/Users/omar/Library/Android/sdk/ndk/29.0.14206865" val ndkHome = System.getenv("ANDROID_NDK_HOME") as String
val vcpkgHome = System.getenv("VCPKG_ROOT") as String
android { android {
namespace = "com.omixlab.mosis" namespace = "com.omixlab.mosis"
@@ -32,6 +33,8 @@ android {
arguments += "-DCMAKE_TOOLCHAIN_FILE=$vcpkgHome/scripts/buildsystems/vcpkg.cmake" arguments += "-DCMAKE_TOOLCHAIN_FILE=$vcpkgHome/scripts/buildsystems/vcpkg.cmake"
arguments += "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$ndkHome/build/cmake/android.toolchain.cmake" arguments += "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$ndkHome/build/cmake/android.toolchain.cmake"
arguments += "-DVCPKG_TARGET_TRIPLET=arm64-android" arguments += "-DVCPKG_TARGET_TRIPLET=arm64-android"
arguments += "-DANDROID_SDK=$sdkHome"
arguments += "-DANDROID_NDK=$ndkHome"
targets += "mosis-service" targets += "mosis-service"
targets += "mosis-test" targets += "mosis-test"
} }

View File

@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle. # Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the # For customization when using a Version Control System, please read the
# header note. # header note.
#Thu Dec 25 21:43:48 CET 2025 #Mon Jan 05 20:27:08 CET 2026
sdk.dir=/Users/omar/Library/Android/sdk sdk.dir=C\:\\Users\\omara\\AppData\\Local\\Android\\Sdk

View File

@@ -4,5 +4,7 @@ import com.omixlab.mosis.IMosisListener;
interface IMosisService { interface IMosisService {
boolean initOS(IMosisListener listener); boolean initOS(IMosisListener listener);
int getNumber(); void onTouchDown(float x, float y);
void onTouchMove(float x, float y);
void onTouchUp(float x, float y);
} }

View File

@@ -1,28 +1,35 @@
<rml> <rml>
<head> <head>
<title>Demo</title> <link type="text/rcss" href="html.rcss"/>
<link type="text/template" href="window.rml" /> <link type="text/rcss" href="phone.rcss"/>
<style> <title>Fullscreen Mobile UI</title>
body </head>
{ <body>
width: 300dp; <div id="status-bar">
height: 225dp; <span class="time">22:47</span>
<div class="status-icons">
<span class="icon">📶</span>
<span class="icon">🔋</span>
<span class="icon">📶</span>
<span class="icon">🔋</span>
<span class="icon">📶</span>
<span class="icon">🔋</span>
</div>
</div>
margin: auto; <div id="content">
} <div class="header-section">
<h1>Hello omar 3 hello! and hello LEO 2 Hello!</h1>
</div>
</div>
div#title_bar div#icon <div id="nav-bar">
{ <div class="nav-item">Home</div>
display: none; <div class="nav-item">Apps</div>
} <div class="nav-item">Settings</div>
<div class="nav-item">Home</div>
div#content <div class="nav-item">Apps</div>
{ <div class="nav-item">Settings</div>
text-align: left; </div>
} </body>
</style>
</head>
<body template="window">
This is a sample.
</body>
</rml> </rml>

93
src/main/assets/html.rcss Normal file
View File

@@ -0,0 +1,93 @@
body, div,
h1, h2, h3, h4,
h5, h6, p,
hr, pre,
tabset tabs
{
display: block;
}
h1
{
font-size: 2em;
margin: .67em 0;
}
h2
{
font-size: 1.5em;
margin: .75em 0;
}
h3
{
font-size: 1.17em;
margin: .83em 0;
}
h4, p
{
margin: 1.12em 0;
}
h5
{
font-size: .83em;
margin: 1.5em 0;
}
h6
{
font-size: .75em;
margin: 1.67em 0;
}
h1, h2, h3, h4,
h5, h6, strong
{
font-weight: bold;
}
em
{
font-style: italic;
}
pre
{
white-space: pre;
}
hr
{
border-width: 1px;
}
table
{
box-sizing: border-box;
display: table;
}
tr
{
box-sizing: border-box;
display: table-row;
}
td
{
box-sizing: border-box;
display: table-cell;
}
col
{
box-sizing: border-box;
display: table-column;
}
colgroup
{
display: table-column-group;
}
thead, tbody, tfoot
{
display: table-row-group;
}

110
src/main/assets/phone.rcss Normal file
View File

@@ -0,0 +1,110 @@
/* Ensure the body fills the entire window */
body {
font-family: LatoLatin;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background: #0f0f12;
color: white;
}
/* Status Bar pinned to top */
#status-bar {
display: block;
height: 140px;
padding: 10px 20px 0;
background-color: rgba(255, 0, 0, 0.2);
}
.time {
float: left;
font-weight: bold;
font-size: 2em;
}
.status-icons {
float: right;
font-size: 2em;
}
.icon {
margin-left: 10px;
}
/* Content area grows to fill space */
#content {
padding: 20px;
/* Leaves room for status and nav bars */
height: 80%;
align: center;
}
.header-section {
margin-bottom: 30px;
text-align: center;
}
h1 {
font-size: 2.5em;
font-weight: bold;
}
/* Mobile-style cards */
.card {
background: #1e1e24;
border-radius: 20px;
padding: 20px;
margin-bottom: 15px;
border: 1px solid #333;
}
.card-title {
font-size: 1.2em;
margin-bottom: 10px;
color: #3498db;
}
.progress-bar {
height: 8px;
background: #333;
border-radius: 4px;
margin: 10px 0;
}
.progress-fill {
width: 84%;
height: 100%;
background: #3498db;
border-radius: 4px;
}
/* Navigation Bar pinned to bottom */
#nav-bar {
position: absolute;
bottom: 0;
width: 100%;
height: 65px;
background-color: #16161a;
display: flex;
justify-content: space-around;
align-items: center;
border-top: 1px solid #333;
}
.nav-item {
font-size: 1.9em;
color: #888;
background-color: red;
width: 100px;
height: 100px;
text-align: center;
vertical-align: middle;
line-height: 90px;
border-radius: 10px;
}
.nav-item:hover {
color: #3498db;
background-color: blue;
}

View File

@@ -4,8 +4,9 @@ project("mosis")
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ANDROID_SDK "/Users/omar/Library/Android/sdk") #set(ANDROID_SDK "/Users/omar/Library/Android/sdk")
set(BINDER_DIR "${ANDROID_SDK}/platforms/android-36/optional/libbinder_ndk_cpp") set(BINDER_DIR "${ANDROID_SDK}/platforms/android-36/optional/libbinder_ndk_cpp")
set(AIDL_EXE "${ANDROID_SDK}/build-tools/36.1.0/aidl.exe")
find_package(RmlUi CONFIG REQUIRED) find_package(RmlUi CONFIG REQUIRED)
@@ -15,10 +16,26 @@ find_package(RmlUi CONFIG REQUIRED)
# message(STATUS "${_variableName}=${${_variableName}}") # message(STATUS "${_variableName}=${${_variableName}}")
#endforeach() #endforeach()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/com/omixlab/mosis/IMosisService.cpp"
COMMAND ${AIDL_EXE} --lang=ndk --min_sdk_version=36 -o ${CMAKE_CURRENT_BINARY_DIR} -h ${CMAKE_CURRENT_BINARY_DIR} -I ..\\aidl ..\\aidl\\com\\omixlab\\mosis\\IMosisService.aidl
DEPENDS ../aidl/com/omixlab/mosis/IMosisService.aidl
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
VERBATIM
)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/com/omixlab/mosis/IMosisListener.cpp"
COMMAND ${AIDL_EXE} --lang=ndk --min_sdk_version=36 -o ${CMAKE_CURRENT_BINARY_DIR} -h ${CMAKE_CURRENT_BINARY_DIR} -I ..\\aidl ..\\aidl\\com\\omixlab\\mosis\\IMosisListener.aidl
DEPENDS ../aidl/com/omixlab/mosis/IMosisListener.aidl
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
VERBATIM
)
add_library(mosis-service SHARED add_library(mosis-service SHARED
mosis-service.cpp mosis-service.cpp
com/omixlab/mosis/IMosisService.cpp ${CMAKE_CURRENT_BINARY_DIR}/com/omixlab/mosis/IMosisService.cpp
com/omixlab/mosis/IMosisListener.cpp ${CMAKE_CURRENT_BINARY_DIR}/com/omixlab/mosis/IMosisListener.cpp
assets_manager.cpp assets_manager.cpp
shader.cpp shader.cpp
external_texture.cpp external_texture.cpp
@@ -37,6 +54,7 @@ target_compile_definitions(mosis-service PUBLIC
) )
target_include_directories(mosis-service PUBLIC target_include_directories(mosis-service PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${BINDER_DIR} ${BINDER_DIR}
glad/include glad/include
) )
@@ -46,8 +64,8 @@ target_link_libraries(mosis-service
) )
add_library(mosis-test SHARED add_library(mosis-test SHARED
com/omixlab/mosis/IMosisService.cpp ${CMAKE_CURRENT_BINARY_DIR}/com/omixlab/mosis/IMosisService.cpp
com/omixlab/mosis/IMosisListener.cpp ${CMAKE_CURRENT_BINARY_DIR}/com/omixlab/mosis/IMosisListener.cpp
mosis-test.cpp mosis-test.cpp
assets_manager.cpp assets_manager.cpp
shader.cpp shader.cpp
@@ -61,6 +79,7 @@ add_library(mosis-test SHARED
) )
target_include_directories(mosis-test PUBLIC target_include_directories(mosis-test PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${BINDER_DIR} ${BINDER_DIR}
glad/include glad/include
) )

View File

@@ -1,56 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisListener.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#pragma once
#include "aidl/com/omixlab/mosis/IMosisListener.h"
#include <android/binder_ibinder.h>
#include <cassert>
#ifndef __BIONIC__
#ifndef __assert2
#define __assert2(a,b,c,d) ((void)0)
#endif
#endif
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
class BnMosisListener : public ::ndk::BnCInterface<IMosisListener> {
public:
BnMosisListener();
virtual ~BnMosisListener();
protected:
::ndk::SpAIBinder createBinder() override;
private:
};
class IMosisListenerDelegator : public BnMosisListener {
public:
explicit IMosisListenerDelegator(const std::shared_ptr<IMosisListener> &impl) : _impl(impl) {
}
::ndk::ScopedAStatus onServiceInitialized(bool in_success) override {
return _impl->onServiceInitialized(in_success);
}
::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) override {
return _impl->onBufferAvailable(in_buffer);
}
::ndk::ScopedAStatus onFrameAvailable() override {
return _impl->onFrameAvailable();
}
protected:
private:
std::shared_ptr<IMosisListener> _impl;
};
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,53 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisService.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#pragma once
#include "aidl/com/omixlab/mosis/IMosisService.h"
#include <android/binder_ibinder.h>
#include <cassert>
#ifndef __BIONIC__
#ifndef __assert2
#define __assert2(a,b,c,d) ((void)0)
#endif
#endif
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
class BnMosisService : public ::ndk::BnCInterface<IMosisService> {
public:
BnMosisService();
virtual ~BnMosisService();
protected:
::ndk::SpAIBinder createBinder() override;
private:
};
class IMosisServiceDelegator : public BnMosisService {
public:
explicit IMosisServiceDelegator(const std::shared_ptr<IMosisService> &impl) : _impl(impl) {
}
::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) override {
return _impl->initOS(in_listener, _aidl_return);
}
::ndk::ScopedAStatus getNumber(int32_t* _aidl_return) override {
return _impl->getNumber(_aidl_return);
}
protected:
private:
std::shared_ptr<IMosisService> _impl;
};
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,31 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisListener.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#pragma once
#include "aidl/com/omixlab/mosis/IMosisListener.h"
#include <android/binder_ibinder.h>
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
class BpMosisListener : public ::ndk::BpCInterface<IMosisListener> {
public:
explicit BpMosisListener(const ::ndk::SpAIBinder& binder);
virtual ~BpMosisListener();
::ndk::ScopedAStatus onServiceInitialized(bool in_success) override;
::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) override;
::ndk::ScopedAStatus onFrameAvailable() override;
};
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,30 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisService.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#pragma once
#include "aidl/com/omixlab/mosis/IMosisService.h"
#include <android/binder_ibinder.h>
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
class BpMosisService : public ::ndk::BpCInterface<IMosisService> {
public:
explicit BpMosisService(const ::ndk::SpAIBinder& binder);
virtual ~BpMosisService();
::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) override;
::ndk::ScopedAStatus getNumber(int32_t* _aidl_return) override;
};
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,61 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisListener.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#pragma once
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <android/binder_interface_utils.h>
#include <android/hardware_buffer_aidl.h>
#ifdef BINDER_STABILITY_SUPPORT
#include <android/binder_stability.h>
#endif // BINDER_STABILITY_SUPPORT
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
class IMosisListenerDelegator;
class IMosisListener : public ::ndk::ICInterface {
public:
typedef IMosisListenerDelegator DefaultDelegator;
static const char* descriptor;
IMosisListener();
virtual ~IMosisListener();
static constexpr uint32_t TRANSACTION_onServiceInitialized = FIRST_CALL_TRANSACTION + 0;
static constexpr uint32_t TRANSACTION_onBufferAvailable = FIRST_CALL_TRANSACTION + 1;
static constexpr uint32_t TRANSACTION_onFrameAvailable = FIRST_CALL_TRANSACTION + 2;
static std::shared_ptr<IMosisListener> fromBinder(const ::ndk::SpAIBinder& binder);
static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisListener>& instance);
static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisListener>* instance);
static bool setDefaultImpl(const std::shared_ptr<IMosisListener>& impl);
static const std::shared_ptr<IMosisListener>& getDefaultImpl();
virtual ::ndk::ScopedAStatus onServiceInitialized(bool in_success) = 0;
virtual ::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) = 0;
virtual ::ndk::ScopedAStatus onFrameAvailable() = 0;
private:
static std::shared_ptr<IMosisListener> default_impl;
};
class IMosisListenerDefault : public IMosisListener {
public:
::ndk::ScopedAStatus onServiceInitialized(bool in_success) override;
::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) override;
::ndk::ScopedAStatus onFrameAvailable() override;
::ndk::SpAIBinder asBinder() override;
bool isRemote() override;
};
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,61 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisService.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#pragma once
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <android/binder_interface_utils.h>
#include <aidl/com/omixlab/mosis/IMosisListener.h>
#ifdef BINDER_STABILITY_SUPPORT
#include <android/binder_stability.h>
#endif // BINDER_STABILITY_SUPPORT
namespace aidl::com::omixlab::mosis {
class IMosisListener;
} // namespace aidl::com::omixlab::mosis
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
class IMosisServiceDelegator;
class IMosisService : public ::ndk::ICInterface {
public:
typedef IMosisServiceDelegator DefaultDelegator;
static const char* descriptor;
IMosisService();
virtual ~IMosisService();
static constexpr uint32_t TRANSACTION_initOS = FIRST_CALL_TRANSACTION + 0;
static constexpr uint32_t TRANSACTION_getNumber = FIRST_CALL_TRANSACTION + 1;
static std::shared_ptr<IMosisService> fromBinder(const ::ndk::SpAIBinder& binder);
static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisService>& instance);
static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisService>* instance);
static bool setDefaultImpl(const std::shared_ptr<IMosisService>& impl);
static const std::shared_ptr<IMosisService>& getDefaultImpl();
virtual ::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) = 0;
virtual ::ndk::ScopedAStatus getNumber(int32_t* _aidl_return) = 0;
private:
static std::shared_ptr<IMosisService> default_impl;
};
class IMosisServiceDefault : public IMosisService {
public:
::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) override;
::ndk::ScopedAStatus getNumber(int32_t* _aidl_return) override;
::ndk::SpAIBinder asBinder() override;
bool isRemote() override;
};
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,242 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisListener.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#include "aidl/com/omixlab/mosis/IMosisListener.h"
#include <cstdint>
#include <android/binder_parcel.h>
#include <android/binder_parcel_utils.h>
#include <android/binder_status.h>
#include <aidl/com/omixlab/mosis/BnMosisListener.h>
#include <aidl/com/omixlab/mosis/BpMosisListener.h>
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
static binder_status_t _aidl_com_omixlab_mosis_IMosisListener_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
(void)_aidl_in;
(void)_aidl_out;
binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
std::shared_ptr<BnMosisListener> _aidl_impl = std::static_pointer_cast<BnMosisListener>(::ndk::ICInterface::asInterface(_aidl_binder));
switch (_aidl_code) {
case (FIRST_CALL_TRANSACTION + 0 /*onServiceInitialized*/): {
bool in_success;
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_success);
if (_aidl_ret_status != STATUS_OK) break;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onServiceInitialized(in_success);
_aidl_ret_status = STATUS_OK;
break;
}
case (FIRST_CALL_TRANSACTION + 1 /*onBufferAvailable*/): {
::aidl::android::hardware::HardwareBuffer in_buffer;
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_buffer);
if (_aidl_ret_status != STATUS_OK) break;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onBufferAvailable(in_buffer);
_aidl_ret_status = STATUS_OK;
break;
}
case (FIRST_CALL_TRANSACTION + 2 /*onFrameAvailable*/): {
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onFrameAvailable();
_aidl_ret_status = STATUS_OK;
break;
}
}
return _aidl_ret_status;
}
static AIBinder_Class* _g_aidl_com_omixlab_mosis_IMosisListener_clazz = ::ndk::ICInterface::defineClass(IMosisListener::descriptor, _aidl_com_omixlab_mosis_IMosisListener_onTransact, nullptr, 0);
BpMosisListener::BpMosisListener(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
BpMosisListener::~BpMosisListener() {}
::ndk::ScopedAStatus BpMosisListener::onServiceInitialized(bool in_success) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_success);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinderReference().get(),
(FIRST_CALL_TRANSACTION + 0 /*onServiceInitialized*/),
_aidl_in.getR(),
_aidl_out.getR(),
FLAG_ONEWAY
#ifdef BINDER_STABILITY_SUPPORT
| static_cast<int>(FLAG_PRIVATE_LOCAL)
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisListener::getDefaultImpl()) {
_aidl_status = IMosisListener::getDefaultImpl()->onServiceInitialized(in_success);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpMosisListener::onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_buffer);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinderReference().get(),
(FIRST_CALL_TRANSACTION + 1 /*onBufferAvailable*/),
_aidl_in.getR(),
_aidl_out.getR(),
FLAG_ONEWAY
#ifdef BINDER_STABILITY_SUPPORT
| static_cast<int>(FLAG_PRIVATE_LOCAL)
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisListener::getDefaultImpl()) {
_aidl_status = IMosisListener::getDefaultImpl()->onBufferAvailable(in_buffer);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpMosisListener::onFrameAvailable() {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinderReference().get(),
(FIRST_CALL_TRANSACTION + 2 /*onFrameAvailable*/),
_aidl_in.getR(),
_aidl_out.getR(),
FLAG_ONEWAY
#ifdef BINDER_STABILITY_SUPPORT
| static_cast<int>(FLAG_PRIVATE_LOCAL)
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisListener::getDefaultImpl()) {
_aidl_status = IMosisListener::getDefaultImpl()->onFrameAvailable();
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
// Source for BnMosisListener
BnMosisListener::BnMosisListener() {}
BnMosisListener::~BnMosisListener() {}
::ndk::SpAIBinder BnMosisListener::createBinder() {
AIBinder* binder = AIBinder_new(_g_aidl_com_omixlab_mosis_IMosisListener_clazz, static_cast<void*>(this));
#ifdef BINDER_STABILITY_SUPPORT
AIBinder_markCompilationUnitStability(binder);
#endif // BINDER_STABILITY_SUPPORT
return ::ndk::SpAIBinder(binder);
}
// Source for IMosisListener
const char* IMosisListener::descriptor = "com.omixlab.mosis.IMosisListener";
IMosisListener::IMosisListener() {}
IMosisListener::~IMosisListener() {}
std::shared_ptr<IMosisListener> IMosisListener::fromBinder(const ::ndk::SpAIBinder& binder) {
if (!AIBinder_associateClass(binder.get(), _g_aidl_com_omixlab_mosis_IMosisListener_clazz)) {
#if __ANDROID_API__ >= 31
const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
if (originalClass == nullptr) return nullptr;
if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
return ::ndk::SharedRefBase::make<BpMosisListener>(binder);
}
#endif
return nullptr;
}
std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
if (interface) {
return std::static_pointer_cast<IMosisListener>(interface);
}
return ::ndk::SharedRefBase::make<BpMosisListener>(binder);
}
binder_status_t IMosisListener::writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisListener>& instance) {
return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
}
binder_status_t IMosisListener::readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisListener>* instance) {
::ndk::SpAIBinder binder;
binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
if (status != STATUS_OK) return status;
*instance = IMosisListener::fromBinder(binder);
return STATUS_OK;
}
bool IMosisListener::setDefaultImpl(const std::shared_ptr<IMosisListener>& impl) {
// Only one user of this interface can use this function
// at a time. This is a heuristic to detect if two different
// users in the same process use this function.
assert(!IMosisListener::default_impl);
if (impl) {
IMosisListener::default_impl = impl;
return true;
}
return false;
}
const std::shared_ptr<IMosisListener>& IMosisListener::getDefaultImpl() {
return IMosisListener::default_impl;
}
std::shared_ptr<IMosisListener> IMosisListener::default_impl = nullptr;
::ndk::ScopedAStatus IMosisListenerDefault::onServiceInitialized(bool /*in_success*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IMosisListenerDefault::onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& /*in_buffer*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IMosisListenerDefault::onFrameAvailable() {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::SpAIBinder IMosisListenerDefault::asBinder() {
return ::ndk::SpAIBinder();
}
bool IMosisListenerDefault::isRemote() {
return false;
}
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -1,227 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Using: /Users/omar/Library/Android/sdk/build-tools/36.1.0/aidl --lang=ndk --min_sdk_version=36 -o src/main/cpp -h src/main/cpp -I src/main/aidl src/main/aidl/com/omixlab/mosis/IMosisService.aidl
*
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
*/
#include "aidl/com/omixlab/mosis/IMosisService.h"
#include <cstdint>
#include <android/binder_parcel.h>
#include <android/binder_parcel_utils.h>
#include <android/binder_status.h>
#include <aidl/com/omixlab/mosis/BnMosisListener.h>
#include <aidl/com/omixlab/mosis/BnMosisService.h>
#include <aidl/com/omixlab/mosis/BpMosisListener.h>
#include <aidl/com/omixlab/mosis/BpMosisService.h>
#include <aidl/com/omixlab/mosis/IMosisListener.h>
namespace aidl {
namespace com {
namespace omixlab {
namespace mosis {
static binder_status_t _aidl_com_omixlab_mosis_IMosisService_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
(void)_aidl_in;
(void)_aidl_out;
binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
std::shared_ptr<BnMosisService> _aidl_impl = std::static_pointer_cast<BnMosisService>(::ndk::ICInterface::asInterface(_aidl_binder));
switch (_aidl_code) {
case (FIRST_CALL_TRANSACTION + 0 /*initOS*/): {
std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener> in_listener;
bool _aidl_return;
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_listener);
if (_aidl_ret_status != STATUS_OK) break;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->initOS(in_listener, &_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
case (FIRST_CALL_TRANSACTION + 1 /*getNumber*/): {
int32_t _aidl_return;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->getNumber(&_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
}
return _aidl_ret_status;
}
static AIBinder_Class* _g_aidl_com_omixlab_mosis_IMosisService_clazz = ::ndk::ICInterface::defineClass(IMosisService::descriptor, _aidl_com_omixlab_mosis_IMosisService_onTransact, nullptr, 0);
BpMosisService::BpMosisService(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
BpMosisService::~BpMosisService() {}
::ndk::ScopedAStatus BpMosisService::initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_listener);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinderReference().get(),
(FIRST_CALL_TRANSACTION + 0 /*initOS*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| static_cast<int>(FLAG_PRIVATE_LOCAL)
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisService::getDefaultImpl()) {
_aidl_status = IMosisService::getDefaultImpl()->initOS(in_listener, _aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpMosisService::getNumber(int32_t* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinderReference().get(),
(FIRST_CALL_TRANSACTION + 1 /*getNumber*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| static_cast<int>(FLAG_PRIVATE_LOCAL)
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisService::getDefaultImpl()) {
_aidl_status = IMosisService::getDefaultImpl()->getNumber(_aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
// Source for BnMosisService
BnMosisService::BnMosisService() {}
BnMosisService::~BnMosisService() {}
::ndk::SpAIBinder BnMosisService::createBinder() {
AIBinder* binder = AIBinder_new(_g_aidl_com_omixlab_mosis_IMosisService_clazz, static_cast<void*>(this));
#ifdef BINDER_STABILITY_SUPPORT
AIBinder_markCompilationUnitStability(binder);
#endif // BINDER_STABILITY_SUPPORT
return ::ndk::SpAIBinder(binder);
}
// Source for IMosisService
const char* IMosisService::descriptor = "com.omixlab.mosis.IMosisService";
IMosisService::IMosisService() {}
IMosisService::~IMosisService() {}
std::shared_ptr<IMosisService> IMosisService::fromBinder(const ::ndk::SpAIBinder& binder) {
if (!AIBinder_associateClass(binder.get(), _g_aidl_com_omixlab_mosis_IMosisService_clazz)) {
#if __ANDROID_API__ >= 31
const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
if (originalClass == nullptr) return nullptr;
if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
return ::ndk::SharedRefBase::make<BpMosisService>(binder);
}
#endif
return nullptr;
}
std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
if (interface) {
return std::static_pointer_cast<IMosisService>(interface);
}
return ::ndk::SharedRefBase::make<BpMosisService>(binder);
}
binder_status_t IMosisService::writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisService>& instance) {
return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
}
binder_status_t IMosisService::readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisService>* instance) {
::ndk::SpAIBinder binder;
binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
if (status != STATUS_OK) return status;
*instance = IMosisService::fromBinder(binder);
return STATUS_OK;
}
bool IMosisService::setDefaultImpl(const std::shared_ptr<IMosisService>& impl) {
// Only one user of this interface can use this function
// at a time. This is a heuristic to detect if two different
// users in the same process use this function.
assert(!IMosisService::default_impl);
if (impl) {
IMosisService::default_impl = impl;
return true;
}
return false;
}
const std::shared_ptr<IMosisService>& IMosisService::getDefaultImpl() {
return IMosisService::default_impl;
}
std::shared_ptr<IMosisService> IMosisService::default_impl = nullptr;
::ndk::ScopedAStatus IMosisServiceDefault::initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& /*in_listener*/, bool* /*_aidl_return*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IMosisServiceDefault::getNumber(int32_t* /*_aidl_return*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::SpAIBinder IMosisServiceDefault::asBinder() {
return ::ndk::SpAIBinder();
}
bool IMosisServiceDefault::isRemote() {
return false;
}
} // namespace mosis
} // namespace omixlab
} // namespace com
} // namespace aidl

View File

@@ -94,7 +94,7 @@ void Kernel::main_loop()
return; return;
} }
m_render_target = std::make_unique<RenderTarget>(); m_render_target = std::make_unique<RenderTarget>();
if (!m_render_target->create_exported(1024, 1024)) if (!m_render_target->create_exported(540, 960))
{ {
Logger::Log("failed to create render target"); Logger::Log("failed to create render target");
return; return;
@@ -117,7 +117,7 @@ void Kernel::main_loop()
Rml::SetFileInterface(&AssetFilesInterface::Instance()); Rml::SetFileInterface(&AssetFilesInterface::Instance());
Rml::SetSystemInterface(&SystemInterface::Instance()); Rml::SetSystemInterface(&SystemInterface::Instance());
Rml::Initialise(); Rml::Initialise();
Rml::Context* context = Rml::CreateContext("default", Rml::Vector2i(1024, 1024)); Rml::Context* context = Rml::CreateContext("default", Rml::Vector2i(540, 960));
if (!context) if (!context)
{ {
Logger::Log("RMLUI failed to create a context"); Logger::Log("RMLUI failed to create a context");
@@ -126,6 +126,7 @@ void Kernel::main_loop()
} }
Rml::LoadFontFace("Roboto/static/Roboto_Condensed-Regular.ttf"); Rml::LoadFontFace("Roboto/static/Roboto_Condensed-Regular.ttf");
Rml::LoadFontFace("LatoLatin-Regular.ttf"); Rml::LoadFontFace("LatoLatin-Regular.ttf");
Rml::LoadFontFace("NotoEmoji-Regular.ttf", true);
// Now we are ready to load our document. // Now we are ready to load our document.
Rml::ElementDocument* document = context->LoadDocument("demo.rml"); Rml::ElementDocument* document = context->LoadDocument("demo.rml");
@@ -133,15 +134,21 @@ void Kernel::main_loop()
while (true) while (true)
{ {
static float angle = 0.0f; if (!m_tasks.empty())
angle += 0.1f; {
std::lock_guard _lock(m_mutex);
for (const auto &task: m_tasks)
task(context);
m_tasks.clear();
}
m_render_target->bind(); m_render_target->bind();
glClearColor(fabs(sin(angle)), 0.0f, 0.0f, 1.0f); glClearColor(0.f, 0.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, 1024, 1024); glViewport(0, 0, 540, 960);
context->Update(); context->Update();
rmlui_render_interface.SetViewport(1024, 1024); rmlui_render_interface.SetViewport(540, 960);
rmlui_render_interface.BeginFrame(); rmlui_render_interface.BeginFrame();
context->Render(); context->Render();
rmlui_render_interface.EndFrame(m_render_target->framebuffer()); rmlui_render_interface.EndFrame(m_render_target->framebuffer());
@@ -171,4 +178,23 @@ void Kernel::add_listener(const std::shared_ptr<IMosisListener> &listener)
listener->onBufferAvailable(*m_aidl_buffer); listener->onBufferAvailable(*m_aidl_buffer);
} }
void Kernel::on_touch_down(float x, float y)
{
Logger::Log(std::format("on_touch_down {} - {}", x, y));
}
void Kernel::on_touch_move(float x, float y)
{
Logger::Log(std::format("on_touch_move {} - {}", x, y));
std::lock_guard _lock(m_mutex);
m_tasks.emplace_back([x, y](Rml::Context* context){
context->ProcessMouseMove(x * 540, y * 960, 0);
});
}
void Kernel::on_touch_up(float x, float y)
{
Logger::Log(std::format("on_touch_up {} - {}", x, y));
}
Kernel::~Kernel() = default; Kernel::~Kernel() = default;

View File

@@ -3,11 +3,14 @@
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include <thread> #include <thread>
#include <vector>
#include <functional>
class RenderTarget; class RenderTarget;
namespace egl { class Context; } namespace egl { class Context; }
namespace aidl::com::omixlab::mosis { class IMosisListener; } namespace aidl::com::omixlab::mosis { class IMosisListener; }
namespace aidl::android::hardware { struct HardwareBuffer; } namespace aidl::android::hardware { struct HardwareBuffer; }
namespace Rml { class Context; }
class Kernel class Kernel
{ {
@@ -15,6 +18,7 @@ class Kernel
std::unique_ptr<RenderTarget> m_render_target; std::unique_ptr<RenderTarget> m_render_target;
std::unordered_map<pid_t, std::shared_ptr<aidl::com::omixlab::mosis::IMosisListener>> m_listeners; std::unordered_map<pid_t, std::shared_ptr<aidl::com::omixlab::mosis::IMosisListener>> m_listeners;
std::unique_ptr<aidl::android::hardware::HardwareBuffer> m_aidl_buffer; std::unique_ptr<aidl::android::hardware::HardwareBuffer> m_aidl_buffer;
std::vector<std::function<void(Rml::Context*)>> m_tasks;
std::mutex m_mutex; std::mutex m_mutex;
std::thread m_main_loop_thread; std::thread m_main_loop_thread;
void main_loop(); void main_loop();
@@ -22,4 +26,7 @@ public:
explicit Kernel(const std::shared_ptr<aidl::com::omixlab::mosis::IMosisListener>& listener); explicit Kernel(const std::shared_ptr<aidl::com::omixlab::mosis::IMosisListener>& listener);
virtual ~Kernel(); virtual ~Kernel();
void add_listener(const std::shared_ptr<aidl::com::omixlab::mosis::IMosisListener>& listener); void add_listener(const std::shared_ptr<aidl::com::omixlab::mosis::IMosisListener>& listener);
void on_touch_down(float x, float y);
void on_touch_move(float x, float y);
void on_touch_up(float x, float y);
}; };

View File

@@ -31,11 +31,6 @@ class NativeService : public BnMosisService
std::unique_ptr<Kernel> m_kernel; std::unique_ptr<Kernel> m_kernel;
public: public:
NativeService() = default; NativeService() = default;
ndk::ScopedAStatus getNumber(int32_t *_aidl_return) override
{
*_aidl_return = 100;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus initOS(const std::shared_ptr<IMosisListener>& listener, ndk::ScopedAStatus initOS(const std::shared_ptr<IMosisListener>& listener,
bool *_aidl_return) override bool *_aidl_return) override
{ {
@@ -51,6 +46,27 @@ public:
} }
return ndk::ScopedAStatus::ok(); return ndk::ScopedAStatus::ok();
} }
ndk::ScopedAStatus onTouchDown(float in_x, float in_y) override
{
if (m_kernel)
m_kernel->on_touch_down(in_x, in_y);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus onTouchMove(float in_x, float in_y) override
{
if (m_kernel)
m_kernel->on_touch_move(in_x, in_y);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus onTouchUp(float in_x, float in_y) override
{
if (m_kernel)
m_kernel->on_touch_up(in_x, in_y);
return ndk::ScopedAStatus::ok();
}
}; };
extern "C" extern "C"

View File

@@ -1,5 +1,6 @@
package com.omixlab.mosis package com.omixlab.mosis
import android.annotation.SuppressLint
import android.content.ComponentName import android.content.ComponentName
import android.content.Intent import android.content.Intent
import android.content.ServiceConnection import android.content.ServiceConnection
@@ -7,6 +8,7 @@ import android.content.res.AssetManager
import android.os.Bundle import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import android.util.Log import android.util.Log
import android.view.MotionEvent
import android.view.Surface import android.view.Surface
import android.view.SurfaceView import android.view.SurfaceView
import android.view.SurfaceHolder import android.view.SurfaceHolder
@@ -36,7 +38,6 @@ class MainActivity : ComponentActivity() {
Log.d("MosisTest", "Service Connected") Log.d("MosisTest", "Service Connected")
statusText.value = "Service Connected" statusText.value = "Service Connected"
remote_service = IMosisService.Stub.asInterface(service) remote_service = IMosisService.Stub.asInterface(service)
Log.d("MosisTest", "Number: ${remote_service?.number}")
serviceConnected(service) serviceConnected(service)
} }
@@ -94,11 +95,13 @@ class MainActivity : ComponentActivity() {
} }
Text(statusText.value) Text(statusText.value)
NativeViewport( NativeViewport(
modifier = Modifier.fillMaxSize(0.8f) modifier = Modifier
.fillMaxSize(0.8f)
) )
} }
} }
} }
@SuppressLint("ClickableViewAccessibility")
@Composable @Composable
fun NativeViewport(modifier: Modifier = Modifier) { fun NativeViewport(modifier: Modifier = Modifier) {
AndroidView( AndroidView(
@@ -106,6 +109,26 @@ class MainActivity : ComponentActivity() {
factory = { context -> factory = { context ->
SurfaceView(context).apply { SurfaceView(context).apply {
holder.addCallback(viewport) holder.addCallback(viewport)
setOnTouchListener { v, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
Log.d("ServiceTester", "ACTION_DOWN ${event.x} - ${event.y}")
remote_service?.onTouchDown(event.x /v.width, event.y / v.height)
true
}
MotionEvent.ACTION_MOVE -> {
Log.d("ServiceTester", "ACTION_MOVE ${event.x} - ${event.y}")
remote_service?.onTouchMove(event.x /v.width, event.y / v.height)
true
}
MotionEvent.ACTION_UP -> {
Log.d("ServiceTester", "ACTION_ ${event.x} - ${event.y}")
remote_service?.onTouchUp(event.x /v.width, event.y / v.height)
true
}
else -> false
}
}
} }
} }
) )