From a34e66c7ff370f293381e0ace0ac1e3bf0519837 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 11 Mar 2025 21:41:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=A4=A7=E6=96=87=E4=BB=B6=E5=B4=A9?= =?UTF-8?q?=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xypower/common/FileUploader.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/xypower/common/FileUploader.java b/common/src/main/java/com/xypower/common/FileUploader.java index 1e5343ae..e647eb21 100644 --- a/common/src/main/java/com/xypower/common/FileUploader.java +++ b/common/src/main/java/com/xypower/common/FileUploader.java @@ -6,6 +6,7 @@ import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -92,8 +93,22 @@ public class FileUploader { } request.writeBytes(this.CRLF); - byte[] bytes = Files.readAllBytes(uploadFile.toPath()); - request.write(bytes); + FileInputStream fis = null; + try { + fis = new FileInputStream(uploadFile); + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + int length = -1; + while ((length = fis.read(buffer)) != -1) { + request.write(buffer, 0, length); + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + FilesUtils.closeFriendly(fis); + } + // byte[] bytes = Files.readAllBytes(uploadFile.toPath()); + // request.write(bytes); } /** From 4de7693aaa88b63da6480b5b0b7525a3d46231f5 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 11 Mar 2025 22:20:22 +0800 Subject: [PATCH 2/6] =?UTF-8?q?Revert=20"=E8=B0=83=E6=95=B4=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d908a36d3b21a9cfd411b74fb929ee007cb67b1c. --- app/build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index be415186..a38b75a2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -76,12 +76,12 @@ android { flavorDimensions "apps" productFlavors { - WP { + N938 { dimension = "apps" externalNativeBuild { cmake { - arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot - abiFilters "arm64-v8a" + arguments "-DUSING_N938=1", "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot + abiFilters "armeabi-v7a" } } } @@ -94,12 +94,12 @@ android { } } } - N938 { + WP { dimension = "apps" externalNativeBuild { cmake { - arguments "-DUSING_N938=1", "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot - abiFilters "armeabi-v7a" + arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot + abiFilters "arm64-v8a" } } } From df1fc220d1c9a5be3c9858d0596888fea79b67d1 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 11 Mar 2025 22:20:31 +0800 Subject: [PATCH 3/6] =?UTF-8?q?Revert=20"=E8=B0=83=E6=95=B4=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E8=84=9A=E6=9C=AC"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 341045651c3e9a2edd5efbd000c88bd88fe2e04a. --- app/build.gradle | 50 +++++++++------------------------ app/src/main/cpp/CMakeLists.txt | 15 ++++------ 2 files changed, 20 insertions(+), 45 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a38b75a2..1588ec59 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,6 +39,7 @@ android { cppFlags '-std=c++17 -fexceptions -Wno-error=format-security -fopenmp' // cppFlags '-std=c++17 -Wno-error=format-security' // arguments "-DANDROID_STL=c++_shared" + arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot abiFilters 'arm64-v8a', 'armeabi-v7a' // setAbiFilters(['arm64-v8a']) } @@ -74,34 +75,15 @@ android { } } - flavorDimensions "apps" - productFlavors { - N938 { - dimension = "apps" - externalNativeBuild { - cmake { - arguments "-DUSING_N938=1", "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot - abiFilters "armeabi-v7a" - } - } - } - RP { - dimension = "apps" - externalNativeBuild { - cmake { - arguments "-DUSING_PLZ=1", "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot - abiFilters "arm64-v8a" - } - } - } - WP { - dimension = "apps" - externalNativeBuild { - cmake { - arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot, "-DHALIDE_ROOT=" + halideroot - abiFilters "arm64-v8a" - } - } + splits { + boolean isReleaseTask = gradle.startParameter.taskNames.any { it.contains("Release") } + // enabled on release build + abi { + enable isReleaseTask + reset() + include "armeabi-v7a", "arm64-v8a" + // include "arm64-v8a" + universalApk false } } @@ -109,19 +91,15 @@ android { variant.outputs.all { output -> if (outputFileName.endsWith('.apk')) { def buildTypeFlag = "dbg" - def flavor = variant.flavorName def prevFileName = "mpapp" - def buildType = variant.buildType if(variant.buildType.name.equals('release')) { buildTypeFlag = "rel" } - if (flavor.equals("N938")) prevFileName = "N938" - else if (flavor.equals("RP")) prevFileName = "rpapp" - def fileName = "${prevFileName}_v${defaultConfig.versionName}_${buildTypeFlag}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" - def outputDir = new File("${project.buildDir}/${buildType}") + def abi = output.getFilter(com.android.build.OutputFile.ABI) + if (abi == null) abi = "all" + if (abi.contains("v7a")) prevFileName = "N938" + def fileName = "${prevFileName}_v${defaultConfig.versionName}_${buildTypeFlag}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}_${abi}.apk" outputFileName = fileName - - // variant.getPackageApplication().outputDirectory = outputDir // new File(project.rootDir.absolutePath + "/app/build/") } } } diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt index 59b29b0e..9d18a0af 100644 --- a/app/src/main/cpp/CMakeLists.txt +++ b/app/src/main/cpp/CMakeLists.txt @@ -17,15 +17,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") add_definitions(-DUSING_ETHERNET) -# USING_N938 defined in gradle -# USING_PLZ defined in gradle - -#if(ANDROID_ABI STREQUAL "armeabi-v7a") -# add_definitions(-DUSING_N938) -#elseif(ANDROID_ABI STREQUAL "arm64-v8a") -# # add_definitions(-DUSING_N938) -# # add_definitions(-DUSING_PLZ) -#endif() +if(ANDROID_ABI STREQUAL "armeabi-v7a") + add_definitions(-DUSING_N938) +elseif(ANDROID_ABI STREQUAL "arm64-v8a") + # add_definitions(-DUSING_N938) + add_definitions(-DUSING_PLZ) +endif() # OUTPUT_DBG_INFO: 输出调试相关信息 add_definitions(-DOUTPUT_DBG_INFO) From bbb78f44b976977fecff90ab47c1bbf5ad97c150 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 11 Mar 2025 22:43:16 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=B0=83=E6=95=B4APP=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/xypower/mpapp/MainActivity.java | 4 ++-- app/src/main/java/com/xypower/mpapp/MicroPhotoService.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/xypower/mpapp/MainActivity.java b/app/src/main/java/com/xypower/mpapp/MainActivity.java index 47b94a97..009dc428 100644 --- a/app/src/main/java/com/xypower/mpapp/MainActivity.java +++ b/app/src/main/java/com/xypower/mpapp/MainActivity.java @@ -73,7 +73,7 @@ public class MainActivity extends AppCompatActivity { Date date = new Date(BuildConfig.BUILD_TIMESTAMP); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String caption = "MP"; - switch (getCustomAppId()) { + switch (MicroPhotoService.getCustomAppId()) { case 1: caption = "RP"; break; @@ -640,6 +640,6 @@ public class MainActivity extends AppCompatActivity { } - private native int getCustomAppId(); + } \ No newline at end of file diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java index 15ea34cf..87bd2016 100644 --- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java +++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java @@ -1681,6 +1681,8 @@ cellSignalStrengthGsm.getDbm(); public static native long requestPowerControl(int type); public static native boolean releasePowerControl(long powerControlHandle); + public static native int getCustomAppId(); + ////////////////////////GPS//////////////////// // private static final String GPS_LOCATION_NAME = android.location.LocationManager.GPS_PROVIDER; private LocationManager mLocationManager; From c912c7057240049abeeb06d5a007097475176c21 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 11 Mar 2025 22:43:28 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=B0=83=E6=95=B4APP=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/MicroPhoto.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/MicroPhoto.cpp b/app/src/main/cpp/MicroPhoto.cpp index 7c717ca7..a7f1a29c 100644 --- a/app/src/main/cpp/MicroPhoto.cpp +++ b/app/src/main/cpp/MicroPhoto.cpp @@ -1424,7 +1424,7 @@ Java_com_xypower_mpapp_MicroPhotoService_releasePowerControl( extern "C" JNIEXPORT jint JNICALL -Java_com_xypower_mpapp_MainActivity_getCustomAppId(JNIEnv *env, jobject thiz) { +Java_com_xypower_mpapp_MicroPhotoService_getCustomAppId(JNIEnv *env, jobject thiz) { #ifdef USING_N938 return 2; #elif defined(USING_PLZ) From d9f6c6e8acb665a21e6e3e7d0a6fa99dce3060ee Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 12 Mar 2025 10:56:08 +0800 Subject: [PATCH 6/6] Update version to 1.3.70 Based Core Version to 1.4.38 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 1588ec59..489eae03 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { // 10,00,000 major-minor-build def AppMajorVersion = 1 def AppMinorVersion = 3 -def AppBuildNumber = 66 +def AppBuildNumber = 70 def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber