Files
rr3-apk/decompiled-community/sources/androidx/media/MediaSessionManager.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

140 lines
4.6 KiB
Java

package androidx.media;
import android.content.Context;
import android.media.session.MediaSessionManager;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.media.MediaSessionManagerImplApi28;
import androidx.media.MediaSessionManagerImplBase;
/* loaded from: classes.dex */
public final class MediaSessionManager {
private static volatile MediaSessionManager sSessionManager;
MediaSessionManagerImpl mImpl;
static final String TAG = "MediaSessionManager";
static final boolean DEBUG = Log.isLoggable(TAG, 3);
private static final Object sLock = new Object();
public interface MediaSessionManagerImpl {
Context getContext();
boolean isTrustedForMediaControl(RemoteUserInfoImpl remoteUserInfoImpl);
}
public interface RemoteUserInfoImpl {
String getPackageName();
int getPid();
int getUid();
}
@NonNull
public static MediaSessionManager getSessionManager(@NonNull Context context) {
MediaSessionManager mediaSessionManager;
if (context == null) {
throw new IllegalArgumentException("context cannot be null");
}
synchronized (sLock) {
try {
if (sSessionManager == null) {
sSessionManager = new MediaSessionManager(context.getApplicationContext());
}
mediaSessionManager = sSessionManager;
} catch (Throwable th) {
throw th;
}
}
return mediaSessionManager;
}
private MediaSessionManager(Context context) {
if (Build.VERSION.SDK_INT >= 28) {
this.mImpl = new MediaSessionManagerImplApi28(context);
} else {
this.mImpl = new MediaSessionManagerImplApi21(context);
}
}
public boolean isTrustedForMediaControl(@NonNull RemoteUserInfo remoteUserInfo) {
if (remoteUserInfo == null) {
throw new IllegalArgumentException("userInfo should not be null");
}
return this.mImpl.isTrustedForMediaControl(remoteUserInfo.mImpl);
}
public Context getContext() {
return this.mImpl.getContext();
}
public static final class RemoteUserInfo {
public static final String LEGACY_CONTROLLER = "android.media.session.MediaController";
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static final int UNKNOWN_PID = -1;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static final int UNKNOWN_UID = -1;
RemoteUserInfoImpl mImpl;
public RemoteUserInfo(@NonNull String str, int i, int i2) {
if (str == null) {
throw new NullPointerException("package shouldn't be null");
}
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("packageName should be nonempty");
}
if (Build.VERSION.SDK_INT >= 28) {
this.mImpl = new MediaSessionManagerImplApi28.RemoteUserInfoImplApi28(str, i, i2);
} else {
this.mImpl = new MediaSessionManagerImplBase.RemoteUserInfoImplBase(str, i, i2);
}
}
@RequiresApi(28)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public RemoteUserInfo(MediaSessionManager.RemoteUserInfo remoteUserInfo) {
String packageName = MediaSessionManagerImplApi28.RemoteUserInfoImplApi28.getPackageName(remoteUserInfo);
if (packageName == null) {
throw new NullPointerException("package shouldn't be null");
}
if (TextUtils.isEmpty(packageName)) {
throw new IllegalArgumentException("packageName should be nonempty");
}
this.mImpl = new MediaSessionManagerImplApi28.RemoteUserInfoImplApi28(remoteUserInfo);
}
@NonNull
public String getPackageName() {
return this.mImpl.getPackageName();
}
public int getPid() {
return this.mImpl.getPid();
}
public int getUid() {
return this.mImpl.getUid();
}
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RemoteUserInfo) {
return this.mImpl.equals(((RemoteUserInfo) obj).mImpl);
}
return false;
}
public int hashCode() {
return this.mImpl.hashCode();
}
}
}