|
|
@ -359,12 +359,14 @@ public class MpMasterService extends Service {
|
|
|
|
final Context context = getApplicationContext();
|
|
|
|
final Context context = getApplicationContext();
|
|
|
|
|
|
|
|
|
|
|
|
if (MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP)) {
|
|
|
|
if (MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP)) {
|
|
|
|
|
|
|
|
logger.warning("MpAPP is STILL Running");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String appPath = MicroPhotoContext.buildMpAppDir(context);
|
|
|
|
String appPath = MicroPhotoContext.buildMpAppDir(context);
|
|
|
|
long ts = System.currentTimeMillis();
|
|
|
|
long ts = System.currentTimeMillis();
|
|
|
|
if (ts - mTimeToStartMpApp < 30000) {
|
|
|
|
if (ts - mTimeToStartMpApp < 30000) {
|
|
|
|
|
|
|
|
logger.warning("MpAPP is STILL Running");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -377,12 +379,13 @@ public class MpMasterService extends Service {
|
|
|
|
((ts - modifiedTimeOfPhoto) > mTimeOfMpAppAlive * 4) ||
|
|
|
|
((ts - modifiedTimeOfPhoto) > mTimeOfMpAppAlive * 4) ||
|
|
|
|
((ts - modifiedTimeOfUpload) > mTimeOfMpAppAlive * 4)) {
|
|
|
|
((ts - modifiedTimeOfUpload) > mTimeOfMpAppAlive * 4)) {
|
|
|
|
// greater than 30m
|
|
|
|
// greater than 30m
|
|
|
|
logger.warning("Restart MpAPP as it is NOT Running");
|
|
|
|
logger.warning("Restart MpAPP as it is NOT Running hb=" + Long.toString(ts - modifiedTimeOfHb) +
|
|
|
|
|
|
|
|
" taking=" + Long.toString(ts - modifiedTimeOfPhoto) + " sending=" + Long.toString(ts - modifiedTimeOfUpload));
|
|
|
|
MicroPhotoContext.restartMpApp(context);
|
|
|
|
MicroPhotoContext.restartMpApp(context);
|
|
|
|
mTimeToStartMpApp = ts;
|
|
|
|
mTimeToStartMpApp = ts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -494,6 +497,7 @@ public class MpMasterService extends Service {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mService.mPreviousHB = null;
|
|
|
|
mService.mPreviousHB = null;
|
|
|
|
|
|
|
|
mService.mPreviousHeartbeatTime = 0;
|
|
|
|
mService.registerHeartbeatTimer();
|
|
|
|
mService.registerHeartbeatTimer();
|
|
|
|
|
|
|
|
|
|
|
|
if (!keepAlive) {
|
|
|
|
if (!keepAlive) {
|
|
|
|