561 lines
15 KiB
Smali
561 lines
15 KiB
Smali
.class public Landroidx/media/session/MediaButtonReceiver;
|
|
.super Landroid/content/BroadcastReceiver;
|
|
.source "MediaButtonReceiver.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Landroidx/media/session/MediaButtonReceiver$a;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final a:Ljava/lang/String; = "MediaButtonReceiver"
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;J)Landroid/app/PendingIntent;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/MethodParameters;
|
|
accessFlags = {
|
|
0x0,
|
|
0x0
|
|
}
|
|
names = {
|
|
"context",
|
|
"action"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p0}, Landroidx/media/session/MediaButtonReceiver;->c(Landroid/content/Context;)Landroid/content/ComponentName;
|
|
|
|
move-result-object v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const-string p0, "MediaButtonReceiver"
|
|
|
|
const-string p1, "A unique media button receiver could not be found in the given context, so couldn\'t build a pending intent."
|
|
|
|
.line 2
|
|
invoke-static {p0, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
.line 3
|
|
:cond_0
|
|
invoke-static {p0, v0, p1, p2}, Landroidx/media/session/MediaButtonReceiver;->b(Landroid/content/Context;Landroid/content/ComponentName;J)Landroid/app/PendingIntent;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static b(Landroid/content/Context;Landroid/content/ComponentName;J)Landroid/app/PendingIntent;
|
|
.locals 3
|
|
.annotation build Landroid/annotation/SuppressLint;
|
|
value = {
|
|
"WrongConstant"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/MethodParameters;
|
|
accessFlags = {
|
|
0x0,
|
|
0x0,
|
|
0x0
|
|
}
|
|
names = {
|
|
"context",
|
|
"mbrComponent",
|
|
"action"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const-string v1, "MediaButtonReceiver"
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const-string p0, "The component name of media button receiver should be provided."
|
|
|
|
.line 1
|
|
invoke-static {v1, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return-object v0
|
|
|
|
.line 2
|
|
:cond_0
|
|
invoke-static {p2, p3}, Landroid/support/v4/media/session/PlaybackStateCompat;->q(J)I
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
.line 3
|
|
new-instance p0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string p1, "Cannot build a media button pending intent with the given action: "
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p0, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {v1, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return-object v0
|
|
|
|
.line 4
|
|
:cond_1
|
|
new-instance p2, Landroid/content/Intent;
|
|
|
|
const-string p3, "android.intent.action.MEDIA_BUTTON"
|
|
|
|
invoke-direct {p2, p3}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 5
|
|
invoke-virtual {p2, p1}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
|
|
|
|
.line 6
|
|
new-instance p1, Landroid/view/KeyEvent;
|
|
|
|
const/4 p3, 0x0
|
|
|
|
invoke-direct {p1, p3, v2}, Landroid/view/KeyEvent;-><init>(II)V
|
|
|
|
const-string p3, "android.intent.extra.KEY_EVENT"
|
|
|
|
invoke-virtual {p2, p3, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
|
|
|
|
const/high16 p1, 0x10000000
|
|
|
|
.line 7
|
|
invoke-virtual {p2, p1}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
|
|
|
|
.line 8
|
|
sget p1, Landroid/support/v4/media/session/MediaSessionCompat;->e:I
|
|
|
|
invoke-static {p0, v2, p2, p1}, Landroid/app/PendingIntent;->getBroadcast(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static c(Landroid/content/Context;)Landroid/content/ComponentName;
|
|
.locals 3
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/MethodParameters;
|
|
accessFlags = {
|
|
0x0
|
|
}
|
|
names = {
|
|
"context"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
new-instance v0, Landroid/content/Intent;
|
|
|
|
const-string v1, "android.intent.action.MEDIA_BUTTON"
|
|
|
|
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 2
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
.line 3
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
.line 4
|
|
invoke-virtual {p0, v0, v1}, Landroid/content/pm/PackageManager;->queryBroadcastReceivers(Landroid/content/Intent;I)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
.line 5
|
|
invoke-interface {p0}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-ne v0, v2, :cond_0
|
|
|
|
.line 6
|
|
invoke-interface {p0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Landroid/content/pm/ResolveInfo;
|
|
|
|
.line 7
|
|
new-instance v0, Landroid/content/ComponentName;
|
|
|
|
iget-object p0, p0, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
|
|
|
|
iget-object v1, p0, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;
|
|
|
|
iget-object p0, p0, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;
|
|
|
|
invoke-direct {v0, v1, p0}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
.line 8
|
|
:cond_0
|
|
invoke-interface {p0}, Ljava/util/List;->size()I
|
|
|
|
move-result p0
|
|
|
|
if-le p0, v2, :cond_1
|
|
|
|
const-string p0, "MediaButtonReceiver"
|
|
|
|
const-string v0, "More than one BroadcastReceiver that handles android.intent.action.MEDIA_BUTTON was found, returning null."
|
|
|
|
.line 9
|
|
invoke-static {p0, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
:cond_1
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static d(Landroid/content/Context;Ljava/lang/String;)Landroid/content/ComponentName;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/MethodParameters;
|
|
accessFlags = {
|
|
0x0,
|
|
0x0
|
|
}
|
|
names = {
|
|
"context",
|
|
"action"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
|
|
|
move-result-object v0
|
|
|
|
.line 2
|
|
new-instance v1, Landroid/content/Intent;
|
|
|
|
invoke-direct {v1, p1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 3
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v1, p0}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
const/4 p0, 0x0
|
|
|
|
.line 4
|
|
invoke-virtual {v0, v1, p0}, Landroid/content/pm/PackageManager;->queryIntentServices(Landroid/content/Intent;I)Ljava/util/List;
|
|
|
|
move-result-object v0
|
|
|
|
.line 5
|
|
invoke-interface {v0}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-ne v1, v2, :cond_0
|
|
|
|
.line 6
|
|
invoke-interface {v0, p0}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Landroid/content/pm/ResolveInfo;
|
|
|
|
.line 7
|
|
new-instance p1, Landroid/content/ComponentName;
|
|
|
|
iget-object p0, p0, Landroid/content/pm/ResolveInfo;->serviceInfo:Landroid/content/pm/ServiceInfo;
|
|
|
|
iget-object v0, p0, Landroid/content/pm/ServiceInfo;->packageName:Ljava/lang/String;
|
|
|
|
iget-object p0, p0, Landroid/content/pm/ServiceInfo;->name:Ljava/lang/String;
|
|
|
|
invoke-direct {p1, v0, p0}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
|
|
.line 8
|
|
:cond_0
|
|
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
.line 9
|
|
:cond_1
|
|
new-instance p0, Ljava/lang/IllegalStateException;
|
|
|
|
const-string v1, "Expected 1 service that handles "
|
|
|
|
const-string v2, ", found "
|
|
|
|
invoke-static {v1, p1, v2}, Landroidx/activity/result/g;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 10
|
|
invoke-interface {v0}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static e(Landroid/support/v4/media/session/MediaSessionCompat;Landroid/content/Intent;)Landroid/view/KeyEvent;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/MethodParameters;
|
|
accessFlags = {
|
|
0x0,
|
|
0x0
|
|
}
|
|
names = {
|
|
"mediaSessionCompat",
|
|
"intent"
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
.line 1
|
|
invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "android.intent.action.MEDIA_BUTTON"
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const-string v0, "android.intent.extra.KEY_EVENT"
|
|
|
|
.line 2
|
|
invoke-virtual {p1, v0}, Landroid/content/Intent;->hasExtra(Ljava/lang/String;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 3
|
|
:cond_0
|
|
invoke-virtual {p1, v0}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Landroid/view/KeyEvent;
|
|
|
|
.line 4
|
|
invoke-virtual {p0}, Landroid/support/v4/media/session/MediaSessionCompat;->e()Landroid/support/v4/media/session/MediaControllerCompat;
|
|
|
|
move-result-object p0
|
|
|
|
.line 5
|
|
invoke-virtual {p0, p1}, Landroid/support/v4/media/session/MediaControllerCompat;->d(Landroid/view/KeyEvent;)Z
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
:goto_0
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/MethodParameters;
|
|
accessFlags = {
|
|
0x0,
|
|
0x0
|
|
}
|
|
names = {
|
|
"context",
|
|
"intent"
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p2, :cond_3
|
|
|
|
.line 1
|
|
invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "android.intent.action.MEDIA_BUTTON"
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
const-string v0, "android.intent.extra.KEY_EVENT"
|
|
|
|
.line 2
|
|
invoke-virtual {p2, v0}, Landroid/content/Intent;->hasExtra(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 3
|
|
:cond_0
|
|
invoke-static {p1, v1}, Landroidx/media/session/MediaButtonReceiver;->d(Landroid/content/Context;Ljava/lang/String;)Landroid/content/ComponentName;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 4
|
|
invoke-virtual {p2, v0}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
|
|
|
|
.line 5
|
|
invoke-static {p1, p2}, Landroidx/core/content/d;->u(Landroid/content/Context;Landroid/content/Intent;)V
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
const-string v0, "android.media.browse.MediaBrowserService"
|
|
|
|
.line 6
|
|
invoke-static {p1, v0}, Landroidx/media/session/MediaButtonReceiver;->d(Landroid/content/Context;Ljava/lang/String;)Landroid/content/ComponentName;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
.line 7
|
|
invoke-virtual {p0}, Landroid/content/BroadcastReceiver;->goAsync()Landroid/content/BroadcastReceiver$PendingResult;
|
|
|
|
move-result-object v1
|
|
|
|
.line 8
|
|
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object p1
|
|
|
|
.line 9
|
|
new-instance v2, Landroidx/media/session/MediaButtonReceiver$a;
|
|
|
|
invoke-direct {v2, p1, p2, v1}, Landroidx/media/session/MediaButtonReceiver$a;-><init>(Landroid/content/Context;Landroid/content/Intent;Landroid/content/BroadcastReceiver$PendingResult;)V
|
|
|
|
.line 10
|
|
new-instance p2, Landroid/support/v4/media/MediaBrowserCompat;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {p2, p1, v0, v2, v1}, Landroid/support/v4/media/MediaBrowserCompat;-><init>(Landroid/content/Context;Landroid/content/ComponentName;Landroid/support/v4/media/MediaBrowserCompat$c;Landroid/os/Bundle;)V
|
|
|
|
.line 11
|
|
invoke-virtual {v2, p2}, Landroidx/media/session/MediaButtonReceiver$a;->f(Landroid/support/v4/media/MediaBrowserCompat;)V
|
|
|
|
.line 12
|
|
invoke-virtual {p2}, Landroid/support/v4/media/MediaBrowserCompat;->a()V
|
|
|
|
return-void
|
|
|
|
.line 13
|
|
:cond_2
|
|
new-instance p1, Ljava/lang/IllegalStateException;
|
|
|
|
const-string p2, "Could not find any Service that handles android.intent.action.MEDIA_BUTTON or implements a media browser service."
|
|
|
|
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
.line 14
|
|
:cond_3
|
|
:goto_0
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v0, "Ignore unsupported intent: "
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "MediaButtonReceiver"
|
|
|
|
invoke-static {p2, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return-void
|
|
.end method
|