正在查看: xDrip+ v04633772025.07.16 应用的 WebFollowService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: xDrip+ v04633772025.07.16 应用的 WebFollowService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eveningoutpost.dexdrip.cgm.webfollow;
import android.content.Intent;
import android.os.IBinder;
import android.text.SpannableString;
import com.eveningoutpost.dexdrip.cgm.nsfollow.utils.Anticipate;
import com.eveningoutpost.dexdrip.models.BgReading;
import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.models.UserError;
import com.eveningoutpost.dexdrip.utilitymodels.StatusItem;
import com.eveningoutpost.dexdrip.utils.DexCollectionType;
import com.eveningoutpost.dexdrip.utils.framework.BuggySamsung;
import com.eveningoutpost.dexdrip.utils.framework.ForegroundService;
import com.eveningoutpost.dexdrip.utils.framework.WakeLockTrampoline;
import com.eveningoutpost.dexdrip.xdrip;
import java.util.ArrayList;
import java.util.List;
public class WebFollowService extends ForegroundService {
private static BuggySamsung buggySamsung;
private static volatile MContext context;
private static volatile BgReading lastBg;
private static volatile long lastBgTime;
private static final long SAMPLE_PERIOD = DexCollectionType.getCollectorSamplePeriod(DexCollectionType.WebFollow);
protected static volatile String lastState = "";
protected static volatile String lastError = "";
protected static volatile long lastErrorTime = 0;
private static volatile long wakeup_time = 0;
private static volatile long last_wakeup = 0;
private static volatile long lastPoll = 0;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
resetInstance();
}
@Override
public int onStartCommand(android.content.Intent r5, int r6, int r7) {
throw new UnsupportedOperationException("Method not decompiled: com.eveningoutpost.dexdrip.cgm.webfollow.WebFollowService.onStartCommand(android.content.Intent, int, int):int");
}
public static void lambda$onStartCommand$0() {
context = Template.get();
if (context != null) {
context.save("template");
JoH.startService(WebFollowService.class, "function", "template");
} else {
lastError = "Could not get template";
lastErrorTime = JoH.tsl();
}
}
public static void lambda$onStartCommand$1() {
try {
new Cmd(context).processAll();
if (context.lastError != null) {
lastErrorTime = context.lastErrorTime.longValue();
lastError = context.lastError;
}
} catch (NullPointerException e) {
UserError.Log.e("WebFollow", "Caught concurrency exception");
e.printStackTrace();
}
scheduleWakeUp();
}
static void scheduleWakeUp() {
BgReading lastNoSenssor = BgReading.lastNoSenssor();
long j = lastNoSenssor != null ? lastNoSenssor.timestamp : 0L;
long next = Anticipate.next(JoH.tsl(), j, SAMPLE_PERIOD, 0L) + 30000;
wakeup_time = next;
UserError.Log.d("WebFollow", "Anticipate next: " + JoH.dateTimeText(next) + " last: " + JoH.dateTimeText(j));
JoH.wakeUpIntent(xdrip.getAppContext(), JoH.msTill(next), WakeLockTrampoline.getPendingIntent(WebFollowService.class, 1028));
}
private static boolean shouldServiceRun() {
return DexCollectionType.getDexCollectionType() == DexCollectionType.WebFollow;
}
public static boolean isCollecting() {
return JoH.msSince(last_wakeup) < 900000;
}
@Override
public void onDestroy() {
super.onDestroy();
resetInstance();
}
private void buggySamsungCheck() {
if (buggySamsung == null) {
buggySamsung = new BuggySamsung("WebFollow");
}
buggySamsung.evaluate(wakeup_time);
wakeup_time = 0L;
}
private static String getBestStatusMessage() {
if (JoH.emptyString(lastState)) {
return null;
}
return lastState;
}
public static List<StatusItem> megaStatus() {
String str;
String str2;
BgReading lastNoSenssor = BgReading.lastNoSenssor();
StatusItem.Highlight highlight = StatusItem.Highlight.NORMAL;
String str3 = "n/a";
if (lastNoSenssor != null) {
long msSince = JoH.msSince(lastNoSenssor.timestamp);
str = JoH.niceTimeScalar(msSince);
if (msSince > SAMPLE_PERIOD + 30000) {
highlight = StatusItem.Highlight.BAD;
}
} else {
str = "n/a";
}
ArrayList arrayList = new ArrayList();
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(lastNoSenssor != null ? " ago" : "");
arrayList.add(new StatusItem("Latest reading", sb.toString(), highlight));
if (lastPoll > 0) {
str2 = JoH.niceTimeScalar(JoH.msSince(lastPoll)) + " ago";
} else {
str2 = "n/a";
}
arrayList.add(new StatusItem("Last poll", str2));
if (last_wakeup > 0) {
str3 = JoH.niceTimeScalar(JoH.msSince(last_wakeup)) + " ago";
}
arrayList.add(new StatusItem("Last wakeup", str3));
arrayList.add(new StatusItem("Next poll in", JoH.niceTimeScalar(Math.max(wakeup_time - JoH.tsl(), 0L))));
if (lastNoSenssor != null) {
arrayList.add(new StatusItem("Last reading time", JoH.dateTimeText(lastNoSenssor.timestamp)));
}
arrayList.add(new StatusItem("Next poll time", JoH.dateTimeText(wakeup_time)));
boolean z = JoH.buggy_samsung;
if (z) {
arrayList.add(new StatusItem("Buggy handset", xdrip.gs(z ? 2131757071 : 2131755900)));
}
if (lastErrorTime != 0 && JoH.msSince(lastErrorTime) < 3600000) {
arrayList.add(new StatusItem("Last Error", lastError, StatusItem.Highlight.BAD));
arrayList.add(new StatusItem("Last Error time", JoH.niceTimeScalar(JoH.msSince(lastErrorTime))));
}
return arrayList;
}
public static void resetInstance() {
synchronized (WebFollowService.class) {
context = null;
lastBg = null;
}
}
public static SpannableString nanoStatus() {
String bestStatusMessage = getBestStatusMessage();
if (JoH.emptyString(bestStatusMessage)) {
return null;
}
return new SpannableString(bestStatusMessage);
}
}