导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import com.iflytek.mdmcommon.FileUtils;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmcommon.StringUtils;
import com.iflytek.mdmcommon.Utils;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.db.DBManager;
import com.iflytek.mdmservice.db.dao.AppInfoDao;
import com.iflytek.mdmservice.db.dao.MdmInterfaceDao;
import com.iflytek.mdmservice.db.dao.WhiteAppDao;
import com.iflytek.mdmservice.db.dao.WoBListDao;
import com.iflytek.mdmservice.db.entity.AppInfo;
import com.iflytek.mdmservice.db.entity.MdmInterface;
import com.iflytek.mdmservice.db.entity.WhiteApp;
import com.iflytek.mdmservice.db.entity.WoBList;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import net.sqlcipher.BuildConfig;

public class PendingIntentRcv extends BroadcastReceiver {
    private static final ExecutorService e = Executors.newFixedThreadPool(2);
    private static final com.iflytek.mdmservice.l.a f = new com.iflytek.mdmservice.l.a();

    private Context f372a;

    private Intent f373b;

    private WoBListDao f374c;
    private MdmInterfaceDao d;

    public enum Type {
        CLEAR_ADMIN_POLICY,
        ENTITY_HOUR_REPORT,
        AUTHOR_SINGLE_START,
        AUTHOR_SINGLE_END,
        AUTHOR_ALL_START,
        AUTHOR_ALL_END
    }

    public void h() {
        String stringExtra = this.f373b.getStringExtra("pkg");
        long longExtra = this.f373b.getLongExtra("start", 0L);
        long longExtra2 = this.f373b.getLongExtra("end", 0L);
        if (StringUtils.isEmpty(stringExtra) || longExtra == 0 || longExtra2 == 0) {
            LogUtil.z("AUTHOR_SINGLE_END data error...");
            return;
        }
        WhiteApp whiteApp = new WhiteApp();
        whiteApp.setPkgName(stringExtra);
        whiteApp.setStart(longExtra);
        whiteApp.setEnd(longExtra2);
        WhiteAppDao whiteAppDao = MDMApp.k().getWhiteAppDao();
        org.greenrobot.greendao.i.g<WhiteApp> queryBuilder = whiteAppDao.queryBuilder();
        queryBuilder.r(WhiteAppDao.Properties.PkgName.a(stringExtra), WhiteAppDao.Properties.Start.a(Long.valueOf(longExtra)), WhiteAppDao.Properties.End.a(Long.valueOf(longExtra2)));
        Iterator<WhiteApp> it = queryBuilder.c().h().iterator();
        while (it.hasNext()) {
            whiteAppDao.delete(it.next());
        }
        MdmSdk.cleanNetworkAccessAppWhiteList();
        l();
        k();
    }

    public void g() {
        String stringExtra = this.f373b.getStringExtra("pkg");
        long longExtra = this.f373b.getLongExtra("start", 0L);
        long longExtra2 = this.f373b.getLongExtra("end", 0L);
        if (StringUtils.isEmpty(stringExtra) || longExtra == 0 || longExtra2 == 0) {
            LogUtil.z("AUTHOR_SINGLE_START data error...");
            return;
        }
        WhiteApp whiteApp = new WhiteApp();
        whiteApp.setPkgName(stringExtra);
        whiteApp.setStart(longExtra);
        whiteApp.setEnd(longExtra2);
        MDMApp.k().getWhiteAppDao().insertOrReplace(whiteApp);
        MdmSdk.setNetworkAccessAppWhiteList(stringExtra);
    }

    private void c() {
        LogUtil.d("===mdm===", "ZeroTimeReceiver onReceive");
        final boolean booleanExtra = this.f373b.getBooleanExtra("reset", false);
        FileUtils.writeStringToSd(new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss").format(new Date()), "mdmlog.txt");
        SpHelper.putBoolean("com.iflytek.mdmservice.ADMIN_SET_STIPULATION", false);
        SpHelper.putString("appWhiteList", BuildConfig.FLAVOR);
        e.submit(new Runnable() {
            @Override
            public final void run() {
                PendingIntentRcv.this.f(booleanExtra);
            }
        });
    }

    private void d(WoBListDao woBListDao, WoBList woBList) {
        WoBList woBList2;
        try {
            org.greenrobot.greendao.i.g<WoBList> queryBuilder = woBListDao.queryBuilder();
            queryBuilder.r(WoBListDao.Properties.SiteUrl.a(woBList.getSiteUrl()), WoBListDao.Properties.CreatorType.a(Integer.valueOf(woBList.getCreatorType())));
            woBList2 = queryBuilder.q();
        } catch (Exception e2) {
            LogUtil.d("deleteWoBList: 删除失败异常 " + e2.getMessage());
            woBList2 = null;
        }
        if (woBList2 != null) {
            woBListDao.delete(woBList2);
        }
    }

    private List<String> e() {
        ArrayList arrayList = new ArrayList();
        Intent intent = new Intent("android.intent.action.MAIN", (Uri) null);
        intent.addCategory("android.intent.category.LAUNCHER");
        List<ResolveInfo> queryIntentActivities = MDMApp.j().getPackageManager().queryIntentActivities(intent, 0);
        if (queryIntentActivities == null || queryIntentActivities.isEmpty()) {
            return Collections.emptyList();
        }
        Iterator<ResolveInfo> it = queryIntentActivities.iterator();
        while (it.hasNext()) {
            arrayList.add(it.next().activityInfo.packageName);
        }
        return arrayList;
    }

    private void k() {
        org.greenrobot.greendao.i.g<AppInfo> queryBuilder = MDMApp.k().getAppInfoDao().queryBuilder();
        queryBuilder.r(AppInfoDao.Properties.Firewall.a(0), new org.greenrobot.greendao.i.i[0]);
        List<AppInfo> h = queryBuilder.c().h();
        if (h == null || h.isEmpty()) {
            LogUtil.z("loadApp fail...");
            return;
        }
        Iterator<AppInfo> it = h.iterator();
        ArrayList arrayList = new ArrayList();
        while (it.hasNext()) {
            arrayList.add(it.next().getPackageName());
        }
        MdmSdk.setNetworkAccessAppWhiteList(arrayList);
    }

    private void l() {
        List<WhiteApp> loadAll = MDMApp.k().getWhiteAppDao().loadAll();
        if (loadAll == null || loadAll.isEmpty()) {
            LogUtil.z("loadWhiteApp fail...");
            return;
        }
        Iterator<WhiteApp> it = loadAll.iterator();
        ArrayList arrayList = new ArrayList();
        while (it.hasNext()) {
            arrayList.add(it.next().getPkgName());
        }
        MdmSdk.setNetworkAccessAppWhiteList(arrayList);
    }

    private void m() {
        if (this.d == null) {
            this.d = DBManager.newInstance(MDMApp.j()).getDaoSession(MDMApp.j()).getMdmInterfaceDao();
        }
        org.greenrobot.greendao.i.g<MdmInterface> queryBuilder = this.d.queryBuilder();
        queryBuilder.r(MdmInterfaceDao.Properties.IsTemp.a(1), new org.greenrobot.greendao.i.i[0]);
        this.d.deleteInTx(queryBuilder.c().h());
    }

    private void n() {
        if (this.f374c == null) {
            this.f374c = DBManager.newInstance(MDMApp.j()).getDaoSession(MDMApp.j()).getWoBListDao();
        }
        org.greenrobot.greendao.i.g<WoBList> queryBuilder = this.f374c.queryBuilder();
        queryBuilder.r(WoBListDao.Properties.IsTemp.a(1), new org.greenrobot.greendao.i.i[0]);
        List<WoBList> h = queryBuilder.c().h();
        if (h != null && !h.isEmpty()) {
            Iterator<WoBList> it = h.iterator();
            while (it.hasNext()) {
                d(this.f374c, it.next());
            }
        }
        p();
    }

    private boolean o() {
        throw new UnsupportedOperationException("Method not decompiled: com.iflytek.mdmservice.receiver.PendingIntentRcv.o():boolean");
    }

    private void p() {
        com.iflytek.mdmservice.utils.u.a();
    }

    public void f(boolean z) {
        if (o()) {
            if (z) {
                Calendar resetTime = Utils.getResetTime(1);
                FileUtils.writeStringToSdAppend(new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss").format(resetTime.getTime()) + "  reboot reset", "mdmlog.txt");
                SpHelper.putLong("zeroTimeRecord", resetTime.getTimeInMillis());
            } else {
                FileUtils.writeStringToSd(new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss").format(new Date()) + "  zero reset", "mdmlog.txt");
                SpHelper.putLong("zeroTimeRecord", new Date().getTime());
            }
        }
        n();
        m();
    }

    public void i() {
        SpHelper.putBoolean("allExcept", true);
        List<String> e2 = e();
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(e2);
        MdmSdk.setNetworkAccessAppWhiteList(arrayList);
    }

    public void j() {
        SpHelper.putBoolean("allExcept", false);
        MdmSdk.cleanNetworkAccessAppWhiteList();
        k();
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        this.f372a = context;
        this.f373b = intent;
        String action = intent.getAction();
        LogUtil.z("PendingIntentRcv action " + action);
        if (action.equals(Type.CLEAR_ADMIN_POLICY.toString())) {
            c();
            return;
        }
        if (action.equals(Type.ENTITY_HOUR_REPORT.toString())) {
            f.f();
            return;
        }
        if (action.equals(Type.AUTHOR_SINGLE_START.toString())) {
            e.submit(new Runnable() {
                @Override
                public final void run() {
                    PendingIntentRcv.this.g();
                }
            });
            return;
        }
        if (action.equals(Type.AUTHOR_SINGLE_END.toString())) {
            e.submit(new Runnable() {
                @Override
                public final void run() {
                    PendingIntentRcv.this.h();
                }
            });
        } else if (action.equals(Type.AUTHOR_ALL_START.toString())) {
            e.submit(new Runnable() {
                @Override
                public final void run() {
                    PendingIntentRcv.this.i();
                }
            });
        } else if (action.equals(Type.AUTHOR_ALL_END.toString())) {
            e.submit(new Runnable() {
                @Override
                public final void run() {
                    PendingIntentRcv.this.j();
                }
            });
        }
    }
}