增加异常捕获

main
Matthew 4 days ago
parent a38e3801ae
commit 99d08c30ef

@ -871,26 +871,30 @@ public class MpMasterService extends Service {
mPreviousHeartbeatTime = triggerTime;
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent);
Intent relaunchIntent = new Intent();
try {
Intent relaunchIntent = new Intent();
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);
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);
long launchTs = System.currentTimeMillis() + (mHeartbeatDuration + 120) * 1000;
long launchTs = System.currentTimeMillis() + (mHeartbeatDuration + 120) * 1000;
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))));
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();
}
}

Loading…
Cancel
Save