This commit is contained in:
2025-12-28 10:54:06 +01:00
commit de82e50bd5
48 changed files with 2511 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#include <jni.h>
#include <android/binder_ibinder_jni.h>
#include <aidl/com/omixlab/mosis/BnMosisService.h>
using namespace aidl::com::omixlab::mosis;
class NativeService : public BnMosisService {
public:
ndk::ScopedAStatus getNumber(int32_t *_aidl_return) override {
*_aidl_return = 100;
return ndk::ScopedAStatus::ok();
}
};
static std::shared_ptr<NativeService> g_service;
extern "C"
JNIEXPORT jobject JNICALL
Java_com_omixlab_mosis_NativeService_getBinderNative(JNIEnv *env, jobject thiz) {
if (!g_service)
{
g_service = ndk::SharedRefBase::make<NativeService>();
}
return AIBinder_toJavaBinder(env, g_service->asBinder().get());
}