正在查看: 管控平台 v5.2.3.0. 应用的 MdmSdkService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 MdmSdkService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.service;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmcommon.Utils;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.db.dao.AppInfoDao;
import com.iflytek.mdmservice.db.entity.AppInfo;
import com.iflytek.mdmservice.i;
import com.iflytek.mdmservice.utils.DeviceHelper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public class MdmSdkService extends Service {
i.a f494a = new a();
class a extends i.a {
a() {
}
@Override
public List<String> A() throws RemoteException {
return MdmSdk.urlWhiteListRead();
}
@Override
public void clearPackageData(String str) throws RemoteException {
MdmSdk.clearPackageData(str);
}
@Override
public String getSerialNumber() throws RemoteException {
return MdmSdk.getSerialNumber();
}
@Override
public boolean isChargingDisabled() throws RemoteException {
return SpHelper.getBoolean("isChargingDisabledAdmin", false);
}
@Override
public boolean isDisableAdb() throws RemoteException {
return MdmSdk.isDisableAdb();
}
@Override
public boolean isDisableUsb() throws RemoteException {
return MdmSdk.isDisableAdb();
}
@Override
public boolean isDisableWifiAdvanced() throws RemoteException {
return MdmSdk.isDisableWifiAdvanced();
}
@Override
public String j() throws RemoteException {
return DeviceHelper.getWifiMac();
}
@Override
public boolean modifySystemTime(String str) throws RemoteException {
return MdmSdk.modifySystemTime(str);
}
@Override
public void powerOff() throws RemoteException {
MdmSdk.powerOff();
}
@Override
public List<String> r() throws RemoteException {
ArrayList arrayList = new ArrayList();
List<String> networkAccessAppWhiteList = MdmSdk.getNetworkAccessAppWhiteList();
if (networkAccessAppWhiteList == null || networkAccessAppWhiteList.isEmpty()) {
LogUtil.c("MDMService", "getNetworkAccessAppWhiteList is empty");
return arrayList;
}
networkAccessAppWhiteList.remove("com.iflytek.mdmservice");
networkAccessAppWhiteList.remove("com.iflytek.mdmadmin");
networkAccessAppWhiteList.remove("com.iflytek.mdmstore");
ArrayList arrayList2 = new ArrayList();
if ("HUAWEI".equals(Build.BRAND) || "HONOR".equals(Build.BRAND)) {
for (String str : networkAccessAppWhiteList) {
if (str.matches("^\\d+$")) {
arrayList2.addAll(Arrays.asList(MdmSdkService.this.getPackageManager().getPackagesForUid(Integer.parseInt(str))));
}
}
networkAccessAppWhiteList.clear();
networkAccessAppWhiteList.addAll(arrayList2);
}
HashMap hashMap = new HashMap();
org.greenrobot.greendao.i.g<AppInfo> queryBuilder = MDMApp.k().getAppInfoDao().queryBuilder();
queryBuilder.r(AppInfoDao.Properties.PackageName.b(networkAccessAppWhiteList), new org.greenrobot.greendao.i.i[0]);
List<AppInfo> h = queryBuilder.c().h();
if (h != null && !h.isEmpty()) {
for (AppInfo appInfo : h) {
hashMap.put(appInfo.getPackageName(), appInfo.getName());
}
}
for (String str2 : networkAccessAppWhiteList) {
if (TextUtils.isEmpty(str2) || !Utils.isPackageInstalled(MDMApp.j(), str2)) {
LogUtil.i("MDMApps", "getWhiteAppUrlList:" + str2 + " do not installed.");
} else {
String str3 = (String) hashMap.get(str2);
String str4 = TextUtils.isEmpty(str3) ? str2 + "/" + MdmSdkService.a(MDMApp.j(), str2) : str2 + "/" + str3;
if (!arrayList.contains(str4)) {
arrayList.add(str4);
}
}
}
return arrayList;
}
@Override
public boolean resetFactory() throws RemoteException {
com.iflytek.mdmservice.utils.q.a();
return true;
}
@Override
public void setChargingDisabled(boolean z) throws RemoteException {
SpHelper.putLong("power_connected_time", System.currentTimeMillis());
SpHelper.putBoolean("isChargingDisabledAdmin", z);
if (!z) {
if (MdmSdk.isChargingDisabled()) {
MdmSdk.setChargingDisabled(false);
return;
}
return;
}
BatteryManager batteryManager = (BatteryManager) MdmSdkService.this.getSystemService("batterymanager");
if (batteryManager.getIntProperty(4) >= 60) {
int intProperty = batteryManager.getIntProperty(6);
if ((intProperty == 2 || intProperty == 5) && !MdmSdk.isChargingDisabled()) {
MdmSdk.setChargingDisabled(true);
}
}
}
@Override
public void silentInstall(String str) throws RemoteException {
MdmSdk.silentInstall(str);
}
@Override
public void silentUninstall(String str) throws RemoteException {
MdmSdk.silentUninstall(str);
}
@Override
public List<String> y() throws RemoteException {
return MdmSdk.getDisallowedRunningApp();
}
}
public static synchronized String a(Context context, String str) {
String str2;
synchronized (MdmSdkService.class) {
PackageManager packageManager = context.getPackageManager();
try {
str2 = (String) packageManager.getApplicationInfo(str, 0).loadLabel(packageManager);
} catch (PackageManager.NameNotFoundException unused) {
return "com.jide.autoupdater".equals(str) ? "鸿合OTA升级" : "无法获取应用名称";
}
}
return str2;
}
@Override
@Nullable
public IBinder onBind(Intent intent) {
return this.f494a;
}
}