通过附件编译时间来选择不同的判断程序是否运行的方法

lowmem
Matthew 2 months ago
parent 28be0c4c80
commit 126c1f5e1b

@ -412,6 +412,21 @@ public class MpMasterService extends Service {
th.start(); th.start();
} }
private boolean isMpAppAlive(Context context) {
if (Build.TIME < 1744905600000L) {
// 2025-04-18 old firmware
// Check Log file time
File file = new File(MicroPhotoContext.buildMpAppDir(context) + "logs/log.txt");
if (file.exists()) {
return ((System.currentTimeMillis() - file.lastModified()) < 1800000);
} else {
return false;
}
}
return MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, MicroPhotoContext.SERVICE_NAME_MPSERVICE);
}
private void detectMpAppAliveImpl() { private void detectMpAppAliveImpl() {
try { try {
final Context context = getApplicationContext(); final Context context = getApplicationContext();
@ -425,7 +440,7 @@ public class MpMasterService extends Service {
} }
boolean isMpAppRunning = false; boolean isMpAppRunning = false;
for (int idx = 0; idx < detectionCnt; idx++) { for (int idx = 0; idx < detectionCnt; idx++) {
isMpAppRunning = MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, MicroPhotoContext.SERVICE_NAME_MPSERVICE); isMpAppRunning = isMpAppAlive(context);
if (isMpAppRunning) { if (isMpAppRunning) {
break; break;
} }

Loading…
Cancel
Save