正在查看: 管控平台 v5.2.3.0. 应用的 SensorService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 SensorService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.service;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$drawable;
import net.sqlcipher.BuildConfig;
public class SensorService extends IntentService {
private static final String f = SensorService.class.getSimpleName();
private static boolean g;
private SensorManager f511a;
private Sensor f512b;
private SensorEventListener f513c;
private long d;
private boolean e;
class a implements SensorEventListener {
a() {
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
boolean z;
boolean z2;
float[] fArr = sensorEvent.values;
if (fArr.length > 0) {
LogUtil.i(SensorService.f, "values[0]:" + fArr[0] + BuildConfig.FLAVOR);
}
if ("Hisense".equalsIgnoreCase(Build.BRAND)) {
long currentTimeMillis = System.currentTimeMillis() - SensorService.this.d;
if (fArr.length <= 0 || fArr[0] <= 0.0f) {
z2 = false;
} else {
z2 = SensorService.this.e;
SensorService.this.e = false;
}
if (fArr.length > 0 && fArr[0] <= 0.0f) {
z2 = !SensorService.this.e;
SensorService.this.e = true;
}
if (z2 || currentTimeMillis > com.igexin.push.config.c.l) {
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putBoolean("isShorter", SensorService.this.e);
intent.setAction("com.iflytek.mdm.intent.EYES_PROTECT_PROXIMITY_CHANGED");
intent.putExtras(bundle);
intent.setPackage("com.android.iflylauncher3");
MDMApp.j().sendBroadcast(intent);
SensorService.this.d = System.currentTimeMillis();
String str = SensorService.f;
StringBuilder sb = new StringBuilder();
sb.append("发送眼睛距离");
sb.append(SensorService.this.e ? "过近" : "过远");
sb.append("广播");
LogUtil.c(str, sb.toString());
return;
}
return;
}
if ("HiteVision".equalsIgnoreCase(Build.BRAND)) {
long currentTimeMillis2 = System.currentTimeMillis() - SensorService.this.d;
if (fArr.length <= 0 || fArr[0] <= 25.0f) {
z = false;
} else {
z = SensorService.this.e;
SensorService.this.e = false;
}
if (fArr.length > 0 && fArr[0] <= 25.0f) {
z = !SensorService.this.e;
SensorService.this.e = true;
}
if (z || currentTimeMillis2 > com.igexin.push.config.c.l) {
Intent intent2 = new Intent();
Bundle bundle2 = new Bundle();
bundle2.putBoolean("isShorter", SensorService.this.e);
intent2.setAction("com.iflytek.mdm.intent.EYES_PROTECT_PROXIMITY_CHANGED");
intent2.putExtras(bundle2);
intent2.setPackage("com.android.iflylauncher3");
MDMApp.j().sendBroadcast(intent2);
SensorService.this.d = System.currentTimeMillis();
String str2 = SensorService.f;
StringBuilder sb2 = new StringBuilder();
sb2.append("发送眼睛距离");
sb2.append(SensorService.this.e ? "过近" : "过远");
sb2.append("广播");
LogUtil.c(str2, sb2.toString());
}
}
}
}
public SensorService() {
this("SensorService");
}
@Override
public void onCreate() {
super.onCreate();
LogUtil.i(f, "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(1120, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台定位,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
SensorManager sensorManager = (SensorManager) MDMApp.j().getSystemService("sensor");
this.f511a = sensorManager;
this.f512b = sensorManager.getDefaultSensor(8);
this.f513c = new a();
}
@Override
public void onDestroy() {
stopForeground(true);
super.onDestroy();
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
Sensor sensor;
Sensor sensor2;
LogUtil.i(f, "onHandleIntent:" + g);
if (g) {
SensorManager sensorManager = this.f511a;
if (sensorManager != null && (sensor2 = this.f512b) != null) {
sensorManager.registerListener(this.f513c, sensor2, 3);
}
} else {
SensorManager sensorManager2 = this.f511a;
if (sensorManager2 != null && (sensor = this.f512b) != null) {
sensorManager2.unregisterListener(this.f513c, sensor);
}
}
while (g) {
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
LogUtil.e(e.getMessage());
Thread.currentThread().interrupt();
}
}
}
@Override
public int onStartCommand(@Nullable Intent intent, int i, int i2) {
g = intent.getBooleanExtra("flag", false);
LogUtil.i(f, "onStartCommand: " + g);
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(1120, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控1").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
}
return super.onStartCommand(intent, i, i2);
}
public SensorService(String str) {
super(str);
this.d = 0L;
this.e = false;
}
}