package android.support.v4.media.session;

import android.content.Context;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.IBinder.DeathRecipient;
import android.os.Message;
import android.support.v4.media.session.MediaSessionCompat.Token;
import android.support.v4.media.session.c.b;
import java.util.HashSet;

public final class MediaControllerCompat {
    final b Jj;
    private final Token Jk;
    private final HashSet<a> Jl = new HashSet();

    public static abstract class a implements DeathRecipient {
        private final Object Jm;
        a Jn;
        boolean Jo;

        public a() {
            if (VERSION.SDK_INT >= 21) {
                this.Jm = new b(new b(this));
            } else {
                this.Jm = new c(this);
            }
        }

        /* Access modifiers changed, original: final */
        public final void a(int i, Object obj, Bundle bundle) {
            if (this.Jn != null) {
                Message obtainMessage = this.Jn.obtainMessage(i, obj);
                obtainMessage.setData(bundle);
                obtainMessage.sendToTarget();
            }
        }
    }

    static class c extends MediaControllerImplApi21 {
        public c(Context context, Token token) {
            super(context, token);
        }
    }

    public MediaControllerCompat(Context context, Token token) {
        if (token == null) {
            throw new IllegalArgumentException("sessionToken must not be null");
        }
        this.Jk = token;
        if (VERSION.SDK_INT >= 24) {
            this.Jj = new d(context, token);
        } else if (VERSION.SDK_INT >= 23) {
            this.Jj = new c(context, token);
        } else if (VERSION.SDK_INT >= 21) {
            this.Jj = new MediaControllerImplApi21(context, token);
        } else {
            this.Jj = new e(this.Jk);
        }
    }
}
