导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.policy.service;

import android.app.AlarmManager;
import android.app.DownloadManager;
import android.app.IntentService;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.constant.MDMConstants;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.db.DownloadTaskManager;
import com.iflytek.mdmservice.db.UdpDownloadTaskManager;
import com.iflytek.mdmservice.db.entity.DownloadTask;
import com.iflytek.mdmservice.db.entity.UdpDownloadTask;
import com.iflytek.mdmservice.service.CheckAppService;
import com.iflytek.mdmservice.utils.q;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.TimerTask;

public class AppService extends IntentService {

    private Handler f308a;

    private AlarmManager f309b;

    private static class SafeHandler extends Handler {
        public SafeHandler(Context context) {
            new WeakReference(context);
        }

        @Override
        public void handleMessage(Message message) {
            Bundle data;
            if ("iFLYTEK".equalsIgnoreCase(Build.BRAND) || (data = message.getData()) == null) {
                return;
            }
            String string = data.getString("packageName");
            if (TextUtils.isEmpty(string)) {
                return;
            }
            ArrayList arrayList = new ArrayList();
            arrayList.add(string);
            if (("AGM3-W09HN".equals(Build.MODEL) || com.iflytek.mdmbase.b.a.b(Build.MODEL)) && !MDMConstants.getMdmApks5().contains(string)) {
                MdmSdk.resetSuperWhiteApp(string);
            } else {
                MdmSdk.setSuperWhiteApp(arrayList, false);
            }
            LogUtil.c("AppService", "setSuperWhiteApp : " + string);
        }
    }

    class a extends TimerTask {
        a(AppService appService) {
        }

        @Override
        public void run() {
            q.a();
        }
    }

    public AppService() {
        this("AppService");
    }

    private void a(String str) {
        PackageInfo packageInfo;
        try {
            packageInfo = MDMApp.j().getPackageManager().getPackageInfo(str, 0);
        } catch (PackageManager.NameNotFoundException e) {
            LogUtil.e(e.getMessage());
            packageInfo = null;
        }
        if (packageInfo != null) {
            DownloadTask downloadTask = DownloadTaskManager.getInstance().getDownloadTask(str, packageInfo.versionCode);
            DownloadManager downloadManager = (DownloadManager) getSystemService("download");
            if (downloadTask != null) {
                LogUtil.c("servicedownload", "安装完成 remove getDownloadId: " + downloadTask.getDownloadId());
                LogUtil.c("servicedownload", "remove: " + downloadManager.remove(downloadTask.getDownloadId().longValue()));
                DownloadTaskManager.getInstance().removeDownloadTask(str, (long) packageInfo.versionCode);
            }
            UdpDownloadTask udpDownloadTask = UdpDownloadTaskManager.getInstance().getUdpDownloadTask(str, packageInfo.versionCode);
            if (udpDownloadTask != null) {
                LogUtil.e("udpservicedownload remove getDownloadId: " + udpDownloadTask.getDownloadId());
                LogUtil.e("udpservicedownload remove: " + downloadManager.remove(udpDownloadTask.getDownloadId().longValue()));
                UdpDownloadTaskManager.getInstance().removeUdpDownloadTask(str, (long) packageInfo.versionCode);
            }
        }
    }

    public void b(java.lang.String r6) {
        throw new UnsupportedOperationException("Method not decompiled: com.iflytek.mdmservice.policy.service.AppService.b(java.lang.String):void");
    }

    private void d(String str) {
        LogUtil.c("CheckApp", "setDelayCheckService:" + str);
        if (this.f309b == null) {
            this.f309b = (AlarmManager) getSystemService("alarm");
        }
        Intent intent = new Intent(MDMApp.j(), (Class<?>) CheckAppService.class);
        intent.putExtra("packageName", str);
        Calendar calendar = Calendar.getInstance();
        PendingIntent service = PendingIntent.getService(MDMApp.j(), (calendar.get(12) * 100000) + (calendar.get(13) * 1000) + calendar.get(14), intent, 1073741824);
        int i = Build.VERSION.SDK_INT;
        if (i < 19) {
            this.f309b.set(0, System.currentTimeMillis() + 180000, service);
        } else if (i < 23) {
            this.f309b.setExact(0, System.currentTimeMillis() + 180000, service);
        } else {
            this.f309b.setExactAndAllowWhileIdle(0, System.currentTimeMillis() + 180000, service);
        }
    }

    @Override
    public void onCreate() {
        super.onCreate();
        this.f309b = (AlarmManager) getSystemService("alarm");
    }

    @Override
    protected void onHandleIntent(@androidx.annotation.Nullable android.content.Intent r31) {
        throw new UnsupportedOperationException("Method not decompiled: com.iflytek.mdmservice.policy.service.AppService.onHandleIntent(android.content.Intent):void");
    }

    public AppService(String str) {
        super(str);
        this.f308a = new SafeHandler(this);
    }
}