正在查看: MX Player v1.97.8 应用的 PlayService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: MX Player v1.97.8 应用的 PlayService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mxtech.videoplayer.service;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDoneException;
import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.SystemClock;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
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 androidx.annotation.NonNull;
import com.mxtech.app.Apps;
import com.mxtech.io.FileStat1;
import com.mxtech.io.Files;
import com.mxtech.media.FFPlayer;
import com.mxtech.media.MediaExtensions;
import com.mxtech.subtitle.SubStationAlphaMedia;
import com.mxtech.videoplayer.L;
import com.mxtech.videoplayer.ad.ActivityScreen;
import com.mxtech.videoplayer.ad.online.superdownloader.bean.MediaType;
import com.mxtech.videoplayer.m;
import com.mxtech.videoplayer.n;
import com.mxtech.videoplayer.subtitle.SubView;
import com.mxtech.videoplayer.subtitle.SubtitleOverlay;
import com.nimbusds.jose.crypto.PasswordBasedEncrypter;
import defpackage.aod;
import defpackage.b1g;
import defpackage.fke;
import defpackage.noc;
import defpackage.oab;
import defpackage.rxa;
import defpackage.s6d;
import defpackage.xnd;
import defpackage.ynd;
import defpackage.yxh;
import defpackage.zjb;
import defpackage.znd;
import in.juspay.hyper.constants.LogSubCategory;
import in.juspay.hypersdk.analytics.LogConstants;
import java.io.File;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@TargetApi(14)
public final class PlayService extends Service implements n.c, a, b1g.a, Handler.Callback, SurfaceHolder.Callback, mh8, SubView.a, m.c {
public static PlayService L0;
public static g M0;
public static FrameLayout N0;
public static int O0;
public ImageView A;
public Bitmap A0;
public View B;
public Bitmap B0;
public View C;
public int C0;
public LinearLayout D;
public byte D0;
public int E;
public int E0;
public WindowManager F;
public SurfaceView G;
public SurfaceHolder H;
public byte I;
public int J;
public ActivityScreen.f J0;
public int K;
public fke.c K0;
public int L;
public int M;
public float P;
public float Q;
public float R;
public float S;
public float T;
public float U;
public int V;
public int W;
public int X;
public int b0;
public int c;
public int c0;
public n d;
public float d0;
public float e0;
public com.mxtech.videoplayer.ActivityScreen f;
public Bundle g;
public boolean h;
public boolean i;
public boolean j;
public boolean j0;
public boolean k;
public SubView m0;
public int n;
public SoftReference<SubtitleOverlay> n0;
public int o;
public SubtitleOverlay o0;
public final IntentFilter p;
public MediaSessionCompat p0;
public boolean q;
public nqd q0;
public boolean r;
public int r0;
public Uri s;
public WindowManager.LayoutParams t;
public ynd t0;
public WindowManager.LayoutParams u;
public PendingIntent u0;
public TopLayoutService v;
public ImageView w;
public ImageView x;
public int x0;
public ImageView y;
public Notification y0;
public ImageView z;
public Intent z0;
public final d b = new d();
public int l = 0;
public Handler m = null;
public int N = 0;
public int O = 0;
public float Y = 0.0f;
public float Z = 0.0f;
public float a0 = 0.0f;
public boolean f0 = false;
public boolean g0 = true;
public boolean h0 = false;
public final Handler i0 = new Handler(this);
public Configuration k0 = null;
public int l0 = 0;
public final a s0 = new a();
public long v0 = 0;
public long w0 = 0;
public ImageView F0 = null;
public Bitmap G0 = null;
public final vlf H0 = new vlf(new b());
public final c I0 = new c();
public static class TopLayoutService extends RelativeLayout 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 (PlayService.L0 != null) {
post(this);
}
}
@Override
public final void run() {
PlayService playService = PlayService.L0;
if (playService != null) {
if (playService == null) {
playService.getClass();
return;
}
if (playService.G == null) {
return;
}
int width = playService.v.getWidth();
int height = playService.v.getHeight();
if (width <= 0 || height <= 0) {
return;
}
playService.G.requestLayout();
if (playService.o0 != null) {
playService.p();
}
}
}
public TopLayoutService(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public TopLayoutService(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
}
public class a extends BroadcastReceiver {
public a() {
}
@Override
public final void onReceive(Context context, Intent intent) {
PlayService playService = PlayService.this;
if (playService.d == null) {
return;
}
String action = intent.getAction();
Log.e("MX.PlayService", "onReceive action: " + action);
if ("android.media.AUDIO_BECOMING_NOISY".equals(action)) {
if (tya.o.b.getBoolean("pause_on_headset_disconnected", true)) {
playService.d.p0(0);
playService.q = true;
return;
}
return;
}
if ("android.intent.action.HEADSET_PLUG".equals(action)) {
playService.j = intent.getIntExtra("state", 0) == 1;
playService.L();
if (playService.j) {
playService.d.x0();
return;
}
return;
}
if (action.equals("android.intent.action.CLOSE_SYSTEM_DIALOGS")) {
String stringExtra = intent.getStringExtra("reason");
Log.e("MX.PlayService", "ACTION_CLOSE_SYSTEM_DIALOGS , reason : " + stringExtra);
if (stringExtra != null) {
if (!stringExtra.isEmpty() && stringExtra.equals("homekey") && playService.f0) {
if (Build.DEVICE.equals("flame") && Build.MODEL.equals("Pixel 4")) {
playService.i0.sendEmptyMessageDelayed(3, 300L);
} else {
playService.q(playService.d0, 0);
}
}
if (stringExtra.isEmpty()) {
return;
}
stringExtra.equals("recentapps");
return;
}
return;
}
if (action.equals("android.intent.action.SCREEN_OFF")) {
if (playService.f0) {
playService.d.p0(0);
}
} else {
if (action.equals("android.intent.action.SCREEN_ON")) {
return;
}
if (action.equals("android.intent.action.USER_PRESENT")) {
if (playService.f0) {
playService.d.O0();
}
} else if (action.equals("android.media.VOLUME_CHANGED_ACTION")) {
s6d.s1 = false;
s6d.t1 = -1;
}
}
}
}
public class b implements a {
public b() {
}
public final void a() {
PlayService playService = PlayService.this;
if (y4i.c(playService.getApplicationContext())) {
playService.q(playService.d0, playService.H0.c);
}
}
}
public class c implements View.OnClickListener {
public c() {
}
@Override
public final void onClick(View view) {
if (en2.a(400L)) {
return;
}
int id = view.getId();
boolean z = false;
PlayService playService = PlayService.this;
if (id == 2131362599) {
if (playService.z0 == null) {
return;
}
playService.h0 = false;
Handler handler = playService.i0;
handler.removeMessages(4);
handler.sendEmptyMessageDelayed(4, 2500L);
try {
PendingIntent pendingIntent = playService.u0;
if (pendingIntent != null) {
pendingIntent.send();
}
} catch (PendingIntent.CanceledException unused) {
}
if (playService.J0 != null) {
u63.b();
fke.b("local");
PlayService playService2 = PlayService.L0;
if (playService2 != null) {
playService2.K0 = null;
return;
}
return;
}
return;
}
if (id == 2131365922) {
if (playService.d == null) {
return;
}
playService.q = false;
int i = PlayService.O0;
if (i == 0) {
playService.H();
playService.d.p0(0);
return;
} else {
if (i == 1) {
playService.H();
playService.d.O0();
return;
}
return;
}
}
if (id == 2131362709) {
PlayService.a(playService);
return;
}
if (id != 2131365923) {
if (id != 2131365921 || playService.d == null) {
return;
}
if (!tya.o.b.getBoolean("custom_pip_control", true)) {
playService.u(10000);
return;
} else {
if (playService.d.k0() == null) {
z6h.c(playService.getApplicationContext(), 2131889300, true);
return;
}
return;
}
}
if (playService.d != null) {
if (!tya.o.b.getBoolean("custom_pip_control", true)) {
playService.u(-10000);
return;
}
if (playService.d.b() && s6d.I0 && playService.d.b0() && playService.d.L() >= 3000) {
z = true;
}
if (playService.d.s0(s6d.I0) != null || z) {
return;
}
z6h.c(playService.getApplicationContext(), 2131889304, true);
}
}
}
public class d extends Binder {
}
public static class e {
@NonNull
public final Intent a;
public final n b;
public final Bundle c;
public e(@NonNull Intent intent, n nVar, Bundle bundle) {
this.a = intent;
this.b = nVar;
this.c = bundle;
}
}
public interface f extends hl8 {
}
public PlayService() {
IntentFilter intentFilter = new IntentFilter();
this.p = intentFilter;
intentFilter.addAction("android.media.AUDIO_BECOMING_NOISY");
intentFilter.addAction("android.intent.action.HEADSET_PLUG");
intentFilter.addAction("android.intent.action.CLOSE_SYSTEM_DIALOGS");
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.SCREEN_ON");
intentFilter.addAction("android.intent.action.USER_PRESENT");
intentFilter.addAction("android.media.VOLUME_CHANGED_ACTION");
}
public static void a(PlayService playService) {
if (playService.d == null) {
return;
}
s6d.s1 = false;
s6d.t1 = -1;
playService.f();
playService.d.p0(0);
playService.e(true);
if (playService.J0 != null) {
u63.b();
fke.b("local");
PlayService playService2 = L0;
if (playService2 != null) {
playService2.K0 = null;
}
}
}
public static void y() {
PlayService playService = L0;
if (playService != null) {
playService.e(true);
}
}
public final void A() {
n nVar;
Bitmap copy;
if (!this.i || (nVar = this.d) == null || !nVar.b0()) {
ejb.a(this.p0, (Bitmap) null, true);
this.B0 = null;
return;
}
Bitmap A = this.d.A(this.c);
if (A != this.B0) {
this.B0 = A;
if (A != null) {
try {
Bitmap.Config config = A.getConfig();
if (config == null) {
config = Bitmap.Config.ARGB_8888;
}
copy = A.copy(config, true);
} catch (OutOfMemoryError e2) {
this.B0 = null;
Log.e("MX.PlayService", "", e2);
this.i = false;
ejb.a(this.p0, (Bitmap) null, true);
this.B0 = null;
return;
}
} else {
copy = null;
}
ejb.a(this.p0, copy, true);
}
}
public final void A2(Uri uri, byte b2, int i) {
o(uri, 0, b2, i);
}
public final void B3() {
this.x0 = 40;
}
public final void B4(LinkedList linkedList) {
D(268435462);
}
public final void C() {
if (s6d.k0 && this.d != null) {
if (this.k) {
return;
}
this.p0 = m.a().b(this, "MX.PlayService", 0);
this.k = true;
return;
}
if (this.k) {
m a2 = m.a();
a2.getClass();
m.c(this);
a2.d();
this.p0 = null;
this.k = false;
}
}
public final void D(int i) {
try {
n nVar = this.d;
if (nVar == null) {
if (this.h) {
stopForeground(true);
this.h = false;
} else if (Build.VERSION.SDK_INT >= 26) {
((NotificationManager) noc.a.getSystemService("notification")).cancel(12345);
} else {
noc.b.cancel(12345);
}
} else if (nVar.c0()) {
Notification c2 = c(i);
n nVar2 = this.d;
if (nVar2.f0) {
if (!this.h) {
if (Build.VERSION.SDK_INT < 31) {
startForeground(12345, this.y0);
} else {
za.d(this, this.y0);
}
this.h = true;
}
} else if (this.r && this.h) {
nVar2.y0();
stopForeground(false);
this.h = false;
}
if (Build.VERSION.SDK_INT >= 26) {
((NotificationManager) noc.a.getSystemService("notification")).notify(12345, c2);
} else {
noc.b.notify(12345, c2);
}
}
if ((i & 4) != 0) {
A();
}
} catch (RuntimeException e2) {
Log.e("MX.PlayService", "", e2);
}
}
public final void D3(com.mxtech.media.b bVar, int i) {
if (i == -1) {
com.mxtech.videoplayer.ActivityScreen.h7(this, bVar);
}
}
public final void E() {
if (this.z == null) {
return;
}
if (tya.o.b.getBoolean("custom_pip_control", true)) {
this.z.setImageResource(2131235030);
this.A.setImageResource(2131235028);
} else {
this.z.setImageResource(2131235031);
this.A.setImageResource(2131235026);
}
}
public final void E3(int i, int i2) {
if (i <= 0 || i2 <= 0) {
return;
}
float f2 = i;
float f3 = i2;
float f4 = f2 / f3;
if (!this.d.Z() && this.G != null) {
this.H.setFixedSize(i, i2);
this.G.requestLayout();
}
if (!this.j0) {
this.j0 = true;
r();
}
this.P = f2;
this.Q = f3;
q(f4, -1);
}
public final void F(int i) {
if (i == 5 && this.w0 == 0) {
this.w0 = SystemClock.elapsedRealtime();
return;
}
if (i == 4 && this.w0 != 0) {
this.v0 = (SystemClock.elapsedRealtime() - this.w0) + this.v0;
this.w0 = 0L;
} else {
if (i != 6 || this.w0 == 0) {
return;
}
this.v0 = (SystemClock.elapsedRealtime() - this.w0) + this.v0;
this.w0 = 0L;
}
}
public final void G(int i, int i2) {
LinearLayout linearLayout;
if (i2 <= 0 || i <= 0 || (linearLayout = this.D) == null) {
return;
}
ViewGroup.LayoutParams layoutParams = linearLayout.getLayoutParams();
if (layoutParams.width > i2) {
layoutParams.width = i2;
} else {
int i3 = this.E;
if (i2 > i3) {
i2 = i3;
}
layoutParams.width = i2;
}
this.D.setLayoutParams(layoutParams);
ImageView imageView = this.A;
if (imageView == null || this.z == null || this.x == null) {
return;
}
ViewGroup.LayoutParams layoutParams2 = imageView.getLayoutParams();
layoutParams2.width = layoutParams.width / 3;
this.A.setLayoutParams(layoutParams2);
this.z.setLayoutParams(layoutParams2);
this.x.setLayoutParams(layoutParams2);
}
public final void H() {
int i = O0;
if (i == 0) {
this.x.setImageDrawable(getResources().getDrawable(2131234880));
O0 = 1;
} else if (i == 1) {
this.x.setImageDrawable(getResources().getDrawable(2131234869));
O0 = 0;
}
}
public final void H5() {
n nVar = this.d;
if (nVar != null) {
boolean z = s6d.E;
nVar.V0(z ? s6d.F : 0, z);
}
}
public final void I() {
float f2 = this.R;
float f3 = this.S;
this.Y = (this.b0 * this.c0) / (f2 * f3);
WindowManager.LayoutParams layoutParams = this.t;
this.Z = ((f2 - layoutParams.x) - layoutParams.width) / f2;
this.a0 = ((f3 - layoutParams.y) - layoutParams.height) / f3;
try {
this.F.updateViewLayout(N0, layoutParams);
} catch (IllegalArgumentException unused) {
}
}
public final void I2() {
if (this.f0 && !this.d.X() && !this.d.d0()) {
g();
}
D(6);
}
public final void I3() {
if (this.d != null) {
w();
i();
this.d.k0();
}
}
public final void J() {
n nVar = this.d;
if (nVar != null) {
K(nVar.L);
} else {
K(0);
}
}
@Override
public final void J1(SubtitleOverlay subtitleOverlay) {
this.v.removeView(subtitleOverlay);
this.o0 = null;
}
public final void K(int i) {
if (this.p0 == null) {
return;
}
n nVar = this.d;
int i2 = 0;
long j = -1;
float f2 = 1.0f;
if (nVar != null) {
if (i > 3) {
j = nVar.L();
f2 = (float) this.d.R();
}
switch (i) {
case -1:
i2 = 7;
break;
case 1:
case 2:
case 3:
i2 = 6;
break;
case 4:
i2 = 2;
break;
case 5:
i2 = 3;
break;
case 6:
i2 = 10;
break;
}
}
MediaSessionCompat mediaSessionCompat = this.p0;
ArrayList arrayList = new ArrayList();
arrayList.add(new PlaybackStateCompat.CustomAction("close_action", rxa.CLOSE, 2131234591, (Bundle) null));
mediaSessionCompat.f(new PlaybackStateCompat(i2, j, 0L, f2, 823L, 0, (CharSequence) null, SystemClock.elapsedRealtime(), arrayList, -1L, (Bundle) null));
}
public final void K2(int i) {
D(0);
}
public final void L() {
n nVar = this.d;
if (nVar != null && nVar.I != null) {
int i = this.n;
if (i == 99) {
boolean z = this.j;
Display defaultDisplay = ((WindowManager) getSystemService("window")).getDefaultDisplay();
String str = com.mxtech.videoplayer.ActivityScreen.p4;
int i2 = 0;
if (!z && xk4.b(this, defaultDisplay) == 8) {
i2 = 2;
}
nVar.K0(i2);
if (this.t0 == null) {
ynd yndVar = new ynd(this, this);
this.t0 = yndVar;
yndVar.enable();
return;
}
return;
}
nVar.K0(i);
}
ynd yndVar2 = this.t0;
if (yndVar2 != null) {
yndVar2.disable();
}
}
public final boolean L0() {
return !this.q;
}
public final void N2() {
SubView subView = this.m0;
if (subView != null) {
subView.c();
}
}
public final void O1(KeyEvent keyEvent) {
if (this.d == null) {
return;
}
int action = keyEvent.getAction();
int keyCode = keyEvent.getKeyCode();
int repeatCount = keyEvent.getRepeatCount();
if (s6d.l0) {
if (keyCode == 87) {
keyCode = 90;
} else if (keyCode == 88) {
keyCode = 89;
}
}
if (action == 0) {
if (keyCode == 89) {
u(-this.o);
return;
} else {
if (keyCode != 90) {
return;
}
u(this.o);
return;
}
}
if (action == 1 && repeatCount == 0) {
if (keyCode != 79) {
if (keyCode != 126) {
if (keyCode == 127) {
this.d.p0(0);
return;
}
switch (keyCode) {
case 85:
this.d.Q0(false);
break;
case 86:
e(false);
break;
case 87:
this.d.k0();
break;
case 88:
this.d.t0();
break;
}
return;
}
if (!s6d.m0) {
this.d.O0();
return;
}
}
if (!s6d.n0 || keyEvent.getRepeatCount() > 0) {
this.d.Q0(false);
return;
}
this.l++;
if (this.m == null) {
this.m = new Handler(new xnd(this));
}
if (this.m.hasMessages(500)) {
return;
}
this.m.sendEmptyMessageDelayed(500, 500L);
}
}
@Override
public final void P1(am8 am8Var) {
FFPlayer N = this.d.N();
if (N != null) {
N.V(am8Var);
}
}
public final void P4(int i, int i2, int i3) {
if (this.d == null) {
return;
}
F(i);
J();
if (i == -1) {
nqd nqdVar = this.q0;
if (!nqdVar.a) {
nqdVar.s = "notificationbar";
nqdVar.b(this.d, true);
this.q0.c(this.m0, this.d.X(), false);
}
if (this.f0) {
r();
}
if (this.d.N0()) {
return;
}
e(true);
return;
}
if (i == 1) {
if (this.f0) {
r();
return;
}
return;
}
if (i != 3) {
if (i == 4) {
D(0);
if (this.f0) {
O0 = 0;
H();
return;
}
return;
}
if (i != 5) {
if (i != 6) {
return;
}
this.d.y0();
M0.sendEmptyMessageDelayed(2, 10L);
return;
}
n nVar = this.d;
Uri uri = nVar.o;
if (uri != this.s) {
this.s = uri;
nVar.y0();
}
D(0);
if (this.f0) {
O0 = 1;
H();
}
nqd nqdVar2 = this.q0;
if (nqdVar2.a) {
return;
}
nqdVar2.s = "notificationbar";
nqdVar2.b(this.d, false);
this.q0.c(this.m0, this.d.X(), false);
return;
}
if (!this.f0 && !m()) {
if (this.d.N0()) {
return;
}
e(true);
return;
}
if (this.f0) {
n nVar2 = this.d;
wfc wfcVar = nVar2.m;
boolean X = nVar2.X();
this.j0 = X;
if (!X) {
this.d.C0((SurfaceHolder) null, (Display) null, 2);
SurfaceView surfaceView = this.G;
if (surfaceView != null) {
this.v.removeView(surfaceView);
this.G = null;
}
SurfaceHolder surfaceHolder = this.H;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(this);
this.H = null;
}
k();
if (!this.d.d0()) {
g();
}
}
SubView subView = this.m0;
if (subView != null) {
subView.setSSARenderingMode(s6d.q0 && this.d.F == 2, this.d);
if (wfcVar == null || wfcVar.l == null) {
n nVar3 = this.d;
if (!nVar3.W) {
nVar3.W = true;
boolean z = !nVar3.X() && this.d.P == null;
Intent intent = this.z0;
Uri[] d2 = Apps.d(intent, "subs");
if (d2 != null) {
String[] stringArrayExtra = intent.getStringArrayExtra("subs.name");
String[] stringArrayExtra2 = intent.getStringArrayExtra("subs.filename");
this.d.j0(d2, (stringArrayExtra == null || stringArrayExtra.length == d2.length) ? stringArrayExtra : null, (stringArrayExtra2 == null || stringArrayExtra2.length == d2.length) ? stringArrayExtra2 : null, z, (Map) null);
} else {
n nVar4 = this.d;
if (nVar4.Z != null) {
nVar4.e0(z);
} else {
HashMap hashMap = com.mxtech.videoplayer.ActivityScreen.s4;
List list = hashMap != null ? (List) hashMap.get(nVar4.o) : null;
if (list == null || list.isEmpty()) {
this.d.e0(z);
} else {
Uri[] uriArr = (Uri[]) list.toArray(new Uri[0]);
HashMap hashMap2 = com.mxtech.videoplayer.ActivityScreen.t4;
this.d.j0(uriArr, (String[]) null, (String[]) null, false, hashMap2 != null ? (Map) hashMap2.get(this.d.o) : null);
}
}
}
}
}
this.m0.c();
zjb zjbVar = this.d.Z;
if (zjbVar != null) {
this.m0.setTranslation(zjbVar.h, zjbVar.i);
this.d.G0(zjbVar.r, zjbVar.s);
} else {
this.m0.setSync((int) (tya.o.b.getFloat("subtitle_default_sync", 0.0f) * 1000.0f));
this.d.G0(-1, -1);
}
L();
xwh xwhVar = this.d.R;
if (xwhVar.b.size() > 0) {
b(xwhVar, zjbVar, Apps.d(this.z0, "subs.enable"), s6d.p ? 3 : 0);
}
}
}
com.mxtech.videoplayer.a.o7();
D(6);
L();
n nVar5 = this.d;
if (nVar5.F == 1) {
com.mxtech.videoplayer.ActivityScreen.h7(this, nVar5.I);
}
}
public final void Q7(b3d b3dVar, String str) {
com.mxtech.media.b bVar;
if (str == null) {
}
switch (str) {
case "navi_move_interval":
this.o = tya.o.b.getInt("navi_move_interval", 10) * PasswordBasedEncrypter.MIN_RECOMMENDED_ITERATION_COUNT;
break;
case "media_buttons":
C();
break;
case "stereo_mode":
this.n = tya.o.b.getInt("stereo_mode", 0);
L();
break;
case "album_art":
this.i = tya.o.b.getBoolean("album_art", true);
A();
break;
case "custom_pip_control":
E();
break;
case "omxdecoder.alt":
n nVar = this.d;
boolean z = (nVar == null || (bVar = nVar.I) == null) ? false : bVar.s() instanceof FFPlayer;
if ((L.getAvailableHWDecoders() & (~L.getPreferredHWDecoder())) != 0 && z) {
e(false);
break;
}
break;
}
}
public final void R3(int i) {
D(0);
}
public final void S() {
n nVar = this.d;
if (nVar != null) {
nVar.p0(0);
}
}
public final boolean U1() {
return false;
}
@Override
public final void W0(int i, int i2) {
n nVar = this.d;
nVar.U = i;
nVar.V = i2;
SubStationAlphaMedia subStationAlphaMedia = nVar.T;
if (subStationAlphaMedia != null) {
subStationAlphaMedia.setCanvasSize(i, i2);
}
}
public final Object Y2() {
return null;
}
public final void Z0() {
n nVar = this.d;
if (nVar != null) {
nVar.O0();
}
}
@Override
public final boolean Z2(am8 am8Var) {
FFPlayer N = this.d.N();
if (N != null) {
return N.K(am8Var);
}
return false;
}
public final void a3(boolean z, byte b2, byte b3) {
if (!this.f0) {
n nVar = this.d;
if (nVar != null) {
this.D0 = b3;
this.E0 |= 128;
nVar.q0((SurfaceHolder) null, (Display) null, 0);
return;
}
return;
}
this.D0 = b3;
if (!z) {
o(null, 3, b3, 128);
return;
}
this.E0 |= 128;
Log.i("MX.PlayService", "Trying next decoder: " + ((int) b2) + " -> " + ((int) b3));
if (this.d.L == 1) {
o(null, this.C0, this.D0, this.E0);
}
}
public final void b(java.util.List<am8> r9, defpackage.zjb r10, android.net.Uri[] r11, int r12) {
throw new UnsupportedOperationException("Method not decompiled: com.mxtech.videoplayer.service.PlayService.b(java.util.List, zjb, android.net.Uri[], int):void");
}
public final void b2() {
if (this.d != null) {
w();
i();
this.d.t0();
}
}
@SuppressLint({"InlinedApi", "NewApi"})
public final Notification c(int i) {
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 26) {
noc.a(noc.a);
}
znc zncVar = new znc(noc.a, LogConstants.DEFAULT_CHANNEL);
Notification notification = zncVar.O;
zncVar.g(4);
notification.vibrate = new long[]{0};
zncVar.k((Uri) null);
zncVar.A = "transport";
zncVar.D = 1;
zncVar.l = -1;
notification.icon = 2131234842;
zncVar.C = qm3.getColor(getApplicationContext(), 2131103702);
zncVar.m = true;
notification.deleteIntent = PendingIntent.getService(this, 0, new Intent(null, Uri.fromParts("cmd", rxa.CLOSE, null), this, PlayService.class), i2 >= 31 ? 67108864 : 0);
int i3 = i2 < 31 ? 0 : 67108864;
PendingIntent service = PendingIntent.getService(this, 0, new Intent(null, Uri.fromParts("cmd", "prev", null), this, PlayService.class), i3);
PendingIntent service2 = PendingIntent.getService(this, 0, new Intent(null, Uri.fromParts("cmd", "next", null), this, PlayService.class), i3);
PendingIntent service3 = PendingIntent.getService(this, 0, new Intent(null, Uri.fromParts("cmd", "playpause", null), this, PlayService.class), i3);
PendingIntent service4 = PendingIntent.getService(this, 0, new Intent(null, Uri.fromParts("cmd", "close_action", null), this, PlayService.class), i3);
qnc qncVar = new qnc(2131234595, "Previous", service);
qnc qncVar2 = new qnc(this.d.f0 ? 2131234592 : 2131234593, "playPause", service3);
qnc qncVar3 = new qnc(2131234594, "Next", service2);
qnc qncVar4 = new qnc(2131234591, "Close", service4);
zncVar.a(qncVar);
zncVar.a(qncVar2);
zncVar.a(qncVar3);
zncVar.a(qncVar4);
MediaSessionCompat mediaSessionCompat = this.p0;
if (mediaSessionCompat != null) {
Bundle bundle = new Bundle();
long j = this.d.w;
eo0 eo0Var = MediaMetadataCompat.f;
if (eo0Var.containsKey("android.media.metadata.DURATION") && ((Integer) eo0Var.get("android.media.metadata.DURATION")).intValue() != 0) {
throw new IllegalArgumentException("The android.media.metadata.DURATION key cannot be used to put a long");
}
bundle.putLong("android.media.metadata.DURATION", j);
mediaSessionCompat.e(new MediaMetadataCompat(bundle));
foc focVar = new foc();
focVar.e = new int[]{0, 1, 2};
focVar.f = ((MediaSessionCompat.c) this.p0.a).b;
zncVar.l(focVar);
} else {
foc focVar2 = new foc();
focVar2.e = new int[]{0, 1, 2};
zncVar.l(focVar2);
}
String stringExtra = this.z0.getStringExtra("title");
if (stringExtra == null) {
stringExtra = sgj.h(this.d.o, L.w);
}
zncVar.f(stringExtra);
zncVar.g = PendingIntent.getActivity(this, 0, this.z0, i3);
if ((i & 1) != 0) {
this.A0 = null;
v(zncVar, (i & 268435456) == 0);
} else if ((2 & i) != 0) {
this.A0 = null;
v(zncVar, (i & 268435456) == 0);
} else {
z(zncVar);
}
this.x0 = 0;
Notification b2 = zncVar.b();
this.y0 = b2;
return b2;
}
public final int c1() {
return this.c;
}
public final void d() {
int dimensionPixelSize = getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", LogSubCategory.LifeCycle.ANDROID));
Configuration configuration = this.k0;
if (configuration != null) {
Handler handler = this.i0;
if (handler != null) {
handler.removeMessages(6);
}
} else {
configuration = getResources().getConfiguration();
}
int i = configuration.orientation;
if (i == 2) {
float f2 = this.T;
float f3 = this.U;
this.R = f2 < f3 ? f3 : f2;
if (f2 >= f3) {
f2 = f3;
}
this.S = f2;
} else if (i == 1) {
float f4 = this.T;
float f5 = this.U;
this.R = f4 < f5 ? f4 : f5;
if (f4 < f5) {
f4 = f5;
}
this.S = f4;
} else {
int i2 = configuration.hardKeyboardHidden;
if (i2 == 1) {
float f6 = this.T;
float f7 = this.U;
this.R = f6 < f7 ? f7 : f6;
if (f6 >= f7) {
f6 = f7;
}
this.S = f6;
} else if (i2 == 2) {
float f8 = this.T;
float f9 = this.U;
this.R = f8 < f9 ? f8 : f9;
if (f8 < f9) {
f8 = f9;
}
this.S = f8;
}
}
float f10 = this.S - dimensionPixelSize;
this.S = f10;
float f11 = this.R;
this.V = ((int) f11) / 3;
this.W = ((int) f10) / 3;
this.e0 = f11 / f10;
}
public final void d2(int i) {
SubView subView;
if ((i == 0 || i == 2) && (subView = this.m0) != null) {
subView.setSSARenderingMode(false, this.d);
}
}
public final void e(boolean r5) {
throw new UnsupportedOperationException("Method not decompiled: com.mxtech.videoplayer.service.PlayService.e(boolean):void");
}
public final void f() {
if (this.f0) {
Handler handler = this.i0;
if (handler.hasMessages(1)) {
handler.removeMessages(1);
}
r();
n nVar = this.d;
if (nVar != null) {
nVar.C0((SurfaceHolder) null, (Display) null, 2);
}
SurfaceView surfaceView = this.G;
if (surfaceView != null) {
this.v.removeView(surfaceView);
this.G = null;
}
SubView subView = this.m0;
if (subView != null) {
subView.d();
this.m0 = null;
this.o0 = null;
}
SurfaceHolder surfaceHolder = this.H;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(this);
this.H = null;
}
try {
this.F.removeView(N0);
} catch (IllegalArgumentException unused) {
}
vlf vlfVar = this.H0;
ulf ulfVar = vlfVar.d;
if (ulfVar != null) {
ulfVar.disable();
vlfVar.d = null;
}
this.f0 = false;
}
}
@SuppressLint({"NewApi"})
public final void g() {
Bitmap bitmap;
try {
n nVar = this.d;
boolean z = false;
if (nVar.P != null) {
bitmap = nVar.A(this.c);
} else if (!nVar.b0()) {
bitmap = null;
} else if (this.d.g0() != null) {
bitmap = this.d.A(this.c);
} else {
bitmap = BitmapFactory.decodeResource(getResources(), 2131234072);
z = true;
}
if (!z) {
this.G0 = null;
if (this.F0 == null) {
this.F0 = new ImageView(this);
this.v.addView(this.F0, new RelativeLayout.LayoutParams(-1, -1));
this.F0.setScaleType(ImageView.ScaleType.FIT_CENTER);
}
if (this.G0 != bitmap) {
this.F0.setImageBitmap(bitmap);
this.G0 = bitmap;
return;
}
return;
}
this.G0 = null;
if (this.F0 == null) {
this.F0 = new ImageView(this);
int i = (int) (getResources().getDisplayMetrics().density * 48.0f);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i, i);
layoutParams.addRule(13);
this.F0.setScaleType(ImageView.ScaleType.FIT_CENTER);
if (this.G0 != bitmap) {
this.F0.setImageBitmap(bitmap);
this.G0 = bitmap;
}
this.v.addView(this.F0, 1, layoutParams);
}
} catch (OutOfMemoryError e2) {
Log.e("MX.PlayService", "", e2);
}
}
@Override
public final Display getDisplay() {
WindowManager windowManager = this.F;
return windowManager != null ? windowManager.getDefaultDisplay() : super.getDisplay();
}
public final int getHeight() {
return this.v.getHeight();
}
@NonNull
public final n getPlayer() {
return this.d;
}
@Override
public final SharedPreferences getSharedPreferences(String str, int i) {
return tya.m.getSharedPreferences(str, i);
}
public final int getWidth() {
return this.v.getWidth();
}
public final void h() {
this.A.setVisibility(4);
this.z.setVisibility(4);
this.w.setVisibility(4);
this.x.setVisibility(4);
this.y.setVisibility(4);
this.C.setVisibility(4);
this.B.setVisibility(4);
I();
this.g0 = false;
}
@Override
public final boolean handleMessage(Message message) {
Handler handler;
int i = message.what;
if (i == 1 && this.f0) {
h();
return true;
}
if (i == 2) {
if (this.H != null) {
if (this.d.a0()) {
try {
this.d.C0(this.H, this.F.getDefaultDisplay(), 0);
if (this.d.isPlaying()) {
O0 = 1;
H();
this.d.O0();
} else {
O0 = 0;
H();
}
} catch (IllegalArgumentException e2) {
Log.e("MX.PlayService", "", e2);
}
this.I = this.d.F;
} else if (this.d.c0()) {
o(null, this.C0, this.D0, this.E0);
}
}
return true;
}
if (i == 3) {
q(this.d0, 0);
} else if (i == 4) {
if (!this.h0) {
z6h.c(getApplicationContext(), 2131889159, true);
}
} else if (i == 5) {
q(message.getData().getFloat("videoRatio"), -1);
} else if (i == 6) {
q(this.d0, -1);
int i2 = this.l0 + 1;
this.l0 = i2;
if (i2 < 5 && (handler = this.i0) != null) {
handler.sendEmptyMessageDelayed(6, 500L);
}
}
return false;
}
public final void i() {
nqd nqdVar = new nqd();
this.q0 = nqdVar;
nqdVar.h = true;
nqdVar.i = true;
}
public final boolean isFinishing() {
return this.f0;
}
public final void j(int i) {
SubView subView;
if (this.d == null) {
return;
}
int i2 = this.x0 + 1;
this.x0 = i2;
if (i2 > 40) {
D(0);
}
if (this.f0 && (subView = this.m0) != null && subView.c == 0) {
subView.f((int) ((i - subView.m) * subView.n), 0, false, true);
}
if (this.K0 != null) {
fke.a += 100;
}
}
public final void k() {
if (this.G == null && this.H == null) {
SurfaceView surfaceView = new SurfaceView(this);
this.G = surfaceView;
SurfaceHolder holder = surfaceView.getHolder();
this.H = holder;
holder.addCallback(this);
this.H.setFormat(s6d.h());
this.H.setType(this.d.F == 2 ? 0 : 3);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.addRule(13, 2131366632);
this.v.addView(this.G, 0, layoutParams);
}
}
public final void l(int i) {
SubView subView;
if (this.f0 && (subView = this.m0) != null && subView.c == 0) {
subView.f((int) ((i - subView.m) * subView.n), 0, false, true);
}
}
public final void l5() {
Log.d("MX.PlayService", "onVideoDeviceChanged");
}
public final boolean m() {
throw new UnsupportedOperationException("Method not decompiled: com.mxtech.videoplayer.service.PlayService.m():boolean");
}
public final void n() {
SubView subView = this.m0;
if (subView != null) {
subView.l();
}
}
public final void n3(long j) {
n nVar = this.d;
if (nVar == null || !nVar.b0() || j > 2147483647L) {
return;
}
n nVar2 = this.d;
nVar2.z0((int) j, nVar2.O());
J();
}
public final void o(Uri uri, int i, byte b2, int i2) {
byte b3;
String n;
Log.d("MX.PlayService", "Load Next");
com.mxtech.videoplayer.ActivityScreen.L6(this.z0, uri);
if (b2 == 0) {
b2 = this.z0.getByteExtra("decode_mode", (byte) 0);
}
if (b2 == 0 && !s6d.U() && (n = Files.n(uri.toString())) != null) {
MediaExtensions q = MediaExtensions.q();
try {
byte s = q.s(n);
if (s == 0) {
s = 2;
}
q.close();
b2 = s;
} catch (Throwable th) {
q.close();
throw th;
}
}
int i3 = this.d.L;
this.C0 = i;
this.D0 = b2;
this.E0 = i2;
if (i3 == 0) {
int i4 = s6d.X ? 2 : s6d.K1;
int i5 = (i4 != 2 || s6d.Y) ? 256 : 0;
HashMap hashMap = com.mxtech.videoplayer.ActivityScreen.t4;
this.d.B0(uri, b2, i5, hashMap != null ? (Map) hashMap.get(uri) : null);
zjb zjbVar = this.d.Z;
if (zjbVar != null) {
if (zjbVar.a <= 0) {
zjbVar.a();
} else if (i4 == 1 || i4 == 2) {
zjbVar.a();
}
}
} else if (i3 != 1) {
o9.e(i3, "Invalid state while loading: ", "MX.PlayService");
return;
}
boolean z = this.f0;
if (z) {
n nVar = this.d;
byte b4 = nVar.F;
if (this.G != null && ((b3 = this.I) == 1 ? b4 != 1 : b3 == 2 ? b4 != 2 : !(b3 != 4 || b4 == 1 || b4 == 4))) {
nVar.C0((SurfaceHolder) null, (Display) null, 2);
SurfaceView surfaceView = this.G;
if (surfaceView != null) {
this.v.removeView(surfaceView);
this.G = null;
}
SurfaceHolder surfaceHolder = this.H;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(this);
this.H = null;
}
k();
return;
}
if (this.H == null) {
return;
}
}
n nVar2 = this.d;
if (nVar2.Z != null) {
this.E0 &= -129;
}
this.I = nVar2.F;
if (z) {
nVar2.q0(this.H, this.F.getDefaultDisplay(), this.E0);
} else {
nVar2.q0((SurfaceHolder) null, (Display) null, 0);
}
n nVar3 = this.d;
if (nVar3 != null) {
nVar3.O0();
D(1);
}
}
@Override
public final boolean o2(boolean z) {
n nVar;
if (z && (nVar = this.d) != null && nVar.b0()) {
return false;
}
n nVar2 = this.d;
if (nVar2 == null) {
return true;
}
nVar2.p0(0);
if (!this.d.c0()) {
return true;
}
c(0);
return true;
}
public final Uri o3() {
return this.d.Q;
}
@Override
public final SubtitleOverlay o4() {
int i;
int i2;
SubtitleOverlay subtitleOverlay = this.o0;
if (subtitleOverlay != null) {
return subtitleOverlay;
}
SoftReference<SubtitleOverlay> softReference = this.n0;
if (softReference != null) {
this.o0 = softReference.get();
}
if (this.o0 == null) {
this.o0 = new SubtitleOverlay(this);
this.n0 = new SoftReference<>(this.o0);
}
this.o0.setFrameScale(s6d.x);
n nVar = this.d;
if (nVar.I != null) {
if (nVar.X()) {
i = this.d.Q();
i2 = this.d.P();
} else {
i = -1;
i2 = -1;
}
this.o0.setVideoSize(i, i2);
}
this.v.addView(this.o0);
if (this.v != null) {
p();
}
return this.o0;
}
@Override
public final IBinder onBind(Intent intent) {
Log.v("MX.PlayService", "Bind");
return this.b;
}
@Override
public final void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
int i = this.c;
int i2 = configuration.orientation;
if (i != i2) {
this.c = i2;
if (this.d == null) {
return;
}
if (this.f0) {
this.k0 = null;
q(this.d0, -1);
Handler handler = this.i0;
if (handler != null) {
handler.removeMessages(6);
}
}
D(4);
}
}
@Override
public final void onCreate() {
Log.v("MX.PlayService", "onCreate");
L0 = this;
tya.m.y((Activity) null);
Context applicationContext = getApplicationContext();
noc.a = applicationContext;
if (Build.VERSION.SDK_INT >= 26) {
noc.a(applicationContext);
}
noc.b = (NotificationManager) applicationContext.getSystemService("notification");
i();
this.o = tya.o.b.getInt("navi_move_interval", 10) * PasswordBasedEncrypter.MIN_RECOMMENDED_ITERATION_COUNT;
this.i = tya.o.b.getBoolean("album_art", true);
this.c = getResources().getConfiguration().orientation;
this.n = tya.o.b.getInt("stereo_mode", 0);
tya.o.d(this);
M0.b();
super.onCreate();
}
@Override
public final void onDestroy() {
Log.v("MX.PlayService", "onDestroy");
tya.o.e(this);
if (Build.VERSION.SDK_INT < 31) {
e(false);
} else {
int i = this.r0;
if (i >= 1) {
this.r0 = i - 1;
try {
unregisterReceiver(this.s0);
} catch (IllegalArgumentException e2) {
Log.e("MX.PlayService", "", e2);
}
}
}
L0 = null;
g gVar = M0;
gVar.b = false;
gVar.removeCallbacksAndMessages(null);
Handler handler = this.m;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
if (com.mxtech.videoplayer.f.A) {
com.mxtech.videoplayer.f.V((Intent) null);
}
super.onDestroy();
}
@Override
public final int onStartCommand(Intent intent, int i, int i2) {
Uri data;
if (this.d == null || intent == null || (data = intent.getData()) == null || !"cmd".equals(data.getScheme())) {
return 2;
}
String schemeSpecificPart = data.getSchemeSpecificPart();
if (rxa.CLOSE.equals(schemeSpecificPart) || "close_action".equals(schemeSpecificPart)) {
this.d.p0(0);
e(false);
weh.l(MediaType.videoType);
return 2;
}
if ("playpause".equals(schemeSpecificPart)) {
n nVar = this.d;
this.r = nVar.f0;
this.q = false;
nVar.Q0(false);
return 2;
}
if ("next".equals(schemeSpecificPart)) {
w();
i();
this.d.k0();
return 2;
}
if (!"prev".equals(schemeSpecificPart)) {
return 2;
}
w();
i();
this.d.t0();
return 2;
}
@Override
public final boolean onUnbind(Intent intent) {
Log.v("MX.PlayService", "Unbind");
return super.onUnbind(intent);
}
public final void p() {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.v.getLayoutParams();
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.o0.getLayoutParams();
layoutParams2.leftMargin = layoutParams.leftMargin;
layoutParams2.topMargin = layoutParams.topMargin;
layoutParams2.rightMargin = layoutParams.rightMargin;
layoutParams2.bottomMargin = layoutParams.bottomMargin;
layoutParams2.width = this.v.getWidth();
layoutParams2.height = this.v.getHeight();
this.o0.requestLayout();
}
public final void p4(am8 am8Var) {
SubView subView = this.m0;
if (subView != null) {
subView.m(am8Var);
}
}
public final void q(float f2, int i) {
if (!this.f0 || this.t == null) {
return;
}
if (Math.abs(f2 - this.d0) > 0.001d) {
int i2 = this.t.width;
this.b0 = i2;
int i3 = (int) (i2 / f2);
this.c0 = i3;
float f3 = i3;
float f4 = this.S;
if (f3 >= f4) {
f3 = f4;
}
int i4 = (int) f3;
this.c0 = i4;
this.b0 = (int) (i4 * f2);
d();
if (f2 <= this.e0) {
int i5 = this.c0;
float f5 = i5;
float f6 = this.S;
if (f5 >= f6) {
i5 = (int) f6;
}
this.c0 = i5;
int i6 = this.W;
if (i5 < i6) {
i5 = i6;
}
this.c0 = i5;
this.b0 = (int) (i5 * f2);
} else {
int i7 = this.b0;
float f7 = i7;
float f8 = this.R;
if (f7 >= f8) {
i7 = (int) f8;
}
this.b0 = i7;
int i8 = this.V;
if (i7 < i8) {
i7 = i8;
}
this.b0 = i7;
this.c0 = (int) (i7 / f2);
}
float f9 = this.R * this.S;
float f10 = this.b0 * this.c0;
if (f9 != 0.0f && f10 <= f9) {
float f11 = this.Y;
if (f11 == 0.0f || f11 > 1.0d) {
this.Y = f10 / f9;
} else {
float f12 = f10 / f9;
if (Math.abs(f12 - f11) > 0.05d) {
float sqrt = (float) Math.sqrt(this.Y / f12);
int i9 = (int) (this.b0 * sqrt);
this.b0 = i9;
int i10 = (int) (sqrt * this.c0);
this.c0 = i10;
if (f2 <= this.e0) {
float f13 = i10;
float f14 = this.S;
if (f13 >= f14) {
i10 = (int) f14;
}
this.c0 = i10;
int i11 = this.W;
if (i10 < i11) {
i10 = i11;
}
this.c0 = i10;
this.b0 = (int) (i10 * f2);
} else {
float f15 = i9;
float f16 = this.R;
if (f15 >= f16) {
i9 = (int) f16;
}
this.b0 = i9;
int i12 = this.V;
if (i9 < i12) {
i9 = i12;
}
this.b0 = i9;
int i13 = (int) (i9 / f2);
this.c0 = i13;
int i14 = this.X;
if (i13 < i14) {
i13 = i14;
}
this.c0 = i13;
this.b0 = (int) (i13 * f2);
}
this.Y = (this.b0 * this.c0) / f9;
} else {
this.Y = f12;
}
}
}
G(this.t.width, this.b0);
WindowManager.LayoutParams layoutParams = this.t;
int i15 = this.b0;
layoutParams.width = i15;
int i16 = this.c0;
layoutParams.height = i16;
float f17 = this.R;
int i17 = (int) ((f17 - i15) - (this.Z * f17));
layoutParams.x = i17;
float f18 = this.S;
int i18 = (int) ((f18 - i16) - (this.a0 * 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;
I();
}
this.d0 = f2;
if (i == -1) {
d();
t();
return;
}
a.c(this);
int dimensionPixelSize = getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", LogSubCategory.LifeCycle.ANDROID));
if (i == 0) {
float f19 = this.T;
float f20 = this.U;
this.R = f19 < f20 ? f19 : f20;
if (f19 < f20) {
f19 = f20;
}
this.S = f19;
} else if (i == 1 || i == 3) {
float f21 = this.T;
float f22 = this.U;
this.R = f21 < f22 ? f22 : f21;
if (f21 >= f22) {
f21 = f22;
}
this.S = f21;
}
float f23 = this.S - dimensionPixelSize;
this.S = f23;
float f24 = this.R;
this.V = ((int) f24) / 3;
this.W = ((int) f23) / 3;
this.e0 = f24 / f23;
t();
Handler handler = this.i0;
if (handler == null) {
return;
}
handler.removeMessages(6);
}
public final void q0(String str) {
n nVar;
if (!str.equals("close_action") || (nVar = this.d) == null) {
return;
}
nVar.p0(0);
e(false);
weh.l(MediaType.videoType);
}
public final void r() {
ImageView imageView = this.F0;
if (imageView != null) {
this.v.removeView(imageView);
this.F0 = null;
}
this.G0 = null;
}
public final void r3(int i) {
o(null, 1, (byte) 0, i);
}
@Override
public final int r5() {
return this.d.L == 5 ? 50 : 0;
}
public final e s(f fVar) {
if (this.d == null || this.z0 == null) {
return null;
}
Log.d("MX.PlayService", "Return " + this.d + " to " + fVar + " original screen " + this.f + ".");
w();
f();
this.d.y0();
Intent intent = this.z0;
n nVar = this.d;
e eVar = new e(intent, nVar, this.g);
nVar.c();
com.mxtech.videoplayer.ActivityScreen activityScreen = this.f;
this.d = null;
this.f = null;
this.g = null;
this.z0 = null;
this.y0 = null;
ynd yndVar = this.t0;
if (yndVar != null) {
yndVar.disable();
this.t0 = null;
}
C();
D(4);
if (activityScreen != null && activityScreen != fVar) {
Log.d("MX.PlayService", "Finish previous screen " + activityScreen);
activityScreen.finish();
}
int i = this.r0;
if (i >= 1) {
this.r0 = i - 1;
try {
unregisterReceiver(this.s0);
} catch (IllegalArgumentException e2) {
Log.e("MX.PlayService", "", e2);
}
}
M0.b();
return eVar;
}
public final void s1(am8 am8Var) {
if (this.d.b0()) {
ArrayList arrayList = new ArrayList(1);
arrayList.add(am8Var);
b(arrayList, this.d.Z, Apps.d(this.z0, "subs.enable"), s6d.p ? 3 : 0);
}
}
@Override
public final void s4(long j) {
n nVar = this.d;
if (nVar == null || !nVar.c0()) {
return;
}
c(0);
}
@Override
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
FFPlayer u;
Log.d("MX.PlayService", "===surfaceChanged, width x height : " + i2 + " x " + i3);
com.mxtech.media.b bVar = this.d.I;
if (bVar == null || (u = bVar.u()) == null) {
return;
}
u.setSurfaceViewSize(i2, i3);
}
@Override
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
Log.d("MX.PlayService", "=== Enter surfaceCreated. holder=" + surfaceHolder + " _surfaceHolderCreated=" + this.H + "_surfaceView=" + this.G);
this.H = surfaceHolder;
this.i0.sendEmptyMessage(2);
Log.d("MX.PlayService", "=== Leave surfaceCreated.");
}
@Override
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
Log.d("MX.PlayService", "=== Enter surfaceDestroyed. holder=" + surfaceHolder + " _surfaceHolderCreated=" + this.H + "_surfaceView=" + this.G);
this.d.C0((SurfaceHolder) null, (Display) null, 2);
this.H = null;
this.I = (byte) 0;
Log.d("MX.PlayService", "=== Leave surfaceDestroyed.");
}
public final void t() {
float f2 = this.d0;
if (f2 <= this.e0) {
int i = this.t.height;
float f3 = i;
float f4 = this.S;
if (f3 >= f4) {
i = (int) f4;
}
this.c0 = i;
int i2 = this.W;
if (i < i2) {
i = i2;
}
this.c0 = i;
this.b0 = (int) (i * f2);
} else {
int i3 = this.t.width;
float f5 = i3;
float f6 = this.R;
if (f5 >= f6) {
i3 = (int) f6;
}
this.b0 = i3;
int i4 = this.V;
if (i3 < i4) {
i3 = i4;
}
this.b0 = i3;
this.c0 = (int) (i3 / f2);
}
G(this.t.width, this.b0);
WindowManager.LayoutParams layoutParams = this.t;
int i5 = this.b0;
layoutParams.width = i5;
int i6 = this.c0;
layoutParams.height = i6;
float f7 = this.R;
int i7 = (int) ((f7 - i5) - (this.Z * f7));
layoutParams.x = i7;
float f8 = this.S;
int i8 = (int) ((f8 - i6) - (this.a0 * 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;
I();
}
public final void u(int i) {
if (this.d.b0()) {
n nVar = this.d;
nVar.z0(nVar.L() + i, this.d.O());
J();
}
}
public final void u3(boolean z) {
if (this.d != null) {
D(0);
}
}
public final void v(znc zncVar, boolean z) {
int dimensionPixelSize;
int dimensionPixelSize2;
Bitmap bitmap;
int i;
Bitmap d2;
Resources resources = getResources();
try {
dimensionPixelSize = resources.getDimensionPixelSize(2131167538);
dimensionPixelSize2 = resources.getDimensionPixelSize(2131167536);
n nVar = this.d;
File file = nVar.q;
Bitmap[] bitmapArr = nVar.P;
bitmap = null;
if (bitmapArr != null) {
if (bitmapArr != null) {
int i2 = dimensionPixelSize <= dimensionPixelSize2 ? 0 : 1;
bitmap = bitmapArr[i2];
if (bitmap == null) {
bitmap = bitmapArr[(i2 + 1) % 2];
}
}
} else if (nVar.b0()) {
if (z) {
n nVar2 = this.d;
List m = nVar2.m((LinkedList) null);
if (m != null) {
nVar2.i0((n.g[]) m.toArray(new n.g[m.size()]));
}
if (this.d.d0()) {
}
}
if (this.d.g0() != null) {
Bitmap[] bitmapArr2 = this.d.P;
if (bitmapArr2 != null) {
int i3 = dimensionPixelSize <= dimensionPixelSize2 ? 0 : 1;
bitmap = bitmapArr2[i3];
if (bitmap == null) {
bitmap = bitmapArr2[(i3 + 1) % 2];
}
}
} else if (file != null) {
try {
oab r = oab.r();
try {
String path = file.getPath();
r.getClass();
try {
i = r.q(path);
} catch (SQLiteDoneException unused) {
i = 0;
}
if (i != 0) {
h4h h4hVar = L.q;
h4hVar.getClass();
FileStat1 fileStat1 = new FileStat1();
String c2 = Files.stat1(path, fileStat1) ? h4hVar.c(i, fileStat1.length, fileStat1.lastModified) : null;
if (c2 != null) {
bitmap = h4h.d(i, c2);
}
}
} finally {
}
} catch (SQLiteException e2) {
Log.e("MX", "", e2);
}
}
}
} catch (OutOfMemoryError e3) {
e = e3;
}
if (bitmap == null || (d2 = yxh.d(bitmap, dimensionPixelSize, dimensionPixelSize2, 0)) == null) {
z(zncVar);
}
this.A0 = d2;
try {
zncVar.i(d2);
ejb.a(this.p0, d2, true);
} catch (OutOfMemoryError e4) {
e = e4;
Log.e("MX.PlayService", "", e);
z(zncVar);
}
}
public final void w() {
n nVar = this.d;
if (nVar == null || nVar.o == null) {
return;
}
if (this.w0 != 0) {
this.v0 = (SystemClock.elapsedRealtime() - this.w0) + this.v0;
this.w0 = 0L;
}
String uri = this.d.o.toString();
long j = this.v0;
weh.k(uri, "" + this.d.w, "" + this.d.L(), "notificationbar", j);
this.v0 = 0L;
}
public final void x(com.mxtech.videoplayer.ActivityScreen activityScreen, n nVar, Class cls, Intent intent, Bundle bundle, Boolean bool) {
if (this.d != null) {
throw new IllegalStateException("PP already exists.");
}
Log.d("MX.PlayService", "Transfer Player(" + nVar + ") from " + activityScreen);
this.d = nVar;
this.f = activityScreen;
this.g = bundle;
nVar.j = this;
Intent putExtra = new Intent(intent).setPackage(getPackageName()).setClass(getApplicationContext(), cls).setFlags(805306368).putExtra("launcher", "com.mxtech.videoplayer.service.PlayService");
this.z0 = putExtra;
int i = Build.VERSION.SDK_INT;
this.u0 = PendingIntent.getActivity(L0, 0, putExtra, i >= 31 ? 67108864 : 0);
if (bool.booleanValue()) {
this.u = new WindowManager.LayoutParams(-1, -1, 2002, 262664, -3);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(-2, -2, 2002, 262664, -3);
this.t = layoutParams;
if (i >= 26) {
layoutParams.type = 2038;
this.u.type = 2038;
} else {
layoutParams.type = 2002;
this.u.type = 2002;
}
this.F = (WindowManager) getSystemService("window");
LayoutInflater layoutInflater = (LayoutInflater) getSystemService("layout_inflater");
DisplayMetrics displayMetrics = new DisplayMetrics();
this.F.getDefaultDisplay().getMetrics(displayMetrics);
this.P = this.d.Q();
this.Q = this.d.P();
Log.d("MX.PlayService", "createPlayerView width: videoWidth:" + this.P + " videoHeight:" + this.Q);
float f2 = (float) displayMetrics.widthPixels;
this.R = f2;
this.T = f2;
float f3 = (float) displayMetrics.heightPixels;
this.S = f3;
this.U = f3;
this.V = ((int) f2) / 3;
this.W = ((int) f3) / 3;
this.d0 = this.P / this.Q;
this.e0 = f2 / f3;
this.l0 = 0;
Handler handler = this.i0;
if (handler != null) {
handler.sendEmptyMessageDelayed(6, 500L);
}
FrameLayout frameLayout = (FrameLayout) layoutInflater.inflate(2131560255, (ViewGroup) null, false);
N0 = frameLayout;
this.v = (TopLayoutService) frameLayout.findViewById(2131366632);
SubView subView = (SubView) N0.findViewById(2131366281);
this.m0 = subView;
n nVar2 = this.d;
subView.setPlayerFromPIP(nVar2, this, nVar2.w0);
k();
WindowManager.LayoutParams layoutParams2 = this.t;
layoutParams2.gravity = 8388659;
layoutParams2.x = 0;
layoutParams2.y = 0;
layoutParams2.width = this.d.Q();
this.t.height = this.d.P();
float f4 = this.d0;
if (f4 <= this.e0) {
int i2 = ((int) this.S) / 2;
this.c0 = i2;
this.b0 = (int) (i2 * f4);
} else {
int i3 = ((int) this.R) / 2;
this.b0 = i3;
this.c0 = (int) (i3 / f4);
}
int a2 = g7f.a(getApplicationContext(), 8.0f);
WindowManager.LayoutParams layoutParams3 = this.t;
float f5 = this.R;
int i4 = this.b0;
float f6 = i4;
float f7 = a2;
int i5 = (int) ((f5 - f6) - f7);
layoutParams3.x = i5;
float f8 = this.S;
int i6 = this.c0;
float f9 = i6;
int i7 = (int) ((f8 - f9) - f7);
layoutParams3.y = i7;
if (i5 < 0) {
i5 = 0;
}
layoutParams3.x = i5;
if (i7 < 0) {
i7 = 0;
}
layoutParams3.y = i7;
layoutParams3.width = i4;
layoutParams3.height = i6;
this.Z = ((f5 - i5) - f6) / f5;
this.a0 = ((f8 - i7) - f9) / f8;
this.F.addView(N0, layoutParams3);
LinearLayout linearLayout = (LinearLayout) N0.findViewById(2131365410);
this.D = linearLayout;
this.E = linearLayout.getLayoutParams().width;
ImageView imageView = (ImageView) N0.findViewById(2131362599);
this.w = imageView;
c cVar = this.I0;
imageView.setOnClickListener(cVar);
ImageView imageView2 = (ImageView) N0.findViewById(2131365922);
this.x = imageView2;
imageView2.setOnClickListener(cVar);
ImageView imageView3 = (ImageView) N0.findViewById(2131362709);
this.y = imageView3;
imageView3.setOnClickListener(cVar);
ImageView imageView4 = (ImageView) N0.findViewById(2131365923);
this.z = imageView4;
imageView4.setOnClickListener(cVar);
ImageView imageView5 = (ImageView) N0.findViewById(2131365921);
this.A = imageView5;
imageView5.setOnClickListener(cVar);
E();
vlf vlfVar = this.H0;
vlfVar.a.a();
ulf ulfVar = new ulf(vlfVar, this, this);
vlfVar.d = ulfVar;
ulfVar.enable();
this.B = N0.findViewById(2131362848);
this.C = N0.findViewById(2131362849);
this.X = this.x.getLayoutParams().height + this.w.getLayoutParams().height;
N0.setOnTouchListener(new znd(this));
N0.setOnClickListener(new aod(this));
this.m0.setSSARenderingMode(s6d.q0 && this.d.F == 2, this.d);
xwh xwhVar = this.d.R;
if (xwhVar.b.size() > 0) {
b(xwhVar, this.d.Z, Apps.d(this.z0, "subs.enable"), s6d.p ? 3 : 0);
}
this.f0 = true;
handler.sendEmptyMessageDelayed(1, s6d.r(this));
}
F(5);
d0c.i().h(true);
C();
D(5);
zm3.a(this, this.s0, this.p, true);
this.r0++;
L();
g gVar = M0;
gVar.sendMessageDelayed(gVar.obtainMessage(3, this.d.o), this.d.L == 4 ? 500 : 0);
gr6.a(tya.m.I(), "BackgroundPlay");
gfh.d(new mdg("mxBackgroundPlay", weh.g));
}
public final void z(znc zncVar) {
if (this.A0 == null) {
this.A0 = BitmapFactory.decodeResource(getApplicationContext().getResources(), 2131235100);
}
zncVar.i(this.A0);
ejb.a(this.p0, this.A0, true);
}
public static class g extends Handler implements a {
public boolean b;
public final void a(boolean z) {
if (!this.b) {
if (bg.f(com.mxtech.videoplayer.ActivityScreen.class)) {
try {
if (tya.m.startService(new Intent((Context) tya.m, (Class<?>) PlayService.class)) == null) {
Log.e("MX.PlayService", "Can't start the play service.");
return;
} else {
this.b = true;
return;
}
} catch (IllegalStateException | SecurityException e) {
Log.e("MX.PlayService", "Can't start the play service.", e);
return;
}
}
return;
}
PlayService playService = PlayService.L0;
if (playService == null || playService.d != null || bg.f(com.mxtech.videoplayer.ActivityScreen.class)) {
return;
}
if (z) {
sendEmptyMessageDelayed(1, 1000L);
} else {
PlayService.L0.stopSelf();
this.b = false;
}
}
public final void b() {
removeMessages(1);
a(true);
}
public final void c(Activity activity, int i) {
PlayService playService;
if (activity instanceof com.mxtech.videoplayer.ActivityScreen) {
PlayService playService2 = PlayService.L0;
if (playService2 != null) {
playService2.h0 = true;
Handler handler = playService2.i0;
if (handler != null) {
handler.removeMessages(4);
}
}
b();
return;
}
if ((activity instanceof com.mxtech.videoplayer.a) && i == 3 && (playService = PlayService.L0) != null && playService.f0 && playService.t != null) {
playService.k0 = activity.getResources().getConfiguration();
playService.q(playService.d0, playService.H0.c);
}
}
@Override
public final void handleMessage(Message message) {
PlayService playService;
int i = message.what;
if (i == 1) {
a(false);
return;
}
if (i == 2) {
PlayService playService2 = PlayService.L0;
if (playService2 != null) {
playService2.w();
playService2.i();
n nVar = playService2.d;
if (nVar != null) {
if (nVar.b0() && playService2.d.l0()) {
return;
}
playService2.e(true);
return;
}
return;
}
return;
}
if (i == 3 && (playService = PlayService.L0) != null) {
Uri uri = (Uri) message.obj;
n nVar2 = playService.d;
if (nVar2 == null || uri == null || !uri.equals(nVar2.o)) {
return;
}
n nVar3 = playService.d;
if (nVar3.L == 6) {
nVar3.y0();
PlayService.M0.sendEmptyMessageDelayed(2, 10L);
} else if (nVar3.b0() && (playService.f0 || playService.m())) {
playService.d.x0();
playService.J();
} else {
if (playService.d.N0()) {
return;
}
playService.e(true);
}
}
}
public final void h() {
}
}
public final void B() {
}
public final void H1() {
}
public final void O3() {
}
public final void R0() {
}
public final void Y1() {
}
@Override
public final void d4() {
}
public final void e0() {
}
public final void w5() {
}
public final void A5(CharSequence charSequence) {
}
public final void R(float f2) {
}
public final void X4(boolean z) {
}
public final void j3(int i) {
}
public final void l2(int i) {
}
public final void v1(int i) {
}
public final int x1(int i) {
return i;
}
public final void F0(zjb zjbVar, List list) {
}
public final void K4(CharSequence charSequence, Drawable drawable) {
}
public final void g1(int i, int i2) {
}
}