package a.c.d.i;

import android.content.Context;
import android.media.AudioManager;

public class d {

    /* renamed from: a  reason: collision with root package name */
    private final String f154a;
    private int b;
    private Context c;

    public static class b {

        /* renamed from: a  reason: collision with root package name */
        private static final d f155a = new d();

        private b() {
        }
    }

    private d() {
        this.f154a = "MediaSessionProvider";
        this.b = 0;
    }

    private synchronized int a() {
        int i = this.b;
        if (i != 0) {
            return i;
        }
        AudioManager audioManager = (AudioManager) this.c.getSystemService("audio");
        if (audioManager != null) {
            this.b = audioManager.generateAudioSessionId();
            a.a.a.b.c("MediaSessionProvider", "session id is " + this.b);
            return this.b;
        }
        throw new UnsupportedOperationException("can't get audio service");
    }

    public static d a(Context context) {
        d dVar = b.f155a;
        if (dVar.c == null) {
            dVar.c = context;
        }
        return dVar;
    }

    public static d b() {
        return a(null);
    }

    public static int c() {
        return b().a();
    }
}
