StorageUtils.smali
.class public final Lcom/nostra13/universalimageloader/utils/StorageUtils;
.super Ljava/lang/Object;
.source "StorageUtils.java"
# static fields
.field private static final EXTERNAL_STORAGE_PERMISSION:Ljava/lang/String; = "android.permission.WRITE_EXTERNAL_STORAGE"
.field private static final INDIVIDUAL_DIR_NAME:Ljava/lang/String; = "uil-images"
# direct methods
.method private constructor <init>()V
.registers 1
.prologue
.line 39
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 40
return-void
.end method
.method public static getCacheDirectory(Landroid/content/Context;)Ljava/io/File;
.registers 2
.prologue
.line 53
const/4 v0, 0x1
invoke-static {p0, v0}, Lcom/nostra13/universalimageloader/utils/StorageUtils;->getCacheDirectory(Landroid/content/Context;Z)Ljava/io/File;
move-result-object v0
return-object v0
.end method
.method public static getCacheDirectory(Landroid/content/Context;Z)Ljava/io/File;
.registers 6
.prologue
.line 68
const/4 v0, 0x0
.line 69
if-eqz p1, :cond_13
const-string v1, "mounted"
.line 70
invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_13
.line 71
invoke-static {p0}, Lcom/nostra13/universalimageloader/utils/StorageUtils;->getExternalCacheDir(Landroid/content/Context;)Ljava/io/File;
move-result-object v0
.line 73
:cond_13
if-nez v0, :cond_19
.line 74
invoke-virtual {p0}, Landroid/content/Context;->getCacheDir()Ljava/io/File;
move-result-object v0
.line 76
:cond_19
if-nez v0, :cond_48
.line 77
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "/data/data/"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, "/cache/"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
.line 78
const-string v0, "Can\'t define system cache directory! \'%s\' will be used."
const/4 v2, 0x1
new-array v2, v2, [Ljava/lang/Object;
const/4 v3, 0x0
aput-object v1, v2, v3
invoke-static {v0, v2}, Lcom/nostra13/universalimageloader/utils/L;->w(Ljava/lang/String;[Ljava/lang/Object;)V
.line 79
new-instance v0, Ljava/io/File;
invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 81
:cond_48
return-object v0
.end method
.method private static getExternalCacheDir(Landroid/content/Context;)Ljava/io/File;
.registers 5
.prologue
const/4 v3, 0x0
.line 123
invoke-static {p0}, Lcom/nostra13/universalimageloader/utils/StorageUtils;->getExternalStorageCacheDir(Landroid/content/Context;)Ljava/io/File;
move-result-object v0
.line 124
if-eqz v0, :cond_1b
invoke-virtual {v0}, Ljava/io/File;->exists()Z
move-result v1
if-nez v1, :cond_1b
.line 125
invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z
move-result v1
if-nez v1, :cond_1c
.line 126
const-string v0, "Unable to create external cache directory"
new-array v1, v3, [Ljava/lang/Object;
invoke-static {v0, v1}, Lcom/nostra13/universalimageloader/utils/L;->w(Ljava/lang/String;[Ljava/lang/Object;)V
.line 127
const/4 v0, 0x0
.line 135
:cond_1b
:goto_1b
return-object v0
.line 130
:cond_1c
:try_start_1c
new-instance v1, Ljava/io/File;
const-string v2, ".nomedia"
invoke-direct {v1, v0, v2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/io/File;->createNewFile()Z
:try_end_26
.catch Ljava/io/IOException; {:try_start_1c .. :try_end_26} :catch_27
goto :goto_1b
.line 131
:catch_27
move-exception v1
.line 132
const-string v1, "Can\'t create \".nomedia\" file in application external cache directory"
new-array v2, v3, [Ljava/lang/Object;
invoke-static {v1, v2}, Lcom/nostra13/universalimageloader/utils/L;->i(Ljava/lang/String;[Ljava/lang/Object;)V
goto :goto_1b
.end method
.method public static getExternalStorageCacheDir(Landroid/content/Context;)Ljava/io/File;
.registers 5
.prologue
const/4 v0, 0x0
const/4 v3, 0x0
.line 139
.line 141
:try_start_2
invoke-static {p0}, Landroid/support/v4/content/ContextCompat;->getExternalCacheDirs(Landroid/content/Context;)[Ljava/io/File;
:try_end_5
.catch Ljava/lang/NullPointerException; {:try_start_2 .. :try_end_5} :catch_12
.catch Ljava/lang/SecurityException; {:try_start_2 .. :try_end_5} :catch_18
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_2 .. :try_end_5} :catch_1e
move-result-object v1
.line 152
:goto_6
if-eqz v1, :cond_11
array-length v2, v1
if-lez v2, :cond_11
aget-object v2, v1, v3
if-eqz v2, :cond_11
.line 153
aget-object v0, v1, v3
.line 155
:cond_11
return-object v0
.line 143
:catch_12
move-exception v1
.line 144
invoke-virtual {v1}, Ljava/lang/NullPointerException;->printStackTrace()V
move-object v1, v0
.line 149
goto :goto_6
.line 145
:catch_18
move-exception v1
.line 146
invoke-virtual {v1}, Ljava/lang/SecurityException;->printStackTrace()V
move-object v1, v0
.line 149
goto :goto_6
.line 147
:catch_1e
move-exception v1
.line 148
invoke-virtual {v1}, Ljava/lang/ArrayIndexOutOfBoundsException;->printStackTrace()V
move-object v1, v0
goto :goto_6
.end method
.method public static getIndividualCacheDirectory(Landroid/content/Context;)Ljava/io/File;
.registers 4
.prologue
.line 93
invoke-static {p0}, Lcom/nostra13/universalimageloader/utils/StorageUtils;->getCacheDirectory(Landroid/content/Context;)Ljava/io/File;
move-result-object v0
.line 94
new-instance v1, Ljava/io/File;
const-string v2, "uil-images"
invoke-direct {v1, v0, v2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
.line 95
invoke-virtual {v1}, Ljava/io/File;->exists()Z
move-result v2
if-nez v2, :cond_18
.line 96
invoke-virtual {v1}, Ljava/io/File;->mkdir()Z
move-result v2
if-nez v2, :cond_18
.line 100
:goto_17
return-object v0
:cond_18
move-object v0, v1
goto :goto_17
.end method
.method private static hasExternalStoragePermission(Landroid/content/Context;)Z
.registers 2
.prologue
.line 160
const-string v0, "android.permission.WRITE_EXTERNAL_STORAGE"
invoke-virtual {p0, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
move-result v0
.line 161
if-nez v0, :cond_a
const/4 v0, 0x1
:goto_9
return v0
:cond_a
const/4 v0, 0x0
goto :goto_9
.end method