|
|
|
@ -120,7 +120,7 @@ public class AppMaster {
|
|
|
|
|
return (System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() / 1000000) / 1000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void start() {
|
|
|
|
|
public void start(final boolean isCriticalTime) {
|
|
|
|
|
|
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
|
|
|
|
|
@ -160,7 +160,7 @@ public class AppMaster {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
runImpl();
|
|
|
|
|
runImpl(isCriticalTime);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -177,7 +177,7 @@ public class AppMaster {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
runImpl();
|
|
|
|
|
runImpl(isCriticalTime);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -186,7 +186,7 @@ public class AppMaster {
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean runImpl() {
|
|
|
|
|
private boolean runImpl(final boolean isCriticalTime) {
|
|
|
|
|
String masterUrl = mMasterUrl;
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(masterUrl)) {
|
|
|
|
@ -201,8 +201,10 @@ public class AppMaster {
|
|
|
|
|
now.setMinutes(0);
|
|
|
|
|
now.setSeconds(0);
|
|
|
|
|
|
|
|
|
|
long startTime = now.getTime() / 1000;
|
|
|
|
|
long endTime = startTime + 86400 - 1;
|
|
|
|
|
final long startTimeMs = now.getTime();
|
|
|
|
|
final long startTime = startTimeMs / 1000;
|
|
|
|
|
final long endTimeMs = startTimeMs + 86400000 - 1;
|
|
|
|
|
final long endTime = startTime + 86400 - 1;
|
|
|
|
|
|
|
|
|
|
String startTimeStr = Integer.toString(now.getYear()) + (now.getMonth() < 10 ? "0" : "") + Integer.toString(now.getMonth()) + (now.getDate() < 10 ? "0" : "") + Integer.toString(now.getDate());
|
|
|
|
|
|
|
|
|
@ -231,13 +233,21 @@ public class AppMaster {
|
|
|
|
|
postParams.add(new Pair<String, String>("signalLevel1", Integer.toString(MpMasterService.getSignalLevel(1))));
|
|
|
|
|
postParams.add(new Pair<String, String>("signalLevel2", Integer.toString(MpMasterService.getSignalLevel(2))));
|
|
|
|
|
|
|
|
|
|
// SysApi.
|
|
|
|
|
postParams.add(new Pair<String, String>("simcard1", mService.getIccid(1)));
|
|
|
|
|
// if (mService.isSeparateNetwork()) {
|
|
|
|
|
postParams.add(new Pair<String, String>("simcard2", mService.getIccid(2)));
|
|
|
|
|
// }
|
|
|
|
|
if (isCriticalTime) {
|
|
|
|
|
// SysApi.
|
|
|
|
|
postParams.add(new Pair<String, String>("simcard1", mService.getIccid(1)));
|
|
|
|
|
// if (mService.isSeparateNetwork()) {
|
|
|
|
|
postParams.add(new Pair<String, String>("simcard2", mService.getIccid(2)));
|
|
|
|
|
|
|
|
|
|
postParams.add(new Pair<String, String>("freeROM", getFreeROM()));
|
|
|
|
|
|
|
|
|
|
postParams.add(new Pair<String, String>("freeROM", getFreeROM()));
|
|
|
|
|
/*
|
|
|
|
|
String crashTimes = getCrashTimes(startTimeMs, endTimeMs);
|
|
|
|
|
if (!TextUtils.isEmpty(crashTimes)) {
|
|
|
|
|
postParams.add(new Pair<String, String>("crashes", crashTimes));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildStats(startTime, postParams);
|
|
|
|
|
|
|
|
|
@ -442,6 +452,35 @@ public class AppMaster {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getCrashTimes(final long startTimeMs, final long endTimeMs) {
|
|
|
|
|
String path = "/data/system/dropbox/";
|
|
|
|
|
final String prefixFileName = "data_app_crash@";
|
|
|
|
|
final int[] cnts = new int[2];
|
|
|
|
|
cnts[0] = 0;
|
|
|
|
|
cnts[1] = 0;
|
|
|
|
|
|
|
|
|
|
long weekStartTime = startTimeMs - 86400000 * 7;
|
|
|
|
|
FileFilter fileFilter = new FileFilter() {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean accept(File pathname) {
|
|
|
|
|
if (pathname.isFile() && pathname.getName().startsWith(prefixFileName) && pathname.lastModified() <= endTimeMs) {
|
|
|
|
|
if (pathname.lastModified() >= startTimeMs) {
|
|
|
|
|
cnts[0]++;
|
|
|
|
|
}
|
|
|
|
|
// if (pathname.lastModified() >= weekStartTime) {
|
|
|
|
|
cnts[1]++;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
File file = new File(path);
|
|
|
|
|
String[] files = file.list();
|
|
|
|
|
File[] subFiles = file.listFiles(fileFilter);
|
|
|
|
|
|
|
|
|
|
return ((cnts[0] == 0) && (cnts[1] == 0)) ? null : Integer.toString(cnts[0]) + " " + Integer.toString(cnts[1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getBatteryVoltage() {
|
|
|
|
|
int val = 0;
|
|
|
|
|
for (int idx = 0; idx < 3; idx++) {
|
|
|
|
|