.class public final Ls4/q;
.super Ljava/lang/Object;
.source ""


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Ls4/q$a;
    }
.end annotation


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

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

    return-void
.end method

.method public static final a(Ls4/q;Lq9/w;Lv9/h0;Ljava/io/File;)V
    .registers 11

    invoke-static {p0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    if-nez p2, :cond_e

    const/4 p0, 0x0

    new-array p0, p0, [Ljava/lang/Object;

    const-string p1, "debugupdate response body is null"

    .line 1
    invoke-static {p1, p0}, Lbb/a;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_25

    :cond_e
    invoke-virtual {p3}, Ljava/io/File;->exists()Z

    move-result v0

    if-nez v0, :cond_17

    invoke-virtual {p3}, Ljava/io/File;->createNewFile()Z

    :cond_17
    const/4 v2, 0x0

    const/4 v3, 0x0

    new-instance v4, Ls4/r;

    const/4 v0, 0x0

    invoke-direct {v4, p0, p2, p3, v0}, Ls4/r;-><init>(Ls4/q;Lv9/h0;Ljava/io/File;Lb9/d;)V

    const/4 v5, 0x3

    const/4 v6, 0x0

    move-object v1, p1

    invoke-static/range {v1 .. v6}, Le/j;->d(Lq9/w;Lb9/f;Lq9/x;Lh9/c;ILjava/lang/Object;)Lq9/t0;

    :goto_25
    return-void
.end method


# virtual methods
.method public final b(Lq9/w;Landroid/content/Context;Ljava/io/File;)V
    .registers 7

    const-string v0, ""

    const-string v1, "default"

    .line 1
    invoke-static {v0, v1}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    const/4 v1, 0x0

    const-string v2, "game_centre"

    invoke-virtual {p2, v2, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p2

    const-string v2, "LATEST_AVAILABLE_VERSION_URL"

    invoke-interface {p2, v2, v0}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    if-nez p2, :cond_17

    goto :goto_18

    :cond_17
    move-object v0, p2

    .line 2
    :goto_18
    invoke-static {v0}, Lp9/h;->s(Ljava/lang/CharSequence;)Z

    move-result p2

    if-eqz p2, :cond_26

    new-array p1, v1, [Ljava/lang/Object;

    const-string p2, "debugupdate An update is available but url is blank!"

    invoke-static {p2, p1}, Lbb/a;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_42

    :cond_26
    new-array p2, v1, [Ljava/lang/Object;

    const-string v1, "debugupdate An update is available but not downloaded, downloading now!"

    invoke-static {v1, p2}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    sget-object p2, Lp4/b;->a:Lp4/b;

    invoke-virtual {p2}, Lp4/b;->a()Lp4/a;

    move-result-object p2

    invoke-interface {p2, v0}, Lp4/a;->a(Ljava/lang/String;)Lya/b;

    move-result-object p2

    if-nez p2, :cond_3a

    goto :goto_42

    :cond_3a
    new-instance v0, Ls4/q$b;

    invoke-direct {v0, p0, p1, p3}, Ls4/q$b;-><init>(Ls4/q;Lq9/w;Ljava/io/File;)V

    invoke-interface {p2, v0}, Lya/b;->o(Lya/d;)V

    :goto_42
    return-void
.end method

.method public final c(Lq9/w;Landroid/content/Context;Ljava/io/File;)V
    .registers 7

    const-string v0, ""

    const-string v1, "default"

    .line 1
    invoke-static {v0, v1}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    const/4 v1, 0x0

    const-string v2, "game_centre"

    invoke-virtual {p2, v2, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p2

    const-string v2, "APP_PARTNER_AVAILABLE_URL"

    invoke-interface {p2, v2, v0}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    if-nez p2, :cond_17

    goto :goto_18

    :cond_17
    move-object v0, p2

    .line 2
    :goto_18
    invoke-static {v0}, Lp9/h;->s(Ljava/lang/CharSequence;)Z

    move-result p2

    if-eqz p2, :cond_26

    new-array p1, v1, [Ljava/lang/Object;

    const-string p2, "debugpartnerapp Partner app is available but url is blank!"

    invoke-static {p2, p1}, Lbb/a;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_42

    :cond_26
    new-array p2, v1, [Ljava/lang/Object;

    const-string v1, "debugpartnerapp Partner app is available but not downloaded, downloading now!"

    invoke-static {v1, p2}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    sget-object p2, Lp4/b;->a:Lp4/b;

    invoke-virtual {p2}, Lp4/b;->a()Lp4/a;

    move-result-object p2

    invoke-interface {p2, v0}, Lp4/a;->a(Ljava/lang/String;)Lya/b;

    move-result-object p2

    if-nez p2, :cond_3a

    goto :goto_42

    :cond_3a
    new-instance v0, Ls4/q$c;

    invoke-direct {v0, p0, p1, p3}, Ls4/q$c;-><init>(Ls4/q;Lq9/w;Ljava/io/File;)V

    invoke-interface {p2, v0}, Lya/b;->o(Lya/d;)V

    :goto_42
    return-void
.end method

.method public final d(Landroid/content/Context;Ljava/io/InputStream;)Z
    .registers 12

    const-string v0, "context"

    invoke-static {p1, v0}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/pm/PackageManager;->getPackageInstaller()Landroid/content/pm/PackageInstaller;

    move-result-object v0

    const-string v1, "context.packageManager.packageInstaller"

    invoke-static {v0, v1}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    new-instance v1, Landroid/content/pm/PackageInstaller$SessionParams;

    const/4 v2, 0x1

    invoke-direct {v1, v2}, Landroid/content/pm/PackageInstaller$SessionParams;-><init>(I)V

    const-string v3, "com.floydwiz.gamingcenter"

    invoke-virtual {v1, v3}, Landroid/content/pm/PackageInstaller$SessionParams;->setAppPackageName(Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/content/pm/PackageInstaller;->createSession(Landroid/content/pm/PackageInstaller$SessionParams;)I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/content/pm/PackageInstaller;->openSession(I)Landroid/content/pm/PackageInstaller$Session;

    move-result-object v0

    const-string v3, "packageInstaller.openSession(sessionId)"

    invoke-static {v0, v3}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-wide/16 v5, 0x0

    const-wide/16 v7, -0x1

    const-string v4, "Game_Center"

    move-object v3, v0

    invoke-virtual/range {v3 .. v8}, Landroid/content/pm/PackageInstaller$Session;->openWrite(Ljava/lang/String;JJ)Ljava/io/OutputStream;

    move-result-object v3

    const-string v4, "session.openWrite(\"Game_Center\", 0, -1)"

    invoke-static {v3, v4}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const/high16 v4, 0x10000

    new-array v4, v4, [B

    :goto_3e
    invoke-virtual {p2, v4}, Ljava/io/InputStream;->read([B)I

    move-result v5

    const/4 v6, -0x1

    const/4 v7, 0x0

    if-eq v5, v6, :cond_4a

    invoke-virtual {v3, v4, v7, v5}, Ljava/io/OutputStream;->write([BII)V

    goto :goto_3e

    :cond_4a
    invoke-virtual {v0, v3}, Landroid/content/pm/PackageInstaller$Session;->fsync(Ljava/io/OutputStream;)V

    invoke-virtual {p2}, Ljava/io/InputStream;->close()V

    invoke-virtual {v3}, Ljava/io/OutputStream;->close()V

    .line 1
    new-instance p2, Landroid/content/Intent;

    const-string v3, "com.floydwiz.gamingcenterINSTALL_COMPLETE"

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

    invoke-static {p1, v1, p2, v7}, Landroid/app/PendingIntent;->getBroadcast(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;

    move-result-object p1

    invoke-virtual {p1}, Landroid/app/PendingIntent;->getIntentSender()Landroid/content/IntentSender;

    move-result-object p1

    const-string p2, "pendingIntent.intentSender"

    invoke-static {p1, p2}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    .line 2
    invoke-virtual {v0, p1}, Landroid/content/pm/PackageInstaller$Session;->commit(Landroid/content/IntentSender;)V

    return v2
.end method

.method public final e(Lq9/w;Landroid/content/Context;)V
    .registers 16

    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x1b

    const/4 v2, 0x0

    if-le v0, v1, :cond_10

    new-array p1, v2, [Ljava/lang/Object;

    const-string p2, "debugpartnerapp Not downloading. SDK above Nougat!"

    invoke-static {p2, p1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    goto/16 :goto_1bd

    :cond_10
    new-instance v3, Ljava/io/File;

    const/4 v4, 0x0

    invoke-virtual {p2, v4}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v5

    const-string v6, "partnerapp.apk"

    invoke-direct {v3, v5, v6}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    new-array v5, v2, [Ljava/lang/Object;

    const-string v6, "debugpartnerapp Partner app is available from server!"

    invoke-static {v6, v5}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-virtual {v3}, Ljava/io/File;->exists()Z

    move-result v5

    if-eqz v5, :cond_1ba

    const-string v5, "MD5"

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

    move-result-object v5

    const-string v6, "getInstance(\"MD5\")"

    invoke-static {v5, v6}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    new-instance v6, Ljava/io/FileInputStream;

    invoke-direct {v6, v3}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    const/16 v7, 0x400

    new-array v7, v7, [B

    :goto_3d
    invoke-virtual {v6, v7}, Ljava/io/FileInputStream;->read([B)I

    move-result v8

    const/4 v9, -0x1

    if-eq v8, v9, :cond_48

    invoke-virtual {v5, v7, v2, v8}, Ljava/security/MessageDigest;->update([BII)V

    goto :goto_3d

    :cond_48
    invoke-virtual {v6}, Ljava/io/FileInputStream;->close()V

    invoke-virtual {v5}, Ljava/security/MessageDigest;->digest()[B

    move-result-object v5

    new-instance v6, Ljava/lang/StringBuilder;

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

    array-length v7, v5

    add-int/2addr v7, v9

    const/4 v8, 0x1

    if-ltz v7, :cond_81

    move v9, v2

    :goto_5a
    add-int/lit8 v10, v9, 0x1

    aget-byte v9, v5, v9

    and-int/lit16 v9, v9, 0xff

    add-int/lit16 v9, v9, 0x100

    const/16 v11, 0x10

    invoke-static {v11}, Lp/a;->c(I)I

    invoke-static {v9, v11}, Ljava/lang/Integer;->toString(II)Ljava/lang/String;

    move-result-object v9

    const-string v11, "java.lang.Integer.toStri\u2026(this, checkRadix(radix))"

    invoke-static {v9, v11}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v9, v8}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v9

    const-string v11, "(this as java.lang.String).substring(startIndex)"

    invoke-static {v9, v11}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

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

    if-le v10, v7, :cond_7f

    goto :goto_81

    :cond_7f
    move v9, v10

    goto :goto_5a

    :cond_81
    :goto_81
    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    const-string v6, "sb.toString()"

    invoke-static {v5, v6}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v6, "debugpartnerapp App file exists locally, md5 = "

    .line 2
    invoke-static {v6, v5}, Lx/e;->k(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v6

    new-array v7, v2, [Ljava/lang/Object;

    invoke-static {v6, v7}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    sget-object v6, Lo4/b;->a:Lo4/b;

    sget-object v7, Lo4/b$a;->F:Lo4/b$a;

    const/4 v9, 0x4

    invoke-static {v6, p2, v7, v4, v9}, Lo4/b;->c(Lo4/b;Landroid/content/Context;Lo4/b$a;Ljava/lang/String;I)Ljava/lang/String;

    move-result-object v7

    invoke-static {v5, v7, v8}, Lp9/h;->r(Ljava/lang/String;Ljava/lang/String;Z)Z

    move-result v5

    if-eqz v5, :cond_1b0

    sget-object p1, Lo4/b$a;->H:Lo4/b$a;

    invoke-static {v6, p2, p1, v2, v9}, Lo4/b;->a(Lo4/b;Landroid/content/Context;Lo4/b$a;ZI)Z

    move-result p1

    const-string v5, "PARTNER_APP_PACKAGE"

    if-eqz p1, :cond_f4

    new-array p1, v2, [Ljava/lang/Object;

    const-string v0, "debugpartnerapp App was already installed once! Not installing again."

    invoke-static {v0, p1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-virtual {p2}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object p1

    sget-object v0, Lo4/b$a;->G:Lo4/b$a;

    invoke-static {v6, p2, v0, v4, v9}, Lo4/b;->c(Lo4/b;Landroid/content/Context;Lo4/b$a;Ljava/lang/String;I)Ljava/lang/String;

    move-result-object v1

    const-string v3, "pm"

    invoke-static {p1, v3}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    .line 3
    :try_start_c4
    invoke-virtual {p1, v1, v2}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
    :try_end_c7
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_c4 .. :try_end_c7} :catch_c9

    move p1, v8

    goto :goto_ca

    :catch_c9
    move p1, v2

    .line 4
    :goto_ca
    sget-object v1, Lo4/b$a;->I:Lo4/b$a;

    invoke-static {v6, p2, v1, v2, v9}, Lo4/b;->a(Lo4/b;Landroid/content/Context;Lo4/b$a;ZI)Z

    move-result v3

    if-nez v3, :cond_1bd

    if-nez p1, :cond_1bd

    new-array p1, v2, [Ljava/lang/Object;

    const-string v2, "debugpartnerapp Sending partner app uninstall analytics!"

    invoke-static {v2, p1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    sget-object p1, Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper;->INSTANCE:Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper;

    sget-object v2, Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper$a;->x:Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper$a;

    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    invoke-static {v6, p2, v0, v4, v9}, Lo4/b;->c(Lo4/b;Landroid/content/Context;Lo4/b$a;Ljava/lang/String;I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v5, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    move-result-object v0

    invoke-virtual {p1, v2, v0}, Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper;->postEvent(Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper$a;Lorg/json/JSONObject;)V

    invoke-virtual {v6, p2, v1, v8}, Lo4/b;->d(Landroid/content/Context;Lo4/b$a;Z)V

    goto/16 :goto_1bd

    :cond_f4
    new-array p1, v2, [Ljava/lang/Object;

    const-string v6, "debugpartnerapp Installing partner app now!"

    invoke-static {v6, p1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-virtual {v3}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object p1

    const-string v3, "appFile.absolutePath"

    invoke-static {p1, v3}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v3, "game_centre"

    if-le v0, v1, :cond_111

    :try_start_108
    const-string p1, "debugpartnerapp Android version is above Nougat"

    new-array p2, v2, [Ljava/lang/Object;

    .line 5
    invoke-static {p1, p2}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    goto/16 :goto_1bd

    :cond_111
    const-string v0, "debugpartnerapp Installing apk "

    invoke-static {v0, p1}, Lx/e;->k(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    const-string v0, "android.content.pm.IPackageInstallObserver"

    invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;

    move-result-object v1

    new-array v6, v8, [Ljava/lang/Class;

    aput-object v0, v6, v2

    new-instance v7, Ls4/q$a;

    invoke-direct {v7}, Ls4/q$a;-><init>()V

    invoke-static {v1, v6, v7}, Ljava/lang/reflect/Proxy;->newProxyInstance(Ljava/lang/ClassLoader;[Ljava/lang/Class;Ljava/lang/reflect/InvocationHandler;)Ljava/lang/Object;

    move-result-object v1

    const-string v6, "newProxyInstance(\n      \u2026r()\n                    )"

    invoke-static {v1, v6}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-class v6, Landroid/content/pm/PackageManager;

    const-string v7, "installPackage"

    new-array v10, v9, [Ljava/lang/Class;

    const-class v11, Landroid/net/Uri;

    aput-object v11, v10, v2

    aput-object v0, v10, v8

    sget-object v0, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;

    const/4 v11, 0x2

    aput-object v0, v10, v11

    const-class v0, Ljava/lang/String;

    const/4 v12, 0x3

    aput-object v0, v10, v12

    invoke-virtual {v6, v7, v10}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v0

    const-string v6, "PackageManager::class.ja\u2026ava\n                    )"

    invoke-static {v0, v6}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p2}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v6

    new-array v7, v9, [Ljava/lang/Object;

    new-instance v9, Ljava/io/File;

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

    invoke-static {v9}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object p1

    aput-object p1, v7, v2

    aput-object v1, v7, v8

    invoke-static {v11}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v7, v11

    aput-object v4, v7, v12

    invoke-virtual {v0, v6, v7}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    .line 6
    invoke-virtual {p2, v3, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p1

    invoke-interface {p1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object p1

    const-string v0, "APP_PARTNER_INSTALLED_ONCE"

    invoke-interface {p1, v0, v8}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    move-result-object p1

    invoke-interface {p1}, Landroid/content/SharedPreferences$Editor;->apply()V

    .line 7
    sget-object p1, Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper;->INSTANCE:Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper;

    sget-object v0, Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper$a;->w:Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper$a;

    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V

    const-string v4, ""

    .line 8
    invoke-virtual {p2, v3, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p2

    const-string v3, "APP_PARTNER_AVAILABLE_PACKAGE_NAME"

    invoke-interface {p2, v3, v4}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    if-nez p2, :cond_19e

    goto :goto_19f

    :cond_19e
    move-object v4, p2

    .line 9
    :goto_19f
    invoke-virtual {v1, v5, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    move-result-object p2

    invoke-virtual {p1, v0, p2}, Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper;->postEvent(Lcom/floydwiz/gamingcenter/utils/network/AnalyticsHelper$a;Lorg/json/JSONObject;)V
    :try_end_1a6
    .catch Ljava/lang/Exception; {:try_start_108 .. :try_end_1a6} :catch_1a7

    goto :goto_1bd

    :catch_1a7
    move-exception p1

    new-array p2, v2, [Ljava/lang/Object;

    const-string v0, "debugpartnerapp"

    invoke-static {p1, v0, p2}, Lbb/a;->d(Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_1bd

    :cond_1b0
    new-array v0, v2, [Ljava/lang/Object;

    const-string v1, "debugpartnerapp Downloading again because md5 mismatch!"

    .line 10
    invoke-static {v1, v0}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-virtual {v3}, Ljava/io/File;->delete()Z

    :cond_1ba
    invoke-virtual {p0, p1, p2, v3}, Ls4/q;->c(Lq9/w;Landroid/content/Context;Ljava/io/File;)V

    :cond_1bd
    :goto_1bd
    return-void
.end method

.method public final f(Lq9/w;Landroid/content/Context;)V
    .registers 15

    new-instance v0, Ljava/io/File;

    const/4 v1, 0x0

    invoke-virtual {p2, v1}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v2

    const-string v3, "update.apk"

    invoke-direct {v0, v2, v3}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    const/4 v2, 0x4

    const/4 v3, 0x0

    const-string v4, "game_centre"

    .line 1
    invoke-virtual {p2, v4, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v5

    const-string v6, "LATEST_AVAILABLE_VERSION_CODE"

    const/4 v7, -0x1

    invoke-interface {v5, v6, v7}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v5

    const/16 v6, 0x75

    if-ge v6, v5, :cond_15b

    new-array v5, v3, [Ljava/lang/Object;

    const-string v6, "debugupdate An update is available from server!"

    .line 2
    invoke-static {v6, v5}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v5

    if-eqz v5, :cond_158

    const-string v5, "MD5"

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

    move-result-object v5

    const-string v6, "getInstance(\"MD5\")"

    invoke-static {v5, v6}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    new-instance v6, Ljava/io/FileInputStream;

    invoke-direct {v6, v0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    const/16 v8, 0x400

    new-array v8, v8, [B

    :goto_40
    invoke-virtual {v6, v8}, Ljava/io/FileInputStream;->read([B)I

    move-result v9

    if-eq v9, v7, :cond_4a

    invoke-virtual {v5, v8, v3, v9}, Ljava/security/MessageDigest;->update([BII)V

    goto :goto_40

    :cond_4a
    invoke-virtual {v6}, Ljava/io/FileInputStream;->close()V

    invoke-virtual {v5}, Ljava/security/MessageDigest;->digest()[B

    move-result-object v5

    new-instance v6, Ljava/lang/StringBuilder;

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

    array-length v8, v5

    add-int/2addr v8, v7

    const/4 v7, 0x1

    if-ltz v8, :cond_83

    move v9, v3

    :goto_5c
    add-int/lit8 v10, v9, 0x1

    aget-byte v9, v5, v9

    and-int/lit16 v9, v9, 0xff

    add-int/lit16 v9, v9, 0x100

    const/16 v11, 0x10

    invoke-static {v11}, Lp/a;->c(I)I

    invoke-static {v9, v11}, Ljava/lang/Integer;->toString(II)Ljava/lang/String;

    move-result-object v9

    const-string v11, "java.lang.Integer.toStri\u2026(this, checkRadix(radix))"

    invoke-static {v9, v11}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v9, v7}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v9

    const-string v11, "(this as java.lang.String).substring(startIndex)"

    invoke-static {v9, v11}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

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

    if-le v10, v8, :cond_81

    goto :goto_83

    :cond_81
    move v9, v10

    goto :goto_5c

    :cond_83
    :goto_83
    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    const-string v6, "sb.toString()"

    invoke-static {v5, v6}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v6, "debugupdate Update file exists locally, md5 = "

    .line 4
    invoke-static {v6, v5}, Lx/e;->k(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v6

    new-array v8, v3, [Ljava/lang/Object;

    invoke-static {v6, v8}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    const-string v6, ""

    const-string v8, "default"

    .line 5
    invoke-static {v6, v8}, Lx/e;->f(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p2, v4, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v4

    const-string v8, "LATEST_AVAILABLE_VERSION_MD5"

    invoke-interface {v4, v8, v6}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    if-nez v4, :cond_ab

    goto :goto_ac

    :cond_ab
    move-object v6, v4

    .line 6
    :goto_ac
    invoke-static {v5, v6, v7}, Lp9/h;->r(Ljava/lang/String;Ljava/lang/String;Z)Z

    move-result v4

    if-eqz v4, :cond_14e

    new-array p1, v3, [Ljava/lang/Object;

    const-string v4, "debugupdate Installing update now!"

    invoke-static {v4, p1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    const p1, 0x7f1100c7

    invoke-static {p2, p1, v7}, Landroid/widget/Toast;->makeText(Landroid/content/Context;II)Landroid/widget/Toast;

    move-result-object p1

    invoke-virtual {p1}, Landroid/widget/Toast;->show()V

    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object p1

    const-string v0, "appFile.absolutePath"

    invoke-static {p1, v0}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-string v0, "debugupdate Installing apk "

    .line 7
    invoke-static {v0, p1}, Lx/e;->k(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    new-array v4, v3, [Ljava/lang/Object;

    invoke-static {v0, v4}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    :try_start_d7
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v4, 0x1b

    if-le v0, v4, :cond_eb

    new-instance v0, Ljava/io/FileInputStream;

    new-instance v1, Ljava/io/File;

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

    invoke-direct {v0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    invoke-virtual {p0, p2, v0}, Ls4/q;->d(Landroid/content/Context;Ljava/io/InputStream;)Z

    goto :goto_15b

    :cond_eb
    const-string v0, "android.content.pm.IPackageInstallObserver"

    invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;

    move-result-object v4

    new-array v5, v7, [Ljava/lang/Class;

    aput-object v0, v5, v3

    new-instance v6, Ls4/q$a;

    invoke-direct {v6}, Ls4/q$a;-><init>()V

    invoke-static {v4, v5, v6}, Ljava/lang/reflect/Proxy;->newProxyInstance(Ljava/lang/ClassLoader;[Ljava/lang/Class;Ljava/lang/reflect/InvocationHandler;)Ljava/lang/Object;

    move-result-object v4

    const-string v5, "newProxyInstance(\n      \u2026ndler()\n                )"

    invoke-static {v4, v5}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    const-class v5, Landroid/content/pm/PackageManager;

    const-string v6, "installPackage"

    new-array v8, v2, [Ljava/lang/Class;

    const-class v9, Landroid/net/Uri;

    aput-object v9, v8, v3

    aput-object v0, v8, v7

    sget-object v0, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;

    const/4 v9, 0x2

    aput-object v0, v8, v9

    const-class v0, Ljava/lang/String;

    const/4 v10, 0x3

    aput-object v0, v8, v10

    invoke-virtual {v5, v6, v8}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v0

    const-string v5, "PackageManager::class.ja\u2026ss.java\n                )"

    invoke-static {v0, v5}, Lx/e;->e(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p2}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object p2

    new-array v2, v2, [Ljava/lang/Object;

    new-instance v5, Ljava/io/File;

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

    invoke-static {v5}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object p1

    aput-object p1, v2, v3

    aput-object v4, v2, v7

    invoke-static {v9}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v2, v9

    aput-object v1, v2, v10

    invoke-virtual {v0, p2, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_144
    .catch Ljava/lang/Exception; {:try_start_d7 .. :try_end_144} :catch_145

    goto :goto_15b

    :catch_145
    move-exception p1

    new-array p2, v3, [Ljava/lang/Object;

    const-string v0, "debugupdate"

    invoke-static {p1, v0, p2}, Lbb/a;->d(Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_15b

    :cond_14e
    new-array v1, v3, [Ljava/lang/Object;

    const-string v2, "debugupdate Downloading again because md5 mismatch!"

    .line 8
    invoke-static {v2, v1}, Lbb/a;->a(Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    :cond_158
    invoke-virtual {p0, p1, p2, v0}, Ls4/q;->b(Lq9/w;Landroid/content/Context;Ljava/io/File;)V

    :cond_15b
    :goto_15b
    return-void
.end method
