智能工厂.apk(点击下载) / b.java


package cn.jiguang.v;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils;
import androidx.core.view.MotionEventCompat;
import cn.jiguang.af.a;
import cn.jiguang.ak.e;
import cn.jiguang.i.c;
import cn.jiguang.o.d;
import com.baidu.speech.utils.AsrError;
import java.nio.ByteBuffer;
import org.json.JSONObject;

public class b {
    private static long a;

    static {
        d.a("JCommon");
        d.a("JLocation");
        d.a("JArp");
    }

    private static int a(Object obj) {
        return (!(obj instanceof Bundle) || !((Bundle) obj).getBoolean("login")) ? 0 : 2;
    }

    /* JADX WARNING: Removed duplicated region for block: B:127:0x01ff A[Catch:{ Throwable -> 0x0208 }] */
    /* JADX WARNING: Removed duplicated region for block: B:128:0x0200 A[Catch:{ Throwable -> 0x0208 }] */
    public static Object a(Context context, String str, Object obj) {
        char c;
        char c2;
        String str2;
        String str3;
        String str4;
        if (context == null) {
            try {
                a.d("JCommonActionHelper", "context is null,give up continue");
                return null;
            } catch (Throwable th) {
                a.d("JCommonActionHelper", "onEvent throwable:" + th.getMessage());
            }
        } else if (TextUtils.isEmpty(str)) {
            a.d("JCommonActionHelper", "action is null,give up continue");
            return null;
        } else {
            char c3 = 0;
            switch (str.hashCode()) {
                case -835320015:
                    if (str.equals("get_all_ids")) {
                        c = 6;
                        break;
                    }
                    c = 65535;
                    break;
                case -24181482:
                    if (str.equals("get_loc_info")) {
                        c = 1;
                        break;
                    }
                    c = 65535;
                    break;
                case 385278662:
                    if (str.equals("periodtask")) {
                        c = 0;
                        break;
                    }
                    c = 65535;
                    break;
                case 781805572:
                    if (str.equals("deviceinfo")) {
                        c = 4;
                        break;
                    }
                    c = 65535;
                    break;
                case 805881853:
                    if (str.equals("getwakeenable")) {
                        c = 2;
                        break;
                    }
                    c = 65535;
                    break;
                case 1207373895:
                    if (str.equals("user_present")) {
                        c = '\t';
                        break;
                    }
                    c = 65535;
                    break;
                case 1567409176:
                    if (str.equals("filter_pkg_list")) {
                        c = 3;
                        break;
                    }
                    c = 65535;
                    break;
                case 1660517635:
                    if (str.equals("on_register")) {
                        c = 5;
                        break;
                    }
                    c = 65535;
                    break;
                case 1947980230:
                    if (str.equals("service_create")) {
                        c = 7;
                        break;
                    }
                    c = 65535;
                    break;
                case 1976348689:
                    if (str.equals("get_imei")) {
                        c = '\b';
                        break;
                    }
                    c = 65535;
                    break;
                default:
                    c = 65535;
                    break;
            }
            switch (c) {
                case 0:
                    a(context, obj);
                    break;
                case 1:
                    return cn.jiguang.ad.a.a().f(context);
                case 2:
                    return cn.jiguang.ai.a.b(context);
                case 3:
                    return cn.jiguang.ai.a.a(context, obj);
                case 4:
                    return cn.jiguang.q.b.a().f(context);
                case 5:
                    cn.jiguang.q.b.a().g(context);
                    str4 = "register";
                    cn.jiguang.ai.a.a(context, str4);
                    break;
                case 6:
                    return cn.jiguang.x.a.a(context);
                case 7:
                    cn.jiguang.p.b.a().b(context);
                    cn.jiguang.ai.a.a(context, "start");
                    cn.jiguang.ba.b.a().b(AsrError.ERROR_AUDIO_INCORRECT, 3000, new cn.jiguang.ba.a() {
                        /* class cn.jiguang.v.b.AnonymousClass1 */

                        @Override // cn.jiguang.ba.a
                        public void a(Message message) {
                        }
                    });
                    break;
                case '\b':
                    return cn.jiguang.u.d.a(context, "");
                case '\t':
                    str4 = "screen";
                    cn.jiguang.ai.a.a(context, str4);
                    break;
            }
            Bundle bundle = obj instanceof Bundle ? (Bundle) obj : null;
            if (bundle != null) {
                switch (str.hashCode()) {
                    case -1485564867:
                        if (str.equals("notification_state")) {
                            c2 = 7;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -955011762:
                        if (str.equals("init_local_ctrl")) {
                            c2 = 0;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -955005568:
                        if (str.equals("lbsenable")) {
                            c2 = 1;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -691876648:
                        if (str.equals("set_ctrl_url")) {
                            c2 = 3;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 98618:
                        if (str.equals("cmd")) {
                            c2 = 4;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 112894784:
                        if (str.equals("waked")) {
                            c2 = 5;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1391522972:
                        if (str.equals("lbsforenry")) {
                            c2 = 2;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1995819041:
                        if (str.equals("set_wake_enable")) {
                            c2 = '\b';
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 2063320150:
                        if (str.equals("set_sdktype_info")) {
                            c2 = 6;
                            break;
                        }
                        c2 = 65535;
                        break;
                    default:
                        c2 = 65535;
                        break;
                }
                switch (c2) {
                    case 1:
                        boolean z = bundle.getBoolean("enable");
                        a.a("JCommonActionHelper", "[setLBSEnable] " + z);
                        cn.jiguang.o.b.b(context, "JLocation", z);
                        break;
                    case 3:
                        cn.jiguang.ak.b.a = bundle.getString("test_wake_controll_url");
                        break;
                    case 4:
                        a(context, bundle);
                        break;
                    case 5:
                        int i = bundle.getInt("type", -1);
                        if (!TextUtils.isEmpty(bundle.getString("from_package"))) {
                            if (i != -1) {
                                e.a(context, bundle, i);
                                break;
                            } else {
                                str2 = "JCommonActionHelper";
                                str3 = "[waked]wrong waked type";
                            }
                        } else {
                            str2 = "JCommonActionHelper";
                            str3 = "[waked]empty packageName waked from ";
                        }
                        a.d(str2, str3);
                        break;
                    case 6:
                        cn.jiguang.ah.a.a().a(context, bundle);
                        break;
                    case 7:
                        cn.jiguang.ag.a.a(context, bundle.getInt("scence"));
                        break;
                    case '\b':
                        cn.jiguang.o.b.a(context, bundle.getBoolean("enable"));
                        break;
                }
            }
            Intent intent = obj instanceof Intent ? (Intent) obj : null;
            if (intent != null) {
                if (str.hashCode() == 1563192504) {
                    if (str.equals("get_receiver")) {
                        if (c3 != 0) {
                            cn.jiguang.i.b.a().a(context, intent);
                        }
                    }
                }
                c3 = 65535;
                if (c3 != 0) {
                }
            }
            return null;
        }
    }

    private static JSONObject a(Bundle bundle) {
        try {
            ByteBuffer wrap = ByteBuffer.wrap(bundle.getByteArray("RESPONSE_BODY"));
            a = wrap.getLong();
            byte[] bArr = new byte[wrap.getShort()];
            wrap.get(bArr);
            String str = new String(bArr, "UTF-8");
            a.a("JCommonActionHelper", "parseBundle2Json content: " + str);
            return new JSONObject(str);
        } catch (Exception e) {
            a.d("JCommonActionHelper", "parseBundle2Json exception:" + e.getMessage());
            return null;
        }
    }

    private static void a(Context context, int i) {
        long a2 = d.a();
        String a3 = cn.jiguang.u.a.a(context, i);
        byte[] a4 = d.a(a, a3);
        Bundle bundle = new Bundle();
        bundle.putInt("cmd", 25);
        bundle.putInt("ver", 1);
        bundle.putLong("rid", a2);
        bundle.putLong("timeout", 0);
        bundle.putByteArray("body", a4);
        if (!TextUtils.isEmpty(a3)) {
            a.a("JCommonActionHelper", "tcp report deviceInfo:" + a3);
        }
        d.a(context, bundle);
    }

    private static void a(Context context, Bundle bundle) {
        JSONObject a2 = a(bundle);
        if (a2 != null) {
            int optInt = a2.optInt("cmd");
            a(context, optInt);
            switch (optInt) {
                case 4:
                    cn.jiguang.i.a.a().c(context);
                    return;
                case 5:
                case MotionEventCompat.AXIS_GENERIC_14:
                    if (cn.jiguang.d.a.l(context)) {
                        cn.jiguang.ad.a.a().b(context, a2);
                        return;
                    }
                    return;
                case 9:
                    c.a().c(context);
                    return;
                case MotionEventCompat.AXIS_GENERIC_13:
                    cn.jiguang.i.d.a().c(context);
                    return;
                case 50:
                    cn.jiguang.ai.b.a(context, a2);
                    return;
                case 51:
                    cn.jiguang.q.d.a().a(context, a2);
                    return;
                case 52:
                    cn.jiguang.l.b.a().b(context, a2);
                    return;
                case 54:
                    cn.jiguang.i.d.a().a(context, a2);
                    return;
                case 55:
                    d.a(context, a2);
                    return;
                case 58:
                    cn.jiguang.p.b.a().a(context, a2);
                    return;
                case 70:
                    cn.jiguang.ai.a.a(context);
                    return;
                case 74:
                    cn.jiguang.i.e.a().c(context);
                    return;
                default:
                    return;
            }
        }
    }

    private static void a(Context context, Object obj) {
        cn.jiguang.l.b.a().d(context);
        if (cn.jiguang.d.a.l(context)) {
            cn.jiguang.ad.a.a().d(context);
        }
        cn.jiguang.ag.a.a(context, a(obj));
        cn.jiguang.q.b.a().b(context);
        cn.jiguang.q.c.a().b(context);
        cn.jiguang.i.a.a().b(context);
        cn.jiguang.i.e.a().b(context);
        cn.jiguang.i.b.a().b(context);
        cn.jiguang.i.d.a().b(context);
        cn.jiguang.p.b.a().c(context);
        cn.jiguang.ai.a.a(context, "heartbeat");
        cn.jiguang.ai.b.a(context, null);
        cn.jiguang.ai.c.a().b(context);
    }
}