key {\r
storeFile file("EQC_G5.jks")\r
storePassword "123456"\r
- keyAlias "android"\r
+ keyAlias "watch_g5"\r
keyPassword "123456"\r
}\r
}\r
targetSdkVersion 19\r
versionCode currentVersionCode\r
versionName "${currentVersionName}"\r
+\r
+ externalNativeBuild {\r
+ cmake {\r
+ cppFlags ""\r
+ }\r
+ }\r
}\r
buildTypes {\r
release {\r
sourceCompatibility = 1.7\r
targetCompatibility = 1.7\r
}\r
+\r
+// externalNativeBuild {\r
+// cmake {\r
+// path "src/main/jni/CMakeLists.txt"\r
+// version "3.10.2"\r
+// }\r
+// }\r
+\r
ndkVersion '20.1.5948944'\r
sourceSets.main {\r
jniLibs.srcDir 'src/main/libs'\r
-[{"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
// }\r
return false;\r
}\r
-\r
+ public static boolean isSL8541E(){\r
+ String tmp=SystemProperties.get("ro.product.board", "");\r
+ return tmp.contains("8541");\r
+ }\r
public static boolean isA9(){\r
if(SystemProperties.get("persist.sys.id_num","").equalsIgnoreCase("A9")\r
|| SystemProperties.get("persist.sys.customname","").equalsIgnoreCase("YQ")) {\r
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;
}
--- /dev/null
+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)
+
--- /dev/null
+APP_MODULES := ICJniUtils sctool\r
+APP_ABI := armeabi-v7a
\ No newline at end of file
--- /dev/null
+# For more information about using CMake with Android Studio, read the\r
+# documentation: https://d.android.com/studio/projects/add-native-code.html\r
+\r
+# Sets the minimum version of CMake required to build the native library.\r
+\r
+cmake_minimum_required(VERSION 3.10.2)\r
+\r
+# Declares and names the project.\r
+\r
+project("demo")\r
+\r
+# Creates and names a library, sets it as either STATIC\r
+# or SHARED, and provides the relative paths to its source code.\r
+# You can define multiple libraries, and CMake builds them for you.\r
+# Gradle automatically packages shared libraries with your APK.\r
+\r
+add_library( # Sets the name of the library.\r
+ jni_atcmd\r
+\r
+ # Sets the library as a shared library.\r
+ SHARED\r
+\r
+ # Provides a relative path to your source file(s).\r
+ atcmd.c )\r
+\r
+# Searches for a specified prebuilt library and stores the path as a\r
+# variable. Because CMake includes system libraries in the search path by\r
+# default, you only need to specify the name of the public NDK library\r
+# you want to add. CMake verifies that the library exists before\r
+# completing its build.\r
+\r
+find_library( # Sets the name of the path variable.\r
+ log-lib\r
+\r
+ # Specifies the name of the NDK library that\r
+ # you want CMake to locate.\r
+ log )\r
+\r
+# Specifies libraries CMake should link to your target library. You\r
+# can link multiple libraries, such as libraries you define in this\r
+# build script, prebuilt third-party libraries, or system libraries.\r
+\r
+target_link_libraries( # Specifies the target library.\r
+ jni_atcmd\r
+\r
+ # Links the target library to the log library\r
+ # included in the NDK.\r
+ ${log-lib} )
\ No newline at end of file
--- /dev/null
+/**
+ * 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_
--- /dev/null
+#include <jni.h>\r
+//#include <string>\r
+\r
+#include "com_ic_jni_AtCMD.h"\r
+\r
+\r
+#include "atci.h"\r
+\r
+\r
+#define MAX_COMMAND_BYTES (8 * 1024)\r
+\r
+/*\r
+ * Class: com_ic_jni_ICJniUtils\r
+ * Method: native_sendATCmd\r
+ * Signature: (ILjava/lang/String;)Ljava/lang/String;\r
+ */\r
+JNIEXPORT jstring JNICALL Java_com_ic_jni_AtCMD_native_1sendATCmd\r
+ (JNIEnv * env, jclass jobj, jint phoneid, jstring cmdstr){\r
+ \r
+ char result[MAX_COMMAND_BYTES] = {0};\r
+ const char* atCmd = (*env)->GetStringUTFChars(env,cmdstr,0);\r
+ // ALOGD("send AT cmd: %s",atCmd);\r
+ int resultValue = sendATCmd(phoneid,atCmd,result,MAX_COMMAND_BYTES);\r
+ (*env)->ReleaseStringUTFChars(env,cmdstr, atCmd);\r
+ if (resultValue != 0) {\r
+ return (*env)->NewStringUTF(env,"ERROR");\r
+ }\r
+ // ALOGI("the return value is: %s",result);\r
+ return (*env)->NewStringUTF(env,result);\r
+ \r
+}\r
+\r
+++ /dev/null
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* 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
+++ /dev/null
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* 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
+++ /dev/null
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* 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
--- /dev/null
+#ifndef _TYPE_DEF_H_
+#define _TYPE_DEF_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+//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
--- /dev/null
+/*
+ * 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 <stdint.h>
+#include <jni.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <malloc.h>
+
+
+#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<void**>(&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;
+}
-#Thu Jul 15 16:03:45 CST 2021\r
-VERSION_CODE=115\r
+#Sat Jul 17 21:29:51 CST 2021\r
+VERSION_CODE=116\r