- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
129 lines
3.5 KiB
Java
129 lines
3.5 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.media.AudioManager;
|
|
import android.os.Handler;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class il {
|
|
private final Context a;
|
|
private final Handler b;
|
|
private final b c;
|
|
private final AudioManager d;
|
|
private c e;
|
|
private int f;
|
|
private int g;
|
|
private boolean h;
|
|
|
|
public interface b {
|
|
void a(int i, boolean z);
|
|
|
|
void d(int i);
|
|
}
|
|
|
|
public static /* synthetic */ void b(il ilVar) {
|
|
ilVar.d();
|
|
}
|
|
|
|
public il(Context context, Handler handler, b bVar) {
|
|
Context applicationContext = context.getApplicationContext();
|
|
this.a = applicationContext;
|
|
this.b = handler;
|
|
this.c = bVar;
|
|
AudioManager audioManager = (AudioManager) b1.b((AudioManager) applicationContext.getSystemService("audio"));
|
|
this.d = audioManager;
|
|
this.f = 3;
|
|
this.g = b(audioManager, 3);
|
|
this.h = a(audioManager, this.f);
|
|
c cVar = new c();
|
|
try {
|
|
applicationContext.registerReceiver(cVar, new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));
|
|
this.e = cVar;
|
|
} catch (RuntimeException e) {
|
|
pc.c("StreamVolumeManager", "Error registering stream volume receiver", e);
|
|
}
|
|
}
|
|
|
|
public int a() {
|
|
return this.d.getStreamMaxVolume(this.f);
|
|
}
|
|
|
|
public void c() {
|
|
c cVar = this.e;
|
|
if (cVar != null) {
|
|
try {
|
|
this.a.unregisterReceiver(cVar);
|
|
} catch (RuntimeException e) {
|
|
pc.c("StreamVolumeManager", "Error unregistering stream volume receiver", e);
|
|
}
|
|
this.e = null;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void d() {
|
|
int b2 = b(this.d, this.f);
|
|
boolean a2 = a(this.d, this.f);
|
|
if (this.g == b2 && this.h == a2) {
|
|
return;
|
|
}
|
|
this.g = b2;
|
|
this.h = a2;
|
|
this.c.a(b2, a2);
|
|
}
|
|
|
|
public final class c extends BroadcastReceiver {
|
|
private c() {
|
|
}
|
|
|
|
@Override // android.content.BroadcastReceiver
|
|
public void onReceive(Context context, Intent intent) {
|
|
Handler handler = il.this.b;
|
|
final il ilVar = il.this;
|
|
handler.post(new Runnable() { // from class: com.applovin.impl.il$c$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
il.b(il.this);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
private static int b(AudioManager audioManager, int i) {
|
|
try {
|
|
return audioManager.getStreamVolume(i);
|
|
} catch (RuntimeException e) {
|
|
pc.c("StreamVolumeManager", "Could not retrieve stream volume for stream type " + i, e);
|
|
return audioManager.getStreamMaxVolume(i);
|
|
}
|
|
}
|
|
|
|
public int b() {
|
|
int streamMinVolume;
|
|
if (xp.a < 28) {
|
|
return 0;
|
|
}
|
|
streamMinVolume = this.d.getStreamMinVolume(this.f);
|
|
return streamMinVolume;
|
|
}
|
|
|
|
public void a(int i) {
|
|
if (this.f == i) {
|
|
return;
|
|
}
|
|
this.f = i;
|
|
d();
|
|
this.c.d(i);
|
|
}
|
|
|
|
private static boolean a(AudioManager audioManager, int i) {
|
|
if (xp.a >= 23) {
|
|
return audioManager.isStreamMute(i);
|
|
}
|
|
return b(audioManager, i) == 0;
|
|
}
|
|
}
|