Compare commits

...

2 Commits

@ -871,19 +871,31 @@ public class MpMasterService extends Service {
mPreviousHeartbeatTime = triggerTime;
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent);
Intent relaunchIntent = new Intent();
relaunchIntent.putExtra("cmd", "forceLaunch");
relaunchIntent.putExtra("pkname", MicroPhotoContext.PACKAGE_NAME_MPMASTER);
relaunchIntent.setAction("com.xy.xsetting.action");
relaunchIntent.setPackage("com.android.systemui");
// getApplicationContext().sendBroadcast(restartIntent);
try {
Intent relaunchIntent = new Intent();
long launchTs = System.currentTimeMillis() + (mHeartbeatDuration + 120) * 1000;
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");
// getApplicationContext().sendBroadcast(restartIntent);
PendingIntent sysKAPendingIntent = PendingIntent.getBroadcast(this, BROADCAST_REQUEST_CODE_SYS_KEEPALIVE, relaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, launchTs, sysKAPendingIntent);
long launchTs = System.currentTimeMillis() + (mHeartbeatDuration + 120) * 1000;
logger.info(String.format("Register KeepAlive Launch Clock: " + format.format(new Date(launchTs))));
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) {
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))));
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
@ -892,6 +904,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 +951,7 @@ public class MpMasterService extends Service {
stopSelf();
}
return START_REDELIVER_INTENT;
return START_STICKY;
}
private void connect() {
@ -1278,6 +1291,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);

Loading…
Cancel
Save