正在查看: 管控平台 v5.2.3.0. 应用的 CameraUsePeriodCtrlByTeaPolicyService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 CameraUsePeriodCtrlByTeaPolicyService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.service;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$drawable;
import com.iflytek.mdmservice.db.entity.TeaCtrlFunPolicy;
import com.iflytek.mdmservice.db.impl.TeaCtrlFunPolicyDaoImpl;
import java.util.Calendar;
public class CameraUsePeriodCtrlByTeaPolicyService extends Service {
private static final AlarmManager f447a = (AlarmManager) MDMApp.j().getSystemService("alarm");
private long a(TeaCtrlFunPolicy teaCtrlFunPolicy) {
long j;
long j2;
String disableCycle = teaCtrlFunPolicy.getDisableCycle();
String disableTime = teaCtrlFunPolicy.getDisableTime();
Calendar calendar = Calendar.getInstance();
int i = calendar.get(7);
long timeInMillis = calendar.getTimeInMillis();
if (com.iflytek.mdmservice.o.d.e.a(disableCycle, i)) {
j = 0;
for (String str : disableTime.split(";")) {
String[] split = str.split("-");
long d = com.iflytek.mdmservice.o.d.e.d(split[0]);
long d2 = com.iflytek.mdmservice.o.d.e.d(split[1]) + 59000;
long j3 = d - timeInMillis;
if (j3 <= 0) {
j3 = d2 - timeInMillis;
}
if (j3 > 0 && (j == 0 || j3 < j)) {
j = j3;
}
}
} else {
j = 0;
}
if (j == 0) {
Calendar calendar2 = Calendar.getInstance();
calendar2.add(6, 1);
calendar2.set(11, 0);
calendar2.set(12, 0);
calendar2.set(13, 0);
calendar2.set(14, 0);
j2 = calendar2.getTimeInMillis();
} else {
j2 = timeInMillis + j;
}
LogUtil.c("TeaCtrlPolicyCamera", "getNextCameraHandleTime:" + j2);
return j2;
}
private void c() {
AppUsePeriodCtrlService.b().post(new Runnable() {
@Override
public final void run() {
CameraUsePeriodCtrlByTeaPolicyService.this.b();
}
});
}
public void b() {
LogUtil.c("TeaCtrlPolicyCamera", "setCameraState开始");
try {
MDMApp.j().getContentResolver().notifyChange(Uri.parse("content://com.iflytek.mdmservice.provider.PolicyProvider/policy"), null);
TeaCtrlFunPolicy cameraForbidPolicy = new TeaCtrlFunPolicyDaoImpl(MDMApp.j()).getCameraForbidPolicy();
LogUtil.c("TeaCtrlPolicyCamera", "已通知POLICYObserver执行新策略");
if (cameraForbidPolicy == null) {
return;
}
long a2 = a(cameraForbidPolicy);
PendingIntent service = PendingIntent.getService(MDMApp.j(), 0, new Intent(MDMApp.j(), (Class<?>) CameraUsePeriodCtrlByTeaPolicyService.class), 134217728);
if (Build.VERSION.SDK_INT < 19) {
f447a.set(0, a2, service);
} else {
f447a.setExact(0, a2, service);
}
} catch (Exception unused) {
LogUtil.d("教师管控相机策略数据读取失败");
}
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.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(1114, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控1").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
}
@Override
public int onStartCommand(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(1114, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
LogUtil.d("TeaCtrlPolicyCamera", "CameraUsePeriodCtrlByTeaPolicyService 响应定时任务 ");
c();
return super.onStartCommand(intent, i, i2);
}
}