正在查看: BAM Crawford v6.14.1 应用的 MediaPlaybackService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BAM Crawford v6.14.1 应用的 MediaPlaybackService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.subsplash.thechurchapp.media;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;
import android.view.KeyEvent;
import androidx.core.app.l;
import com.subsplash.thechurchapp.TheChurchApp;
import com.subsplash.thechurchapp.handlers.playlist.PlaylistHandler;
import com.subsplash.thechurchapp.handlers.playlist.PlaylistItem;
import com.subsplash.thechurchapp.media.j;
import com.subsplash.util.a0;
import com.subsplash.util.c0;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.jvm.internal.DefaultConstructorMarker;
import okhttp3.HttpUrl;
public final class MediaPlaybackService extends d implements j.t {
public static final a O = new a(null);
private final IBinder F = new b();
private final Timer G = new Timer();
private NotificationManager H;
private l.e I;
private boolean J;
private String K;
private String L;
private String M;
private int N;
public static final class a {
private a() {
}
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public final class b extends Binder {
private final MediaPlaybackService a;
public b() {
this.a = MediaPlaybackService.this;
}
public final MediaPlaybackService a() {
return this.a;
}
}
public static final class c extends TimerTask {
c() {
}
@Override
public void run() {
}
}
private final PendingIntent P(Intent intent, int i, int i2) {
intent.putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(0, i));
PendingIntent broadcast = PendingIntent.getBroadcast(TheChurchApp.n(), i2, intent, Build.VERSION.SDK_INT >= 31 ? 167772160 : 134217728);
kotlin.jvm.internal.k.d(broadcast, "getBroadcast(TheChurchAp…questCode, intent, flags)");
return broadcast;
}
private final void Q() {
NotificationChannel notificationChannel;
if (this.I == null) {
com.subsplash.util.i.a.d();
Object systemService = TheChurchApp.n().getSystemService("notification");
kotlin.jvm.internal.k.c(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
NotificationManager notificationManager = (NotificationManager) systemService;
int i = Build.VERSION.SDK_INT;
if (i >= 26) {
notificationChannel = notificationManager.getNotificationChannel("sapMediaPlayer");
if (notificationChannel == null) {
n.a();
notificationManager.createNotificationChannel(uc.q.a("sapMediaPlayer", "Media Player", 2));
}
}
l.e u = new l.e(TheChurchApp.n(), "sapMediaPlayer").F(1).k(PendingIntent.getActivity(this, 0, PlaylistHandler.createHandlerForLoadedPlaylist().getIntent(this), i >= 31 ? 67108864 : 0)).z(pi.m.icon_notification).y(false).u(true);
this.I = u;
if (u != null) {
u.B(new androidx.media.app.b().h(j.q0().w0()).i(new int[]{0, 1, 2}));
}
}
}
private final void U(boolean z) {
PlaylistItem m0 = j.q0().m0();
if (m0 == null) {
W();
return;
}
if (z) {
List<String> textArray = m0.getTextArray();
this.J = true;
String str = null;
this.K = (textArray == null || textArray.size() <= 0) ? null : textArray.get(0);
this.L = (textArray == null || textArray.size() <= 1) ? null : textArray.get(1);
if (textArray != null && textArray.size() > 2) {
str = textArray.get(2);
}
this.M = str;
this.N = j.m0;
Q();
Y();
}
S(z);
}
private final void V() {
Timer timer = this.G;
if (timer != null) {
timer.scheduleAtFixedRate(new c(), 0L, 5000L);
}
}
private final void W() {
Timer timer = this.G;
if (timer != null) {
timer.cancel();
}
}
private final void Y() {
this.I = null;
Q();
l.e eVar = this.I;
if (eVar == null) {
return;
}
if (eVar != null) {
eVar.D(this.K);
}
int i = pi.m.button_notification_rewind_15;
int i2 = pi.m.button_notification_fastforward_15;
l.e eVar2 = this.I;
if (eVar2 != null) {
eVar2.u(j.q0().W0());
}
l.e eVar3 = this.I;
if (eVar3 != null) {
eVar3.m(this.K);
}
l.e eVar4 = this.I;
if (eVar4 != null) {
eVar4.l(this.L);
}
l.e eVar5 = this.I;
if (eVar5 != null) {
eVar5.C(this.M);
}
l.e eVar6 = this.I;
if (eVar6 != null) {
eVar6.q(j.q0().P);
}
ComponentName componentName = new ComponentName(TheChurchApp.n(), (Class<?>) MediaIntentReceiver.class);
Intent intent = new Intent("android.intent.action.MEDIA_BUTTON");
intent.setComponent(componentName);
l.e eVar7 = this.I;
if (eVar7 != null) {
eVar7.o(P(intent, 86, 4));
}
l.e eVar8 = this.I;
if (eVar8 != null) {
eVar8.a(i, (CharSequence) null, P(intent, 88, 1));
}
l.e eVar9 = this.I;
if (eVar9 != null) {
eVar9.a(this.N, (CharSequence) null, P(intent, 85, 2));
}
l.e eVar10 = this.I;
if (eVar10 != null) {
eVar10.a(i2, (CharSequence) null, P(intent, 87, 3));
}
if (Build.VERSION.SDK_INT < 26) {
String k0 = j.q0().k0();
int a2 = k0 != null ? com.subsplash.util.o.a(k0) : 0;
if (a2 == 0 || !com.subsplash.util.o.d(a2, -1)) {
return;
}
l.e eVar11 = this.I;
if (eVar11 != null) {
eVar11.i(a2);
}
l.e eVar12 = this.I;
if (eVar12 != null) {
eVar12.j(true);
}
}
}
@Override
protected IBinder L() {
return this.F;
}
public final void R() {
a0.a("MediaPlaybackService", "onStop");
S(false);
W();
}
public final void S(boolean z) {
try {
if (!z) {
stopForeground(false);
NotificationManager notificationManager = this.H;
if (notificationManager != null) {
notificationManager.cancel(pi.q.audio_service_started);
}
this.J = false;
return;
}
l.e eVar = this.I;
if (eVar == null || this.H == null || !this.J) {
return;
}
Notification c2 = eVar != null ? eVar.c() : null;
NotificationManager notificationManager2 = this.H;
if (notificationManager2 != null) {
notificationManager2.notify(pi.q.audio_service_started, c2);
}
if (j.q0().W0()) {
startForeground(pi.q.audio_service_started, c2);
} else {
stopForeground(false);
}
} catch (Exception e) {
String message = e.getMessage();
if (message == null) {
message = HttpUrl.FRAGMENT_ENCODE_SET;
}
Log.d("MediaPlaybackService error", message);
}
}
public final void T(int i) {
this.N = i;
X();
}
public final void X() {
Y();
S(!ui.c.w());
}
@Override
public void onBufferedChanged(int i) {
}
@Override
public void onCreate() {
super.onCreate();
Object systemService = getSystemService("notification");
kotlin.jvm.internal.k.c(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
this.H = (NotificationManager) systemService;
V();
}
@Override
public void onDestroy() {
super.onDestroy();
a0.a("MediaPlaybackService", "onDestroy");
j.u1();
j.F1(this);
S(false);
W();
}
@Override
public void onLocalAudioItemDeleted(PlaylistItem item, j instance) {
kotlin.jvm.internal.k.e(item, "item");
kotlin.jvm.internal.k.e(instance, "instance");
}
@Override
public void onPlayerStateChanged(c0 state) {
kotlin.jvm.internal.k.e(state, "state");
if (state == c0.Prepared) {
U(!ui.c.w());
} else if (state == c0.Error) {
R();
stopSelf();
}
}
@Override
public void onPositionChanged(PlaylistItem item, int i, int i2) {
kotlin.jvm.internal.k.e(item, "item");
}
@Override
public void onScan(j instance) {
kotlin.jvm.internal.k.e(instance, "instance");
}
@Override
public void onSeekComplete(j instance) {
kotlin.jvm.internal.k.e(instance, "instance");
}
public int onStartCommand(Intent intent, int i, int i2) {
kotlin.jvm.internal.k.e(intent, "intent");
a0.a("MediaPlaybackService", "onStart");
j.a0(this);
U(true);
return 1;
}
public void onTaskRemoved(Intent rootIntent) {
kotlin.jvm.internal.k.e(rootIntent, "rootIntent");
super/*android.app.Service*/.onTaskRemoved(rootIntent);
a0.a("MediaPlaybackService", "onTaskRemoved");
j.u1();
j.F1(this);
R();
stopForeground(true);
}
}