XI.CHEN 3 months ago
commit 83d9e4e6c9

@ -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
@ -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 {
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"
}
}
}
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"
}
}
}
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"
}
}
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/")
}
}
}

@ -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")
if(ANDROID_ABI STREQUAL "armeabi-v7a")
add_definitions(-DUSING_N938)
elseif(ANDROID_ABI STREQUAL "arm64-v8a")
# add_definitions(-DUSING_N938)
#elseif(ANDROID_ABI STREQUAL "arm64-v8a")
# # add_definitions(-DUSING_N938)
# # add_definitions(-DUSING_PLZ)
#endif()
add_definitions(-DUSING_PLZ)
endif()
# OUTPUT_DBG_INFO:
add_definitions(-DOUTPUT_DBG_INFO)

@ -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)

@ -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();
}

@ -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;

@ -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);
}
/**

Loading…
Cancel
Save