granularity level: instruction
.class public final Landroidx/core/app/NavUtils;
.super Ljava/lang/Object;
.source "NavUtils.java"
.field public static final PARENT_ACTIVITY:Ljava/lang/String; = "android.support.PARENT_ACTIVITY"
.field private static final TAG:Ljava/lang/String; = "NavUtils"
.method private constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getParentActivityIntent(Landroid/app/Activity;)Landroid/content/Intent;
.locals 3
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-lt v0, v1, :cond_0
invoke-virtual {p0}, Landroid/app/Activity;->getParentActivityIntent()Landroid/content/Intent;
move-result-object v0
if-eqz v0, :cond_0
return-object v0
:cond_0
invoke-static {p0}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/app/Activity;)Ljava/lang/String;
move-result-object v0
const/4 v1, 0x0
if-nez v0, :cond_1
return-object v1
:cond_1
new-instance v2, Landroid/content/ComponentName;
invoke-direct {v2, p0, v0}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/String;)V
:try_start_0
invoke-static {p0, v2}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
move-result-object p0
if-nez p0, :cond_2
invoke-static {v2}, Landroid/content/Intent;->makeMainActivity(Landroid/content/ComponentName;)Landroid/content/Intent;
move-result-object p0
goto :goto_0
:cond_2
new-instance p0, Landroid/content/Intent;
invoke-direct {p0}, Landroid/content/Intent;-><init>()V
invoke-virtual {p0, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
move-result-object p0
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
:goto_0
return-object p0
:catch_0
new-instance p0, Ljava/lang/StringBuilder;
invoke-direct {p0}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "getParentActivityIntent: bad parentActivityName \'"
invoke-virtual {p0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v0, "\' in manifest"
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
const-string v0, "NavUtils"
invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
return-object v1
.end method
.method public static getParentActivityIntent(Landroid/content/Context;Landroid/content/ComponentName;)Landroid/content/Intent;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/content/pm/PackageManager$NameNotFoundException;
}
.end annotation
invoke-static {p0, p1}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
move-result-object v0
if-nez v0, :cond_0
const/4 p0, 0x0
return-object p0
:cond_0
new-instance v1, Landroid/content/ComponentName;
invoke-virtual {p1}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;
move-result-object p1
invoke-direct {v1, p1, v0}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-static {p0, v1}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
move-result-object p0
if-nez p0, :cond_1
invoke-static {v1}, Landroid/content/Intent;->makeMainActivity(Landroid/content/ComponentName;)Landroid/content/Intent;
move-result-object p0
goto :goto_0
:cond_1
new-instance p0, Landroid/content/Intent;
invoke-direct {p0}, Landroid/content/Intent;-><init>()V
invoke-virtual {p0, v1}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
move-result-object p0
:goto_0
return-object p0
.end method
.method public static getParentActivityIntent(Landroid/content/Context;Ljava/lang/Class;)Landroid/content/Intent;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/content/pm/PackageManager$NameNotFoundException;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Ljava/lang/Class<",
"*>;)",
"Landroid/content/Intent;"
}
.end annotation
new-instance v0, Landroid/content/ComponentName;
invoke-direct {v0, p0, p1}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
invoke-static {p0, v0}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
move-result-object p1
if-nez p1, :cond_0
const/4 p0, 0x0
return-object p0
:cond_0
new-instance v0, Landroid/content/ComponentName;
invoke-direct {v0, p0, p1}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/String;)V
invoke-static {p0, v0}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
move-result-object p0
if-nez p0, :cond_1
invoke-static {v0}, Landroid/content/Intent;->makeMainActivity(Landroid/content/ComponentName;)Landroid/content/Intent;
move-result-object p0
goto :goto_0
:cond_1
new-instance p0, Landroid/content/Intent;
invoke-direct {p0}, Landroid/content/Intent;-><init>()V
invoke-virtual {p0, v0}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
move-result-object p0
:goto_0
return-object p0
.end method
.method public static getParentActivityName(Landroid/app/Activity;)Ljava/lang/String;
.locals 1
:try_start_0
invoke-virtual {p0}, Landroid/app/Activity;->getComponentName()Landroid/content/ComponentName;
move-result-object v0
invoke-static {p0, v0}, Landroidx/core/app/NavUtils;->getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
move-result-object p0
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
return-object p0
:catch_0
move-exception p0
new-instance v0, Ljava/lang/IllegalArgumentException;
invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/Throwable;)V
throw v0
.end method
.method public static getParentActivityName(Landroid/content/Context;Landroid/content/ComponentName;)Ljava/lang/String;
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/content/pm/PackageManager$NameNotFoundException;
}
.end annotation
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x280
sget v2, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v3, 0x1d
if-lt v2, v3, :cond_0
const v1, 0x100c0280
goto :goto_0
:cond_0
sget v2, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v3, 0x18
if-lt v2, v3, :cond_1
const v1, 0xc0280
:goto_0
:cond_1
invoke-virtual {v0, p1, v1}, Landroid/content/pm/PackageManager;->getActivityInfo(Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;
move-result-object p1
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-lt v0, v1, :cond_2
iget-object v0, p1, Landroid/content/pm/ActivityInfo;->parentActivityName:Ljava/lang/String;
if-eqz v0, :cond_2
return-object v0
:cond_2
iget-object v0, p1, Landroid/content/pm/ActivityInfo;->metaData:Landroid/os/Bundle;
const/4 v1, 0x0
if-nez v0, :cond_3
return-object v1
:cond_3
iget-object p1, p1, Landroid/content/pm/ActivityInfo;->metaData:Landroid/os/Bundle;
const-string v0, "android.support.PARENT_ACTIVITY"
invoke-virtual {p1, v0}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
if-nez p1, :cond_4
return-object v1
:cond_4
const/4 v0, 0x0
invoke-virtual {p1, v0}, Ljava/lang/String;->charAt(I)C
move-result v0
const/16 v1, 0x2e
if-ne v0, v1, :cond_5
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object p0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
:cond_5
return-object p1
.end method
.method public static navigateUpFromSameTask(Landroid/app/Activity;)V
.locals 3
invoke-static {p0}, Landroidx/core/app/NavUtils;->getParentActivityIntent(Landroid/app/Activity;)Landroid/content/Intent;
move-result-object v0
if-eqz v0, :cond_0
invoke-static {p0, v0}, Landroidx/core/app/NavUtils;->navigateUpTo(Landroid/app/Activity;Landroid/content/Intent;)V
return-void
:cond_0
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Activity "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object p0
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p0, " does not have a parent activity name specified. (Did you forget to add the android.support.PARENT_ACTIVITY <meta-data> element in your manifest?)"
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public static navigateUpTo(Landroid/app/Activity;Landroid/content/Intent;)V
.locals 2
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-lt v0, v1, :cond_0
invoke-virtual {p0, p1}, Landroid/app/Activity;->navigateUpTo(Landroid/content/Intent;)Z
goto :goto_0
:cond_0
const/high16 v0, 0x4000000
invoke-virtual {p1, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
invoke-virtual {p0, p1}, Landroid/app/Activity;->startActivity(Landroid/content/Intent;)V
invoke-virtual {p0}, Landroid/app/Activity;->finish()V
:goto_0
return-void
.end method
.method public static shouldUpRecreateTask(Landroid/app/Activity;Landroid/content/Intent;)Z
.locals 2
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-lt v0, v1, :cond_0
invoke-virtual {p0, p1}, Landroid/app/Activity;->shouldUpRecreateTask(Landroid/content/Intent;)Z
move-result p0
return p0
:cond_0
invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;
move-result-object p0
invoke-virtual {p0}, Landroid/content/Intent;->getAction()Ljava/lang/String;
move-result-object p0
if-eqz p0, :cond_1
const-string p1, "android.intent.action.MAIN"
invoke-virtual {p0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p0
if-nez p0, :cond_1
const/4 p0, 0x1
goto :goto_0
:cond_1
const/4 p0, 0x0
:goto_0
return p0
.end method