Compare commits

..

3 Commits

Author SHA1 Message Date
Matthew 476fa0ab7c 优化代码 5 days ago
Matthew 9ea9043a0e 优化代码 5 days ago
Matthew 8acd884797 改成常量 5 days ago

@ -479,7 +479,7 @@ public class MicroPhotoService extends Service {
}
private boolean isMpMasterAlive(Context context) {
if (Build.TIME < 1744905600000L) {
if (Build.TIME < MicroPhotoContext.BUILD_TIME_WO_SID_20250418) {
// 2025-04-18 old firmware
// Check Log file time
File file = new File(MicroPhotoContext.buildMasterAppDir(context) + "logs/mlog.txt");
@ -595,7 +595,7 @@ public class MicroPhotoService extends Service {
try {
boolean mpmstAlive = isMpMasterAlive(context);
if (!mpmstAlive) {
if (Build.TIME >= 1744905600000L) {
if (Build.TIME >= MicroPhotoContext.BUILD_TIME_WO_SID_20250418) {
int pid = MicroPhotoContext.getProcessIdOfService(context, MicroPhotoContext.PACKAGE_NAME_MPMASTER, MicroPhotoContext.SERVICE_NAME_MPMASTER);
if (pid != 0) {
android.os.Process.killProcess(pid);

@ -50,6 +50,8 @@ public class MicroPhotoContext {
public final static int DEFAULT_HEARTBEAT_FOR_SHARED_NW = 10; // minutes
public final static int DEFAULT_QUICK_HEARTBEAT = 60; // second
public static final long BUILD_TIME_WO_SID_20250418 = 1744905600000L;
public static class AppConfig {
public String cmdid;
public String server;

@ -412,7 +412,7 @@ public class MpMasterService extends Service {
}
private boolean isMpAppAlive(Context context) {
if (Build.TIME < 1744905600000L) {
if (Build.TIME < MicroPhotoContext.BUILD_TIME_WO_SID_20250418) {
// 2025-04-18 old firmware
// Check Log file time
File file = new File(MicroPhotoContext.buildMpAppDir(context) + "logs/log.txt");
@ -874,7 +874,7 @@ public class MpMasterService extends Service {
try {
Intent relaunchIntent = new Intent();
if (Build.TIME < 1744905600000L) {
if (Build.TIME < MicroPhotoContext.BUILD_TIME_WO_SID_20250418) {
// Earlier than 2025-04-18
relaunchIntent.putExtra("cmd", "reboot");
} else {
@ -890,7 +890,7 @@ public class MpMasterService extends Service {
PendingIntent sysKAPendingIntent = PendingIntent.getBroadcast(this, BROADCAST_REQUEST_CODE_SYS_KEEPALIVE, relaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, launchTs, sysKAPendingIntent);
if (Build.TIME < 1744905600000L) {
if (Build.TIME < MicroPhotoContext.BUILD_TIME_WO_SID_20250418) {
logger.info(String.format("Register KeepAlive Reboot Clock: " + format.format(new Date(launchTs))));
} else {
logger.info(String.format("Register KeepAlive Launch Clock: " + format.format(new Date(launchTs))));
@ -1292,7 +1292,7 @@ public class MpMasterService extends Service {
}
private static void forceStopMpApp(Context context) {
if (Build.TIME < 1744905600000L) {
if (Build.TIME < MicroPhotoContext.BUILD_TIME_WO_SID_20250418) {
// 2025-04-18
SysApi.forceStopApp(context, MicroPhotoContext.PACKAGE_NAME_MPAPP);
} else {

Loading…
Cancel
Save