c0.smali

.class public final Lcom/google/android/exoplayer2/util/c0;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/google/android/exoplayer2/util/c0$b;,
        Lcom/google/android/exoplayer2/util/c0$c;,
        Lcom/google/android/exoplayer2/util/c0$a;
    }
.end annotation


# static fields
.field public static final a:Ljava/lang/Object;

.field public static final b:Ljava/lang/Object;

.field public static c:Z

.field public static d:J


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

    .line 1
    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lcom/google/android/exoplayer2/util/c0;->a:Ljava/lang/Object;

    .line 2
    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lcom/google/android/exoplayer2/util/c0;->b:Ljava/lang/Object;

    return-void
.end method

.method public static a()J
    .registers 20
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    sget-object v1, Lcom/google/android/exoplayer2/util/c0;->b:Ljava/lang/Object;

    monitor-enter v1

    .line 2
    :try_start_3
    monitor-exit v1
    :try_end_4
    .catchall {:try_start_3 .. :try_end_4} :catchall_ff

    const-string v0, "time.android.com"

    .line 3
    invoke-static {v0}, Ljava/net/InetAddress;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;

    move-result-object v0

    .line 4
    new-instance v1, Ljava/net/DatagramSocket;

    invoke-direct {v1}, Ljava/net/DatagramSocket;-><init>()V

    const/16 v2, 0x2710

    .line 5
    :try_start_11
    invoke-virtual {v1, v2}, Ljava/net/DatagramSocket;->setSoTimeout(I)V

    const/16 v2, 0x30

    new-array v3, v2, [B

    .line 6
    new-instance v4, Ljava/net/DatagramPacket;

    const/16 v5, 0x7b

    invoke-direct {v4, v3, v2, v0, v5}, Ljava/net/DatagramPacket;-><init>([BILjava/net/InetAddress;I)V

    const/16 v0, 0x1b

    const/4 v5, 0x0

    aput-byte v0, v3, v5

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

    move-result-wide v6

    .line 8
    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v8

    const-wide/16 v10, 0x0

    const/16 v0, 0x28

    const/16 v12, 0x18

    cmp-long v13, v6, v10

    if-nez v13, :cond_3c

    .line 9
    invoke-static {v3, v0, v2, v5}, Ljava/util/Arrays;->fill([BIIB)V

    move-object/from16 v19, v1

    goto :goto_a9

    :cond_3c
    const-wide/16 v10, 0x3e8

    .line 10
    div-long v13, v6, v10
    :try_end_40
    .catchall {:try_start_11 .. :try_end_40} :catchall_f3

    invoke-static {v13, v14}, Ljava/lang/Long;->signum(J)I

    mul-long v15, v13, v10

    sub-long v15, v6, v15

    const-wide v17, 0x83aa7e80L

    add-long v13, v13, v17

    const/16 v17, 0x29

    shr-long v10, v13, v12

    long-to-int v11, v10

    int-to-byte v10, v11

    :try_start_54
    aput-byte v10, v3, v0
    :try_end_56
    .catchall {:try_start_54 .. :try_end_56} :catchall_f3

    const/16 v10, 0x2a

    const/16 v11, 0x10

    move-object/from16 v19, v1

    shr-long v0, v13, v11

    long-to-int v1, v0

    int-to-byte v0, v1

    :try_start_60
    aput-byte v0, v3, v17

    const/16 v0, 0x2b

    const/16 v1, 0x8

    shr-long v11, v13, v1

    long-to-int v12, v11

    int-to-byte v11, v12

    aput-byte v11, v3, v10

    const/16 v10, 0x2c

    shr-long v11, v13, v5

    long-to-int v12, v11

    int-to-byte v11, v12

    aput-byte v11, v3, v0

    const-wide v11, 0x100000000L

    mul-long v15, v15, v11

    const-wide/16 v11, 0x3e8

    .line 11
    div-long/2addr v15, v11

    const/16 v0, 0x2d

    const/16 v11, 0x18

    shr-long v12, v15, v11

    long-to-int v11, v12

    int-to-byte v11, v11

    aput-byte v11, v3, v10

    const/16 v10, 0x2e

    const/16 v11, 0x10

    shr-long v11, v15, v11

    long-to-int v12, v11

    int-to-byte v11, v12

    aput-byte v11, v3, v0

    const/16 v0, 0x2f

    shr-long v11, v15, v1

    long-to-int v1, v11

    int-to-byte v1, v1

    aput-byte v1, v3, v10

    .line 12
    invoke-static {}, Ljava/lang/Math;->random()D

    move-result-wide v10

    const-wide v12, 0x406fe00000000000L    # 255.0

    mul-double v10, v10, v12

    double-to-int v1, v10

    int-to-byte v1, v1

    aput-byte v1, v3, v0
    :try_end_a9
    .catchall {:try_start_60 .. :try_end_a9} :catchall_ef

    :goto_a9
    move-object/from16 v1, v19

    .line 13
    :try_start_ab
    invoke-virtual {v1, v4}, Ljava/net/DatagramSocket;->send(Ljava/net/DatagramPacket;)V

    .line 14
    new-instance v0, Ljava/net/DatagramPacket;

    invoke-direct {v0, v3, v2}, Ljava/net/DatagramPacket;-><init>([BI)V

    .line 15
    invoke-virtual {v1, v0}, Ljava/net/DatagramSocket;->receive(Ljava/net/DatagramPacket;)V

    .line 16
    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v10

    sub-long v8, v10, v8

    add-long/2addr v8, v6

    aget-byte v0, v3, v5

    shr-int/lit8 v0, v0, 0x6

    and-int/lit8 v0, v0, 0x3

    int-to-byte v0, v0

    aget-byte v2, v3, v5

    and-int/lit8 v2, v2, 0x7

    int-to-byte v2, v2

    const/4 v4, 0x1

    aget-byte v4, v3, v4

    and-int/lit16 v4, v4, 0xff

    const/16 v5, 0x18

    .line 17
    invoke-static {v3, v5}, Lcom/google/android/exoplayer2/util/c0;->d([BI)J

    move-result-wide v5

    const/16 v7, 0x20

    .line 18
    invoke-static {v3, v7}, Lcom/google/android/exoplayer2/util/c0;->d([BI)J

    move-result-wide v12

    const/16 v7, 0x28

    .line 19
    invoke-static {v3, v7}, Lcom/google/android/exoplayer2/util/c0;->d([BI)J

    move-result-wide v14

    .line 20
    invoke-static {v0, v2, v4, v14, v15}, Lcom/google/android/exoplayer2/util/c0;->b(BBIJ)V

    sub-long/2addr v12, v5

    sub-long/2addr v14, v8

    add-long/2addr v14, v12

    const-wide/16 v2, 0x2

    .line 21
    div-long/2addr v14, v2
    :try_end_e9
    .catchall {:try_start_ab .. :try_end_e9} :catchall_f3

    add-long/2addr v8, v14

    sub-long/2addr v8, v10

    .line 22
    invoke-virtual {v1}, Ljava/net/DatagramSocket;->close()V

    return-wide v8

    :catchall_ef
    move-exception v0

    move-object/from16 v1, v19

    goto :goto_f4

    :catchall_f3
    move-exception v0

    :goto_f4
    move-object v2, v0

    .line 23
    :try_start_f5
    invoke-virtual {v1}, Ljava/net/DatagramSocket;->close()V
    :try_end_f8
    .catchall {:try_start_f5 .. :try_end_f8} :catchall_f9

    goto :goto_fe

    :catchall_f9
    move-exception v0

    move-object v1, v0

    invoke-virtual {v2, v1}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V

    :goto_fe
    throw v2

    :catchall_ff
    move-exception v0

    .line 24
    :try_start_100
    monitor-exit v1
    :try_end_101
    .catchall {:try_start_100 .. :try_end_101} :catchall_ff

    throw v0
.end method

.method public static b(BBIJ)V
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v0, 0x3

    if-eq p0, v0, :cond_37

    const/4 p0, 0x4

    if-eq p1, p0, :cond_16

    const/4 p0, 0x5

    if-ne p1, p0, :cond_a

    goto :goto_16

    .line 1
    :cond_a
    new-instance p0, Ljava/io/IOException;

    const-string p2, "SNTP: Untrusted mode: "

    .line 2
    invoke-static {p2, p1}, Landroidx/appcompat/widget/h;->a(Ljava/lang/String;I)Ljava/lang/String;

    move-result-object p1

    .line 3
    invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p0

    :cond_16
    :goto_16
    if-eqz p2, :cond_2b

    const/16 p0, 0xf

    if-gt p2, p0, :cond_2b

    const-wide/16 p0, 0x0

    cmp-long p2, p3, p0

    if-eqz p2, :cond_23

    return-void

    .line 4
    :cond_23
    new-instance p0, Ljava/io/IOException;

    const-string p1, "SNTP: Zero transmitTime"

    invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p0

    .line 5
    :cond_2b
    new-instance p0, Ljava/io/IOException;

    const-string p1, "SNTP: Untrusted stratum: "

    .line 6
    invoke-static {p1, p2}, Landroidx/appcompat/widget/h;->a(Ljava/lang/String;I)Ljava/lang/String;

    move-result-object p1

    .line 7
    invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p0

    .line 8
    :cond_37
    new-instance p0, Ljava/io/IOException;

    const-string p1, "SNTP: Unsynchronized server"

    invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method public static c([BI)J
    .registers 7

    .line 1
    aget-byte v0, p0, p1

    add-int/lit8 v1, p1, 0x1

    .line 2
    aget-byte v1, p0, v1

    add-int/lit8 v2, p1, 0x2

    .line 3
    aget-byte v2, p0, v2

    add-int/lit8 p1, p1, 0x3

    .line 4
    aget-byte p0, p0, p1

    and-int/lit16 p1, v0, 0x80

    const/16 v3, 0x80

    if-ne p1, v3, :cond_18

    and-int/lit8 p1, v0, 0x7f

    add-int/lit16 v0, p1, 0x80

    :cond_18
    and-int/lit16 p1, v1, 0x80

    if-ne p1, v3, :cond_20

    and-int/lit8 p1, v1, 0x7f

    add-int/lit16 v1, p1, 0x80

    :cond_20
    and-int/lit16 p1, v2, 0x80

    if-ne p1, v3, :cond_28

    and-int/lit8 p1, v2, 0x7f

    add-int/lit16 v2, p1, 0x80

    :cond_28
    and-int/lit16 p1, p0, 0x80

    if-ne p1, v3, :cond_2f

    and-int/lit8 p0, p0, 0x7f

    add-int/2addr p0, v3

    :cond_2f
    int-to-long v3, v0

    const/16 p1, 0x18

    shl-long/2addr v3, p1

    int-to-long v0, v1

    const/16 p1, 0x10

    shl-long/2addr v0, p1

    add-long/2addr v3, v0

    int-to-long v0, v2

    const/16 p1, 0x8

    shl-long/2addr v0, p1

    add-long/2addr v3, v0

    int-to-long p0, p0

    add-long/2addr v3, p0

    return-wide v3
.end method

.method public static d([BI)J
    .registers 7

    .line 1
    invoke-static {p0, p1}, Lcom/google/android/exoplayer2/util/c0;->c([BI)J

    move-result-wide v0

    add-int/lit8 p1, p1, 0x4

    .line 2
    invoke-static {p0, p1}, Lcom/google/android/exoplayer2/util/c0;->c([BI)J

    move-result-wide p0

    const-wide/16 v2, 0x0

    cmp-long v4, v0, v2

    if-nez v4, :cond_15

    cmp-long v4, p0, v2

    if-nez v4, :cond_15

    return-wide v2

    :cond_15
    const-wide v2, 0x83aa7e80L

    sub-long/2addr v0, v2

    const-wide/16 v2, 0x3e8

    mul-long v0, v0, v2

    mul-long p0, p0, v2

    const-wide v2, 0x100000000L

    .line 3
    div-long/2addr p0, v2

    add-long/2addr p0, v0

    return-wide p0
.end method