导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.receiver;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.StringUtils;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.db.entity.WoBList;
import com.iflytek.mdmservice.receiver.PendingIntentRcv;
import com.iflytek.mdmservice.service.FirewallService;
import java.util.ArrayList;

public class MdmWhiteUrlReceiver extends MdmReceiver {

    private final AlarmManager f368c = (AlarmManager) MDMApp.j().getSystemService("alarm");
    private final Context d = MDMApp.j();
    private Intent e;

    private void e(long j, long j2) {
        Intent intent = new Intent(this.d, (Class<?>) PendingIntentRcv.class);
        intent.setAction(PendingIntentRcv.Type.AUTHOR_ALL_START.toString());
        intent.putExtra("start", j);
        intent.putExtra("end", j2);
        this.f368c.set(0, j, PendingIntent.getBroadcast(this.d, 0, intent, 0));
        Intent intent2 = new Intent(this.d, (Class<?>) PendingIntentRcv.class);
        intent2.setAction(PendingIntentRcv.Type.AUTHOR_ALL_END.toString());
        intent2.putExtra("start", j);
        intent2.putExtra("end", j2);
        this.f368c.set(0, j2, PendingIntent.getBroadcast(this.d, 0, intent2, 0));
    }

    private void f(long j, long j2, String str) {
        Intent intent = new Intent(this.d, (Class<?>) FirewallService.class);
        intent.setAction("com.iflytek.mdm.action.FIREWALL_GET_DATA");
        intent.putExtra("pkg", str);
        intent.putExtra("start", j);
        intent.putExtra("end", j2);
        this.d.startService(intent);
    }

    private boolean g(long j, long j2) {
        if (j2 > j && j2 - j < com.igexin.push.core.b.E) {
            return true;
        }
        LogUtil.i("MDMApi", "timeVerify fail...");
        return false;
    }

    private void h() {
        long longExtra = this.e.getLongExtra("start", 0L);
        long longExtra2 = this.e.getLongExtra("end", 0L);
        if (longExtra2 == 0) {
            longExtra = System.currentTimeMillis();
            longExtra2 = 3600000 + System.currentTimeMillis();
        }
        if (g(longExtra, longExtra2)) {
            e(longExtra, longExtra2);
        }
    }

    private void i() {
        String stringExtra = this.e.getStringExtra("url");
        if (StringUtils.isEmpty(stringExtra)) {
            return;
        }
        MDMApp.k().getWoBListDao().insertOrReplace(new WoBList(null, stringExtra, 0, 0, null, 1, 0, true));
        ArrayList arrayList = new ArrayList();
        arrayList.add(stringExtra);
        MdmSdk.urlWhiteListWrite(arrayList);
    }

    private void j() {
        long longExtra = this.e.getLongExtra("start", 0L);
        long longExtra2 = this.e.getLongExtra("end", 0L);
        String stringExtra = this.e.getStringExtra("whiteApp");
        if (StringUtils.isEmpty(stringExtra)) {
            LogUtil.i("MDMApi", "whiteSingle intent fail...");
            return;
        }
        if (longExtra2 == 0) {
            longExtra = System.currentTimeMillis();
            longExtra2 = 3600000 + System.currentTimeMillis();
        }
        long j = longExtra;
        long j2 = longExtra2;
        if (g(j, j2)) {
            f(j, j2, stringExtra);
        }
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        char c2;
        super.onReceive(context, intent);
        this.e = intent;
        String action = intent.getAction();
        int hashCode = action.hashCode();
        int i = 0;
        if (hashCode == -18413583) {
            if (action.equals("com.iflytek.mdm.intent.ACTION_WHITE_ALL")) {
                c2 = 1;
            }
            c2 = 65535;
        } else if (hashCode != 1705939540) {
            if (hashCode == 1709447128 && action.equals("com.iflytek.mdm.intent.ACTION_WHITE_SINGLE")) {
                c2 = 0;
            }
            c2 = 65535;
        } else {
            if (action.equals("com.iflytek.mdm.intent.ACTION_WHITE_SETONE")) {
                c2 = 2;
            }
            c2 = 65535;
        }
        if (c2 == 0) {
            i = 1013;
        } else if (c2 == 1) {
            i = 1014;
        } else if (c2 == 2) {
            i = 1015;
        }
        String stringExtra = intent.getStringExtra("package");
        String stringExtra2 = intent.getStringExtra("sign");
        LogUtil.c("MDMApi", "action:" + action + ", packageName:" + stringExtra);
        if (c(i, stringExtra, stringExtra2)) {
            switch (i) {
                case 1013:
                    j();
                    break;
                case 1014:
                    h();
                    break;
                case 1015:
                    i();
                    break;
            }
        }
        LogUtil.c("MDMApi", "action:" + action + ", packageName:" + stringExtra + " unauthorized");
    }
}