OaidClient.smali

.class public Lcom/appsflyer/oaid/OaidClient;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/appsflyer/oaid/OaidClient$Info;
    }
.end annotation


# instance fields
.field private final context:Landroid/content/Context;

.field private final logger:Ljava/util/logging/Logger;

.field private final timeout:J

.field private final unit:Ljava/util/concurrent/TimeUnit;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 5

    .line 7
    sget-object v0, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    const-wide/16 v1, 0x1

    invoke-direct {p0, p1, v1, v2, v0}, Lcom/appsflyer/oaid/OaidClient;-><init>(Landroid/content/Context;JLjava/util/concurrent/TimeUnit;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;JLjava/util/concurrent/TimeUnit;)V
    .registers 6

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

    const-string v0, "AppsFlyerOaid6.2.4"

    .line 2
    invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;

    move-result-object v0

    iput-object v0, p0, Lcom/appsflyer/oaid/OaidClient;->logger:Ljava/util/logging/Logger;

    .line 3
    iput-object p1, p0, Lcom/appsflyer/oaid/OaidClient;->context:Landroid/content/Context;

    .line 4
    iput-wide p2, p0, Lcom/appsflyer/oaid/OaidClient;->timeout:J

    .line 5
    iput-object p4, p0, Lcom/appsflyer/oaid/OaidClient;->unit:Ljava/util/concurrent/TimeUnit;

    .line 6
    sget-object p1, Ljava/util/logging/Level;->OFF:Ljava/util/logging/Level;

    invoke-virtual {v0, p1}, Ljava/util/logging/Logger;->setLevel(Ljava/util/logging/Level;)V

    return-void
.end method

.method public static INVOKEVIRTUAL_com_appsflyer_oaid_OaidClient_com_shopee_app_asm_fix_androidx_ThreadFixer_start(Ljava/lang/Thread;)V
    .registers 3

    .line 1
    :try_start_0
    invoke-static {}, Lcom/shopee/app/asm/fix/androidx/b;->b()Z

    move-result v0

    if-eqz v0, :cond_12

    .line 2
    invoke-static {p0}, Lcom/shopee/app/asm/fix/androidx/b;->a(Ljava/lang/Thread;)V
    :try_end_9
    .catchall {:try_start_0 .. :try_end_9} :catchall_a

    goto :goto_12

    :catchall_a
    move-exception v0

    .line 3
    invoke-static {}, Lcom/shopee/app/apm/c;->d()Lcom/shopee/app/apm/nonfatal/a;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/shopee/app/apm/nonfatal/a;->c(Ljava/lang/Throwable;)V

    .line 4
    :cond_12
    :goto_12
    invoke-virtual {p0}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method public static INVOKEVIRTUAL_com_appsflyer_oaid_OaidClient_com_shopee_app_asm_fix_androidx_ThreadFixer_start1(Ljava/lang/Thread;)V
    .registers 3

    .line 1
    :try_start_0
    instance-of v0, p0, Ljava/lang/Thread;

    if-eqz v0, :cond_25

    .line 2
    new-instance v0, Lcom/shopee/app/asm/anr/threadpool/d;

    invoke-direct {v0, p0}, Lcom/shopee/app/asm/anr/threadpool/d;-><init>(Ljava/lang/Thread;)V

    .line 3
    sget-object v1, Lcom/shopee/app/asm/fix/threadpool/config/a;->a:Lcom/shopee/app/asm/fix/threadpool/config/a;

    invoke-virtual {v1}, Lcom/shopee/app/asm/fix/threadpool/config/a;->a()Z

    move-result v1

    if-eqz v1, :cond_1b

    .line 4
    sget-object v1, Lcom/shopee/app/asm/fix/threadpool/pool/d;->a:Lcom/shopee/app/asm/fix/threadpool/pool/d;

    invoke-virtual {v1}, Lcom/shopee/app/asm/fix/threadpool/pool/d;->a()Ljava/util/concurrent/ExecutorService;

    move-result-object v1

    invoke-interface {v1, v0}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V

    return-void

    .line 5
    :cond_1b
    sget-boolean v1, Lcom/shopee/app/asm/fix/threadpool/global/i;->f:Z

    if-eqz v1, :cond_25

    .line 6
    sget-object v1, Lcom/shopee/app/asm/fix/threadpool/global/i;->e:Lcom/shopee/app/asm/fix/threadpool/global/j;

    .line 7
    invoke-virtual {v1, v0}, Lcom/shopee/app/asm/anr/threadpool/b;->execute(Ljava/lang/Runnable;)V
    :try_end_24
    .catchall {:try_start_0 .. :try_end_24} :catchall_25

    return-void

    .line 8
    :catchall_25
    :cond_25
    invoke-static {p0}, Lcom/appsflyer/oaid/OaidClient;->INVOKEVIRTUAL_com_appsflyer_oaid_OaidClient_com_shopee_app_asm_fix_androidx_ThreadFixer_start(Ljava/lang/Thread;)V

    return-void
.end method

.method public static synthetic access$000(Lcom/appsflyer/oaid/OaidClient;)Landroid/content/Context;
    .registers 1

    iget-object p0, p0, Lcom/appsflyer/oaid/OaidClient;->context:Landroid/content/Context;

    return-object p0
.end method

.method private fetchHuawei()Lcom/appsflyer/oaid/OaidClient$Info;
    .registers 5

    .line 1
    :try_start_0
    new-instance v0, Ljava/util/concurrent/FutureTask;

    new-instance v1, Lcom/appsflyer/oaid/OaidClient$1;

    invoke-direct {v1, p0}, Lcom/appsflyer/oaid/OaidClient$1;-><init>(Lcom/appsflyer/oaid/OaidClient;)V

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

    .line 2
    new-instance v1, Ljava/lang/Thread;

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

    invoke-static {v1}, Lcom/appsflyer/oaid/OaidClient;->INVOKEVIRTUAL_com_appsflyer_oaid_OaidClient_com_shopee_app_asm_fix_androidx_ThreadFixer_start1(Ljava/lang/Thread;)V

    .line 3
    iget-wide v1, p0, Lcom/appsflyer/oaid/OaidClient;->timeout:J

    iget-object v3, p0, Lcom/appsflyer/oaid/OaidClient;->unit:Ljava/util/concurrent/TimeUnit;

    invoke-virtual {v0, v1, v2, v3}, Ljava/util/concurrent/FutureTask;->get(JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/appsflyer/oaid/OaidClient$Info;
    :try_end_1c
    .catchall {:try_start_0 .. :try_end_1c} :catchall_1d

    return-object v0

    :catchall_1d
    move-exception v0

    .line 4
    iget-object v1, p0, Lcom/appsflyer/oaid/OaidClient;->logger:Ljava/util/logging/Logger;

    invoke-virtual {v0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Ljava/util/logging/Logger;->info(Ljava/lang/String;)V

    const/4 v0, 0x0

    return-object v0
.end method

.method private static isHuawei()Z
    .registers 3

    const/4 v0, 0x0

    .line 1
    :try_start_1
    sget-object v1, Landroid/os/Build;->BRAND:Ljava/lang/String;

    const-string v2, "huawei"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v1

    if-nez v1, :cond_24

    const-string v1, "com.huawei.android.os.BuildEx$VERSION"

    .line 2
    invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v1

    const-string v2, "EMUI_SDK_INT"

    .line 3
    invoke-virtual {v1, v2}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;

    move-result-object v1

    const/4 v2, 0x0

    .line 4
    invoke-virtual {v1, v2}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Integer;

    .line 5
    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v1
    :try_end_22
    .catch Ljava/lang/ClassNotFoundException; {:try_start_1 .. :try_end_22} :catch_25
    .catch Ljava/lang/NoSuchFieldException; {:try_start_1 .. :try_end_22} :catch_25
    .catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_22} :catch_25

    if-lez v1, :cond_25

    :cond_24
    const/4 v0, 0x1

    :catch_25
    :cond_25
    return v0
.end method

.method private static isMsaAvailableAtRuntime()Z
    .registers 1

    :try_start_0
    const-class v0, Lcom/bun/miitmdid/interfaces/IIdentifierListener;
    :try_end_2
    .catch Ljava/lang/NoClassDefFoundError; {:try_start_0 .. :try_end_2} :catch_4

    const/4 v0, 0x1

    return v0

    :catch_4
    const/4 v0, 0x0

    return v0
.end method


# virtual methods
.method public fetch()Lcom/appsflyer/oaid/OaidClient$Info;
    .registers 9

    const/4 v0, 0x0

    .line 1
    :try_start_1
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    .line 2
    invoke-static {}, Lcom/appsflyer/oaid/OaidClient;->isHuawei()Z

    move-result v3

    if-eqz v3, :cond_10

    invoke-direct {p0}, Lcom/appsflyer/oaid/OaidClient;->fetchHuawei()Lcom/appsflyer/oaid/OaidClient$Info;

    move-result-object v3

    goto :goto_24

    .line 3
    :cond_10
    invoke-static {}, Lcom/appsflyer/oaid/OaidClient;->isMsaAvailableAtRuntime()Z

    move-result v3

    if-eqz v3, :cond_23

    .line 4
    iget-object v3, p0, Lcom/appsflyer/oaid/OaidClient;->context:Landroid/content/Context;

    iget-object v4, p0, Lcom/appsflyer/oaid/OaidClient;->logger:Ljava/util/logging/Logger;

    iget-wide v5, p0, Lcom/appsflyer/oaid/OaidClient;->timeout:J

    iget-object v7, p0, Lcom/appsflyer/oaid/OaidClient;->unit:Ljava/util/concurrent/TimeUnit;

    invoke-static {v3, v4, v5, v6, v7}, Lcom/appsflyer/oaid/OaidMsaClient;->fetchMsa(Landroid/content/Context;Ljava/util/logging/Logger;JLjava/util/concurrent/TimeUnit;)Lcom/appsflyer/oaid/OaidClient$Info;

    move-result-object v3

    goto :goto_24

    :cond_23
    move-object v3, v0

    .line 5
    :goto_24
    iget-object v4, p0, Lcom/appsflyer/oaid/OaidClient;->logger:Ljava/util/logging/Logger;

    new-instance v5, Ljava/lang/StringBuilder;

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

    const-string v6, "Fetch "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v6

    sub-long/2addr v6, v1

    invoke-virtual {v5, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v1, " ms"

    invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v4, v1}, Ljava/util/logging/Logger;->info(Ljava/lang/String;)V
    :try_end_44
    .catchall {:try_start_1 .. :try_end_44} :catchall_45

    return-object v3

    :catchall_45
    move-exception v1

    .line 6
    iget-object v2, p0, Lcom/appsflyer/oaid/OaidClient;->logger:Ljava/util/logging/Logger;

    invoke-virtual {v1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v2, v1}, Ljava/util/logging/Logger;->info(Ljava/lang/String;)V

    return-object v0
.end method

.method public setLogging(Z)V
    .registers 3

    iget-object v0, p0, Lcom/appsflyer/oaid/OaidClient;->logger:Ljava/util/logging/Logger;

    if-eqz p1, :cond_6

    const/4 p1, 0x0

    goto :goto_8

    :cond_6
    sget-object p1, Ljava/util/logging/Level;->OFF:Ljava/util/logging/Level;

    :goto_8
    invoke-virtual {v0, p1}, Ljava/util/logging/Logger;->setLevel(Ljava/util/logging/Level;)V

    return-void
.end method