cg.smali

.class public Lcom/tendcloud/tenddata/cg;
.super Ljava/lang/Object;
.source "td"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/tendcloud/tenddata/cg$a;
    }
.end annotation


# static fields
.field private static b:Ljava/lang/String;

.field private static volatile c:Lcom/tendcloud/tenddata/cg;


# instance fields
.field private final a:Ljava/util/concurrent/LinkedBlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/LinkedBlockingQueue<",
            "Landroid/os/IBinder;",
            ">;"
        }
    .end annotation
.end field

.field private d:Landroid/content/ServiceConnection;


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

    .line 1
    new-instance v0, Lcom/tendcloud/tenddata/cg;

    invoke-direct {v0}, Lcom/tendcloud/tenddata/cg;-><init>()V

    sput-object v0, Lcom/tendcloud/tenddata/cg;->c:Lcom/tendcloud/tenddata/cg;

    return-void
.end method

.method private constructor <init>()V
    .registers 3

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

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

    const/4 v1, 0x1

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

    iput-object v0, p0, Lcom/tendcloud/tenddata/cg;->a:Ljava/util/concurrent/LinkedBlockingQueue;

    .line 3
    new-instance v0, Lcom/tendcloud/tenddata/cg$1;

    invoke-direct {v0, p0}, Lcom/tendcloud/tenddata/cg$1;-><init>(Lcom/tendcloud/tenddata/cg;)V

    iput-object v0, p0, Lcom/tendcloud/tenddata/cg;->d:Landroid/content/ServiceConnection;

    return-void
.end method

.method private static a(Ljava/lang/String;Landroid/content/Context;Lcom/tendcloud/tenddata/cg$a;)Ljava/lang/String;
    .registers 11

    .line 7
    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v0

    .line 8
    sget-object v1, Lcom/tendcloud/tenddata/cg;->b:Ljava/lang/String;

    if-nez v1, :cond_53

    const/4 v1, 0x0

    .line 9
    :try_start_9
    invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object p1

    const/16 v2, 0x40

    invoke-virtual {p1, v0, v2}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object p1

    iget-object p1, p1, Landroid/content/pm/PackageInfo;->signatures:[Landroid/content/pm/Signature;
    :try_end_15
    .catch Ljava/lang/Throwable; {:try_start_9 .. :try_end_15} :catch_16

    goto :goto_17

    :catch_16
    move-object p1, v1

    :goto_17
    if-eqz p1, :cond_51

    .line 10
    array-length v2, p1

    if-lez v2, :cond_51

    const/4 v2, 0x0

    .line 11
    aget-object p1, p1, v2

    invoke-virtual {p1}, Landroid/content/pm/Signature;->toByteArray()[B

    move-result-object p1

    :try_start_23
    const-string v3, "SHA1"

    .line 12
    invoke-static {v3}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v3

    if-eqz v3, :cond_51

    .line 13
    invoke-virtual {v3, p1}, Ljava/security/MessageDigest;->digest([B)[B

    move-result-object p1

    .line 14
    new-instance v3, Ljava/lang/StringBuilder;

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

    .line 15
    array-length v4, p1

    :goto_35
    if-ge v2, v4, :cond_4d

    aget-byte v5, p1, v2

    and-int/lit16 v5, v5, 0xff

    or-int/lit16 v5, v5, 0x100

    .line 16
    invoke-static {v5}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

    move-result-object v5

    const/4 v6, 0x3

    const/4 v7, 0x1

    invoke-virtual {v5, v7, v6}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v5

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

    add-int/lit8 v2, v2, 0x1

    goto :goto_35

    .line 17
    :cond_4d
    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1
    :try_end_51
    .catch Ljava/lang/Throwable; {:try_start_23 .. :try_end_51} :catch_51

    .line 18
    :catch_51
    :cond_51
    sput-object v1, Lcom/tendcloud/tenddata/cg;->b:Ljava/lang/String;

    .line 19
    :cond_53
    sget-object p1, Lcom/tendcloud/tenddata/cg;->b:Ljava/lang/String;

    invoke-virtual {p2, v0, p1, p0}, Lcom/tendcloud/tenddata/cg$a;->getSerID(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    return-object p0
.end method

.method static synthetic a(Lcom/tendcloud/tenddata/cg;)Ljava/util/concurrent/LinkedBlockingQueue;
    .registers 1

    .line 1
    iget-object p0, p0, Lcom/tendcloud/tenddata/cg;->a:Ljava/util/concurrent/LinkedBlockingQueue;

    return-object p0
.end method

.method public static a(Landroid/content/Context;)Z
    .registers 3

    const/16 v0, 0x1d

    const/4 v1, 0x0

    .line 2
    :try_start_3
    invoke-static {v0}, Lcom/tendcloud/tenddata/af;->b(I)Z

    move-result v0

    if-eqz v0, :cond_a

    return v1

    .line 3
    :cond_a
    invoke-static {}, Lcom/tendcloud/tenddata/bz;->d()Z

    move-result v0

    if-nez v0, :cond_11

    return v1

    .line 4
    :cond_11
    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object p0

    const-string v0, "com.heytap.openid"

    .line 5
    invoke-virtual {p0, v0, v1}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object p0

    if-nez p0, :cond_1e

    return v1

    .line 6
    :cond_1e
    iget p0, p0, Landroid/content/pm/PackageInfo;->versionCode:I
    :try_end_20
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_20} :catch_25

    const/4 v0, 0x1

    if-ge p0, v0, :cond_24

    return v1

    :cond_24
    return v0

    :catch_25
    return v1
.end method

.method private b(Landroid/content/Context;)V
    .registers 6

    .line 1
    :try_start_0
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 2
    new-instance v1, Landroid/content/ComponentName;

    const-string v2, "com.heytap.openid"

    const-string v3, "com.heytap.openid.IdentifyService"

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

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    const-string v1, "action.com.heytap.openid.OPEN_ID_SERVICE"

    .line 3
    invoke-virtual {v0, v1}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;

    .line 4
    iget-object v1, p0, Lcom/tendcloud/tenddata/cg;->d:Landroid/content/ServiceConnection;

    const/4 v2, 0x1

    invoke-virtual {p1, v0, v1, v2}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z

    move-result v0

    if-eqz v0, :cond_60

    .line 5
    iget-object v0, p0, Lcom/tendcloud/tenddata/cg;->a:Ljava/util/concurrent/LinkedBlockingQueue;

    invoke-virtual {v0}, Ljava/util/concurrent/LinkedBlockingQueue;->take()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/IBinder;

    .line 6
    new-instance v1, Lcom/tendcloud/tenddata/cg$a;

    invoke-direct {v1, v0}, Lcom/tendcloud/tenddata/cg$a;-><init>(Landroid/os/IBinder;)V
    :try_end_2c
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_2c} :catch_60

    :try_start_2c
    const-string v0, "OUID"

    .line 7
    invoke-static {v0, p1, v1}, Lcom/tendcloud/tenddata/cg;->a(Ljava/lang/String;Landroid/content/Context;Lcom/tendcloud/tenddata/cg$a;)Ljava/lang/String;

    move-result-object v0

    .line 8
    invoke-static {}, Lcom/tendcloud/tenddata/df;->a()Lcom/tendcloud/tenddata/df;

    move-result-object v2

    invoke-virtual {v2, v0}, Lcom/tendcloud/tenddata/df;->setOAID(Ljava/lang/String;)V
    :try_end_39
    .catch Ljava/lang/Throwable; {:try_start_2c .. :try_end_39} :catch_39

    :catch_39
    :try_start_39
    const-string v0, "DUID"

    .line 9
    invoke-static {v0, p1, v1}, Lcom/tendcloud/tenddata/cg;->a(Ljava/lang/String;Landroid/content/Context;Lcom/tendcloud/tenddata/cg$a;)Ljava/lang/String;

    move-result-object v0

    .line 10
    invoke-static {}, Lcom/tendcloud/tenddata/df;->a()Lcom/tendcloud/tenddata/df;

    move-result-object v2

    invoke-virtual {v2, v0}, Lcom/tendcloud/tenddata/df;->setVAID(Ljava/lang/String;)V
    :try_end_46
    .catch Ljava/lang/Throwable; {:try_start_39 .. :try_end_46} :catch_46

    :catch_46
    :try_start_46
    const-string v0, "AUID"

    .line 11
    invoke-static {v0, p1, v1}, Lcom/tendcloud/tenddata/cg;->a(Ljava/lang/String;Landroid/content/Context;Lcom/tendcloud/tenddata/cg$a;)Ljava/lang/String;

    move-result-object v0

    .line 12
    invoke-static {}, Lcom/tendcloud/tenddata/df;->a()Lcom/tendcloud/tenddata/df;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/tendcloud/tenddata/df;->setAAID(Ljava/lang/String;)V
    :try_end_53
    .catch Ljava/lang/Throwable; {:try_start_46 .. :try_end_53} :catch_53
    .catchall {:try_start_46 .. :try_end_53} :catchall_59

    .line 13
    :catch_53
    :try_start_53
    iget-object v0, p0, Lcom/tendcloud/tenddata/cg;->d:Landroid/content/ServiceConnection;

    invoke-virtual {p1, v0}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
    :try_end_58
    .catch Ljava/lang/Throwable; {:try_start_53 .. :try_end_58} :catch_60

    goto :goto_60

    :catchall_59
    move-exception v0

    :try_start_5a
    iget-object v1, p0, Lcom/tendcloud/tenddata/cg;->d:Landroid/content/ServiceConnection;

    invoke-virtual {p1, v1}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
    :try_end_5f
    .catch Ljava/lang/Throwable; {:try_start_5a .. :try_end_5f} :catch_5f

    .line 14
    :catch_5f
    :try_start_5f
    throw v0
    :try_end_60
    .catch Ljava/lang/Throwable; {:try_start_5f .. :try_end_60} :catch_60

    :catch_60
    :cond_60
    :goto_60
    return-void
.end method

.method public static bindONEPLUSServiceGetOAID(Landroid/content/Context;)V
    .registers 2

    .line 1
    sget-object v0, Lcom/tendcloud/tenddata/cg;->c:Lcom/tendcloud/tenddata/cg;

    invoke-direct {v0, p0}, Lcom/tendcloud/tenddata/cg;->b(Landroid/content/Context;)V

    return-void
.end method