MMCVideoCacheUtil.smali

.class public Lcom/mmc/player/videocache/MMCVideoCacheUtil;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCInnerPreloadListener;,
        Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCPreloadListener;
    }
.end annotation


# static fields
.field public static final MMC_CACHE_MAX_SIZE:Ljava/lang/String; = "max-dir-size"

.field public static final MMC_CACHE_PATH:Ljava/lang/String; = "cache-dir-path"

.field private static final cacheMap:Ljava/util/concurrent/ConcurrentHashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/ConcurrentHashMap<",
            "Ljava/lang/String;",
            "Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCPreloadListener;",
            ">;"
        }
    .end annotation
.end field

.field private static final configUpdate:Lcom/mmc/player/config/MMCConfigManager$ConfigUpdate;


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

    .line 1
    invoke-static {}, Lcom/mmc/player/MMCPlayerNative;->tryLoadMMCPlaySo()V

    .line 2
    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

    invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V

    sput-object v0, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->cacheMap:Ljava/util/concurrent/ConcurrentHashMap;

    .line 3
    sget-object v0, Lcom/mmc/player/videocache/a;->a:Lcom/mmc/player/videocache/a;

    sput-object v0, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->configUpdate:Lcom/mmc/player/config/MMCConfigManager$ConfigUpdate;

    return-void
.end method

.method public constructor <init>()V
    .registers 1

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

    return-void
.end method

.method public static INVOKEVIRTUAL_com_mmc_player_videocache_MMCVideoCacheUtil_com_shopee_app_asm_fix_printstack_PrintStackTraceShieldFix_printStackTrace(Ljava/lang/Throwable;)V
    .registers 1

    return-void
.end method

.method public static synthetic a()V
    .registers 0

    invoke-static {}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->lambda$static$0()V

    return-void
.end method

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

    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->replaceUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_abort(Ljava/lang/String;)V

    return-void
.end method

.method public static synthetic access$000()Ljava/util/concurrent/ConcurrentHashMap;
    .registers 1

    sget-object v0, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->cacheMap:Ljava/util/concurrent/ConcurrentHashMap;

    return-object v0
.end method

.method public static cache(Ljava/lang/String;JLjava/lang/String;)V
    .registers 4

    .line 1
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->replaceUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    .line 2
    invoke-static {p0, p1, p2, p3}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_cache(Ljava/lang/String;JLjava/lang/String;)V

    return-void
.end method

.method public static cache(Ljava/lang/String;JLjava/lang/String;Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCPreloadListener;)V
    .registers 6

    .line 3
    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_7

    return-void

    .line 4
    :cond_7
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->replaceUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    .line 5
    sget-object v0, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->cacheMap:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v0, p0, p4}, Ljava/util/concurrent/ConcurrentHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 6
    new-instance v0, Lcom/mmc/player/videocache/MMCVideoCacheUtil$1;

    invoke-direct {v0, p4, p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil$1;-><init>(Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCPreloadListener;Ljava/lang/String;)V

    invoke-static {p0, p1, p2, p3, v0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_cache(Ljava/lang/String;JLjava/lang/String;Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCInnerPreloadListener;)V

    return-void
.end method

.method public static config(Ljava/util/HashMap;)Z
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/HashMap<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;)Z"
        }
    .end annotation

    :try_start_0
    const-string v0, "mmc_cache_use_new_get_api"

    .line 1
    sget-object v1, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->configUpdate:Lcom/mmc/player/config/MMCConfigManager$ConfigUpdate;

    invoke-static {v0, v1}, Lcom/mmc/player/config/MMCConfigManager;->registerKeyChangeListener(Ljava/lang/String;Lcom/mmc/player/config/MMCConfigManager$ConfigUpdate;)V

    .line 2
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_config(Ljava/util/HashMap;)Z

    move-result p0
    :try_end_b
    .catchall {:try_start_0 .. :try_end_b} :catchall_c

    goto :goto_11

    :catchall_c
    move-exception p0

    .line 3
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->INVOKEVIRTUAL_com_mmc_player_videocache_MMCVideoCacheUtil_com_shopee_app_asm_fix_printstack_PrintStackTraceShieldFix_printStackTrace(Ljava/lang/Throwable;)V

    const/4 p0, 0x0

    :goto_11
    return p0
.end method

.method public static deleteAllCache(Z)V
    .registers 1

    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_deleteAllCache(Z)V

    return-void
.end method

.method public static getCached(Ljava/lang/String;)Landroid/util/Pair;
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Landroid/util/Pair<",
            "Ljava/lang/Long;",
            "Ljava/lang/Long;",
            ">;"
        }
    .end annotation

    .line 1
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->replaceUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    .line 2
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_getRequestLength(Ljava/lang/String;)J

    move-result-wide v0

    .line 3
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_getCachedLength(Ljava/lang/String;)J

    move-result-wide v2

    .line 4
    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p0

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    invoke-static {p0, v0}, Landroid/util/Pair;->create(Ljava/lang/Object;Ljava/lang/Object;)Landroid/util/Pair;

    move-result-object p0

    return-object p0
.end method

.method private static synthetic lambda$static$0()V
    .registers 1

    const-string v0, "mmc_cache_use_new_get_api"

    .line 1
    invoke-static {v0}, Lcom/mmc/player/config/MMCConfigManager;->getBooleanForKey(Ljava/lang/String;)Z

    move-result v0

    .line 2
    invoke-static {v0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->setUseNewGetApi(Z)V

    return-void
.end method

.method private static native native_abort(Ljava/lang/String;)V
.end method

.method private static native native_cache(Ljava/lang/String;JLjava/lang/String;)V
.end method

.method private static native native_cache(Ljava/lang/String;JLjava/lang/String;Lcom/mmc/player/videocache/MMCVideoCacheUtil$MMCInnerPreloadListener;)V
.end method

.method private static native native_config(Ljava/util/HashMap;)Z
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/HashMap<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;)Z"
        }
    .end annotation
.end method

.method private static native native_deleteAllCache(Z)V
.end method

.method private static native native_getCachedLength(Ljava/lang/String;)J
.end method

.method private static native native_getRequestLength(Ljava/lang/String;)J
.end method

.method private static native native_set_use_new_get_api(Z)V
.end method

.method public static replaceUrl(Ljava/lang/String;)Ljava/lang/String;
    .registers 3

    .line 1
    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_9

    const-string p0, ""

    return-object p0

    :cond_9
    const-string v0, "https:"

    const-string v1, "http:"

    .line 2
    invoke-virtual {p0, v0, v1}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;

    move-result-object p0

    return-object p0
.end method

.method public static setUseNewGetApi(Z)V
    .registers 1

    .line 1
    :try_start_0
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->native_set_use_new_get_api(Z)V
    :try_end_3
    .catchall {:try_start_0 .. :try_end_3} :catchall_4

    goto :goto_8

    :catchall_4
    move-exception p0

    .line 2
    invoke-static {p0}, Lcom/mmc/player/videocache/MMCVideoCacheUtil;->INVOKEVIRTUAL_com_mmc_player_videocache_MMCVideoCacheUtil_com_shopee_app_asm_fix_printstack_PrintStackTraceShieldFix_printStackTrace(Ljava/lang/Throwable;)V

    :goto_8
    return-void
.end method