package c.i.a.c; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.os.Handler; import androidx.annotation.Nullable; import c.i.a.c.i2.f0; import c.i.a.c.i2.p; import com.airbnb.lottie.parser.AnimatableValueParser; import java.util.Iterator; /* compiled from: StreamVolumeManager */ public final class q1 { public final Context a; public final Handler b; /* renamed from: c reason: collision with root package name */ public final b f951c; public final AudioManager d; @Nullable public c e; public int f = 3; public int g; public boolean h; /* compiled from: StreamVolumeManager */ public interface b { } /* compiled from: StreamVolumeManager */ public final class c extends BroadcastReceiver { public c(a aVar) { } @Override // android.content.BroadcastReceiver public void onReceive(Context context, Intent intent) { q1 q1Var = q1.this; q1Var.b.post(new b0(q1Var)); } } public q1(Context context, Handler handler, b bVar) { Context applicationContext = context.getApplicationContext(); this.a = applicationContext; this.b = handler; this.f951c = bVar; AudioManager audioManager = (AudioManager) applicationContext.getSystemService("audio"); AnimatableValueParser.H(audioManager); this.d = audioManager; this.g = b(audioManager, 3); this.h = a(audioManager, this.f); c cVar = new c(null); try { applicationContext.registerReceiver(cVar, new IntentFilter("android.media.VOLUME_CHANGED_ACTION")); this.e = cVar; } catch (RuntimeException e) { p.c("StreamVolumeManager", "Error registering stream volume receiver", e); } } public static boolean a(AudioManager audioManager, int i) { return f0.a >= 23 ? audioManager.isStreamMute(i) : b(audioManager, i) == 0; } public static int b(AudioManager audioManager, int i) { try { return audioManager.getStreamVolume(i); } catch (RuntimeException e) { p.c("StreamVolumeManager", "Could not retrieve stream volume for stream type " + i, e); return audioManager.getStreamMaxVolume(i); } } public final void c() { int b2 = b(this.d, this.f); boolean a2 = a(this.d, this.f); if (this.g != b2 || this.h != a2) { this.g = b2; this.h = a2; Iterator it = p1.this.j.iterator(); while (it.hasNext()) { it.next().a(); } } } }