|
|
|
@ -30,7 +30,6 @@ import android.os.SystemClock;
|
|
|
|
|
|
|
|
|
|
import androidx.core.app.NotificationCompat;
|
|
|
|
|
|
|
|
|
|
import android.telephony.CellSignalStrength;
|
|
|
|
|
import android.telephony.SignalStrength;
|
|
|
|
|
import android.telephony.SubscriptionManager;
|
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
|
@ -44,7 +43,6 @@ import com.dev.devapi.api.SysApi;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
@ -417,7 +415,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
private boolean registerCaptureSchedule(long startTime, long baseTime) {
|
|
|
|
|
private boolean registerCaptureSchedule(long timeOfZeroPoint, long secondsOfToday) {
|
|
|
|
|
|
|
|
|
|
long[] photoTimeData = getPhotoTimeData(mNativeHandle);
|
|
|
|
|
if (photoTimeData == null) {
|
|
|
|
@ -431,7 +429,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
long val = 0L;
|
|
|
|
|
// int maxDuration = mHeartbeatDuration * 2 / 1000;
|
|
|
|
|
int maxDuration = 35 * 60 * 1000 + 1000;
|
|
|
|
|
int currentTs = 0;
|
|
|
|
|
int currentTs = -1;
|
|
|
|
|
List<Long> schedules = new ArrayList<>();
|
|
|
|
|
int offset = 0;
|
|
|
|
|
for (int day = 0; day < 2; day++, offset += 86400) {
|
|
|
|
@ -439,15 +437,15 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
val = photoTimeData[idx];
|
|
|
|
|
ts = (int) ((val & 0x00FFFFFF00000000L) >> 32) + offset;
|
|
|
|
|
|
|
|
|
|
if (ts < baseTime) {
|
|
|
|
|
if (ts < secondsOfToday) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((ts - baseTime) > maxDuration) {
|
|
|
|
|
if ((ts - secondsOfToday) > maxDuration) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentTs == 0) {
|
|
|
|
|
if (currentTs == -1) {
|
|
|
|
|
currentTs = ts;
|
|
|
|
|
channel = (short) ((val & 0xFF0000L) >> 16);
|
|
|
|
|
preset = (short) ((val & 0xFF00L) >> 8);
|
|
|
|
@ -473,11 +471,11 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!schedules.isEmpty()) {
|
|
|
|
|
long expectedTs = startTime + ts;
|
|
|
|
|
Date date = new Date(expectedTs * 1000);
|
|
|
|
|
// Log.d(TAG, "Register Photo Time: " + date.toString() + " BaseTime=" + baseTime + " ts=" + ts + " startTime=" + startTime + " expectedTs=" + expectedTs);
|
|
|
|
|
long expectedTs = timeOfZeroPoint + ts;
|
|
|
|
|
// Date date = new Date(expectedTs * 1000);
|
|
|
|
|
// Log.d(TAG, "Register Photo Time: " + date.toString() + " BaseTime=" + secondsOfToday + " ts=" + ts + " startTime=" + startTime + " expectedTs=" + expectedTs);
|
|
|
|
|
|
|
|
|
|
registerPhotoTimer(channel, preset, currentTs, (currentTs - baseTime) * 1000, schedules);
|
|
|
|
|
registerPhotoTimer(channel, preset, expectedTs, expectedTs * 1000 - System.currentTimeMillis(), schedules);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@ -487,12 +485,13 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
|
|
|
|
|
List<Long> schedules = new ArrayList<>();
|
|
|
|
|
long ts = System.currentTimeMillis() / 1000;
|
|
|
|
|
long val = (ts << 24);
|
|
|
|
|
// long val = (ts << 24);
|
|
|
|
|
long val = 0;
|
|
|
|
|
val |= ((long)channel << 16);
|
|
|
|
|
val |= ((long)preset << 8);
|
|
|
|
|
schedules.add(Long.valueOf(val));
|
|
|
|
|
|
|
|
|
|
registerPhotoTimer(context, channel, preset, System.currentTimeMillis() / 1000, 0, schedules);
|
|
|
|
|
registerPhotoTimer(context, channel, preset, 0, 0, schedules);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -545,7 +544,6 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// registerPhotoTimer();
|
|
|
|
|
break;
|
|
|
|
|
case ACTION_STOP:
|
|
|
|
|
unregisterReceiver(mScreenaAtionReceiver);
|
|
|
|
@ -822,10 +820,12 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
SignalStrength ss = telephonyManager.getSignalStrength();
|
|
|
|
|
// List<CellSignalStrength> css = ss.getCellSignalStrengths();
|
|
|
|
|
|
|
|
|
|
int signalLevel = ss.getLevel();
|
|
|
|
|
sb.append("&Signal4G=" + signalLevel);
|
|
|
|
|
sb.append("&Signal2G=" + signalLevel);
|
|
|
|
|
sb.append("&SL=" + signalLevel);
|
|
|
|
|
if (ss != null) {
|
|
|
|
|
int signalLevel = ss.getLevel();
|
|
|
|
|
sb.append("&Signal4G=" + signalLevel);
|
|
|
|
|
sb.append("&Signal2G=" + signalLevel);
|
|
|
|
|
sb.append("&SL=" + signalLevel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isXyPlatform) {
|
|
|
|
|
java.text.DecimalFormat fmt=new java.text.DecimalFormat("0.0");
|
|
|
|
|