InMobiAdActivity.java 源代码


package com.inmobi.ads.rendering;

import android.R;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import com.anythink.expressad.videocommon.e.b;
import com.inmobi.media.bj;
import com.inmobi.media.bn;
import com.inmobi.media.bw;
import com.inmobi.media.cf;
import com.inmobi.media.dg;
import com.inmobi.media.ew;
import com.inmobi.media.ex;
import com.inmobi.media.fd;
import com.inmobi.media.fe;
import com.inmobi.media.fu;
import com.inmobi.media.gu;
import com.inmobi.media.gy;
import com.inmobi.media.h;
import com.inmobi.media.hb;
import com.inmobi.media.he;
import com.inmobi.media.hn;
import com.inmobi.media.l;
import com.inmobi.media.m;
import com.inmobi.media.o;
import com.inmobi.media.q;
import java.util.HashMap;
import java.util.Map;

@SuppressLint({"ClickableViewAccessibility"})
public class InMobiAdActivity extends Activity {

    private static final String f14537g = "InMobiAdActivity";

    private static o f14539i;

    private static q f14540j;

    private h f14542k;

    @Nullable
    private o f14543l;

    private cf f14544m;

    private cf f14545n;

    private ew f14546o;

    private int f14547p;

    private int f14548q;

    private static SparseArray<h> f14538h = new SparseArray<>();

    @SuppressLint({"UseSparseArrays"})
    public static Map<Integer, a> f14532b = new HashMap();

    @SuppressLint({"UseSparseArrays"})
    public static Map<Integer, Intent> f14533c = new HashMap();

    public static Integer f14534d = 0;

    @SuppressLint({"UseSparseArrays"})
    public static Map<Integer, Object> f14535e = new HashMap();

    public static Integer f14536f = 0;

    public boolean f14541a = false;

    private boolean f14549r = false;

    private boolean f14550s = false;

    public interface a {
    }

    static boolean c(InMobiAdActivity inMobiAdActivity) {
        inMobiAdActivity.f14541a = true;
        return true;
    }

    @Override
    protected void onActivityResult(int i6, int i7, Intent intent) {
        super.onActivityResult(i6, i7, intent);
        if (f14532b.remove(Integer.valueOf(i6)) != null) {
            f14533c.remove(Integer.valueOf(i6));
            this.f14541a = true;
            finish();
        }
    }

    @Override
    public void onBackPressed() {
        boolean z6;
        int i6 = this.f14547p;
        if (i6 == 102) {
            h hVar = this.f14542k;
            if (hVar != null && !hVar.c()) {
                if (200 == this.f14548q) {
                    o oVar = (o) this.f14542k;
                    if (oVar != null) {
                        String str = oVar.f15935q;
                        if (str != null) {
                            z6 = true;
                        } else {
                            z6 = false;
                        }
                        if (z6) {
                            oVar.a(str, "broadcastEvent('backButtonPressed')");
                        }
                        if (oVar.f15934p) {
                            return;
                        }
                        this.f14541a = true;
                        try {
                            oVar.b();
                            return;
                        } catch (Exception unused) {
                            he.a((byte) 2, "InMobi", "SDK encountered unexpected error in processing close request");
                            return;
                        }
                    }
                    return;
                }
                h hVar2 = this.f14542k;
                if (hVar2 instanceof m) {
                    m mVar = (m) hVar2;
                    if (mVar == null || mVar.k().f14882b) {
                        return;
                    }
                    this.f14541a = true;
                    ew ewVar = this.f14546o;
                    if (ewVar != null) {
                        bw bwVar = (bw) ewVar.getTag();
                        if (bwVar != null) {
                            if (1 == mVar.getPlacementType()) {
                                this.f14546o.a();
                            }
                            try {
                                if (((Boolean) bwVar.f14862v.get("isFullScreen")).booleanValue()) {
                                    bwVar.f14862v.put("seekPosition", Integer.valueOf(this.f14546o.getCurrentPosition()));
                                    if (!mVar.f15880j && ((Boolean) bwVar.f14862v.get("didRequestFullScreen")).booleanValue()) {
                                        Map<String, Object> map = bwVar.f14862v;
                                        Boolean bool = Boolean.FALSE;
                                        map.put("didRequestFullScreen", bool);
                                        bj bjVar = bwVar.f14865y;
                                        if (bjVar != null) {
                                            bjVar.f14862v.put("didRequestFullScreen", bool);
                                        }
                                        mVar.b();
                                        bwVar.f14862v.put("isFullScreen", bool);
                                        return;
                                    }
                                    return;
                                }
                                return;
                            } catch (Exception e6) {
                                he.a((byte) 2, "InMobi", "SDK encountered unexpected error in closing video");
                                fu.a().a(new gu(e6));
                                return;
                            }
                        }
                        return;
                    }
                    finish();
                    return;
                }
                if (hVar2 instanceof l) {
                    l lVar = (l) hVar2;
                    if (lVar != null) {
                        if (lVar.k().f14882b) {
                            return;
                        }
                        lVar.b();
                        return;
                    }
                    finish();
                    return;
                }
                return;
            }
            return;
        }
        if (i6 == 100) {
            this.f14541a = true;
            finish();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        o oVar = this.f14543l;
        if (oVar != null && "Resized".equals(oVar.f15922d) && oVar.getResizeProperties() != null) {
            oVar.f15925g.a();
        }
    }

    @Override
    @TargetApi(23)
    protected void onCreate(Bundle bundle) {
        int intExtra;
        String[] stringArrayExtra;
        fd fdVar;
        super.onCreate(bundle);
        if (!gy.a()) {
            finish();
            he.a((byte) 2, "InMobi", "Session not found, AdActivity will be closed");
            return;
        }
        this.f14549r = false;
        int i6 = Build.VERSION.SDK_INT;
        if (i6 >= 29) {
            hn.a(this);
        }
        int intExtra2 = getIntent().getIntExtra("com.inmobi.ads.rendering.InMobiAdActivity.EXTRA_AD_ACTIVITY_TYPE", 102);
        this.f14547p = intExtra2;
        if (intExtra2 == 100) {
            String stringExtra = getIntent().getStringExtra("com.inmobi.ads.rendering.InMobiAdActivity.IN_APP_BROWSER_URL");
            long longExtra = getIntent().getLongExtra(b.f5543v, Long.MIN_VALUE);
            boolean booleanExtra = getIntent().getBooleanExtra("allowAutoRedirection", false);
            String stringExtra2 = getIntent().getStringExtra("impressionId");
            String stringExtra3 = getIntent().getStringExtra("creativeId");
            q qVar = o.f15919a;
            o oVar = f14539i;
            if (oVar != null) {
                qVar = oVar.getListener();
                fdVar = f14539i.getAdConfig();
            } else {
                fdVar = (fd) fe.a("ads", gy.f());
                q qVar2 = f14540j;
                if (qVar2 != null) {
                    qVar = qVar2;
                }
            }
            try {
                o oVar2 = new o(this, (byte) 1, null, stringExtra2);
                this.f14543l = oVar2;
                oVar2.setPlacementId(longExtra);
                this.f14543l.setCreativeId(stringExtra3);
                this.f14543l.setAllowAutoRedirection(booleanExtra);
                this.f14543l.setShouldFireRenderBeacon(false);
                this.f14543l.setIsInAppBrowser(true);
                this.f14543l.a(qVar, fdVar, false, false);
                RelativeLayout relativeLayout = new RelativeLayout(this);
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
                layoutParams.addRule(10);
                layoutParams.addRule(2, 65533);
                relativeLayout.setBackgroundColor(-1);
                relativeLayout.addView(this.f14543l, layoutParams);
                float f6 = hn.a().f15728c;
                LinearLayout linearLayout = new LinearLayout(this);
                RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, (int) (48.0f * f6));
                linearLayout.setOrientation(0);
                linearLayout.setId(65533);
                linearLayout.setWeightSum(100.0f);
                linearLayout.setBackgroundResource(R.drawable.bottom_bar);
                linearLayout.setBackgroundColor(-7829368);
                layoutParams2.addRule(12);
                relativeLayout.addView(linearLayout, layoutParams2);
                LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -1);
                layoutParams3.weight = 25.0f;
                cf cfVar = new cf(this, f6, (byte) 2);
                cfVar.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        if (motionEvent.getAction() == 1) {
                            view.setBackgroundColor(-7829368);
                            InMobiAdActivity.c(InMobiAdActivity.this);
                            InMobiAdActivity.this.finish();
                            return true;
                        }
                        if (motionEvent.getAction() == 0) {
                            view.setBackgroundColor(-16711681);
                        }
                        return true;
                    }
                });
                linearLayout.addView(cfVar, layoutParams3);
                cf cfVar2 = new cf(this, f6, (byte) 3);
                cfVar2.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        if (motionEvent.getAction() == 1) {
                            view.setBackgroundColor(-7829368);
                            InMobiAdActivity.this.f14543l.reload();
                            return true;
                        }
                        if (motionEvent.getAction() == 0) {
                            view.setBackgroundColor(-16711681);
                        }
                        return true;
                    }
                });
                linearLayout.addView(cfVar2, layoutParams3);
                cf cfVar3 = new cf(this, f6, (byte) 4);
                cfVar3.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        if (motionEvent.getAction() == 1) {
                            view.setBackgroundColor(-7829368);
                            if (InMobiAdActivity.this.f14543l.canGoBack()) {
                                InMobiAdActivity.this.f14543l.goBack();
                            } else {
                                InMobiAdActivity.c(InMobiAdActivity.this);
                                InMobiAdActivity.this.finish();
                            }
                            return true;
                        }
                        if (motionEvent.getAction() == 0) {
                            view.setBackgroundColor(-16711681);
                        }
                        return true;
                    }
                });
                linearLayout.addView(cfVar3, layoutParams3);
                cf cfVar4 = new cf(this, f6, (byte) 6);
                cfVar4.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        if (motionEvent.getAction() == 1) {
                            view.setBackgroundColor(-7829368);
                            if (InMobiAdActivity.this.f14543l.canGoForward()) {
                                InMobiAdActivity.this.f14543l.goForward();
                            }
                            return true;
                        }
                        if (motionEvent.getAction() == 0) {
                            view.setBackgroundColor(-16711681);
                        }
                        return true;
                    }
                });
                linearLayout.addView(cfVar4, layoutParams3);
                setContentView(relativeLayout);
                this.f14543l.loadUrl(stringExtra);
                this.f14543l.setFullScreenActivityContext(this);
                return;
            } catch (Exception e6) {
                fu.a().a(new gu(e6));
                qVar.a();
                finish();
                return;
            }
        }
        if (intExtra2 == 102) {
            b();
            return;
        }
        if (intExtra2 == 103) {
            int intExtra3 = getIntent().getIntExtra("id", -1);
            if (intExtra3 != -1) {
                startActivityForResult(f14533c.get(Integer.valueOf(intExtra3)), intExtra3);
                return;
            }
            return;
        }
        if (intExtra2 == 104 && (intExtra = getIntent().getIntExtra("id", -1)) != -1 && (stringArrayExtra = getIntent().getStringArrayExtra("permissions")) != null && stringArrayExtra.length > 0 && i6 >= 23) {
            hb.b();
            requestPermissions(stringArrayExtra, intExtra);
        }
    }

    @Override
    protected void onDestroy() {
        h hVar;
        bw bwVar;
        h hVar2;
        if (this.f14541a) {
            int i6 = this.f14547p;
            if (100 == i6) {
                o oVar = this.f14543l;
                if (oVar != null && oVar.getFullScreenEventsListener() != null) {
                    try {
                        this.f14543l.getFullScreenEventsListener().b(this.f14543l);
                        this.f14543l.destroy();
                        this.f14543l = null;
                    } catch (Exception unused) {
                    }
                }
            } else if (102 == i6 && (hVar2 = this.f14542k) != null && hVar2.getFullScreenEventsListener() != null) {
                int i7 = this.f14548q;
                if (200 == i7) {
                    try {
                        this.f14542k.getFullScreenEventsListener().b(null);
                    } catch (Exception unused2) {
                        he.a((byte) 2, "InMobi", "SDK encountered unexpected error while finishing fullscreen view");
                    }
                } else if (201 == i7) {
                    h hVar3 = this.f14542k;
                    if (hVar3 instanceof m) {
                        ex exVar = (ex) ((m) hVar3).getVideoContainerView();
                        if (exVar != null) {
                            try {
                                this.f14542k.getFullScreenEventsListener().b((bw) exVar.getVideoView().getTag());
                            } catch (Exception e6) {
                                he.a((byte) 2, "InMobi", "SDK encountered unexpected error while finishing fullscreen view");
                                fu.a().a(new gu(e6));
                            }
                        }
                    } else if (hVar3 instanceof l) {
                        try {
                            hVar3.getFullScreenEventsListener().b(null);
                        } catch (Exception e7) {
                            he.a((byte) 2, "InMobi", "SDK encountered unexpected error while finishing fullscreen view");
                            fu.a().a(new gu(e7));
                        }
                    }
                }
            }
            h hVar4 = this.f14542k;
            if (hVar4 != null) {
                hVar4.destroy();
                this.f14542k = null;
            }
        } else {
            int i8 = this.f14547p;
            if (100 != i8 && 102 == i8 && (hVar = this.f14542k) != null) {
                int i9 = this.f14548q;
                if (200 == i9) {
                    o oVar2 = (o) hVar;
                    oVar2.setFullScreenActivityContext(null);
                    try {
                        oVar2.b();
                    } catch (Exception unused3) {
                        he.a((byte) 2, "InMobi", "SDK encountered unexpected error in processing close request");
                    }
                } else if (201 == i9) {
                    if (hVar instanceof m) {
                        m mVar = (m) hVar;
                        ew ewVar = this.f14546o;
                        if (ewVar != null && (bwVar = (bw) ewVar.getTag()) != null) {
                            if (1 == mVar.getPlacementType()) {
                                this.f14546o.a();
                            }
                            if (this.f14542k.getFullScreenEventsListener() != null) {
                                try {
                                    this.f14542k.getFullScreenEventsListener().b(bwVar);
                                } catch (Exception e8) {
                                    he.a((byte) 2, "InMobi", "SDK encountered unexpected error while finishing fullscreen view");
                                    fu.a().a(new gu(e8));
                                }
                            }
                        }
                    } else if ((hVar instanceof l) && hVar.getFullScreenEventsListener() != null) {
                        try {
                            this.f14542k.getFullScreenEventsListener().b(null);
                        } catch (Exception e9) {
                            he.a((byte) 2, "InMobi", "SDK encountered unexpected error while finishing fullscreen view");
                            fu.a().a(new gu(e9));
                        }
                    }
                }
                a((Object) this.f14542k);
                this.f14542k.destroy();
                this.f14542k = null;
            }
        }
        super.onDestroy();
    }

    @Override
    public void onMultiWindowModeChanged(boolean z6) {
        super.onMultiWindowModeChanged(z6);
        if (z6) {
            return;
        }
        o oVar = this.f14543l;
        if (oVar != null) {
            oVar.setOrientationProperties(oVar.getOrientationProperties());
        }
        h hVar = this.f14542k;
        if (hVar != null) {
            hVar.d();
        }
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        b();
    }

    @Override
    public void onRequestPermissionsResult(int i6, @NonNull String[] strArr, @NonNull int[] iArr) {
        super.onRequestPermissionsResult(i6, strArr, iArr);
        hb.c();
        f14535e.remove(Integer.valueOf(i6));
        finish();
    }

    @Override
    protected void onResume() {
        ew ewVar;
        super.onResume();
        if (!this.f14541a) {
            int i6 = this.f14547p;
            if (100 == i6) {
                o oVar = this.f14543l;
                if (oVar != null && oVar.getFullScreenEventsListener() != null) {
                    if (!this.f14549r) {
                        this.f14549r = true;
                        this.f14543l.getFullScreenEventsListener().a(this.f14543l);
                    }
                }
                this.f14550s = false;
            }
            int i7 = this.f14548q;
            if (i7 == 200 && 102 == i6) {
                h hVar = this.f14542k;
                if (hVar != null && hVar.getFullScreenEventsListener() != null) {
                    if (!this.f14549r) {
                        this.f14549r = true;
                        this.f14542k.getFullScreenEventsListener().a(null);
                    }
                }
            } else if (201 == i7) {
                h hVar2 = this.f14542k;
                if ((hVar2 instanceof m) && (ewVar = this.f14546o) != null) {
                    final bw bwVar = (bw) ewVar.getTag();
                    if (bwVar != null && this.f14550s) {
                        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                            @Override
                            public final void run() {
                                if (InMobiAdActivity.this.f14542k != null) {
                                    if (InMobiAdActivity.this.f14542k.getPlacementType() != 1 || !((Boolean) bwVar.f14862v.get("didCompleteQ4")).booleanValue()) {
                                        InMobiAdActivity.this.f14546o.start();
                                    }
                                }
                            }
                        }, 50L);
                    }
                    if (this.f14542k.getFullScreenEventsListener() != null) {
                        try {
                            if (!this.f14549r) {
                                this.f14549r = true;
                                this.f14542k.getFullScreenEventsListener().a(bwVar);
                            }
                        } catch (Exception e6) {
                            fu.a().a(new gu(e6));
                        }
                    }
                } else if (hVar2 instanceof l) {
                    try {
                        if (!this.f14549r) {
                            this.f14549r = true;
                            hVar2.getFullScreenEventsListener().a(null);
                        }
                    } catch (Exception e7) {
                        fu.a().a(new gu(e7));
                    }
                }
            }
            this.f14550s = false;
            this.f14550s = false;
        }
    }

    @Override
    protected void onStart() {
        h hVar;
        super.onStart();
        if (!this.f14541a && 102 == this.f14547p && (hVar = this.f14542k) != null) {
            dg viewableAd = hVar.getViewableAd();
            int i6 = this.f14548q;
            if (200 == i6) {
                if (1 == this.f14542k.getPlacementType()) {
                    try {
                        viewableAd.a(this.f14544m, this.f14545n);
                        return;
                    } catch (Exception unused) {
                        if (this.f14542k.getFullScreenEventsListener() != null) {
                            this.f14542k.getFullScreenEventsListener().a();
                            return;
                        }
                        return;
                    }
                }
                return;
            }
            if (201 == i6) {
                try {
                    fd adConfig = this.f14542k.getAdConfig();
                    if (viewableAd.b() != null) {
                        h hVar2 = this.f14542k;
                        if (hVar2 instanceof m) {
                            bw bwVar = (bw) this.f14546o.getTag();
                            if (bwVar != null) {
                                fd.m mVar = adConfig.viewability;
                                int i7 = mVar.video.impressionMinTimeViewed;
                                if (bwVar.G.containsKey("time")) {
                                    i7 = ((Integer) bwVar.G.get("time")).intValue();
                                }
                                mVar.video.impressionMinTimeViewed = i7;
                                viewableAd.a(new View[0]);
                                return;
                            }
                            return;
                        }
                        if (hVar2 instanceof l) {
                            try {
                                viewableAd.a(new View[0]);
                            } catch (Exception unused2) {
                                if (this.f14542k.getFullScreenEventsListener() != null) {
                                    this.f14542k.getFullScreenEventsListener().a();
                                }
                            }
                        }
                    }
                } catch (Exception e6) {
                    if (this.f14542k.getFullScreenEventsListener() != null) {
                        this.f14542k.getFullScreenEventsListener().a();
                    }
                    fu.a().a(new gu(e6));
                }
            }
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        if (!this.f14541a) {
            this.f14550s = true;
            ew ewVar = this.f14546o;
            if (ewVar != null) {
                ewVar.pause();
            }
        }
    }

    private void b() {
        if (getIntent().hasExtra("com.inmobi.ads.rendering.InMobiAdActivity.EXTRA_AD_CONTAINER_INDEX")) {
            h hVar = f14538h.get(getIntent().getIntExtra("com.inmobi.ads.rendering.InMobiAdActivity.EXTRA_AD_CONTAINER_INDEX", -1));
            this.f14542k = hVar;
            if (hVar == null) {
                finish();
                return;
            }
            int intExtra = getIntent().getIntExtra("com.inmobi.ads.rendering.InMobiAdActivity.EXTRA_AD_CONTAINER_TYPE", 0);
            this.f14548q = intExtra;
            if (intExtra == 0) {
                if (this.f14542k.getFullScreenEventsListener() != null) {
                    this.f14542k.getFullScreenEventsListener().a();
                }
                finish();
                return;
            }
            if (getIntent().getBooleanExtra("com.inmobi.ads.rendering.InMobiAdActivity.EXTRA_AD_ACTIVITY_IS_FULL_SCREEN", false)) {
                requestWindowFeature(1);
                getWindow().setFlags(1024, 1024);
            }
            if ((200 == this.f14548q && !"html".equals(this.f14542k.getMarkupType())) || (201 == this.f14548q && !"inmobiJson".equals(this.f14542k.getMarkupType()))) {
                if (this.f14542k.getFullScreenEventsListener() != null) {
                    this.f14542k.getFullScreenEventsListener().a();
                }
                finish();
                return;
            }
            try {
                this.f14542k.setFullScreenActivityContext(this);
                c();
            } catch (Exception e6) {
                this.f14542k.setFullScreenActivityContext(null);
                if (this.f14542k.getFullScreenEventsListener() != null) {
                    this.f14542k.getFullScreenEventsListener().a();
                }
                finish();
                fu.a().a(new gu(e6));
            }
        }
    }

    private void c() {
        ex exVar;
        FrameLayout frameLayout = (FrameLayout) findViewById(R.id.content);
        RelativeLayout relativeLayout = new RelativeLayout(getApplicationContext());
        relativeLayout.setId(65534);
        float f6 = hn.a().f15728c;
        if ("html".equals(this.f14542k.getMarkupType())) {
            relativeLayout.setBackgroundColor(0);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            layoutParams.addRule(10);
            int i6 = (int) (50.0f * f6);
            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(i6, i6);
            layoutParams2.addRule(11);
            cf cfVar = new cf(this, f6, (byte) 0);
            this.f14544m = cfVar;
            cfVar.setId(65532);
            this.f14544m.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    InMobiAdActivity.c(InMobiAdActivity.this);
                    try {
                        InMobiAdActivity.this.f14542k.b();
                    } catch (Exception unused) {
                        String unused2 = InMobiAdActivity.f14537g;
                        he.a((byte) 2, "InMobi", "SDK encountered unexpected error in processing close request");
                    }
                }
            });
            cf cfVar2 = new cf(this, f6, (byte) 1);
            this.f14545n = cfVar2;
            cfVar2.setId(65531);
            this.f14545n.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    InMobiAdActivity.c(InMobiAdActivity.this);
                    try {
                        InMobiAdActivity.this.f14542k.b();
                    } catch (Exception unused) {
                        String unused2 = InMobiAdActivity.f14537g;
                        he.a((byte) 2, "InMobi", "SDK encountered unexpected error in processing close request");
                    }
                }
            });
            View c6 = this.f14542k.getViewableAd().c();
            if (c6 != null) {
                ViewGroup viewGroup = (ViewGroup) c6.getParent();
                if (viewGroup != null) {
                    viewGroup.removeView(c6);
                }
                relativeLayout.addView(c6, layoutParams);
                relativeLayout.addView(this.f14544m, layoutParams2);
                relativeLayout.addView(this.f14545n, layoutParams2);
                h hVar = this.f14542k;
                ((o) hVar).b(((o) hVar).f15933o);
                h hVar2 = this.f14542k;
                ((o) hVar2).c(((o) hVar2).f15930l);
            }
        } else if ("inmobiJson".equals(this.f14542k.getMarkupType())) {
            byte placementType = this.f14542k.getPlacementType();
            relativeLayout.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
            bn bnVar = (bn) this.f14542k.getDataModel();
            Point point = bnVar.f14884d.f14843c.f14866a;
            dg viewableAd = this.f14542k.getViewableAd();
            View b6 = bnVar.f14883c ? viewableAd.b() : null;
            if (b6 == null) {
                b6 = viewableAd.a(null, relativeLayout, false);
            }
            h hVar3 = this.f14542k;
            if ((hVar3 instanceof m) && (exVar = (ex) hVar3.getVideoContainerView()) != null) {
                ew videoView = exVar.getVideoView();
                this.f14546o = videoView;
                videoView.requestFocus();
                bw bwVar = (bw) this.f14546o.getTag();
                bj bjVar = bwVar.f14865y;
                if (bjVar != null) {
                    bwVar.a((bw) bjVar);
                }
                if (placementType == 0) {
                    bwVar.f14862v.put(com.anythink.expressad.atsignalcommon.d.a.f3010a, (byte) 0);
                } else {
                    bwVar.f14862v.put(com.anythink.expressad.atsignalcommon.d.a.f3010a, (byte) 1);
                }
            }
            if (b6 != null) {
                relativeLayout.addView(b6, new RelativeLayout.LayoutParams(point.x, point.y));
            }
            this.f14542k.d();
        } else {
            if (this.f14542k.getFullScreenEventsListener() != null) {
                this.f14542k.getFullScreenEventsListener().a();
            }
            finish();
            return;
        }
        frameLayout.removeAllViews();
        frameLayout.addView(relativeLayout, new RelativeLayout.LayoutParams(-1, -1));
    }

    public static int a(h hVar) {
        int hashCode = hVar.hashCode();
        f14538h.put(hashCode, hVar);
        return hashCode;
    }

    public static void a(@NonNull Object obj) {
        f14538h.remove(obj.hashCode());
    }

    public static void a(o oVar) {
        f14539i = oVar;
    }

    @Override
    public void onMultiWindowModeChanged(boolean z6, Configuration configuration) {
        super.onMultiWindowModeChanged(z6, configuration);
        onMultiWindowModeChanged(z6);
    }

    public static void a(q qVar) {
        f14540j = qVar;
    }
}