WeChat.apk(点击下载) / e$$q.java


package qd;

import android.view.Surface;
import bb.e;
import com.tencent.kinda.framework.widget.tools.ConstantsKinda;
import com.tencent.live2.jsplugin.V2TXJSAdapterConstants;
import com.tencent.mm.plugin.appbrand.p;
import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.Util;
import com.tencent.tav.core.AssetExtension;
import com.tencent.tmassistantsdk.openSDK.QQDownloader.AssistantStore;
import et0.g;
import ft0.b0;
import ft0.d0;
import ft0.e0;
import ft0.f0;
import ft0.g0;
import ft0.q;
import ft0.t;
import ft0.u;
import ft0.y;
import gx0.k;
import hd.c;
import id.r;
import id.s;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import lh4.m;
import org.json.JSONArray;
import org.json.JSONObject;
import pn0.i;
import qn0.e;
import qn0.f;
import rn0.l;
import rn0.q;
import rx.schedulers.Schedulers;
import sd.a;
import sd.b;
import sd.d;
import tm4.h;

public class e$$q implements Runnable {

    /* renamed from: d  reason: collision with root package name */
    public final /* synthetic */ c f288954d;

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

    public e$$q(e eVar, c cVar) {
        this.f288955e = eVar;
        this.f288954d = cVar;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:303:0x083d, code lost:
        if (r0.r(r3) != false) goto L_0x083f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:312:0x085d, code lost:
        if (r0.g(r3) != false) goto L_0x083f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:439:0x0bd3, code lost:
        if (r0.r(r3) != false) goto L_0x0bd5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:447:0x0bee, code lost:
        if (r0.g(r3) != false) goto L_0x0bd5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:454:0x0c0c, code lost:
        if (r0.o(r3) != false) goto L_0x0c0e;
     */
    /* JADX WARNING: Removed duplicated region for block: B:134:0x046b  */
    /* JADX WARNING: Removed duplicated region for block: B:135:0x046d  */
    /* JADX WARNING: Removed duplicated region for block: B:138:0x047e  */
    /* JADX WARNING: Removed duplicated region for block: B:140:0x0488  */
    /* JADX WARNING: Removed duplicated region for block: B:147:0x04a1  */
    /* JADX WARNING: Removed duplicated region for block: B:150:0x04af  */
    /* JADX WARNING: Removed duplicated region for block: B:153:0x04c0  */
    /* JADX WARNING: Removed duplicated region for block: B:156:0x04ce  */
    /* JADX WARNING: Removed duplicated region for block: B:170:0x0518  */
    /* JADX WARNING: Removed duplicated region for block: B:173:0x0528  */
    /* JADX WARNING: Removed duplicated region for block: B:176:0x0538  */
    /* JADX WARNING: Removed duplicated region for block: B:198:0x0596  */
    /* JADX WARNING: Removed duplicated region for block: B:207:0x05e6  */
    /* JADX WARNING: Removed duplicated region for block: B:210:0x05f0  */
    /* JADX WARNING: Removed duplicated region for block: B:218:0x060e  */
    /* JADX WARNING: Removed duplicated region for block: B:221:0x061b  */
    /* JADX WARNING: Removed duplicated region for block: B:227:0x063d  */
    /* JADX WARNING: Removed duplicated region for block: B:245:0x06e4  */
    /* JADX WARNING: Removed duplicated region for block: B:487:0x0ccb  */
    /* JADX WARNING: Removed duplicated region for block: B:491:0x0cf3  */
    /* JADX WARNING: Removed duplicated region for block: B:509:0x0d43  */
    /* JADX WARNING: Removed duplicated region for block: B:510:0x0d45  */
    public void run() {
        String str;
        String str2;
        String str3;
        boolean z15;
        boolean z16;
        String str4;
        String str5;
        String str6;
        String str7;
        boolean z17;
        boolean z18;
        boolean z19;
        boolean z25;
        boolean z26;
        String str8;
        boolean z27;
        String str9;
        boolean z28;
        boolean z29;
        boolean z35;
        boolean z36;
        d dVar;
        JSONObject optJSONObject;
        d dVar2;
        e eVar = this.f288955e;
        c cVar = this.f288954d;
        eVar.getClass();
        String f15 = cVar.f();
        if (!Util.isNullOrNil(f15)) {
            Log.i(eVar.x(), "*** handler(%s) handleJsApi(%s), data:%s", eVar.p(), f15, cVar.b().toString());
            String str10 = f15;
            if (f15.contains("insert")) {
                eVar.f288924s = cVar;
                a aVar = eVar.f288896a1;
                if (aVar != null) {
                    aVar.a(cVar.g());
                }
                if (eVar.f288904h == null) {
                    Log.w(eVar.x(), "insert, media player is null");
                    eVar.u(eVar.f288924s);
                }
                Log.i(eVar.x(), "registerLifecycleListener");
                j jVar = new j(eVar);
                eVar.f288926t = jVar;
                cVar.c(jVar);
                b bVar = eVar.f288920q;
                if (bVar != null) {
                    bVar.p(cVar);
                }
                if (!(eVar.f288902g == null || eVar.f288904h == null)) {
                    Log.i(eVar.x(), "insert, setSurface");
                    eVar.f288904h.setSurface(eVar.f288902g);
                }
                JSONObject b15 = cVar.b();
                eVar.f288934z = b15.optBoolean(V2TXJSAdapterConstants.PLAYER_KEY_AUTO_PLAY, false);
                eVar.f288932y = (long) (b15.optDouble("initialTime", 0.0d) * 1000.0d);
                eVar.D = b15.optBoolean("loop", false);
                boolean optBoolean = b15.optBoolean("muted", false);
                eVar.E = optBoolean;
                eVar.f288904h.setMute(optBoolean);
                eVar.Q = b15.optBoolean("autoPauseIfNavigate", true);
                eVar.R = b15.optBoolean("autoPauseIfOpenNative", true);
                boolean optBoolean2 = b15.optBoolean("needEvent", false);
                eVar.B = optBoolean2;
                if (optBoolean2 && (dVar2 = eVar.f288906i) != null) {
                    g gVar = (g) dVar2;
                    boolean z37 = cVar instanceof com.tencent.mm.plugin.appbrand.extendplugin.b;
                    if (z37) {
                        gVar.f209109b = (com.tencent.mm.plugin.appbrand.extendplugin.b) cVar;
                    }
                    String optString = b15.optString("data", "");
                    ((g) eVar.f288906i).f209113f = optString;
                    a aVar2 = eVar.f288908j;
                    if (aVar2 != null) {
                        et0.a aVar3 = (et0.a) aVar2;
                        if (z37) {
                            aVar3.f209066c = (com.tencent.mm.plugin.appbrand.extendplugin.b) cVar;
                        }
                        et0.a aVar4 = (et0.a) eVar.f288908j;
                        aVar4.getClass();
                        m.g(optString, "data");
                        aVar4.f209065b = optString;
                    }
                }
                if (b15.has("position") && (optJSONObject = b15.optJSONObject("position")) != null) {
                    eVar.F = k.c(optJSONObject.optInt("width", 0));
                    eVar.G = k.c(optJSONObject.optInt("height", 0));
                    Log.i(eVar.x(), "insert, size:[%d, %d]", Integer.valueOf(eVar.F), Integer.valueOf(eVar.G));
                }
                String optString2 = b15.optString(V2TXJSAdapterConstants.PLAYER_KEY_OBJECTFIT, "contain");
                eVar.P = optString2;
                if (Util.isNullOrNil(optString2)) {
                    eVar.P = "contain";
                }
                eVar.q(true);
                com.tencent.mm.plugin.appbrand.jsapi.g g15 = cVar.g();
                if (g15 == null) {
                    Log.w(eVar.x(), "updateReferrers, component is null");
                } else {
                    xq0.a aVar5 = (xq0.a) e.a(xq0.a.class);
                    if (aVar5 == null) {
                        Log.w(eVar.x(), "updateReferrers, referrerHelper is null");
                    } else {
                        if (eVar.X0 == null) {
                            eVar.X0 = aVar5.I5();
                        }
                        xq0.c F3 = aVar5.F3(b15, g15);
                        if (F3 != null) {
                            eVar.X0 = F3;
                        }
                        Log.i(eVar.x(), "updateReferrers, mReferrerPolicy: " + eVar.X0);
                        if (xq0.c.NO_REFERRER == eVar.X0) {
                            eVar.Y0 = null;
                        } else {
                            eVar.Y0 = aVar5.j9(g15);
                            Log.i(eVar.x(), "updateReferrers, mReferrer: " + eVar.Y0);
                        }
                    }
                }
                vr0.d dVar3 = eVar.f288904h;
                if (b15.has("preferredPeakBitRate")) {
                    dVar3.g(b15.optDouble("preferredPeakBitRate"));
                }
                eVar.N = b15.optString(AssistantStore.DownloadInfos.DownloadInfoColumns.FILEPATH);
                eVar.Z = b15.optBoolean("isDrm", eVar.Z);
                eVar.f288918p0 = b15.optBoolean("isLive", eVar.f288918p0);
                eVar.f288931x0 = b15.optString("provisionUrl", eVar.f288931x0);
                eVar.f288933y0 = b15.optString("licenseUrl", eVar.f288933y0);
                if (!Util.isNullOrNil(eVar.N)) {
                    b bVar2 = eVar.f288920q;
                    if (bVar2 != null) {
                        bVar2.t(eVar.f288924s, eVar.f288904h, eVar.N);
                    }
                    String str11 = eVar.N;
                    b bVar3 = eVar.f288920q;
                    if (bVar3 != null) {
                        str11 = bVar3.s(cVar, str11);
                    }
                    Log.i(eVar.x(), "insert, path:%s, proxy:%s", eVar.N, str11);
                    if (!Util.isNullOrNil(str11)) {
                        if (eVar.Z) {
                            String str12 = Util.isNullOrNil(eVar.f288931x0) ? null : eVar.f288931x0;
                            String str13 = Util.isNullOrNil(eVar.f288933y0) ? null : eVar.f288933y0;
                            boolean z38 = eVar.f288918p0;
                            Log.i(eVar.x(), "insert, isDrm, provisionUrl:%s, licenseUrl:%s, isLive: %b", str12, str13, Boolean.valueOf(z38));
                            eVar.f288904h.u(str11, str12, str13, z38);
                        } else {
                            eVar.f288904h.f(str11, eVar.Y0);
                        }
                        Log.i(eVar.x(), "insert, media player prepare async");
                        eVar.E(true);
                    }
                }
                eVar.f288919p1 = b15.optString(FFmpegMetadataRetriever.METADATA_KEY_TITLE, eVar.f288919p1);
                eVar.f288921q1 = b15.optString("backgroundPoster", eVar.f288921q1);
                if (b15.optBoolean("enableCasting", false)) {
                    boolean optBoolean3 = b15.optBoolean("enableCasting");
                    eVar.x();
                    if (eVar.f288922r == null) {
                        eVar.f288922r = eVar.f288920q.j(eVar.f288908j, cVar);
                    }
                    eVar.f288922r.f209076h = optBoolean3;
                }
                cVar.k("ok");
                str3 = "";
            } else if (!str10.contains("update")) {
                String str14 = "ok";
                if (!str10.contains("operate") || !str10.contains("Background")) {
                    if (!str10.contains("operate")) {
                        str = "";
                        str2 = str10;
                        if (str2.contains("remove")) {
                            eVar.G();
                            cVar.k(str14);
                            eVar.f288901f1.k(cVar);
                        }
                        eVar.f288900e1.a(str2, cVar);
                        String str15 = eVar.N;
                        eVar.f288901f1.j(cVar, str15 != null ? str15 : str);
                    } else if (eVar.f288904h == null) {
                        Log.w(eVar.x(), "operate, media player is null");
                        cVar.k("fail");
                    } else {
                        JSONObject b16 = cVar.b();
                        String optString3 = b16.optString("type");
                        if (!Util.isNullOrNil(optString3)) {
                            Log.i(eVar.x(), "operate, type:%s", optString3);
                            if (optString3.equalsIgnoreCase("startCasting")) {
                                z15 = true;
                            } else {
                                if (eVar.f288922r != null) {
                                    et0.b bVar4 = eVar.f288922r;
                                    if (bVar4.f209076h) {
                                        z15 = bVar4.f209077i;
                                    }
                                }
                                z15 = false;
                            }
                            str = "";
                            str10 = str10;
                            if (z15) {
                                Log.i(eVar.x(), "video cast operate, type:%s", optString3);
                                if (eVar.f288922r == null && eVar.f288922r == null) {
                                    eVar.f288922r = eVar.f288920q.j(eVar.f288908j, cVar);
                                }
                                et0.b bVar5 = eVar.f288922r;
                                String str16 = eVar.N;
                                bVar5.getClass();
                                m.g(str16, ConstantsKinda.INTENT_LITEAPP_PATH);
                                ft0.c cVar2 = bVar5.f209073e;
                                if (cVar2 != null) {
                                    cVar2.setVideoPath(str16);
                                }
                                bVar5.f209075g = str16;
                                et0.b bVar6 = eVar.f288922r;
                                vr0.d dVar4 = eVar.f288904h;
                                if (dVar4 != null) {
                                    dVar4.getCurrentPosition();
                                }
                                bVar6.getClass();
                                if (optString3.equalsIgnoreCase("requestFullScreen")) {
                                    Log.i(eVar.x(), "requestFullscreen");
                                    b bVar7 = eVar.f288920q;
                                    if (bVar7 != null) {
                                    }
                                    z16 = false;
                                    str5 = "stop";
                                    str4 = "pause";
                                    str6 = "exitPictureInPicture";
                                    if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                        Log.i(eVar.x(), "getSnapshotCached");
                                        if (eVar.f288920q == null) {
                                            cVar.k("fail:snapshot error");
                                        } else {
                                            eVar.W0 = cVar;
                                            Log.i(eVar.x(), "takeScreenshot");
                                            hd.g.b(eVar.f310982f, eVar.f310981e, eVar.f310980d);
                                        }
                                    } else if (!optString3.equalsIgnoreCase(str6)) {
                                        if (z16) {
                                            str7 = str14;
                                        } else {
                                            str7 = "fail";
                                        }
                                        cVar.k(str7);
                                    }
                                    if (optString3.equalsIgnoreCase(str4) || optString3.equalsIgnoreCase(str5)) {
                                        eVar.f288901f1.k(cVar);
                                    }
                                    str2 = str10;
                                    eVar.f288900e1.a(str2, cVar);
                                    String str152 = eVar.N;
                                    eVar.f288901f1.j(cVar, str152 != null ? str152 : str);
                                } else if (optString3.equalsIgnoreCase("exitFullScreen")) {
                                    Log.i(eVar.x(), "exitFullscreen");
                                    b bVar8 = eVar.f288920q;
                                    if (bVar8 != null) {
                                    }
                                    z16 = false;
                                    str5 = "stop";
                                    str4 = "pause";
                                    str6 = "exitPictureInPicture";
                                    if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                    }
                                    eVar.f288901f1.k(cVar);
                                    str2 = str10;
                                    eVar.f288900e1.a(str2, cVar);
                                    String str1522 = eVar.N;
                                    eVar.f288901f1.j(cVar, str1522 != null ? str1522 : str);
                                } else {
                                    et0.b bVar9 = eVar.f288922r;
                                    bVar9.getClass();
                                    String optString4 = b16.optString("type");
                                    Log.i("MicroMsg.VideoCast.AppBrandVideoCastHandler", "handleOperate: type = " + optString4);
                                    if (optString4 != null) {
                                        switch (optString4.hashCode()) {
                                            case -1983381905:
                                                str4 = "pause";
                                                if (optString4.equals("switchCasting")) {
                                                    ft0.c cVar3 = bVar9.f209073e;
                                                    if (cVar3 != null) {
                                                        cVar3.G2(4);
                                                    }
                                                    z25 = true;
                                                    bVar9.b().d(false, true);
                                                    z16 = z25;
                                                    break;
                                                }
                                                z25 = true;
                                                z16 = z25;
                                            case -1491869371:
                                                str4 = "pause";
                                                if (optString4.equals("exitCasting")) {
                                                    ft0.c cVar4 = bVar9.f209073e;
                                                    if (cVar4 != null) {
                                                        cVar4.G2(6);
                                                    }
                                                    q b17 = bVar9.b();
                                                    d0 d0Var = d0.f216773d;
                                                    b17.getClass();
                                                    m.g(d0Var, "action");
                                                    b17.f216842e.b().e(new e0(b17, d0Var));
                                                    bVar9.b().b();
                                                    bVar9.f209077i = false;
                                                    bVar9.c(false);
                                                }
                                                z25 = true;
                                                z16 = z25;
                                                break;
                                            case 3443508:
                                                str4 = "pause";
                                                if (optString4.equals(AssetExtension.SCENE_PLAY)) {
                                                    bVar9.b().c(-1, -1);
                                                }
                                                z25 = true;
                                                z16 = z25;
                                                break;
                                            case 3526264:
                                                str4 = "pause";
                                                if (optString4.equals("seek")) {
                                                    long j15 = -1;
                                                    if (b16.has("data")) {
                                                        JSONArray optJSONArray = b16.optJSONArray("data");
                                                        if (optJSONArray == null || optJSONArray.length() == 0) {
                                                            Log.w("MicroMsg.VideoCast.AppBrandVideoCastHandler", "parseSeekPosition, data array is null");
                                                        } else {
                                                            double optDouble = optJSONArray.optDouble(0, -1.0d);
                                                            if (optDouble < 0.0d) {
                                                                Log.w("MicroMsg.VideoCast.AppBrandVideoCastHandler", "parseSeekPosition, invalid position:%s", Double.valueOf(optDouble));
                                                            } else {
                                                                Log.i("MicroMsg.VideoCast.AppBrandVideoCastHandler", "parseSeekPosition, position:%s", Double.valueOf(optDouble));
                                                                j15 = (long) (optDouble * ((double) 1000));
                                                            }
                                                        }
                                                    }
                                                    if (j15 > 0) {
                                                        q b18 = bVar9.b();
                                                        String a15 = et0.b.f209067n.a((int) j15);
                                                        b18.getClass();
                                                        qn0.c b19 = b18.f216842e.b();
                                                        b0 b0Var = new b0(b18, a15);
                                                        f fVar = b19.f290434c;
                                                        if (fVar != null) {
                                                            b19.f290433b.g(new i(b19.a(fVar), b19.f290434c.f290453a, a15), b0Var);
                                                        }
                                                    } else {
                                                        Log.i("MicroMsg.VideoCast.AppBrandVideoCastHandler", "invalid seek position");
                                                        str5 = "stop";
                                                        str6 = "exitPictureInPicture";
                                                        z16 = false;
                                                        if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                                        }
                                                        eVar.f288901f1.k(cVar);
                                                        str2 = str10;
                                                        eVar.f288900e1.a(str2, cVar);
                                                        String str15222 = eVar.N;
                                                        eVar.f288901f1.j(cVar, str15222 != null ? str15222 : str);
                                                    }
                                                }
                                                z25 = true;
                                                z16 = z25;
                                                break;
                                            case 106440182:
                                                str4 = "pause";
                                                if (optString4.equals(str4)) {
                                                    q b25 = bVar9.b();
                                                    t tVar = t.f216874d;
                                                    b25.getClass();
                                                    m.g(tVar, "action");
                                                    qn0.c b26 = b25.f216842e.b();
                                                    u uVar = new u(b25, tVar);
                                                    f fVar2 = b26.f290434c;
                                                    if (fVar2 != null) {
                                                        b26.f290433b.g(new pn0.f(b26.a(fVar2), b26.f290434c.f290453a), uVar);
                                                    }
                                                }
                                                z25 = true;
                                                z16 = z25;
                                                break;
                                            case 420897153:
                                                if (optString4.equals("startCasting")) {
                                                    bVar9.b().f216845h = new et0.c(bVar9);
                                                    bVar9.b().d(true, false);
                                                }
                                                str5 = "stop";
                                                str4 = "pause";
                                                str6 = "exitPictureInPicture";
                                                z16 = true;
                                                if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                                }
                                                eVar.f288901f1.k(cVar);
                                                str2 = str10;
                                                eVar.f288900e1.a(str2, cVar);
                                                String str152222 = eVar.N;
                                                eVar.f288901f1.j(cVar, str152222 != null ? str152222 : str);
                                            case 1082113260:
                                                if (optString4.equals("reconnectCasting")) {
                                                    ft0.c cVar5 = bVar9.f209073e;
                                                    if (cVar5 != null) {
                                                        cVar5.G2(5);
                                                    }
                                                    q b27 = bVar9.b();
                                                    if (b27.f216842e.b().f290436e.f290446a == e.a.Playing) {
                                                        ((et0.a) b27.f216839b).e(true);
                                                    } else {
                                                        f0 f0Var = b27.f216842e;
                                                        y yVar = new y(b27);
                                                        f0Var.getClass();
                                                        try {
                                                            f0Var.f216788g.b();
                                                            qn0.a b28 = qn0.a.b();
                                                            b28.f290419a = true;
                                                            for (qn0.c cVar6 : ((HashMap) b28.f290420b).values()) {
                                                                cVar6.h();
                                                                cVar6.i();
                                                                cVar6.f290439h = null;
                                                            }
                                                            b28.e(f0Var.f216791j);
                                                            b28.e(f0Var.f216790i);
                                                            b28.a();
                                                            try {
                                                                int i15 = rn0.q.f296617h;
                                                                q.e.f296631a.a();
                                                            } catch (un0.a unused) {
                                                            }
                                                            l.c.f296592a.a();
                                                        } catch (Exception e15) {
                                                            Log.e("MicroMsg.VideoCast.VideoCastDeviceManager", "Error happen while cleaning up " + e15.getMessage());
                                                        }
                                                        if (!f0Var.d()) {
                                                            Log.i("MicroMsg.VideoCast.VideoCastDeviceManager", "reconnect: not enableRouter");
                                                            break;
                                                        } else {
                                                            f0Var.f216789h = yVar;
                                                            qn0.a.b().c(f0Var.f216790i);
                                                            f0Var.c();
                                                            f0Var.f216788g.a(qm4.e.c(new h(10, TimeUnit.SECONDS, Schedulers.computation())).g(new g0(f0Var)));
                                                        }
                                                    }
                                                    str5 = "stop";
                                                    str4 = "pause";
                                                    str6 = "exitPictureInPicture";
                                                    z16 = true;
                                                    if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                                    }
                                                    eVar.f288901f1.k(cVar);
                                                    str2 = str10;
                                                    eVar.f288900e1.a(str2, cVar);
                                                    String str1522222 = eVar.N;
                                                    eVar.f288901f1.j(cVar, str1522222 != null ? str1522222 : str);
                                                }
                                                break;
                                        }
                                    }
                                    str4 = "pause";
                                    z25 = true;
                                    z16 = z25;
                                }
                                z16 = true;
                                str5 = "stop";
                                str4 = "pause";
                                str6 = "exitPictureInPicture";
                                if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                }
                                eVar.f288901f1.k(cVar);
                                str2 = str10;
                                eVar.f288900e1.a(str2, cVar);
                                String str15222222 = eVar.N;
                                eVar.f288901f1.j(cVar, str15222222 != null ? str15222222 : str);
                            }
                            str4 = "pause";
                            if (optString3.equalsIgnoreCase(AssetExtension.SCENE_PLAY)) {
                                z16 = eVar.D(false, true);
                            } else if (optString3.equalsIgnoreCase(str4)) {
                                z16 = eVar.C(false);
                            } else {
                                str5 = "stop";
                                if (optString3.equalsIgnoreCase(str5)) {
                                    z16 = eVar.O();
                                    if (z16 && eVar.V) {
                                        Log.i(eVar.x(), "stop, isRuntimeInBackground, setPlayingWhenEnterBackground false");
                                        eVar.W = new AtomicBoolean(false);
                                    }
                                } else {
                                    if (optString3.equalsIgnoreCase("seek")) {
                                        if (eVar.f288904h != null && b16.has("data")) {
                                            JSONArray optJSONArray2 = b16.optJSONArray("data");
                                            if (optJSONArray2 == null || optJSONArray2.length() == 0) {
                                                Log.w(eVar.x(), "seek, data array is null");
                                            } else {
                                                double optDouble2 = optJSONArray2.optDouble(0, -1.0d);
                                                if (optDouble2 < 0.0d) {
                                                    Log.w(eVar.x(), "seek, invalid position:%s", Double.valueOf(optDouble2));
                                                } else {
                                                    eVar.K((long) (optDouble2 * 1000.0d));
                                                }
                                            }
                                        }
                                        str6 = "exitPictureInPicture";
                                        z16 = false;
                                        if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                        }
                                        eVar.f288901f1.k(cVar);
                                        str2 = str10;
                                        eVar.f288900e1.a(str2, cVar);
                                        String str152222222 = eVar.N;
                                        eVar.f288901f1.j(cVar, str152222222 != null ? str152222222 : str);
                                    }
                                    if (!optString3.equalsIgnoreCase("playbackRate")) {
                                        z17 = false;
                                        if (optString3.equalsIgnoreCase("requestFullScreen")) {
                                            Log.i(eVar.x(), "requestFullscreen");
                                            b bVar10 = eVar.f288920q;
                                            if (bVar10 != null) {
                                            }
                                            z16 = false;
                                        } else if (optString3.equalsIgnoreCase("exitFullScreen")) {
                                            Log.i(eVar.x(), "exitFullscreen");
                                            b bVar11 = eVar.f288920q;
                                            if (bVar11 != null) {
                                            }
                                            z16 = false;
                                        } else if (optString3.equalsIgnoreCase("setScreenBrightness")) {
                                            Log.i(eVar.x(), "setScreenBrightness");
                                            b bVar12 = eVar.f288920q;
                                            if (bVar12 != null) {
                                            }
                                        } else {
                                            str6 = "exitPictureInPicture";
                                            if (optString3.equalsIgnoreCase(str6)) {
                                                eVar.f288901f1.b(cVar);
                                            } else if (optString3.equalsIgnoreCase("requestBackgroundPlayback")) {
                                                eVar.x();
                                                if (Util.isNullOrNil(eVar.N)) {
                                                    Log.i(eVar.x(), "enableBackgroundPlayAudio, videoPath is empty");
                                                } else {
                                                    if (!eVar.f288911l1) {
                                                        eVar.x();
                                                        eVar.L(r.class, new s(eVar));
                                                        eVar.x();
                                                        eVar.L(s.class, new t(eVar));
                                                        eVar.x();
                                                        eVar.L(id.q.class, new u(eVar));
                                                        eVar.x();
                                                        eVar.L(id.p.class, new w(eVar));
                                                        z18 = true;
                                                        eVar.f288911l1 = true;
                                                    } else {
                                                        z18 = true;
                                                    }
                                                    eVar.x();
                                                    qs0.a a16 = id.i.a(cVar);
                                                    if (a16 == null) {
                                                        Log.w(eVar.x(), "enableBackgroundPlayAudioInternal, audioOfVideoBackgroundPlayManager is null");
                                                        z19 = false;
                                                    } else {
                                                        z19 = a16.l(eVar, z18);
                                                    }
                                                    if (z19) {
                                                        eVar.f288916o1.set(z18);
                                                        vr0.d dVar5 = eVar.f288904h;
                                                        if (dVar5 != null) {
                                                            dVar5.setSurface(null);
                                                        }
                                                        eVar.f288912m1 = z18;
                                                        d dVar6 = eVar.f288906i;
                                                        if (dVar6 != null) {
                                                            ((g) dVar6).d(z18);
                                                        }
                                                        z16 = z18;
                                                        if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                                        }
                                                        eVar.f288901f1.k(cVar);
                                                        str2 = str10;
                                                        eVar.f288900e1.a(str2, cVar);
                                                        String str1522222222 = eVar.N;
                                                        eVar.f288901f1.j(cVar, str1522222222 != null ? str1522222222 : str);
                                                    }
                                                }
                                            } else if (optString3.equalsIgnoreCase("exitBackgroundPlayback")) {
                                                z16 = eVar.v(cVar);
                                                if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                                }
                                                eVar.f288901f1.k(cVar);
                                                str2 = str10;
                                                eVar.f288900e1.a(str2, cVar);
                                                String str15222222222 = eVar.N;
                                                eVar.f288901f1.j(cVar, str15222222222 != null ? str15222222222 : str);
                                            }
                                            z16 = z17;
                                            if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                            }
                                            eVar.f288901f1.k(cVar);
                                            str2 = str10;
                                            eVar.f288900e1.a(str2, cVar);
                                            String str152222222222 = eVar.N;
                                            eVar.f288901f1.j(cVar, str152222222222 != null ? str152222222222 : str);
                                        }
                                        z16 = true;
                                    } else if (eVar.f288904h == null || !b16.has("data")) {
                                        z17 = false;
                                    } else {
                                        JSONArray optJSONArray3 = b16.optJSONArray("data");
                                        if (optJSONArray3 == null || optJSONArray3.length() == 0) {
                                            z17 = false;
                                            Log.w(eVar.x(), "speed, data array is null");
                                        } else {
                                            z17 = false;
                                            double optDouble3 = optJSONArray3.optDouble(0, -1.0d);
                                            if (optDouble3 < 0.0d) {
                                                Log.w(eVar.x(), "speed, invalid rate:%s", Double.valueOf(optDouble3));
                                            } else {
                                                Log.i(eVar.x(), "speed, speed:%s", Double.valueOf(optDouble3));
                                                z16 = eVar.f288904h.p((float) optDouble3);
                                            }
                                        }
                                    }
                                    str6 = "exitPictureInPicture";
                                    z16 = z17;
                                    if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                    }
                                    eVar.f288901f1.k(cVar);
                                    str2 = str10;
                                    eVar.f288900e1.a(str2, cVar);
                                    String str1522222222222 = eVar.N;
                                    eVar.f288901f1.j(cVar, str1522222222222 != null ? str1522222222222 : str);
                                    str6 = "exitPictureInPicture";
                                    z16 = true;
                                    if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                    }
                                    eVar.f288901f1.k(cVar);
                                    str2 = str10;
                                    eVar.f288900e1.a(str2, cVar);
                                    String str15222222222222 = eVar.N;
                                    eVar.f288901f1.j(cVar, str15222222222222 != null ? str15222222222222 : str);
                                }
                                str6 = "exitPictureInPicture";
                                if (!optString3.equalsIgnoreCase(p.f92727c)) {
                                }
                                eVar.f288901f1.k(cVar);
                                str2 = str10;
                                eVar.f288900e1.a(str2, cVar);
                                String str152222222222222 = eVar.N;
                                eVar.f288901f1.j(cVar, str152222222222222 != null ? str152222222222222 : str);
                            }
                            str5 = "stop";
                            str6 = "exitPictureInPicture";
                            if (!optString3.equalsIgnoreCase(p.f92727c)) {
                            }
                            eVar.f288901f1.k(cVar);
                            str2 = str10;
                            eVar.f288900e1.a(str2, cVar);
                            String str1522222222222222 = eVar.N;
                            eVar.f288901f1.j(cVar, str1522222222222222 != null ? str1522222222222222 : str);
                        }
                    }
                } else if (eVar.f288904h == null) {
                    Log.w(eVar.x(), "operateBackground, media player is null");
                    cVar.k("fail");
                } else {
                    String optString5 = cVar.b().optString("type");
                    if (!Util.isNullOrNil(optString5)) {
                        Log.i(eVar.x(), "operateBackground, type:%s", optString5);
                        if (optString5.equalsIgnoreCase("stop")) {
                            boolean v15 = eVar.v(cVar);
                            if (v15 && eVar.V) {
                                Log.i(eVar.x(), "operateBackground, isRuntimeInBackground, setPlayingWhenEnterBackground false");
                                eVar.W = new AtomicBoolean(false);
                            }
                            z26 = v15;
                        } else {
                            z26 = false;
                        }
                        if (!z26) {
                            str14 = "fail";
                        }
                        cVar.k(str14);
                    }
                }
                str = "";
                str10 = str10;
                str2 = str10;
                eVar.f288900e1.a(str2, cVar);
                String str15222222222222222 = eVar.N;
                eVar.f288901f1.j(cVar, str15222222222222222 != null ? str15222222222222222 : str);
            } else if (eVar.f288904h == null) {
                Log.w(eVar.x(), "update, media player is null");
                cVar.k("fail");
                str3 = "";
            } else {
                JSONObject b29 = cVar.b();
                vr0.d dVar7 = eVar.f288904h;
                if (b29.has("preferredPeakBitRate")) {
                    str8 = "autoPauseIfNavigate";
                    dVar7.g(b29.optDouble("preferredPeakBitRate"));
                } else {
                    str8 = "autoPauseIfNavigate";
                }
                eVar.Z = b29.optBoolean("isDrm", eVar.Z);
                eVar.f288918p0 = b29.optBoolean("isLive", eVar.f288918p0);
                eVar.f288931x0 = b29.optString("provisionUrl", eVar.f288931x0);
                eVar.f288933y0 = b29.optString("licenseUrl", eVar.f288933y0);
                if (b29.has(AssistantStore.DownloadInfos.DownloadInfoColumns.FILEPATH)) {
                    String optString6 = b29.optString(AssistantStore.DownloadInfos.DownloadInfoColumns.FILEPATH);
                    if (!Util.isNullOrNil(optString6) && !optString6.equalsIgnoreCase(eVar.N)) {
                        eVar.N = optString6;
                        b bVar13 = eVar.f288920q;
                        if (bVar13 != null) {
                            optString6 = bVar13.s(cVar, optString6);
                        }
                        Log.i(eVar.x(), "update, path:%s, proxy:%s", eVar.N, optString6);
                        if (eVar.f288904h == null || !Util.isNullOrNil(optString6)) {
                            eVar.S = false;
                            eVar.O();
                            eVar.I(cVar);
                        }
                        b bVar14 = eVar.f288920q;
                        if (bVar14 != null) {
                            bVar14.t(eVar.f288924s, eVar.f288904h, eVar.N);
                        }
                        eVar.N();
                        if (eVar.Z) {
                            String str17 = Util.isNullOrNil(eVar.f288931x0) ? null : eVar.f288931x0;
                            String str18 = Util.isNullOrNil(eVar.f288933y0) ? null : eVar.f288933y0;
                            boolean z39 = eVar.f288918p0;
                            Log.i(eVar.x(), "update, isDrm, provisionUrl:%s, licenseUrl:%s, isLive: %b", str17, str18, Boolean.valueOf(z39));
                            eVar.f288904h.u(optString6, str17, str18, z39);
                        } else {
                            eVar.f288904h.f(optString6, eVar.Y0);
                        }
                        z27 = true;
                        if (!(eVar.f288902g == null || eVar.f288904h == null)) {
                            boolean z45 = eVar.f288916o1.get();
                            String x15 = eVar.x();
                            Object[] objArr = new Object[3];
                            objArr[0] = Boolean.valueOf(eVar.T);
                            objArr[1] = Boolean.valueOf(z45);
                            objArr[2] = Boolean.valueOf(eVar.Z0 == null);
                            Log.i(x15, "update, setSurface, WebViewInBackground: %b, JustPlayAudio: %b, SurfacePipSet exist: %b", objArr);
                            if (!eVar.T) {
                                Surface surface = eVar.Z0;
                                if (surface != null) {
                                    eVar.f288904h.setSurface(surface);
                                } else if (!z45) {
                                    eVar.f288904h.setSurface(eVar.f288902g);
                                }
                            } else if (!z45) {
                                eVar.f288904h.setSurface(eVar.f288902g);
                            }
                        }
                        if (b29.has(V2TXJSAdapterConstants.PLAYER_KEY_AUTO_PLAY)) {
                            eVar.f288934z = b29.optBoolean(V2TXJSAdapterConstants.PLAYER_KEY_AUTO_PLAY, eVar.f288934z);
                        }
                        if (b29.has("initialTime")) {
                            eVar.f288932y = (long) (b29.optDouble("initialTime", 0.0d) * 1000.0d);
                        }
                        if (b29.has("loop")) {
                            eVar.D = b29.optBoolean("loop", eVar.D);
                        }
                        if (b29.has("muted")) {
                            boolean z46 = eVar.E;
                            boolean optBoolean4 = b29.optBoolean("muted", z46);
                            eVar.E = optBoolean4;
                            eVar.f288904h.setMute(optBoolean4);
                            if (eVar.E != z46 && eVar.B() && !eVar.T && !eVar.V) {
                                if (eVar.E) {
                                    Log.i(eVar.x(), "video muted, abandonFocus");
                                    eVar.f288897b1.O();
                                } else {
                                    Log.i(eVar.x(), "video unmuted, requestFocus");
                                    eVar.f288897b1.requestFocus();
                                }
                            }
                        }
                        if (b29.has(str8)) {
                            eVar.Q = b29.optBoolean(str8, eVar.Q);
                        }
                        if (b29.has("autoPauseIfOpenNative")) {
                            eVar.R = b29.optBoolean("autoPauseIfOpenNative", eVar.R);
                        }
                        if (b29.has("needEvent")) {
                            eVar.B = b29.optBoolean("needEvent", eVar.B);
                        }
                        if (eVar.B || (dVar = eVar.f288906i) == null) {
                            str3 = "";
                        } else {
                            g gVar2 = (g) dVar;
                            boolean z47 = cVar instanceof com.tencent.mm.plugin.appbrand.extendplugin.b;
                            if (z47) {
                                gVar2.f209109b = (com.tencent.mm.plugin.appbrand.extendplugin.b) cVar;
                            }
                            str3 = "";
                            String optString7 = b29.optString("data", str3);
                            if (b29.has("data")) {
                                ((g) eVar.f288906i).f209113f = optString7;
                            }
                            if (eVar.f288908j != null) {
                                if (b29.has("data")) {
                                    et0.a aVar6 = (et0.a) eVar.f288908j;
                                    aVar6.getClass();
                                    m.g(optString7, "data");
                                    aVar6.f209065b = optString7;
                                }
                                et0.a aVar7 = (et0.a) eVar.f288908j;
                                aVar7.getClass();
                                if (z47) {
                                    aVar7.f209066c = (com.tencent.mm.plugin.appbrand.extendplugin.b) cVar;
                                }
                            }
                        }
                        if (!b29.has("position")) {
                            JSONObject optJSONObject2 = b29.optJSONObject("position");
                            if (optJSONObject2 != null) {
                                int i16 = eVar.F;
                                int i17 = eVar.G;
                                eVar.F = k.c(optJSONObject2.optInt("width", i16));
                                eVar.G = k.c(optJSONObject2.optInt("height", i17));
                                Log.i(eVar.x(), "update, size:[%d, %d]", Integer.valueOf(eVar.F), Integer.valueOf(eVar.G));
                                if (!(eVar.F == i16 && eVar.G == i17)) {
                                    z36 = true;
                                    z28 = z36;
                                    str9 = V2TXJSAdapterConstants.PLAYER_KEY_OBJECTFIT;
                                    z29 = true;
                                }
                            }
                            z36 = false;
                            z28 = z36;
                            str9 = V2TXJSAdapterConstants.PLAYER_KEY_OBJECTFIT;
                            z29 = true;
                        } else {
                            str9 = V2TXJSAdapterConstants.PLAYER_KEY_OBJECTFIT;
                            z29 = false;
                            z28 = false;
                        }
                        if (b29.has(str9)) {
                            String str19 = eVar.P;
                            String optString8 = b29.optString(str9, str19);
                            eVar.P = optString8;
                            if (Util.isNullOrNil(optString8)) {
                                eVar.P = "contain";
                            }
                            if (!eVar.P.equals(str19)) {
                                z28 = false;
                            }
                            z29 = true;
                        }
                        if (z29) {
                            eVar.q(z28);
                        }
                        if (b29.optBoolean("enableCasting", false)) {
                            boolean optBoolean5 = b29.optBoolean("enableCasting");
                            eVar.x();
                            if (eVar.f288922r == null) {
                                eVar.f288922r = eVar.f288920q.j(eVar.f288908j, cVar);
                            }
                            eVar.f288922r.f209076h = optBoolean5;
                        }
                        String optString9 = b29.optString(AssistantStore.DownloadInfos.DownloadInfoColumns.FILEPATH);
                        if (eVar.f288922r != null) {
                            et0.b bVar15 = eVar.f288922r;
                            if (!bVar15.f209076h) {
                                z35 = false;
                            } else {
                                z35 = bVar15.f209077i;
                            }
                            if (z35) {
                                et0.b bVar16 = eVar.f288922r;
                                bVar16.getClass();
                                m.g(optString9, "updateVideoPath");
                                Log.i("MicroMsg.VideoCast.AppBrandVideoCastHandler", "updateVideoPath: [" + optString9 + ']');
                                if (!ek4.y.n(ek4.d0.l0(optString9).toString())) {
                                    bVar16.b().f();
                                    if (!m.b(optString9, bVar16.f209075g)) {
                                        ft0.c cVar7 = bVar16.f209073e;
                                        if (cVar7 != null) {
                                            cVar7.setVideoPath(optString9);
                                        }
                                        bVar16.f209075g = optString9;
                                        bVar16.c(true);
                                        ft0.q b35 = bVar16.b();
                                        et0.d dVar8 = new et0.d(bVar16);
                                        b35.getClass();
                                        b35.f216842e.b().e(new e0(b35, dVar8));
                                        if (bVar16.b().f216841d == -1) {
                                            bVar16.b().f216841d = 8;
                                        } else {
                                            Log.i("MicroMsg.VideoCast.AppBrandVideoCastHandler", "discard a updateVideoPath report event");
                                        }
                                    }
                                }
                            }
                        }
                        eVar.f288919p1 = b29.optString(FFmpegMetadataRetriever.METADATA_KEY_TITLE, eVar.f288919p1);
                        eVar.f288921q1 = b29.optString("backgroundPoster", eVar.f288921q1);
                        if (z27) {
                            Log.i(eVar.x(), "update, media player prepare async");
                            eVar.E(true);
                        }
                        cVar.k("ok");
                    }
                }
                z27 = false;
                boolean z452 = eVar.f288916o1.get();
                String x152 = eVar.x();
                Object[] objArr2 = new Object[3];
                objArr2[0] = Boolean.valueOf(eVar.T);
                objArr2[1] = Boolean.valueOf(z452);
                objArr2[2] = Boolean.valueOf(eVar.Z0 == null);
                Log.i(x152, "update, setSurface, WebViewInBackground: %b, JustPlayAudio: %b, SurfacePipSet exist: %b", objArr2);
                if (!eVar.T) {
                }
                if (b29.has(V2TXJSAdapterConstants.PLAYER_KEY_AUTO_PLAY)) {
                }
                if (b29.has("initialTime")) {
                }
                if (b29.has("loop")) {
                }
                if (b29.has("muted")) {
                }
                if (b29.has(str8)) {
                }
                if (b29.has("autoPauseIfOpenNative")) {
                }
                if (b29.has("needEvent")) {
                }
                if (eVar.B) {
                }
                str3 = "";
                if (!b29.has("position")) {
                }
                if (b29.has(str9)) {
                }
                if (z29) {
                }
                if (b29.optBoolean("enableCasting", false)) {
                }
                String optString92 = b29.optString(AssistantStore.DownloadInfos.DownloadInfoColumns.FILEPATH);
                if (eVar.f288922r != null) {
                }
                eVar.f288919p1 = b29.optString(FFmpegMetadataRetriever.METADATA_KEY_TITLE, eVar.f288919p1);
                eVar.f288921q1 = b29.optString("backgroundPoster", eVar.f288921q1);
                if (z27) {
                }
                cVar.k("ok");
            }
            str = str3;
            str2 = str10;
            eVar.f288900e1.a(str2, cVar);
            String str152222222222222222 = eVar.N;
            eVar.f288901f1.j(cVar, str152222222222222222 != null ? str152222222222222222 : str);
        }
    }
}