导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.receiver;

import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import com.alibaba.fastjson.JSONObject;
import com.iflytek.mdmcommon.IdGenUtil;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.NetUtil;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$dimen;
import com.iflytek.mdmservice.R$layout;
import com.iflytek.mdmservice.R$style;
import com.iflytek.mdmservice.db.ViolstionNoNetManager;
import com.iflytek.mdmservice.db.entity.ViolstionNoNetwork;
import com.iflytek.mdmservice.k.d0;
import com.iflytek.mdmservice.ui.MainActivity;
import com.iflytek.user.combo.ComboManage;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import net.sqlcipher.BuildConfig;
import net.sqlcipher.database.SQLiteDatabase;

public class ViolationNoticeReceiver extends BroadcastReceiver {

    private com.iflytek.mdmservice.l.a f387a;

    private ExecutorService f388b;

    static void b(String str, String str2, String str3, String str4) {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("appName", str);
        jSONObject.put("appPackageName", str2);
        jSONObject.put("appVersion", str3);
        jSONObject.put("apkSign", str4);
        com.iflytek.mdmservice.utils.t.a().c("17", jSONObject.toJSONString());
    }

    static void c(Dialog dialog) {
        if (dialog == null || !dialog.isShowing()) {
            return;
        }
        dialog.dismiss();
    }

    private void d(Context context) {
        View inflate = LayoutInflater.from(context).inflate(R$layout.layout_toast, (ViewGroup) null);
        final Dialog dialog = new Dialog(context, R$style.ToastStyle);
        Window window = dialog.getWindow();
        window.setWindowAnimations(R$style.ToastStyle);
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.y = context.getResources().getDimensionPixelSize(R$dimen.toast_offset_y);
        attributes.gravity = 80;
        attributes.width = -2;
        attributes.height = -2;
        window.setAttributes(attributes);
        dialog.setCanceledOnTouchOutside(true);
        if (Build.VERSION.SDK_INT >= 26) {
            window.setType(2038);
        } else {
            window.setType(2003);
        }
        dialog.addContentView(inflate, new RelativeLayout.LayoutParams(-2, -2));
        dialog.show();
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                ViolationNoticeReceiver.c(dialog);
            }
        }, com.igexin.push.config.c.t);
    }

    public void a(String str, String[] strArr, Intent intent, Context context, long j, long j2, int i) {
        String str2;
        Long valueOf = Long.valueOf(IdGenUtil.getIdGenUtil().generate());
        int intValue = Integer.valueOf(str).intValue();
        if (intValue == 1) {
            this.f387a.c(valueOf, strArr);
            com.iflytek.mdmservice.utils.t.a().c("9", "设备已经root");
            str2 = "root";
        } else if (intValue == 2) {
            LogUtil.z("ViolationNoticeReceiver type2...");
            str2 = intent.getStringExtra("packageName");
            this.f387a.b(valueOf, strArr, str2);
        } else if (intValue == 3) {
            this.f387a.d(valueOf, strArr);
            str2 = "sim";
        } else if (intValue != 4) {
            str2 = BuildConfig.FLAVOR;
        } else {
            this.f387a.e(valueOf, strArr);
            str2 = "usb连接电脑";
        }
        String str3 = str2;
        try {
            if (strArr.length == 3) {
                Integer.valueOf(strArr[2]).intValue();
            }
        } catch (Exception e) {
            LogUtil.e(e.getMessage());
        }
        if (NetUtil.isNetworkAvailable(context)) {
            d0.b0().D1(j, j2, str, i, valueOf, System.currentTimeMillis(), str3);
            return;
        }
        ViolstionNoNetwork violstionNoNetwork = new ViolstionNoNetwork();
        violstionNoNetwork.setUserId(Long.valueOf(j));
        violstionNoNetwork.setSchoolId(Long.valueOf(j2));
        violstionNoNetwork.setType(str);
        violstionNoNetwork.setLimit(Integer.valueOf(i));
        violstionNoNetwork.setViolstionId(valueOf);
        violstionNoNetwork.setViolstionTime(Long.valueOf(System.currentTimeMillis()));
        violstionNoNetwork.setVioDetail(str3);
        ViolstionNoNetManager.getInstance().addViolstionNoNet(violstionNoNetwork);
    }

    @Override
    public void onReceive(final Context context, final Intent intent) {
        if (intent == null || TextUtils.isEmpty(intent.getAction())) {
            return;
        }
        String action = intent.getAction();
        if (!"com.iflytek.mdm.intent.ACTION_VIOLATION_NOTICE".equals(action)) {
            if ("com.iflytek.mdm.intent.ACTION_VIOLATION_UPLOAD".equals(action)) {
                final String stringExtra = intent.getStringExtra("packageName");
                final String stringExtra2 = intent.getStringExtra("appName");
                final String stringExtra3 = intent.getStringExtra("versionName");
                final String stringExtra4 = intent.getStringExtra("apkSign");
                com.iflytek.mdmservice.utils.r.a(new Runnable() {
                    @Override
                    public final void run() {
                        ViolationNoticeReceiver.b(stringExtra2, stringExtra, stringExtra3, stringExtra4);
                    }
                });
                return;
            }
            return;
        }
        final String stringExtra5 = intent.getStringExtra("type");
        LogUtil.z("接收到违规通知,违规类型:" + stringExtra5);
        final String[] stringArrayExtra = intent.getStringArrayExtra("dealManner");
        final long longExtra = intent.getLongExtra(ComboManage.USER_ID, -1L);
        final long longExtra2 = intent.getLongExtra("lastSchool", -1L);
        final int intValue = Integer.valueOf(stringArrayExtra[1]).intValue();
        try {
            d(context);
        } catch (Exception e) {
            LogUtil.e(e.getMessage());
            Intent intent2 = new Intent(MDMApp.j(), (Class<?>) MainActivity.class);
            intent2.setFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
            MDMApp.j().startActivity(intent2);
        }
        if (this.f387a == null) {
            this.f387a = new com.iflytek.mdmservice.l.a();
        }
        if (this.f388b == null) {
            this.f388b = Executors.newFixedThreadPool(2);
        }
        this.f388b.submit(new Runnable() {
            @Override
            public final void run() {
                ViolationNoticeReceiver.this.a(stringExtra5, stringArrayExtra, intent, context, longExtra, longExtra2, intValue);
            }
        });
    }
}