diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt index 5866e03d0a..5b1cdbcf28 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt @@ -81,4 +81,8 @@ class MoGoObuProvider : IMoGoObuProvider { override fun uploadObuPack(filePathArray: Array) { MogoPrivateObuNewManager.INSTANCE.uploadObuPack(filePathArray) } + + override fun deleteObuFile() { + MogoPrivateObuNewManager.INSTANCE.deleteObuFile() + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt index 9ed1316354..a4b0d19ddb 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.datacenter.obu import android.content.Context -import android.util.Log import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.* @@ -104,10 +103,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener { || status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_CHECK_FAILED || status == ObuSoftwareUpgradeStatus.PACKAGE_UPLOAD_FAILED || status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FAILED || status == ObuSoftwareUpgradeStatus.UNKNOWN) { - UiThreadHandler.post { - var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath) - var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath) - } + deleteObuFile() } } @@ -122,6 +118,17 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener { } } + /** + * 删除obu相关的文件夹 + */ + fun deleteObuFile(){ + UiThreadHandler.post { + var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath) + var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath) + CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess") + } + } + /** * 监听obu */ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/upgrade/UpgradeManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/upgrade/UpgradeManager.kt index f8773ed393..e0acfc917a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/upgrade/UpgradeManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/upgrade/UpgradeManager.kt @@ -2,7 +2,6 @@ package com.zhjt.mogo_core_function_devatools.upgrade import android.app.NotificationManager import android.content.Context -import android.util.Log import androidx.core.app.NotificationCompat import com.elegant.utils.UiThreadHandler import com.mogo.eagle.core.data.obu.MogoObuConst @@ -18,7 +17,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA import com.mogo.eagle.core.utilcode.util.AppUtils -import com.mogo.eagle.core.utilcode.util.FileUtils import com.mogo.eagle.core.utilcode.util.ZipUtils import java.io.IOException @@ -159,7 +157,8 @@ class UpgradeManager : IDownload { }, 1000) } - override fun onError(url: String?, errorMsg: String?) {} + override fun onError(url: String?, errorMsg: String?) { + } }) } @@ -194,16 +193,15 @@ class UpgradeManager : IDownload { CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "updateObuUpgradeStatus ---md5Path = $md5Path -----tarPath = $tarPath ") CallerObuApiManager.uploadObuPack(arrayOf(md5Path, tarPath)) } catch (e: IOException) { - //解压失败 - com.mogo.eagle.core.utilcode.util.UiThreadHandler.post { - var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath) - var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath) - } + //解压失败,删除文件夹 + CallerObuApiManager.deleteObuFile() e.printStackTrace() } } override fun onError(url: String?, errorMsg: String?) { + //下载失败,删除文件夹 + CallerObuApiManager.deleteObuFile() } }) } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt index e2af230c6c..4909f11220 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt @@ -18,4 +18,6 @@ interface IMoGoObuProvider : IMoGoFunctionServerProvider { fun setObuLog(isChecked: Boolean) fun uploadObuPack(filePathArray: Array) + + fun deleteObuFile() } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt index 67b18a74b1..5224f901f1 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt @@ -54,4 +54,11 @@ object CallerObuApiManager { providerApi.uploadObuPack(filePathArray) } + /** + * 删除obu文件夹 + */ + fun deleteObuFile() { + providerApi.deleteObuFile() + } + } \ No newline at end of file