ByteHook.smali

.class public Lcom/bytedance/android/bytehook/ByteHook;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/bytedance/android/bytehook/ByteHook$a;,
        Lcom/bytedance/android/bytehook/ByteHook$b;
    }
.end annotation


# static fields
.field public static a:Z = false

.field public static b:I = 0x1

.field public static final c:I


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

    sget-object v0, Lcom/bytedance/android/bytehook/ByteHook$b;->AUTOMATIC:Lcom/bytedance/android/bytehook/ByteHook$b;

    invoke-virtual {v0}, Lcom/bytedance/android/bytehook/ByteHook$b;->getValue()I

    move-result v0

    sput v0, Lcom/bytedance/android/bytehook/ByteHook;->c:I

    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 a()V
    .registers 3
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "LogNotTimber"
        }
    .end annotation

    const-string v0, "bytehook"

    .line 1
    :try_start_2
    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
    :try_end_5
    .catchall {:try_start_2 .. :try_end_5} :catchall_6

    goto :goto_2d

    :catchall_6
    move-exception v1

    .line 2
    invoke-static {}, Lcom/shopee/app/asm/fix/loadlibrary/a;->a()Z

    move-result v2

    if-eqz v2, :cond_39

    .line 3
    sget-object v1, Lcom/shopee/app/asm/fix/loadlibrary/a;->a:Lcom/getkeepsafe/relinker/e;

    if-nez v1, :cond_17

    .line 4
    invoke-static {}, Lcom/getkeepsafe/relinker/c;->b()Lcom/getkeepsafe/relinker/e;

    move-result-object v1

    .line 5
    sput-object v1, Lcom/shopee/app/asm/fix/loadlibrary/a;->a:Lcom/getkeepsafe/relinker/e;

    .line 6
    :cond_17
    invoke-static {}, Lcom/shopee/app/application/n2;->e()Lcom/shopee/app/application/n2;

    move-result-object v1

    .line 7
    invoke-static {v1}, Landroidx/appcompat/i;->O(Landroid/content/Context;)Landroid/content/Context;

    move-result-object v1

    if-nez v1, :cond_25

    .line 8
    invoke-static {}, Lcom/shopee/app/application/n2;->e()Lcom/shopee/app/application/n2;

    move-result-object v1

    .line 9
    :cond_25
    invoke-static {v1}, Lcom/shopee/app/asm/fix/loadlibrary/a;->b(Landroid/content/Context;)V

    .line 10
    :try_start_28
    sget-object v2, Lcom/shopee/app/asm/fix/loadlibrary/a;->a:Lcom/getkeepsafe/relinker/e;

    .line 11
    invoke-virtual {v2, v1, v0}, Lcom/getkeepsafe/relinker/e;->b(Landroid/content/Context;Ljava/lang/String;)V
    :try_end_2d
    .catch Lcom/getkeepsafe/relinker/b; {:try_start_28 .. :try_end_2d} :catch_2e

    :goto_2d
    return-void

    :catch_2e
    move-exception v0

    .line 12
    new-instance v1, Ljava/lang/UnsatisfiedLinkError;

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

    move-result-object v0

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

    throw v1

    .line 13
    :cond_39
    throw v1
.end method

.method public static declared-synchronized b(Lcom/bytedance/android/bytehook/ByteHook$a;)I
    .registers 5

    const-class v0, Lcom/bytedance/android/bytehook/ByteHook;

    monitor-enter v0

    .line 1
    :try_start_3
    sget-boolean v1, Lcom/bytedance/android/bytehook/ByteHook;->a:Z

    if-eqz v1, :cond_b

    .line 2
    sget p0, Lcom/bytedance/android/bytehook/ByteHook;->b:I
    :try_end_9
    .catchall {:try_start_3 .. :try_end_9} :catchall_56

    monitor-exit v0

    return p0

    :cond_b
    const/4 v1, 0x1

    .line 3
    :try_start_c
    sput-boolean v1, Lcom/bytedance/android/bytehook/ByteHook;->a:Z

    .line 4
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
    :try_end_11
    .catchall {:try_start_c .. :try_end_11} :catchall_56

    .line 5
    :try_start_11
    iget-object v1, p0, Lcom/bytedance/android/bytehook/ByteHook$a;->a:Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/k;

    if-nez v1, :cond_19

    .line 6
    invoke-static {}, Lcom/bytedance/android/bytehook/ByteHook;->a()V

    goto :goto_2b

    :cond_19
    const-string v2, "bytehook"

    .line 7
    iget-object v1, v1, Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/k;->a:Ljava/lang/Object;

    check-cast v1, Landroid/content/Context;

    const-string v3, "$context"

    .line 8
    invoke-static {v1, v3}, Lcom/shopee/sz/loadtask/datasource/a;->y(Ljava/lang/Object;Ljava/lang/String;)V

    .line 9
    invoke-static {}, Lcom/getkeepsafe/relinker/c;->b()Lcom/getkeepsafe/relinker/e;

    move-result-object v3

    .line 10
    invoke-virtual {v3, v1, v2}, Lcom/getkeepsafe/relinker/e;->b(Landroid/content/Context;Ljava/lang/String;)V
    :try_end_2b
    .catchall {:try_start_11 .. :try_end_2b} :catchall_4b

    :goto_2b
    const/16 v1, 0x65

    .line 11
    :try_start_2d
    iget v2, p0, Lcom/bytedance/android/bytehook/ByteHook$a;->b:I

    .line 12
    iget-boolean v3, p0, Lcom/bytedance/android/bytehook/ByteHook$a;->c:Z

    .line 13
    invoke-static {v2, v3}, Lcom/bytedance/android/bytehook/ByteHook;->nativeInit(IZ)I

    move-result v2

    sput v2, Lcom/bytedance/android/bytehook/ByteHook;->b:I
    :try_end_37
    .catchall {:try_start_2d .. :try_end_37} :catchall_38

    goto :goto_3a

    .line 14
    :catchall_38
    :try_start_38
    sput v1, Lcom/bytedance/android/bytehook/ByteHook;->b:I

    .line 15
    :goto_3a
    iget-boolean p0, p0, Lcom/bytedance/android/bytehook/ByteHook$a;->d:Z
    :try_end_3c
    .catchall {:try_start_38 .. :try_end_3c} :catchall_56

    if-eqz p0, :cond_44

    .line 16
    :try_start_3e
    invoke-static {p0}, Lcom/bytedance/android/bytehook/ByteHook;->nativeSetRecordable(Z)V
    :try_end_41
    .catchall {:try_start_3e .. :try_end_41} :catchall_42

    goto :goto_44

    .line 17
    :catchall_42
    :try_start_42
    sput v1, Lcom/bytedance/android/bytehook/ByteHook;->b:I

    .line 18
    :cond_44
    :goto_44
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    .line 19
    sget p0, Lcom/bytedance/android/bytehook/ByteHook;->b:I
    :try_end_49
    .catchall {:try_start_42 .. :try_end_49} :catchall_56

    monitor-exit v0

    return p0

    :catchall_4b
    const/16 p0, 0x64

    .line 20
    :try_start_4d
    sput p0, Lcom/bytedance/android/bytehook/ByteHook;->b:I

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

    .line 22
    sget p0, Lcom/bytedance/android/bytehook/ByteHook;->b:I
    :try_end_54
    .catchall {:try_start_4d .. :try_end_54} :catchall_56

    monitor-exit v0

    return p0

    :catchall_56
    move-exception p0

    monitor-exit v0

    throw p0
.end method

.method private static native nativeAddIgnore(Ljava/lang/String;)I
.end method

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

.method private static native nativeGetDebug()Z
.end method

.method private static native nativeGetMode()I
.end method

.method private static native nativeGetRecordable()Z
.end method

.method private static native nativeGetRecords(I)Ljava/lang/String;
.end method

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

.method private static native nativeInit(IZ)I
.end method

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

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