ApplicationVersionSignature.smali
.class public final Lcom/bumptech/glide/signature/ApplicationVersionSignature;
.super Ljava/lang/Object;
.source "ApplicationVersionSignature.java"
# static fields
.field private static final PACKAGE_NAME_TO_KEY:Ljava/util/concurrent/ConcurrentMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/ConcurrentMap<",
"Ljava/lang/String;",
"Lcom/bumptech/glide/load/Key;",
">;"
}
.end annotation
.end field
.field private static final TAG:Ljava/lang/String; = "AppVersionSignature"
# direct methods
.method static constructor <clinit>()V
.registers 1
.line 21
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
sput-object v0, Lcom/bumptech/glide/signature/ApplicationVersionSignature;->PACKAGE_NAME_TO_KEY:Ljava/util/concurrent/ConcurrentMap;
return-void
.end method
.method private constructor <init>()V
.registers 1
.line 76
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private static getPackageInfo(Landroid/content/Context;)Landroid/content/pm/PackageInfo;
.registers 4
.line 69
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v1
const/4 v2, 0x0
invoke-virtual {v0, v1, v2}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object p0
:try_end_d
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_d} :catch_e
return-object p0
:catch_e
move-exception v0
.line 71
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Cannot resolve info for"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object p0
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
const-string v1, "AppVersionSignature"
invoke-static {v1, p0, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
const/4 p0, 0x0
return-object p0
.end method
.method private static getVersionCode(Landroid/content/pm/PackageInfo;)Ljava/lang/String;
.registers 1
if-eqz p0, :cond_9
.line 59
iget p0, p0, Landroid/content/pm/PackageInfo;->versionCode:I
invoke-static {p0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object p0
goto :goto_11
.line 61
:cond_9
invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;
move-result-object p0
invoke-virtual {p0}, Ljava/util/UUID;->toString()Ljava/lang/String;
move-result-object p0
:goto_11
return-object p0
.end method
.method public static obtain(Landroid/content/Context;)Lcom/bumptech/glide/load/Key;
.registers 4
.line 29
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v0
.line 30
sget-object v1, Lcom/bumptech/glide/signature/ApplicationVersionSignature;->PACKAGE_NAME_TO_KEY:Ljava/util/concurrent/ConcurrentMap;
invoke-interface {v1, v0}, Ljava/util/concurrent/ConcurrentMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Lcom/bumptech/glide/load/Key;
if-nez v2, :cond_1c
.line 32
invoke-static {p0}, Lcom/bumptech/glide/signature/ApplicationVersionSignature;->obtainVersionSignature(Landroid/content/Context;)Lcom/bumptech/glide/load/Key;
move-result-object v2
.line 33
invoke-interface {v1, v0, v2}, Ljava/util/concurrent/ConcurrentMap;->putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Lcom/bumptech/glide/load/Key;
if-nez p0, :cond_1b
goto :goto_1c
:cond_1b
move-object v2, p0
:cond_1c
:goto_1c
return-object v2
.end method
.method private static obtainVersionSignature(Landroid/content/Context;)Lcom/bumptech/glide/load/Key;
.registers 2
.line 50
invoke-static {p0}, Lcom/bumptech/glide/signature/ApplicationVersionSignature;->getPackageInfo(Landroid/content/Context;)Landroid/content/pm/PackageInfo;
move-result-object p0
.line 51
invoke-static {p0}, Lcom/bumptech/glide/signature/ApplicationVersionSignature;->getVersionCode(Landroid/content/pm/PackageInfo;)Ljava/lang/String;
move-result-object p0
.line 52
new-instance v0, Lcom/bumptech/glide/signature/ObjectKey;
invoke-direct {v0, p0}, Lcom/bumptech/glide/signature/ObjectKey;-><init>(Ljava/lang/Object;)V
return-object v0
.end method
.method static reset()V
.registers 1
.line 45
sget-object v0, Lcom/bumptech/glide/signature/ApplicationVersionSignature;->PACKAGE_NAME_TO_KEY:Ljava/util/concurrent/ConcurrentMap;
invoke-interface {v0}, Ljava/util/concurrent/ConcurrentMap;->clear()V
return-void
.end method