From a38e3801ae511eaa09e35e73d16453ebaa84ea96 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 12 Jun 2025 15:09:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E6=97=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E7=9B=B4=E6=8E=A5=E6=B3=A8=E5=86=8C=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=9A=84=E5=BB=B6=E8=BF=9F=E5=B9=BF=E6=92=AD?= =?UTF-8?q?=E6=9D=A5=E4=BF=9D=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xypower/mpmaster/MpMasterService.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index 6b342c7a..bb203cfe 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -872,7 +872,12 @@ public class MpMasterService extends Service { alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent); Intent relaunchIntent = new Intent(); - relaunchIntent.putExtra("cmd", "forceLaunch"); + + if (Build.TIME < 1744905600000L) { + relaunchIntent.putExtra("cmd", "reboot"); + } else { + relaunchIntent.putExtra("cmd", "forceLaunch"); + } relaunchIntent.putExtra("pkname", MicroPhotoContext.PACKAGE_NAME_MPMASTER); relaunchIntent.setAction("com.xy.xsetting.action"); relaunchIntent.setPackage("com.android.systemui"); @@ -882,8 +887,11 @@ 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); - - logger.info(String.format("Register KeepAlive Launch Clock: " + format.format(new Date(launchTs)))); + if (Build.TIME < 1744905600000L) { + 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)))); + } } @Override @@ -892,6 +900,7 @@ public class MpMasterService extends Service { Log.d(TAG, "MpMasterService::onStartCommand"); if (intent == null) { + Log.d(TAG, "MpMasterService::onStartCommand intent is null. Stop self"); stopForeground(true); stopSelf(startId); return START_NOT_STICKY; @@ -938,7 +947,7 @@ public class MpMasterService extends Service { stopSelf(); } - return START_REDELIVER_INTENT; + return START_STICKY; } private void connect() { @@ -1278,6 +1287,7 @@ public class MpMasterService extends Service { private static void forceStopMpApp(Context context) { if (Build.TIME < 1744905600000L) { + // 2025-04-18 SysApi.forceStopApp(context, MicroPhotoContext.PACKAGE_NAME_MPAPP); } else { int pid = MicroPhotoContext.getProcessIdOfService(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, MicroPhotoContext.SERVICE_NAME_MPSERVICE);