处理上传异常,压缩后卸载原apk
This commit is contained in:
parent
827aaa21f8
commit
6d084c92e4
|
@ -39,6 +39,7 @@ import com.example.studyapp.utils.ShellUtils;
|
|||
import com.example.studyapp.worker.CheckAccessibilityWorker;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
@ -274,7 +275,11 @@ public class MainActivity extends AppCompatActivity {
|
|||
LogFileUtil.logAndWrite(android.util.Log.DEBUG, "MainActivity", "----发送result------;" + currentScriptResult, null);
|
||||
if (currentScriptResult != null && !TextUtils.isEmpty(currentScriptResult)) {
|
||||
TaskUtil.execSaveTask(this, androidId, taskId, currentScriptResult);
|
||||
infoUpload(this, androidId, currentScriptResult);
|
||||
try {
|
||||
infoUpload(this, androidId, currentScriptResult);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
|
|
|
@ -247,6 +247,9 @@ public class TaskUtil {
|
|||
zipFile.delete();
|
||||
e.printStackTrace();
|
||||
}
|
||||
//uninstall
|
||||
String uninstall = "pm uninstall "+packAge;
|
||||
String chmodResult = ShellUtils.execRootCmdAndGetResult(uninstall);
|
||||
Log.e("TAG", "infoUpload compress finish: ");
|
||||
// 上传压缩文件
|
||||
if (!zipFile.exists()) {
|
||||
|
@ -257,9 +260,6 @@ public class TaskUtil {
|
|||
String chmod = "chmod 777 \"" + safeNewPath + "\"";
|
||||
uploadFile(zipFile);
|
||||
|
||||
//uninstall
|
||||
String uninstall = "pm uninstall "+packAge;
|
||||
String chmodResult = ShellUtils.execRootCmdAndGetResult(uninstall);
|
||||
// 清理临时文件
|
||||
delFileSh(copiedAPKFile.getAbsolutePath());
|
||||
ShellUtils.execRootCmdAndGetResult(chmod);
|
||||
|
|
Loading…
Reference in New Issue