增加对拍照闹钟的处理(其中包含心跳)

lowmem
Matthew 1 month ago
parent e75fe1648c
commit 38fe69d93b

@ -256,6 +256,7 @@ public class MpMasterService extends Service {
intentFilter.addAction(ACTION_UNINSTALL_RESULT);
intentFilter.addAction(ACTION_REQ_RESTART_APP);
intentFilter.addAction(MicroPhotoContext.ACTION_HEARTBEAT_MP);
intentFilter.addAction(MicroPhotoContext.ACTION_TAKEPHOTO_MP);
registerReceiver(mAlarmReceiver, intentFilter);
}
@ -645,7 +646,17 @@ public class MpMasterService extends Service {
mService = service;
}
public void onReceive(Context context, Intent intent) {
public void onReceive(final Context context, final Intent intent) {
mService.mHander.postDelayed(new Runnable() {
@Override
public void run() {
processAction(context, intent);
}
}, 0);
}
public void processAction(final Context context, final Intent intent) {
String action = intent.getAction();
if (TextUtils.equals(ACTION_HEARTBEAT, action)) {
boolean keepAlive = intent.getBooleanExtra("keepAlive", false);
@ -681,6 +692,22 @@ public class MpMasterService extends Service {
mService.startMaster(true);
}
mService.detectMpAppAlive();
} else if (TextUtils.equals(MicroPhotoContext.ACTION_TAKEPHOTO_MP, action)) {
if (intent.hasExtra("HeartbeatDuration")) {
int hbDuration = intent.getIntExtra("HeartbeatDuration", 600000);
mService.mMpHeartbeatDuration = hbDuration > 0 ? hbDuration : 600000;
mService.mPreviousMpHbTime = intent.getLongExtra("HeartbeatTime", System.currentTimeMillis());
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action + " MpHB=" + Long.toString(mService.mMpHeartbeatDuration) + " HBTime =" + mService.mPreviousMpHbTime);
mService.registerHeartbeatTimer();
mService.buildChargingBatteryVoltage(System.currentTimeMillis());
if (!mService.mSeparateNetwork && (!mService.mMntnMode)) {
mService.startMaster(true);
}
mService.detectMpAppAlive();
}
} else if (TextUtils.equals(ACTION_UPDATE_CONFIGS, action)) {
int restart = intent.getIntExtra("restart", 0);
mService.logger.info("Update Config Fired ACTION=" + action + " restart=" + restart);

Loading…
Cancel
Save