From e6b688475c708c8f31a077abe53bd42cb2e163cd Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Mon, 11 Mar 2024 15:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/MicroPhoto.cpp | 2 +- .../java/com/xypower/mpapp/MicroPhotoService.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/MicroPhoto.cpp b/app/src/main/cpp/MicroPhoto.cpp index da3ba82c..957efd81 100644 --- a/app/src/main/cpp/MicroPhoto.cpp +++ b/app/src/main/cpp/MicroPhoto.cpp @@ -645,7 +645,7 @@ Java_com_xypower_mpapp_MicroPhotoService_recordingFinished( extern "C" JNIEXPORT void JNICALL -Java_com_xypower_mpapp_MicroPhotoService_updateConfigs( +Java_com_xypower_mpapp_MicroPhotoService_reloadConfigs( JNIEnv* env, jobject pThis, jlong handler) { diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java index 4e1eef74..ea0ad3aa 100644 --- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java +++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java @@ -406,9 +406,12 @@ public class MicroPhotoService extends Service { mService.sendHeartbeat(mService.mNativeHandle, mService.getSignalLevel()); } } else if (TextUtils.equals(ACTION_UPDATE_CONFIGS, action)) { - Log.i(TAG, "UPD CFG Fired ACTION=" + action); - if (mService.mNativeHandle != 0) { - mService.updateConfigs(mService.mNativeHandle); + int restart = intent.getIntExtra("restart", 0); + Log.i(TAG, "UPD CFG Fired ACTION=" + action + " restart" + restart); + if (restart != 0) { + MicroPhotoService.restartApp(context, context.getPackageName()); + } else if (mService.mNativeHandle != 0) { + mService.reloadConfigs(mService.mNativeHandle); } } else if (TextUtils.equals(ACTION_VIDEO_FINISHED, action)) { boolean result = intent.getBooleanExtra("result", false); @@ -1090,7 +1093,7 @@ cellSignalStrengthGsm.getDbm(); // protected native long[] getNextScheduleItem(long handler); protected native boolean notifyToTakePhoto(long handler, int channel, int preset, long scheduleTime, boolean photoOrVideo); protected native boolean sendHeartbeat(long handler, int signalLevel); - protected native boolean updateConfigs(long handler); + protected native boolean reloadConfigs(long handler); protected native void updatePosition(long handler, double lon, double lat, long ts); protected native boolean uninit(long handler); protected native void recordingFinished(long handler, boolean result, String path, long videoId);