package p138.p176.p177.p190.p236;

import android.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.SubtitleView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import p000.p001.p002.p003.p004.C0567;
import p037.p065.p068.C1850;
import p138.p176.p177.p190.AbstractC3457;
import p138.p176.p177.p190.C3439;
import p138.p176.p177.p190.C3441;
import p138.p176.p177.p190.C3454;
import p138.p176.p177.p190.InterfaceC3415;
import p138.p176.p177.p190.InterfaceC3440;
import p138.p176.p177.p190.InterfaceC3442;
import p138.p176.p177.p190.p210.C3710;
import p138.p176.p177.p190.p210.p212.C3724;
import p138.p176.p177.p190.p210.p214.C3734;
import p138.p176.p177.p190.p217.C3829;
import p138.p176.p177.p190.p226.C3946;
import p138.p176.p177.p190.p226.InterfaceC3955;
import p138.p176.p177.p190.p235.C4039;
import p138.p176.p177.p190.p235.InterfaceC4036;
import p138.p176.p177.p190.p236.C4054;
import p138.p176.p177.p190.p236.p237.C4082;
import p138.p176.p177.p190.p236.p237.InterfaceC4081;
import p138.p176.p177.p190.p239.C4150;
import p138.p176.p177.p190.p239.InterfaceC4124;
import p138.p176.p177.p190.p240.C4166;
import p138.p176.p177.p190.p240.C4174;
import p138.p176.p177.p190.p240.InterfaceC4168;
import p138.p176.p177.p190.p240.InterfaceC4175;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.އ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C4059 extends FrameLayout {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final ViewOnLayoutChangeListenerC4061 f12915;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final AspectRatioFrameLayout f12916;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final View f12917;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final View f12918;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final ImageView f12919;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final SubtitleView f12920;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final View f12921;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final TextView f12922;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final C4054 f12923;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final FrameLayout f12924;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final FrameLayout f12925;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public InterfaceC3442 f12926;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public boolean f12927;

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public C4054.InterfaceC4058 f12928;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public boolean f12929;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public Drawable f12930;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public int f12931;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public boolean f12932;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public boolean f12933;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public InterfaceC4124<? super ExoPlaybackException> f12934;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public CharSequence f12935;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public int f12936;

    /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
    public boolean f12937;

    /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
    public boolean f12938;

    /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
    public boolean f12939;

    /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
    public int f12940;

    /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
    public boolean f12941;

    /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
    public boolean f12942;

    /* JADX INFO: renamed from: ޟ, reason: contains not printable characters */
    public boolean f12943;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.އ$ؠ, reason: contains not printable characters */
    public final class ViewOnLayoutChangeListenerC4061 implements InterfaceC3442.InterfaceC3443, InterfaceC3955, InterfaceC4175, View.OnLayoutChangeListener, InterfaceC4081, C4054.InterfaceC4058 {
        public /* synthetic */ ViewOnLayoutChangeListenerC4061(C4060 c4060) {
        }

        @Override // android.view.View.OnLayoutChangeListener
        public void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
            C4059.m6539((TextureView) view, C4059.this.f12940);
        }

        @Override // p138.p176.p177.p190.p240.InterfaceC4175
        /* JADX INFO: renamed from: ֏ */
        public void mo5699() {
            C4059.this.m6554();
        }

        @Override // p138.p176.p177.p190.p236.C4054.InterfaceC4058
        /* JADX INFO: renamed from: ֏ */
        public void mo6538(int i) {
            C4059.this.m6558();
        }

        @Override // p138.p176.p177.p190.p240.InterfaceC4175
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo5701(int i, int i2) {
            C4174.m6822(this, i, i2);
        }

        @Override // p138.p176.p177.p190.p240.InterfaceC4175
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo6561(int i, int i2, int i3, float f) {
            float f2 = (i2 == 0 || i == 0) ? 1.0f : (i * f) / i2;
            if (C4059.this.f12918 instanceof TextureView) {
                if (i3 == 90 || i3 == 270) {
                    f2 = 1.0f / f2;
                }
                C4059 c4059 = C4059.this;
                if (c4059.f12940 != 0) {
                    c4059.f12918.removeOnLayoutChangeListener(this);
                }
                C4059 c40592 = C4059.this;
                c40592.f12940 = i3;
                if (i3 != 0) {
                    c40592.f12918.addOnLayoutChangeListener(this);
                }
                C4059 c40593 = C4059.this;
                C4059.m6539((TextureView) c40593.f12918, c40593.f12940);
            }
            C4059 c40594 = C4059.this;
            AspectRatioFrameLayout aspectRatioFrameLayout = c40594.f12916;
            View view = c40594.f12918;
            if (aspectRatioFrameLayout != null) {
                if (view instanceof C4082) {
                    f2 = 0.0f;
                }
                aspectRatioFrameLayout.setAspectRatio(f2);
            }
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1956(ExoPlaybackException exoPlaybackException) {
            C3441.m5633(this, exoPlaybackException);
        }

        @Override // p138.p176.p177.p190.p226.InterfaceC3955
        /* JADX INFO: renamed from: ֏ */
        public void mo1278(List<C3946> list) {
            SubtitleView subtitleView = C4059.this.f12920;
            if (subtitleView != null) {
                subtitleView.setCues(list);
            }
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1957(C3439 c3439) {
            C3441.m5634(this, c3439);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1958(AbstractC3457 abstractC3457, int i) {
            C3441.m5635(this, abstractC3457, i);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        @Deprecated
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1959(AbstractC3457 abstractC3457, Object obj, int i) {
            C3441.m5636(this, abstractC3457, obj, i);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public void mo1960(C3829 c3829, C4039 c4039) {
            C4059.this.m6551(false);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1961(boolean z) {
            C3441.m5640(this, z);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public void mo1962(boolean z, int i) {
            C4059.this.m6557();
            C4059.this.m6559();
            if (C4059.this.m6552()) {
                C4059 c4059 = C4059.this;
                if (c4059.f12938) {
                    c4059.m6550();
                    return;
                }
            }
            C4059.this.m6546(false);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ؠ */
        public /* synthetic */ void mo1963() {
            C3441.m5631(this);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ؠ */
        public /* synthetic */ void mo1964(int i) {
            C3441.m5641(this, i);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ؠ */
        public /* synthetic */ void mo1965(boolean z) {
            C3441.m5642(this, z);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ހ */
        public /* synthetic */ void mo1966(int i) {
            C3441.m5632(this, i);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ހ */
        public /* synthetic */ void mo1967(boolean z) {
            C3441.m5638(this, z);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ށ */
        public void mo1968(int i) {
            if (C4059.this.m6552()) {
                C4059 c4059 = C4059.this;
                if (c4059.f12938) {
                    c4059.m6550();
                }
            }
        }
    }

    public C4059(Context context) {
        this(context, null);
    }

    public C4059(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public C4059(Context context, AttributeSet attributeSet, int i) {
        int i2;
        int i3;
        boolean z;
        boolean z2;
        boolean z3;
        boolean z4;
        int i4;
        boolean z5;
        int i5;
        boolean z6;
        int i6;
        int i7;
        super(context, attributeSet, i);
        this.f12942 = true;
        this.f12915 = new ViewOnLayoutChangeListenerC4061(null);
        if (isInEditMode()) {
            this.f12916 = null;
            this.f12917 = null;
            this.f12918 = null;
            this.f12919 = null;
            this.f12920 = null;
            this.f12921 = null;
            this.f12922 = null;
            this.f12923 = null;
            this.f12924 = null;
            this.f12925 = null;
            ImageView imageView = new ImageView(context);
            if (C4150.f13259 >= 23) {
                Resources resources = getResources();
                imageView.setImageDrawable(resources.getDrawable(C4063.exo_edit_mode_logo, null));
                imageView.setBackgroundColor(resources.getColor(C4062.exo_edit_mode_background_color, null));
            } else {
                Resources resources2 = getResources();
                imageView.setImageDrawable(resources2.getDrawable(C4063.exo_edit_mode_logo));
                imageView.setBackgroundColor(resources2.getColor(C4062.exo_edit_mode_background_color));
            }
            addView(imageView);
            return;
        }
        int i8 = C4066.exo_player_view;
        this.f12933 = true;
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, C4068.PlayerView, 0, 0);
            try {
                boolean zHasValue = typedArrayObtainStyledAttributes.hasValue(C4068.PlayerView_shutter_background_color);
                int color = typedArrayObtainStyledAttributes.getColor(C4068.PlayerView_shutter_background_color, 0);
                int resourceId = typedArrayObtainStyledAttributes.getResourceId(C4068.PlayerView_player_layout_id, i8);
                boolean z7 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_use_artwork, true);
                int resourceId2 = typedArrayObtainStyledAttributes.getResourceId(C4068.PlayerView_default_artwork, 0);
                boolean z8 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_use_controller, true);
                int i9 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerView_surface_type, 1);
                int i10 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerView_resize_mode, 0);
                int i11 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerView_show_timeout, 5000);
                boolean z9 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_hide_on_touch, true);
                boolean z10 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_auto_show, true);
                int integer = typedArrayObtainStyledAttributes.getInteger(C4068.PlayerView_show_buffering, 0);
                this.f12932 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_keep_content_on_player_reset, this.f12932);
                boolean z11 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_hide_during_ads, true);
                this.f12933 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerView_use_sensor_rotation, this.f12933);
                typedArrayObtainStyledAttributes.recycle();
                i2 = i10;
                i8 = resourceId;
                i7 = i11;
                i6 = i9;
                z = z11;
                z6 = z8;
                i5 = resourceId2;
                z5 = z7;
                i4 = color;
                z4 = zHasValue;
                z3 = z10;
                z2 = z9;
                i3 = integer;
            } catch (Throwable th) {
                typedArrayObtainStyledAttributes.recycle();
                throw th;
            }
        } else {
            i2 = 0;
            i3 = 0;
            z = true;
            z2 = true;
            z3 = true;
            z4 = false;
            i4 = 0;
            z5 = true;
            i5 = 0;
            z6 = true;
            i6 = 1;
            i7 = 5000;
        }
        LayoutInflater.from(context).inflate(i8, this);
        setDescendantFocusability(262144);
        AspectRatioFrameLayout aspectRatioFrameLayout = (AspectRatioFrameLayout) findViewById(C4064.exo_content_frame);
        this.f12916 = aspectRatioFrameLayout;
        if (aspectRatioFrameLayout != null && aspectRatioFrameLayout.f1892 != i2) {
            aspectRatioFrameLayout.f1892 = i2;
            aspectRatioFrameLayout.m1258(false);
        }
        View viewFindViewById = findViewById(C4064.exo_shutter);
        this.f12917 = viewFindViewById;
        if (viewFindViewById != null && z4) {
            viewFindViewById.setBackgroundColor(i4);
        }
        if (this.f12916 == null || i6 == 0) {
            this.f12918 = null;
        } else {
            ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1);
            if (i6 == 2) {
                this.f12918 = new TextureView(context);
            } else if (i6 == 3) {
                C4082 c4082 = new C4082(context);
                c4082.setSingleTapListener(this.f12915);
                c4082.setUseSensorRotation(this.f12933);
                this.f12918 = c4082;
            } else if (i6 != 4) {
                this.f12918 = new SurfaceView(context);
            } else {
                this.f12918 = new C4166(context);
            }
            this.f12918.setLayoutParams(layoutParams);
            this.f12916.addView(this.f12918, 0);
        }
        this.f12924 = (FrameLayout) findViewById(C4064.exo_ad_overlay);
        this.f12925 = (FrameLayout) findViewById(C4064.exo_overlay);
        ImageView imageView2 = (ImageView) findViewById(C4064.exo_artwork);
        this.f12919 = imageView2;
        this.f12929 = z5 && imageView2 != null;
        if (i5 != 0) {
            this.f12930 = C1850.m3655(getContext(), i5);
        }
        SubtitleView subtitleView = (SubtitleView) findViewById(C4064.exo_subtitles);
        this.f12920 = subtitleView;
        if (subtitleView != null) {
            subtitleView.m1277();
            this.f12920.m1279();
        }
        View viewFindViewById2 = findViewById(C4064.exo_buffering);
        this.f12921 = viewFindViewById2;
        if (viewFindViewById2 != null) {
            viewFindViewById2.setVisibility(8);
        }
        this.f12931 = i3;
        TextView textView = (TextView) findViewById(C4064.exo_error_message);
        this.f12922 = textView;
        if (textView != null) {
            textView.setVisibility(8);
        }
        C4054 c4054 = (C4054) findViewById(C4064.exo_controller);
        View viewFindViewById3 = findViewById(C4064.exo_controller_placeholder);
        if (c4054 != null) {
            this.f12923 = c4054;
        } else if (viewFindViewById3 != null) {
            C4054 c40542 = new C4054(context, null, 0, attributeSet);
            this.f12923 = c40542;
            c40542.setId(C4064.exo_controller);
            this.f12923.setLayoutParams(viewFindViewById3.getLayoutParams());
            ViewGroup viewGroup = (ViewGroup) viewFindViewById3.getParent();
            int iIndexOfChild = viewGroup.indexOfChild(viewFindViewById3);
            viewGroup.removeView(viewFindViewById3);
            viewGroup.addView(this.f12923, iIndexOfChild);
        } else {
            this.f12923 = null;
        }
        this.f12936 = this.f12923 != null ? i7 : 0;
        this.f12939 = z2;
        this.f12937 = z3;
        this.f12938 = z;
        this.f12927 = z6 && this.f12923 != null;
        m6550();
        m6558();
        C4054 c40543 = this.f12923;
        if (c40543 != null) {
            c40543.f12863.add(this.f12915);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static /* synthetic */ void m6539(TextureView textureView, int i) {
        Matrix matrix = new Matrix();
        float width = textureView.getWidth();
        float height = textureView.getHeight();
        if (width != 0.0f && height != 0.0f && i != 0) {
            float f = width / 2.0f;
            float f2 = height / 2.0f;
            matrix.postRotate(i, f, f2);
            RectF rectF = new RectF(0.0f, 0.0f, width, height);
            RectF rectF2 = new RectF();
            matrix.mapRect(rectF2, rectF);
            matrix.postScale(width / rectF2.width(), height / rectF2.height(), f, f2);
        }
        textureView.setTransform(matrix);
    }

    @Override // android.view.ViewGroup, android.view.View
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        InterfaceC3442 interfaceC3442 = this.f12926;
        if (interfaceC3442 != null && interfaceC3442.mo5496()) {
            return super.dispatchKeyEvent(keyEvent);
        }
        int keyCode = keyEvent.getKeyCode();
        boolean z = keyCode == 19 || keyCode == 270 || keyCode == 22 || keyCode == 271 || keyCode == 20 || keyCode == 269 || keyCode == 21 || keyCode == 268 || keyCode == 23;
        if (z && m6560() && !this.f12923.m6524()) {
            m6546(true);
        } else {
            if (!(m6560() && this.f12923.m6520(keyEvent)) && !super.dispatchKeyEvent(keyEvent)) {
                if (!z || !m6560()) {
                    return false;
                }
                m6546(true);
                return false;
            }
            m6546(true);
        }
        return true;
    }

    public View[] getAdOverlayViews() {
        ArrayList arrayList = new ArrayList();
        FrameLayout frameLayout = this.f12925;
        if (frameLayout != null) {
            arrayList.add(frameLayout);
        }
        C4054 c4054 = this.f12923;
        if (c4054 != null) {
            arrayList.add(c4054);
        }
        return (View[]) arrayList.toArray(new View[0]);
    }

    public ViewGroup getAdViewGroup() {
        FrameLayout frameLayout = this.f12924;
        if (frameLayout != null) {
            return frameLayout;
        }
        throw new IllegalStateException("exo_ad_overlay must be present for ad playback");
    }

    public boolean getControllerAutoShow() {
        return this.f12937;
    }

    public boolean getControllerHideOnTouch() {
        return this.f12939;
    }

    public int getControllerShowTimeoutMs() {
        return this.f12936;
    }

    public Drawable getDefaultArtwork() {
        return this.f12930;
    }

    public FrameLayout getOverlayFrameLayout() {
        return this.f12925;
    }

    public InterfaceC3442 getPlayer() {
        return this.f12926;
    }

    public int getResizeMode() {
        C0567.m1925(this.f12916);
        return this.f12916.getResizeMode();
    }

    public SubtitleView getSubtitleView() {
        return this.f12920;
    }

    public boolean getUseArtwork() {
        return this.f12929;
    }

    public boolean getUseController() {
        return this.f12927;
    }

    public View getVideoSurfaceView() {
        return this.f12918;
    }

    @Override // android.view.View
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (!m6560() || this.f12926 == null) {
            return super.onTouchEvent(motionEvent);
        }
        int action = motionEvent.getAction();
        if (action == 0) {
            this.f12941 = true;
            return true;
        }
        if (action != 1 || !this.f12941) {
            return false;
        }
        this.f12941 = false;
        performClick();
        return true;
    }

    @Override // android.view.View
    public boolean onTrackballEvent(MotionEvent motionEvent) {
        if (!m6560() || this.f12926 == null) {
            return false;
        }
        m6546(true);
        return true;
    }

    @Override // android.view.View
    public boolean performClick() {
        super.performClick();
        return m6556();
    }

    public void setAspectRatioListener(AspectRatioFrameLayout.InterfaceC0311 interfaceC0311) {
        C0567.m1925(this.f12916);
        this.f12916.setAspectRatioListener(interfaceC0311);
    }

    public void setControlDispatcher(InterfaceC3415 interfaceC3415) {
        C0567.m1925(this.f12923);
        this.f12923.setControlDispatcher(interfaceC3415);
    }

    public void setControllerAutoShow(boolean z) {
        this.f12937 = z;
    }

    public void setControllerHideDuringAds(boolean z) {
        this.f12938 = z;
    }

    public void setControllerHideOnTouch(boolean z) {
        C0567.m1925(this.f12923);
        this.f12939 = z;
        m6558();
    }

    public void setControllerShowTimeoutMs(int i) {
        C0567.m1925(this.f12923);
        this.f12936 = i;
        if (this.f12923.m6524()) {
            m6549(m6555());
        }
    }

    public void setControllerVisibilityListener(C4054.InterfaceC4058 interfaceC4058) {
        C0567.m1925(this.f12923);
        C4054.InterfaceC4058 interfaceC40582 = this.f12928;
        if (interfaceC40582 == interfaceC4058) {
            return;
        }
        if (interfaceC40582 != null) {
            this.f12923.f12863.remove(interfaceC40582);
        }
        this.f12928 = interfaceC4058;
        if (interfaceC4058 != null) {
            this.f12923.f12863.add(interfaceC4058);
        }
    }

    public void setCustomErrorMessage(CharSequence charSequence) {
        C0567.m1932(this.f12922 != null);
        this.f12935 = charSequence;
        m6559();
    }

    @Deprecated
    public void setDefaultArtwork(Bitmap bitmap) {
        setDefaultArtwork(bitmap == null ? null : new BitmapDrawable(getResources(), bitmap));
    }

    public void setDefaultArtwork(Drawable drawable) {
        if (this.f12930 != drawable) {
            this.f12930 = drawable;
            m6551(false);
        }
    }

    public void setErrorMessageProvider(InterfaceC4124<? super ExoPlaybackException> interfaceC4124) {
        if (this.f12934 != interfaceC4124) {
            this.f12934 = interfaceC4124;
            m6559();
        }
    }

    public void setFastForwardIncrementMs(int i) {
        C0567.m1925(this.f12923);
        this.f12923.setFastForwardIncrementMs(i);
    }

    public void setKeepContentOnPlayerReset(boolean z) {
        if (this.f12932 != z) {
            this.f12932 = z;
            m6551(false);
        }
    }

    public void setPlaybackPreparer(InterfaceC3440 interfaceC3440) {
        C0567.m1925(this.f12923);
        this.f12923.setPlaybackPreparer(interfaceC3440);
    }

    public void setPlayer(InterfaceC3442 interfaceC3442) {
        C0567.m1932(Looper.myLooper() == Looper.getMainLooper());
        C0567.m1896(interfaceC3442 == null || interfaceC3442.mo5507() == Looper.getMainLooper());
        InterfaceC3442 interfaceC34422 = this.f12926;
        if (interfaceC34422 == interfaceC3442) {
            return;
        }
        if (interfaceC34422 != null) {
            interfaceC34422.mo5488(this.f12915);
            InterfaceC3442.InterfaceC3445 interfaceC3445Mo5495 = interfaceC34422.mo5495();
            if (interfaceC3445Mo5495 != null) {
                C3454 c3454 = (C3454) interfaceC3445Mo5495;
                c3454.f10189.remove(this.f12915);
                View view = this.f12918;
                if (view instanceof TextureView) {
                    TextureView textureView = (TextureView) view;
                    c3454.m5662();
                    if (textureView != null && textureView == c3454.f10206) {
                        c3454.m5656((TextureView) null);
                    }
                } else if (view instanceof C4082) {
                    ((C4082) view).setVideoComponent(null);
                } else if (view instanceof C4166) {
                    c3454.m5662();
                    c3454.m5657((InterfaceC4168) null);
                } else if (view instanceof SurfaceView) {
                    SurfaceView surfaceView = (SurfaceView) view;
                    SurfaceHolder holder = surfaceView == null ? null : surfaceView.getHolder();
                    c3454.m5662();
                    if (holder != null && holder == c3454.f10205) {
                        c3454.m5655((SurfaceHolder) null);
                    }
                }
            }
            InterfaceC3442.InterfaceC3444 interfaceC3444Mo5513 = interfaceC34422.mo5513();
            if (interfaceC3444Mo5513 != null) {
                ((C3454) interfaceC3444Mo5513).f10191.remove(this.f12915);
            }
        }
        this.f12926 = interfaceC3442;
        if (m6560()) {
            this.f12923.setPlayer(interfaceC3442);
        }
        SubtitleView subtitleView = this.f12920;
        if (subtitleView != null) {
            subtitleView.setCues(null);
        }
        m6557();
        m6559();
        m6551(true);
        if (interfaceC3442 == null) {
            m6550();
            return;
        }
        InterfaceC3442.InterfaceC3445 interfaceC3445Mo54952 = interfaceC3442.mo5495();
        if (interfaceC3445Mo54952 != null) {
            View view2 = this.f12918;
            if (view2 instanceof TextureView) {
                ((C3454) interfaceC3445Mo54952).m5656((TextureView) view2);
            } else if (view2 instanceof C4082) {
                ((C4082) view2).setVideoComponent(interfaceC3445Mo54952);
            } else if (view2 instanceof C4166) {
                InterfaceC4168 videoDecoderOutputBufferRenderer = ((C4166) view2).getVideoDecoderOutputBufferRenderer();
                C3454 c34542 = (C3454) interfaceC3445Mo54952;
                c34542.m5662();
                if (videoDecoderOutputBufferRenderer != null) {
                    c34542.m5662();
                    c34542.m5659();
                    c34542.m5654((Surface) null, false);
                    c34542.m5652(0, 0);
                }
                c34542.m5657(videoDecoderOutputBufferRenderer);
            } else if (view2 instanceof SurfaceView) {
                SurfaceView surfaceView2 = (SurfaceView) view2;
                ((C3454) interfaceC3445Mo54952).m5655(surfaceView2 != null ? surfaceView2.getHolder() : null);
            }
            ((C3454) interfaceC3445Mo54952).f10189.add(this.f12915);
        }
        InterfaceC3442.InterfaceC3444 interfaceC3444Mo55132 = interfaceC3442.mo5513();
        if (interfaceC3444Mo55132 != null) {
            ViewOnLayoutChangeListenerC4061 viewOnLayoutChangeListenerC4061 = this.f12915;
            C3454 c34543 = (C3454) interfaceC3444Mo55132;
            if (!c34543.f10215.isEmpty()) {
                viewOnLayoutChangeListenerC4061.mo1278(c34543.f10215);
            }
            c34543.f10191.add(viewOnLayoutChangeListenerC4061);
        }
        interfaceC3442.mo5484(this.f12915);
        m6546(false);
    }

    public void setRepeatToggleModes(int i) {
        C0567.m1925(this.f12923);
        this.f12923.setRepeatToggleModes(i);
    }

    public void setRewindIncrementMs(int i) {
        C0567.m1925(this.f12923);
        this.f12923.setRewindIncrementMs(i);
    }

    public void setShowBuffering(int i) {
        if (this.f12931 != i) {
            this.f12931 = i;
            m6557();
        }
    }

    @Deprecated
    public void setShowBuffering(boolean z) {
        setShowBuffering(z ? 1 : 0);
    }

    public void setShowMultiWindowTimeBar(boolean z) {
        C0567.m1925(this.f12923);
        this.f12923.setShowMultiWindowTimeBar(z);
    }

    public void setShowShuffleButton(boolean z) {
        C0567.m1925(this.f12923);
        this.f12923.setShowShuffleButton(z);
    }

    public void setShutterBackgroundColor(int i) {
        View view = this.f12917;
        if (view != null) {
            view.setBackgroundColor(i);
        }
    }

    public void setShutterEnabled(boolean z) {
        this.f12942 = z;
    }

    public void setShutterVisible(boolean z) {
        View view = this.f12917;
        if (view == null || view.getVisibility() == 0) {
            return;
        }
        this.f12917.setVisibility(0);
        if (!z) {
            this.f12917.setAlpha(1.0f);
        } else {
            this.f12917.setAlpha(0.0f);
            this.f12917.animate().alpha(1.0f).withLayer().setDuration(150L);
        }
    }

    public void setUseArtwork(boolean z) {
        C0567.m1932((z && this.f12919 == null) ? false : true);
        if (this.f12929 != z) {
            this.f12929 = z;
            m6551(false);
        }
    }

    public void setUseController(boolean z) {
        C0567.m1932((z && this.f12923 == null) ? false : true);
        if (this.f12927 == z) {
            return;
        }
        this.f12927 = z;
        if (m6560()) {
            this.f12923.setPlayer(this.f12926);
        } else {
            C4054 c4054 = this.f12923;
            if (c4054 != null) {
                c4054.m6516();
                this.f12923.setPlayer(null);
            }
        }
        m6558();
    }

    public void setUseSensorRotation(boolean z) {
        if (this.f12933 != z) {
            this.f12933 = z;
            View view = this.f12918;
            if (view instanceof C4082) {
                ((C4082) view).setUseSensorRotation(z);
            }
        }
    }

    @Override // android.view.View
    public void setVisibility(int i) {
        super.setVisibility(i);
        View view = this.f12918;
        if (view instanceof SurfaceView) {
            view.setVisibility(i);
        }
    }

    @SuppressLint({"NewApi"})
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6545() {
        if (!this.f12942 || this.f12943) {
            return;
        }
        setShutterVisible(true);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6546(boolean z) {
        if (!(m6552() && this.f12938) && m6560()) {
            boolean z2 = this.f12923.m6524() && this.f12923.getShowTimeoutMs() <= 0;
            boolean zM6555 = m6555();
            if (z || z2 || zM6555) {
                m6549(zM6555);
            }
        }
    }

    @RequiresNonNull({"artworkView"})
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final boolean m6547(Drawable drawable) {
        if (drawable != null) {
            int intrinsicWidth = drawable.getIntrinsicWidth();
            int intrinsicHeight = drawable.getIntrinsicHeight();
            if (intrinsicWidth > 0 && intrinsicHeight > 0) {
                float f = intrinsicWidth / intrinsicHeight;
                AspectRatioFrameLayout aspectRatioFrameLayout = this.f12916;
                ImageView imageView = this.f12919;
                if (aspectRatioFrameLayout != null) {
                    if (imageView instanceof C4082) {
                        f = 0.0f;
                    }
                    aspectRatioFrameLayout.setAspectRatio(f);
                }
                this.f12919.setImageDrawable(drawable);
                this.f12919.setVisibility(0);
                return true;
            }
        }
        return false;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m6548() {
        ImageView imageView = this.f12919;
        if (imageView != null) {
            imageView.setImageResource(R.color.transparent);
            this.f12919.setVisibility(4);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m6549(boolean z) {
        if (m6560()) {
            this.f12923.setShowTimeoutMs(z ? 0 : this.f12936);
            C4054 c4054 = this.f12923;
            if (!c4054.m6524()) {
                c4054.setVisibility(0);
                Iterator<C4054.InterfaceC4058> it = c4054.f12863.iterator();
                while (it.hasNext()) {
                    it.next().mo6538(c4054.getVisibility());
                }
                c4054.m6527();
                c4054.m6525();
            }
            c4054.m6522();
        }
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public void m6550() {
        C4054 c4054 = this.f12923;
        if (c4054 != null) {
            c4054.m6516();
        }
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final void m6551(boolean z) {
        byte[] bArr;
        int i;
        InterfaceC3442 interfaceC3442 = this.f12926;
        if (interfaceC3442 != null) {
            boolean z2 = true;
            if (!(interfaceC3442.mo5505().f11785 == 0)) {
                if (z && !this.f12932) {
                    m6545();
                }
                C4039 c4039Mo5511 = interfaceC3442.mo5511();
                for (int i2 = 0; i2 < c4039Mo5511.f12828; i2++) {
                    if (interfaceC3442.mo5476(i2) == 2 && c4039Mo5511.f12829[i2] != null) {
                        m6548();
                        return;
                    }
                }
                m6545();
                if (this.f12929) {
                    C0567.m1925(this.f12919);
                } else {
                    z2 = false;
                }
                if (z2) {
                    for (int i3 = 0; i3 < c4039Mo5511.f12828; i3++) {
                        InterfaceC4036 interfaceC4036 = c4039Mo5511.f12829[i3];
                        if (interfaceC4036 != null) {
                            for (int i4 = 0; i4 < interfaceC4036.length(); i4++) {
                                C3710 c3710 = interfaceC4036.mo6475(i4).f10088;
                                if (c3710 != null) {
                                    int i5 = 0;
                                    int i6 = -1;
                                    boolean zM6547 = false;
                                    while (true) {
                                        C3710.InterfaceC3712[] interfaceC3712Arr = c3710.f11440;
                                        if (i5 >= interfaceC3712Arr.length) {
                                            break;
                                        }
                                        C3710.InterfaceC3712 interfaceC3712 = interfaceC3712Arr[i5];
                                        if (interfaceC3712 instanceof C3734) {
                                            C3734 c3734 = (C3734) interfaceC3712;
                                            bArr = c3734.f11490;
                                            i = c3734.f11489;
                                        } else if (interfaceC3712 instanceof C3724) {
                                            C3724 c3724 = (C3724) interfaceC3712;
                                            bArr = c3724.f11471;
                                            i = c3724.f11464;
                                        } else {
                                            continue;
                                            i5++;
                                        }
                                        if (i6 == -1 || i == 3) {
                                            zM6547 = m6547(new BitmapDrawable(getResources(), BitmapFactory.decodeByteArray(bArr, 0, bArr.length)));
                                            if (i == 3) {
                                                break;
                                            } else {
                                                i6 = i;
                                            }
                                        }
                                        i5++;
                                    }
                                    if (zM6547) {
                                        return;
                                    }
                                }
                            }
                        }
                    }
                    if (m6547(this.f12930)) {
                        return;
                    }
                }
                m6548();
                return;
            }
        }
        if (this.f12932) {
            return;
        }
        m6548();
        m6545();
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final boolean m6552() {
        InterfaceC3442 interfaceC3442 = this.f12926;
        return interfaceC3442 != null && interfaceC3442.mo5496() && this.f12926.mo5500();
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public /* synthetic */ void m6553() {
        this.f12917.setVisibility(8);
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public void m6554() {
        View view = this.f12917;
        if (view != null && view.getVisibility() == 0) {
            this.f12917.animate().alpha(0.0f).withLayer().setDuration(150L).withEndAction(new Runnable() { // from class: ދ.ހ.֏.ؠ.ྉ.ރ
                @Override // java.lang.Runnable
                public final void run() {
                    this.f12859.m6553();
                }
            });
        }
        this.f12943 = false;
    }

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final boolean m6555() {
        InterfaceC3442 interfaceC3442 = this.f12926;
        if (interfaceC3442 == null) {
            return true;
        }
        int iMo5493 = interfaceC3442.mo5493();
        return this.f12937 && (iMo5493 == 1 || iMo5493 == 4 || !this.f12926.mo5500());
    }

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final boolean m6556() {
        C4054 c4054 = this.f12923;
        if (c4054 == null || this.f12926 == null) {
            return false;
        }
        if (!c4054.m6524()) {
            m6546(true);
        } else if (this.f12939) {
            this.f12923.m6516();
        }
        return true;
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final void m6557() {
        int i;
        if (this.f12921 != null) {
            InterfaceC3442 interfaceC3442 = this.f12926;
            boolean z = true;
            if (interfaceC3442 == null || interfaceC3442.mo5493() != 2 || ((i = this.f12931) != 2 && (i != 1 || !this.f12926.mo5500()))) {
                z = false;
            }
            this.f12921.setVisibility(z ? 0 : 8);
        }
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final void m6558() {
        C4054 c4054 = this.f12923;
        if (c4054 == null || !this.f12927) {
            setContentDescription(null);
        } else if (c4054.getVisibility() == 0) {
            setContentDescription(this.f12939 ? getResources().getString(C4067.exo_controls_hide) : null);
        } else {
            setContentDescription(getResources().getString(C4067.exo_controls_show));
        }
    }

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final void m6559() {
        InterfaceC4124<? super ExoPlaybackException> interfaceC4124;
        TextView textView = this.f12922;
        if (textView != null) {
            CharSequence charSequence = this.f12935;
            if (charSequence != null) {
                textView.setText(charSequence);
                this.f12922.setVisibility(0);
                return;
            }
            InterfaceC3442 interfaceC3442 = this.f12926;
            ExoPlaybackException exoPlaybackExceptionMo5501 = interfaceC3442 != null ? interfaceC3442.mo5501() : null;
            if (exoPlaybackExceptionMo5501 == null || (interfaceC4124 = this.f12934) == null) {
                this.f12922.setVisibility(8);
            } else {
                this.f12922.setText((CharSequence) interfaceC4124.m6630(exoPlaybackExceptionMo5501).second);
                this.f12922.setVisibility(0);
            }
        }
    }

    @EnsuresNonNullIf(expression = {"controller"}, result = true)
    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final boolean m6560() {
        if (!this.f12927) {
            return false;
        }
        C0567.m1925(this.f12923);
        return true;
    }
}
