增加异常捕获

main
Matthew 5 days ago
parent a38e3801ae
commit 99d08c30ef

@ -871,26 +871,30 @@ public class MpMasterService extends Service {
mPreviousHeartbeatTime = triggerTime; mPreviousHeartbeatTime = triggerTime;
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent); alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent);
Intent relaunchIntent = new Intent(); try {
Intent relaunchIntent = new Intent();
if (Build.TIME < 1744905600000L) { if (Build.TIME < 1744905600000L) {
relaunchIntent.putExtra("cmd", "reboot"); relaunchIntent.putExtra("cmd", "reboot");
} else { } else {
relaunchIntent.putExtra("cmd", "forceLaunch"); relaunchIntent.putExtra("cmd", "forceLaunch");
} }
relaunchIntent.putExtra("pkname", MicroPhotoContext.PACKAGE_NAME_MPMASTER); relaunchIntent.putExtra("pkname", MicroPhotoContext.PACKAGE_NAME_MPMASTER);
relaunchIntent.setAction("com.xy.xsetting.action"); relaunchIntent.setAction("com.xy.xsetting.action");
relaunchIntent.setPackage("com.android.systemui"); relaunchIntent.setPackage("com.android.systemui");
// getApplicationContext().sendBroadcast(restartIntent); // 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); PendingIntent sysKAPendingIntent = PendingIntent.getBroadcast(this, BROADCAST_REQUEST_CODE_SYS_KEEPALIVE, relaunchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, launchTs, sysKAPendingIntent); alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, launchTs, sysKAPendingIntent);
if (Build.TIME < 1744905600000L) { if (Build.TIME < 1744905600000L) {
logger.info(String.format("Register KeepAlive Reboot Clock: " + format.format(new Date(launchTs)))); logger.info(String.format("Register KeepAlive Reboot Clock: " + format.format(new Date(launchTs))));
} else { } else {
logger.info(String.format("Register KeepAlive Launch Clock: " + format.format(new Date(launchTs)))); logger.info(String.format("Register KeepAlive Launch Clock: " + format.format(new Date(launchTs))));
}
} catch (Exception ex) {
ex.printStackTrace();
} }
} }

Loading…
Cancel
Save