123 lines
3.8 KiB
Java
123 lines
3.8 KiB
Java
|
package androidx.media;
|
||
|
|
||
|
import android.media.VolumeProvider;
|
||
|
import android.os.Build;
|
||
|
import androidx.annotation.Nullable;
|
||
|
import androidx.annotation.RestrictTo;
|
||
|
import java.lang.annotation.Retention;
|
||
|
import java.lang.annotation.RetentionPolicy;
|
||
|
public abstract class VolumeProviderCompat {
|
||
|
public static final int VOLUME_CONTROL_ABSOLUTE = 2;
|
||
|
public static final int VOLUME_CONTROL_FIXED = 0;
|
||
|
public static final int VOLUME_CONTROL_RELATIVE = 1;
|
||
|
private Callback mCallback;
|
||
|
private final String mControlId;
|
||
|
private final int mControlType;
|
||
|
private int mCurrentVolume;
|
||
|
private final int mMaxVolume;
|
||
|
private VolumeProvider mVolumeProviderFwk;
|
||
|
|
||
|
/* renamed from: androidx.media.VolumeProviderCompat$1 reason: invalid class name */
|
||
|
public class AnonymousClass1 extends VolumeProvider {
|
||
|
public AnonymousClass1(int i, int i2, int i3, String str) {
|
||
|
super(i, i2, i3, str);
|
||
|
}
|
||
|
|
||
|
@Override // android.media.VolumeProvider
|
||
|
public void onAdjustVolume(int i) {
|
||
|
VolumeProviderCompat.this.onAdjustVolume(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.media.VolumeProvider
|
||
|
public void onSetVolumeTo(int i) {
|
||
|
VolumeProviderCompat.this.onSetVolumeTo(i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* renamed from: androidx.media.VolumeProviderCompat$2 reason: invalid class name */
|
||
|
public class AnonymousClass2 extends VolumeProvider {
|
||
|
public AnonymousClass2(int i, int i2, int i3) {
|
||
|
super(i, i2, i3);
|
||
|
}
|
||
|
|
||
|
@Override // android.media.VolumeProvider
|
||
|
public void onAdjustVolume(int i) {
|
||
|
VolumeProviderCompat.this.onAdjustVolume(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.media.VolumeProvider
|
||
|
public void onSetVolumeTo(int i) {
|
||
|
VolumeProviderCompat.this.onSetVolumeTo(i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static abstract class Callback {
|
||
|
public abstract void onVolumeChanged(VolumeProviderCompat volumeProviderCompat);
|
||
|
}
|
||
|
|
||
|
@Retention(RetentionPolicy.SOURCE)
|
||
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||
|
public @interface ControlType {
|
||
|
}
|
||
|
|
||
|
public VolumeProviderCompat(int i, int i2, int i3) {
|
||
|
this(i, i2, i3, null);
|
||
|
}
|
||
|
|
||
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||
|
public VolumeProviderCompat(int i, int i2, int i3, @Nullable String str) {
|
||
|
this.mControlType = i;
|
||
|
this.mMaxVolume = i2;
|
||
|
this.mCurrentVolume = i3;
|
||
|
this.mControlId = str;
|
||
|
}
|
||
|
|
||
|
public final int getCurrentVolume() {
|
||
|
return this.mCurrentVolume;
|
||
|
}
|
||
|
|
||
|
public final int getMaxVolume() {
|
||
|
return this.mMaxVolume;
|
||
|
}
|
||
|
|
||
|
public final int getVolumeControl() {
|
||
|
return this.mControlType;
|
||
|
}
|
||
|
|
||
|
@Nullable
|
||
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||
|
public final String getVolumeControlId() {
|
||
|
return this.mControlId;
|
||
|
}
|
||
|
|
||
|
public Object getVolumeProvider() {
|
||
|
if (this.mVolumeProviderFwk == null) {
|
||
|
if (Build.VERSION.SDK_INT >= 30) {
|
||
|
this.mVolumeProviderFwk = new AnonymousClass1(this.mControlType, this.mMaxVolume, this.mCurrentVolume, this.mControlId);
|
||
|
} else {
|
||
|
this.mVolumeProviderFwk = new AnonymousClass2(this.mControlType, this.mMaxVolume, this.mCurrentVolume);
|
||
|
}
|
||
|
}
|
||
|
return this.mVolumeProviderFwk;
|
||
|
}
|
||
|
|
||
|
public void onAdjustVolume(int i) {
|
||
|
}
|
||
|
|
||
|
public void onSetVolumeTo(int i) {
|
||
|
}
|
||
|
|
||
|
public void setCallback(Callback callback) {
|
||
|
this.mCallback = callback;
|
||
|
}
|
||
|
|
||
|
public final void setCurrentVolume(int i) {
|
||
|
this.mCurrentVolume = i;
|
||
|
((VolumeProvider) getVolumeProvider()).setCurrentVolume(i);
|
||
|
Callback callback = this.mCallback;
|
||
|
if (callback != null) {
|
||
|
callback.onVolumeChanged(this);
|
||
|
}
|
||
|
}
|
||
|
}
|