正在查看: 管控平台 v5.2.3.0. 应用的 WarningService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 WarningService.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.NetUtils;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$drawable;
import com.iflytek.mdmservice.k.d0;
import com.iflytek.mdmservice.utils.DeviceHelper;
import java.text.SimpleDateFormat;
import java.util.Date;
import net.sqlcipher.BuildConfig;
public class WarningService extends IntentService {
private final String f519a;
private AlarmManager f520b;
class a implements d0.w {
a() {
}
@Override
public void a(String str) {
LogUtil.c(WarningService.this.f519a, "call api rebootSystemRecord onFailed:" + str);
WarningService.this.e();
}
@Override
public void onException(Exception exc) {
LogUtil.c(WarningService.this.f519a, "call api rebootSystemRecord onException:" + exc.getMessage());
WarningService.this.e();
}
@Override
public void onSuccess(String str) {
LogUtil.c(WarningService.this.f519a, "call api rebootSystemRecord onSuccess:" + str);
WarningService.this.f();
SpHelper.putBoolean("reboot_system_commit_flag", true);
}
}
public WarningService() {
this("WarningService");
}
private String d(String str, String str2) {
char[] charArray = str.toCharArray();
char[] charArray2 = str2.toCharArray();
int length = charArray.length;
int length2 = charArray2.length;
int max = Math.max(length, length2);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < max; i++) {
if (i < length) {
sb.append(charArray[i]);
}
if (i < length2) {
sb.append(charArray2[i]);
}
}
return sb.toString().replaceAll(":", BuildConfig.FLAVOR);
}
public void e() {
LogUtil.i(this.f519a, "startTimeTask");
if (this.f520b == null) {
this.f520b = (AlarmManager) getSystemService("alarm");
}
PendingIntent service = PendingIntent.getService(this, 101, new Intent(this, (Class<?>) WarningService.class), 134217728);
long currentTimeMillis = System.currentTimeMillis() + 300000;
if (Build.VERSION.SDK_INT < 19) {
this.f520b.set(0, currentTimeMillis, service);
} else {
this.f520b.setExact(0, currentTimeMillis, service);
}
}
public void f() {
LogUtil.i(this.f519a, "stopTimeTask");
if (this.f520b == null) {
this.f520b = (AlarmManager) getSystemService("alarm");
}
this.f520b.cancel(PendingIntent.getService(this, 101, new Intent(this, (Class<?>) WarningService.class), 134217728));
}
@Override
public void onCreate() {
super.onCreate();
LogUtil.i(this.f519a, "onCreate");
this.f520b = (AlarmManager) getSystemService("alarm");
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(1119, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
if (!NetUtils.isNetAvailable(MDMApp.j())) {
LogUtil.i(this.f519a, "network error");
e();
return;
}
String stringExtra = intent.getStringExtra("source");
SpHelper.getInstances().init(getApplicationContext());
String string = SpHelper.getString("reboot_system_flag", BuildConfig.FLAVOR);
LogUtil.c(this.f519a, "source:" + stringExtra + ", flag: " + string);
if (string == null || string.length() == 0) {
string = d(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()), DeviceHelper.getWifiMac());
SpHelper.putString("reboot_system_flag", string);
SpHelper.putBoolean("reboot_system_commit_flag", false);
LogUtil.c(this.f519a, "source:" + stringExtra + ", create flag: " + string);
}
boolean z = SpHelper.getBoolean("reboot_system_commit_flag", false);
LogUtil.c(this.f519a, "source:" + stringExtra + ", commit flag: " + z);
if (z) {
return;
}
d0.b0().b1(string, "1", new a());
}
@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(1119, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
return super.onStartCommand(intent, i, i2);
}
public WarningService(String str) {
super(str);
this.f519a = WarningService.class.getSimpleName();
}
}