|
|
@ -459,19 +459,23 @@ public class MpMasterService extends Service {
|
|
|
|
((ts - modifiedTimeOfPhoto) > mTimeOfMpAppAlive * 4) ||
|
|
|
|
((ts - modifiedTimeOfPhoto) > mTimeOfMpAppAlive * 4) ||
|
|
|
|
((ts - modifiedTimeOfUpload) > mTimeOfMpAppAlive * 4)) {
|
|
|
|
((ts - modifiedTimeOfUpload) > mTimeOfMpAppAlive * 4)) {
|
|
|
|
|
|
|
|
|
|
|
|
String msg = "Restart MpAPP as it is NOT Running hb=" + Long.toString(ts - modifiedTimeOfHb) +
|
|
|
|
if (ts - mTimeToStartMpApp >= 30000) {
|
|
|
|
" taking=" + Long.toString(ts - modifiedTimeOfPhoto) + " sending=" + Long.toString(ts - modifiedTimeOfUpload) +
|
|
|
|
String msg = "Restart MpAPP as it is NOT Running hb=" + Long.toString(ts - modifiedTimeOfHb) +
|
|
|
|
" Will restart MpApp in " + Long.toString(mDelayedRestartMpTime / 1000) + " seconds";
|
|
|
|
" taking=" + Long.toString(ts - modifiedTimeOfPhoto) + " sending=" + Long.toString(ts - modifiedTimeOfUpload) +
|
|
|
|
logger.warning(msg);
|
|
|
|
" Will restart MpApp in " + Long.toString(mDelayedRestartMpTime / 1000) + " seconds";
|
|
|
|
|
|
|
|
logger.warning(msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
|
|
|
|
|
|
|
|
Intent alarmIntent = new Intent();
|
|
|
|
|
|
|
|
alarmIntent.setAction(ACTION_MP_RESTART);
|
|
|
|
|
|
|
|
alarmIntent.putExtra("reason", msg);
|
|
|
|
|
|
|
|
|
|
|
|
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
|
|
|
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
Intent alarmIntent = new Intent();
|
|
|
|
|
|
|
|
alarmIntent.setAction(ACTION_MP_RESTART);
|
|
|
|
|
|
|
|
alarmIntent.putExtra("reason", msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, ts + mDelayedRestartMpTime, pendingIntent);
|
|
|
|
|
|
|
|
|
|
|
|
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, ts + mDelayedRestartMpTime, pendingIntent);
|
|
|
|
mTimeToStartMpApp = ts;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
ex.printStackTrace();
|
|
|
|
ex.printStackTrace();
|
|
|
@ -624,7 +628,8 @@ public class MpMasterService extends Service {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (intent.hasExtra("HeartbeatDuration")) {
|
|
|
|
if (intent.hasExtra("HeartbeatDuration")) {
|
|
|
|
mService.mMpHeartbeatDuration = intent.getIntExtra("HeartbeatDuration", 600000);
|
|
|
|
int hbDuration = intent.getIntExtra("HeartbeatDuration", 600000);
|
|
|
|
|
|
|
|
mService.mMpHeartbeatDuration = hbDuration > 0 ? hbDuration : 600000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mService.mPreviousMpHbTime = intent.getLongExtra("HeartbeatTime", System.currentTimeMillis());
|
|
|
|
mService.mPreviousMpHbTime = intent.getLongExtra("HeartbeatTime", System.currentTimeMillis());
|
|
|
|
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action + " MpHB=" + Long.toString(mService.mMpHeartbeatDuration));
|
|
|
|
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action + " MpHB=" + Long.toString(mService.mMpHeartbeatDuration));
|
|
|
|