ShadowHook.smali

.class public final Lcom/bytedance/shadowhook/ShadowHook;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/bytedance/shadowhook/ShadowHook$c;,
        Lcom/bytedance/shadowhook/ShadowHook$a;,
        Lcom/bytedance/shadowhook/ShadowHook$b;
    }
.end annotation


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

.field public static b:I = 0x2

.field public static final c:I


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

    sget-object v0, Lcom/bytedance/shadowhook/ShadowHook$c;->SHARED:Lcom/bytedance/shadowhook/ShadowHook$c;

    invoke-virtual {v0}, Lcom/bytedance/shadowhook/ShadowHook$c;->getValue()I

    move-result v0

    sput v0, Lcom/bytedance/shadowhook/ShadowHook;->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, "shadowhook"

    .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/shadowhook/ShadowHook$a;)I
    .registers 5

    const-class v0, Lcom/bytedance/shadowhook/ShadowHook;

    monitor-enter v0

    .line 1
    :try_start_3
    sget-boolean v1, Lcom/bytedance/shadowhook/ShadowHook;->a:Z

    if-eqz v1, :cond_b

    .line 2
    sget p0, Lcom/bytedance/shadowhook/ShadowHook;->b:I
    :try_end_9
    .catchall {:try_start_3 .. :try_end_9} :catchall_51

    monitor-exit v0

    return p0

    :cond_b
    const/4 v1, 0x1

    .line 3
    :try_start_c
    sput-boolean v1, Lcom/bytedance/shadowhook/ShadowHook;->a:Z

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

    .line 5
    :try_start_11
    iget-object v2, p0, Lcom/bytedance/shadowhook/ShadowHook$a;->a:Lcom/bytedance/shadowhook/ShadowHook$b;

    if-nez v2, :cond_19

    .line 6
    invoke-static {}, Lcom/bytedance/shadowhook/ShadowHook;->a()V

    goto :goto_24

    .line 7
    :cond_19
    check-cast v2, Lcom/google/firebase/crashlytics/internal/common/l0;

    iget-object v2, v2, Lcom/google/firebase/crashlytics/internal/common/l0;->b:Ljava/lang/Object;

    check-cast v2, Landroid/content/Context;

    invoke-static {v2}, Lcom/shopee/luban/faststack/FastStack;->b(Landroid/content/Context;)V
    :try_end_22
    .catchall {:try_start_11 .. :try_end_22} :catchall_23

    goto :goto_24

    :catchall_23
    const/4 v1, 0x0

    :goto_24
    if-nez v1, :cond_31

    const/16 p0, 0x64

    .line 8
    :try_start_28
    sput p0, Lcom/bytedance/shadowhook/ShadowHook;->b:I

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

    .line 10
    sget p0, Lcom/bytedance/shadowhook/ShadowHook;->b:I
    :try_end_2f
    .catchall {:try_start_28 .. :try_end_2f} :catchall_51

    monitor-exit v0

    return p0

    :cond_31
    const/16 v1, 0x65

    .line 11
    :try_start_33
    iget v2, p0, Lcom/bytedance/shadowhook/ShadowHook$a;->b:I

    .line 12
    iget-boolean v3, p0, Lcom/bytedance/shadowhook/ShadowHook$a;->c:Z

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

    move-result v2

    sput v2, Lcom/bytedance/shadowhook/ShadowHook;->b:I
    :try_end_3d
    .catchall {:try_start_33 .. :try_end_3d} :catchall_3e

    goto :goto_40

    .line 14
    :catchall_3e
    :try_start_3e
    sput v1, Lcom/bytedance/shadowhook/ShadowHook;->b:I

    .line 15
    :goto_40
    iget-boolean p0, p0, Lcom/bytedance/shadowhook/ShadowHook$a;->d:Z
    :try_end_42
    .catchall {:try_start_3e .. :try_end_42} :catchall_51

    if-eqz p0, :cond_4a

    .line 16
    :try_start_44
    invoke-static {p0}, Lcom/bytedance/shadowhook/ShadowHook;->nativeSetRecordable(Z)V
    :try_end_47
    .catchall {:try_start_44 .. :try_end_47} :catchall_48

    goto :goto_4a

    .line 17
    :catchall_48
    :try_start_48
    sput v1, Lcom/bytedance/shadowhook/ShadowHook;->b:I

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

    .line 19
    sget p0, Lcom/bytedance/shadowhook/ShadowHook;->b:I
    :try_end_4f
    .catchall {:try_start_48 .. :try_end_4f} :catchall_51

    monitor-exit v0

    return p0

    :catchall_51
    move-exception p0

    monitor-exit v0

    throw p0
.end method

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

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

.method private static native nativeGetInitErrno()I
.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 nativeSetDebuggable(Z)V
.end method

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

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