导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - C1661.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 C1661.java JAVA 源代码文件

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


package amc.cd.p251;

import amc.cd.p363.C2267;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.hailiang.advlib.common.d;
import com.hailiang.advlib.common.e;
import com.hailiang.advlib.core.QMConfig;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONObject;

public class C1661 {

    public static AtomicInteger f3088;

    public static String f3089;

    public static List<InterfaceC1660> f3090;

    public static volatile boolean f3091;

    public static String f3092;

    public static final String f3093;

    public static InterfaceC1655 f3094;

    public static volatile C1666 f3095;

    public static long f3096;

    public static String f3097;

    public static final char[] f3098;

    public static String f3099;

    public static int f3100;

    public static final String f3101;

    public static boolean f3102;

    public static String f3103;

    public static long f3104;

    public static Context f3105;

    public static boolean f3106;

    public static String f3107;

    public static int f3108;

    public static String f3109;

    public static String f3110;

    public static class RunnableC1662 implements Runnable {

        public final long f3111;

        public final boolean f3112;

        public final boolean f3113;

        public RunnableC1662(boolean z, boolean z2, long j) {
            this.f3112 = z;
            this.f3113 = z2;
            this.f3111 = j;
        }

        @Override
        public void run() {
            Map<String, String> m2384 = C1661.m2384();
            if (C1661.m2367()) {
                d.a(C1661.f3105, C1661.f3089.equals(C1661.f3101), this.f3112, this.f3113, this.f3111, C1661.f3104, m2384);
            } else {
                d.a(C1661.f3105, C1661.f3089.equals(C1661.f3101), this.f3112, this.f3113, "unknow", C1661.f3104, m2384);
            }
        }
    }

    public static class RunnableC1663 implements Runnable {

        public final JSONObject f3114;

        public RunnableC1663(JSONObject jSONObject) {
            this.f3114 = jSONObject;
        }

        @Override
        public void run() {
            C1661.m2369(this.f3114);
        }
    }

    public static class RunnableC1664 implements Runnable {

        public final QMConfig f3115;

        public RunnableC1664(QMConfig qMConfig) {
            this.f3115 = qMConfig;
        }

        @Override
        public void run() {
            if (C1661.m2378(C1661.f3105)) {
                C1657.m2350().m2356(this.f3115);
            }
        }
    }

    public static class RunnableC1665 implements Runnable {

        public final boolean f3116;

        public final Throwable f3117;

        public final boolean f3118;

        public RunnableC1665(Throwable th, boolean z, boolean z2) {
            this.f3117 = th;
            this.f3118 = z;
            this.f3116 = z2;
        }

        @Override
        public void run() {
            try {
                d.a(C1661.f3105, this.f3117.getMessage(), C1661.m2381(this.f3117), C1661.m2384(), this.f3118, this.f3116);
            } catch (Throwable unused) {
            }
        }
    }

    static {
        String str = Build.VERSION.RELEASE;
        f3093 = str.contains("12") ? "_hailiang_localjar" : "_hailiang_local.jar";
        f3101 = str.contains("12") ? "_hailiang_remotejar" : "_hailiang_remote.jar";
        f3109 = "https://update0.qquanquan.com/qm/nsdk/cgi/";
        f3089 = null;
        f3103 = null;
        f3097 = null;
        f3095 = null;
        f3098 = new char[0];
        f3088 = new AtomicInteger(0);
        f3091 = false;
        f3104 = 0L;
        f3096 = 0L;
        f3090 = new CopyOnWriteArrayList();
        f3100 = 0;
    }

    public static void m2361(QMConfig qMConfig) {
        boolean z;
        if (m2382(f3105)) {
            StringBuilder sb = new StringBuilder();
            sb.append(f3097);
            sb.append("/");
            String str = f3101;
            sb.append(str);
            File file = new File(sb.toString());
            int[] m2383 = m2383(f3105);
            f3104 = 0L;
            if (file.length() <= 0 || m2383[1] != 1) {
                StringBuilder sb2 = new StringBuilder();
                sb2.append(f3097);
                sb2.append("/");
                String str2 = f3093;
                sb2.append(str2);
                if (new File(sb2.toString()).length() <= 0 || m2383[0] != 1) {
                    m2371();
                    z = true;
                    m2379(f3089);
                    f3108 = 0;
                    f3091 = true;
                    m2375();
                    m2373(z, false);
                    m2364(qMConfig);
                }
                f3089 = str2;
                f3107 = f3110;
                f3102 = false;
            } else {
                f3089 = str;
                f3107 = f3099;
                f3102 = true;
            }
            z = false;
            m2379(f3089);
            f3108 = 0;
            f3091 = true;
            m2375();
            m2373(z, false);
            m2364(qMConfig);
        }
    }

    public static boolean m2363(QMConfig qMConfig, @NonNull InterfaceC1655 interfaceC1655) {
        f3092 = qMConfig.getVersionName();
        f3094 = interfaceC1655;
        if (f3088.getAndIncrement() > 0) {
            return false;
        }
        Context context = qMConfig.getContext();
        f3105 = context;
        d.a(context);
        f3096 = System.currentTimeMillis();
        m2361(qMConfig);
        return false;
    }

    public static void m2364(QMConfig qMConfig) {
        d.a(new RunnableC1664(qMConfig), 100L);
    }

    public static boolean m2365() {
        return false;
    }

    public static boolean m2367() {
        return f3095 != null && f3095.m2388();
    }

    public static Bundle m2368() {
        Bundle bundle = new Bundle();
        bundle.putString("expectedSdkVersion", f3107);
        bundle.putString("sdkVersion", f3094.b());
        return bundle;
    }

    public static void m2369(JSONObject jSONObject) {
        if (!m2365() && f3100 <= 2) {
            try {
                if (f3097 == null || f3103 == null) {
                    m2382(f3105);
                }
                new C1666(f3097 + "/" + f3101, f3103, null, C1661.class.getClassLoader());
                f3100 = 0;
                if (jSONObject.has("version")) {
                    m2385(f3105, jSONObject.getString("version"));
                }
            } catch (Throwable unused) {
                f3100++;
                d.a(new RunnableC1663(jSONObject), 5000L);
            }
        }
    }

    public static void m2371() {
        try {
            File file = new File(f3097 + "/" + f3093);
            try {
                if (file.exists()) {
                    file.delete();
                }
            } catch (Throwable unused) {
            }
            InputStream open = f3105.getAssets().open(f3094.c());
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            e.b(open, fileOutputStream);
            fileOutputStream.close();
            open.close();
            file.setReadOnly();
            f3089 = f3093;
            f3107 = "3.468";
            f3102 = false;
            m2376(f3105);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Throwable unused2) {
        }
        f3089 = f3093;
        f3107 = "3.468";
    }

    public static void m2372(Throwable th, boolean z, boolean z2) {
        d.a(new RunnableC1665(th, z, z2), 100L);
    }

    public static void m2373(boolean z, boolean z2) {
        d.a(new RunnableC1662(z, z2, System.currentTimeMillis() - f3096), 100L);
        if (m2367()) {
            return;
        }
        f3088.decrementAndGet();
    }

    public static void m2374() {
        Context context = f3105;
        if (context == null) {
            return;
        }
        SharedPreferences sharedPreferences = context.getSharedPreferences("hailiang_loadremote_config", 0);
        if (TextUtils.equals(sharedPreferences.getString("lastLoadDexVersion", ""), f3107)) {
            f3106 = false;
        } else {
            f3106 = true;
            sharedPreferences.edit().putString("lastLoadDexVersion", f3107).commit();
        }
    }

    public static void m2375() {
        for (InterfaceC1660 interfaceC1660 : f3090) {
            interfaceC1660.m2359(m2367(), m2368());
            f3090.remove(interfaceC1660);
        }
    }

    public static void m2376(Context context) {
        try {
            context.getSharedPreferences("hailiang_loadremote_config", 0).edit().putString("aisdk_lib_local", "3.468").apply();
        } catch (Throwable unused) {
        }
    }

    public static boolean m2378(Context context) {
        if (context != null && context.getApplicationContext() != null) {
            try {
                return context.getApplicationContext().getPackageName().equals(e.c(context));
            } catch (Throwable unused) {
            }
        }
        return true;
    }

    public static void m2379(String str) throws ClassNotFoundException {
        f3095 = null;
        C2267.m3389().m3392("loadD");
        f3095 = new C1666(f3097 + "/" + str, f3103, null, C1661.class.getClassLoader());
        C2267.m3389().m3396("loadD");
        f3095.m2387(f3094.e());
        m2374();
    }

    public static boolean m2380(String str, String str2) {
        try {
            return str.compareTo(str2) >= 0;
        } catch (Throwable unused) {
            return false;
        }
    }

    public static String m2381(Throwable th) {
        try {
            StringWriter stringWriter = new StringWriter();
            th.printStackTrace(new PrintWriter(stringWriter));
            return URLEncoder.encode(stringWriter.toString(), "UTF-8");
        } catch (Throwable unused) {
            return "";
        }
    }

    public static boolean m2382(Context context) {
        try {
            if (f3097 != null) {
                return true;
            }
            f3097 = context.getDir("qm", 0).getAbsolutePath();
            f3103 = context.getCodeCacheDir().getAbsolutePath();
            return true;
        } catch (NullPointerException e) {
            e.printStackTrace();
            return false;
        }
    }

    public static int[] m2383(Context context) {
        try {
            SharedPreferences sharedPreferences = context.getSharedPreferences("hailiang_loadremote_config", 0);
            f3110 = sharedPreferences.getString("aisdk_lib_local", "1.0");
            f3099 = sharedPreferences.getString("aisdk_lib_version", "1.0");
            return new int[]{m2380(f3110, "3.468") ? 1 : 0, m2380(f3099, "3.468") ? 1 : 0};
        } catch (Throwable th) {
            d.a(context, th.getMessage());
            return new int[]{0, 0};
        }
    }

    public static Map<String, String> m2384() {
        HashMap hashMap = new HashMap();
        try {
            hashMap.put("opt_isRemote", (f3102 ? 1 : 0) + "");
            hashMap.put("opt_local_version", f3110);
            hashMap.put("opt_remote_version", f3099);
            hashMap.put("opt_is_update", "1");
            hashMap.put("opt_channel", "hailiang");
            hashMap.put("opt_is_androidx", String.valueOf(e.a()));
            hashMap.put("opt_new_inside_version", "15.434");
            hashMap.put("opt_load_version", f3107);
            hashMap.put("opt_time", System.currentTimeMillis() + "");
            hashMap.put("opt_location", String.valueOf(f3108));
            hashMap.put("opt_lib_pkgname", C1667.m2389());
            hashMap.put("opt_is_first_load", String.valueOf(f3106));
            if (f3105 != null) {
                String m2393 = C1668.m2390().m2393(f3105);
                String m2394 = C1668.m2390().m2394(f3105);
                hashMap.put("opt_app_t", m2393);
                hashMap.put("opt_app_o", m2394);
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
        return hashMap;
    }

    public static void m2385(Context context, String str) {
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            context.getSharedPreferences("hailiang_loadremote_config", 0).edit().putString("aisdk_lib_version", str).commit();
        } catch (Throwable unused) {
        }
    }

    public static String m2386(Context context) {
        try {
            SharedPreferences sharedPreferences = context.getSharedPreferences("hailiang_loadremote_config", 0);
            String string = sharedPreferences.getString("ruid", "");
            if (!TextUtils.isEmpty(string)) {
                return string;
            }
            String uuid = UUID.randomUUID().toString();
            sharedPreferences.edit().putString("ruid", uuid).apply();
            return uuid;
        } catch (Throwable unused) {
            return "";
        }
    }
}