正在查看: 管控平台 v5.2.3.0. 应用的 InitAppService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 InitAppService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.service;
import android.app.AlarmManager;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Build;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$drawable;
import com.iflytek.mdmservice.utils.BigDataTrackUtil;
import com.iflytek.user.combo.ComboManage;
import java.lang.Thread;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeoutException;
public class InitAppService extends IntentService {
public InitAppService() {
this("InitAppService");
}
private void a() {
final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public final void uncaughtException(Thread thread, Throwable th) {
InitAppService.c(defaultUncaughtExceptionHandler, thread, th);
}
});
}
private void b() {
String str;
int i;
long j;
int i2;
PendingIntent service;
Intent intent = new Intent(MDMApp.j(), (Class<?>) LocationService.class);
intent.putExtra("repeat", true);
PendingIntent service2 = PendingIntent.getService(MDMApp.j(), 0, intent, 134217728);
AlarmManager alarmManager = (AlarmManager) MDMApp.j().getSystemService("alarm");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
int i3 = SpHelper.getInt("placeCollectionSwitch", 0);
long j2 = 0;
if (i3 == 0) {
alarmManager.cancel(service2);
} else if (i3 == 1) {
int i4 = SpHelper.getInt("placeCollectionInteval", 0);
LogUtil.c("MDMLocation", "InitAppService{placeCollectionInteval:" + i4 + "min}");
if (i4 > 0) {
long j3 = SpHelper.getLong("placeCollectionLatestTime", 0L);
LogUtil.c("MDMLocation", "InitAppService{locationLatestTime:" + simpleDateFormat.format(new Date(j3)) + "}");
long j4 = ((long) (i4 * 60)) * 1000;
long currentTimeMillis = System.currentTimeMillis();
if (j3 == 0) {
j = new SecureRandom().nextInt(i4) + 1;
currentTimeMillis = System.currentTimeMillis() + (j * 60 * 1000);
} else {
if (System.currentTimeMillis() - j3 < j4) {
currentTimeMillis = j3 + j4;
}
j = 0;
}
long j5 = currentTimeMillis;
String format = simpleDateFormat.format(new Date(j5));
StringBuilder sb = new StringBuilder();
sb.append("InitAppService{randomTime:");
sb.append(j);
str = "min, triggerTime:";
sb.append(str);
sb.append(format);
sb.append("}");
LogUtil.c("MDMLocation", sb.toString());
alarmManager.cancel(service2);
if (Build.VERSION.SDK_INT < 19) {
i = 0;
alarmManager.set(0, j5, service2);
} else {
i = 0;
alarmManager.setExact(0, j5, service2);
}
} else {
str = "min, triggerTime:";
i = 0;
}
i2 = SpHelper.getInt("dataReportInteval", i);
int i5 = SpHelper.getInt("dataReportInteval_switch", i);
LogUtil.c("MDMDevice", "InitAppService{dataReportInteval:" + i2 + "min}");
Intent intent2 = new Intent(MDMApp.j(), (Class<?>) TaskService.class);
intent2.putExtra("repeat", true);
service = PendingIntent.getService(MDMApp.j(), 0, intent2, 134217728);
if (i2 > 0 || i5 != 0) {
alarmManager.cancel(service);
}
long j6 = i2 * 60 * 1000;
long j7 = SpHelper.getLong("dataReportLatestTime", 0L);
LogUtil.c("MDMConfig", "InitAppService{reportLatestTime:" + simpleDateFormat.format(new Date(j7)) + "}");
long currentTimeMillis2 = System.currentTimeMillis();
if (j7 == 0) {
j2 = new SecureRandom().nextInt(i2) + 1;
currentTimeMillis2 = System.currentTimeMillis() + (60 * j2 * 1000);
} else if (System.currentTimeMillis() - j7 < j6) {
currentTimeMillis2 = j7 + j6;
}
long j8 = currentTimeMillis2;
LogUtil.c("MDMConfig", "InitAppService{randomTime:" + j2 + str + simpleDateFormat.format(new Date(j8)) + "}");
alarmManager.cancel(service);
if (Build.VERSION.SDK_INT < 19) {
alarmManager.set(0, j8, service);
return;
} else {
alarmManager.setExact(0, j8, service);
return;
}
}
i = 0;
str = "min, triggerTime:";
i2 = SpHelper.getInt("dataReportInteval", i);
int i52 = SpHelper.getInt("dataReportInteval_switch", i);
LogUtil.c("MDMDevice", "InitAppService{dataReportInteval:" + i2 + "min}");
Intent intent22 = new Intent(MDMApp.j(), (Class<?>) TaskService.class);
intent22.putExtra("repeat", true);
service = PendingIntent.getService(MDMApp.j(), 0, intent22, 134217728);
if (i2 > 0) {
}
alarmManager.cancel(service);
}
static void c(Thread.UncaughtExceptionHandler uncaughtExceptionHandler, Thread thread, Throwable th) {
if (thread != null && thread.getName().equals("FinalizerWatchdogDaemon") && (th instanceof TimeoutException)) {
LogUtil.c("InitAppService", "ignoreFinalizeTimeOutException: FinalizerWatchdogDaemon");
} else {
uncaughtExceptionHandler.uncaughtException(thread, th);
}
}
@Override
public void onCreate() {
super.onCreate();
LogUtil.i("InitAppService", "onCreate");
if (Build.VERSION.SDK_INT >= 26) {
String packageName = getPackageName();
NotificationManager notificationManager = (NotificationManager) getSystemService(com.igexin.push.core.b.l);
NotificationChannel notificationChannel = new NotificationChannel(packageName, "主服务", 4);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(-65536);
notificationChannel.setShowBadge(true);
notificationChannel.setDescription("管控平台正在后台运行,请勿停用此服务!");
notificationChannel.setLockscreenVisibility(-1);
notificationManager.createNotificationChannel(notificationChannel);
startForeground(1116, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控8").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
a();
b();
BigDataTrackUtil.initBigDataTrack(getApplication(), String.valueOf(SpHelper.getLong(ComboManage.USER_ID, -1L)), false);
}
@Override
public int onStartCommand(@Nullable Intent intent, int i, int i2) {
if (Build.VERSION.SDK_INT >= 26) {
String packageName = getPackageName();
NotificationManager notificationManager = (NotificationManager) getSystemService(com.igexin.push.core.b.l);
NotificationChannel notificationChannel = new NotificationChannel(packageName, "主服务", 4);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(-65536);
notificationChannel.setShowBadge(true);
notificationChannel.setDescription("管控平台正在后台运行,请勿停用此服务!");
notificationChannel.setLockscreenVisibility(-1);
notificationManager.createNotificationChannel(notificationChannel);
startForeground(1116, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控8").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
return super.onStartCommand(intent, i, i2);
}
public InitAppService(String str) {
super(str);
}
}