package com.tencent.mm.plugin.ext.openapi.provider;

import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Looper;
import com.google.android.gms.common.util.CrashUtils.ErrorDialogData;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.aa.i;
import com.tencent.mm.ah.o;
import com.tencent.mm.bp.d;
import com.tencent.mm.g.a.fp;
import com.tencent.mm.g.a.sg;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.aw;
import com.tencent.mm.plugin.appbrand.appusage.LocalUsageInfo;
import com.tencent.mm.plugin.appbrand.appusage.af;
import com.tencent.mm.plugin.appbrand.appusage.ag;
import com.tencent.mm.plugin.appbrand.config.WxaAttributes;
import com.tencent.mm.plugin.ext.c.b$b;
import com.tencent.mm.plugin.ext.c.d.b;
import com.tencent.mm.plugin.ext.c.e.2;
import com.tencent.mm.plugin.ext.provider.ExtContentProviderBase;
import com.tencent.mm.plugin.ext.ui.RedirectToQrCodeStubUI;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.plugin.sight.base.SightVideoJNI;
import com.tencent.mm.plugin.sight.base.c;
import com.tencent.mm.pluginsdk.d.a.a;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.ak;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.ac;
import com.tencent.mm.storage.ad;
import com.tencent.mm.storage.bp;
import com.tencent.mm.storage.bz;
import com.tencent.mm.vfs.e;
import com.tencent.ttpic.baseutils.ApiHelper$VERSION_CODES;
import com.tencent.ytcommon.BuildConfig;
import java.util.HashMap;
import java.util.List;

public class ExtControlProviderOpenApi extends ExtContentProviderBase {
    public static boolean lPG = false;
    private static final String[] lPH = new String[]{"retCode", "selfId"};
    private static final String[] lPI = new String[]{"retCode", "sportConfig"};
    private static final String[] lPJ = new String[]{"openid", "avatar"};
    private static final String[] lPK = new String[]{"voiceType", "sampleRateInHz", "channelConfig", "audioFormat", "filePath"};
    private static final String[] lPL = new String[]{"ssid", "macAddress", "isSupportWechat", "name"};
    private static final String[] lPM = new String[]{"username", "appId", "versionType", "nickname", "shortNickname", "iconURL", "collection", "runningFlag", "wechatPkg", "action", "intentInfo"};
    private Context context;
    private ak handler;
    private String[] lPN = null;
    private int lPO = -1;

    public ExtControlProviderOpenApi(String[] strArr, int i, Context context) {
        this.lPN = strArr;
        this.lPO = i;
        this.context = context;
    }

    public String getType(Uri uri) {
        return null;
    }

    public boolean onCreate() {
        AppMethodBeat.i(20315);
        this.handler = new ak();
        AppMethodBeat.o(20315);
        return true;
    }

    public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        AppMethodBeat.i(20316);
        ab.i("MicroMsg.ExtControlProviderOpenApi", "query(), ApiId = %s", new Object[]{Integer.valueOf(this.lPO)});
        a(uri, this.context, this.lPO, this.lPN);
        String str3 = this.lPW;
        MatrixCursor Kn;
        Cursor Kn2;
        if (uri == null) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "uri == null return code = 5");
            dZ(3, 5);
            Kn = a.Kn(5);
            AppMethodBeat.o(20316);
            return Kn;
        } else if (bo.isNullOrNil(this.lPW)) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "AppID == null return code = 7");
            dZ(3, 7);
            Kn2 = a.Kn(7);
            AppMethodBeat.o(20316);
            return Kn2;
        } else if (bo.isNullOrNil(brL())) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "PkgName == null return code = 6");
            dZ(3, 6);
            Kn2 = a.Kn(6);
            AppMethodBeat.o(20316);
            return Kn2;
        } else if (aVl()) {
            int i = 1;
            if (!lPG) {
                i = brM();
            }
            if (i != 1) {
                ab.e("MicroMsg.ExtControlProviderOpenApi", "invalid appid ! return code = ".concat(String.valueOf(i)));
                dZ(2, i);
                Kn2 = a.Kn(i);
                AppMethodBeat.o(20316);
                return Kn2;
            }
            String str4;
            String str5;
            Intent intent;
            long j;
            Intent intent2;
            switch (this.lPO) {
                case ApiHelper$VERSION_CODES.LOLLIPOP_MR1 /*22*/:
                    Kn2 = m(uri.getQueryParameter("op"), uri.getQueryParameter("scene"), uri.getQueryParameter("msgType"), uri.getQueryParameter("msgState"));
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 23:
                    Kn2 = r(strArr2);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 25:
                    Kn2 = s(strArr2);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 34:
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "sendSight ");
                    if (strArr2 == null || strArr2.length <= 0 || strArr2[0].length() <= 0) {
                        str3 = "MicroMsg.ExtControlProviderOpenApi";
                        str4 = "sendSight wrong args,args == null:%s";
                        Object[] objArr = new Object[1];
                        objArr[0] = Boolean.valueOf(strArr2 == null);
                        ab.e(str3, str4, objArr);
                        dZ(3, 3401);
                        Kn2 = a.Kn(3401);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    Object obj;
                    str5 = strArr2[0];
                    if (bo.isNullOrNil(str5) || !e.ct(str5)) {
                        obj = null;
                    } else {
                        c cVar = new c();
                        obj = SightVideoJNI.isSightOk(str5, cVar.qxg, cVar.qxh, cVar.qxi, cVar.qxk, cVar.qxj, cVar.qxj.length) == 0 ? 1 : null;
                    }
                    if (obj == null) {
                        ab.e("MicroMsg.ExtControlProviderOpenApi", "isSightOk wrong args");
                        dZ(3, 3402);
                        Kn2 = a.Kn(3402);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    intent = new Intent();
                    intent.addFlags(ErrorDialogData.BINDER_CRASH);
                    intent.addFlags(67108864);
                    intent.putExtra("sight_local_path", str5);
                    d.f(this.context, ".ui.transmit.SightForwardUI", intent);
                    T(12, 0, 1);
                    Kn2 = a.Kn(1);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 35:
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "hy: start redirect to chatting by phone num");
                    if (strArr2 == null || strArr2.length <= 0 || bo.isNullOrNil(strArr2[0])) {
                        ab.e("MicroMsg.ExtControlProviderOpenApi", "hy: args error: no phone num or phone num is null or nil");
                        dZ(3, 3201);
                        Kn2 = a.Kn(3201);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "hy: start searching for phone num: %s", new Object[]{strArr2[0]});
                    i = new com.tencent.mm.plugin.ext.b.c(this.context, str5).brH();
                    ab.i("MicroMsg.ExtControlProviderOpenApi", " ret =  ", new Object[]{Integer.valueOf(i)});
                    if (i != -1) {
                        T(14, 0, i);
                        i = 0;
                    } else {
                        T(15, 0, i);
                    }
                    Kn2 = a.Kn(i);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 36:
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "hy: start redirect to wechat out by phone num");
                    if (strArr2 == null || strArr2.length < 3) {
                        ab.e("MicroMsg.ExtControlProviderOpenApi", "hy: wechat out args error: args length error");
                        dZ(3, 3301);
                        Kn2 = a.Kn(3301);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    str5 = strArr2[0];
                    int i2 = bo.getInt(strArr2[1], -1);
                    str4 = strArr2[2];
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "hy: start wechat out: contactid: %s, countrycode: %s,  phone num: %s", new Object[]{str5, Integer.valueOf(i2), str4});
                    if (bo.isNullOrNil(str5) || i2 < 0 || bo.isNullOrNil(str4)) {
                        ab.i("MicroMsg.ExtControlProviderOpenApi", "hy: param err");
                        dZ(3, 3302);
                        Kn2 = a.Kn(3302);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    sg sgVar = new sg();
                    sgVar.cOy.cOz = str5;
                    sgVar.cOy.cOA = i2;
                    sgVar.cOy.cMQ = str4;
                    sgVar.cOy.bCu = com.tencent.mm.pluginsdk.a.i(str5, this.context);
                    com.tencent.mm.sdk.b.a.xxA.m(sgVar);
                    T(16, 0, 1);
                    Kn2 = a.Kn(1);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 37:
                    ab.d("MicroMsg.ExtControlProviderOpenApi", com.tencent.mm.plugin.appbrand.jsapi.wifi.c.NAME);
                    this.handler = new ak(Looper.getMainLooper());
                    Kn = (MatrixCursor) new 1(this, strArr2).b(this.handler);
                    if (Kn == null) {
                        T(19, 4, 14);
                        Kn2 = a.Kn(14);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    T(18, 0, 1);
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "returnMatrix syncTaskCur");
                    AppMethodBeat.o(20316);
                    return Kn;
                case 38:
                    ab.d("MicroMsg.ExtControlProviderOpenApi", "connectWifi");
                    this.handler = new ak(Looper.getMainLooper());
                    Integer num = (Integer) new 2(this, strArr2).b(this.handler);
                    if (num == null) {
                        T(21, 4, 14);
                        Kn2 = a.Kn(14);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    T(20, 0, num.intValue());
                    Kn2 = a.Kn(num.intValue());
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 40:
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "setSportStep start");
                    if (strArr2 == null || strArr2.length < 3) {
                        ab.e("MicroMsg.ExtControlProviderOpenApi", "args error: args length error");
                        T(23, 3, 2);
                        Kn2 = a.Kn(2);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    long j2 = bo.getLong(strArr2[0], -1);
                    j = bo.getLong(strArr2[1], -1);
                    long j3 = bo.getLong(strArr2[2], -1);
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "setSportStep: timestampe: %s, stepcount: %s,  version: %s", new Object[]{Long.valueOf(j), Long.valueOf(j2), Long.valueOf(j3)});
                    if (j < 0 || j2 < 0 || j3 < 0) {
                        ab.i("MicroMsg.ExtControlProviderOpenApi", "param err");
                        T(23, 3, 2);
                        Kn2 = a.Kn(2);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    brI();
                    fp fpVar = new fp();
                    fpVar.czu.action = 2;
                    fpVar.czu.czw = j;
                    fpVar.czu.czx = j2;
                    fpVar.czu.baZ = j3;
                    if (com.tencent.mm.sdk.b.a.xxA.m(fpVar) && fpVar.czv.czz) {
                        T(22, 0, fpVar.czv.czA);
                        Kn2 = a.Kn(fpVar.czv.czA);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    T(23, 4, 8);
                    Kn2 = a.Kn(8);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 41:
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "getSportConfig start");
                    brI();
                    fp fpVar2 = new fp();
                    fpVar2.czu.action = 3;
                    if (com.tencent.mm.sdk.b.a.xxA.m(fpVar2) && fpVar2.czv.czz) {
                        str4 = fpVar2.czv.czy;
                        Kn2 = new MatrixCursor(lPI);
                        Kn2.addRow(new Object[]{Integer.valueOf(fpVar2.czv.czA), bo.nullAsNil(str4)});
                        T(22, 0, fpVar2.czv.czA);
                        ab.i("MicroMsg.ExtControlProviderOpenApi", "return  code =%s ", new Object[]{Integer.valueOf(fpVar2.czv.czA)});
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    T(23, 4, 8);
                    Kn2 = a.Kn(8);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 42:
                    intent2 = new Intent();
                    intent2.addFlags(131072);
                    intent2.putExtra("key_from_scene", 4);
                    if (strArr2 == null || strArr2.length <= 0 || strArr2[0].length() <= 0) {
                        ab.i("MicroMsg.ExtControlProviderOpenApi", "openOffline appid:%s", new Object[]{str3});
                    } else {
                        ab.i("MicroMsg.ExtControlProviderOpenApi", "openOffline business_attach:%s,appid:%s", new Object[]{strArr2[0], str3});
                        intent2.putExtra("key_business_attach", strArr2[0]);
                    }
                    intent2.putExtra("key_appid", str3);
                    d.b(this.context, "offline", ".ui.WalletOfflineEntranceUI", intent2);
                    h.pYm.e(12097, new Object[]{Integer.valueOf(9), Integer.valueOf(0), Long.valueOf(System.currentTimeMillis())});
                    T(24, 0, 1);
                    Kn2 = a.Kn(1);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 46:
                    ab.d("MicroMsg.ExtControlProviderOpenApi", "openClean appid:%s", new Object[]{str3});
                    aw.ZK();
                    if (com.tencent.mm.model.c.isSDCardAvailable()) {
                        intent2 = new Intent();
                        intent2.putExtra("key_from_openapi", true);
                        intent2.putExtra("key_openapi_appid", str3);
                        d.b(this.context, "clean", ".ui.CleanUI", intent2);
                        T(26, 0, 1);
                        Kn2 = a.Kn(1);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    T(27, 5, 4);
                    Kn2 = a.Kn(4101);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 48:
                    com.tencent.mm.plugin.ext.c.e.brW().mContext = this.context;
                    if (strArr2 == null || strArr2.length <= 0) {
                        ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: invalid arg length!");
                        Kn2 = a.Kn(4201);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    int i3 = bo.getInt(strArr2[0], -1);
                    if (i3 < 0 || !(i3 == 0 || i3 == 1 || i3 == 2)) {
                        ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: invalid command!");
                        T(32, 3, 2);
                        Kn2 = a.Kn(4201);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    }
                    str5 = null;
                    if (i3 != 0 && i3 != 1) {
                        str4 = null;
                    } else if (strArr2.length < 2) {
                        ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: invalid arg length when check or open!");
                        Kn2 = a.Kn(4205);
                        AppMethodBeat.o(20316);
                        return Kn2;
                    } else {
                        str3 = strArr2[1];
                        if (i3 != 1) {
                            str4 = str3;
                        } else if (strArr2.length < 3) {
                            ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: not providing md5!");
                            Kn2 = a.Kn(4208);
                            AppMethodBeat.o(20316);
                            return Kn2;
                        } else {
                            str5 = strArr2[2];
                            str4 = str3;
                        }
                    }
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "hy: cmdid: %d, yuvHandle: %s", new Object[]{Integer.valueOf(i3), str4});
                    com.tencent.mm.plugin.ext.c.e.a Lj;
                    switch (i3) {
                        case 0:
                            com.tencent.mm.plugin.ext.c.e brW = com.tencent.mm.plugin.ext.c.e.brW();
                            if (bo.isNullOrNil(str4)) {
                                ab.w("MicroMsg.ExtQrCodeHandler", "hy: null handle in doHandleCheckQrCode");
                                com.tencent.mm.plugin.ext.c.e.Q(null, -1, 4205);
                                Kn2 = a.Kn(4205);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            }
                            com.tencent.mm.plugin.ext.c.e.a aVar;
                            Lj = com.tencent.mm.plugin.ext.c.c.Lj(str4);
                            if (Lj == null || bo.isNullOrNil(Lj.url)) {
                                b aH = com.tencent.mm.plugin.ext.c.e.aH(str4, false);
                                if (aH == null) {
                                    ab.w("MicroMsg.ExtQrCodeHandler", "hy: not retrieved yuv data in doHandleCheckQrCode");
                                    com.tencent.mm.plugin.ext.c.e.Q(null, -1, 4206);
                                    Kn2 = a.Kn(4206);
                                    AppMethodBeat.o(20316);
                                    return Kn2;
                                }
                                Lj = brW.a(aH);
                                if (Lj == null || bo.isNullOrNil(Lj.url)) {
                                    ab.w("MicroMsg.ExtQrCodeHandler", "hy: not resolved model");
                                    Kn2 = a.Kn(4203);
                                    AppMethodBeat.o(20316);
                                    return Kn2;
                                }
                                aVar = Lj;
                            } else {
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: handled previously. yuvhandle: %s, url: %s. direct return", new Object[]{str4, Lj});
                                aVar = Lj;
                            }
                            if (aVar.type != 19) {
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: subapp code. can open");
                                Kn2 = a.Kn(1);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            } else if (com.tencent.mm.plugin.ext.c.c.Ll(aVar.url)) {
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: fastjudge wechat cannot open: %s", new Object[]{aVar.url.toUpperCase()});
                                com.tencent.mm.plugin.ext.c.e.Q(aVar.url, aVar.type, 4207);
                                Kn2 = a.aiv(aVar.url);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            } else if (com.tencent.mm.plugin.ext.c.c.Lk(aVar.url)) {
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: wechat can open: %s", new Object[]{aVar.url});
                                com.tencent.mm.plugin.ext.c.e.Q(aVar.url, aVar.type, 1);
                                Kn2 = a.Kn(1);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            } else {
                                j = bo.yz();
                                b$b Lm = com.tencent.mm.plugin.ext.c.c.Lm(aVar.url);
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: resolve config: %s, using: %d ms", new Object[]{Lm.toString(), Long.valueOf(bo.az(j))});
                                if (Lm == b$b.WHITE) {
                                    com.tencent.mm.plugin.ext.c.c.Lh(aVar.url);
                                    com.tencent.mm.plugin.ext.c.e.Q(aVar.url, aVar.type, 1);
                                    Kn2 = a.Kn(1);
                                    AppMethodBeat.o(20316);
                                    return Kn2;
                                }
                                if (Lm != b$b.BLACK) {
                                    String str6 = aVar.url;
                                    int i4 = aVar.type;
                                    int i5 = aVar.lRd;
                                    ab.i("MicroMsg.ExtQrCodeHandler", "hy: start remote judge url: %s", new Object[]{str6});
                                    long currentTimeMillis = System.currentTimeMillis();
                                    ab.i("MicroMsg.ExtQrCodeHandler", "hy: can open: %b, using %d ms", new Object[]{(Boolean) new 2(brW, Boolean.TRUE, str6, i4, i5).b(com.tencent.mm.plugin.ext.c.e.brY()), Long.valueOf(System.currentTimeMillis() - currentTimeMillis)});
                                    if (((Boolean) new 2(brW, Boolean.TRUE, str6, i4, i5).b(com.tencent.mm.plugin.ext.c.e.brY())).booleanValue()) {
                                        com.tencent.mm.plugin.ext.c.c.Lh(aVar.url);
                                        com.tencent.mm.plugin.ext.c.e.Q(aVar.url, aVar.type, 1);
                                        Kn2 = a.Kn(1);
                                        AppMethodBeat.o(20316);
                                        return Kn2;
                                    }
                                }
                                com.tencent.mm.plugin.ext.c.c.Li(aVar.url);
                                ab.w("MicroMsg.ExtQrCodeHandler", "hy: remote wechat cannot open: %s", new Object[]{aVar.url});
                                com.tencent.mm.plugin.ext.c.e.Q(aVar.url, aVar.type, 4207);
                                Kn2 = a.aiv(aVar.url);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            }
                        case 1:
                            com.tencent.mm.plugin.ext.c.e brW2 = com.tencent.mm.plugin.ext.c.e.brW();
                            if (bo.isNullOrNil(str4)) {
                                ab.w("MicroMsg.ExtQrCodeHandler", "hy: null handle in doHandleOpenQrCode");
                                com.tencent.mm.plugin.ext.c.e.R(null, -1, 4205);
                                Kn2 = a.Kn(4205);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            }
                            com.tencent.mm.plugin.ext.c.e.a Lj2 = com.tencent.mm.plugin.ext.c.c.Lj(str4);
                            if (Lj2 != null && !bo.isNullOrNil(Lj2.url)) {
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: handled previously. yuvhandle: %s, url: %s. direct return", new Object[]{str4, Lj2});
                                Lj = Lj2;
                            } else if (bo.isNullOrNil(str5)) {
                                ab.w("MicroMsg.ExtQrCodeHandler", "hy: md5 not correct!!");
                                com.tencent.mm.plugin.ext.c.e.R(null, -1, 4208);
                                Kn2 = a.Kn(4208);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            } else {
                                b aH2 = com.tencent.mm.plugin.ext.c.e.aH(str4, true);
                                if (aH2 == null) {
                                    ab.w("MicroMsg.ExtQrCodeHandler", "hy: not retrieved yuv data in doHandleOpenQrCode");
                                    com.tencent.mm.plugin.ext.c.e.R(null, -1, 4206);
                                    Kn2 = a.Kn(4206);
                                    AppMethodBeat.o(20316);
                                    return Kn2;
                                } else if (bo.isNullOrNil(aH2.cvZ)) {
                                    ab.w("MicroMsg.ExtQrCodeHandler", "hy: cannot retrieve md5 from yuv!");
                                    com.tencent.mm.plugin.ext.c.e.R(null, -1, 4210);
                                    Kn2 = a.Kn(4210);
                                    AppMethodBeat.o(20316);
                                    return Kn2;
                                } else if (aH2.cvZ.equalsIgnoreCase(str5)) {
                                    Lj = brW2.a(aH2);
                                    if (Lj == null || bo.isNullOrNil(Lj.url)) {
                                        ab.w("MicroMsg.ExtQrCodeHandler", "hy: not resolved model");
                                        com.tencent.mm.plugin.ext.c.e.R(null, -1, 4203);
                                        Kn2 = a.Kn(4203);
                                        AppMethodBeat.o(20316);
                                        return Kn2;
                                    }
                                    com.tencent.mm.plugin.ext.c.c.a(str4, Lj);
                                } else {
                                    ab.w("MicroMsg.ExtQrCodeHandler", "hy: yuv data not match!!");
                                    com.tencent.mm.plugin.ext.c.e.R(null, -1, 4209);
                                    Kn2 = a.Kn(4209);
                                    AppMethodBeat.o(20316);
                                    return Kn2;
                                }
                            }
                            if (Lj.type == 19 && com.tencent.mm.plugin.ext.c.c.Ll(Lj.url)) {
                                ab.i("MicroMsg.ExtQrCodeHandler", "hy: fastjudge wechat cannot open: %s", new Object[]{Lj.url});
                                com.tencent.mm.plugin.ext.c.e.R(Lj.url, Lj.type, 4207);
                                Kn2 = a.Kn(4207);
                                AppMethodBeat.o(20316);
                                return Kn2;
                            }
                            ab.i("MicroMsg.ExtQrCodeHandler", "hy: do open");
                            ab.i("MicroMsg.ExtQrCodeHandler", "hy: start open: %s", new Object[]{Lj.toString()});
                            intent = new Intent(brW2.mContext, RedirectToQrCodeStubUI.class);
                            intent.putExtra("K_STR", Lj.url);
                            intent.putExtra("K_TYPE", Lj.type);
                            intent.putExtra("K_VERSION", Lj.lRd);
                            intent.addFlags(ErrorDialogData.BINDER_CRASH);
                            brW2.mContext.startActivity(intent);
                            com.tencent.mm.plugin.ext.c.e.R(Lj.url, Lj.type, 1);
                            Kn2 = a.Kn(1);
                            AppMethodBeat.o(20316);
                            return Kn2;
                        case 2:
                            com.tencent.mm.plugin.ext.c.e.brW();
                            Kn2 = com.tencent.mm.plugin.ext.c.e.brX();
                            AppMethodBeat.o(20316);
                            return Kn2;
                        default:
                            AppMethodBeat.o(20316);
                            return null;
                    }
                case 51:
                    Kn2 = q(strArr2);
                    AppMethodBeat.o(20316);
                    return Kn2;
                case 52:
                    Kn2 = p(strArr2);
                    AppMethodBeat.o(20316);
                    return Kn2;
                default:
                    dZ(3, 15);
                    AppMethodBeat.o(20316);
                    return null;
            }
        } else {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "not login return code = 3");
            dZ(1, 3);
            Kn2 = a.Kn(3);
            AppMethodBeat.o(20316);
            return Kn2;
        }
    }

    private Cursor p(String[] strArr) {
        AppMethodBeat.i(20317);
        if (strArr == null || strArr.length == 0) {
            ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: invalid arg length!");
            MatrixCursor Kn = a.Kn(2);
            AppMethodBeat.o(20317);
            return Kn;
        }
        Cursor Kn2;
        try {
            int parseInt = Integer.parseInt(strArr[0]);
            if (1 == parseInt) {
                try {
                    int parseInt2 = Integer.parseInt(strArr[1]);
                    if (1 == parseInt2 || 2 == parseInt2) {
                        ((com.tencent.mm.plugin.appbrand.service.b) g.K(com.tencent.mm.plugin.appbrand.service.b.class)).F(this.context, parseInt2);
                    } else {
                        Kn2 = a.Kn(2);
                        AppMethodBeat.o(20317);
                        return Kn2;
                    }
                } catch (NumberFormatException e) {
                    ab.printErrStackTrace("MicroMsg.ExtControlProviderOpenApi", e, BuildConfig.FLAVOR, new Object[0]);
                    Kn2 = a.Kn(2);
                    AppMethodBeat.o(20317);
                    return Kn2;
                }
            } else if (2 == parseInt) {
                ((com.tencent.mm.plugin.appbrand.service.b) g.K(com.tencent.mm.plugin.appbrand.service.b.class)).cX(this.context);
            } else {
                Kn2 = a.Kn(2);
                AppMethodBeat.o(20317);
                return Kn2;
            }
            Kn2 = a.Kn(1);
            AppMethodBeat.o(20317);
            return Kn2;
        } catch (NumberFormatException e2) {
            ab.printErrStackTrace("MicroMsg.ExtControlProviderOpenApi", e2, BuildConfig.FLAVOR, new Object[0]);
            Kn2 = a.Kn(2);
            AppMethodBeat.o(20317);
            return Kn2;
        }
    }

    private static Cursor q(String[] strArr) {
        AppMethodBeat.i(20318);
        if (strArr == null || strArr.length < 2) {
            ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: invalid arg length!");
            MatrixCursor Kn = a.Kn(2);
            AppMethodBeat.o(20318);
            return Kn;
        }
        MatrixCursor matrixCursor = new MatrixCursor(lPM);
        try {
            int parseInt = Integer.parseInt(strArr[0]);
            int parseInt2 = Integer.parseInt(strArr[1]);
            List list = null;
            if (1 == parseInt) {
                list = ((ag) g.K(ag.class)).nA(parseInt2);
            } else if (2 == parseInt) {
                list = ((af) g.K(af.class)).a(parseInt2, null);
            }
            for (LocalUsageInfo localUsageInfo : com.tencent.luggage.g.c.C(list)) {
                WxaAttributes zc = ((com.tencent.mm.plugin.appbrand.service.d) g.K(com.tencent.mm.plugin.appbrand.service.d.class)).zc(localUsageInfo.appId);
                if (zc != null) {
                    String[] strArr2 = new String[]{zc.field_roundedSquareIconURL, zc.field_brandIconURL, zc.field_bigHeadURL};
                    com.tencent.mm.modelappbrand.b.a aVar = (com.tencent.mm.modelappbrand.b.a) g.K(com.tencent.mm.modelappbrand.b.a.class);
                    String packageName = ah.getPackageName();
                    parseInt2 = localUsageInfo.har;
                    String str = zc.field_username;
                    String str2 = zc.field_nickname;
                    String str3 = zc.field_appId;
                    g.RN();
                    Intent a = aVar.a(packageName, parseInt2, str, str2, strArr2, str3, com.tencent.mm.kernel.a.QF(), 3);
                    if (a != null) {
                        Bundle extras = a.getExtras();
                        if (extras != null) {
                            HashMap hashMap = new HashMap();
                            for (String str4 : extras.keySet()) {
                                hashMap.put(str4, extras.get(str4));
                            }
                            Object[] objArr = new Object[11];
                            objArr[0] = localUsageInfo.username;
                            objArr[1] = localUsageInfo.appId;
                            objArr[2] = Integer.valueOf(localUsageInfo.har);
                            objArr[3] = localUsageInfo.nickname;
                            objArr[4] = localUsageInfo.bQo;
                            objArr[5] = zc.field_brandIconURL;
                            objArr[6] = Integer.valueOf(localUsageInfo.haP ? 1 : 0);
                            objArr[7] = Long.valueOf(localUsageInfo.haQ);
                            objArr[8] = a.getPackage();
                            objArr[9] = a.getAction();
                            objArr[10] = new i(hashMap).toString();
                            matrixCursor.addRow(objArr);
                        }
                    }
                }
            }
            AppMethodBeat.o(20318);
            return matrixCursor;
        } catch (NumberFormatException e) {
            ab.printErrStackTrace("MicroMsg.ExtControlProviderOpenApi", e, BuildConfig.FLAVOR, new Object[0]);
            Cursor Kn2 = a.Kn(2);
            AppMethodBeat.o(20318);
            return Kn2;
        }
    }

    public Uri insert(Uri uri, ContentValues contentValues) {
        return null;
    }

    public int delete(Uri uri, String str, String[] strArr) {
        return 0;
    }

    public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        return 0;
    }

    private Cursor m(String str, String str2, String str3, String str4) {
        AppMethodBeat.i(20319);
        ab.i("MicroMsg.ExtControlProviderOpenApi", "registerMsgReceiver, op = %s", new Object[]{str});
        Cursor Kn;
        if (this.context == null) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "context == null return code = 2001");
            dZ(4, 2001);
            MatrixCursor Kn2 = a.Kn(2001);
            AppMethodBeat.o(20319);
            return Kn2;
        } else if (bo.isNullOrNil(str)) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "wrong args, op is null return code = 2002");
            dZ(3, 2002);
            Kn = a.Kn(2002);
            AppMethodBeat.o(20319);
            return Kn;
        } else {
            int i = -1;
            try {
                i = bo.getInt(str, -1);
            } catch (Exception e) {
            }
            if (i == 1) {
                Kn = P(str2, str3, str4);
                AppMethodBeat.o(20319);
                return Kn;
            } else if (i == 2) {
                ab.d("MicroMsg.ExtControlProviderOpenApi", "doUnRegisterMsgListener");
                if (com.tencent.mm.plugin.ext.b.brA().apN(this.lPW) == null) {
                    ab.w("MicroMsg.ExtControlProviderOpenApi", "This app never been registered, appId = %s, pkg = %s", new Object[]{this.lPW, brL()});
                    Kn = a.Kn(2007);
                    AppMethodBeat.o(20319);
                    return Kn;
                }
                boolean z;
                bp brA = com.tencent.mm.plugin.ext.b.brA();
                String str5 = this.lPW;
                if (str5 == null || str5.length() <= 0) {
                    z = false;
                } else {
                    if (brA.bSd.delete("OpenMsgListener", "appId=?", new String[]{bo.vA(str5)}) <= 0) {
                        z = false;
                    } else {
                        z = true;
                    }
                }
                ab.i("MicroMsg.ExtControlProviderOpenApi", "doUnRegisterMsgListener ret = %s, appId = %s, pkg = %s", new Object[]{Boolean.valueOf(z), this.lPW, brL()});
                if (z) {
                    T(0, 0, 1);
                    Kn = a.Kn(1);
                    AppMethodBeat.o(20319);
                    return Kn;
                }
                Kn = a.Kn(2008);
                AppMethodBeat.o(20319);
                return Kn;
            } else {
                ab.e("MicroMsg.ExtControlProviderOpenApi", "wrong args, no such op, %s", new Object[]{Integer.valueOf(i)});
                dZ(3, 2003);
                Kn = a.Kn(2003);
                AppMethodBeat.o(20319);
                return Kn;
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:33:0x0124  */
    private android.database.Cursor P(java.lang.String r11, java.lang.String r12, java.lang.String r13) {
        /*
        r10 = this;
        r0 = 20320; // 0x4f60 float:2.8474E-41 double:1.00394E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r0);
        r0 = "MicroMsg.ExtControlProviderOpenApi";
        r1 = "doRegisterMsgListener";
        com.tencent.mm.sdk.platformtools.ab.i(r0, r1);
        r0 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r11);
        if (r0 != 0) goto L_0x0020;
    L_0x0014:
        r0 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r12);
        if (r0 != 0) goto L_0x0020;
    L_0x001a:
        r0 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r13);
        if (r0 == 0) goto L_0x0047;
    L_0x0020:
        r0 = "MicroMsg.ExtControlProviderOpenApi";
        r1 = "wrong args, scene = %s, msgType = %s, msgState = %s";
        r2 = 3;
        r2 = new java.lang.Object[r2];
        r3 = 0;
        r2[r3] = r11;
        r3 = 1;
        r2[r3] = r12;
        r3 = 2;
        r2[r3] = r13;
        com.tencent.mm.sdk.platformtools.ab.e(r0, r1, r2);
        r0 = 3;
        r1 = 2004; // 0x7d4 float:2.808E-42 double:9.9E-321;
        r10.dZ(r0, r1);
        r0 = 2004; // 0x7d4 float:2.808E-42 double:9.9E-321;
        r0 = com.tencent.mm.pluginsdk.d.a.a.Kn(r0);
        r1 = 20320; // 0x4f60 float:2.8474E-41 double:1.00394E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.o(r1);
    L_0x0046:
        return r0;
    L_0x0047:
        r2 = 0;
        r1 = java.lang.Integer.parseInt(r13);	 Catch:{ Exception -> 0x0106 }
        r3 = java.lang.Integer.parseInt(r11);	 Catch:{ Exception -> 0x0106 }
        r4 = java.lang.Integer.parseInt(r12);	 Catch:{ Exception -> 0x0106 }
        r0 = 2;
        if (r1 == r0) goto L_0x007a;
    L_0x0057:
        r0 = "MicroMsg.ExtControlProviderOpenApi";
        r3 = "wrong msgState: ";
        r1 = java.lang.String.valueOf(r1);	 Catch:{ Exception -> 0x0106 }
        r1 = r3.concat(r1);	 Catch:{ Exception -> 0x0106 }
        com.tencent.mm.sdk.platformtools.ab.e(r0, r1);	 Catch:{ Exception -> 0x0106 }
        r0 = 3;
        r1 = 2005; // 0x7d5 float:2.81E-42 double:9.906E-321;
        r10.dZ(r0, r1);	 Catch:{ Exception -> 0x0106 }
        r0 = 2005; // 0x7d5 float:2.81E-42 double:9.906E-321;
        r0 = com.tencent.mm.pluginsdk.d.a.a.Kn(r0);	 Catch:{ Exception -> 0x0106 }
        r1 = 20320; // 0x4f60 float:2.8474E-41 double:1.00394E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.o(r1);
        goto L_0x0046;
    L_0x007a:
        r0 = com.tencent.mm.plugin.ext.b.brA();	 Catch:{ Exception -> 0x0106 }
        r5 = r10.lPW;	 Catch:{ Exception -> 0x0106 }
        r0 = r0.apN(r5);	 Catch:{ Exception -> 0x0106 }
        if (r0 != 0) goto L_0x0134;
    L_0x0086:
        r5 = new com.tencent.mm.storage.bo;	 Catch:{ Exception -> 0x0106 }
        r5.<init>();	 Catch:{ Exception -> 0x0106 }
        r0 = r10.lPW;	 Catch:{ Exception -> 0x0106 }
        r5.field_appId = r0;	 Catch:{ Exception -> 0x0106 }
        r0 = r10.brL();	 Catch:{ Exception -> 0x0106 }
        r5.field_packageName = r0;	 Catch:{ Exception -> 0x0106 }
        r0 = r10.lPW;	 Catch:{ Exception -> 0x0106 }
        r6 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r0);	 Catch:{ Exception -> 0x0106 }
        if (r6 == 0) goto L_0x00f8;
    L_0x009d:
        r0 = 0;
    L_0x009e:
        if (r0 == 0) goto L_0x0102;
    L_0x00a0:
        r0 = 1;
        r5.field_status = r0;	 Catch:{ Exception -> 0x0106 }
    L_0x00a3:
        r5.field_sceneFlag = r3;	 Catch:{ Exception -> 0x0106 }
        r5.field_msgTypeFlag = r4;	 Catch:{ Exception -> 0x0106 }
        r5.field_msgState = r1;	 Catch:{ Exception -> 0x0106 }
        r0 = com.tencent.mm.plugin.ext.b.brA();	 Catch:{ Exception -> 0x0106 }
        r0 = r0.b(r5);	 Catch:{ Exception -> 0x0106 }
        r4 = "MicroMsg.ExtControlProviderOpenApi";
        r6 = "registerMsgReceiver ret = %s, pkgName = %s, scene = %s, msgType = %s, msgState = %s, appStatus = %s";
        r7 = 6;
        r7 = new java.lang.Object[r7];	 Catch:{ Exception -> 0x0106 }
        r8 = 0;
        r9 = java.lang.Boolean.valueOf(r0);	 Catch:{ Exception -> 0x0106 }
        r7[r8] = r9;	 Catch:{ Exception -> 0x0106 }
        r8 = 1;
        r9 = r10.brL();	 Catch:{ Exception -> 0x0106 }
        r7[r8] = r9;	 Catch:{ Exception -> 0x0106 }
        r8 = 2;
        r3 = java.lang.Integer.valueOf(r3);	 Catch:{ Exception -> 0x0106 }
        r7[r8] = r3;	 Catch:{ Exception -> 0x0106 }
        r3 = 3;
        r8 = java.lang.Integer.valueOf(r1);	 Catch:{ Exception -> 0x0106 }
        r7[r3] = r8;	 Catch:{ Exception -> 0x0106 }
        r3 = 4;
        r1 = java.lang.Integer.valueOf(r1);	 Catch:{ Exception -> 0x0106 }
        r7[r3] = r1;	 Catch:{ Exception -> 0x0106 }
        r1 = 5;
        r3 = r5.field_status;	 Catch:{ Exception -> 0x0106 }
        r3 = java.lang.Integer.valueOf(r3);	 Catch:{ Exception -> 0x0106 }
        r7[r1] = r3;	 Catch:{ Exception -> 0x0106 }
        com.tencent.mm.sdk.platformtools.ab.i(r4, r6, r7);	 Catch:{ Exception -> 0x0106 }
        if (r0 != 0) goto L_0x014c;
    L_0x00eb:
        r0 = 2006; // 0x7d6 float:2.811E-42 double:9.91E-321;
        r0 = com.tencent.mm.pluginsdk.d.a.a.Kn(r0);	 Catch:{ Exception -> 0x0106 }
        r1 = 20320; // 0x4f60 float:2.8474E-41 double:1.00394E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.o(r1);
        goto L_0x0046;
    L_0x00f8:
        r6 = 1;
        r0 = com.tencent.mm.pluginsdk.model.app.g.bT(r0, r6);	 Catch:{ Exception -> 0x0106 }
        r0 = com.tencent.mm.pluginsdk.model.app.g.k(r0);	 Catch:{ Exception -> 0x0106 }
        goto L_0x009e;
    L_0x0102:
        r0 = 0;
        r5.field_status = r0;	 Catch:{ Exception -> 0x0106 }
        goto L_0x00a3;
    L_0x0106:
        r0 = move-exception;
        r1 = r0;
    L_0x0108:
        r0 = 1;
        r3 = 4;
        r4 = 12;
        r10.T(r0, r3, r4);
        r0 = "MicroMsg.ExtControlProviderOpenApi";
        r3 = "exception in doRegisterMsgListener, %s";
        r4 = 1;
        r4 = new java.lang.Object[r4];
        r5 = 0;
        r1 = r1.getMessage();
        r4[r5] = r1;
        com.tencent.mm.sdk.platformtools.ab.e(r0, r3, r4);
        if (r2 == 0) goto L_0x0127;
    L_0x0124:
        r2.close();
    L_0x0127:
        r0 = 12;
        r0 = com.tencent.mm.pluginsdk.d.a.a.Kn(r0);
        r1 = 20320; // 0x4f60 float:2.8474E-41 double:1.00394E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.o(r1);
        goto L_0x0046;
    L_0x0134:
        r0 = "MicroMsg.ExtControlProviderOpenApi";
        r1 = "This app had already been registered, appId = %s, pkg = %s";
        r3 = 2;
        r3 = new java.lang.Object[r3];	 Catch:{ Exception -> 0x0106 }
        r4 = 0;
        r5 = r10.lPW;	 Catch:{ Exception -> 0x0106 }
        r3[r4] = r5;	 Catch:{ Exception -> 0x0106 }
        r4 = 1;
        r5 = r10.brL();	 Catch:{ Exception -> 0x0106 }
        r3[r4] = r5;	 Catch:{ Exception -> 0x0106 }
        com.tencent.mm.sdk.platformtools.ab.w(r0, r1, r3);	 Catch:{ Exception -> 0x0106 }
    L_0x014c:
        r0 = new java.lang.StringBuilder;	 Catch:{ Exception -> 0x0106 }
        r0.<init>();	 Catch:{ Exception -> 0x0106 }
        r1 = com.tencent.mm.model.r.Yz();	 Catch:{ Exception -> 0x0106 }
        r0 = r0.append(r1);	 Catch:{ Exception -> 0x0106 }
        com.tencent.mm.model.aw.ZK();	 Catch:{ Exception -> 0x0106 }
        r1 = com.tencent.mm.model.c.QF();	 Catch:{ Exception -> 0x0106 }
        r0 = r0.append(r1);	 Catch:{ Exception -> 0x0106 }
        r0 = r0.toString();	 Catch:{ Exception -> 0x0106 }
        r1 = com.tencent.mm.sdk.platformtools.ag.ck(r0);	 Catch:{ Exception -> 0x0106 }
        r0 = new android.database.MatrixCursor;	 Catch:{ Exception -> 0x0106 }
        r3 = lPH;	 Catch:{ Exception -> 0x0106 }
        r0.<init>(r3);	 Catch:{ Exception -> 0x0106 }
        r2 = 2;
        r2 = new java.lang.Object[r2];	 Catch:{ Exception -> 0x01a9 }
        r3 = 0;
        r4 = 1;
        r4 = java.lang.Integer.valueOf(r4);	 Catch:{ Exception -> 0x01a9 }
        r2[r3] = r4;	 Catch:{ Exception -> 0x01a9 }
        r3 = 1;
        r1 = com.tencent.mm.sdk.platformtools.bo.nullAsNil(r1);	 Catch:{ Exception -> 0x01a9 }
        r2[r3] = r1;	 Catch:{ Exception -> 0x01a9 }
        r0.addRow(r2);	 Catch:{ Exception -> 0x01a9 }
        r1 = 0;
        r2 = 0;
        r3 = 1;
        r10.T(r1, r2, r3);	 Catch:{ Exception -> 0x01a9 }
        r1 = "MicroMsg.ExtControlProviderOpenApi";
        r2 = "return  code =%s ";
        r3 = 1;
        r3 = new java.lang.Object[r3];	 Catch:{ Exception -> 0x01a9 }
        r4 = 0;
        r5 = 1;
        r5 = java.lang.Integer.valueOf(r5);	 Catch:{ Exception -> 0x01a9 }
        r3[r4] = r5;	 Catch:{ Exception -> 0x01a9 }
        com.tencent.mm.sdk.platformtools.ab.i(r1, r2, r3);	 Catch:{ Exception -> 0x01a9 }
        r1 = 20320; // 0x4f60 float:2.8474E-41 double:1.00394E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.o(r1);
        goto L_0x0046;
    L_0x01a9:
        r1 = move-exception;
        r2 = r0;
        goto L_0x0108;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.ext.openapi.provider.ExtControlProviderOpenApi.P(java.lang.String, java.lang.String, java.lang.String):android.database.Cursor");
    }

    private Cursor r(String[] strArr) {
        AppMethodBeat.i(20321);
        ab.i("MicroMsg.ExtControlProviderOpenApi", "getUserAvatarByOpenId");
        if (strArr == null || strArr.length <= 0) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "wrong args");
            dZ(3, 3001);
            MatrixCursor Kn = a.Kn(3001);
            AppMethodBeat.o(20321);
            return Kn;
        }
        Cursor matrixCursor = new MatrixCursor(lPJ);
        int i = 0;
        while (i < strArr.length && i < 5) {
            try {
                if (!bo.isNullOrNil(strArr[i])) {
                    bz apZ = com.tencent.mm.plugin.ext.b.brB().apZ(strArr[i]);
                    if (apZ == null || bo.isNullOrNil(apZ.field_openId) || bo.isNullOrNil(apZ.field_username)) {
                        ab.e("MicroMsg.ExtControlProviderOpenApi", "openidInApp is null");
                    } else {
                        aw.ZK();
                        ad aoO = com.tencent.mm.model.c.XM().aoO(apZ.field_username);
                        if (aoO == null || aoO.field_username == null || aoO.field_username.length() <= 0) {
                            ab.e("MicroMsg.ExtControlProviderOpenApi", "contact is null");
                        } else {
                            o.acd();
                            String D = com.tencent.mm.ah.d.D(aoO.field_username, false);
                            if (bo.isNullOrNil(D)) {
                                ab.w("MicroMsg.ExtControlProviderOpenApi", "hy: get avatar sfs path is null or nil");
                            } else {
                                String str;
                                if (D.startsWith(g.RP().cachePath)) {
                                    str = g.RP().eJM + D.substring(g.RP().cachePath.length());
                                    e.tf(e.atb(str));
                                    e.y(D, str);
                                } else {
                                    str = D;
                                }
                                com.tencent.mm.ah.d.b.qk(str);
                                matrixCursor.addRow(new Object[]{strArr[i], str});
                            }
                        }
                    }
                }
                i++;
            } catch (Exception e) {
                ab.e("MicroMsg.ExtControlProviderOpenApi", "Exception occur, %s", new Object[]{e.getMessage()});
                T(7, 4, 12);
                matrixCursor.close();
                matrixCursor = a.Kn(12);
                AppMethodBeat.o(20321);
                return matrixCursor;
            }
        }
        T(6, 0, 1);
        AppMethodBeat.o(20321);
        return matrixCursor;
    }

    private Cursor s(String[] strArr) {
        AppMethodBeat.i(20322);
        ab.i("MicroMsg.ExtControlProviderOpenApi", "decodeVoice");
        MatrixCursor Kn;
        if (strArr == null || strArr.length <= 0 || strArr[0].length() <= 0) {
            ab.e("MicroMsg.ExtControlProviderOpenApi", "decodeVoice wrong args");
            dZ(3, 3101);
            Kn = a.Kn(3101);
            AppMethodBeat.o(20322);
            return Kn;
        }
        Kn = null;
        int i = 0;
        while (i < 5 && i < strArr.length) {
            String str = strArr[i];
            try {
                if (com.tencent.mm.modelvoice.o.i(str, 0, true)) {
                    String str2;
                    if (Kn == null) {
                        Kn = new MatrixCursor(lPK);
                    }
                    com.tencent.mm.modelvoice.i iVar = new com.tencent.mm.modelvoice.i();
                    String str3 = com.tencent.mm.plugin.ext.b.brD() + "/" + com.tencent.mm.sdk.platformtools.ag.ck(str);
                    ab.i("MicroMsg.ExtControlProviderOpenApi", "summerpcm pcmPath[%s]", new Object[]{str3});
                    if (e.asZ(str3) > 0) {
                        ab.d("MicroMsg.ExtControlProviderOpenApi", "pcm already exist");
                        str2 = str3;
                    } else {
                        str2 = iVar.aX(str, str3);
                    }
                    if (e.asZ(str3) == 0) {
                        str2 = iVar.aX(str, str3);
                    }
                    if (bo.isNullOrNil(str2)) {
                        ab.w("MicroMsg.ExtControlProviderOpenApi", "wrong args targetFilePath is null");
                    } else {
                        ab.d("MicroMsg.ExtControlProviderOpenApi", "decode to pcm success %d", new Object[]{Integer.valueOf(i)});
                        Kn.addRow(new Object[]{Integer.valueOf(1), Integer.valueOf(iVar.mSampleRate), Integer.valueOf(iVar.cpQ), Integer.valueOf(2), str2});
                    }
                } else {
                    ab.w("MicroMsg.ExtControlProviderOpenApi", "wrong args : %s", new Object[]{strArr[i]});
                }
            } catch (Exception e) {
                ab.e("MicroMsg.ExtControlProviderOpenApi", "Exception in decodeVoice, %s", new Object[]{e.getMessage()});
            }
            i++;
        }
        if (Kn != null) {
            T(8, 0, 1);
            AppMethodBeat.o(20322);
            return Kn;
        }
        T(9, 3, 4);
        Cursor Kn2 = a.Kn(4);
        AppMethodBeat.o(20322);
        return Kn2;
    }

    private void brI() {
        AppMethodBeat.i(20323);
        String str = (String) com.tencent.mm.plugin.ext.b.brz().get(ac.a.xOC, null);
        ab.i("MicroMsg.ExtControlProviderOpenApi", "setSportBroadPkg: pkgNames: %s, pkg: %s", new Object[]{str, brL()});
        if (str != null) {
            if (!com.tencent.mm.compatible.loader.a.contains(str.split(";"), r1)) {
                com.tencent.mm.plugin.ext.b.brz().set(ac.a.xOC, str + ";" + brL());
            }
            AppMethodBeat.o(20323);
            return;
        }
        com.tencent.mm.plugin.ext.b.brz().set(ac.a.xOC, brL());
        AppMethodBeat.o(20323);
    }
}
