From: snickersun Date: Sun, 16 Aug 2020 15:20:39 +0000 (+0800) Subject: 1、重新配置编译环境,与icprotocol 一致 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.js?a=commitdiff_plain;h=f3f9fbfba48602e49aea17cd55fa4293894c46c0;p=factoryMode.git 1、重新配置编译环境,与icprotocol 一致 2、修复 温度校准 到负数仍然计时的问题。 --- diff --git a/app/build.gradle b/app/build.gradle index 084e71d..11fdce8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,9 +87,8 @@ android { } dependencies { -// implementation 'com.android.support:support-v4:20.0.0' - // compileOnly files('libs/framework.jar') - compileOnly files('libs/framework.jar') + compileOnly files ('libs/frameworks-full-debug.jar') + provided files ('libs/telephony_common-full-debug.jar') implementation 'com.squareup.okhttp3:okhttp:3.4.1' implementation 'io.reactivex:rxandroid:1.2.1' implementation 'com.liulishuo.filedownloader:library:1.6.3' diff --git a/app/libs/frameworks-full-debug.jar b/app/libs/frameworks-full-debug.jar new file mode 100644 index 0000000..8b3dde7 Binary files /dev/null and b/app/libs/frameworks-full-debug.jar differ diff --git a/app/libs/telephony_common-full-debug.jar b/app/libs/telephony_common-full-debug.jar new file mode 100644 index 0000000..e6a112c Binary files /dev/null and b/app/libs/telephony_common-full-debug.jar differ diff --git a/app/src/main/java/mobile/miki/TemperatureAdjustActivity.java b/app/src/main/java/mobile/miki/TemperatureAdjustActivity.java index 0a01d0c..cb1f75c 100644 --- a/app/src/main/java/mobile/miki/TemperatureAdjustActivity.java +++ b/app/src/main/java/mobile/miki/TemperatureAdjustActivity.java @@ -30,8 +30,7 @@ import mobile.miki.mainui.TestMainActivity; import mobile.miki.mainui.TestMainList; import mobile.miki.util.Config; import mobile.miki.util.Logger; -import rx.Observable; -import rx.functions.Action1; + import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP; import static android.os.PowerManager.SCREEN_DIM_WAKE_LOCK; @@ -143,7 +142,7 @@ public class TemperatureAdjustActivity extends Activity implements View.OnClickL String tail = "秒。。。"; long time_cost = (System.currentTimeMillis() - timestamp_start) / 1000; adjust_start_seconds_left = (adjust_timeout_time - time_cost); - if (adjust_start_seconds_left == 0) { + if (adjust_start_seconds_left <= 0) { int ret= ICJniUtils.doTempCalibration(37.0f); tv_mesg.setText("体温校准完毕,偏差数据"+String.format("%1$.2f",(avg_temp-37.0f))+"摄氏度!ret "+ret); diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk deleted file mode 100644 index 6edf3e1..0000000 --- a/app/src/main/jni/Android.mk +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2011 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) -LOCAL_SRC_FILES := dbmd4_test_jni.cpp -LOCAL_CERTIFICATE := platform - -LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) -LOCAL_SHARED_LIBRARIES := liblog libandroid_runtime libtinyalsa libcutils -LOCAL_PRELINK_MODULE := false - -LOCAL_MODULE := libdbmd4_test_jni -include $(BUILD_SHARED_LIBRARY) - diff --git a/app/src/main/jni/Application.mk b/app/src/main/jni/Application.mk deleted file mode 100644 index 1678532..0000000 --- a/app/src/main/jni/Application.mk +++ /dev/null @@ -1,3 +0,0 @@ -#APP_ABI := armeabi armeabi-v7a arm64-v8a -#APP_ABI := armeabi arm64-v8a -APP_ABI := armeabi armeabi-v7a arm64-v8a \ No newline at end of file diff --git a/app/src/main/jni/dbmd4_test_jni.cpp b/app/src/main/jni/dbmd4_test_jni.cpp deleted file mode 100644 index 331c60d..0000000 --- a/app/src/main/jni/dbmd4_test_jni.cpp +++ /dev/null @@ -1,182 +0,0 @@ - - -#include -#include -#include -#include -#include -#include -#include - -using namespace android; - -static const char *classPathName = "mobile/miki/DSPActivity"; - -static jint dbmd4_open(JNIEnv *env, jobject thiz,jint card ,jint device,jint channels,jint bits,jint rate){ - - struct pcm_config config; - enum pcm_format format; - struct pcm *pcm = NULL; - - ALOGE("dbmd4_open card=%d device=%d channels=%d bits=%d rate=%d\n",card,device,channels,bits,rate); - memset(&config,0,sizeof(config)); - switch (bits) { - case 32: - format = PCM_FORMAT_S32_LE; - break; - case 24: - format = PCM_FORMAT_S24_LE; - break; - case 16: - format = PCM_FORMAT_S16_LE; - break; - default: - ALOGE("%d bits is not supported.\n", bits); - return 0; - } - - config.channels = channels;//2 - config.format = format;//16 - config.rate = rate;//16000 - config.period_size = 1024;//default - config.period_count = 4; //default - config.start_threshold = 0; - config.stop_threshold = 0; - config.silence_threshold = 0; - - pcm = pcm_open(card, device, PCM_IN, &config); - if (!pcm || !pcm_is_ready(pcm)) { - ALOGE("Unable to open PCM device\n"); - return 0; - } - - return (int)pcm; -} - -static jint dbmd4_get_buffersize(JNIEnv *env, jobject thiz,jint dbmd4_handle){ - int buffersize; - struct pcm *pcm = (struct pcm *)dbmd4_handle; - - buffersize = pcm_frames_to_bytes(pcm, pcm_get_buffer_size(pcm)); - ALOGE("dbmd4_get_buffersize buffersize=%d\n",buffersize); - return buffersize; -} - -static jint dbmd4_read_buffer(JNIEnv *env, jobject thiz,jint dbmd4_handle,jbyteArray buffer, jint length){ - - int ret; - struct pcm *pcm = (struct pcm *)dbmd4_handle; - jbyte* buf = (jbyte *)malloc(length); - ALOGE("dbmd4_read_buffer buffer length=%d\n",length); - if(!buf){ - ALOGE("dbmd4_read_buffer alloc buf failed\n"); - return 0; - } - memset(buf,0,length); - ret = pcm_read(pcm, buf, length); - if(!ret){ - ALOGE("dbmd4_read_buffer read pcm data failed\n"); - free(buf); - return 0; - } - env->SetByteArrayRegion(buffer, 0, length, buf); - free(buf); - return length; - -} - -static void dbmd4_close(JNIEnv *env, jobject thiz,jint dbmd4_handle){ - ALOGE("dbmd4_close\n"); - pcm_close((struct pcm *)dbmd4_handle); -} - -static JNINativeMethod methods[] = -{ - {"dbmd4_open", "(IIIII)I", (void*)dbmd4_open }, - {"dbmd4_get_buffersize", "(I)I", (void*)dbmd4_get_buffersize}, - {"dbmd4_read_buffer", "(I[BI)I", (void*)dbmd4_read_buffer }, - {"dbmd4_close", "(I)V", (void*)dbmd4_close }, - -}; - -/* - * Register several native methods for one class. - */ -static int registerNativeMethods(JNIEnv* env, const char* className, - JNINativeMethod* gMethods, int numMethods) -{ - jclass clazz; - - clazz = env->FindClass(className); - if (clazz == NULL) - { - //LOGE("Native registration unable to find class '%s'", className); - return JNI_FALSE; - } - if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) - { - //LOGE("RegisterNatives failed for '%s'", className); - return JNI_FALSE; - } - - return JNI_TRUE; -} - -/* - * Register native methods for all classes we know about. - * - * returns JNI_TRUE on success. - */ -static int registerNatives(JNIEnv* env) -{ - if (!registerNativeMethods(env, classPathName, - methods, sizeof(methods) / sizeof(methods[0]))) - { - return JNI_FALSE; - } - - return JNI_TRUE; -} - - -// ---------------------------------------------------------------------------- - -/* - * This is called by the VM when the shared library is first loaded. - */ - -typedef union -{ - JNIEnv* env; - void* venv; -} UnionJNIEnvToVoid; - -jint JNI_OnLoad(JavaVM* vm, void* reserved) -{ - UnionJNIEnvToVoid uenv; - uenv.venv = NULL; - jint result = -1; - JNIEnv* env = NULL; - - //LOGI("JNI_OnLoad"); - - if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) - { - //LOGE("ERROR: GetEnv failed"); - goto bail; - } - env = uenv.env; - - if (registerNatives(env) != JNI_TRUE) - { - //LOGE("ERROR: registerNatives failed"); - goto bail; - } - - result = JNI_VERSION_1_4; - -bail: - return result; -} - - diff --git a/app/src/main/jni/heartrate.cpp b/app/src/main/jni/heartrate.cpp deleted file mode 100644 index 7f8e2a0..0000000 --- a/app/src/main/jni/heartrate.cpp +++ /dev/null @@ -1,140 +0,0 @@ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace android; - -#define HEARTRATE_DEVICE_NAME "/sys/class/input/input2/heartrate"//"/dev/heartrate" - - -#define DEV_LOG_TAG "heartrate" -#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,DEV_LOG_TAG,__VA_ARGS__) - -#define HRS3300_IOCTL_BASE 87 //0x1D -#define HRS3300_IOCTL_GET_HEART_VALUE _IO(HRS3300_IOCTL_BASE,5) - -static const char *classPathName = "mobile/miki/HeartRate"; - - -static jint get_heartrate(JNIEnv *env, jobject thiz) -{ - int fd = -1; - int ret = -1; - int heartrate = -1; - - LOGW("[open_heartrate]."); - fd = open(HEARTRATE_DEVICE_NAME, O_RDONLY); - if(fd < 0) - { - LOGW("Failed to open device: heart rate."); - return -1; - } - -/* if (ioctl(fd, HRS3300_IOCTL_GET_HEART_VALUE,&heartrate) < 0) - { - LOGW("get heartrate failed."); - } else { - LOGW("get heartrate successed."); - }*/ - close(fd); - return 80; - return heartrate; - -} - - - -static JNINativeMethod methods[] = -{ - {"get_heartrate", "()I", (void*)get_heartrate }, - -}; -/* - * Register several native methods for one class. - */ -static int registerNativeMethods(JNIEnv* env, const char* className, - JNINativeMethod* gMethods, int numMethods) -{ - jclass clazz; - - clazz = env->FindClass(className); - if (clazz == NULL) - { - //LOGE("Native registration unable to find class '%s'", className); - return JNI_FALSE; - } - if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) - { - //LOGE("RegisterNatives failed for '%s'", className); - return JNI_FALSE; - } - - return JNI_TRUE; -} - -/* - * Register native methods for all classes we know about. - * - * returns JNI_TRUE on success. - */ -static int registerNatives(JNIEnv* env) -{ - if (!registerNativeMethods(env, classPathName, - methods, sizeof(methods) / sizeof(methods[0]))) - { - return JNI_FALSE; - } - - return JNI_TRUE; -} - - -// ---------------------------------------------------------------------------- - -/* - * This is called by the VM when the shared library is first loaded. - */ - -typedef union -{ - JNIEnv* env; - void* venv; -} UnionJNIEnvToVoid; - -jint JNI_OnLoad(JavaVM* vm, void* reserved) -{ - UnionJNIEnvToVoid uenv; - uenv.venv = NULL; - jint result = -1; - JNIEnv* env = NULL; - - //LOGI("JNI_OnLoad"); - - if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) - { - //LOGE("ERROR: GetEnv failed"); - goto bail; - } - env = uenv.env; - - if (registerNatives(env) != JNI_TRUE) - { - //LOGE("ERROR: registerNatives failed"); - goto bail; - } - - result = JNI_VERSION_1_4; - -bail: - return result; -} - - diff --git a/build.gradle b/build.gradle index 232f30a..35c4663 100644 --- a/build.gradle +++ b/build.gradle @@ -1,24 +1,39 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. + buildscript { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'me.tatarka:gradle-retrolambda:3.2.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files } } allprojects { repositories { jcenter() - google() + maven { url 'https://jitpack.io' } + maven { + url 'https://maven.google.com/' + name 'Google' + } } - gradle.projectsEvaluated { tasks.withType(JavaCompile) { - options.compilerArgs.add('-Xbootclasspath/p:app\\libs\\framework.jar') + options.compilerArgs.add('-Xbootclasspath/p:app\\libs\\frameworks-full-debug.jar') } } +} +task clean(type: Delete) { + delete rootProject.buildDir } diff --git a/factorymode.iml b/factorymode.iml index 6bbc01d..e438926 100644 --- a/factorymode.iml +++ b/factorymode.iml @@ -13,7 +13,7 @@ - + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index efc27cb..cc8c069 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Jan 13 09:12:34 PST 2018 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip +#Sun Aug 16 22:50:44 CST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/watchlibrary/watchlibrary.iml b/watchlibrary/watchlibrary.iml index 36172a0..ff1a55f 100644 --- a/watchlibrary/watchlibrary.iml +++ b/watchlibrary/watchlibrary.iml @@ -7,21 +7,13 @@