From: SnickerSun Date: Sat, 17 Jul 2021 13:32:18 +0000 (+0800) Subject: release V116 X-Git-Url: http://git.snicker.com.cn/sitemap.xml?a=commitdiff_plain;h=7ea6d19057b2194184614d7a54834e2d994b3d04;p=factoryMode.git release V116 修复8.1下libatci 访问权限问题,保证系统不报错的前提下,工厂测试也能测试RF校准信息。 --- diff --git a/app/build.gradle b/app/build.gradle index a1f6fe9..f235d33 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,7 +33,7 @@ android { key { storeFile file("EQC_G5.jks") storePassword "123456" - keyAlias "android" + keyAlias "watch_g5" keyPassword "123456" } } @@ -52,6 +52,12 @@ android { targetSdkVersion 19 versionCode currentVersionCode versionName "${currentVersionName}" + + externalNativeBuild { + cmake { + cppFlags "" + } + } } buildTypes { release { @@ -84,6 +90,14 @@ android { sourceCompatibility = 1.7 targetCompatibility = 1.7 } + +// externalNativeBuild { +// cmake { +// path "src/main/jni/CMakeLists.txt" +// version "3.10.2" +// } +// } + ndkVersion '20.1.5948944' sourceSets.main { jniLibs.srcDir 'src/main/libs' diff --git a/app/release/FactoryMode_V115_202107151603_release.apk b/app/release/FactoryMode_V116_202107172129_release.apk similarity index 92% rename from app/release/FactoryMode_V115_202107151603_release.apk rename to app/release/FactoryMode_V116_202107172129_release.apk index 93a7aad..0ba2919 100644 Binary files a/app/release/FactoryMode_V115_202107151603_release.apk and b/app/release/FactoryMode_V116_202107172129_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index f1c3552..f36a3a4 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":115,"versionName":"202107151603","enabled":true,"outputFile":"FactoryMode_V115_202107151603_release.apk","fullName":"release","baseName":"release"},"path":"FactoryMode_V115_202107151603_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":116,"versionName":"202107172129","enabled":true,"outputFile":"FactoryMode_V116_202107172129_release.apk","fullName":"release","baseName":"release"},"path":"FactoryMode_V116_202107172129_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/mobile/miki/util/FTUtils.java b/app/src/main/java/mobile/miki/util/FTUtils.java index 61eae3d..c3ef4c0 100644 --- a/app/src/main/java/mobile/miki/util/FTUtils.java +++ b/app/src/main/java/mobile/miki/util/FTUtils.java @@ -231,7 +231,10 @@ public class FTUtils { // } return false; } - + public static boolean isSL8541E(){ + String tmp=SystemProperties.get("ro.product.board", ""); + return tmp.contains("8541"); + } public static boolean isA9(){ if(SystemProperties.get("persist.sys.id_num","").equalsIgnoreCase("A9") || SystemProperties.get("persist.sys.customname","").equalsIgnoreCase("YQ")) { diff --git a/app/src/main/java/mobile/miki/util/IATUtils.java b/app/src/main/java/mobile/miki/util/IATUtils.java index 0715430..4ceff6e 100644 --- a/app/src/main/java/mobile/miki/util/IATUtils.java +++ b/app/src/main/java/mobile/miki/util/IATUtils.java @@ -21,51 +21,52 @@ public class IATUtils { public static String sendATCmd(String cmd, String serverName) { - strTmp = "error service can't get"; - try { + if (!FTUtils.isSL8541E()) { + try { // mPhoneCount = TelephonyManager.getPhoneCount(); - if (mPhoneCount == 1) { - serverName = "atchannel"; - } - - mAtChannel = IAtChannel.Stub.asInterface(ServiceManager - .getService(serverName)); - if(serverName.contains("atchannel0")){ - Log.v(TAG, "<0> mAtChannel = " + mAtChannel + " , and cmd = " + cmd); - }else if(serverName.contains("atchannel1")){ - Log.v(TAG, "<1> mAtChannel = " + mAtChannel + " , and cmd = " + cmd); - }else{ - Log.v(TAG, " mAtChannel = " + mAtChannel + " , and cmd = " + cmd); - } - if (mAtChannel == null) { - //ATChannel 失败则走libatci 通路 - Log.d(TAG, "error atchannel=null"); - - } else { - strTmp = mAtChannel.sendAt(cmd); - if(serverName.contains("atchannel0")){ - Log.d(TAG, "<0> AT response " + strTmp); - }else if(serverName.contains("atchannel1")){ - Log.d(TAG, "<1> AT response " + strTmp); - }else{ - Log.d(TAG, " AT response " + strTmp); + if (mPhoneCount == 1) { + serverName = "atchannel"; + } + mAtChannel = IAtChannel.Stub.asInterface(ServiceManager + .getService(serverName)); + if (serverName.contains("atchannel0")) { + Log.v(TAG, "<0> mAtChannel = " + mAtChannel + " , and cmd = " + cmd); + } else if (serverName.contains("atchannel1")) { + Log.v(TAG, "<1> mAtChannel = " + mAtChannel + " , and cmd = " + cmd); + } else { + Log.v(TAG, " mAtChannel = " + mAtChannel + " , and cmd = " + cmd); + } + if (mAtChannel == null) { + //ATChannel 失败则走libatci 通路 + Log.d(TAG, "error atchannel=null"); + + } else { + strTmp = mAtChannel.sendAt(cmd); + if (serverName.contains("atchannel0")) { + Log.d(TAG, "<0> AT response " + strTmp); + } else if (serverName.contains("atchannel1")) { + Log.d(TAG, "<1> AT response " + strTmp); + } else { + Log.d(TAG, " AT response " + strTmp); + } } + return strTmp; + } catch (Exception e) { + e.printStackTrace(); + Log.e(TAG, e.getMessage()); } - return strTmp; - } catch (Exception e) { - e.printStackTrace(); - Log.e(TAG, e.getMessage()); - } + } else { try { String result = sendAtCmd(cmd); return result; - }catch (Exception se){ - Log.d("AT Exception",se.toString()); - strTmp+=" 8541 "; + } catch (Exception se) { + Log.d("AT Exception", se.toString()); + strTmp += " 8541 "; } - return strTmp; + } + return strTmp; } diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk new file mode 100644 index 0000000..3f68e6c --- /dev/null +++ b/app/src/main/jni/Android.mk @@ -0,0 +1,59 @@ +LOCAL_PATH :=$(call my-dir) +include $(CLEAR_VARS) +LOCAL_VENDOR_MODULE = true +LOCAL_MODULE := libICJniUtils +#LOCAL_ALLOW_UNDEFINED_SYMBOLS := true +LOCAL_SRC_FILES := ppg_ecg_hal.c stepcounter_hal.c native-lib.c temperature_hal.c +LOCAL_MODULE_TAGS := optional +LOCAL_SHARED_LIBRARIES := liblog +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers +#LOCAL_CFLAGS := -Werror +include $(BUILD_SHARED_LIBRARY) + + + +#validationtools invoke native methods + +include $(CLEAR_VARS) +LOCAL_VENDOR_MODULE = true +LOCAL_MODULE := libjni_atcmd + +LOCAL_NDK_STL_VARIANT := stlport_static + +LOCAL_C_INCLUDES += vendor/sprd/modules/libatci +#validationtools invoke native lib +LOCAL_SHARED_LIBRARIES := libcutils libutils liblog +LOCAL_SHARED_LIBRARIES += libatci +LOCAL_LDFLAGS := -llog + +LOCAL_CPPFLAGS += $(JNI_CFLAGS) +LOCAL_MULTILIB := both + +LOCAL_SRC_FILES := \ + atcmd.c + +include $(BUILD_SHARED_LIBRARY) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + test.c + +LOCAL_C_INCLUDES := bionic/libc/bionic + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + liblog \ + libc + +LOCAL_VENDOR_MODULE = true +LOCAL_SHARED_LIBRARIES += libICJniUtils +LOCAL_MODULE := sctool + +#$(shell cp -rf $(LOCAL_PATH)/lib/armeabi-v7a/*.so $(TARGET_OUT)/lib/) + +# Including this will define $(intermediates). +# +include $(BUILD_EXECUTABLE) + diff --git a/app/src/main/jni/Applicatioin.mk b/app/src/main/jni/Applicatioin.mk new file mode 100644 index 0000000..527843c --- /dev/null +++ b/app/src/main/jni/Applicatioin.mk @@ -0,0 +1,2 @@ +APP_MODULES := ICJniUtils sctool +APP_ABI := armeabi-v7a \ No newline at end of file diff --git a/app/src/main/jni/CMakeLists.txt b/app/src/main/jni/CMakeLists.txt new file mode 100644 index 0000000..37b430b --- /dev/null +++ b/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,48 @@ +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html + +# Sets the minimum version of CMake required to build the native library. + +cmake_minimum_required(VERSION 3.10.2) + +# Declares and names the project. + +project("demo") + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. + +add_library( # Sets the name of the library. + jni_atcmd + + # Sets the library as a shared library. + SHARED + + # Provides a relative path to your source file(s). + atcmd.c ) + +# Searches for a specified prebuilt library and stores the path as a +# variable. Because CMake includes system libraries in the search path by +# default, you only need to specify the name of the public NDK library +# you want to add. CMake verifies that the library exists before +# completing its build. + +find_library( # Sets the name of the path variable. + log-lib + + # Specifies the name of the NDK library that + # you want CMake to locate. + log ) + +# Specifies libraries CMake should link to your target library. You +# can link multiple libraries, such as libraries you define in this +# build script, prebuilt third-party libraries, or system libraries. + +target_link_libraries( # Specifies the target library. + jni_atcmd + + # Links the target library to the log library + # included in the NDK. + ${log-lib} ) \ No newline at end of file diff --git a/app/src/main/jni/atci.h b/app/src/main/jni/atci.h new file mode 100644 index 0000000..3fd7abd --- /dev/null +++ b/app/src/main/jni/atci.h @@ -0,0 +1,22 @@ +/** + * AT Command Interface Client Socket implementation + * + * Copyright (C) 2015 Spreadtrum Communications Inc. + * + */ + +#ifndef ATCI_H_ +#define ATCI_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +const char* sendCmd(int phoneId, const char* atCmd); +int sendATCmd(int phoneId, const char *atCmd, char *resp, size_t respLen); + +#ifdef __cplusplus +} +#endif + +#endif // ATCI_H_ diff --git a/app/src/main/jni/atcmd.c b/app/src/main/jni/atcmd.c new file mode 100644 index 0000000..92c3441 --- /dev/null +++ b/app/src/main/jni/atcmd.c @@ -0,0 +1,32 @@ +#include +//#include + +#include "com_ic_jni_AtCMD.h" + + +#include "atci.h" + + +#define MAX_COMMAND_BYTES (8 * 1024) + +/* + * Class: com_ic_jni_ICJniUtils + * Method: native_sendATCmd + * Signature: (ILjava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_ic_jni_AtCMD_native_1sendATCmd + (JNIEnv * env, jclass jobj, jint phoneid, jstring cmdstr){ + + char result[MAX_COMMAND_BYTES] = {0}; + const char* atCmd = (*env)->GetStringUTFChars(env,cmdstr,0); + // ALOGD("send AT cmd: %s",atCmd); + int resultValue = sendATCmd(phoneid,atCmd,result,MAX_COMMAND_BYTES); + (*env)->ReleaseStringUTFChars(env,cmdstr, atCmd); + if (resultValue != 0) { + return (*env)->NewStringUTF(env,"ERROR"); + } + // ALOGI("the return value is: %s",result); + return (*env)->NewStringUTF(env,result); + +} + diff --git a/app/src/main/jni/com_ic_jni_ICJniUtils_GSensorType.h b/app/src/main/jni/com_ic_jni_ICJniUtils_GSensorType.h deleted file mode 100644 index 50a5d3b..0000000 --- a/app/src/main/jni/com_ic_jni_ICJniUtils_GSensorType.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class com_ic_jni_ICJniUtils_GSensorType */ - -#ifndef _Included_com_ic_jni_ICJniUtils_GSensorType -#define _Included_com_ic_jni_ICJniUtils_GSensorType -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif diff --git a/app/src/main/jni/com_ic_jni_ICJniUtils_PPG_EGC_SensorType.h b/app/src/main/jni/com_ic_jni_ICJniUtils_PPG_EGC_SensorType.h deleted file mode 100644 index c749232..0000000 --- a/app/src/main/jni/com_ic_jni_ICJniUtils_PPG_EGC_SensorType.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class com_ic_jni_ICJniUtils_PPG_EGC_SensorType */ - -#ifndef _Included_com_ic_jni_ICJniUtils_PPG_EGC_SensorType -#define _Included_com_ic_jni_ICJniUtils_PPG_EGC_SensorType -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif diff --git a/app/src/main/jni/com_ic_jni_ICJniUtils_TempSensorType.h b/app/src/main/jni/com_ic_jni_ICJniUtils_TempSensorType.h deleted file mode 100644 index a26e883..0000000 --- a/app/src/main/jni/com_ic_jni_ICJniUtils_TempSensorType.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class com_ic_jni_ICJniUtils_TempSensorType */ - -#ifndef _Included_com_ic_jni_ICJniUtils_TempSensorType -#define _Included_com_ic_jni_ICJniUtils_TempSensorType -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif diff --git a/app/src/main/jni/header/typedef.h b/app/src/main/jni/header/typedef.h new file mode 100644 index 0000000..b7496d9 --- /dev/null +++ b/app/src/main/jni/header/typedef.h @@ -0,0 +1,71 @@ +#ifndef _TYPE_DEF_H_ +#define _TYPE_DEF_H_ + +#include +#include +#include + +//typedef __int64 Word64; +//typedef unsigned __int64 Word64u; +//typedef long Word32; +//typedef unsigned long Word32u; +//typedef short Word16; +//typedef unsigned short Word16u; +//typedef char Word8; +//typedef unsigned char Word8u; + +typedef unsigned char BYTE; +typedef unsigned char *PBYTE; +typedef unsigned short WORD; +typedef unsigned short *PWORD; +typedef unsigned long DWORD; +typedef unsigned long LWORD; +typedef unsigned long ULONG; + + +//typedef __int64 Word64; +//typedef unsigned __int64 Word64u; +typedef long long int Word64; +typedef unsigned long long int Word64u; + +typedef long Word32; +typedef unsigned long Word32u; +typedef short Word16; +typedef unsigned short Word16u; +typedef char Word8; +typedef unsigned char Word8u; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +#define DIFF(x, y) (((x)>(y))?((x)-(y)):((y)-(x))) +#define ABS(x) ((x<0)?-(x):(x)) +#define MAXA(x,y) ((ABS(x)>ABS(y))?(x):(y)) +#define MIN2(x, y) (((x)<(y))?(x):(y)) +#define MAX2(x, y) (((x)>(y))?(x):(y)) +#define DIFF2(x, y) (((x)-(y))*((x)-(y))) +#define CLIP(x,a,b) (MIN2(MAX2(x,a),b)) +#define Clamp(x, a, b) (((x)<(a))? (a): ((x)>(b))? (b): (x)) + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; +typedef char int8; +typedef short int16; +typedef int int32; + +typedef unsigned char BOOL; + +#ifdef TRUE +#undef TRUE +#endif + +#ifdef FALSE +#undef FALSE +#endif + +#define TRUE 1 +#define FALSE 0 + +#endif diff --git a/app/src/main/jni/jniutils.cpp b/app/src/main/jni/jniutils.cpp new file mode 100644 index 0000000..2476a9f --- /dev/null +++ b/app/src/main/jni/jniutils.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2013 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. + */ + +#define LOG_TAG "validation_jni" +//#include "utils/Log.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +#define ROOT_MAGIC 0x524F4F54 //"ROOT" +#define ROOT_OFFSET 512 +#define MAX_COMMAND_BYTES (8 * 1024) + + +extern "C" { +#include "atci.h" +} + +static jstring Validation_sendATCmd(JNIEnv* env, jobject thiz, jint phoneId, jstring cmd) { + char result[MAX_COMMAND_BYTES] = {0}; + const char* atCmd = env->GetStringUTFChars(cmd,0); + ALOGD("send AT cmd: %s",atCmd); + int resultValue = sendATCmd(phoneId,atCmd,result,MAX_COMMAND_BYTES); + env->ReleaseStringUTFChars(cmd, atCmd); + if (resultValue != 0) { + return env->NewStringUTF("ERROR"); + } + ALOGI("the return value is: %s",result); + return env->NewStringUTF(result); +} + +static const char *hardWareClassPathName = + "com/sprd/validationtools/utils/Native"; + +static JNINativeMethod getMethods[] = { + {"native_sendATCmd","(ILjava/lang/String;)Ljava/lang/String;", (void*) Validation_sendATCmd } +}; + + +static int registerNativeMethods(JNIEnv* env, const char* className, + JNINativeMethod* gMethods, int numMethods) { + jclass clazz; + clazz = env->FindClass(className); + if (clazz == NULL) { + ALOGE("Native registration unable to find class '%s'", className); + return JNI_FALSE; + } + if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) { + ALOGE("RegisterNatives failed for '%s'", className); + return JNI_FALSE; + } + return JNI_TRUE; +} + +jint JNI_OnLoad(JavaVM* vm, void* reserved) { + JNIEnv* env; + //use JNI1.6 + if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) { + ALOGE("Error: GetEnv failed in JNI_OnLoad"); + return -1; + } + if (!registerNativeMethods(env, hardWareClassPathName, getMethods, + sizeof(getMethods) / sizeof(getMethods[0]))) { + ALOGE("Error: could not register native methods for HardwareFragment"); + return -1; + } + return JNI_VERSION_1_6; +} diff --git a/app/src/main/libs/arm64-v8a/android.hardware.radio@1.1.so b/app/src/main/libs/arm64-v8a/android.hardware.radio@1.1.so new file mode 100644 index 0000000..f6a3141 Binary files /dev/null and b/app/src/main/libs/arm64-v8a/android.hardware.radio@1.1.so differ diff --git a/app/src/main/libs/arm64-v8a/libatci.so b/app/src/main/libs/arm64-v8a/libatci.so new file mode 100644 index 0000000..32a3305 Binary files /dev/null and b/app/src/main/libs/arm64-v8a/libatci.so differ diff --git a/app/src/main/libs/armeabi-v7a/android.hardware.radio@1.1.so b/app/src/main/libs/armeabi-v7a/android.hardware.radio@1.1.so new file mode 100644 index 0000000..fafdfe3 Binary files /dev/null and b/app/src/main/libs/armeabi-v7a/android.hardware.radio@1.1.so differ diff --git a/app/src/main/libs/armeabi-v7a/libatci.so b/app/src/main/libs/armeabi-v7a/libatci.so new file mode 100644 index 0000000..7258314 Binary files /dev/null and b/app/src/main/libs/armeabi-v7a/libatci.so differ diff --git a/app/version_code.properties b/app/version_code.properties index c668554..e31fd30 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Thu Jul 15 16:03:45 CST 2021 -VERSION_CODE=115 +#Sat Jul 17 21:29:51 CST 2021 +VERSION_CODE=116