mirror of
https://github.com/flutter/samples.git
synced 2026-06-25 07:38:26 +00:00
[experimental/pedometer] Update jni and jnigen to 0.6 (#2006)
This commit is contained in:
@@ -44,7 +44,7 @@ dependencies:
|
||||
cupertino_icons: ^1.0.2
|
||||
ffi: ^2.0.1
|
||||
intl: ^0.18.0
|
||||
jni: ^0.5.0
|
||||
jni: ^0.6.1
|
||||
fl_chart: ^0.63.0
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
@@ -3,8 +3,6 @@ android_sdk_config:
|
||||
add_gradle_sources: true
|
||||
android_example: 'example/'
|
||||
|
||||
suspend_fun_to_async: true
|
||||
|
||||
output:
|
||||
c:
|
||||
library_name: health_connect
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,12 +11,12 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
plugin_platform_interface: ^2.0.2
|
||||
jni: ^0.5.0
|
||||
jni: ^0.6.1
|
||||
ffi: ^2.0.1
|
||||
|
||||
dev_dependencies:
|
||||
ffigen: ^9.0.0
|
||||
jnigen: ^0.5.0
|
||||
jnigen: ^0.6.0
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
typedef CRITICAL_SECTION MutexLock;
|
||||
typedef CONDITION_VARIABLE ConditionVariable;
|
||||
|
||||
static inline void init_lock(MutexLock* lock) {
|
||||
InitializeCriticalSection(lock);
|
||||
@@ -58,15 +59,32 @@ static inline void release_lock(MutexLock* lock) {
|
||||
LeaveCriticalSection(lock);
|
||||
}
|
||||
|
||||
static inline void _destroyLock(MutexLock* lock) {
|
||||
static inline void destroy_lock(MutexLock* lock) {
|
||||
DeleteCriticalSection(lock);
|
||||
}
|
||||
|
||||
#elif defined __DARWIN__ || defined __LINUX__ || defined __ANDROID__ || \
|
||||
static inline void init_cond(ConditionVariable* cond) {
|
||||
InitializeConditionVariable(cond);
|
||||
}
|
||||
|
||||
static inline void signal_cond(ConditionVariable* cond) {
|
||||
WakeConditionVariable(cond);
|
||||
}
|
||||
|
||||
static inline void wait_for(ConditionVariable* cond, MutexLock* lock) {
|
||||
SleepConditionVariableCS(cond, lock, INFINITE);
|
||||
}
|
||||
|
||||
static inline void destroy_cond(ConditionVariable* cond) {
|
||||
// Not available.
|
||||
}
|
||||
|
||||
#elif defined __APPLE__ || defined __LINUX__ || defined __ANDROID__ || \
|
||||
defined __GNUC__
|
||||
#include <pthread.h>
|
||||
|
||||
typedef pthread_mutex_t MutexLock;
|
||||
typedef pthread_cond_t ConditionVariable;
|
||||
|
||||
static inline void init_lock(MutexLock* lock) {
|
||||
pthread_mutex_init(lock, NULL);
|
||||
@@ -80,16 +98,39 @@ static inline void release_lock(MutexLock* lock) {
|
||||
pthread_mutex_unlock(lock);
|
||||
}
|
||||
|
||||
static inline void _destroyLock(MutexLock* lock) {
|
||||
static inline void destroy_lock(MutexLock* lock) {
|
||||
pthread_mutex_destroy(lock);
|
||||
}
|
||||
|
||||
static inline void init_cond(ConditionVariable* cond) {
|
||||
pthread_cond_init(cond, NULL);
|
||||
}
|
||||
|
||||
static inline void signal_cond(ConditionVariable* cond) {
|
||||
pthread_cond_signal(cond);
|
||||
}
|
||||
|
||||
static inline void wait_for(ConditionVariable* cond, MutexLock* lock) {
|
||||
pthread_cond_wait(cond, lock);
|
||||
}
|
||||
|
||||
static inline void destroy_cond(ConditionVariable* cond) {
|
||||
pthread_cond_destroy(cond);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error "No locking support; Possibly unsupported platform"
|
||||
#error "No locking/condition variable support; Possibly unsupported platform"
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct CallbackResult {
|
||||
MutexLock lock;
|
||||
ConditionVariable cond;
|
||||
int ready;
|
||||
jobject object;
|
||||
} CallbackResult;
|
||||
|
||||
typedef struct JniLocks {
|
||||
MutexLock classLoadingLock;
|
||||
MutexLock methodLoadingLock;
|
||||
@@ -369,10 +410,15 @@ static inline JniResult to_global_ref_result(jobject ref) {
|
||||
|
||||
FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data);
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_github_dart_1lang_jni_PortContinuation__1resumeWith(JNIEnv* env,
|
||||
jobject thiz,
|
||||
jlong port,
|
||||
jobject result);
|
||||
FFI_PLUGIN_EXPORT
|
||||
JniResult DartException__ctor(jstring message);
|
||||
|
||||
FFI_PLUGIN_EXPORT
|
||||
JniResult PortContinuation__ctor(int64_t j);
|
||||
|
||||
FFI_PLUGIN_EXPORT
|
||||
JniResult PortProxy__newInstance(jobject binaryName,
|
||||
int64_t port,
|
||||
int64_t functionPtr);
|
||||
|
||||
FFI_PLUGIN_EXPORT void resultFor(CallbackResult* result, jobject object);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user