cey.smali

.class public Ldxoptimizer/cey;
.super Ljava/lang/Object;
.source "StorageUtils.java"


# annotations
.annotation build Landroid/annotation/SuppressLint;
    value = {
        "WrongConstant"
    }
.end annotation


# static fields
.field private static final a:[Ljava/lang/String;

.field private static final b:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .registers 3

    .prologue
    .line 37
    const/4 v0, 0x1

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    const-string v2, "com.sec.knox.containeragent"

    aput-object v2, v0, v1

    sput-object v0, Ldxoptimizer/cey;->a:[Ljava/lang/String;

    .line 233
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-static {}, Ldxoptimizer/cey;->h()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, "/external_sd"

    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 v0

    sput-object v0, Ldxoptimizer/cey;->b:Ljava/lang/String;

    return-void
.end method

.method public static a(Landroid/content/Context;Ljava/lang/String;)J
    .registers 8

    .prologue
    const-wide/16 v0, 0x0

    const/4 v4, 0x1

    const/4 v5, 0x0

    .line 273
    sget v2, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v3, 0x19

    if-le v2, v3, :cond_10

    .line 274
    const/4 v0, 0x7

    invoke-static {p0, p1, v0}, Ldxoptimizer/cey;->a(Landroid/content/Context;Ljava/lang/String;I)J

    move-result-wide v0

    .line 302
    :cond_f
    :goto_f
    return-wide v0

    .line 276
    :cond_10
    invoke-static {p0}, Ldxoptimizer/cfb;->a(Landroid/content/Context;)Landroid/content/pm/PackageManager;

    move-result-object v2

    .line 277
    if-eqz v2, :cond_f

    .line 280
    new-instance v3, Ljava/util/concurrent/CountDownLatch;

    invoke-direct {v3, v4}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    .line 281
    new-array v4, v4, [J

    aput-wide v0, v4, v5

    .line 283
    new-instance v0, Ldxoptimizer/cey$1;

    invoke-direct {v0, v4, v3}, Ldxoptimizer/cey$1;-><init>([JLjava/util/concurrent/CountDownLatch;)V

    invoke-static {v2, p1, v0}, Ldxoptimizer/qb;->a(Landroid/content/pm/PackageManager;Ljava/lang/String;Landroid/content/pm/IPackageStatsObserver;)Z

    move-result v0

    .line 293
    if-eqz v0, :cond_2d

    .line 295
    :try_start_2a
    invoke-virtual {v3}, Ljava/util/concurrent/CountDownLatch;->await()V
    :try_end_2d
    .catch Ljava/lang/InterruptedException; {:try_start_2a .. :try_end_2d} :catch_30

    .line 302
    :cond_2d
    :goto_2d
    aget-wide v0, v4, v5

    goto :goto_f

    .line 296
    :catch_30
    move-exception v0

    .line 297
    const-string v1, "StorageUtils"

    const-string v2, "Unexpected interruption"

    invoke-static {v1, v2, v0}, Ldxoptimizer/afo;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2d
.end method

.method private static a(Landroid/content/Context;Ljava/lang/String;I)J
    .registers 11
    .annotation build Landroid/annotation/TargetApi;
        value = 0x18
    .end annotation

    .prologue
    const-wide/16 v2, 0x0

    .line 65
    invoke-static {p0}, Ldxoptimizer/cey;->b(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_9

    .line 119
    :cond_8
    :goto_8
    return-wide v2

    .line 68
    :cond_9
    invoke-static {p0}, Ldxoptimizer/cfb;->a(Landroid/content/Context;)Landroid/content/pm/PackageManager;

    move-result-object v1

    .line 69
    if-eqz v1, :cond_8

    .line 72
    const-string v0, "storagestats"

    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v4

    .line 73
    if-eqz v4, :cond_8

    .line 76
    const-string v0, "storage"

    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/storage/StorageManager;

    .line 77
    if-eqz v0, :cond_8

    .line 81
    invoke-virtual {v0}, Landroid/os/storage/StorageManager;->getStorageVolumes()Ljava/util/List;

    move-result-object v0

    .line 84
    const/16 v5, 0x80

    :try_start_27
    invoke-virtual {v1, p1, v5}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;

    move-result-object v1

    .line 85
    iget v5, v1, Landroid/content/pm/ApplicationInfo;->uid:I
    :try_end_2d
    .catch Ljava/lang/Exception; {:try_start_27 .. :try_end_2d} :catch_6d

    .line 91
    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :cond_31
    :goto_31
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_8

    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/storage/StorageVolume;

    .line 92
    invoke-virtual {v0}, Landroid/os/storage/StorageVolume;->getUuid()Ljava/lang/String;

    move-result-object v1

    .line 93
    const/4 v0, 0x0

    .line 94
    if-eqz v1, :cond_48

    .line 96
    :try_start_44
    invoke-static {v1}, Ljava/util/UUID;->fromString(Ljava/lang/String;)Ljava/util/UUID;
    :try_end_47
    .catch Ljava/lang/IllegalArgumentException; {:try_start_44 .. :try_end_47} :catch_6b

    move-result-object v0

    .line 101
    :cond_48
    :goto_48
    if-nez v0, :cond_50

    .line 102
    invoke-static {}, Ldxoptimizer/qb;->b()Ljava/util/UUID;

    move-result-object v0

    .line 103
    if-eqz v0, :cond_31

    .line 108
    :cond_50
    invoke-static {v4, v0, v5}, Ldxoptimizer/qb;->a(Ljava/lang/Object;Ljava/util/UUID;I)Ldxoptimizer/qg;

    move-result-object v7

    .line 109
    and-int/lit8 v0, p2, 0x1

    if-eqz v0, :cond_6f

    .line 110
    iget-wide v0, v7, Ldxoptimizer/qg;->a:J

    add-long/2addr v0, v2

    .line 112
    :goto_5b
    and-int/lit8 v2, p2, 0x2

    if-eqz v2, :cond_62

    .line 113
    iget-wide v2, v7, Ldxoptimizer/qg;->b:J

    add-long/2addr v0, v2

    .line 115
    :cond_62
    and-int/lit8 v2, p2, 0x4

    if-eqz v2, :cond_69

    .line 116
    iget-wide v2, v7, Ldxoptimizer/qg;->c:J

    add-long/2addr v0, v2

    :cond_69
    move-wide v2, v0

    .line 118
    goto :goto_31

    .line 97
    :catch_6b
    move-exception v1

    goto :goto_48

    .line 86
    :catch_6d
    move-exception v0

    goto :goto_8

    :cond_6f
    move-wide v0, v2

    goto :goto_5b
.end method

.method public static a(Landroid/content/Context;Ljava/lang/String;Z)J
    .registers 11
    .annotation build Landroid/annotation/TargetApi;
        value = 0x11
    .end annotation

    .prologue
    const-wide/16 v0, 0x0

    const/4 v5, 0x1

    const/4 v2, 0x0

    .line 387
    sget v3, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v4, 0x19

    if-le v3, v4, :cond_10

    .line 388
    const/4 v0, 0x4

    invoke-static {p0, p1, v0}, Ldxoptimizer/cey;->a(Landroid/content/Context;Ljava/lang/String;I)J

    move-result-wide v0

    .line 459
    :cond_f
    :goto_f
    return-wide v0

    .line 390
    :cond_10
    invoke-static {p0}, Ldxoptimizer/cfb;->a(Landroid/content/Context;)Landroid/content/pm/PackageManager;

    move-result-object v3

    .line 391
    if-eqz v3, :cond_f

    .line 394
    new-instance v4, Ljava/util/concurrent/CountDownLatch;

    invoke-direct {v4, v5}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    .line 395
    new-array v5, v5, [J

    aput-wide v0, v5, v2

    .line 398
    sget-object v1, Ldxoptimizer/cey;->a:[Ljava/lang/String;

    array-length v6, v1

    move v0, v2

    :goto_23
    if-ge v0, v6, :cond_33

    aget-object v7, v1, v0

    .line 399
    invoke-virtual {v7, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_30

    .line 400
    aget-wide v0, v5, v2

    goto :goto_f

    .line 398
    :cond_30
    add-int/lit8 v0, v0, 0x1

    goto :goto_23

    .line 405
    :cond_33
    new-instance v0, Ldxoptimizer/cey$3;

    invoke-direct {v0, v5, p2, p1, v4}, Ldxoptimizer/cey$3;-><init>([JZLjava/lang/String;Ljava/util/concurrent/CountDownLatch;)V

    invoke-static {v3, p1, v0}, Ldxoptimizer/qb;->a(Landroid/content/pm/PackageManager;Ljava/lang/String;Landroid/content/pm/IPackageStatsObserver;)Z

    move-result v0

    .line 450
    if-eqz v0, :cond_41

    .line 452
    :try_start_3e
    invoke-virtual {v4}, Ljava/util/concurrent/CountDownLatch;->await()V
    :try_end_41
    .catch Ljava/lang/InterruptedException; {:try_start_3e .. :try_end_41} :catch_44

    .line 459
    :cond_41
    :goto_41
    aget-wide v0, v5, v2

    goto :goto_f

    .line 453
    :catch_44
    move-exception v0

    .line 454
    const-string v1, "StorageUtils"

    const-string v3, "Unexpected interruption"

    invoke-static {v1, v3, v0}, Ldxoptimizer/afo;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_41
.end method

.method public static a()Ljava/lang/String;
    .registers 1

    .prologue
    .line 126
    invoke-static {}, Landroid/os/Environment;->getDataDirectory()Ljava/io/File;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static a(Landroid/content/Context;)V
    .registers 7

    .prologue
    .line 463
    invoke-static {p0}, Ldxoptimizer/cfb;->a(Landroid/content/Context;)Landroid/content/pm/PackageManager;

    move-result-object v0

    .line 464
    if-nez v0, :cond_7

    .line 498
    :cond_6
    :goto_6
    return-void

    .line 467
    :cond_7
    invoke-static {}, Ldxoptimizer/cey;->c()J

    move-result-wide v2

    const-wide/16 v4, 0x1

    sub-long/2addr v2, v4

    .line 468
    new-instance v1, Ljava/util/concurrent/CountDownLatch;

    const/4 v4, 0x1

    invoke-direct {v1, v4}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    .line 469
    new-instance v4, Ldxoptimizer/cey$4;

    invoke-direct {v4, v0, v1}, Ldxoptimizer/cey$4;-><init>(Landroid/content/pm/PackageManager;Ljava/util/concurrent/CountDownLatch;)V

    invoke-static {v0, v2, v3, v4}, Ldxoptimizer/qb;->a(Landroid/content/pm/PackageManager;JLandroid/content/pm/IPackageDataObserver;)Z

    move-result v0

    .line 490
    if-eqz v0, :cond_6

    .line 492
    :try_start_1f
    invoke-virtual {v1}, Ljava/util/concurrent/CountDownLatch;->await()V
    :try_end_22
    .catch Ljava/lang/InterruptedException; {:try_start_1f .. :try_end_22} :catch_23

    goto :goto_6

    .line 493
    :catch_23
    move-exception v0

    .line 494
    const-string v1, "StorageUtils"

    const-string v2, "Unexpected interruption"

    invoke-static {v1, v2, v0}, Ldxoptimizer/afo;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_6
.end method

.method public static b()J
    .registers 4

    .prologue
    .line 133
    new-instance v0, Landroid/os/StatFs;

    invoke-static {}, Ldxoptimizer/cey;->a()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/StatFs;-><init>(Ljava/lang/String;)V

    .line 134
    invoke-virtual {v0}, Landroid/os/StatFs;->getBlockSize()I

    move-result v1

    int-to-long v2, v1

    invoke-virtual {v0}, Landroid/os/StatFs;->getAvailableBlocks()I

    move-result v0

    int-to-long v0, v0

    mul-long/2addr v0, v2

    return-wide v0
.end method

.method public static b(Landroid/content/Context;Ljava/lang/String;)J
    .registers 8

    .prologue
    const-wide/16 v0, 0x0

    const/4 v5, 0x0

    const/4 v4, 0x1

    .line 348
    sget v2, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v3, 0x19

    if-le v2, v3, :cond_f

    .line 349
    invoke-static {p0, p1, v4}, Ldxoptimizer/cey;->a(Landroid/content/Context;Ljava/lang/String;I)J

    move-result-wide v0

    .line 378
    :cond_e
    :goto_e
    return-wide v0

    .line 351
    :cond_f
    invoke-static {p0}, Ldxoptimizer/cfb;->a(Landroid/content/Context;)Landroid/content/pm/PackageManager;

    move-result-object v2

    .line 352
    if-eqz v2, :cond_e

    .line 355
    new-instance v3, Ljava/util/concurrent/CountDownLatch;

    invoke-direct {v3, v4}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    .line 356
    new-array v4, v4, [J

    aput-wide v0, v4, v5

    .line 359
    new-instance v0, Ldxoptimizer/cey$2;

    invoke-direct {v0, v4, v3}, Ldxoptimizer/cey$2;-><init>([JLjava/util/concurrent/CountDownLatch;)V

    invoke-static {v2, p1, v0}, Ldxoptimizer/qb;->a(Landroid/content/pm/PackageManager;Ljava/lang/String;Landroid/content/pm/IPackageStatsObserver;)Z

    move-result v0

    .line 369
    if-eqz v0, :cond_2c

    .line 371
    :try_start_29
    invoke-virtual {v3}, Ljava/util/concurrent/CountDownLatch;->await()V
    :try_end_2c
    .catch Ljava/lang/InterruptedException; {:try_start_29 .. :try_end_2c} :catch_2f

    .line 378
    :cond_2c
    :goto_2c
    aget-wide v0, v4, v5

    goto :goto_e

    .line 372
    :catch_2f
    move-exception v0

    .line 373
    const-string v1, "StorageUtils"

    const-string v2, "Unexpected interruption"

    invoke-static {v1, v2, v0}, Ldxoptimizer/afo;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2c
.end method

.method private static b(Landroid/content/Context;)Z
    .registers 7
    .annotation build Landroid/annotation/TargetApi;
        value = 0x17
    .end annotation

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 45
    const-string v0, "appops"

    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/AppOpsManager;

    .line 46
    if-nez v0, :cond_d

    .line 60
    :goto_c
    return v2

    .line 49
    :cond_d
    const-string v3, "android:get_usage_stats"

    .line 50
    invoke-static {}, Landroid/os/Process;->myUid()I

    move-result v4

    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v5

    .line 49
    invoke-virtual {v0, v3, v4, v5}, Landroid/app/AppOpsManager;->checkOpNoThrow(Ljava/lang/String;ILjava/lang/String;)I

    move-result v0

    .line 51
    const/4 v3, 0x3

    if-ne v3, v0, :cond_2c

    .line 52
    const/4 v0, -0x1

    .line 54
    :try_start_1f
    const-string v3, "android.permission.PACKAGE_USAGE_STATS"

    invoke-virtual {p0, v3}, Landroid/content/Context;->checkSelfPermission(Ljava/lang/String;)I
    :try_end_24
    .catch Ljava/lang/Throwable; {:try_start_1f .. :try_end_24} :catch_32

    move-result v0

    .line 58
    :goto_25
    if-nez v0, :cond_2a

    move v0, v1

    :goto_28
    move v2, v0

    goto :goto_c

    :cond_2a
    move v0, v2

    goto :goto_28

    .line 60
    :cond_2c
    if-nez v0, :cond_30

    :goto_2e
    move v2, v1

    goto :goto_c

    :cond_30
    move v1, v2

    goto :goto_2e

    .line 55
    :catch_32
    move-exception v3

    goto :goto_25
.end method

.method public static c()J
    .registers 4

    .prologue
    .line 141
    new-instance v0, Landroid/os/StatFs;

    invoke-static {}, Ldxoptimizer/cey;->a()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/StatFs;-><init>(Ljava/lang/String;)V

    .line 142
    invoke-virtual {v0}, Landroid/os/StatFs;->getBlockSize()I

    move-result v1

    int-to-long v2, v1

    invoke-virtual {v0}, Landroid/os/StatFs;->getBlockCount()I

    move-result v0

    int-to-long v0, v0

    mul-long/2addr v0, v2

    return-wide v0
.end method

.method public static d()I
    .registers 6

    .prologue
    .line 152
    invoke-static {}, Ldxoptimizer/cey;->c()J

    move-result-wide v0

    .line 153
    invoke-static {}, Ldxoptimizer/cey;->b()J

    move-result-wide v2

    .line 154
    const-wide/16 v4, 0x64

    mul-long/2addr v2, v4

    div-long v0, v2, v0

    long-to-int v0, v0

    return v0
.end method

.method public static e()I
    .registers 6

    .prologue
    .line 158
    invoke-static {}, Ldxoptimizer/cey;->g()Z

    move-result v0

    if-eqz v0, :cond_17

    .line 159
    invoke-static {}, Ldxoptimizer/cey;->j()J

    move-result-wide v0

    .line 160
    invoke-static {}, Ldxoptimizer/cey;->i()J

    move-result-wide v2

    .line 161
    sub-long v2, v0, v2

    const-wide/16 v4, 0x64

    mul-long/2addr v2, v4

    div-long v0, v2, v0

    long-to-int v0, v0

    .line 163
    :goto_16
    return v0

    :cond_17
    const/4 v0, 0x0

    goto :goto_16
.end method

.method public static f()I
    .registers 6

    .prologue
    .line 168
    invoke-static {}, Ldxoptimizer/cey;->g()Z

    move-result v0

    if-eqz v0, :cond_15

    .line 169
    invoke-static {}, Ldxoptimizer/cey;->j()J

    move-result-wide v0

    .line 170
    invoke-static {}, Ldxoptimizer/cey;->i()J

    move-result-wide v2

    .line 171
    const-wide/16 v4, 0x64

    mul-long/2addr v2, v4

    div-long v0, v2, v0

    long-to-int v0, v0

    .line 173
    :goto_14
    return v0

    :cond_15
    const/4 v0, 0x0

    goto :goto_14
.end method

.method public static g()Z
    .registers 2

    .prologue
    .line 182
    invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String;

    move-result-object v0

    const-string v1, "mounted"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public static h()Ljava/lang/String;
    .registers 1

    .prologue
    .line 189
    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static i()J
    .registers 4

    .prologue
    .line 205
    :try_start_0
    invoke-static {}, Ldxoptimizer/cey;->g()Z

    move-result v0

    if-eqz v0, :cond_1c

    .line 206
    new-instance v0, Landroid/os/StatFs;

    invoke-static {}, Ldxoptimizer/cey;->h()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/StatFs;-><init>(Ljava/lang/String;)V

    .line 207
    invoke-virtual {v0}, Landroid/os/StatFs;->getBlockSize()I

    move-result v1

    int-to-long v2, v1

    invoke-virtual {v0}, Landroid/os/StatFs;->getAvailableBlocks()I
    :try_end_17
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_17} :catch_1b

    move-result v0

    int-to-long v0, v0

    mul-long/2addr v0, v2

    .line 212
    :goto_1a
    return-wide v0

    .line 209
    :catch_1b
    move-exception v0

    .line 212
    :cond_1c
    const-wide/16 v0, -0x1

    goto :goto_1a
.end method

.method public static j()J
    .registers 6

    .prologue
    const-wide/16 v0, -0x1

    .line 221
    :try_start_2
    invoke-static {}, Ldxoptimizer/cey;->g()Z

    move-result v2

    if-eqz v2, :cond_22

    .line 222
    new-instance v2, Landroid/os/StatFs;

    invoke-static {}, Ldxoptimizer/cey;->h()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Landroid/os/StatFs;-><init>(Ljava/lang/String;)V

    .line 223
    invoke-virtual {v2}, Landroid/os/StatFs;->getBlockSize()I

    move-result v3

    int-to-long v4, v3

    invoke-virtual {v2}, Landroid/os/StatFs;->getBlockCount()I
    :try_end_19
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_19} :catch_25

    move-result v2

    int-to-long v2, v2

    mul-long/2addr v2, v4

    .line 224
    const-wide/16 v4, 0x0

    cmp-long v4, v2, v4

    if-nez v4, :cond_23

    .line 229
    :cond_22
    :goto_22
    return-wide v0

    :cond_23
    move-wide v0, v2

    .line 224
    goto :goto_22

    .line 226
    :catch_25
    move-exception v2

    goto :goto_22
.end method