导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - MdmApiService.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 MdmApiService.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.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.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 MdmApiService extends Service {

    i.a f492a = 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 {
        }

        @Override
        public String getSerialNumber() throws RemoteException {
            return null;
        }

        @Override
        public boolean isChargingDisabled() throws RemoteException {
            return false;
        }

        @Override
        public boolean isDisableAdb() throws RemoteException {
            return false;
        }

        @Override
        public boolean isDisableUsb() throws RemoteException {
            return false;
        }

        @Override
        public boolean isDisableWifiAdvanced() throws RemoteException {
            return false;
        }

        @Override
        public String j() throws RemoteException {
            return DeviceHelper.getWifiMac();
        }

        @Override
        public boolean modifySystemTime(String str) throws RemoteException {
            return false;
        }

        @Override
        public void powerOff() throws RemoteException {
        }

        @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(MdmApiService.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 + "/" + MdmApiService.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 {
        }

        @Override
        public void silentInstall(String str) throws RemoteException {
        }

        @Override
        public void silentUninstall(String str) throws RemoteException {
        }

        @Override
        public List<String> y() throws RemoteException {
            return MdmSdk.getDisallowedRunningApp();
        }
    }

    public static synchronized String a(Context context, String str) {
        String str2;
        synchronized (MdmApiService.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.f492a;
    }
}