|
|
|
@ -383,11 +383,26 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
// Will be called fron native
|
|
|
|
|
private void registerHeartbeatTimer(int duration, long nextPhotoTime) {
|
|
|
|
|
int orgHeartbeatDuration = mHeartbeatDuration;
|
|
|
|
|
mHeartbeatDuration = duration;
|
|
|
|
|
|
|
|
|
|
if (orgHeartbeatDuration == 0) {
|
|
|
|
|
registerHeartbeatTimer();
|
|
|
|
|
if (nextPhotoTime == 0) {
|
|
|
|
|
mHeartbeatDuration = duration;
|
|
|
|
|
registerHeartbeatTimer();
|
|
|
|
|
} else {
|
|
|
|
|
long ts = System.currentTimeMillis();
|
|
|
|
|
nextPhotoTime *= 1000;
|
|
|
|
|
if (nextPhotoTime > ts) {
|
|
|
|
|
mHeartbeatDuration = (int) ((nextPhotoTime - ts) % duration) + 999;
|
|
|
|
|
registerHeartbeatTimer();
|
|
|
|
|
mHeartbeatDuration = duration;
|
|
|
|
|
} else {
|
|
|
|
|
mHeartbeatDuration = duration;
|
|
|
|
|
registerHeartbeatTimer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
mHeartbeatDuration = duration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void registerHeartbeatTimer() {
|
|
|
|
|
|
|
|
|
|