CommandLine.smali
.class public abstract Laegon/chrome/base/CommandLine;
.super Ljava/lang/Object;
# annotations
.annotation build Laegon/chrome/base/annotations/MainDex;
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Laegon/chrome/base/CommandLine$NativeCommandLine;,
Laegon/chrome/base/CommandLine$JavaCommandLine;
}
.end annotation
# static fields
.field static final synthetic $assertionsDisabled:Z
.field private static final SWITCH_PREFIX:Ljava/lang/String; = "--"
.field private static final SWITCH_TERMINATOR:Ljava/lang/String; = "--"
.field private static final SWITCH_VALUE_SEPARATOR:Ljava/lang/String; = "="
.field private static final TAG:Ljava/lang/String; = "CommandLine"
.field private static final sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/atomic/AtomicReference",
"<",
"Laegon/chrome/base/CommandLine;",
">;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.registers 1
const-class v0, Laegon/chrome/base/CommandLine;
invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z
move-result v0
if-nez v0, :cond_13
const/4 v0, 0x1
:goto_9
sput-boolean v0, Laegon/chrome/base/CommandLine;->$assertionsDisabled:Z
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
sput-object v0, Laegon/chrome/base/CommandLine;->sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
return-void
:cond_13
const/4 v0, 0x0
goto :goto_9
.end method
.method private constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method synthetic constructor <init>(Laegon/chrome/base/CommandLine$1;)V
.registers 2
invoke-direct {p0}, Laegon/chrome/base/CommandLine;-><init>()V
return-void
.end method
.method static synthetic access$100([Ljava/lang/String;)V
.registers 1
invoke-static {p0}, Laegon/chrome/base/CommandLine;->nativeInit([Ljava/lang/String;)V
return-void
.end method
.method static synthetic access$200(Ljava/lang/String;)Z
.registers 2
invoke-static {p0}, Laegon/chrome/base/CommandLine;->nativeHasSwitch(Ljava/lang/String;)Z
move-result v0
return v0
.end method
.method static synthetic access$300(Ljava/lang/String;)Ljava/lang/String;
.registers 2
invoke-static {p0}, Laegon/chrome/base/CommandLine;->nativeGetSwitchValue(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method static synthetic access$400(Ljava/lang/String;)V
.registers 1
invoke-static {p0}, Laegon/chrome/base/CommandLine;->nativeAppendSwitch(Ljava/lang/String;)V
return-void
.end method
.method static synthetic access$500(Ljava/lang/String;Ljava/lang/String;)V
.registers 2
invoke-static {p0, p1}, Laegon/chrome/base/CommandLine;->nativeAppendSwitchWithValue(Ljava/lang/String;Ljava/lang/String;)V
return-void
.end method
.method static synthetic access$600([Ljava/lang/String;)V
.registers 1
invoke-static {p0}, Laegon/chrome/base/CommandLine;->nativeAppendSwitchesAndArguments([Ljava/lang/String;)V
return-void
.end method
.method public static enableNativeProxy()V
.registers 3
sget-object v0, Laegon/chrome/base/CommandLine;->sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
new-instance v1, Laegon/chrome/base/CommandLine$NativeCommandLine;
invoke-static {}, Laegon/chrome/base/CommandLine;->getJavaSwitchesOrNull()[Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Laegon/chrome/base/CommandLine$NativeCommandLine;-><init>([Ljava/lang/String;)V
invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->set(Ljava/lang/Object;)V
return-void
.end method
.method public static getInstance()Laegon/chrome/base/CommandLine;
.registers 2
.annotation build Laegon/chrome/base/VisibleForTesting;
.end annotation
sget-object v0, Laegon/chrome/base/CommandLine;->sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Laegon/chrome/base/CommandLine;
sget-boolean v1, Laegon/chrome/base/CommandLine;->$assertionsDisabled:Z
if-nez v1, :cond_14
if-nez v0, :cond_14
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
throw v0
:cond_14
return-object v0
.end method
.method public static getJavaSwitchesOrNull()[Ljava/lang/String;
.registers 1
.annotation build Landroid/support/annotation/Nullable;
.end annotation
sget-object v0, Laegon/chrome/base/CommandLine;->sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Laegon/chrome/base/CommandLine;
if-eqz v0, :cond_f
invoke-virtual {v0}, Laegon/chrome/base/CommandLine;->getCommandLineArguments()[Ljava/lang/String;
move-result-object v0
:goto_e
return-object v0
:cond_f
const/4 v0, 0x0
goto :goto_e
.end method
.method public static init([Ljava/lang/String;)V
.registers 2
.param p0 # [Ljava/lang/String;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.end param
new-instance v0, Laegon/chrome/base/CommandLine$JavaCommandLine;
invoke-direct {v0, p0}, Laegon/chrome/base/CommandLine$JavaCommandLine;-><init>([Ljava/lang/String;)V
invoke-static {v0}, Laegon/chrome/base/CommandLine;->setInstance(Laegon/chrome/base/CommandLine;)V
return-void
.end method
.method public static initFromFile(Ljava/lang/String;)V
.registers 2
invoke-static {p0}, Laegon/chrome/base/CommandLine;->readFileAsUtf8(Ljava/lang/String;)[C
move-result-object v0
if-nez v0, :cond_b
const/4 v0, 0x0
:goto_7
invoke-static {v0}, Laegon/chrome/base/CommandLine;->init([Ljava/lang/String;)V
return-void
:cond_b
invoke-static {v0}, Laegon/chrome/base/CommandLine;->tokenizeQuotedArguments([C)[Ljava/lang/String;
move-result-object v0
goto :goto_7
.end method
.method public static isInitialized()Z
.registers 1
sget-object v0, Laegon/chrome/base/CommandLine;->sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v0
if-eqz v0, :cond_a
const/4 v0, 0x1
:goto_9
return v0
:cond_a
const/4 v0, 0x0
goto :goto_9
.end method
.method private static native nativeAppendSwitch(Ljava/lang/String;)V
.end method
.method private static native nativeAppendSwitchWithValue(Ljava/lang/String;Ljava/lang/String;)V
.end method
.method private static native nativeAppendSwitchesAndArguments([Ljava/lang/String;)V
.end method
.method private static native nativeGetSwitchValue(Ljava/lang/String;)Ljava/lang/String;
.end method
.method private static native nativeHasSwitch(Ljava/lang/String;)Z
.end method
.method private static native nativeInit([Ljava/lang/String;)V
.end method
.method private static readFileAsUtf8(Ljava/lang/String;)[C
.registers 8
const/4 v1, 0x0
new-instance v0, Ljava/io/File;
invoke-direct {v0, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V
:try_start_6
new-instance v3, Ljava/io/FileReader;
invoke-direct {v3, v0}, Ljava/io/FileReader;-><init>(Ljava/io/File;)V
:try_end_b
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_b} :catch_27
const/4 v2, 0x0
:try_start_c
invoke-virtual {v0}, Ljava/io/File;->length()J
move-result-wide v4
long-to-int v0, v4
new-array v0, v0, [C
invoke-virtual {v3, v0}, Ljava/io/FileReader;->read([C)I
move-result v4
const/4 v5, 0x0
invoke-static {v0, v5, v4}, Ljava/util/Arrays;->copyOfRange([CII)[C
:try_end_1b
.catch Ljava/lang/Throwable; {:try_start_c .. :try_end_1b} :catch_2e
.catchall {:try_start_c .. :try_end_1b} :catchall_43
move-result-object v0
if-eqz v1, :cond_2a
:try_start_1e
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:try_end_21
.catch Ljava/lang/Throwable; {:try_start_1e .. :try_end_21} :catch_22
.catch Ljava/io/IOException; {:try_start_1e .. :try_end_21} :catch_27
:goto_21
return-object v0
:catch_22
move-exception v3
:try_start_23
invoke-virtual {v2, v3}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
goto :goto_21
:catch_27
move-exception v0
move-object v0, v1
goto :goto_21
:cond_2a
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:try_end_2d
.catch Ljava/io/IOException; {:try_start_23 .. :try_end_2d} :catch_27
goto :goto_21
:catch_2e
move-exception v0
:try_start_2f
throw v0
:try_end_30
.catchall {:try_start_2f .. :try_end_30} :catchall_30
:catchall_30
move-exception v2
move-object v6, v2
move-object v2, v0
move-object v0, v6
:goto_34
if-eqz v2, :cond_3f
:try_start_36
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:try_end_39
.catch Ljava/lang/Throwable; {:try_start_36 .. :try_end_39} :catch_3a
.catch Ljava/io/IOException; {:try_start_36 .. :try_end_39} :catch_27
:goto_39
:try_start_39
throw v0
:catch_3a
move-exception v3
invoke-virtual {v2, v3}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
goto :goto_39
:cond_3f
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:try_end_42
.catch Ljava/io/IOException; {:try_start_39 .. :try_end_42} :catch_27
goto :goto_39
:catchall_43
move-exception v0
move-object v2, v1
goto :goto_34
.end method
.method public static reset()V
.registers 1
.annotation build Laegon/chrome/base/VisibleForTesting;
.end annotation
const/4 v0, 0x0
invoke-static {v0}, Laegon/chrome/base/CommandLine;->setInstance(Laegon/chrome/base/CommandLine;)V
return-void
.end method
.method private static setInstance(Laegon/chrome/base/CommandLine;)V
.registers 2
sget-object v0, Laegon/chrome/base/CommandLine;->sCommandLine:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {v0, p0}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Laegon/chrome/base/CommandLine;
if-eqz v0, :cond_d
invoke-virtual {v0}, Laegon/chrome/base/CommandLine;->destroy()V
:cond_d
return-void
.end method
.method static tokenizeQuotedArguments([C)[Ljava/lang/String;
.registers 12
.annotation build Laegon/chrome/base/VisibleForTesting;
.end annotation
const/4 v2, 0x0
const/4 v4, 0x0
array-length v0, p0
const/high16 v1, 0x10000
if-le v0, v1, :cond_21
new-instance v0, Ljava/lang/RuntimeException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Flags file too big: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
array-length v2, p0
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
:cond_21
new-instance v6, Ljava/util/ArrayList;
invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V
array-length v7, p0
move v5, v4
move v1, v4
move-object v0, v2
:goto_2a
if-ge v5, v7, :cond_8e
aget-char v3, p0, v5
if-nez v1, :cond_38
const/16 v8, 0x27
if-eq v3, v8, :cond_3a
const/16 v8, 0x22
if-eq v3, v8, :cond_3a
:cond_38
if-ne v3, v1, :cond_6c
:cond_3a
if-eqz v0, :cond_63
invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I
move-result v8
if-lez v8, :cond_63
invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I
move-result v8
add-int/lit8 v8, v8, -0x1
invoke-virtual {v0, v8}, Ljava/lang/StringBuilder;->charAt(I)C
move-result v8
const/16 v9, 0x5c
if-ne v8, v9, :cond_63
invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I
move-result v8
add-int/lit8 v8, v8, -0x1
invoke-virtual {v0, v8, v3}, Ljava/lang/StringBuilder;->setCharAt(IC)V
move v10, v1
move-object v1, v0
move v0, v10
:goto_5c
add-int/lit8 v3, v5, 0x1
move v5, v3
move v10, v0
move-object v0, v1
move v1, v10
goto :goto_2a
:cond_63
if-nez v1, :cond_6a
move v1, v3
:goto_66
move v10, v1
move-object v1, v0
move v0, v10
goto :goto_5c
:cond_6a
move v1, v4
goto :goto_66
:cond_6c
if-nez v1, :cond_80
invoke-static {v3}, Ljava/lang/Character;->isWhitespace(C)Z
move-result v8
if-eqz v8, :cond_80
if-eqz v0, :cond_8a
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
move v0, v1
move-object v1, v2
goto :goto_5c
:cond_80
if-nez v0, :cond_87
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
:cond_87
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
:cond_8a
move v10, v1
move-object v1, v0
move v0, v10
goto :goto_5c
:cond_8e
if-eqz v0, :cond_b1
if-eqz v1, :cond_aa
const-string v1, "CommandLine"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Unterminated quoted string: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
:cond_aa
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:cond_b1
invoke-virtual {v6}, Ljava/util/ArrayList;->size()I
move-result v0
new-array v0, v0, [Ljava/lang/String;
invoke-virtual {v6, v0}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v0
check-cast v0, [Ljava/lang/String;
return-object v0
.end method
# virtual methods
.method public abstract appendSwitch(Ljava/lang/String;)V
.annotation build Laegon/chrome/base/VisibleForTesting;
.end annotation
.end method
.method public abstract appendSwitchWithValue(Ljava/lang/String;Ljava/lang/String;)V
.end method
.method public abstract appendSwitchesAndArguments([Ljava/lang/String;)V
.end method
.method protected destroy()V
.registers 1
return-void
.end method
.method protected abstract getCommandLineArguments()[Ljava/lang/String;
.end method
.method public abstract getSwitchValue(Ljava/lang/String;)Ljava/lang/String;
.end method
.method public getSwitchValue(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.registers 5
invoke-virtual {p0, p1}, Laegon/chrome/base/CommandLine;->getSwitchValue(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v1
if-eqz v1, :cond_b
:goto_a
return-object p2
:cond_b
move-object p2, v0
goto :goto_a
.end method
.method public abstract hasSwitch(Ljava/lang/String;)Z
.annotation build Laegon/chrome/base/VisibleForTesting;
.end annotation
.end method
.method public isNativeImplementation()Z
.registers 2
const/4 v0, 0x0
return v0
.end method