正在查看: MX Player v1.97.8 应用的 ExoPlayerService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: MX Player v1.97.8 应用的 ExoPlayerService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mxtech.videoplayer.ad.online.mxexo.service;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.media.AudioManager;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.exoplayer2.n;
import com.google.android.exoplayer2.ui.SubtitleView;
import com.m.x.player.pandora.common.fromstack.FromStack;
import com.microsoft.identity.common.java.AuthenticationConstants;
import com.microsoft.identity.common.java.telemetry.TelemetryEventStrings;
import com.mxplay.interactivemedia.api.AdErrorEvent;
import com.mxtech.bean.TranslateInfo;
import com.mxtech.videoplayer.ad.online.ad.theatermode.a;
import com.mxtech.videoplayer.ad.online.features.download.ExoDownloadPlayerActivity;
import com.mxtech.videoplayer.ad.online.live.ExoLivePlayerActivity;
import com.mxtech.videoplayer.ad.online.live.SonyLivePlayerActivity;
import com.mxtech.videoplayer.ad.online.model.bean.Feed;
import com.mxtech.videoplayer.ad.online.model.bean.ICdnProvider;
import com.mxtech.videoplayer.ad.online.model.bean.next.OnlineResource;
import com.mxtech.videoplayer.ad.online.model.bean.next.PlayInfo;
import com.mxtech.videoplayer.ad.online.model.bean.next.VideoStatus;
import com.mxtech.videoplayer.ad.online.model.bean.next.livetv.TVChannel;
import com.mxtech.videoplayer.ad.online.model.bean.next.livetv.TVProgram;
import com.mxtech.videoplayer.ad.online.model.bean.next.music.Album;
import com.mxtech.videoplayer.ad.online.model.bean.next.music.OttMusicPlayList;
import com.mxtech.videoplayer.ad.online.model.bean.next.tvshow.TvSeason;
import com.mxtech.videoplayer.ad.online.model.bean.next.tvshow.TvShow;
import com.mxtech.videoplayer.ad.online.mxexo.ExoPlayerActivity;
import com.mxtech.videoplayer.ad.online.mxexo.service.ExoPlayerService;
import com.mxtech.videoplayer.ad.online.mxexo.service.a;
import com.mxtech.videoplayer.ad.subscriptions.bean.view_model.MxSubscriptionInfoWrapper;
import com.mxtech.videoplayer.ad.subscriptions.bean.view_model.SubscriptionGroupBean;
import com.mxtech.videoplayer.ad.subscriptions.ui.SvodGroupTheme;
import defpackage.a05;
import defpackage.ag2;
import defpackage.api;
import defpackage.at2;
import defpackage.b05;
import defpackage.b3d;
import defpackage.b3e;
import defpackage.b7d;
import defpackage.bg;
import defpackage.cd;
import defpackage.d0c;
import defpackage.d1j;
import defpackage.d7d;
import defpackage.dn5;
import defpackage.dod;
import defpackage.dta;
import defpackage.e52;
import defpackage.e7d;
import defpackage.es2;
import defpackage.eta;
import defpackage.f7d;
import defpackage.fo5;
import defpackage.fuc;
import defpackage.g7d;
import defpackage.gr5;
import defpackage.h3i;
import defpackage.h7d;
import defpackage.h7f;
import defpackage.hr5;
import defpackage.i7d;
import defpackage.id;
import defpackage.ir5;
import defpackage.jkd;
import defpackage.jr5;
import defpackage.js3;
import defpackage.kr5;
import defpackage.mdg;
import defpackage.nr5;
import defpackage.on8;
import defpackage.sj8;
import defpackage.tj5;
import defpackage.tya;
import defpackage.ulf;
import defpackage.vg8;
import defpackage.vlf;
import defpackage.wj8;
import defpackage.x6d;
import defpackage.xe0;
import defpackage.z6h;
import defpackage.zm3;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import org.greenrobot.eventbus.ThreadMode;
public final class ExoPlayerService extends Service implements Handler.Callback, AudioManager.OnAudioFocusChangeListener, fuc<es2>, f, d, e0h, ICdnProvider, b3d.a, c {
public static ExoPlayerService Q0;
public static d R0;
public static ExoPIPFrameLayout S0;
public static int T0;
public int A;
public TvShow A0;
public WindowManager B;
public SurfaceView C;
public int D;
public int E;
public int F;
public int G;
public b05 G0;
public float J;
public hod J0;
public float K;
public String K0;
public float L;
public tai L0;
public float M;
public float N;
public float O;
public int P;
public int Q;
public int R;
public int V;
public int W;
public float X;
public float Y;
public a b;
public com.mxtech.videoplayer.ad.online.mxexo.service.a b0;
public com.mxtech.videoplayer.ad.online.ad.theatermode.c c;
public g7d c0;
public vf3 d;
public TVChannel e0;
public TVProgram f0;
public k2b g;
public Intent h;
public Feed h0;
public final IntentFilter i;
public boolean i0;
public int j;
public b3e j0;
public int k0;
public long l0;
public OnlineResource m0;
public WindowManager.LayoutParams n;
public TopLayoutService o;
public View p;
public ImageView q;
public ImageView r;
public ImageView s;
public i7d s0;
public ImageView t;
public ImageView u;
public FromStack u0;
public View v;
public SubtitleView v0;
public View w;
public View x;
public e7d x0;
public View y;
public PIPPlayerInfo y0;
public LinearLayout z;
public ir5 z0;
public final c f = new c();
public final Handler k = new Handler(this);
public final Handler l = new Handler(Looper.getMainLooper());
public boolean m = false;
public int H = 0;
public int I = 0;
public float S = 0.0f;
public float T = 0.0f;
public float U = 0.0f;
public boolean Z = false;
public boolean a0 = false;
public boolean d0 = true;
public boolean g0 = false;
public f n0 = f.b;
public Feed o0 = null;
public Pair<dod, dod> p0 = new Pair<>(null, null);
public boolean q0 = false;
public e r0 = e.b;
public float t0 = 0.0f;
public boolean w0 = false;
public boolean B0 = false;
public boolean C0 = false;
public boolean D0 = false;
public String E0 = null;
public final ArrayList F0 = new ArrayList();
public final cog H0 = new cog();
public boolean I0 = false;
public final rai M0 = rai.a;
public hr5 N0 = null;
public final vlf O0 = new vlf(new b());
public final a P0 = new a();
public static class TopLayoutService extends FrameLayout implements Runnable {
public TopLayoutService(Context context) {
super(context);
}
@Override
public final void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
if (ExoPlayerService.Q0 != null) {
post(this);
}
}
@Override
public final void run() {
ExoPlayerService exoPlayerService = ExoPlayerService.Q0;
if (exoPlayerService != null) {
if (exoPlayerService == null) {
exoPlayerService.getClass();
return;
}
if (exoPlayerService.C == null) {
return;
}
int width = exoPlayerService.o.getWidth();
int height = exoPlayerService.o.getHeight();
if (width <= 0 || height <= 0) {
return;
}
exoPlayerService.C.requestLayout();
}
}
public TopLayoutService(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public TopLayoutService(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
}
public class a implements View.OnClickListener {
public a() {
}
@Override
public final void onClick(View view) {
Object obj;
int id = view.getId();
ExoPlayerService exoPlayerService = ExoPlayerService.this;
if (id == 2131362599) {
exoPlayerService.p(new boolean[0]);
return;
}
if (id == 2131365922) {
k2b k2bVar = exoPlayerService.g;
if (k2bVar == null) {
return;
}
int i = ExoPlayerService.T0;
if (i == 0) {
exoPlayerService.P();
exoPlayerService.g.B();
return;
} else {
if (i == 1) {
if (k2bVar.k()) {
exoPlayerService.I(2131888603);
return;
} else if (exoPlayerService.C0) {
exoPlayerService.I(2131888603);
return;
} else {
exoPlayerService.P();
exoPlayerService.g.C();
return;
}
}
return;
}
}
if (id == 2131362709) {
ExoPlayerService.d(exoPlayerService);
return;
}
if (id == 2131366867) {
exoPlayerService.x.setVisibility(8);
exoPlayerService.p(new boolean[0]);
return;
}
if (id != 2131365923) {
if (id == 2131365921) {
if (tya.o.b.getBoolean("custom_pip_control", true)) {
ExoPlayerService exoPlayerService2 = ExoPlayerService.Q0;
exoPlayerService.y();
return;
}
k2b k2bVar2 = exoPlayerService.g;
if (k2bVar2 == null) {
return;
}
long g = k2bVar2.g() + 10000;
if (g > exoPlayerService.g.e()) {
exoPlayerService.y();
return;
} else {
exoPlayerService.g.G(g);
return;
}
}
return;
}
if (tya.o.b.getBoolean("custom_pip_control", true)) {
Pair<dod, dod> pair = exoPlayerService.p0;
if (pair == null || (obj = pair.first) == null) {
return;
}
((dod) obj).a(null, null);
return;
}
k2b k2bVar3 = exoPlayerService.g;
if (k2bVar3 == null) {
return;
}
long g2 = k2bVar3.g() - 10000;
if (g2 < 0) {
exoPlayerService.g.G(0L);
} else {
exoPlayerService.g.G(g2);
}
}
}
public class b implements vlf.a {
public b() {
}
@Override
public final void a() {
ExoPlayerService exoPlayerService = ExoPlayerService.this;
if (exoPlayerService.k.hasMessages(6)) {
exoPlayerService.k.sendEmptyMessageDelayed(2, 100L);
} else {
exoPlayerService.C(exoPlayerService.X, exoPlayerService.O0.c);
}
}
}
public class c extends Binder {
}
public static final class e {
public static final e b;
public static final e c;
public static final e d;
public static final e[] f;
static {
e eVar = new e("NORMAL_FEED", 0);
b = eVar;
e eVar2 = new e("LIVE_FEED", 1);
c = eVar2;
e eVar3 = new e("LIVE_VOD_FEED", 2);
d = eVar3;
f = new e[]{eVar, eVar2, eVar3, new e("DOWNLOAD_FEED", 3)};
}
public e() {
throw null;
}
public static e valueOf(String str) {
return (e) Enum.valueOf(e.class, str);
}
public static e[] values() {
return (e[]) f.clone();
}
}
public static final class f {
public static final f b;
public static final f c;
public static final f[] d;
static {
f fVar = new f("NORMAL_PLAY", 0);
b = fVar;
f fVar2 = new f("LIVE_PLAY", 1);
c = fVar2;
d = new f[]{fVar, fVar2};
}
public f() {
throw null;
}
public static f valueOf(String str) {
return (f) Enum.valueOf(f.class, str);
}
public static f[] values() {
return (f[]) d.clone();
}
}
public ExoPlayerService() {
IntentFilter intentFilter = new IntentFilter();
this.i = intentFilter;
intentFilter.addAction("android.intent.action.CLOSE_SYSTEM_DIALOGS");
intentFilter.addAction("android.media.VOLUME_CHANGED_ACTION");
}
public static void B(TextView textView, SvodGroupTheme svodGroupTheme) {
Drawable findDrawableByLayerId;
if (textView == null || textView.getBackground() == null) {
return;
}
Drawable background = textView.getBackground();
Drawable mutate = background != null ? background.mutate() : null;
LayerDrawable layerDrawable = mutate instanceof LayerDrawable ? (LayerDrawable) mutate : null;
Object mutate2 = (layerDrawable == null || (findDrawableByLayerId = layerDrawable.findDrawableByLayerId(2131365052)) == null) ? null : findDrawableByLayerId.mutate();
GradientDrawable gradientDrawable = mutate2 instanceof GradientDrawable ? (GradientDrawable) mutate2 : null;
int[] iArr = {svodGroupTheme.b, svodGroupTheme.c};
if (gradientDrawable != null) {
gradientDrawable.setColors(iArr);
}
textView.setTextColor(svodGroupTheme.g);
}
public static void M() {
ExoPlayerService exoPlayerService = Q0;
if (exoPlayerService != null) {
exoPlayerService.k(true);
}
}
public static void d(ExoPlayerService exoPlayerService) {
d dVar;
k2b k2bVar;
b05 b05Var = exoPlayerService.G0;
if (b05Var != null && (k2bVar = exoPlayerService.g) != null) {
k2bVar.g();
exoPlayerService.g.e();
b05Var.a();
}
dn5.c = 1.0f;
dn5.d = -1.0f;
dn5.e = null;
exoPlayerService.l(true);
exoPlayerService.k(true);
jkd.b();
fke.b(VideoStatus.ONLINE);
k2b k2bVar2 = exoPlayerService.g;
if (k2bVar2 == null || (dVar = fke.d) == null) {
return;
}
k2bVar2.J(dVar);
fke.d = null;
}
public final void B5(AdErrorEvent adErrorEvent, hk hkVar) {
com.mxtech.videoplayer.ad.online.ad.theatermode.c s;
if (!hkVar.n || (s = s()) == null) {
return;
}
s.a(adErrorEvent.getError());
}
public final void B7(k2b k2bVar, int i, int i2, int i3, float f2) {
ImageView imageView;
if (i > 0 && i2 > 0) {
float f3 = i;
float f4 = i2;
float f5 = f3 / f4;
this.J = f3;
this.K = f4;
this.X = f5;
Handler handler = this.k;
if (handler.hasMessages(6)) {
handler.sendEmptyMessageDelayed(5, 100L);
} else {
C(f5, -1);
}
}
i7d i7dVar = this.s0;
if (i7dVar == null || k2bVar == null) {
return;
}
boolean o = k2bVar.o();
if (!o && (imageView = i7dVar.a) != null && i7dVar.b && imageView.getVisibility() != 0) {
imageView.setVisibility(0);
}
if (o) {
i7dVar.b();
}
}
public final void C(float f2, int i) {
if (!this.Z || this.n == null) {
return;
}
if (Math.abs(f2 - this.X) > 0.001d) {
int i2 = this.n.width;
this.V = i2;
int i3 = (int) (i2 / f2);
this.W = i3;
float f3 = i3;
float f4 = this.M;
if (f3 >= f4) {
f3 = f4;
}
int i4 = (int) f3;
this.W = i4;
this.V = (int) (i4 * f2);
e();
if (f2 <= this.Y) {
int i5 = this.W;
float f5 = i5;
float f6 = this.M;
if (f5 >= f6) {
i5 = (int) f6;
}
this.W = i5;
int i6 = this.Q;
if (i5 < i6) {
i5 = i6;
}
this.W = i5;
this.V = (int) (i5 * f2);
} else {
int i7 = this.V;
float f7 = i7;
float f8 = this.L;
if (f7 >= f8) {
i7 = (int) f8;
}
this.V = i7;
int i8 = this.P;
if (i7 < i8) {
i7 = i8;
}
this.V = i7;
this.W = (int) (i7 / f2);
}
float f9 = this.L * this.M;
float f10 = this.V * this.W;
if (f9 != 0.0f && f10 <= f9) {
float f11 = this.S;
if (f11 == 0.0f || f11 > 1.0d) {
this.S = f10 / f9;
} else {
float f12 = f10 / f9;
if (Math.abs(f12 - f11) > 0.05d) {
float sqrt = (float) Math.sqrt(this.S / f12);
int i9 = (int) (this.V * sqrt);
this.V = i9;
int i10 = (int) (sqrt * this.W);
this.W = i10;
if (f2 <= this.Y) {
float f13 = i10;
float f14 = this.M;
if (f13 >= f14) {
i10 = (int) f14;
}
this.W = i10;
int i11 = this.Q;
if (i10 < i11) {
i10 = i11;
}
this.W = i10;
this.V = (int) (i10 * f2);
} else {
float f15 = i9;
float f16 = this.L;
if (f15 >= f16) {
i9 = (int) f16;
}
this.V = i9;
int i12 = this.P;
if (i9 < i12) {
i9 = i12;
}
this.V = i9;
int i13 = (int) (i9 / f2);
this.W = i13;
int i14 = this.R;
if (i13 < i14) {
i13 = i14;
}
this.W = i13;
this.V = (int) (i13 * f2);
}
this.S = (this.V * this.W) / f9;
} else {
this.S = f12;
}
}
}
O(this.n.width, this.V);
WindowManager.LayoutParams layoutParams = this.n;
int i15 = this.V;
layoutParams.width = i15;
int i16 = this.W;
layoutParams.height = i16;
float f17 = this.L;
int i17 = (int) ((f17 - i15) - (this.T * f17));
layoutParams.x = i17;
float f18 = this.M;
int i18 = (int) ((f18 - i16) - (this.U * f18));
layoutParams.y = i18;
if (i17 < 0) {
i17 = 0;
}
layoutParams.x = i17;
if (i18 < 0) {
i18 = 0;
}
layoutParams.y = i18;
int i19 = (int) f17;
if (i17 + i15 >= i19) {
i17 = i19 - i15;
}
layoutParams.x = i17;
int i20 = (int) f18;
if (i18 + i16 >= i20) {
i18 = i20 - i16;
}
layoutParams.y = i18;
Q();
}
this.X = f2;
if (i == -1) {
e();
E();
return;
}
h7f.a.c(this);
int dimensionPixelSize = getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", TelemetryEventStrings.Os.OS_NAME));
if (i == 0) {
float f19 = this.N;
float f20 = this.O;
this.L = f19 < f20 ? f19 : f20;
if (f19 < f20) {
f19 = f20;
}
this.M = f19;
} else if (i == 1 || i == 3) {
float f21 = this.N;
float f22 = this.O;
this.L = f21 < f22 ? f22 : f21;
if (f21 >= f22) {
f21 = f22;
}
this.M = f21;
}
float f23 = this.M - dimensionPixelSize;
this.M = f23;
float f24 = this.L;
this.P = ((int) f24) / 3;
this.Q = ((int) f23) / 3;
this.Y = f24 / f23;
E();
}
public final void D(boolean z) {
i7d i7dVar = this.s0;
if (i7dVar != null) {
i7dVar.b();
this.s0 = null;
}
SubtitleView subtitleView = this.v0;
if (subtitleView != null) {
subtitleView.setCues((List) null);
}
if (this.g != null) {
T();
e7d e7dVar = this.x0;
if (e7dVar != null) {
e7dVar.c(this.o0);
}
k2b k2bVar = this.g;
if (k2bVar != null) {
k2bVar.S(this.C);
}
SurfaceView surfaceView = this.C;
if (surfaceView != null) {
this.o.removeView(surfaceView);
this.C = null;
}
this.g.J(this);
this.g.N();
S();
if (z && !this.B0) {
this.g.E();
}
this.g = null;
}
this.B0 = false;
}
public final void E() {
float f2 = this.X;
if (f2 <= this.Y) {
int i = this.n.height;
float f3 = i;
float f4 = this.M;
if (f3 >= f4) {
i = (int) f4;
}
this.W = i;
int i2 = this.Q;
if (i < i2) {
i = i2;
}
this.W = i;
this.V = (int) (i * f2);
} else {
int i3 = this.n.width;
float f5 = i3;
float f6 = this.L;
if (f5 >= f6) {
i3 = (int) f6;
}
this.V = i3;
int i4 = this.P;
if (i3 < i4) {
i3 = i4;
}
this.V = i3;
this.W = (int) (i3 / f2);
}
O(this.n.width, this.V);
WindowManager.LayoutParams layoutParams = this.n;
int i5 = this.V;
layoutParams.width = i5;
int i6 = this.W;
layoutParams.height = i6;
float f7 = this.L;
int i7 = (int) ((f7 - i5) - (this.T * f7));
layoutParams.x = i7;
float f8 = this.M;
int i8 = (int) ((f8 - i6) - (this.U * f8));
layoutParams.y = i8;
if (i7 < 0) {
i7 = 0;
}
layoutParams.x = i7;
if (i8 < 0) {
i8 = 0;
}
layoutParams.y = i8;
int i9 = (int) f7;
if (i7 + i5 >= i9) {
i7 = i9 - i5;
}
layoutParams.x = i7;
int i10 = (int) f8;
if (i8 + i6 >= i10) {
i8 = i10 - i6;
}
layoutParams.y = i8;
Q();
}
public final void E4(k2b k2bVar) {
this.D0 = false;
this.A0 = null;
}
public final void E5(f2b f2bVar) {
k2b k2bVar;
boolean z = f2bVar.c.a().f;
g7d g7dVar = this.c0;
if (g7dVar != null) {
if (!z) {
t();
} else if (g7dVar != null && ((k2bVar = this.g) == null || !k2bVar.o())) {
g7d g7dVar2 = this.c0;
g7dVar2.b = true;
g7dVar2.g.setVisibility(0);
H(8);
}
}
Feed feed = this.h0;
if (feed == null || feed.getTvShow() == null) {
return;
}
eta a2 = eta.a();
String id = this.h0.getTvShow().getId();
a2.getClass();
a2.a.a(new id(6, a2, id));
}
public final void F(View view, boolean z) {
if (view == null) {
return;
}
g7d g7dVar = this.c0;
boolean z2 = g7dVar != null && g7dVar.b;
view.setEnabled(z);
view.setAlpha(z ? 1.0f : 0.3f);
view.setVisibility(z2 ? 4 : 0);
}
public final void G() {
throw new UnsupportedOperationException("Method not decompiled: com.mxtech.videoplayer.ad.online.mxexo.service.ExoPlayerService.G():void");
}
public final void H(int i) {
this.c0.getClass();
View view = this.p;
if (view != null) {
view.setVisibility(i);
if (i == 0) {
t();
}
this.p.setOnClickListener(new cd(this, 1));
}
View view2 = this.p;
if (view2 == null) {
return;
}
((TextView) view2).setText(2131889558);
}
public final void I(int i) {
String string = getString(i);
if (TextUtils.isEmpty(string)) {
return;
}
z6h.d(getApplicationContext(), string, true);
}
public final void J5(f2b f2bVar) {
T0 = 0;
P();
if (f2bVar != null && f2bVar.o()) {
this.k.removeMessages(1);
F(this.t, false);
F(this.u, false);
G();
}
t();
T();
}
public final void K(k2b k2bVar, TVChannel tVChannel, TVProgram tVProgram, FromStack fromStack, Class cls, Intent intent, boolean z) {
d0c.i().h(true);
if (k2bVar == null) {
throw new IllegalStateException("mxplayer is null.");
}
if (this.g != null) {
throw new IllegalStateException("PP already exists.");
}
Log.d("MX.ExoPlayService", "Transfer Player(" + this.g + ") from " + cls);
this.h = intent;
this.e0 = tVChannel;
this.f0 = tVProgram;
this.g0 = z;
this.u0 = fromStack;
this.g = k2bVar;
if (intent != null) {
this.r0 = (e) intent.getSerializableExtra("CurrentFeedType");
this.t0 = intent.getFloatExtra("CurrentBrightness", 0.0f);
this.w0 = intent.getBooleanExtra("CurrentFeedNoAD", false);
this.y0 = (PIPPlayerInfo) intent.getParcelableExtra("CurrentPlayerInfo");
}
List<PlayInfo> list = null;
if (z) {
if (tVChannel != null) {
list = tVChannel.playInfoList();
}
} else if (tVProgram != null) {
list = tVProgram.playInfoList();
}
this.j0 = new b3e(list);
n();
this.x0 = m();
this.g.D(this);
this.g.a(this);
dr5 b2 = dr5.b();
b2.a(this.g, b2);
this.g.M(this.C);
if (this.g.o() || this.g.p()) {
T0 = 1;
P();
this.g.C();
} else {
T0 = 0;
P();
this.g.B();
}
if (this.N0 == null) {
hr5 hr5Var = new hr5(this);
this.N0 = hr5Var;
zm3.a(this, hr5Var, this.i, true);
}
if (this.z0 == null) {
IntentFilter intentFilter = new IntentFilter("com.mxplayer.login");
this.z0 = new ir5(this);
dia.a(this).b(this.z0, intentFilter);
}
this.n0 = f.c;
d dVar = R0;
dVar.sendMessageDelayed(dVar.obtainMessage(3), this.g.n() ? TranslateInfo.GOOGLE_MAX_LENGTH : 0);
Handler handler = this.k;
if (handler != null) {
handler.sendEmptyMessageDelayed(5, 2000L);
}
cog cogVar = this.H0;
if (cogVar != null) {
cogVar.h = true;
int i = d1j.a;
Handler handler2 = cogVar.e;
handler2.postDelayed(new ti1(cogVar, 11), 1000L);
handler2.postDelayed(cogVar.g, cogVar.f);
}
}
public final void K3(vg8 vg8Var, hk hkVar) {
com.mxtech.videoplayer.ad.online.ad.theatermode.c s;
if (!hkVar.n || (s = s()) == null) {
return;
}
s.b(vg8Var);
}
public final hk K5() {
e7d e7dVar;
Feed feed = this.h0;
lai laiVar = lai.b;
if (a.b(feed).g() || (e7dVar = this.x0) == null) {
return null;
}
return e7dVar.b();
}
public final void L(k2b k2bVar, Feed feed, FromStack fromStack, Class cls, Intent intent, Pair<Pair<dod, dod>, Feed> pair, OnlineResource onlineResource) {
d0c.i().h(true);
if (k2bVar == null) {
throw new IllegalStateException("mxplayer is null.");
}
if (this.g != null) {
throw new IllegalStateException("PP already exists.");
}
Log.d("MX.ExoPlayService", "Transfer Player(" + k2bVar + ") from " + cls);
this.h = intent;
this.g = k2bVar;
this.u0 = fromStack;
this.r0 = (e) intent.getSerializableExtra("CurrentFeedType");
String stringExtra = intent.getStringExtra("streamId");
if (!TextUtils.isEmpty(stringExtra)) {
this.K0 = stringExtra;
}
this.t0 = intent.getFloatExtra("CurrentBrightness", 0.0f);
this.w0 = intent.getBooleanExtra("CurrentFeedNoAD", false);
this.I0 = intent.getBooleanExtra("CurrentLockStatus", false);
this.y0 = (PIPPlayerInfo) intent.getParcelableExtra("CurrentPlayerInfo");
int intExtra = intent.getIntExtra("CurrentSource", 0);
this.p0 = (Pair) pair.first;
this.o0 = (Feed) pair.second;
this.h0 = feed;
this.m0 = onlineResource;
this.j0 = new b3e(feed != null ? feed.playInfoList() : null);
n();
if (intExtra == 1) {
this.G0 = new b05(feed);
com.mxtech.videoplayer.ad.online.mxexo.service.a aVar = this.b0;
if (aVar != null) {
aVar.b = null;
aVar.c.release();
}
a.C0087a c0087a = new a.C0087a();
c0087a.a = this.h0;
c0087a.e = true;
c0087a.c = S0;
c0087a.d = this;
com.mxtech.videoplayer.ad.online.mxexo.service.a aVar2 = new com.mxtech.videoplayer.ad.online.mxexo.service.a(c0087a);
this.b0 = aVar2;
aVar2.c.load();
}
this.x0 = m();
this.g.D(this);
this.g.a(this);
dr5 b2 = dr5.b();
b2.a(this.g, b2);
this.g.M(this.C);
k2b k2bVar2 = this.g;
k2bVar2.v = this;
d dVar = k2bVar2.x;
if (dVar != null) {
n o = dVar.o();
o.getClass();
o.g.add(this);
}
k2b k2bVar3 = this.g;
if (!((k2bVar3 != null && (k2bVar3.Q() instanceof wj8)) ? k2bVar3.Q().a() : false)) {
if (this.g.o() || this.g.p()) {
T0 = 1;
P();
this.g.C();
} else {
T0 = 0;
P();
this.g.B();
}
}
if (this.N0 == null) {
hr5 hr5Var = new hr5(this);
this.N0 = hr5Var;
zm3.a(this, hr5Var, this.i, true);
}
if (this.z0 == null) {
IntentFilter intentFilter = new IntentFilter("com.mxplayer.login");
this.z0 = new ir5(this);
dia.a(this).b(this.z0, intentFilter);
}
this.n0 = f.b;
d dVar2 = R0;
dVar2.sendMessageDelayed(dVar2.obtainMessage(3), this.g.n() ? TranslateInfo.GOOGLE_MAX_LENGTH : 0);
Handler handler = this.k;
if (handler != null) {
handler.sendEmptyMessageDelayed(5, 2000L);
}
cog cogVar = this.H0;
if (cogVar != null) {
cogVar.h = true;
int i = d1j.a;
Handler handler2 = cogVar.e;
handler2.postDelayed(new ti1(cogVar, 11), 1000L);
handler2.postDelayed(cogVar.g, cogVar.f);
}
j();
}
public final void N() {
if (this.t == null) {
return;
}
if (tya.o.b.getBoolean("custom_pip_control", true)) {
this.t.setImageResource(2131235030);
this.u.setImageResource(2131235028);
} else {
this.t.setImageResource(2131235031);
this.u.setImageResource(2131235026);
}
}
public final FrameLayout N0() {
return this.o;
}
public final void O(int i, int i2) {
LinearLayout linearLayout;
if (i2 <= 0 || i <= 0 || (linearLayout = this.z) == null) {
return;
}
ViewGroup.LayoutParams layoutParams = linearLayout.getLayoutParams();
if (layoutParams.width > i2) {
layoutParams.width = i2;
} else {
int i3 = this.A;
if (i2 > i3) {
i2 = i3;
}
layoutParams.width = i2;
}
this.z.setLayoutParams(layoutParams);
ImageView imageView = this.u;
if (imageView == null || this.t == null || this.r == null) {
return;
}
ViewGroup.LayoutParams layoutParams2 = imageView.getLayoutParams();
layoutParams2.width = layoutParams.width / 3;
this.u.setLayoutParams(layoutParams2);
this.t.setLayoutParams(layoutParams2);
this.r.setLayoutParams(layoutParams2);
}
public final boolean O7() {
return false;
}
public final void P() {
int i = T0;
if (i == 0) {
this.r.setImageDrawable(getResources().getDrawable(2131234880));
T0 = 1;
} else if (i == 1) {
this.r.setImageDrawable(getResources().getDrawable(2131234869));
T0 = 0;
}
}
public final void Q() {
ImageView imageView;
float f2 = this.L;
float f3 = this.M;
this.S = (this.V * this.W) / (f2 * f3);
WindowManager.LayoutParams layoutParams = this.n;
this.T = ((f2 - layoutParams.x) - layoutParams.width) / f2;
this.U = ((f3 - layoutParams.y) - layoutParams.height) / f3;
try {
this.B.updateViewLayout(S0, layoutParams);
i7d i7dVar = this.s0;
if (i7dVar != null) {
float f4 = this.L;
float f5 = this.M;
float f6 = this.V;
if (i7dVar.a == null || !i7dVar.b || f6 <= 0.0f || f4 <= 0.0f || f5 <= 0.0f) {
return;
}
int i = (int) (((f4 > f5 ? 1 : (f4 == f5 ? 0 : -1)) < 0 ? i7dVar.d : i7dVar.c) * (f6 / f4));
int i2 = i / 3;
if (i <= 0 || i2 <= 0 || !TextUtils.equals(i7dVar.e, "voot") || i < 0 || i2 < 0 || (imageView = i7dVar.a) == null) {
return;
}
ViewGroup.LayoutParams layoutParams2 = imageView.getLayoutParams();
if (layoutParams2 instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) layoutParams2;
layoutParams3.width = i;
layoutParams3.height = i2;
layoutParams3.setMargins(i2, i2, i2, i2);
}
}
} catch (IllegalArgumentException unused) {
}
}
public final void Q6(f2b f2bVar) {
Feed feed;
T();
P();
if (!h3i.a.a.c() && f2bVar != null && !f2bVar.o() && (feed = this.h0) != null && feed.isNeedLogin()) {
I(2131888603);
this.C0 = true;
this.D0 = true;
this.E0 = null;
return;
}
Handler handler = this.k;
if (handler != null) {
handler.sendEmptyMessage(3);
}
b05 b05Var = this.G0;
if (b05Var == null || ((b05.a) b05.b.remove(b05Var.a.getId())) == null) {
return;
}
if (a05.f == null) {
synchronized (a05.class) {
try {
if (a05.f == null) {
a05.f = new a05();
}
} finally {
}
}
}
a05.f.getClass();
kl3.p(new xe0[]{null});
}
@Override
public final void Q7(b3d b3dVar, String str) {
if (str != null && str.equals("custom_pip_control")) {
N();
}
}
public final void R() {
boolean z;
if (this.p0 == null) {
return;
}
F(this.r, true);
boolean z2 = tya.o.b.getBoolean("custom_pip_control", true);
a aVar = this.P0;
if (z2) {
boolean z3 = this.p0.first != null;
F(this.t, z3);
if (z3) {
this.t.setOnClickListener(aVar);
}
z = this.p0.second != null;
F(this.u, z);
if (z) {
this.u.setOnClickListener(aVar);
return;
}
return;
}
e eVar = this.r0;
e eVar2 = e.c;
boolean z4 = eVar != eVar2;
F(this.t, z4);
if (z4) {
this.t.setOnClickListener(aVar);
}
z = this.r0 != eVar2;
F(this.u, z);
if (z) {
this.u.setOnClickListener(aVar);
}
}
public final void S() {
k2b k2bVar = this.g;
if (k2bVar == null) {
return;
}
long e2 = k2bVar.e();
if (e2 == -9223372036854775807L || e2 <= 0) {
return;
}
this.l0 = Math.max(0L, this.g.g());
}
public final void T() {
e7d e7dVar = this.x0;
if (e7dVar != null) {
e7dVar.e();
}
}
public final boolean Z() {
return false;
}
public final void Z3(f2b f2bVar, long j, long j2) {
ImageView imageView;
T0 = 1;
P();
if (f2bVar != null && f2bVar.o()) {
u();
}
T();
i7d i7dVar = this.s0;
if (i7dVar != null) {
boolean z = f2bVar != null && f2bVar.o();
if (!z && (imageView = i7dVar.a) != null && i7dVar.b && imageView.getVisibility() != 0) {
imageView.setVisibility(0);
}
if (z) {
i7dVar.b();
}
}
k2b k2bVar = this.g;
if (k2bVar != null && k2bVar.x != null && this.d0) {
this.d0 = false;
}
this.w0 = false;
}
@Override
public final void a(Object obj) {
}
@NonNull
public final tj8 a1() {
if (this.J0 == null) {
this.J0 = new hod(this.K0, (on8) null);
}
return this.J0;
}
public final OnlineResource b5() {
e7d e7dVar = this.x0;
if (e7dVar != null) {
return e7dVar.a();
}
return null;
}
public final void b8(f2b r7, java.lang.Throwable r8) {
throw new UnsupportedOperationException("Method not decompiled: com.mxtech.videoplayer.ad.online.mxexo.service.ExoPlayerService.b8(f2b, java.lang.Throwable):void");
}
public final void d5() {
p(new boolean[0]);
}
public final void e() {
int dimensionPixelSize = getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", TelemetryEventStrings.Os.OS_NAME));
Configuration configuration = getResources().getConfiguration();
int i = configuration.orientation;
if (i == 2) {
float f2 = this.N;
float f3 = this.O;
this.L = f2 < f3 ? f3 : f2;
if (f2 >= f3) {
f2 = f3;
}
this.M = f2;
} else if (i == 1) {
float f4 = this.N;
float f5 = this.O;
this.L = f4 < f5 ? f4 : f5;
if (f4 < f5) {
f4 = f5;
}
this.M = f4;
} else {
int i2 = configuration.hardKeyboardHidden;
if (i2 == 1) {
float f6 = this.N;
float f7 = this.O;
this.L = f6 < f7 ? f7 : f6;
if (f6 >= f7) {
f6 = f7;
}
this.M = f6;
} else if (i2 == 2) {
float f8 = this.N;
float f9 = this.O;
this.L = f8 < f9 ? f8 : f9;
if (f8 < f9) {
f8 = f9;
}
this.M = f8;
}
}
float f10 = this.M - dimensionPixelSize;
this.M = f10;
float f11 = this.L;
this.P = ((int) f11) / 3;
this.Q = ((int) f10) / 3;
this.Y = f11 / f10;
}
public final void f() {
Rect rect = this.y0.c;
WindowManager.LayoutParams layoutParams = this.n;
int i = rect.left;
layoutParams.x = i;
int i2 = rect.top;
layoutParams.y = i2;
int i3 = rect.right - i;
int i4 = rect.bottom - i2;
float f2 = this.X;
if (f2 <= this.Y) {
float f3 = i4;
float f4 = this.M;
if (f3 >= f4) {
i4 = (int) f4;
}
} else {
float f5 = i3;
float f6 = this.L;
if (f5 >= f6) {
i3 = (int) f6;
}
i4 = (int) (i3 / f2);
int i5 = this.R;
if (i4 < i5) {
i4 = i5;
}
}
int i6 = (int) (i4 * f2);
layoutParams.width = i6;
layoutParams.height = i4;
if (i < 0) {
i = 0;
}
layoutParams.x = i;
if (i2 < 0) {
i2 = 0;
}
layoutParams.y = i2;
int i7 = i + i6;
float f7 = this.L;
if (i7 >= ((int) f7)) {
i = ((int) f7) - i6;
}
layoutParams.x = i;
int i8 = i2 + i4;
float f8 = this.M;
if (i8 >= ((int) f8)) {
i2 = ((int) f8) - i4;
}
layoutParams.y = i2;
}
public final boolean f6() {
return !this.w0;
}
public final FromStack fromStack() {
return this.u0;
}
public final void g(List<ax3> list) {
SubtitleView subtitleView = this.v0;
if (subtitleView != null) {
subtitleView.setCues(list);
}
}
@Override
public final List<String> getCdnList() {
List<String> cdnList;
com.mxtech.videoplayer.ad.online.mxexo.service.a aVar = this.b0;
if (aVar == null) {
cdnList = new ArrayList<>();
} else {
fo5 fo5Var = aVar.c;
cdnList = fo5Var != null ? fo5Var.getCdnList() : new ArrayList<>();
}
boolean n = ti.n(cdnList);
ArrayList arrayList = this.F0;
if (n) {
return arrayList;
}
arrayList.clear();
arrayList.addAll(cdnList);
return arrayList;
}
@Override
public final SharedPreferences getSharedPreferences(String str, int i) {
return tya.m.getSharedPreferences(str, i);
}
public final boolean h() {
Feed feed = this.h0;
if (feed == null) {
return false;
}
if (feed.isYoutube()) {
return true;
}
List<PlayInfo> playInfoList = this.h0.playInfoList();
if (playInfoList == null || playInfoList.isEmpty()) {
return false;
}
return !fuh.C(this.h0);
}
@Override
public final boolean handleMessage(Message message) {
int i = message.what;
if (i == 1 && this.Z) {
u();
return true;
}
Handler handler = this.k;
if (i == 2) {
if (handler.hasMessages(6)) {
handler.sendEmptyMessageDelayed(2, 100L);
} else {
C(this.X, this.O0.c);
}
} else if (i == 3) {
y();
} else if (i == 4) {
if (!this.m) {
z6h.c(getApplicationContext(), 2131889159, true);
dr5 b2 = dr5.b();
if (b2.i != null) {
b2.i = null;
}
this.B0 = false;
}
} else if (i == 5) {
if (handler.hasMessages(6)) {
handler.sendEmptyMessageDelayed(5, 100L);
} else {
C(this.X, -1);
}
} else if (i == 6 && this.Z) {
int a2 = i7d.a(8, getApplicationContext());
WindowManager.LayoutParams layoutParams = this.n;
int i2 = this.V;
layoutParams.width = i2;
int i3 = this.W;
layoutParams.height = i3;
float f2 = this.L;
float f3 = a2;
int i4 = (int) ((f2 - i2) - f3);
layoutParams.x = i4;
float f4 = this.M;
int i5 = (int) ((f4 - i3) - f3);
layoutParams.y = i5;
if (i4 < 0) {
i4 = 0;
}
layoutParams.x = i4;
if (i5 < 0) {
i5 = 0;
}
layoutParams.y = i5;
int i6 = (int) f2;
if (i4 + i2 >= i6) {
i4 = i6 - i2;
}
layoutParams.x = i4;
int i7 = (int) f4;
if (i5 + i3 >= i7) {
i5 = i7 - i3;
}
layoutParams.y = i5;
Q();
}
return false;
}
public final void i() {
Feed feed = this.h0;
lai laiVar = lai.b;
lai b2 = a.b(feed);
MxSubscriptionInfoWrapper a2 = b2.a(b2.a.getContentAccess());
if (a2 != null) {
if (a2.isTvod()) {
ExoPIPFrameLayout exoPIPFrameLayout = S0;
if (exoPIPFrameLayout == null || this.h0 == null) {
return;
}
View findViewById = exoPIPFrameLayout.findViewById(2131367385);
findViewById.setVisibility(0);
findViewById.setOnClickListener(new ag2(this, 3));
return;
}
if (S0 != null && this.h0 != null) {
rqg rqgVar = new rqg();
List packs = b2.a(b2.a.getContentAccess()).packs();
h3i.a.a.c();
Feed feed2 = this.h0;
Boolean bool = Boolean.FALSE;
mdg u = d0d.u("subscribeNowScreenViewedPip");
d0d.c(u, "membership", packs != null ? CollectionsKt.I(packs, ",", (String) null, (String) null, (Function1) null, 62) : null);
d0d.c(u, "isPreview", Integer.valueOf(Intrinsics.b(bool, Boolean.TRUE) ? 1 : 0));
if (feed2 != null) {
rqg.d(u, feed2);
}
rqg.p(rqgVar, u, false, (String) null, false, 14);
final View findViewById2 = S0.findViewById(2131366357);
findViewById2.setVisibility(0);
final TextView textView = (TextView) findViewById2.findViewById(2131367148);
final TextView textView2 = (TextView) findViewById2.findViewById(2131362413);
findViewById2.setOnClickListener(new at2(this, 1));
if (!b2.h()) {
jo7 jo7Var = new jo7(new Function1() {
public final Object invoke(Object obj) {
TextView textView3 = textView2;
SubscriptionGroupBean subscriptionGroupBean = (SubscriptionGroupBean) obj;
ExoPlayerService exoPlayerService = ExoPlayerService.Q0;
ExoPlayerService.this.getClass();
textView.setText(subscriptionGroupBean.getName());
try {
ExoPlayerService.B(textView3, subscriptionGroupBean.getTheme());
} catch (Exception unused) {
}
try {
SvodGroupTheme theme = subscriptionGroupBean.getTheme();
View view = findViewById2;
if (view.getBackground() == null) {
return null;
}
Drawable mutate = view.getBackground().mutate();
if (!(mutate instanceof GradientDrawable)) {
return null;
}
int i = m63.i(theme.g, 230);
int i2 = m63.i(theme.f, 230);
((GradientDrawable) mutate).setColors(new int[]{i, m63.c(i2, i), i2});
return null;
} catch (Exception unused2) {
return null;
}
}
}, new gr5(0), (big) null, (g6f) null, (String) null, (String) null, (Function0) null, 252);
lai b3 = a.b(this.h0);
jo7Var.a(this, (String) b3.a(b3.a.getContentAccess()).packs().get(0));
}
}
I(2131889124);
}
}
public final void j() {
Feed feed;
if (this.d == null && (feed = this.h0) != null && !TextUtils.isEmpty(feed.getId())) {
Feed feed2 = this.h0;
lai laiVar = lai.b;
if (feed2.enableConcurrentStream(a.b(feed2).g()) && h3i.a.a.c()) {
this.d = new vf3(this.h0.getId(), this.h0.getType() != null ? this.h0.getType().typeName() : "", this);
}
}
vf3 vf3Var = this.d;
if (vf3Var != null && vf3Var.i == 4) {
this.l.post(new g70(this, 3));
} else if (vf3Var != null) {
vf3Var.b(0);
}
}
public final void k(boolean z) {
ExoPlayerService exoPlayerService;
Log.d("MX.ExoPlayService", "Return " + this.g);
T();
e7d e7dVar = this.x0;
if (e7dVar != null) {
e7dVar.c(this.o0);
}
l(true);
k2b k2bVar = this.g;
this.g = null;
this.h = null;
zm3.b(this, this.N0);
dia.a(this).d(this.z0);
R0.b();
if (z && k2bVar != null && (exoPlayerService = Q0) != null) {
k2bVar.J(exoPlayerService);
k2bVar.T(Q0);
if (!Q0.B0) {
k2bVar.E();
}
Q0.B0 = false;
}
this.x0 = null;
com.mxtech.videoplayer.ad.online.mxexo.service.a aVar = this.b0;
if (aVar != null) {
aVar.b = null;
aVar.c.release();
this.b0 = null;
}
this.b = null;
cog cogVar = this.H0;
if (cogVar != null) {
cogVar.h = false;
int i = d1j.a;
cogVar.e.removeCallbacks(cogVar.g);
}
}
public final void l(boolean z) {
if (this.Z) {
Handler handler = this.k;
if (handler.hasMessages(1)) {
handler.removeMessages(1);
}
handler.removeMessages(3);
k2b k2bVar = this.g;
if (k2bVar != null) {
k2bVar.S(this.C);
}
SurfaceView surfaceView = this.C;
if (surfaceView != null) {
this.o.removeView(surfaceView);
this.C = null;
}
D(z);
this.B.removeView(S0);
S0 = null;
vlf vlfVar = this.O0;
ulf ulfVar = vlfVar.d;
if (ulfVar != null) {
ulfVar.disable();
vlfVar.d = null;
}
this.p0 = new Pair<>(null, null);
this.o0 = null;
api.e(this.g);
i7d i7dVar = this.s0;
if (i7dVar != null) {
i7dVar.b();
this.s0 = null;
}
vf3 vf3Var = this.d;
if (vf3Var != null) {
vf3Var.b(2);
}
this.Z = false;
}
}
public final e7d m() {
int ordinal = this.r0.ordinal();
if (ordinal == 0) {
getApplicationContext();
return new d7d(this);
}
if (ordinal == 1) {
getApplicationContext();
b7d b7dVar = new b7d(this);
b7dVar.c = this.e0;
b7dVar.d = this.f0;
return b7dVar;
}
if (ordinal != 2) {
if (ordinal != 3) {
return null;
}
getApplicationContext();
return new x6d(this);
}
getApplicationContext();
h7d h7dVar = new h7d(this);
h7dVar.c = this.f0;
return h7dVar;
}
public final void n() {
g7d g7dVar;
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(-2, -2, AuthenticationConstants.BrokerResponse.BROKER_ERROR_RESPONSE, 264840, -3);
this.n = layoutParams;
if (Build.VERSION.SDK_INT >= 26) {
layoutParams.type = 2038;
} else {
layoutParams.type = AuthenticationConstants.BrokerResponse.BROKER_ERROR_RESPONSE;
}
this.B = (WindowManager) getSystemService("window");
LayoutInflater layoutInflater = (LayoutInflater) getSystemService("layout_inflater");
DisplayMetrics displayMetrics = new DisplayMetrics();
this.B.getDefaultDisplay().getMetrics(displayMetrics);
k2b k2bVar = this.g;
n Q = k2bVar != null ? k2bVar.Q() : null;
if ((Q != null ? Q.q : null) == null) {
this.J = 320.0f;
this.K = 240.0f;
} else {
this.J = r2.u;
this.K = r2.v;
}
float f2 = displayMetrics.widthPixels;
this.L = f2;
this.N = f2;
float f3 = displayMetrics.heightPixels;
this.M = f3;
this.O = f3;
this.P = ((int) f2) / 3;
this.Q = ((int) f3) / 3;
this.X = this.J / this.K;
this.Y = f2 / f3;
ExoPIPFrameLayout exoPIPFrameLayout = (ExoPIPFrameLayout) layoutInflater.inflate(2131560063, (ViewGroup) null, false);
S0 = exoPIPFrameLayout;
this.o = (TopLayoutService) exoPIPFrameLayout.findViewById(2131366632);
v();
SubtitleView subtitleView = new SubtitleView(getApplicationContext());
this.v0 = subtitleView;
subtitleView.setUserDefaultStyle();
this.v0.setUserDefaultTextSize();
this.v0.setCues((List) null);
this.o.addView(this.v0);
WindowManager.LayoutParams layoutParams2 = this.n;
layoutParams2.gravity = 8388659;
layoutParams2.x = 0;
layoutParams2.y = 0;
layoutParams2.width = (int) this.J;
layoutParams2.height = (int) this.K;
float f4 = this.X;
if (f4 <= this.Y) {
int i = ((int) this.M) / 2;
this.W = i;
this.V = (int) (i * f4);
} else {
int i2 = ((int) this.L) / 2;
this.V = i2;
this.W = (int) (i2 / f4);
}
PIPPlayerInfo pIPPlayerInfo = this.y0;
if (pIPPlayerInfo == null || pIPPlayerInfo.c == null || pIPPlayerInfo.b) {
float f5 = this.L;
int i3 = this.V;
layoutParams2.x = (int) (f5 - i3);
float f6 = this.M;
int i4 = this.W;
layoutParams2.y = (int) (f6 - i4);
layoutParams2.width = i3;
layoutParams2.height = i4;
} else {
f();
}
WindowManager.LayoutParams layoutParams3 = this.n;
int i5 = layoutParams3.x;
if (i5 < 0) {
i5 = 0;
}
layoutParams3.x = i5;
int i6 = layoutParams3.y;
layoutParams3.y = i6 >= 0 ? i6 : 0;
float f7 = this.t0;
if (f7 < 0.0f || f7 > 1.0d) {
f7 = layoutParams3.screenBrightness;
}
layoutParams3.screenBrightness = f7;
this.B.addView(S0, layoutParams3);
ExoPIPFrameLayout exoPIPFrameLayout2 = S0;
if (exoPIPFrameLayout2 == null) {
g7dVar = null;
} else {
g7dVar = new g7d();
tya tyaVar = tya.m;
xrf.f();
ImageView imageView = (ImageView) exoPIPFrameLayout2.findViewById(2131364716);
g7dVar.c = imageView;
imageView.setOnClickListener(new f7d());
View findViewById = exoPIPFrameLayout2.findViewById(2131365668);
g7dVar.d = findViewById;
if (findViewById != null) {
g7dVar.f = (ViewGroup) findViewById.getParent();
}
g7dVar.g = exoPIPFrameLayout2.findViewById(2131362425);
g7dVar.h = this;
}
this.c0 = g7dVar;
g7dVar.c.setVisibility(8);
LinearLayout linearLayout = (LinearLayout) S0.findViewById(2131365410);
this.z = linearLayout;
this.A = linearLayout.getLayoutParams().width;
ImageView imageView2 = (ImageView) S0.findViewById(2131362599);
this.q = imageView2;
a aVar = this.P0;
imageView2.setOnClickListener(aVar);
ImageView imageView3 = (ImageView) S0.findViewById(2131365922);
this.r = imageView3;
imageView3.setOnClickListener(aVar);
ImageView imageView4 = (ImageView) S0.findViewById(2131362709);
this.s = imageView4;
imageView4.setOnClickListener(aVar);
ImageView imageView5 = (ImageView) S0.findViewById(2131365923);
this.t = imageView5;
imageView5.setOnClickListener(aVar);
ImageView imageView6 = (ImageView) S0.findViewById(2131365921);
this.u = imageView6;
imageView6.setOnClickListener(aVar);
N();
this.p = S0.findViewById(2131365668);
this.x = S0.findViewById(2131362660);
View findViewById2 = S0.findViewById(2131366867);
this.y = findViewById2;
findViewById2.setOnClickListener(aVar);
vlf vlfVar = this.O0;
vlfVar.a.a();
ulf ulfVar = new ulf(vlfVar, this, this);
vlfVar.d = ulfVar;
ulfVar.enable();
this.v = S0.findViewById(2131362848);
this.w = S0.findViewById(2131362849);
this.R = this.r.getLayoutParams().height + this.q.getLayoutParams().height;
S0.setOnTouchListener(new jr5(this));
S0.setOnClickListener(new kr5(this));
View findViewById3 = S0.findViewById(2131365354);
Feed feed = this.h0;
this.s0 = new i7d(findViewById3, feed != null ? feed.waterMark() : null);
api.a(this.g);
this.Z = true;
Handler handler = this.k;
handler.sendEmptyMessageDelayed(5, 500L);
handler.sendEmptyMessageDelayed(1, s6d.r(this));
this.k0 = -1;
this.l0 = -9223372036854775807L;
u();
PIPPlayerInfo pIPPlayerInfo2 = this.y0;
if (pIPPlayerInfo2 == null || pIPPlayerInfo2.c == null || pIPPlayerInfo2.b) {
return;
}
handler.sendEmptyMessageDelayed(6, 150L);
}
public final void n8(k2b k2bVar, long j, long j2, long j3) {
Feed feed;
if (this.g == null || this.h0 == null) {
return;
}
com.mxtech.videoplayer.ad.online.ad.theatermode.c cVar = this.c;
if (cVar != null && j > 0 && j2 > 0 && (j2 * 1.0f) / j > 0.95d) {
cVar.c(a.b.c);
}
js3 f2 = k2bVar.f();
boolean z = (f2 == null || (feed = this.h0) == null || feed.isDisableLoginMandate()) ? false : true;
if (!h3i.a.a.c() && !k2bVar.o() && (z || this.h0.isNeedLogin())) {
if (this.A0 != null) {
if (this.g.n()) {
return;
}
T0 = 0;
P();
this.g.B();
I(2131888603);
this.C0 = true;
if (z) {
this.E0 = f2.e();
return;
} else {
this.E0 = null;
return;
}
}
if (z || j2 >= this.h0.getNeedLoginDuration() * TranslateInfo.MX_MAX_LENGTH) {
if (this.g.n()) {
return;
}
T0 = 0;
P();
this.g.B();
I(2131888603);
this.C0 = true;
if (z) {
this.E0 = f2.e();
} else {
this.E0 = null;
}
Feed feed2 = this.h0;
if (feed2 == null || feed2.getTvShow() == null) {
return;
}
eta a2 = eta.a();
TvShow tvShow = this.h0.getTvShow();
a2.getClass();
a2.a.a(new g83(4, a2, tvShow));
return;
}
this.C0 = false;
this.E0 = null;
}
if (this.g.o()) {
return;
}
Feed feed3 = this.h0;
lai laiVar = lai.b;
if (!a.b(feed3).m() || this.g.n()) {
return;
}
T0 = 0;
P();
this.g.B();
i();
}
public final void o() {
this.t.setEnabled(false);
this.t.setAlpha(0.3f);
this.u.setEnabled(false);
this.u.setAlpha(0.3f);
this.r.setImageDrawable(getResources().getDrawable(2131234880));
T0 = 1;
}
@Override
public final void onAudioFocusChange(int i) {
k2b k2bVar;
if (i == 1 || i == -3 || (k2bVar = this.g) == null) {
return;
}
k2bVar.B();
}
@Override
public final IBinder onBind(Intent intent) {
Log.v("MX.ExoPlayService", "Bind");
return this.f;
}
@Override
public final void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if (this.g == null) {
return;
}
int i = this.j;
int i2 = configuration.orientation;
if (i != i2) {
this.j = i2;
if (this.Z) {
C(this.X, -1);
}
}
}
@Override
public final void onCreate() {
Log.v("MX.ExoPlayService", "onCreate");
Q0 = this;
this.j = getResources().getConfiguration().orientation;
String uuid = UUID.randomUUID().toString();
this.K0 = uuid;
Intent intent = this.h;
if (intent != null) {
intent.putExtra("streamId", uuid);
}
R0.b();
tj5.e(this);
tya.o.d(this);
super.onCreate();
}
@Override
public final void onDestroy() {
Log.v("MX.ExoPlayService", "onDestroy");
k(false);
Q0 = null;
d dVar = R0;
dVar.b = false;
dVar.removeCallbacksAndMessages(null);
if (com.mxtech.videoplayer.f.A) {
com.mxtech.videoplayer.f.V(null);
}
tj5.h(this);
super.onDestroy();
}
@vgg(threadMode = ThreadMode.MAIN)
public void onEvent(dta dtaVar) {
if (tj5.a.contains(this)) {
this.A0 = dtaVar.b;
}
}
@Override
public final int onStartCommand(Intent intent, int i, int i2) {
return 2;
}
@Override
public final boolean onUnbind(Intent intent) {
Log.v("MX.ExoPlayService", "Unbind");
return super.onUnbind(intent);
}
public final void p(boolean... r14) {
throw new UnsupportedOperationException("Method not decompiled: com.mxtech.videoplayer.ad.online.mxexo.service.ExoPlayerService.p(boolean[]):void");
}
public final Feed q() {
return this.b0.c.getFeed() == null ? this.h0 : this.b0.c.getFeed();
}
public final void q0(f2b f2bVar, boolean z) {
if (!z) {
t();
return;
}
if (this.c0 != null) {
k2b k2bVar = this.g;
if (k2bVar == null || !k2bVar.o()) {
g7d g7dVar = this.c0;
g7dVar.b = true;
g7dVar.g.setVisibility(0);
H(8);
}
}
}
public final String r1() {
return "PIP";
}
public final void r5(f2b f2bVar, boolean z) {
if (z) {
u();
}
}
public final com.mxtech.videoplayer.ad.online.ad.theatermode.c s() {
Feed feed;
if (this.c == null && (feed = this.h0) != null) {
this.c = new com.mxtech.videoplayer.ad.online.ad.theatermode.c(feed);
}
return this.c;
}
public final void s6(k2b k2bVar) {
e();
}
public final void t() {
g7d g7dVar = this.c0;
if (g7dVar == null || !g7dVar.b) {
return;
}
g7dVar.b = false;
g7dVar.g.setVisibility(8);
}
public final void u() {
this.u.setVisibility(4);
this.t.setVisibility(4);
this.q.setVisibility(4);
this.r.setVisibility(4);
this.s.setVisibility(4);
this.w.setVisibility(4);
this.v.setVisibility(4);
Q();
this.a0 = false;
}
public final void v() {
if (this.C != null) {
return;
}
this.C = new SurfaceView(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.addRule(13, 2131366632);
this.o.addView(this.C, 0, layoutParams);
}
public final void w() {
Feed feed = this.h0;
lai laiVar = lai.b;
if (a.b(feed).m()) {
i();
return;
}
if (h()) {
if (this.h0.isYoutube()) {
this.q0 = true;
return;
} else {
x();
return;
}
}
this.p.setVisibility(0);
t();
this.p.setOnClickListener(new nr5(this));
View view = this.p;
if (view == null) {
return;
}
((TextView) view).setText(2131889558);
}
public final void x() {
k2b a2;
k2b k2bVar = this.g;
if (k2bVar != null) {
k2bVar.E();
this.g = null;
}
this.k0 = -1;
this.l0 = -9223372036854775807L;
this.i0 = false;
if (this.g == null) {
PlayInfo a3 = this.j0.a();
if (a3 == null || !this.Z || TextUtils.isEmpty(a3.getUri())) {
g7d g7dVar = this.c0;
g7dVar.c.setVisibility(0);
g7dVar.c.setOnClickListener(new e52(g7dVar, 7));
ImageView imageView = g7dVar.c;
ExoPlayerService exoPlayerService = g7dVar.h;
exoPlayerService.getClass();
Context context = imageView.getContext();
Feed feed = exoPlayerService.h0;
sx9.l(context, imageView, feed != null ? feed.posterList() : null, 2131167609, 2131167608, kr4.o());
} else {
int ordinal = this.r0.ordinal();
if (ordinal == 0) {
d dVar = new d();
dVar.b = getApplicationContext();
dVar.c = this;
dVar.b(this.h0);
dVar.o = this.K0;
dVar.q = true;
dVar.r = true;
a2 = dVar.a();
} else if (ordinal == 1) {
d dVar2 = new d();
dVar2.b = getApplicationContext();
dVar2.c = this;
dVar2.c(this.e0, (TVProgram) null);
dVar2.q = true;
dVar2.r = true;
a2 = dVar2.a();
} else if (ordinal == 2) {
d dVar3 = new d();
dVar3.b = getApplicationContext();
dVar3.c = this;
TVChannel tVChannel = this.e0;
TVProgram tVProgram = this.f0;
dVar3.f = tVProgram.playInfoList();
dVar3.g = tVProgram;
dVar3.h = tVChannel;
dVar3.q = true;
dVar3.r = true;
a2 = dVar3.a();
} else if (ordinal != 3) {
a2 = null;
} else {
d dVar4 = new d();
dVar4.b = getApplicationContext();
dVar4.c = this;
dVar4.b(this.h0);
dVar4.o = this.K0;
dVar4.k = true;
dVar4.q = true;
dVar4.r = true;
a2 = dVar4.a();
}
this.g = a2;
if (a2 != null) {
dr5 b2 = dr5.b();
b2.a(this.g, b2);
k2b k2bVar2 = this.g;
if (this.b == null) {
this.b = z74.a(this);
}
k2bVar2.o = this.b;
this.g.D(this);
this.g.a(this);
e eVar = this.r0;
if (eVar == e.b || eVar == e.c || eVar == e.d) {
api.a(this.g);
}
v();
this.g.M(this.C);
k2b k2bVar3 = this.g;
k2bVar3.v = this;
d dVar5 = k2bVar3.x;
if (dVar5 != null) {
n o = dVar5.o();
o.getClass();
o.g.add(this);
}
this.g.C();
e7d e7dVar = this.x0;
long d2 = e7dVar != null ? e7dVar.d() : 0L;
if (d2 != 0) {
this.g.G(d2);
}
this.g.V(dn5.c);
}
}
j();
}
if (this.k0 != -1) {
this.g.G(this.l0);
}
this.d0 = true;
this.i0 = false;
H(8);
View findViewById = S0.findViewById(2131365354);
Feed feed2 = this.h0;
this.s0 = new i7d(findViewById, feed2 != null ? feed2.waterMark() : null);
j();
}
public final void y() {
Object obj;
Pair<dod, dod> pair = this.p0;
if (pair == null || (obj = pair.second) == null) {
l(true);
k(true);
return;
}
if (((dod) obj).a.getRating().equals("A")) {
tya tyaVar = tya.m;
if (!xrf.f().getBoolean("age_over_18", false)) {
this.x.setVisibility(0);
u();
this.h0 = ((dod) this.p0.second).a;
return;
}
}
this.x.setVisibility(8);
((dod) this.p0.second).a(null, null);
}
public final void z(Feed feed, OnlineResource onlineResource, FromStack fromStack) {
OnlineResource onlineResource2;
k2b k2bVar;
if (feed == null && onlineResource == null) {
l(true);
k(true);
return;
}
String uuid = UUID.randomUUID().toString();
this.K0 = uuid;
Intent intent = this.h;
if (intent != null) {
intent.putExtra("streamId", uuid);
}
b05 b05Var = this.G0;
if (b05Var != null && (k2bVar = this.g) != null) {
k2bVar.g();
this.g.e();
b05Var.a();
}
D(true);
this.h0 = feed;
e7d e7dVar = this.x0;
if (e7dVar != null) {
e7dVar.b = feed;
}
this.m0 = onlineResource;
Feed feed2 = this.h0;
this.j0 = new b3e(feed2 != null ? feed2.playInfoList() : null);
if (this.h0 != null && (onlineResource2 = this.m0) != null && (onlineResource2 instanceof TvSeason)) {
this.m0 = null;
}
this.u0 = fromStack;
o();
a.C0087a c0087a = new a.C0087a();
c0087a.a = this.h0;
OnlineResource onlineResource3 = this.m0;
if (onlineResource3 != null) {
if (onlineResource3 instanceof OttMusicPlayList) {
c0087a.b = (OttMusicPlayList) onlineResource3;
} else if (onlineResource3 instanceof Album) {
c0087a.b = (Album) onlineResource3;
} else if (onlineResource3 instanceof TvSeason) {
c0087a.b = (TvSeason) onlineResource3;
} else if (onlineResource3 instanceof TvShow) {
c0087a.b = (TvShow) onlineResource3;
}
}
c0087a.c = S0;
c0087a.d = this;
com.mxtech.videoplayer.ad.online.mxexo.service.a aVar = new com.mxtech.videoplayer.ad.online.mxexo.service.a(c0087a);
this.b0 = aVar;
aVar.c.load();
vf3 vf3Var = this.d;
if (vf3Var != null) {
vf3Var.c = null;
vf3Var.f.removeCallbacksAndMessages(null);
vf3Var.g.removeCallbacksAndMessages(null);
vf3Var.i = 2;
this.d = null;
}
w();
}
@NonNull
public final tai z6() {
String str = this.K0;
if (str != null) {
tj8 a1 = a1();
this.M0.getClass();
return rai.a(str, a1);
}
if (this.L0 == null) {
this.L0 = new tai(a1());
}
return this.L0;
}
@vgg(priority = 3, threadMode = ThreadMode.MAIN)
public void onEvent(dog dogVar) {
cog cogVar;
if (tj5.a.contains(this) && (cogVar = this.H0) != null && cogVar.h) {
if (dogVar != null) {
tj5.a(dogVar);
}
e7d e7dVar = this.x0;
if (e7dVar != null) {
e7dVar.c(this.o0);
}
p(true);
}
}
public static class d extends Handler implements bg.a {
public boolean b;
public final void a(boolean z) {
if (this.b) {
ExoPlayerService exoPlayerService = ExoPlayerService.Q0;
if (exoPlayerService == null || exoPlayerService.g != null || bg.f(ExoPlayerActivity.class) || bg.f(ExoLivePlayerActivity.class) || bg.f(ExoDownloadPlayerActivity.class)) {
return;
}
if (z) {
sendEmptyMessageDelayed(1, 1000L);
return;
} else {
ExoPlayerService.Q0.stopSelf();
this.b = false;
return;
}
}
if (bg.f(ExoPlayerActivity.class) || bg.f(ExoLivePlayerActivity.class) || bg.f(ExoDownloadPlayerActivity.class) || bg.f(SonyLivePlayerActivity.class)) {
try {
if (tya.m.startService(new Intent(tya.m, (Class<?>) ExoPlayerService.class)) == null) {
Log.e("MX.ExoPlayService", "Can't start the play service.");
} else {
this.b = true;
}
} catch (IllegalStateException | SecurityException e) {
Log.e("MX.ExoPlayService", "Can't start the play service.", e);
}
}
}
public final void b() {
removeMessages(1);
a(true);
}
@Override
public final void c(Activity activity, int i) {
Integer num;
if ((activity instanceof ExoPlayerActivity) || (activity instanceof ExoLivePlayerActivity) || (activity instanceof ExoDownloadPlayerActivity) || (activity instanceof SonyLivePlayerActivity)) {
ExoPlayerService exoPlayerService = ExoPlayerService.Q0;
if (exoPlayerService != null) {
exoPlayerService.m = true;
Handler handler = exoPlayerService.k;
if (handler != null) {
handler.removeMessages(4);
}
}
if (((sj8) activity).t1() && ((num = bg.a.get(activity)) == null || (num.intValue() & 1) == 0)) {
return;
}
b();
}
}
@Override
public final void handleMessage(Message message) {
ExoPlayerService exoPlayerService;
int i = message.what;
if (i == 1) {
a(false);
} else if (i == 3 && (exoPlayerService = ExoPlayerService.Q0) != null) {
exoPlayerService.getClass();
}
}
@Override
public final void h() {
}
}
@Override
public final void c(es2 es2Var) {
}
}