WeChat.apk(点击下载) / AppChooserUI.java


package com.tencent.mm.pluginsdk.ui.tools;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import c04.e;
import com.tencent.mm.R;
import com.tencent.mm.plugin.downloader.model.FileDownloadTaskInfo;
import com.tencent.mm.plugin.downloader.model.u;
import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever;
import com.tencent.mm.pluginsdk.model.app.j0;
import com.tencent.mm.pluginsdk.model.i1;
import com.tencent.mm.pluginsdk.model.j1;
import com.tencent.mm.pluginsdk.model.k1;
import com.tencent.mm.sdk.platformtools.ChannelUtil;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.Util;
import com.tencent.mm.storage.t1;
import com.tencent.mm.ui.ListViewInScrollView;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.widget.imageview.WeImageView;
import com.tencent.mm.ui.x4;
import com.tencent.mm.vfs.u1;
import com.tencent.mm.view.recyclerview.WxRecyclerAdapter;
import com.tencent.mm.view.recyclerview.WxRecyclerView;
import com.tencent.thumbplayer.tplayer.plugins.report.TPReportKeys;
import com.tencent.xweb.updater.IXWebBroadcastListener;
import d60.z;
import i72.a$$a;
import i84.l;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import jn.c;
import kq.y;
import p64.w;
import p64.w$$d;

@i14.a(7)
public class AppChooserUI extends MMActivity {

    /* renamed from: y0  reason: collision with root package name */
    public static final /* synthetic */ int f172798y0 = 0;
    public int A = 0;
    public p B = null;
    public p C = new p(this);
    public ArrayList<p> D = new ArrayList<>();
    public ArrayList<p> E = new ArrayList<>();
    public boolean F = false;
    public String G;
    public String H = null;
    public int I;
    public int J;
    public boolean K = false;
    public boolean L = false;
    public boolean M = false;
    public long N;
    public s P = s.UNINSTALL;
    public r Q;
    public AdapterView.OnItemClickListener R = new b();
    public DialogInterface.OnClickListener S = new c();
    public View.OnClickListener T = new d();
    public DialogInterface.OnClickListener U = new e();
    public l.b<i84.o> V = new f();
    public View.OnClickListener W = new g();
    public w$$d X = new h();
    public w$$d Y = new i();
    public DialogInterface.OnDismissListener Z = new j();

    /* renamed from: e  reason: collision with root package name */
    public PackageManager f172799e;

    /* renamed from: f  reason: collision with root package name */
    public n f172800f;

    /* renamed from: g  reason: collision with root package name */
    public w f172801g;

    /* renamed from: h  reason: collision with root package name */
    public WxRecyclerView f172802h;

    /* renamed from: i  reason: collision with root package name */
    public WxRecyclerAdapter<p> f172803i;

    /* renamed from: j  reason: collision with root package name */
    public final p f172804j;

    /* renamed from: n  reason: collision with root package name */
    public w f172805n;

    /* renamed from: o  reason: collision with root package name */
    public WxRecyclerView f172806o;

    /* renamed from: p  reason: collision with root package name */
    public WxRecyclerAdapter<p> f172807p;

    /* renamed from: p0  reason: collision with root package name */
    public u f172808p0 = new a();

    /* renamed from: q  reason: collision with root package name */
    public p f172809q;

    /* renamed from: r  reason: collision with root package name */
    public p f172810r;

    /* renamed from: s  reason: collision with root package name */
    public boolean f172811s = true;

    /* renamed from: t  reason: collision with root package name */
    public Intent f172812t = null;

    /* renamed from: u  reason: collision with root package name */
    public int f172813u;

    /* renamed from: v  reason: collision with root package name */
    public String f172814v = null;

    /* renamed from: w  reason: collision with root package name */
    public Bundle f172815w = null;

    /* renamed from: x  reason: collision with root package name */
    public j1 f172816x = null;

    /* renamed from: x0  reason: collision with root package name */
    public List<Integer> f172817x0 = Arrays.asList(1, 2, 8, 7);

    /* renamed from: y  reason: collision with root package name */
    public ArrayList<String> f172818y = null;

    /* renamed from: z  reason: collision with root package name */
    public int f172819z = 0;

    public class a implements u {
        public a() {
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void B(long j15) {
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void R(long j15, String str) {
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void T(long j15) {
            t1 i15 = z.s().i();
            AppChooserUI appChooserUI = AppChooserUI.this;
            i15.K(AppChooserUI.U7(274560, appChooserUI.H, appChooserUI.f172813u), 0L);
            AppChooserUI.this.Y7(s.UNINSTALL);
            n nVar = AppChooserUI.this.f172800f;
            if (nVar != null) {
                nVar.notifyDataSetChanged();
            }
            WxRecyclerAdapter<p> wxRecyclerAdapter = AppChooserUI.this.f172803i;
            if (wxRecyclerAdapter != null) {
                wxRecyclerAdapter.notifyDataSetChanged();
            }
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void V(long j15, String str) {
            AppChooserUI.this.N = j15;
            t1 i15 = z.s().i();
            AppChooserUI appChooserUI = AppChooserUI.this;
            i15.K(AppChooserUI.U7(274560, appChooserUI.H, appChooserUI.f172813u), Long.valueOf(AppChooserUI.this.N));
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void d(long j15, int i15, boolean z15) {
            t1 i16 = z.s().i();
            AppChooserUI appChooserUI = AppChooserUI.this;
            i16.K(AppChooserUI.U7(274560, appChooserUI.H, appChooserUI.f172813u), 0L);
            AppChooserUI.this.Y7(s.UNINSTALL);
            n nVar = AppChooserUI.this.f172800f;
            if (nVar != null) {
                nVar.notifyDataSetChanged();
            }
            WxRecyclerAdapter<p> wxRecyclerAdapter = AppChooserUI.this.f172803i;
            if (wxRecyclerAdapter != null) {
                wxRecyclerAdapter.notifyDataSetChanged();
            }
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void h(long j15, String str, boolean z15) {
            if (!Util.isNullOrNil(str) && u1.k(str)) {
                t1 i15 = z.s().i();
                AppChooserUI appChooserUI = AppChooserUI.this;
                i15.K(AppChooserUI.U7(274560, appChooserUI.H, appChooserUI.f172813u), Long.valueOf(AppChooserUI.this.N));
                AppChooserUI.this.Y7(s.DOWNLOADED);
                AppChooserUI appChooserUI2 = AppChooserUI.this;
                n nVar = appChooserUI2.f172800f;
                if (nVar != null && appChooserUI2.N == j15) {
                    nVar.notifyDataSetChanged();
                }
                AppChooserUI appChooserUI3 = AppChooserUI.this;
                WxRecyclerAdapter<p> wxRecyclerAdapter = appChooserUI3.f172803i;
                if (wxRecyclerAdapter != null && appChooserUI3.N == j15) {
                    wxRecyclerAdapter.notifyDataSetChanged();
                }
            }
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void q(long j15, String str, long j16, long j17) {
        }

        @Override // com.tencent.mm.plugin.downloader.model.u
        public void x(long j15) {
        }
    }

    public class b implements AdapterView.OnItemClickListener {
        public b() {
        }

        @Override // android.widget.AdapterView.OnItemClickListener
        public void onItemClick(AdapterView<?> adapterView, View view, int i15, long j15) {
            p pVar;
            ResolveInfo resolveInfo;
            ArrayList arrayList = new ArrayList();
            arrayList.add(adapterView);
            arrayList.add(view);
            arrayList.add(Integer.valueOf(i15));
            arrayList.add(Long.valueOf(j15));
            Object[] array = arrayList.toArray();
            arrayList.clear();
            j30.a.b("com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$1", "android/widget/AdapterView$OnItemClickListener", "onItemClick", "(Landroid/widget/AdapterView;Landroid/view/View;IJ)V", this, array);
            AppChooserUI appChooserUI = AppChooserUI.this;
            n nVar = appChooserUI.f172800f;
            if (nVar != null) {
                appChooserUI.B = nVar.getItem(i15);
                AppChooserUI.this.f172800f.notifyDataSetChanged();
                r rVar = AppChooserUI.this.Q;
                if (rVar != null && rVar.f172853b.isShowing()) {
                    AppChooserUI appChooserUI2 = AppChooserUI.this;
                    p pVar2 = appChooserUI2.B;
                    if (pVar2 == null || !pVar2.f172847g || (pVar2.f172850j && (pVar2.f172848h || appChooserUI2.I >= appChooserUI2.J))) {
                        appChooserUI2.Q.a(true);
                    } else {
                        appChooserUI2.Q.a(false);
                    }
                }
                AppChooserUI appChooserUI3 = AppChooserUI.this;
                if (!((appChooserUI3.f172819z != 6 && appChooserUI3.f172813u != 2) || (pVar = appChooserUI3.B) == null || (resolveInfo = pVar.f172844d) == null)) {
                    appChooserUI3.X7(-1, resolveInfo.activityInfo.packageName, false);
                    com.tencent.mm.plugin.report.service.q.INSTANCE.g(12809, 4, AppChooserUI.this.B.f172844d.activityInfo.packageName);
                }
            }
            j30.a.g(this, "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$1", "android/widget/AdapterView$OnItemClickListener", "onItemClick", "(Landroid/widget/AdapterView;Landroid/view/View;IJ)V");
        }
    }

    public class c implements DialogInterface.OnClickListener {
        public c() {
        }

        public void onClick(DialogInterface dialogInterface, int i15) {
            p pVar = AppChooserUI.this.B;
            if (pVar != null && pVar.f172844d != null) {
                t1 i16 = z.s().i();
                AppChooserUI appChooserUI = AppChooserUI.this;
                i16.K(AppChooserUI.U7(274528, appChooserUI.H, appChooserUI.f172813u), AppChooserUI.this.B.f172844d.activityInfo.packageName);
                AppChooserUI appChooserUI2 = AppChooserUI.this;
                e.h(appChooserUI2.H, appChooserUI2.f172813u);
                AppChooserUI appChooserUI3 = AppChooserUI.this;
                appChooserUI3.X7(-1, appChooserUI3.B.f172844d.activityInfo.packageName, true);
            }
        }
    }

    public class d implements View.OnClickListener {
        public d() {
        }

        public void onClick(View view) {
            String str;
            String str2;
            ResolveInfo resolveInfo;
            ArrayList arrayList = new ArrayList();
            arrayList.add(view);
            Object[] array = arrayList.toArray();
            arrayList.clear();
            j30.a.b("com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$3", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V", this, array);
            AppChooserUI appChooserUI = AppChooserUI.this;
            p pVar = appChooserUI.f172810r;
            if (pVar == appChooserUI.f172804j || (resolveInfo = pVar.f172844d) == null) {
                str = "";
            } else {
                str = resolveInfo.activityInfo.packageName;
            }
            t1 i15 = z.s().i();
            AppChooserUI appChooserUI2 = AppChooserUI.this;
            i15.K(AppChooserUI.U7(274528, appChooserUI2.H, appChooserUI2.f172813u), str);
            AppChooserUI appChooserUI3 = AppChooserUI.this;
            e.h(appChooserUI3.H, appChooserUI3.f172813u);
            AppChooserUI appChooserUI4 = AppChooserUI.this;
            appChooserUI4.f172811s = false;
            appChooserUI4.f172805n.n();
            AppChooserUI.this.f172801g.n();
            AppChooserUI appChooserUI5 = AppChooserUI.this;
            p pVar2 = appChooserUI5.f172810r;
            if (pVar2 == appChooserUI5.f172804j) {
                str2 = appChooserUI5.getString(R.string.f367413sz);
            } else {
                str2 = pVar2.f172845e.toString();
            }
            AppChooserUI appChooserUI6 = AppChooserUI.this;
            ((pp.h) yz3.j.c(pp.h.class)).ai(4, appChooserUI6.A, str2, appChooserUI6.H);
            j30.a.g(this, "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$3", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V");
        }
    }

    public class e implements DialogInterface.OnClickListener {
        public e() {
        }

        public void onClick(DialogInterface dialogInterface, int i15) {
            ResolveInfo resolveInfo;
            AppChooserUI appChooserUI = AppChooserUI.this;
            p pVar = appChooserUI.B;
            if (pVar != null && (resolveInfo = pVar.f172844d) != null) {
                appChooserUI.X7(-1, resolveInfo.activityInfo.packageName, false);
            }
        }
    }

    public class f implements l.b<i84.o> {
        public f() {
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [androidx.recyclerview.widget.RecyclerView$e, android.view.View, int, androidx.recyclerview.widget.RecyclerView$z] */
        @Override // i84.l.b
        public void E3(RecyclerView.e<i84.o> eVar, View view, int i15, i84.o oVar) {
            p pVar = AppChooserUI.this.D.get(i15);
            ((pp.h) yz3.j.c(pp.h.class)).ai(2, AppChooserUI.this.A, pVar.f172845e.toString(), AppChooserUI.this.H);
            if (!pVar.f172848h || pVar.f172844d == null) {
                AppChooserUI appChooserUI = AppChooserUI.this;
                if (pVar != appChooserUI.C) {
                    return;
                }
                if (!pVar.f172850j || pVar.f172849i) {
                    i1.r(appChooserUI.getContext(), null, null, null, Integer.toString(hashCode()), "OTHER_APP_OPEN", null);
                    return;
                }
                return;
            }
            p64.q qVar = new p64.q(AppChooserUI.this);
            qVar.g(AppChooserUI.this.getString(R.string.g_6));
            qVar.a(true);
            qVar.m(R.string.f367025i4);
            qVar.l(new AppChooserUI$f$$a(this, pVar));
            qVar.i(new a$$a());
            qVar.o();
        }
    }

    public class g implements View.OnClickListener {
        public g() {
        }

        public void onClick(View view) {
            s sVar;
            ArrayList arrayList = new ArrayList();
            arrayList.add(view);
            Object[] array = arrayList.toArray();
            arrayList.clear();
            j30.a.b("com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$6", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V", this, array);
            Log.i("MicroMsg.AppChooserUI", "mDownloadOnClickListener");
            AppChooserUI appChooserUI = AppChooserUI.this;
            if (appChooserUI.f172800f != null) {
                if (appChooserUI.Z7()) {
                    sVar = appChooserUI.P;
                } else {
                    sVar = appChooserUI.f172800f.f172837e;
                }
                if (sVar == s.UNINSTALL) {
                    r rVar = appChooserUI.Q;
                    if (rVar != null && rVar.f172853b.isShowing()) {
                        appChooserUI.Q.f172853b.dismiss();
                    }
                    if (!Util.isNullOrNil(appChooserUI.f172816x.g())) {
                        Intent intent = new Intent();
                        intent.putExtra("rawUrl", appChooserUI.f172816x.g());
                        sv3.b.j(appChooserUI.getContext(), "webview", ".ui.tools.WebViewUI", intent, null);
                    } else {
                        Intent intent2 = new Intent();
                        intent2.setClassName(appChooserUI.getContext(), "com.tencent.mm.plugin.webview.ui.tools.WebViewDownloadUI");
                        intent2.putExtra("task_name", appChooserUI.f172816x.d());
                        intent2.putExtra("task_download_type", 1);
                        c.a c15 = appChooserUI.f172816x.c();
                        String d15 = appChooserUI.f172816x.d();
                        if (c15.f241340d > 0) {
                            d15 = appChooserUI.getResources().getString(c15.f241340d);
                        } else if (!Util.isNullOrNil(c15.f241341e)) {
                            d15 = c15.f241341e;
                        }
                        intent2.putExtra(FFmpegMetadataRetriever.METADATA_KEY_TITLE, d15);
                        intent2.putExtra("icon_res_id", c15.f241337a);
                        if (appChooserUI.f172819z == 1) {
                            intent2.putExtra("task_url", "http://appchannel.html5.qq.com/directdown?app=qqbrowser&channel=10375");
                        } else {
                            intent2.putExtra("task_url", appChooserUI.f172816x.e());
                        }
                        intent2.putExtra("fileType", 1);
                        intent2.putExtra(IXWebBroadcastListener.PACKAGE_NAME, appChooserUI.f172816x.f());
                        k30.a aVar = new k30.a();
                        aVar.c(intent2);
                        j30.a.d(appChooserUI, aVar.b(), "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI", "tryDownloadQB", "()V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
                        appChooserUI.startActivity((Intent) aVar.a(0));
                        j30.a.e(appChooserUI, "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI", "tryDownloadQB", "()V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
                    }
                    k1 a15 = k1.a();
                    int i15 = appChooserUI.f172813u;
                    a15.getClass();
                    if (i15 == 0) {
                        com.tencent.mm.plugin.report.service.q.INSTANCE.g(10998, 2);
                    } else if (i15 == 1) {
                        com.tencent.mm.plugin.report.service.q.INSTANCE.g(11091, 2);
                    }
                    if (appChooserUI.f172813u == 0) {
                        if (appChooserUI.L) {
                            com.tencent.mm.plugin.report.service.q.INSTANCE.g(11168, 4, Integer.valueOf(appChooserUI.f172819z));
                        } else {
                            com.tencent.mm.plugin.report.service.q.INSTANCE.g(11168, 3, Integer.valueOf(appChooserUI.f172819z));
                        }
                    }
                    if (appChooserUI.f172813u == 1) {
                        com.tencent.mm.plugin.report.service.q.INSTANCE.g(12809, 5, "");
                    }
                } else if (sVar == s.DOWNLOADED) {
                    long j15 = appChooserUI.N;
                    Log.i("MicroMsg.AppChooserUI", "installRecommendApp");
                    ((dx.f) yz3.j.c(dx.f.class)).Xh0(appChooserUI.getContext(), ((com.tencent.mm.plugin.downloader.model.l) ((y) yz3.j.c(y.class)).fI0()).p(j15).f103384g, new j(appChooserUI), false);
                }
            }
            j30.a.g(this, "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$6", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V");
        }
    }

    public class h implements w$$d {
        public h() {
        }

        @Override // p64.w$$d
        public void onDismiss() {
            AppChooserUI.this.finish();
        }
    }

    public class i implements w$$d {
        public i() {
        }

        @Override // p64.w$$d
        public void onDismiss() {
            AppChooserUI appChooserUI = AppChooserUI.this;
            if (appChooserUI.f172811s) {
                appChooserUI.f172810r = appChooserUI.f172809q;
            }
        }
    }

    public class j implements DialogInterface.OnDismissListener {
        public j() {
        }

        public void onDismiss(DialogInterface dialogInterface) {
            AppChooserUI.this.finish();
        }
    }

    public class k extends i84.i<p> {
        public k() {
        }

        @Override // i84.i
        public int g() {
            return R.layout.acr;
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [i84.o, i84.c, int, int, boolean, java.util.List] */
        /* JADX WARNING: Code restructure failed: missing block: B:20:0x0081, code lost:
            if (r5.I >= r5.J) goto L_0x0083;
         */
        /* JADX WARNING: Removed duplicated region for block: B:26:0x0098  */
        /* JADX WARNING: Removed duplicated region for block: B:31:0x00ad  */
        @Override // i84.i
        public void i(i84.o oVar, p pVar, int i15, int i16, boolean z15, List list) {
            s sVar;
            ResolveInfo resolveInfo;
            p pVar2 = pVar;
            ImageView imageView = (ImageView) oVar.D(R.id.e1s);
            TextView textView = (TextView) oVar.D(R.id.e1t);
            TextView textView2 = (TextView) oVar.D(R.id.e1r);
            if (pVar2.f172846f == null) {
                new q().execute(pVar2);
            }
            imageView.setImageDrawable(pVar2.f172846f);
            CharSequence charSequence = pVar2.f172845e;
            AppChooserUI appChooserUI = AppChooserUI.this;
            if (appChooserUI.F && (resolveInfo = pVar2.f172844d) != null && resolveInfo.activityInfo.packageName.equals(appChooserUI.G)) {
                charSequence = TextUtils.concat(charSequence, AppChooserUI.this.getString(R.string.f367412sy));
                AppChooserUI appChooserUI2 = AppChooserUI.this;
                if (appChooserUI2.B == null) {
                    appChooserUI2.B = pVar2;
                }
            }
            textView.setText(charSequence);
            boolean z16 = pVar2.f172847g;
            if (z16 && !pVar2.f172848h) {
                if (z16 && pVar2.f172850j) {
                    AppChooserUI appChooserUI3 = AppChooserUI.this;
                }
                textView2.setVisibility(0);
                sVar = AppChooserUI.this.P;
                if (sVar != s.UNINSTALL) {
                    if (pVar2.f172849i) {
                        textView2.setText(R.string.f367551wt);
                    } else {
                        textView2.setText(R.string.f367422t8);
                    }
                    textView2.setEnabled(true);
                    return;
                } else if (sVar == s.DOWNLOADING) {
                    textView2.setText(R.string.f367427td);
                    textView2.setEnabled(false);
                    return;
                } else if (sVar == s.DOWNLOADED) {
                    if (pVar2.f172849i) {
                        textView2.setText(R.string.f367629yz);
                    } else {
                        textView2.setText(R.string.f367628yy);
                    }
                    textView2.setEnabled(true);
                    return;
                } else {
                    return;
                }
            }
            if (!pVar2.f172849i) {
                textView2.setVisibility(8);
                return;
            }
            textView2.setVisibility(0);
            sVar = AppChooserUI.this.P;
            if (sVar != s.UNINSTALL) {
            }
        }
    }

    public class l extends i84.i<p> {
        public l() {
        }

        @Override // i84.i
        public int g() {
            return R.layout.acu;
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [i84.o, i84.c, int, int, boolean, java.util.List] */
        @Override // i84.i
        public void i(i84.o oVar, p pVar, int i15, int i16, boolean z15, List list) {
            int i17;
            p pVar2 = pVar;
            View view = oVar.f7101d;
            if (pVar2.f172848h) {
                i17 = 0;
            } else {
                i17 = 8;
            }
            k30.a aVar = new k30.a();
            ThreadLocal<k30.a> threadLocal = k30.c.f244265a;
            aVar.c(Integer.valueOf(i17));
            j30.a.d(view, aVar.b(), "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$AppDefaultInfoItemConvert", "onBindViewHolder", "(Lcom/tencent/mm/view/recyclerview/SimpleViewHolder;Lcom/tencent/mm/pluginsdk/ui/tools/AppChooserUI$DisplayResolveInfo;IIZLjava/util/List;)V", "android/view/View_EXEC_", "setVisibility", "(I)V");
            view.setVisibility(((Integer) aVar.a(0)).intValue());
            j30.a.e(view, "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$AppDefaultInfoItemConvert", "onBindViewHolder", "(Lcom/tencent/mm/view/recyclerview/SimpleViewHolder;Lcom/tencent/mm/pluginsdk/ui/tools/AppChooserUI$DisplayResolveInfo;IIZLjava/util/List;)V", "android/view/View_EXEC_", "setVisibility", "(I)V");
            AppChooseItemCheckedView appChooseItemCheckedView = (AppChooseItemCheckedView) oVar.D(R.id.e1w);
            appChooseItemCheckedView.f172794d = true;
            appChooseItemCheckedView.a();
            appChooseItemCheckedView.getTitleTv().setText(pVar2.f172845e);
            if (appChooseItemCheckedView.getIconImg() != null) {
                appChooseItemCheckedView.getIconImg().setImageDrawable(pVar2.f172846f);
            }
            appChooseItemCheckedView.setChecked(AppChooserUI.this.f172810r.a(pVar2));
            oVar.f7101d.setOnClickListener(new k(this, pVar2));
        }
    }

    public class m extends i84.i<i84.c> {

        public class a implements View.OnClickListener {
            public a() {
            }

            public void onClick(View view) {
                ArrayList arrayList = new ArrayList();
                arrayList.add(view);
                Object[] array = arrayList.toArray();
                arrayList.clear();
                j30.a.b("com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$AppDefaultNotSetItemConvert$1", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V", this, array);
                AppChooserUI appChooserUI = AppChooserUI.this;
                appChooserUI.f172810r = appChooserUI.f172804j;
                appChooserUI.f172807p.notifyDataSetChanged();
                j30.a.g(this, "com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$AppDefaultNotSetItemConvert$1", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V");
            }
        }

        public m() {
        }

        @Override // i84.i
        public i84.o f(RecyclerView recyclerView, View view) {
            return new i84.o(view);
        }

        @Override // i84.i
        public int g() {
            return R.layout.acu;
        }

        @Override // i84.i
        public void i(i84.o oVar, i84.c cVar, int i15, int i16, boolean z15, List<Object> list) {
            AppChooseItemCheckedView appChooseItemCheckedView = (AppChooseItemCheckedView) oVar.D(R.id.e1w);
            boolean z16 = false;
            appChooseItemCheckedView.f172794d = false;
            appChooseItemCheckedView.a();
            AppChooserUI appChooserUI = AppChooserUI.this;
            p pVar = appChooserUI.f172804j;
            p pVar2 = appChooserUI.f172810r;
            if (pVar == pVar2 || pVar2 == null) {
                z16 = true;
            }
            appChooseItemCheckedView.setChecked(z16);
            oVar.f7101d.setOnClickListener(new a());
        }
    }

    public class n extends BaseAdapter {

        /* renamed from: d  reason: collision with root package name */
        public List<p> f172836d = new ArrayList();

        /* renamed from: e  reason: collision with root package name */
        public s f172837e = s.UNINSTALL;

        public n() {
            AppChooserUI.this.f172799e = AppChooserUI.this.getPackageManager();
        }

        /* renamed from: a */
        public p getItem(int i15) {
            List<p> list = this.f172836d;
            if (list == null) {
                return null;
            }
            return list.get(i15);
        }

        public int getCount() {
            List<p> list = this.f172836d;
            if (list == null) {
                return 0;
            }
            return list.size();
        }

        public long getItemId(int i15) {
            return (long) i15;
        }

        public int getItemViewType(int i15) {
            if (getItem(i15).f172847g) {
                return 1;
            }
            return 0;
        }

        /* JADX WARNING: Code restructure failed: missing block: B:30:0x00a2, code lost:
            if (r0.I >= r0.J) goto L_0x00a4;
         */
        /* JADX WARNING: Removed duplicated region for block: B:36:0x00d9  */
        /* JADX WARNING: Removed duplicated region for block: B:41:0x00f4  */
        /* JADX WARNING: Removed duplicated region for block: B:53:0x0128  */
        /* JADX WARNING: Removed duplicated region for block: B:61:0x0154  */
        public View getView(int i15, View view, ViewGroup viewGroup) {
            o oVar;
            p pVar;
            s sVar;
            ResolveInfo resolveInfo;
            int i16;
            p a15 = getItem(i15);
            if (view == null || view.getTag() == null) {
                LayoutInflater from = LayoutInflater.from(AppChooserUI.this.getContext());
                if (a15.f172847g) {
                    i16 = R.layout.f365427hu;
                } else {
                    i16 = R.layout.f365426ht;
                }
                view = from.inflate(i16, (ViewGroup) null);
                oVar = new o(AppChooserUI.this, view);
                view.setTag(oVar);
            } else {
                oVar = (o) view.getTag();
            }
            int i17 = 0;
            if (a15.f172846f == null) {
                new q().execute(a15);
            }
            oVar.f172839a.setImageDrawable(a15.f172846f);
            CharSequence charSequence = a15.f172845e;
            AppChooserUI appChooserUI = AppChooserUI.this;
            if (appChooserUI.F && (resolveInfo = a15.f172844d) != null && resolveInfo.activityInfo.packageName.equals(appChooserUI.G)) {
                charSequence = TextUtils.concat(charSequence, AppChooserUI.this.getString(R.string.f367412sy));
                AppChooserUI appChooserUI2 = AppChooserUI.this;
                if (appChooserUI2.B == null) {
                    appChooserUI2.B = a15;
                }
            }
            oVar.f172840b.setText(charSequence);
            boolean z15 = a15.f172847g;
            if (z15 && !a15.f172848h) {
                if (z15 && a15.f172850j) {
                    AppChooserUI appChooserUI3 = AppChooserUI.this;
                }
                oVar.f172842d.setVisibility(0);
                oVar.f172843e.setVisibility(8);
                oVar.f172842d.setOnClickListener(AppChooserUI.this.W);
                sVar = this.f172837e;
                if (sVar != s.UNINSTALL) {
                    if (a15.f172849i) {
                        oVar.f172842d.setText(R.string.f367551wt);
                    } else {
                        oVar.f172842d.setText(R.string.f367422t8);
                    }
                    oVar.f172842d.setEnabled(true);
                } else if (sVar == s.DOWNLOADING) {
                    oVar.f172842d.setText(R.string.f367427td);
                    oVar.f172842d.setEnabled(false);
                } else if (sVar == s.DOWNLOADED) {
                    if (a15.f172849i) {
                        oVar.f172842d.setText(R.string.f367629yz);
                    } else {
                        oVar.f172842d.setText(R.string.f367628yy);
                    }
                    oVar.f172842d.setEnabled(true);
                }
                if (a15.f172847g) {
                    AppChooserUI appChooserUI4 = AppChooserUI.this;
                    if (appChooserUI4.f172819z == 4) {
                        oVar.f172841c.setText(R.string.hok);
                    } else {
                        oVar.f172841c.setText(Util.nullAsNil(appChooserUI4.f172814v));
                    }
                    TextView textView = oVar.f172841c;
                    if (Util.isNullOrNil(AppChooserUI.this.f172814v)) {
                        i17 = 8;
                    }
                    textView.setVisibility(i17);
                } else {
                    oVar.f172841c.setVisibility(8);
                }
                AppChooserUI appChooserUI5 = AppChooserUI.this;
                if (!(appChooserUI5.f172819z == 6 || (pVar = appChooserUI5.B) == null || !pVar.equals(a15))) {
                    oVar.f172843e.setChecked(true);
                }
                return view;
            }
            if (!a15.f172849i) {
                oVar.f172842d.setVisibility(8);
                oVar.f172843e.setVisibility(0);
                oVar.f172843e.setChecked(a15.a(AppChooserUI.this.B));
                if (a15.f172847g) {
                }
                AppChooserUI appChooserUI52 = AppChooserUI.this;
                oVar.f172843e.setChecked(true);
                return view;
            }
            oVar.f172842d.setVisibility(0);
            oVar.f172843e.setVisibility(8);
            oVar.f172842d.setOnClickListener(AppChooserUI.this.W);
            sVar = this.f172837e;
            if (sVar != s.UNINSTALL) {
            }
            if (a15.f172847g) {
            }
            AppChooserUI appChooserUI522 = AppChooserUI.this;
            oVar.f172843e.setChecked(true);
            return view;
        }

        public int getViewTypeCount() {
            return 2;
        }
    }

    public class o {

        /* renamed from: a  reason: collision with root package name */
        public ImageView f172839a;

        /* renamed from: b  reason: collision with root package name */
        public TextView f172840b;

        /* renamed from: c  reason: collision with root package name */
        public TextView f172841c;

        /* renamed from: d  reason: collision with root package name */
        public TextView f172842d;

        /* renamed from: e  reason: collision with root package name */
        public RadioButton f172843e;

        public o(AppChooserUI appChooserUI, View view) {
            this.f172839a = (ImageView) view.findViewById(R.id.a15);
            this.f172840b = (TextView) view.findViewById(R.id.a1o);
            this.f172841c = (TextView) view.findViewById(R.id.a0x);
            this.f172842d = (TextView) view.findViewById(R.id.a1z);
            this.f172843e = (RadioButton) view.findViewById(R.id.a1v);
        }
    }

    public class p implements i84.c {

        /* renamed from: d  reason: collision with root package name */
        public ResolveInfo f172844d;

        /* renamed from: e  reason: collision with root package name */
        public CharSequence f172845e;

        /* renamed from: f  reason: collision with root package name */
        public Drawable f172846f;

        /* renamed from: g  reason: collision with root package name */
        public boolean f172847g;

        /* renamed from: h  reason: collision with root package name */
        public boolean f172848h;

        /* renamed from: i  reason: collision with root package name */
        public boolean f172849i;

        /* renamed from: j  reason: collision with root package name */
        public boolean f172850j;

        public p(AppChooserUI appChooserUI) {
        }

        public boolean a(Object obj) {
            ResolveInfo resolveInfo;
            if (!(obj instanceof p)) {
                return false;
            }
            p pVar = (p) obj;
            ResolveInfo resolveInfo2 = pVar.f172844d;
            if (resolveInfo2 != null && (resolveInfo = this.f172844d) != null && resolveInfo2.activityInfo.packageName.equals(resolveInfo.activityInfo.packageName)) {
                return true;
            }
            if (!pVar.f172847g || !this.f172847g) {
                return false;
            }
            return true;
        }

        @Override // i84.c
        public long getItemId() {
            return (long) hashCode();
        }

        @Override // i84.c
        public int m() {
            return 0;
        }

        public p(AppChooserUI appChooserUI, ResolveInfo resolveInfo, CharSequence charSequence, boolean z15, boolean z16, boolean z17) {
            this.f172844d = resolveInfo;
            this.f172845e = charSequence;
            this.f172847g = z15;
            this.f172848h = z16;
            this.f172849i = z17;
        }
    }

    public class q extends AsyncTask<p, Void, p> {
        public q() {
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
        /* JADX WARNING: Code restructure failed: missing block: B:16:0x0041, code lost:
            if (r5 == null) goto L_0x0044;
         */
        @Override // android.os.AsyncTask
        public p doInBackground(p[] pVarArr) {
            Drawable drawable;
            p pVar = pVarArr[0];
            if (pVar.f172846f == null) {
                AppChooserUI appChooserUI = AppChooserUI.this;
                ResolveInfo resolveInfo = pVar.f172844d;
                int i15 = AppChooserUI.f172798y0;
                appChooserUI.getClass();
                try {
                    String str = resolveInfo.resolvePackageName;
                    Drawable drawable2 = null;
                    if (!(str == null || resolveInfo.icon == 0)) {
                        Resources resourcesForApplication = appChooserUI.f172799e.getResourcesForApplication(str);
                        int i16 = resolveInfo.icon;
                        try {
                            Method method = hy3.e.f229135f;
                            if (resourcesForApplication == null) {
                                e.c cVar = c04.e.f46088a;
                                drawable = null;
                            } else {
                                c04.e.f46101n.set(Boolean.TRUE);
                                drawable = resourcesForApplication.getDrawable(i16);
                                c04.e.f46101n.set(Boolean.FALSE);
                            }
                        } catch (Resources.NotFoundException unused) {
                        }
                    }
                    int iconResource = resolveInfo.getIconResource();
                    if (iconResource != 0) {
                        Resources resourcesForApplication2 = appChooserUI.f172799e.getResourcesForApplication(resolveInfo.activityInfo.packageName);
                        try {
                            Method method2 = hy3.e.f229135f;
                            if (resourcesForApplication2 == null) {
                                e.c cVar2 = c04.e.f46088a;
                            } else {
                                c04.e.f46101n.set(Boolean.TRUE);
                                Drawable drawable3 = resourcesForApplication2.getDrawable(iconResource);
                                c04.e.f46101n.set(Boolean.FALSE);
                                drawable2 = drawable3;
                            }
                        } catch (Resources.NotFoundException unused2) {
                        }
                        if (drawable2 != null) {
                            Log.i("MicroMsg.AppChooserUI", "loadIconForResolveInfo iconRes %d done", Integer.valueOf(iconResource));
                            drawable = drawable2;
                            pVar.f172846f = drawable;
                        }
                    }
                } catch (PackageManager.NameNotFoundException e15) {
                    Log.e("MicroMsg.AppChooserUI", "Couldn't find resources for package", e15);
                }
                drawable = resolveInfo.loadIcon(appChooserUI.f172799e);
                pVar.f172846f = drawable;
            }
            return pVar;
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // android.os.AsyncTask
        public void onPostExecute(p pVar) {
            n nVar = AppChooserUI.this.f172800f;
            if (nVar != null) {
                nVar.notifyDataSetChanged();
            }
            WxRecyclerAdapter<p> wxRecyclerAdapter = AppChooserUI.this.f172803i;
            if (wxRecyclerAdapter != null) {
                wxRecyclerAdapter.notifyDataSetChanged();
            }
        }
    }

    public class r {

        /* renamed from: a  reason: collision with root package name */
        public Context f172852a;

        /* renamed from: b  reason: collision with root package name */
        public p64.g f172853b;

        /* renamed from: c  reason: collision with root package name */
        public ListViewInScrollView f172854c;

        /* renamed from: d  reason: collision with root package name */
        public String f172855d;

        /* renamed from: e  reason: collision with root package name */
        public BaseAdapter f172856e;

        /* renamed from: f  reason: collision with root package name */
        public AdapterView.OnItemClickListener f172857f;

        /* renamed from: g  reason: collision with root package name */
        public DialogInterface.OnClickListener f172858g;

        /* renamed from: h  reason: collision with root package name */
        public DialogInterface.OnClickListener f172859h;

        /* renamed from: i  reason: collision with root package name */
        public DialogInterface.OnDismissListener f172860i;

        public r(AppChooserUI appChooserUI, Context context) {
            this.f172852a = context;
            this.f172854c = (ListViewInScrollView) View.inflate(context, R.layout.f365425hs, null);
        }

        public void a(boolean z15) {
            p64.g gVar = this.f172853b;
            if (gVar == null) {
                return;
            }
            if (!z15) {
                gVar.t(R.string.f367643zd, null);
                this.f172853b.q(R.string.f367642zc, null);
                return;
            }
            gVar.t(R.string.f367643zd, this.f172859h);
            this.f172853b.q(R.string.f367642zc, this.f172858g);
        }
    }

    public enum s {
        UNINSTALL,
        DOWNLOADING,
        DOWNLOADED
    }

    public AppChooserUI() {
        p pVar = new p(this);
        this.f172804j = pVar;
        this.f172809q = pVar;
        this.f172810r = pVar;
    }

    public static int U7(int i15, String str, int i16) {
        return str != null ? i15 + i16 + str.hashCode() : i15 + i16;
    }

    public final boolean T7() {
        this.N = ((Long) z.s().i().e(U7(274560, this.H, this.f172813u), 0L)).longValue();
        FileDownloadTaskInfo p15 = ((com.tencent.mm.plugin.downloader.model.l) ((y) yz3.j.c(y.class)).fI0()).p(this.N);
        if (3 != p15.f103383f || !u1.k(p15.f103384g)) {
            return false;
        }
        Y7(s.DOWNLOADED);
        n nVar = this.f172800f;
        if (nVar != null) {
            nVar.notifyDataSetChanged();
        }
        WxRecyclerAdapter<p> wxRecyclerAdapter = this.f172803i;
        if (wxRecyclerAdapter == null) {
            return true;
        }
        wxRecyclerAdapter.notifyDataSetChanged();
        return true;
    }

    /* JADX DEBUG: Multi-variable search result rejected for r11v1, resolved type: int */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r11v0 */
    /* JADX WARN: Type inference failed for: r11v2 */
    public final ArrayList<p> V7(Intent intent, boolean z15, ArrayList<String> arrayList) {
        boolean z16;
        ArrayList<p> arrayList2 = new ArrayList<>();
        List<ResolveInfo> queryIntentActivities = this.f172799e.queryIntentActivities(intent, 65536);
        c.a c15 = this.f172816x.c();
        if (!Util.isNullOrNil(c15.f241339c)) {
            this.f172814v = c15.f241339c;
        } else if (c15.f241338b > 0) {
            this.f172814v = getResources().getString(c15.f241338b);
        }
        if (c15.f241337a > 0) {
            this.C.f172846f = getResources().getDrawable(c15.f241337a);
        }
        if (c15.f241340d > 0) {
            this.C.f172845e = getResources().getString(c15.f241340d);
        } else {
            this.C.f172845e = c15.f241341e;
        }
        p pVar = this.C;
        int i15 = 1;
        pVar.f172847g = true;
        boolean z17 = this.K;
        pVar.f172848h = z17;
        if (z17) {
            pVar.f172850j = true;
        }
        if (this.L) {
            pVar.f172849i = true;
        }
        if (queryIntentActivities == null || queryIntentActivities.size() <= 0) {
            z16 = false;
        } else {
            int size = queryIntentActivities.size();
            int i16 = 0;
            z16 = false;
            while (i16 < size) {
                Object[] objArr = new Object[i15];
                objArr[0] = queryIntentActivities.get(i16).activityInfo.name;
                Log.i("MicroMsg.AppChooserUI", "cpan name:%s", objArr);
                ResolveInfo resolveInfo = queryIntentActivities.get(i16);
                if (resolveInfo != null) {
                    String str = resolveInfo.activityInfo.packageName;
                    if (arrayList == null || arrayList.isEmpty() || arrayList.contains(str)) {
                        if (this.f172816x.i(str)) {
                            p pVar2 = this.C;
                            pVar2.f172844d = resolveInfo;
                            pVar2.f172850j = i15;
                            if ((!z15 && this.K) || !z15) {
                                arrayList2.add(0, pVar2);
                                z16 = i15;
                            }
                        } else {
                            p pVar3 = new p(this, resolveInfo, this.f172816x.b(getContext(), resolveInfo), false, true, false);
                            arrayList2.add(pVar3);
                            if (this.f172816x.i(pVar3.f172844d.activityInfo.packageName)) {
                                z16 = true;
                            }
                        }
                    }
                }
                i16++;
                i15 = 1;
            }
        }
        if (z15 && !z16) {
            if (this.f172813u != 0 || this.H == null) {
                arrayList2.add(0, this.C);
            } else {
                arrayList2.add(0, this.C);
                if (this.L) {
                    com.tencent.mm.plugin.report.service.q.INSTANCE.g(11168, 2, Integer.valueOf(this.f172819z));
                } else {
                    com.tencent.mm.plugin.report.service.q.INSTANCE.g(11168, 1, Integer.valueOf(this.f172819z));
                }
            }
        }
        int i17 = this.f172819z;
        if (i17 == 4 || i17 == 8) {
            p pVar4 = this.C;
            if (pVar4.f172844d == null) {
                pVar4.f172844d = new ResolveInfo();
                this.C.f172844d.activityInfo = new ActivityInfo();
                this.C.f172844d.activityInfo.packageName = "com.tencent.mtt";
            }
        }
        HashSet hashSet = new HashSet();
        for (int size2 = arrayList2.size() - 1; size2 >= 0; size2--) {
            ResolveInfo resolveInfo2 = arrayList2.get(size2).f172844d;
            if (resolveInfo2 != null) {
                String str2 = resolveInfo2.activityInfo.packageName;
                if (!Util.isNullOrNil(str2) && !hashSet.add(str2)) {
                    arrayList2.remove(size2);
                }
            }
        }
        return arrayList2;
    }

    public final boolean W7() {
        Util.isOverseasUser(this);
        if (!this.M || this.I >= this.J || Util.isOverseasUser(this) || ChannelUtil.channelId == 1) {
            return false;
        }
        return true;
    }

    public final void X7(int i15, String str, boolean z15) {
        Intent intent = new Intent();
        intent.putExtra("selectpkg", str);
        intent.putExtra("isalways", z15);
        intent.putExtra("transferback", this.f172815w);
        setResult(i15, intent);
        finish();
    }

    public void Y7(s sVar) {
        if (Z7()) {
            this.P = sVar;
            return;
        }
        n nVar = this.f172800f;
        if (nVar != null) {
            nVar.f172837e = sVar;
        }
    }

    public final boolean Z7() {
        return this.f172817x0.contains(Integer.valueOf(this.f172819z));
    }

    @Override // com.tencent.mm.ui.MMActivity
    public int getLayoutId() {
        return -1;
    }

    @Override // androidx.activity.ComponentActivity, com.tencent.mm.ui.component.UIComponentActivity, com.tencent.mm.ui.MMActivity
    public void onBackPressed() {
        super.onBackPressed();
        X7(0, null, false);
    }

    /* JADX WARNING: Removed duplicated region for block: B:130:0x0231 A[EDGE_INSN: B:130:0x0231->B:59:0x0231 ?: BREAK  , SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:37:0x01a6  */
    /* JADX WARNING: Removed duplicated region for block: B:40:0x01ae  */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x01c5  */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x01c7  */
    /* JADX WARNING: Removed duplicated region for block: B:48:0x01ef  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x020b  */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x0250  */
    /* JADX WARNING: Removed duplicated region for block: B:70:0x027a  */
    /* JADX WARNING: Removed duplicated region for block: B:78:0x02ab  */
    /* JADX WARNING: Removed duplicated region for block: B:79:0x02b0  */
    /* JADX WARNING: Removed duplicated region for block: B:90:0x02da  */
    /* JADX WARNING: Removed duplicated region for block: B:94:0x02e5  */
    @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.tencent.mm.ui.component.UIComponentActivity, com.tencent.mm.ui.MMActivity, com.tencent.mm.hellhoundlib.activities.HellActivity, com.tencent.mm.ui.MMFragmentActivity
    public void onCreate(Bundle bundle) {
        boolean z15;
        Iterator<p> it;
        Iterator<p> it4;
        p pVar;
        ArrayList<String> arrayList;
        super.onCreate(bundle);
        k1 a15 = k1.a();
        int i15 = this.f172813u;
        a15.getClass();
        if (i15 == 0) {
            com.tencent.mm.plugin.report.service.q.INSTANCE.g(10998, 0);
        } else if (i15 == 1) {
            com.tencent.mm.plugin.report.service.q.INSTANCE.g(11091, 0);
        }
        x4.f0(getWindow());
        Intent intent = getIntent();
        Parcelable parcelableExtra = intent.getParcelableExtra("targetintent");
        if (!(parcelableExtra instanceof Intent)) {
            Log.w("ChooseActivity", "Target is not an intent: " + parcelableExtra);
            X7(0, null, false);
            return;
        }
        this.f172812t = (Intent) parcelableExtra;
        String stringExtra = intent.getStringExtra(FFmpegMetadataRetriever.METADATA_KEY_TITLE);
        this.f172813u = intent.getIntExtra("type", 0);
        this.F = intent.getBooleanExtra("openWay", false);
        this.f172815w = intent.getBundleExtra("transferback");
        this.f172818y = intent.getStringArrayListExtra("targetwhitelist");
        this.L = intent.getBooleanExtra("needupate", false);
        this.H = intent.getStringExtra("mimetype");
        this.A = intent.getIntExtra("enter_scene", 0);
        this.f172819z = intent.getIntExtra(TPReportKeys.PlayerStep.PLAYER_BUFFERING_SCENE, 0);
        if (z.a()) {
            String str = (String) z.s().i().e(U7(274528, this.H, this.f172813u), "");
            this.G = str;
            if (!TextUtils.isEmpty(str) && j0.f(getContext(), this.G) && (((arrayList = this.f172818y) == null || arrayList.isEmpty() || this.f172818y.contains(this.G)) && !this.F)) {
                Intent intent2 = new Intent(this.f172812t);
                intent2.setPackage(this.G);
                if (Util.isIntentAvailable(this, intent2, false)) {
                    z15 = true;
                    Log.i("MicroMsg.AppChooserUI", "isAlwaysUseOption %b, scene %d, mDefaultAppPackageName %s, mimeType %s, isOpenWay %b", Boolean.valueOf(z15), Integer.valueOf(this.f172819z), this.G, this.H, Boolean.valueOf(this.F));
                    if (z15 || this.f172819z == 6 || Z7()) {
                        this.f172799e = getPackageManager();
                        this.f172800f = new n();
                        j1 b15 = k1.a().b(this.f172813u, intent.getBundleExtra("key_recommend_params"));
                        this.f172816x = b15;
                        this.K = b15.h(getContext());
                        this.I = ((Integer) z.s().i().e(this.f172813u + 274496, 0)).intValue();
                        k1 a16 = k1.a();
                        int i16 = this.f172813u;
                        a16.getClass();
                        this.J = i16 == 0 ? i16 != 1 ? 5 : Integer.MAX_VALUE : 0;
                        String.valueOf(this.K);
                        this.M = !intent.getBooleanExtra("not_show_recommend_app", false);
                        boolean z16 = this.I < this.J;
                        this.D.clear();
                        this.D.addAll(V7(this.f172812t, W7(), this.f172818y));
                        this.E.clear();
                        it = this.D.iterator();
                        while (it.hasNext()) {
                            p next = it.next();
                            if (next.f172848h) {
                                this.E.add(next);
                            }
                        }
                        it4 = this.D.iterator();
                        while (true) {
                            if (!it4.hasNext()) {
                                break;
                            }
                            p next2 = it4.next();
                            ResolveInfo resolveInfo = next2.f172844d;
                            if (resolveInfo != null && resolveInfo.activityInfo.packageName.equals(this.G)) {
                                Log.i("MicroMsg.AppChooserUI", "init default pkg name: %s", this.G);
                                this.f172809q = next2;
                                this.f172810r = next2;
                                break;
                            }
                        }
                        if (!z16 && !this.K) {
                            z.s().i().K(274496 + this.f172813u, Integer.valueOf(this.I + 1));
                        }
                        if (!this.K) {
                            k1 a17 = k1.a();
                            int i17 = this.f172813u;
                            a17.getClass();
                            if (i17 == 0) {
                                com.tencent.mm.plugin.report.service.q.INSTANCE.g(10998, 3);
                            } else if (i17 == 1) {
                                com.tencent.mm.plugin.report.service.q.INSTANCE.g(11091, 3);
                            }
                        } else if (!z16) {
                            k1 a18 = k1.a();
                            int i18 = this.f172813u;
                            a18.getClass();
                            if (i18 == 0) {
                                com.tencent.mm.plugin.report.service.q.INSTANCE.g(10998, 1);
                            } else if (i18 == 1) {
                                com.tencent.mm.plugin.report.service.q.INSTANCE.g(11091, 1);
                            }
                        }
                        Object[] objArr = new Object[1];
                        ArrayList<p> arrayList2 = this.D;
                        objArr[0] = Integer.valueOf(arrayList2 == null ? arrayList2.size() : 0);
                        Log.i("MicroMsg.AppChooserUI", "mResolveListData size %d", objArr);
                        ArrayList<p> arrayList3 = this.D;
                        if (arrayList3 != null && arrayList3.size() == 1 && (!W7() || this.K)) {
                            pVar = this.D.get(0);
                            if (pVar != null) {
                                X7(4097, null, false);
                                return;
                            } else if (pVar.f172844d == null) {
                                X7(4098, null, false);
                                return;
                            }
                        }
                        setTitleVisibility(8);
                        ArrayList<p> arrayList4 = this.D;
                        if (arrayList4 == null || arrayList4.isEmpty()) {
                            X7(4097, null, false);
                            return;
                        }
                        if (Z7()) {
                            w wVar = new w(this);
                            this.f172801g = wVar;
                            wVar.j(R.layout.acw);
                            View view = this.f172801g.f281322f;
                            x4.n0(((TextView) view.findViewById(R.id.e1x)).getPaint());
                            this.f172802h = (WxRecyclerView) view.findViewById(R.id.e1u);
                            ((WeImageView) view.findViewById(R.id.e1k)).setOnClickListener(new f(this));
                            ((WeImageView) view.findViewById(R.id.e1v)).setOnClickListener(new g(this));
                            this.f172801g.f281332s = this.X;
                            WxRecyclerView wxRecyclerView = this.f172802h;
                            WxRecyclerAdapter<p> wxRecyclerAdapter = new WxRecyclerAdapter<>(new i84.j() {
                                /* class com.tencent.mm.pluginsdk.ui.tools.AppChooserUI.AnonymousClass16 */

                                @Override // i84.j
                                public i84.i<?> getItemConvert(int i15) {
                                    return new k();
                                }
                            }, this.D, true);
                            this.f172803i = wxRecyclerAdapter;
                            wxRecyclerView.setAdapter(wxRecyclerAdapter);
                            this.f172802h.setLayoutManager(new GridLayoutManager(this, 4));
                            this.f172803i.f230852o = this.V;
                            this.f172801g.p();
                            ((pp.h) yz3.j.c(pp.h.class)).ai(1, this.A, "", this.H);
                            T7();
                        } else {
                            this.f172800f.f172836d = this.D;
                            T7();
                            r rVar = new r(this, getContext());
                            this.Q = rVar;
                            if (stringExtra != null) {
                                rVar.f172855d = stringExtra.toString();
                            } else {
                                rVar.f172855d = null;
                            }
                            r rVar2 = this.Q;
                            rVar2.f172857f = this.R;
                            rVar2.f172859h = this.U;
                            rVar2.f172858g = this.S;
                            rVar2.f172856e = this.f172800f;
                            rVar2.f172860i = this.Z;
                            if (!this.L && this.K && !z16) {
                                this.B = this.C;
                                rVar2.a(true);
                            }
                            r rVar3 = this.Q;
                            AdapterView.OnItemClickListener onItemClickListener = rVar3.f172857f;
                            if (onItemClickListener != null) {
                                rVar3.f172854c.setOnItemClickListener(onItemClickListener);
                            }
                            BaseAdapter baseAdapter = rVar3.f172856e;
                            if (baseAdapter != null) {
                                rVar3.f172854c.setAdapter((ListAdapter) baseAdapter);
                            }
                            Context context = rVar3.f172852a;
                            p64.g J2 = i14.j.J(context, true, rVar3.f172855d, rVar3.f172854c, context.getString(R.string.f367643zd), rVar3.f172852a.getString(R.string.f367642zc), rVar3.f172859h, rVar3.f172858g, R.color.f358632su);
                            rVar3.f172853b = J2;
                            J2.setOnDismissListener(rVar3.f172860i);
                            rVar3.f172853b.show();
                        }
                        ((com.tencent.mm.plugin.downloader.model.l) ((y) yz3.j.c(y.class)).fI0()).a(this.f172808p0);
                        return;
                    }
                    X7(-1, this.G, true);
                    return;
                }
            }
            z15 = false;
            Log.i("MicroMsg.AppChooserUI", "isAlwaysUseOption %b, scene %d, mDefaultAppPackageName %s, mimeType %s, isOpenWay %b", Boolean.valueOf(z15), Integer.valueOf(this.f172819z), this.G, this.H, Boolean.valueOf(this.F));
            if (z15) {
            }
            this.f172799e = getPackageManager();
            this.f172800f = new n();
            j1 b152 = k1.a().b(this.f172813u, intent.getBundleExtra("key_recommend_params"));
            this.f172816x = b152;
            this.K = b152.h(getContext());
            this.I = ((Integer) z.s().i().e(this.f172813u + 274496, 0)).intValue();
            k1 a162 = k1.a();
            int i162 = this.f172813u;
            a162.getClass();
            this.J = i162 == 0 ? i162 != 1 ? 5 : Integer.MAX_VALUE : 0;
            String.valueOf(this.K);
            this.M = !intent.getBooleanExtra("not_show_recommend_app", false);
            if (this.I < this.J) {
            }
            this.D.clear();
            this.D.addAll(V7(this.f172812t, W7(), this.f172818y));
            this.E.clear();
            it = this.D.iterator();
            while (it.hasNext()) {
            }
            it4 = this.D.iterator();
            while (true) {
                if (!it4.hasNext()) {
                }
            }
            z.s().i().K(274496 + this.f172813u, Integer.valueOf(this.I + 1));
            if (!this.K) {
            }
            Object[] objArr2 = new Object[1];
            ArrayList<p> arrayList22 = this.D;
            objArr2[0] = Integer.valueOf(arrayList22 == null ? arrayList22.size() : 0);
            Log.i("MicroMsg.AppChooserUI", "mResolveListData size %d", objArr2);
            ArrayList<p> arrayList32 = this.D;
            pVar = this.D.get(0);
            if (pVar != null) {
            }
        } else {
            Log.e("MicroMsg.AppChooserUI", "acc not ready");
            X7(4097, null, false);
        }
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.tencent.mm.ui.component.UIComponentActivity, com.tencent.mm.ui.MMActivity, com.tencent.mm.hellhoundlib.activities.HellActivity, com.tencent.mm.ui.MMFragmentActivity
    public void onDestroy() {
        super.onDestroy();
        ((com.tencent.mm.plugin.downloader.model.l) ((y) yz3.j.c(y.class)).fI0()).s(this.f172808p0);
        r rVar = this.Q;
        if (rVar != null) {
            rVar.f172853b.dismiss();
        }
    }

    @Override // androidx.fragment.app.FragmentActivity, com.tencent.mm.ui.component.UIComponentActivity, com.tencent.mm.ui.MMActivity, com.tencent.mm.hellhoundlib.activities.HellActivity, com.tencent.mm.ui.MMFragmentActivity
    public void onResume() {
        Intent intent;
        super.onResume();
        if (this.L && (intent = this.f172812t) != null && this.f172816x.j(this, intent)) {
            Log.i("MicroMsg.AppChooserUI", "user installed lasted recommend app");
            this.L = false;
            this.C.f172849i = false;
        }
        this.K = this.f172816x.h(getContext());
        this.D.clear();
        this.D.addAll(V7(this.f172812t, W7(), this.f172818y));
        this.E.clear();
        Iterator<p> it = this.D.iterator();
        while (it.hasNext()) {
            p next = it.next();
            if (next.f172848h) {
                this.E.add(next);
            }
        }
        r rVar = this.Q;
        if (rVar != null && this.K && this.B == null && !this.F) {
            this.B = this.C;
            rVar.a(true);
        }
        n nVar = this.f172800f;
        if (nVar != null) {
            nVar.f172836d = this.D;
            nVar.notifyDataSetChanged();
        }
        WxRecyclerAdapter<p> wxRecyclerAdapter = this.f172803i;
        if (wxRecyclerAdapter != null) {
            wxRecyclerAdapter.notifyDataSetChanged();
        }
    }
}