apkfuckery/com.discord/smali/androidx/media/MediaSessionManagerImplBase.smali
2020-04-17 19:35:24 +02:00

343 lines
9.4 KiB
Smali

.class public Landroidx/media/MediaSessionManagerImplBase;
.super Ljava/lang/Object;
.source "MediaSessionManagerImplBase.java"
# interfaces
.implements Landroidx/media/MediaSessionManager$MediaSessionManagerImpl;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/media/MediaSessionManagerImplBase$RemoteUserInfoImplBase;
}
.end annotation
# static fields
.field public static final DEBUG:Z
.field public static final ENABLED_NOTIFICATION_LISTENERS:Ljava/lang/String; = "enabled_notification_listeners"
.field public static final PERMISSION_MEDIA_CONTENT_CONTROL:Ljava/lang/String; = "android.permission.MEDIA_CONTENT_CONTROL"
.field public static final PERMISSION_STATUS_BAR_SERVICE:Ljava/lang/String; = "android.permission.STATUS_BAR_SERVICE"
.field public static final TAG:Ljava/lang/String; = "MediaSessionManager"
# instance fields
.field public mContentResolver:Landroid/content/ContentResolver;
.field public mContext:Landroid/content/Context;
# direct methods
.method public static constructor <clinit>()V
.locals 1
sget-boolean v0, Landroidx/media/MediaSessionManager;->DEBUG:Z
sput-boolean v0, Landroidx/media/MediaSessionManagerImplBase;->DEBUG:Z
return-void
.end method
.method public constructor <init>(Landroid/content/Context;)V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Landroidx/media/MediaSessionManagerImplBase;->mContext:Landroid/content/Context;
iget-object p1, p0, Landroidx/media/MediaSessionManagerImplBase;->mContext:Landroid/content/Context;
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object p1
iput-object p1, p0, Landroidx/media/MediaSessionManagerImplBase;->mContentResolver:Landroid/content/ContentResolver;
return-void
.end method
.method private isPermissionGranted(Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;Ljava/lang/String;)Z
.locals 4
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPid()I
move-result v0
const/4 v1, 0x1
const/4 v2, 0x0
if-gez v0, :cond_1
iget-object v0, p0, Landroidx/media/MediaSessionManagerImplBase;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPackageName()Ljava/lang/String;
move-result-object p1
invoke-virtual {v0, p2, p1}, Landroid/content/pm/PackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;)I
move-result p1
if-nez p1, :cond_0
goto :goto_0
:cond_0
const/4 v1, 0x0
:goto_0
return v1
:cond_1
iget-object v0, p0, Landroidx/media/MediaSessionManagerImplBase;->mContext:Landroid/content/Context;
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPid()I
move-result v3
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getUid()I
move-result p1
invoke-virtual {v0, p2, v3, p1}, Landroid/content/Context;->checkPermission(Ljava/lang/String;II)I
move-result p1
if-nez p1, :cond_2
goto :goto_1
:cond_2
const/4 v1, 0x0
:goto_1
return v1
.end method
# virtual methods
.method public getContext()Landroid/content/Context;
.locals 1
iget-object v0, p0, Landroidx/media/MediaSessionManagerImplBase;->mContext:Landroid/content/Context;
return-object v0
.end method
.method public isEnabledNotificationListener(Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;)Z
.locals 5
.param p1 # Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
iget-object v0, p0, Landroidx/media/MediaSessionManagerImplBase;->mContentResolver:Landroid/content/ContentResolver;
const-string v1, "enabled_notification_listeners"
invoke-static {v0, v1}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
const/4 v1, 0x0
if-eqz v0, :cond_1
const-string v2, ":"
invoke-virtual {v0, v2}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
move-result-object v0
const/4 v2, 0x0
:goto_0
array-length v3, v0
if-ge v2, v3, :cond_1
aget-object v3, v0, v2
invoke-static {v3}, Landroid/content/ComponentName;->unflattenFromString(Ljava/lang/String;)Landroid/content/ComponentName;
move-result-object v3
if-eqz v3, :cond_0
invoke-virtual {v3}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;
move-result-object v3
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPackageName()Ljava/lang/String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
const/4 p1, 0x1
return p1
:cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
return v1
.end method
.method public isTrustedForMediaControl(Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;)Z
.locals 4
.param p1 # Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
const-string v0, "MediaSessionManager"
const/4 v1, 0x0
:try_start_0
iget-object v2, p0, Landroidx/media/MediaSessionManagerImplBase;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPackageName()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3, v1}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;
move-result-object v2
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
iget v2, v2, Landroid/content/pm/ApplicationInfo;->uid:I
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getUid()I
move-result v3
if-eq v2, v3, :cond_1
sget-boolean v2, Landroidx/media/MediaSessionManagerImplBase;->DEBUG:Z
if-eqz v2, :cond_0
const-string v2, "Package name "
invoke-static {v2}, Lf/e/b/a/a;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPackageName()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v3, " doesn\'t match with the uid "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getUid()I
move-result p1
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-static {v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_0
return v1
:cond_1
const-string v0, "android.permission.STATUS_BAR_SERVICE"
invoke-direct {p0, p1, v0}, Landroidx/media/MediaSessionManagerImplBase;->isPermissionGranted(Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_2
const-string v0, "android.permission.MEDIA_CONTENT_CONTROL"
invoke-direct {p0, p1, v0}, Landroidx/media/MediaSessionManagerImplBase;->isPermissionGranted(Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_2
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getUid()I
move-result v0
const/16 v2, 0x3e8
if-eq v0, v2, :cond_2
invoke-virtual {p0, p1}, Landroidx/media/MediaSessionManagerImplBase;->isEnabledNotificationListener(Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;)Z
move-result p1
if-eqz p1, :cond_3
:cond_2
const/4 v1, 0x1
:cond_3
return v1
:catch_0
nop
sget-boolean v2, Landroidx/media/MediaSessionManagerImplBase;->DEBUG:Z
if-eqz v2, :cond_4
const-string v2, "Package "
invoke-static {v2}, Lf/e/b/a/a;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-interface {p1}, Landroidx/media/MediaSessionManager$RemoteUserInfoImpl;->getPackageName()Ljava/lang/String;
move-result-object p1
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p1, " doesn\'t exist"
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-static {v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:cond_4
return v1
.end method