package Mqv2r_3.KQgRr5e_0.KQgRr5e_0.QxJ9d_1.IFxWkV_5;

import android.content.Context;
import android.media.AudioAttributes;
import android.media.MediaMetadata;
import android.media.session.MediaController;
import android.media.session.MediaSession;
import android.media.session.PlaybackState;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.support.v4.media.session.MediaSessionCompat;
import android.view.KeyEvent;
import java.util.List;
/* compiled from: MediaControllerCompatApi21.java */
/* loaded from: classes.dex */
public class PGPF6hQ_2 {

    /* compiled from: MediaControllerCompatApi21.java */
    /* loaded from: classes.dex */
    public interface KQgRr5e_0 {
        void KQgRr5e_0();

        void KQgRr5e_0(int i, int i2, int i3, int i4, int i5);

        void KQgRr5e_0(Bundle bundle);

        void KQgRr5e_0(CharSequence charSequence);

        void KQgRr5e_0(Object obj);

        void KQgRr5e_0(String str, Bundle bundle);

        void KQgRr5e_0(List<?> list);

        void QxJ9d_1(Object obj);
    }

    /* compiled from: MediaControllerCompatApi21.java */
    /* renamed from: Mqv2r_3.KQgRr5e_0.KQgRr5e_0.QxJ9d_1.IFxWkV_5.PGPF6hQ_2$PGPF6hQ_2  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static class C0028PGPF6hQ_2 {
        /* renamed from: KQgRr5e_0  reason: collision with other method in class */
        public static AudioAttributes m141KQgRr5e_0(Object obj) {
            return ((MediaController.PlaybackInfo) obj).getAudioAttributes();
        }

        public static int KQgRr5e_0(Object obj) {
            return KQgRr5e_0(m141KQgRr5e_0(obj));
        }

        public static int KQgRr5e_0(AudioAttributes audioAttributes) {
            if ((audioAttributes.getFlags() & 1) == 1) {
                return 7;
            }
            if ((audioAttributes.getFlags() & 4) == 4) {
                return 6;
            }
            int usage = audioAttributes.getUsage();
            if (usage != 13) {
                switch (usage) {
                    case 2:
                        return 0;
                    case 3:
                        return 8;
                    case 4:
                        return 4;
                    case 5:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                        return 5;
                    case 6:
                        return 2;
                    default:
                        return 3;
                }
            }
            return 1;
        }
    }

    /* compiled from: MediaControllerCompatApi21.java */
    /* loaded from: classes.dex */
    public static class QxJ9d_1<T extends KQgRr5e_0> extends MediaController.Callback {
        public final T KQgRr5e_0;

        public QxJ9d_1(T t) {
            this.KQgRr5e_0 = t;
        }

        @Override // android.media.session.MediaController.Callback
        public void onAudioInfoChanged(MediaController.PlaybackInfo playbackInfo) {
            this.KQgRr5e_0.KQgRr5e_0(playbackInfo.getPlaybackType(), C0028PGPF6hQ_2.KQgRr5e_0((Object) playbackInfo), playbackInfo.getVolumeControl(), playbackInfo.getMaxVolume(), playbackInfo.getCurrentVolume());
        }

        @Override // android.media.session.MediaController.Callback
        public void onExtrasChanged(Bundle bundle) {
            MediaSessionCompat.KQgRr5e_0(bundle);
            this.KQgRr5e_0.KQgRr5e_0(bundle);
        }

        @Override // android.media.session.MediaController.Callback
        public void onMetadataChanged(MediaMetadata mediaMetadata) {
            this.KQgRr5e_0.QxJ9d_1(mediaMetadata);
        }

        @Override // android.media.session.MediaController.Callback
        public void onPlaybackStateChanged(PlaybackState playbackState) {
            this.KQgRr5e_0.KQgRr5e_0(playbackState);
        }

        @Override // android.media.session.MediaController.Callback
        public void onQueueChanged(List<MediaSession.QueueItem> list) {
            this.KQgRr5e_0.KQgRr5e_0(list);
        }

        @Override // android.media.session.MediaController.Callback
        public void onQueueTitleChanged(CharSequence charSequence) {
            this.KQgRr5e_0.KQgRr5e_0(charSequence);
        }

        @Override // android.media.session.MediaController.Callback
        public void onSessionDestroyed() {
            this.KQgRr5e_0.KQgRr5e_0();
        }

        @Override // android.media.session.MediaController.Callback
        public void onSessionEvent(String str, Bundle bundle) {
            MediaSessionCompat.KQgRr5e_0(bundle);
            this.KQgRr5e_0.KQgRr5e_0(str, bundle);
        }
    }

    public static Object KQgRr5e_0(Context context, Object obj) {
        return new MediaController(context, (MediaSession.Token) obj);
    }

    public static Object KQgRr5e_0(KQgRr5e_0 kQgRr5e_0) {
        return new QxJ9d_1(kQgRr5e_0);
    }

    public static boolean KQgRr5e_0(Object obj, KeyEvent keyEvent) {
        return ((MediaController) obj).dispatchMediaButtonEvent(keyEvent);
    }

    public static void KQgRr5e_0(Object obj, String str, Bundle bundle, ResultReceiver resultReceiver) {
        ((MediaController) obj).sendCommand(str, bundle, resultReceiver);
    }
}
