APKPure.apk(点击下载) / i.java


package e.g.a.e0;

import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import com.apkpure.aegon.application.AegonApplication;
import com.apkpure.aegon.application.RealApplicationLike;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.messaging.FirebaseMessaging;
import com.tencent.assistant.dynamic.host.api.IHostLogger;
import com.tencent.assistant.dynamic.host.api.IShadowManagerService;
import com.tencent.raft.raftframework.RAFT;
import e.g.a.e0.q;
import e.g.a.f.j;
import e.g.a.f.l;
import e.g.a.i0.q0;
import e.g.a.i0.y0;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Objects;

public class i {

    /* renamed from: a  reason: collision with root package name */
    public static int f5715a = 0;
    public static boolean b = false;
    public static boolean c = false;
    public static boolean d = false;

    /* renamed from: e  reason: collision with root package name */
    public static boolean f5716e = false;

    /* renamed from: f  reason: collision with root package name */
    public static boolean f5717f = false;

    /* renamed from: g  reason: collision with root package name */
    public static final HashSet<String> f5718g = new HashSet<>();

    /* renamed from: h  reason: collision with root package name */
    public static final HashMap<String, Long> f5719h = new HashMap<>();

    /* renamed from: i  reason: collision with root package name */
    public static final HashMap<String, Long> f5720i = new HashMap<>();

    /* renamed from: j  reason: collision with root package name */
    public static final HashSet<String> f5721j = new HashSet<>();

    /* renamed from: k  reason: collision with root package name */
    public static final HashSet<String> f5722k = new HashSet<>();

    /* renamed from: l  reason: collision with root package name */
    public static final HashSet<String> f5723l = new HashSet<>();

    /* renamed from: m  reason: collision with root package name */
    public static final HashMap<String, String> f5724m = new HashMap<>();

    public class a implements Runnable {
        public final /* synthetic */ e.w.c.f.a b;

        public a(e.w.c.f.a aVar) {
            this.b = aVar;
        }

        public void run() {
            e.w.c.b.c().e(this.b);
        }
    }

    public class b implements OnFailureListener {
        @Override // com.google.android.gms.tasks.OnFailureListener
        public void onFailure(Exception exc) {
            int i2 = AegonApplication.f1165e;
            if (TextUtils.isEmpty(y0.a(RealApplicationLike.getContext()).b())) {
                e.g.a.c0.g.h(3, exc.getMessage() != null ? exc.getMessage() : "");
                i.f();
                return;
            }
            e.g.a.h0.b.h.z("get_push_type", q.d.firebase.name);
            e.g.a.h0.b.h.z("get_push_token", y0.a(RealApplicationLike.getContext()).b());
            e.g.a.s.l.a.D0(y0.a(RealApplicationLike.getContext()).b(), d.firebase);
        }
    }

    public class c implements OnSuccessListener<String> {
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // com.google.android.gms.tasks.OnSuccessListener
        public void onSuccess(String str) {
            String str2 = str;
            if (TextUtils.isEmpty(str2)) {
                e.g.a.c0.g.h(3, "");
                i.f();
                return;
            }
            e.g.a.h0.b.h.z("get_push_type", q.d.firebase.name);
            e.g.a.h0.b.h.z("get_push_token", str2);
            e.g.a.s.l.a.D0(str2, d.firebase);
        }
    }

    public class d implements IHostLogger {
        @Override // com.tencent.assistant.dynamic.host.api.IHostLogger
        public void debug(String str, String str2) {
        }

        @Override // com.tencent.assistant.dynamic.host.api.IHostLogger
        public void error(String str, String str2) {
        }

        @Override // com.tencent.assistant.dynamic.host.api.IHostLogger
        public void info(String str, String str2) {
        }

        @Override // com.tencent.assistant.dynamic.host.api.IHostLogger
        public void warn(String str, String str2) {
        }
    }

    public class e implements e.w.g.a.a.c {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ Application f5725a;

        public e(Application application) {
            this.f5725a = application;
        }
    }

    public class f implements Runnable {
        public void run() {
            j.a().e(j.d.PLUGIN_START_INIT, null, null);
            e a2 = e.a();
            synchronized (a2) {
                if (!e.f5707f) {
                    e.f5707f = true;
                    a2.c();
                }
            }
        }
    }

    public class g implements Runnable {
        public final /* synthetic */ Application b;
        public final /* synthetic */ String c;

        public g(Application application, String str) {
            this.b = application;
            this.c = str;
        }

        public void run() {
            i.f5718g.add("plugin_hw_push");
            i.a("plugin_hw_push", "plugin_hw_push.zip", this.b, "https://projecta-common-1258344701.file.myqcloud.com/xy/aprojectadmin/pkg_upload/20230519/plugin_hw_push-8.0.zip");
            j.a().e(j.d.PLUGIN_START_DOWNLOAD, this.c, null);
        }
    }

    public class h implements e.w.c.f.c {
        public final /* synthetic */ String b;
        public final /* synthetic */ String c;
        public final /* synthetic */ String d;

        /* renamed from: e  reason: collision with root package name */
        public final /* synthetic */ long f5726e;

        /* renamed from: f  reason: collision with root package name */
        public final /* synthetic */ Application f5727f;

        public class a implements Runnable {
            public final /* synthetic */ e.w.c.f.a b;

            public a(e.w.c.f.a aVar) {
                this.b = aVar;
            }

            public void run() {
                h hVar = h.this;
                i.a(hVar.d, hVar.b, hVar.f5727f, hVar.c);
                if (h.this.c.equals("https://projecta-common-1258344701.file.myqcloud.com/xy/aprojectadmin/pkg_upload/20230519/plugin_hw_push-8.0.zip")) {
                    HashMap hashMap = new HashMap();
                    hashMap.put(l.a.PLUGIN_PLUGIN_ERROR.getName(), this.b.p());
                    hashMap.put("times", this.b.p());
                    e.g.a.d0.a.c(q.c.downloadPluginError.name, hashMap);
                }
            }
        }

        public h(String str, String str2, String str3, long j2, Application application) {
            this.b = str;
            this.c = str2;
            this.d = str3;
            this.f5726e = j2;
            this.f5727f = application;
        }

        @Override // e.w.c.f.c
        public void onTaskCompletedMainloop(e.w.c.f.a aVar) {
            q0.a("plugin_shadow_manager", this.c + ":onDownloadSuccess()");
            i.f5721j.remove(this.b);
            i.f5723l.add(this.b);
        }

        @Override // e.w.c.f.c
        public void onTaskCompletedSubloop(e.w.c.f.a aVar) {
            l lVar;
            String str;
            l.a aVar2 = l.a.PLUGIN_DOWNLOADED;
            long j2 = ((e.w.c.f.l.e) aVar).y;
            String str2 = this.d;
            int i2 = m.b;
            o.s.c.j.e(str2, "pluginName");
            e.g.a.d0.a.f(17, "PluginDownloadResult", o.o.h.q(new o.g("name", str2), new o.g("cost_time", Long.valueOf(j2)), new o.g("return_code", "0"), new o.g("app_start_time", Long.valueOf(System.currentTimeMillis() - m.f5729a))));
            String str3 = this.c;
            if (str3 == "https://projecta-common-1258344701.file.myqcloud.com/xy/aprojectadmin/pkg_upload/20230403/plugin_shadow_manager-1.2.9.apk") {
                i.i.g.c.Y(RealApplicationLike.getContext(), "plugin_shadow_manager1.2.9", true);
                lVar = l.a();
                str = "plugin_shadow_manager";
            } else if (str3 == "https://projecta-common-1258344701.file.myqcloud.com/xy/aprojectadmin/pkg_upload/20230519/plugin_topon2-73.0.zip") {
                i.i.g.c.Y(RealApplicationLike.getContext(), "plugin_topon273", true);
                lVar = l.a();
                str = "plugin_topon2";
            } else {
                if (str3 == "https://projecta-common-1258344701.file.myqcloud.com/xy/aprojectadmin/pkg_upload/20230519/plugin_hw_push-8.0.zip") {
                    i.i.g.c.Y(RealApplicationLike.getContext(), "plugin_hw_push8.0", true);
                    l.a().b(aVar2, "plugin_hw_push");
                    e.g.a.d0.a.c(q.c.downloadPluginSuccess.name, null);
                } else {
                    HashMap hashMap = new HashMap();
                    e.w.c.f.l.e eVar = (e.w.c.f.l.e) aVar;
                    hashMap.put("cost", Long.valueOf(eVar.y));
                    hashMap.put("app_start_time", Long.valueOf(System.currentTimeMillis() - j.d));
                    hashMap.put("speed", Integer.valueOf(eVar.w()));
                    hashMap.put("name", this.b);
                    i.i.g.c.Y(RealApplicationLike.getContext(), "plugin_login7.0", true);
                    j.a().e(j.d.PLUGIN_DOWNLOADED, "plugin_login", hashMap);
                }
                i.n(this.f5727f);
            }
            lVar.b(aVar2, str);
            i.n(this.f5727f);
        }

        @Override // e.w.c.f.c
        public void onTaskDetectedMainloop(e.w.c.f.a aVar) {
        }

        @Override // e.w.c.f.c
        public void onTaskDetectedSubloop(e.w.c.f.a aVar) {
        }

        @Override // e.w.c.f.c
        public void onTaskFailedMainloop(e.w.c.f.a aVar) {
            q0.a("plugin_shadow_manager", this.c + ":onDownloadFailed() mainloop");
            i.f5721j.remove(this.b);
            i.f5722k.remove(this.b);
            String str = this.b;
            if ("plugin_login.zip".equals(str)) {
                i.d = false;
            } else if ("plugin_shadow_manager.plg".equals(str)) {
                i.c = false;
            }
            e.w.c.f.l.e eVar = (e.w.c.f.l.e) aVar;
            String p2 = eVar.p();
            i.f5724m.put(this.b, p2);
            l.a().b(l.a.PLUGIN_PLUGIN_ERROR, p2);
            j.a().e(j.d.PLUGIN_PLUGIN_ERROR, p2, null);
            String str2 = this.d;
            long currentTimeMillis = System.currentTimeMillis() - this.f5726e;
            int i2 = m.b;
            o.s.c.j.e(str2, "pluginName");
            o.s.c.j.e(p2, "code");
            e.g.a.d0.a.f(17, "PluginDownloadResult", o.o.h.q(new o.g("name", str2), new o.g("return_code", p2), new o.g("cost_time", Long.valueOf(currentTimeMillis)), new o.g("app_start_time", Long.valueOf(System.currentTimeMillis() - m.f5729a))));
            if (i.f5715a < 4) {
                e.g.a.i0.f2.a.d().postDelayed(new a(eVar), 3000);
                i.f5715a++;
            }
        }

        @Override // e.w.c.f.c
        public void onTaskFailedSubloop(e.w.c.f.a aVar) {
            q0.a("plugin_shadow_manager", this.c + ":onDownloadFailed()");
        }

        @Override // e.w.c.f.c
        public void onTaskPausedMainloop(e.w.c.f.a aVar) {
        }

        @Override // e.w.c.f.c
        public void onTaskPausedSubloop(e.w.c.f.a aVar) {
        }

        @Override // e.w.c.f.c
        public void onTaskPendingMainloop(e.w.c.f.a aVar) {
            StringBuilder Z = e.d.a.a.a.Z("onTaskPendingMainloop: pluginName=");
            Z.append(this.b);
            e.f.a.g.a.a("PluginDownloadManager", Z.toString(), new Object[0]);
        }

        @Override // e.w.c.f.c
        public void onTaskReceivedMainloop(e.w.c.f.a aVar) {
        }

        @Override // e.w.c.f.c
        public void onTaskReceivedSubloop(e.w.c.f.a aVar) {
            q0.a("plugin_shadow_manager", this.c + ":progress:" + ((e.w.c.f.l.e) aVar).o());
        }

        @Override // e.w.c.f.c
        public void onTaskStartedMainloop(e.w.c.f.a aVar) {
            e.f.a.g.a.a("PluginDownloadManager", "download plugin started: %s, url=%s", this.b, this.c);
            i.f5722k.remove(this.b);
            i.f5721j.add(this.b);
            i.f5719h.put(((e.w.c.f.l.e) aVar).v, 0L);
            i.f5720i.put(((e.w.c.f.l.e) aVar).v, Long.valueOf(System.currentTimeMillis()));
            j a2 = j.a();
            String str = this.b;
            Objects.requireNonNull(a2);
            HashMap hashMap = new HashMap();
            hashMap.put("name", str);
            hashMap.put("app_start_time", Long.valueOf(System.currentTimeMillis() - j.d));
            e.g.a.i0.f2.a.a().postDelayed(new e.g.a.f.i(a2, hashMap, str), 0);
            String str2 = this.d;
            long currentTimeMillis = System.currentTimeMillis() - this.f5726e;
            int i2 = m.b;
            o.s.c.j.e(str2, "pluginName");
            e.g.a.d0.a.f(17, "PluginDownloadStarted", o.o.h.q(new o.g("name", str2), new o.g("cost_time", Long.valueOf(currentTimeMillis)), new o.g("app_start_time", Long.valueOf(System.currentTimeMillis() - m.f5729a))));
        }

        @Override // e.w.c.f.c
        public void onTaskStartedSubloop(e.w.c.f.a aVar) {
        }
    }

    public static void a(String str, String str2, Application application, String str3) {
        f5722k.add(str2);
        e.f.a.g.a.a("PluginDownloadManager", "try download plugin: %s, url=%s", str2, str3);
        int i2 = m.b;
        o.s.c.j.e(str, "pluginName");
        o.s.c.j.e(str3, ImagesContract.URL);
        e.g.a.d0.a.f(17, "PluginStartDownload", o.o.h.q(new o.g("name", str), new o.g(ImagesContract.URL, str3), new o.g("app_start_time", Long.valueOf(System.currentTimeMillis() - m.f5729a))));
        long currentTimeMillis = System.currentTimeMillis();
        e.w.c.b c2 = e.w.c.b.c();
        e.w.c.f.a a2 = c2.a(str3, application.getFilesDir() + "", str2, new h(str2, str3, str, currentTimeMillis, application));
        e.w.c.f.l.e eVar = (e.w.c.f.l.e) a2;
        eVar.V(str2);
        e.w.c.b.c().e(a2);
        e.g.a.i0.f2.a.d().postDelayed(new a(a2), 2000);
        q0.a("plugin_shadow_manager", "QDS createNewTask url:" + eVar.f() + ",path:" + eVar.x());
        StringBuilder sb = new StringBuilder();
        sb.append(str3);
        sb.append(":startDownload()");
        e.d.a.a.a.D0(sb, str2, "plugin_shadow_manager");
    }

    public static String b(Context context) {
        return context.getFilesDir() + "/" + "plugin_hw_push.zip";
    }

    public static String c(Context context) {
        return context.getFilesDir() + "/" + "plugin_login.zip";
    }

    public static String d(Context context) {
        return context.getFilesDir() + "/" + "plugin_shadow_manager.plg";
    }

    public static String e(Context context) {
        return context.getFilesDir() + "/" + "plugin_topon2.zip";
    }

    public static void f() {
        f5717f = true;
        q a2 = q.a();
        Objects.requireNonNull(a2);
        e.g.a.i0.f2.a.d().postDelayed(new r(a2), 3000);
        e.g.a.h0.b.h.z("get_push_type", q.d.gettingHuawei.name);
        e.g.a.d0.a.c(q.c.startInit.name, null);
    }

    public static boolean g(Context context) {
        return h(context) && i(context);
    }

    public static boolean h(Context context) {
        return new File(c(context)).exists() && i.i.g.c.E(RealApplicationLike.getContext(), "plugin_login7.0");
    }

    public static boolean i(Context context) {
        return new File(d(context)).exists() && i.i.g.c.E(RealApplicationLike.getContext(), "plugin_shadow_manager1.2.9");
    }

    public static boolean j(String str) {
        return f5718g.contains(str);
    }

    public static boolean k(Context context) {
        return new File(e(context)).exists() && i.i.g.c.E(RealApplicationLike.getContext(), "plugin_topon273");
    }

    public static boolean l(Context context) {
        return new File(b(context)).exists() && i.i.g.c.E(RealApplicationLike.getContext(), "plugin_hw_push8.0");
    }

    public static void m(Application application) {
        e.g.a.c0.g.h(2, "");
        FirebaseMessaging.a().c.g().continueWith(e.l.c.v.j.f10128a).addOnSuccessListener(new c()).addOnFailureListener(new b());
        l.a().b(l.a.PLUGIN_START_LOAD, null);
        j.a().e(j.d.PLUGIN_START_LOAD, null, null);
        IShadowManagerService iShadowManagerService = (IShadowManagerService) RAFT.get(IShadowManagerService.class);
        iShadowManagerService.onShadowHostCreate(application, "", "plugin_shadow_manager", new d());
        iShadowManagerService.onResHubCreate(new e(application), 3600000, false);
    }

    public static void n(Application application) {
        if (k(application)) {
            i(application);
        }
        g(application);
        boolean z = false;
        if (k(application) && i(application)) {
            e.g.a.i0.f2.a.d().post(new j(application));
        }
        if (g(application)) {
            e.g.a.i0.f2.a.d().postDelayed(new f(), 3000);
        }
        if (l(application) && i(application)) {
            z = true;
        }
        if (z && f5717f) {
            q a2 = q.a();
            Objects.requireNonNull(a2);
            e.g.a.i0.f2.a.d().postDelayed(new r(a2), 3000);
        }
    }

    public static void o(Application application, String str) {
        if (!f5716e && !l(application) && str.equals("plugin_hw_push") && f5717f) {
            e.g.a.i0.f2.a.d().postDelayed(new g(application, str), 3000);
            f5716e = true;
            e.g.a.d0.a.c(q.c.startDownloadPlugin.name, null);
        }
    }
}