上传日志增加时间的控制

master
Matthew 11 months ago
parent 6f7c81c731
commit 82200e7f45

@ -507,7 +507,9 @@ public class AppMaster {
String url = jsonObject.optString("url", null);
mService.logger.warning("Recv Upload Log " + url);
int noSpecData = jsonObject.optInt("noSpecData", 0);
uploadLogs(url, noSpecData == 0);
long modificationTime = jsonObject.optLong("mTime", 0);
modificationTime *= 1000; // to ms
uploadLogs(url, noSpecData == 0, modificationTime);
// uploadMasterLogs(url);
} else if (TextUtils.equals(cmd, CMD_SET_CMA)) {
String ip = jsonObject.optString("value_str", null);
@ -933,12 +935,12 @@ public class AppMaster {
}
}
private void uploadLogs(String url, final boolean includingSpecData) {
private void uploadLogs(String url, final boolean includingSpecData, final long modificationTime) {
String appDir = mService.buildAppDir();
try {
long ts = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
final long ts = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dt = new Date(ts);
@ -978,6 +980,13 @@ public class AppMaster {
return false;
}
if (modificationTime > 0) {
File f = new File(dir, name);
if (ts - f.lastModified() > modificationTime) {
return false;
}
}
return true;
}
};

Loading…
Cancel
Save