导航菜单

页面标题

页面副标题

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

正在查看: 管控平台 v5.2.3.0. 应用的 CheckBlackAppService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.iflytek.mdmservice.service;

import android.app.IntentService;
import android.content.Intent;
import android.content.pm.PackageInfo;
import androidx.annotation.Nullable;
import com.alibaba.fastjson.JSONObject;
import com.iflytek.fsp.shield.android.sdk.http.ApiResponse;
import com.iflytek.mdmcommon.AppUtils;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.db.AppInfoManager;
import com.iflytek.mdmservice.db.BlackAppManager;
import com.iflytek.mdmservice.db.entity.BlackApp;
import com.iflytek.mdmservice.k.d0;
import java.util.List;

public class CheckBlackAppService extends IntentService {

    class a implements d0.x<List<BlackApp>> {
        a() {
        }

        @Override
        public void onSuccess(List<BlackApp> list) {
            SpHelper.putLong("get_black_applist_time", System.currentTimeMillis());
            if (list == null || list.isEmpty()) {
                return;
            }
            BlackAppManager.getInstance().replaceBlackApps(list);
            CheckBlackAppService.this.b(list);
        }

        @Override
        public void onException(Exception exc) {
        }

        @Override
        public void onFailed(ApiResponse apiResponse) {
        }
    }

    public CheckBlackAppService() {
        super("CheckBlackAppService");
    }

    public void b(List<BlackApp> list) {
        if (list == null || list.isEmpty()) {
            return;
        }
        for (BlackApp blackApp : list) {
            if (AppUtils.isInstalled(MDMApp.j(), blackApp.getPackageName())) {
                if (AppInfoManager.getInstance().getAppInfo(blackApp.getPackageName()) != null) {
                    LogUtil.c("blackapp", "黑名单应用(" + blackApp.getPackageName() + ")已安装,但在应用商店已上架");
                } else {
                    LogUtil.c("blackapp", "黑名单应用(" + blackApp.getPackageName() + ")已安装");
                    PackageInfo packageInfo = AppUtils.getPackageInfo(MDMApp.j(), blackApp.getPackageName());
                    if (packageInfo != null) {
                        String charSequence = packageInfo.applicationInfo.loadLabel(MDMApp.j().getPackageManager()).toString();
                        String str = packageInfo.versionName;
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("appPackageName", blackApp.getPackageName());
                        jSONObject.put("appName", charSequence);
                        jSONObject.put("appVersion", str);
                        if ((packageInfo.applicationInfo.flags & 1) == 0) {
                            jSONObject.put("appType", 1);
                        } else {
                            jSONObject.put("appType", 2);
                        }
                        jSONObject.put("appPath", packageInfo.applicationInfo.sourceDir);
                        com.iflytek.mdmservice.utils.t.a().c("16", jSONObject.toJSONString());
                    }
                    MdmSdk.silentUninstall(blackApp.getPackageName());
                }
            }
        }
        SpHelper.putLong("check_black_applist_time", System.currentTimeMillis());
    }

    public static void c() {
        MDMApp.j().startService(new Intent(MDMApp.j(), (Class<?>) CheckBlackAppService.class));
    }

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        if (com.iflytek.mdmservice.o.d.a.b().c()) {
            d0.b0().X(new a());
        } else {
            LogUtil.c("blackapp", "拉取黑名单策略未超过三天");
            b(BlackAppManager.getInstance().getBlackApps());
        }
    }
}