得物.apk(点击下载) / dy.java


package c.t.m.g;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Base64;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.tencent.location.qimei.sdk.IQimeiSDK;
import com.tencent.location.qimei.sdk.QimeiSDK;
import java.security.AlgorithmParameters;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.json.JSONObject;

/* compiled from: TML */
public class dy {

    /* renamed from: a  reason: collision with root package name */
    private static final String f2171a = "dy";
    private static dy b;

    /* renamed from: c  reason: collision with root package name */
    private final IQimeiSDK f2172c;
    private final Context d;
    private final Handler e = new Handler(bn.a("loc_qimei_thread").getLooper());

    /* compiled from: TML */
    public interface a {
        void a(String str, String str2, int i);
    }

    private dy(Context context) {
        this.d = context;
        IQimeiSDK instance = QimeiSDK.getInstance("0AND0JTZ084D0OPY");
        this.f2172c = instance;
        instance.getStrategy().enableIMEI(false).enableIMSI(false).enableMAC(false).enableOAID(false);
    }

    private boolean c() {
        for (String str : Build.SUPPORTED_ABIS) {
            if (str.contains("x86")) {
                return true;
            }
        }
        return false;
    }

    public static dy a(Context context) {
        if (b == null) {
            synchronized (dy.class) {
                if (b == null) {
                    b = new dy(context);
                }
            }
        }
        return b;
    }

    public void a() {
        Context context = this.d;
        if (context != null) {
            this.f2172c.init(context);
            this.f2172c.setAppVersion("7.3.6.0.official_1");
            return;
        }
        throw new IllegalArgumentException("context is null");
    }

    public void a(final a aVar) {
        String a5 = ei.a("LocationSDK", "q16", "");
        String a12 = ei.a("LocationSDK", "q36", "");
        if (System.currentTimeMillis() - ei.a("LocationSDK", "qimei_update_time", 0L) <= 259200000 || c()) {
            aVar.a(a5, a12, 0);
        } else {
            this.e.post(new Runnable() {
                /* class c.t.m.g.dy.AnonymousClass1 */

                public void run() {
                    String str;
                    Throwable th2;
                    Exception e;
                    String str2;
                    String str3 = "";
                    if (aVar != null && dy.this.d != null) {
                        int i = -101;
                        String token = dy.this.f2172c.getToken();
                        String str4 = dy.f2171a;
                        bt.b(str4, "token: " + token);
                        try {
                            Bundle a5 = new cy(dy.this.d, el.a(dy.this.d.getPackageName())).a("https://qlbs.map.qq.com/android", token.getBytes("UTF-8"));
                            byte[] byteArray = a5.getByteArray("data_bytes");
                            if (byteArray != null) {
                                byte[] decode = Base64.decode(byteArray, 0);
                                Cipher instance = Cipher.getInstance("AES/CBC/PKCS7Padding");
                                SecretKeySpec secretKeySpec = new SecretKeySpec(bj.a("id_qimei").getBytes(), "AES");
                                AlgorithmParameters instance2 = AlgorithmParameters.getInstance("AES");
                                instance2.init(new IvParameterSpec(bj.a("id_qimei").getBytes()));
                                instance.init(2, secretKeySpec, instance2);
                                String str5 = new String(instance.doFinal(decode), a5.getString("data_charset"));
                                String unused = dy.f2171a;
                                JSONObject jSONObject = new JSONObject(str5);
                                String string = jSONObject.getString("q16");
                                try {
                                    str3 = jSONObject.getString("q36");
                                    i = jSONObject.getInt(PushConstants.BASIC_PUSH_STATUS_CODE);
                                    ei.b("LocationSDK", "q16", string);
                                    ei.b("LocationSDK", "q36", str3);
                                    ei.b("LocationSDK", "qimei_update_time", System.currentTimeMillis());
                                    str2 = str3;
                                    str3 = string;
                                } catch (Exception e6) {
                                    e = e6;
                                    str = str3;
                                    str3 = string;
                                    try {
                                        e.printStackTrace();
                                        aVar.a(str3, str, i);
                                    } catch (Throwable th3) {
                                        th2 = th3;
                                        aVar.a(str3, str, i);
                                        throw th2;
                                    }
                                } catch (Throwable th4) {
                                    th2 = th4;
                                    str = str3;
                                    str3 = string;
                                    aVar.a(str3, str, i);
                                    throw th2;
                                }
                            } else {
                                str2 = str3;
                            }
                            aVar.a(str3, str2, i);
                        } catch (Exception e12) {
                            e = e12;
                            str = str3;
                            e.printStackTrace();
                            aVar.a(str3, str, i);
                        } catch (Throwable th5) {
                            th2 = th5;
                            str = str3;
                            aVar.a(str3, str, i);
                            throw th2;
                        }
                    }
                }
            });
        }
    }
}