导航菜单

页面标题

页面副标题

BAM Crawford v6.14.1 - y.java 源代码

正在查看: BAM Crawford v6.14.1 应用的 y.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package uc;

import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import com.google.android.gms.cast.CastDevice;
import com.google.android.gms.cast.MediaInfo;
import com.google.android.gms.cast.framework.ReconnectionService;
import com.google.android.gms.cast.framework.media.MediaIntentReceiver;
import com.google.android.gms.cast.framework.media.i;
import com.google.android.gms.cast.framework.media.y0;
import com.google.android.gms.internal.cast.h0;
import com.google.android.gms.internal.cast.t1;
import com.google.android.gms.internal.cast.z1;
import java.util.List;

public final class y {
    private static final xc.b w = new xc.b("MediaSessionManager");
    public static final int x = 0;
    private final Context a;
    private final tc.c b;
    private final h0 c;
    private final tc.w d;
    private final com.google.android.gms.cast.framework.media.h e;
    private final ComponentName f;
    private final ComponentName g;
    private final b h;
    private final b i;
    private final r j;
    private final Handler k;
    private final Runnable l;
    private final i.a m;
    private com.google.android.gms.cast.framework.media.i n;
    private CastDevice o;
    private MediaSessionCompat p;
    private MediaSessionCompat.Callback q;
    private boolean r;
    private PlaybackStateCompat.CustomAction s;
    private PlaybackStateCompat.CustomAction t;
    private PlaybackStateCompat.CustomAction u;
    private PlaybackStateCompat.CustomAction v;

    public y(Context context, tc.c cVar, h0 h0Var) {
        this.a = context;
        this.b = cVar;
        this.c = h0Var;
        tc.b g = tc.b.g();
        Object[] objArr = 0;
        this.d = g != null ? g.f() : null;
        com.google.android.gms.cast.framework.media.a g2 = cVar.g();
        this.e = g2 == null ? null : g2.m();
        this.m = new x(this, objArr == true ? 1 : 0);
        String g3 = g2 == null ? null : g2.g();
        this.f = !TextUtils.isEmpty(g3) ? new ComponentName(context, g3) : null;
        String j = g2 == null ? null : g2.j();
        this.g = !TextUtils.isEmpty(j) ? new ComponentName(context, j) : null;
        b bVar = new b(context);
        this.h = bVar;
        bVar.c(new t(this));
        b bVar2 = new b(context);
        this.i = bVar2;
        bVar2.c(new u(this));
        this.k = new z1(Looper.getMainLooper());
        this.j = r.e(cVar) ? new r(context) : null;
        this.l = new Runnable() {
            @Override
            public final void run() {
                y.this.j();
            }
        };
    }

    private final long m(String str, int i, Bundle bundle) {
        char c;
        long j;
        int hashCode = str.hashCode();
        if (hashCode == -945151566) {
            if (str.equals(MediaIntentReceiver.ACTION_SKIP_NEXT)) {
                c = 2;
            }
            c = 65535;
        } else if (hashCode != -945080078) {
            if (hashCode == 235550565 && str.equals(MediaIntentReceiver.ACTION_TOGGLE_PLAYBACK)) {
                c = 0;
            }
            c = 65535;
        } else {
            if (str.equals(MediaIntentReceiver.ACTION_SKIP_PREV)) {
                c = 1;
            }
            c = 65535;
        }
        if (c == 0) {
            if (i == 3) {
                j = 514;
                i = 3;
            } else {
                j = 512;
            }
            if (i != 2) {
                return j;
            }
            return 516L;
        }
        if (c == 1) {
            com.google.android.gms.cast.framework.media.i iVar = this.n;
            if (iVar != null && iVar.l0()) {
                return 16L;
            }
            bundle.putBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS", true);
            return 0L;
        }
        if (c != 2) {
            return 0L;
        }
        com.google.android.gms.cast.framework.media.i iVar2 = this.n;
        if (iVar2 != null && iVar2.k0()) {
            return 32L;
        }
        bundle.putBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT", true);
        return 0L;
    }

    private final Uri n(sc.i iVar, int i) {
        com.google.android.gms.cast.framework.media.a g = this.b.g();
        com.google.android.gms.cast.framework.media.c i2 = g == null ? null : g.i();
        dd.a a = i2 != null ? i2.a(iVar, i) : iVar.y() ? (dd.a) iVar.m().get(0) : null;
        if (a == null) {
            return null;
        }
        return a.i();
    }

    private final MediaMetadataCompat.Builder o() {
        MediaSessionCompat mediaSessionCompat = this.p;
        MediaMetadataCompat metadata = mediaSessionCompat == null ? null : mediaSessionCompat.getController().getMetadata();
        return metadata == null ? new MediaMetadataCompat.Builder() : new MediaMetadataCompat.Builder(metadata);
    }

    public final void p(Bitmap bitmap, int i) {
        MediaSessionCompat mediaSessionCompat = this.p;
        if (mediaSessionCompat == null) {
            return;
        }
        if (bitmap == null) {
            bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
            bitmap.eraseColor(0);
        }
        mediaSessionCompat.setMetadata(o().putBitmap(i == 0 ? "android.media.metadata.DISPLAY_ICON" : "android.media.metadata.ALBUM_ART", bitmap).build());
    }

    private final void q(PlaybackStateCompat.Builder builder, String str, com.google.android.gms.cast.framework.media.f fVar) {
        char c;
        PlaybackStateCompat.CustomAction customAction;
        com.google.android.gms.cast.framework.media.h hVar;
        com.google.android.gms.cast.framework.media.h hVar2;
        com.google.android.gms.cast.framework.media.h hVar3;
        com.google.android.gms.cast.framework.media.h hVar4;
        switch (str.hashCode()) {
            case -1699820260:
                if (str.equals(MediaIntentReceiver.ACTION_REWIND)) {
                    c = 1;
                    break;
                }
                c = 65535;
                break;
            case -668151673:
                if (str.equals(MediaIntentReceiver.ACTION_STOP_CASTING)) {
                    c = 2;
                    break;
                }
                c = 65535;
                break;
            case -124479363:
                if (str.equals(MediaIntentReceiver.ACTION_DISCONNECT)) {
                    c = 3;
                    break;
                }
                c = 65535;
                break;
            case 1362116196:
                if (str.equals(MediaIntentReceiver.ACTION_FORWARD)) {
                    c = 0;
                    break;
                }
                c = 65535;
                break;
            default:
                c = 65535;
                break;
        }
        if (c == 0) {
            if (this.s == null && (hVar = this.e) != null) {
                long G = hVar.G();
                this.s = new PlaybackStateCompat.CustomAction.Builder(MediaIntentReceiver.ACTION_FORWARD, this.a.getResources().getString(z.b(hVar, G)), z.a(this.e, G)).build();
            }
            customAction = this.s;
        } else if (c == 1) {
            if (this.t == null && (hVar2 = this.e) != null) {
                long G2 = hVar2.G();
                this.t = new PlaybackStateCompat.CustomAction.Builder(MediaIntentReceiver.ACTION_REWIND, this.a.getResources().getString(z.d(hVar2, G2)), z.c(this.e, G2)).build();
            }
            customAction = this.t;
        } else if (c == 2) {
            if (this.u == null && (hVar3 = this.e) != null) {
                this.u = new PlaybackStateCompat.CustomAction.Builder(MediaIntentReceiver.ACTION_STOP_CASTING, this.a.getResources().getString(hVar3.zza()), this.e.k()).build();
            }
            customAction = this.u;
        } else if (c != 3) {
            customAction = fVar != null ? new PlaybackStateCompat.CustomAction.Builder(str, fVar.i(), fVar.j()).build() : null;
        } else {
            if (this.v == null && (hVar4 = this.e) != null) {
                this.v = new PlaybackStateCompat.CustomAction.Builder(MediaIntentReceiver.ACTION_DISCONNECT, this.a.getResources().getString(hVar4.zza()), this.e.k()).build();
            }
            customAction = this.v;
        }
        if (customAction != null) {
            builder.addCustomAction(customAction);
        }
    }

    private final void r(boolean z) {
        if (this.b.i()) {
            Runnable runnable = this.l;
            if (runnable != null) {
                this.k.removeCallbacks(runnable);
            }
            Intent intent = new Intent(this.a, (Class<?>) ReconnectionService.class);
            intent.setPackage(this.a.getPackageName());
            try {
                this.a.startService(intent);
            } catch (IllegalStateException unused) {
                if (z) {
                    this.k.postDelayed(this.l, 1000L);
                }
            }
        }
    }

    private final void s() {
        r rVar = this.j;
        if (rVar != null) {
            w.a("Stopping media notification.", new Object[0]);
            rVar.c();
        }
    }

    private final void t() {
        if (this.b.i()) {
            this.k.removeCallbacks(this.l);
            Intent intent = new Intent(this.a, (Class<?>) ReconnectionService.class);
            intent.setPackage(this.a.getPackageName());
            this.a.stopService(intent);
        }
    }

    private final void u(int i, MediaInfo mediaInfo) {
        PlaybackStateCompat build;
        MediaSessionCompat mediaSessionCompat;
        sc.i B;
        PendingIntent activity;
        MediaSessionCompat mediaSessionCompat2 = this.p;
        if (mediaSessionCompat2 == null) {
            return;
        }
        Bundle bundle = new Bundle();
        PlaybackStateCompat.Builder builder = new PlaybackStateCompat.Builder();
        com.google.android.gms.cast.framework.media.i iVar = this.n;
        if (iVar == null || this.j == null) {
            build = builder.build();
        } else {
            builder.setState(i, (iVar.T() == 0 || iVar.p()) ? 0L : iVar.f(), 1.0f);
            if (i == 0) {
                build = builder.build();
            } else {
                com.google.android.gms.cast.framework.media.h hVar = this.e;
                y0 W = hVar != null ? hVar.W() : null;
                com.google.android.gms.cast.framework.media.i iVar2 = this.n;
                long j = (iVar2 == null || iVar2.p() || this.n.t()) ? 0L : 256L;
                if (W != null) {
                    List<com.google.android.gms.cast.framework.media.f> f = z.f(W);
                    if (f != null) {
                        for (com.google.android.gms.cast.framework.media.f fVar : f) {
                            String g = fVar.g();
                            if (v(g)) {
                                j |= m(g, i, bundle);
                            } else {
                                q(builder, g, fVar);
                            }
                        }
                    }
                } else {
                    com.google.android.gms.cast.framework.media.h hVar2 = this.e;
                    if (hVar2 != null) {
                        for (String str : hVar2.g()) {
                            if (v(str)) {
                                j |= m(str, i, bundle);
                            } else {
                                q(builder, str, null);
                            }
                        }
                    }
                }
                build = builder.setActions(j).build();
            }
        }
        mediaSessionCompat2.setPlaybackState(build);
        com.google.android.gms.cast.framework.media.h hVar3 = this.e;
        if (hVar3 != null && hVar3.Z()) {
            bundle.putBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS", true);
        }
        com.google.android.gms.cast.framework.media.h hVar4 = this.e;
        if (hVar4 != null && hVar4.Y()) {
            bundle.putBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT", true);
        }
        if (bundle.containsKey("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS") || bundle.containsKey("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT")) {
            mediaSessionCompat2.setExtras(bundle);
        }
        if (i == 0) {
            mediaSessionCompat2.setMetadata(new MediaMetadataCompat.Builder().build());
            return;
        }
        if (this.n != null) {
            if (this.f == null) {
                activity = null;
            } else {
                Intent intent = new Intent();
                intent.setComponent(this.f);
                activity = PendingIntent.getActivity(this.a, 0, intent, t1.a | 134217728);
            }
            if (activity != null) {
                mediaSessionCompat2.setSessionActivity(activity);
            }
        }
        if (this.n == null || (mediaSessionCompat = this.p) == null || mediaInfo == null || (B = mediaInfo.B()) == null) {
            return;
        }
        com.google.android.gms.cast.framework.media.i iVar3 = this.n;
        long E = (iVar3 == null || !iVar3.p()) ? mediaInfo.E() : 0L;
        String v = B.v("com.google.android.gms.cast.metadata.TITLE");
        String v2 = B.v("com.google.android.gms.cast.metadata.SUBTITLE");
        MediaMetadataCompat.Builder putLong = o().putLong("android.media.metadata.DURATION", E);
        if (v != null) {
            putLong.putString("android.media.metadata.TITLE", v);
            putLong.putString("android.media.metadata.DISPLAY_TITLE", v);
        }
        if (v2 != null) {
            putLong.putString("android.media.metadata.DISPLAY_SUBTITLE", v2);
        }
        mediaSessionCompat.setMetadata(putLong.build());
        Uri n = n(B, 0);
        if (n != null) {
            this.h.d(n);
        } else {
            p(null, 0);
        }
        Uri n2 = n(B, 3);
        if (n2 != null) {
            this.i.d(n2);
        } else {
            p(null, 3);
        }
    }

    private static final boolean v(String str) {
        return TextUtils.equals(str, MediaIntentReceiver.ACTION_TOGGLE_PLAYBACK) || TextUtils.equals(str, MediaIntentReceiver.ACTION_SKIP_PREV) || TextUtils.equals(str, MediaIntentReceiver.ACTION_SKIP_NEXT);
    }

    public final void h(com.google.android.gms.cast.framework.media.i iVar, CastDevice castDevice) {
        AudioManager audioManager;
        tc.c cVar = this.b;
        com.google.android.gms.cast.framework.media.a g = cVar == null ? null : cVar.g();
        if (this.r || this.b == null || g == null || this.e == null || iVar == null || castDevice == null || this.g == null) {
            w.a("skip attaching media session", new Object[0]);
            return;
        }
        this.n = iVar;
        iVar.E(this.m);
        this.o = castDevice;
        if (!jd.m.f() && (audioManager = (AudioManager) this.a.getSystemService("audio")) != null) {
            audioManager.requestAudioFocus(null, 3, 3);
        }
        Intent intent = new Intent("android.intent.action.MEDIA_BUTTON");
        intent.setComponent(this.g);
        PendingIntent broadcast = PendingIntent.getBroadcast(this.a, 0, intent, t1.a);
        if (g.k()) {
            MediaSessionCompat mediaSessionCompat = new MediaSessionCompat(this.a, "CastMediaSession", this.g, broadcast);
            this.p = mediaSessionCompat;
            u(0, null);
            CastDevice castDevice2 = this.o;
            if (castDevice2 != null && !TextUtils.isEmpty(castDevice2.j())) {
                mediaSessionCompat.setMetadata(new MediaMetadataCompat.Builder().putString("android.media.metadata.ALBUM_ARTIST", this.a.getResources().getString(tc.s.cast_casting_to_device, this.o.j())).build());
            }
            v vVar = new v(this);
            this.q = vVar;
            mediaSessionCompat.setCallback(vVar);
            mediaSessionCompat.setActive(true);
            this.c.e3(mediaSessionCompat);
        }
        this.r = true;
        l(false);
    }

    public final void i(int i) {
        AudioManager audioManager;
        if (this.r) {
            this.r = false;
            com.google.android.gms.cast.framework.media.i iVar = this.n;
            if (iVar != null) {
                iVar.S(this.m);
            }
            if (!jd.m.f() && (audioManager = (AudioManager) this.a.getSystemService("audio")) != null) {
                audioManager.abandonAudioFocus(null);
            }
            this.c.e3(null);
            b bVar = this.h;
            if (bVar != null) {
                bVar.a();
            }
            b bVar2 = this.i;
            if (bVar2 != null) {
                bVar2.a();
            }
            MediaSessionCompat mediaSessionCompat = this.p;
            if (mediaSessionCompat != null) {
                mediaSessionCompat.setCallback((MediaSessionCompat.Callback) null);
                this.p.setMetadata(new MediaMetadataCompat.Builder().build());
                u(0, null);
            }
            MediaSessionCompat mediaSessionCompat2 = this.p;
            if (mediaSessionCompat2 != null) {
                mediaSessionCompat2.setActive(false);
                this.p.release();
                this.p = null;
            }
            this.n = null;
            this.o = null;
            this.q = null;
            s();
            if (i == 0) {
                t();
            }
        }
    }

    final void j() {
        r(false);
    }

    public final void k(CastDevice castDevice) {
        w.e("update Cast device to %s", castDevice);
        this.o = castDevice;
        l(false);
    }

    public final void l(boolean z) {
        com.google.android.gms.cast.g h;
        com.google.android.gms.cast.framework.media.i iVar = this.n;
        if (iVar == null) {
            return;
        }
        int T = iVar.T();
        MediaInfo i = iVar.i();
        if (iVar.q() && (h = iVar.h()) != null && h.r() != null) {
            i = h.r();
        }
        u(T, i);
        if (!iVar.n()) {
            s();
            t();
        } else if (T != 0) {
            r rVar = this.j;
            if (rVar != null) {
                w.a("Update media notification.", new Object[0]);
                rVar.d(this.o, this.n, this.p, z);
            }
            if (iVar.q()) {
                return;
            }
            r(true);
        }
    }
}