导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.policy.receiver;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmcommon.Utils;
import com.iflytek.mdmservice.MDMApp;
import com.igexin.push.config.c;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import net.sqlcipher.BuildConfig;

public class TimeReceiver extends BroadcastReceiver {
    private static volatile boolean e = false;
    private static final String f = TimeReceiver.class.getSimpleName();

    private String f301a;

    private AlarmManager f302b;

    private final String[] f303c = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
    private String d;

    private java.lang.Long a(java.util.Calendar r20) {
        throw new UnsupportedOperationException("Method not decompiled: com.iflytek.mdmservice.policy.receiver.TimeReceiver.a(java.util.Calendar):java.lang.Long");
    }

    private void b() {
        MDMApp.j().o().execute(new Runnable() {
            @Override
            public final void run() {
                TimeReceiver.this.c();
            }
        });
    }

    public void c() {
        Calendar calendar;
        TimeReceiver timeReceiver;
        int i;
        Integer num;
        JSONArray jSONArray;
        SimpleDateFormat simpleDateFormat;
        int i2;
        Calendar calendar2 = Calendar.getInstance();
        if (BuildConfig.FLAVOR.equals(this.f301a) || "{}".equals(this.f301a) || c.H.equals(this.f301a)) {
            calendar = calendar2;
            String str = f;
            StringBuilder sb = new StringBuilder();
            sb.append("===timetick, policy:");
            timeReceiver = this;
            sb.append(timeReceiver.f301a);
            LogUtil.c(str, sb.toString());
        } else {
            if (TextUtils.isEmpty(this.f301a)) {
                this.f301a = SpHelper.getString("time_policy", BuildConfig.FLAVOR);
            }
            if (!Utils.isJson(this.f301a)) {
                return;
            }
            JSONArray jSONArray2 = JSON.parseObject(this.f301a).getJSONArray(this.f303c[calendar2.get(7) - 1]);
            SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            int i3 = calendar2.get(1);
            int i4 = calendar2.get(2) + 1;
            int i5 = calendar2.get(5);
            long timeInMillis = calendar2.getTimeInMillis();
            int i6 = 0;
            while (jSONArray2 != null && i6 < jSONArray2.size()) {
                String[] split = jSONArray2.get(i6).toString().split("-");
                try {
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(i3);
                    sb2.append("-");
                    sb2.append(i4);
                    sb2.append("-");
                    sb2.append(i5);
                    sb2.append(" ");
                    jSONArray = jSONArray2;
                    try {
                        sb2.append(split[0]);
                        sb2.append(":00");
                        Date parse = simpleDateFormat2.parse(sb2.toString());
                        StringBuilder sb3 = new StringBuilder();
                        sb3.append(i3);
                        sb3.append("-");
                        sb3.append(i4);
                        sb3.append("-");
                        sb3.append(i5);
                        sb3.append(" ");
                        calendar = calendar2;
                        try {
                            sb3.append(split[1]);
                            sb3.append(":59");
                            Date parse2 = simpleDateFormat2.parse(sb3.toString());
                            String str2 = f;
                            simpleDateFormat = simpleDateFormat2;
                            try {
                                StringBuilder sb4 = new StringBuilder();
                                sb4.append("Start time");
                                sb4.append(i3);
                                sb4.append("-");
                                sb4.append(i4);
                                sb4.append("-");
                                sb4.append(i5);
                                sb4.append(" ");
                                i2 = i6;
                                try {
                                    sb4.append(split[0]);
                                    sb4.append(":00");
                                    LogUtil.c(str2, sb4.toString());
                                    LogUtil.c(f, "End time" + i3 + "-" + i4 + "-" + i5 + " " + split[1] + ":59");
                                    if (parse.getTime() <= timeInMillis && timeInMillis < parse2.getTime()) {
                                        i = 0;
                                        timeReceiver = this;
                                        break;
                                    }
                                } catch (ParseException e2) {
                                    e = e2;
                                    LogUtil.e(e.getMessage());
                                    i6 = i2 + 1;
                                    jSONArray2 = jSONArray;
                                    calendar2 = calendar;
                                    simpleDateFormat2 = simpleDateFormat;
                                }
                            } catch (ParseException e3) {
                                e = e3;
                                i2 = i6;
                                LogUtil.e(e.getMessage());
                                i6 = i2 + 1;
                                jSONArray2 = jSONArray;
                                calendar2 = calendar;
                                simpleDateFormat2 = simpleDateFormat;
                            }
                        } catch (ParseException e4) {
                            e = e4;
                            simpleDateFormat = simpleDateFormat2;
                            i2 = i6;
                            LogUtil.e(e.getMessage());
                            i6 = i2 + 1;
                            jSONArray2 = jSONArray;
                            calendar2 = calendar;
                            simpleDateFormat2 = simpleDateFormat;
                        }
                    } catch (ParseException e5) {
                        e = e5;
                        calendar = calendar2;
                    }
                } catch (ParseException e6) {
                    e = e6;
                    calendar = calendar2;
                    jSONArray = jSONArray2;
                }
                i6 = i2 + 1;
                jSONArray2 = jSONArray;
                calendar2 = calendar;
                simpleDateFormat2 = simpleDateFormat;
            }
            calendar = calendar2;
            timeReceiver = this;
        }
        i = 1;
        if (((!Utils.isJson(timeReceiver.d) || (num = (Integer) ((Map) JSON.parseObject(timeReceiver.d, HashMap.class)).get(1)) == null) ? 1 : num.intValue()) == 0) {
            com.iflytek.mdmservice.o.d.c.c("time_policy_disable", i ^ 1, false);
        } else {
            com.iflytek.mdmservice.o.d.c.b("time_policy_disable", i ^ 1);
        }
        String str3 = f;
        StringBuilder sb5 = new StringBuilder();
        sb5.append("TimePolicy");
        sb5.append(i != 0 ? "禁用" : "启用");
        sb5.append("设备");
        LogUtil.c(str3, sb5.toString());
        Long a2 = timeReceiver.a(calendar);
        if (a2 != null) {
            long longValue = a2.longValue();
            if (timeReceiver.f302b == null) {
                timeReceiver.f302b = (AlarmManager) MDMApp.j().getSystemService("alarm");
            }
            Intent intent = new Intent(MDMApp.j(), (Class<?>) TimeReceiver.class);
            intent.putExtra("triggerTime", longValue);
            intent.putExtra("selfrun", true);
            PendingIntent broadcast = PendingIntent.getBroadcast(MDMApp.j(), 0, intent, 134217728);
            if (Build.VERSION.SDK_INT < 19) {
                timeReceiver.f302b.set(0, longValue, broadcast);
            } else {
                timeReceiver.f302b.setExact(0, longValue, broadcast);
            }
        }
    }

    public void d(String str, String str2) {
        SpHelper.putString("time_policy", str);
        this.f301a = str;
        this.d = str2;
        b();
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        boolean booleanExtra = intent.getBooleanExtra("selfrun", false);
        if (!e || booleanExtra) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
            LogUtil.c(f, "onReceiver: " + simpleDateFormat.format(new Date()));
            b();
            e = true;
        }
    }
}