version:2.0.2.1

update:2020.08.17
fix:后台隐藏桌面图标的应用未安装时,管控失效
add:抓取log,静默截图
This commit is contained in:
2020-08-17 18:42:43 +08:00
parent 0dc74d4c41
commit ec61380fcc
8 changed files with 305 additions and 4 deletions

View File

@@ -58,7 +58,10 @@ import org.lzh.framework.updatepluginlib.UpdateConfig;
import org.lzh.framework.updatepluginlib.base.UpdateParser;
import org.lzh.framework.updatepluginlib.model.CheckEntity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -173,7 +176,63 @@ public class MyApplication extends MultiDexApplication {
}
registerTimeReceiver();
// ignoreBatteryOptimization(this);
// try {
// Process exec = Runtime.getRuntime().exec(running);
// final InputStream is = exec.getInputStream();
// new LogThread(is).start();
// } catch (IOException e) {
//// e.printStackTrace();
// Log.e("第一个是Logcat", e.getMessage());
// }
}
//第一个是Logcat 也就是我们想要获取的log日志
//第二个是 -s 也就是表示过滤的意思
//第三个就是 我们要过滤的类型 W表示warm ,我们也可以换成 D debug IinfoEerror等等
// String[] running = new String[]{"logcat", "-s", "adb logcat *: W"};
String[] running = new String[]{"logcat"};
String filePath = "/sdcard/Log/Log.txt";
class LogThread extends Thread {
InputStream is;
LogThread(InputStream inputStream) {
super();
this.is = inputStream;
}
@Override
public void run() {
FileOutputStream os = null;
try {
//新建一个路径信息
File file = new File(filePath);
if (!file.exists()) {
file.getParentFile().mkdirs();
file.createNewFile();
}
os = new FileOutputStream(filePath);
int len = 0;
byte[] buf = new byte[1024];
while (-1 != (len = is.read(buf))) {
os.write(buf, 0, len);
os.flush();
}
} catch (Exception e) {
Log.e("writelog", "read logcat process failed. message: "
+ e.getMessage());
} finally {
if (null != os) {
try {
os.close();
os = null;
} catch (IOException e) {
// Do nothing
}
}
}
}
}
/**