a.smali
.class public Lcom/iflytek/idata/extension/a;
.super Ljava/lang/Object;
# interfaces
.implements Ljava/lang/Runnable;
# instance fields
.field protected a:Landroid/content/Context;
.field private b:Lcom/iflytek/idata/extension/b$a;
.field private c:Z
# direct methods
.method public constructor <init>(Landroid/content/Context;Z)V
.registers 4
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Lcom/iflytek/idata/extension/a$1;
invoke-direct {v0, p0}, Lcom/iflytek/idata/extension/a$1;-><init>(Lcom/iflytek/idata/extension/a;)V
iput-object v0, p0, Lcom/iflytek/idata/extension/a;->b:Lcom/iflytek/idata/extension/b$a;
iput-object p1, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
iput-boolean p2, p0, Lcom/iflytek/idata/extension/a;->c:Z
return-void
.end method
.method private a()V
.registers 6
const-wide/16 v0, 0x2710
:try_start_2
invoke-static {v0, v1}, Landroid/os/SystemClock;->sleep(J)V
invoke-direct {p0}, Lcom/iflytek/idata/extension/a;->b()Z
move-result v0
if-eqz v0, :cond_6a
iget-object v0, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-static {v0}, Lcom/iflytek/thirdparty/av;->a(Landroid/content/Context;)Z
move-result v0
if-eqz v0, :cond_6a
new-instance v0, Lcom/iflytek/idata/extension/b;
invoke-direct {v0}, Lcom/iflytek/idata/extension/b;-><init>()V
const/16 v1, 0x4e20
invoke-virtual {v0, v1}, Lcom/iflytek/idata/extension/b;->b(I)V
const/4 v1, 0x1
invoke-virtual {v0, v1}, Lcom/iflytek/idata/extension/b;->a(I)V
new-instance v1, Lorg/json/JSONObject;
invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V
const-string v2, "appid"
iget-object v3, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-static {v3}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->a(Landroid/content/Context;)Lcom/iflytek/idata/extension/IFlyCollectorExt;
move-result-object v3
invoke-virtual {v3}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->d()Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
iget-object v2, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-static {v2}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->a(Landroid/content/Context;)Lcom/iflytek/idata/extension/IFlyCollectorExt;
move-result-object v2
invoke-virtual {v2}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->a()Ljava/lang/String;
move-result-object v2
const-string v3, "ver"
invoke-virtual {v1, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v2, "impl"
const/4 v3, 0x2
invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
const-string v2, "pkg"
iget-object v3, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-virtual {v3}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v2, "https://logconf.iflytek.com/hotupdate"
const/4 v3, 0x0
invoke-virtual {v1}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
move-result-object v1
const-string v4, "utf-8"
invoke-virtual {v1, v4}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B
move-result-object v1
invoke-virtual {v0, v2, v3, v1}, Lcom/iflytek/idata/extension/b;->a(Ljava/lang/String;Ljava/lang/String;[B)V
iget-object v1, p0, Lcom/iflytek/idata/extension/a;->b:Lcom/iflytek/idata/extension/b$a;
invoke-virtual {v0, v1}, Lcom/iflytek/idata/extension/b;->b(Lcom/iflytek/idata/extension/b$a;)V
:try_end_6a
.catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_6a} :catch_6b
:cond_6a
:goto_6a
return-void
:catch_6b
move-exception v0
const-string v0, "Collector"
const-string v1, "exception occur while update"
invoke-static {v0, v1}, Lcom/iflytek/thirdparty/aw;->c(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_6a
.end method
.method static synthetic a(Lcom/iflytek/idata/extension/a;Lorg/json/JSONObject;)V
.registers 2
invoke-direct {p0, p1}, Lcom/iflytek/idata/extension/a;->a(Lorg/json/JSONObject;)V
return-void
.end method
.method private static a(Ljava/io/Closeable;)V
.registers 2
if-eqz p0, :cond_5
:try_start_2
invoke-interface {p0}, Ljava/io/Closeable;->close()V
:try_end_5
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_5} :catch_6
:cond_5
:goto_5
return-void
:catch_6
move-exception v0
goto :goto_5
.end method
.method private a(Lorg/json/JSONObject;)V
.registers 6
const-string v0, "update"
invoke-virtual {p1, v0}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
const-string v1, "yes"
invoke-virtual {v1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_39
const-string v0, "msg"
invoke-virtual {p1, v0}, Lorg/json/JSONObject;->optString(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-nez v1, :cond_22
const/4 v1, 0x0
invoke-static {v0, v1}, Landroid/util/Base64;->decode(Ljava/lang/String;I)[B
move-result-object v0
invoke-direct {p0, v0}, Lcom/iflytek/idata/extension/a;->a([B)V
:cond_22
:goto_22
iget-object v0, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-static {v0}, Lcom/iflytek/thirdparty/av;->b(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "last_check_time"
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v2
invoke-interface {v0, v1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
return-void
:cond_39
const-string v0, "Collector"
const-string v1, "no need to update"
invoke-static {v0, v1}, Lcom/iflytek/thirdparty/aw;->a(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_22
.end method
.method private a([B)V
.registers 6
const/4 v2, 0x0
iget-object v0, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-static {v0}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->a(Landroid/content/Context;)Lcom/iflytek/idata/extension/IFlyCollectorExt;
move-result-object v0
invoke-virtual {v0}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->c()V
new-instance v1, Ljava/io/File;
invoke-virtual {v0}, Lcom/iflytek/idata/extension/IFlyCollectorExt;->b()Ljava/lang/String;
move-result-object v0
invoke-static {}, Lcom/iflytek/thirdparty/av;->a()Ljava/lang/String;
move-result-object v3
invoke-direct {v1, v0, v3}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V
:try_start_17
new-instance v3, Ljava/io/FileOutputStream;
invoke-direct {v3, v1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
:try_end_1c
.catch Ljava/lang/Throwable; {:try_start_17 .. :try_end_1c} :catch_2b
.catchall {:try_start_17 .. :try_end_1c} :catchall_37
:try_start_1c
new-instance v1, Ljava/io/BufferedOutputStream;
invoke-direct {v1, v3}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
:try_end_21
.catch Ljava/lang/Throwable; {:try_start_1c .. :try_end_21} :catch_49
.catchall {:try_start_1c .. :try_end_21} :catchall_40
:try_start_21
invoke-virtual {v1, p1}, Ljava/io/BufferedOutputStream;->write([B)V
:try_end_24
.catch Ljava/lang/Throwable; {:try_start_21 .. :try_end_24} :catch_4d
.catchall {:try_start_21 .. :try_end_24} :catchall_42
invoke-static {v1}, Lcom/iflytek/idata/extension/a;->a(Ljava/io/Closeable;)V
invoke-static {v3}, Lcom/iflytek/idata/extension/a;->a(Ljava/io/Closeable;)V
:goto_2a
return-void
:catch_2b
move-exception v0
move-object v1, v2
:goto_2d
:try_start_2d
invoke-virtual {v0}, Ljava/lang/Throwable;->printStackTrace()V
:try_end_30
.catchall {:try_start_2d .. :try_end_30} :catchall_45
invoke-static {v1}, Lcom/iflytek/idata/extension/a;->a(Ljava/io/Closeable;)V
invoke-static {v2}, Lcom/iflytek/idata/extension/a;->a(Ljava/io/Closeable;)V
goto :goto_2a
:catchall_37
move-exception v0
move-object v3, v2
:goto_39
invoke-static {v2}, Lcom/iflytek/idata/extension/a;->a(Ljava/io/Closeable;)V
invoke-static {v3}, Lcom/iflytek/idata/extension/a;->a(Ljava/io/Closeable;)V
throw v0
:catchall_40
move-exception v0
goto :goto_39
:catchall_42
move-exception v0
move-object v2, v1
goto :goto_39
:catchall_45
move-exception v0
move-object v3, v2
move-object v2, v1
goto :goto_39
:catch_49
move-exception v0
move-object v1, v2
move-object v2, v3
goto :goto_2d
:catch_4d
move-exception v0
move-object v2, v3
goto :goto_2d
.end method
.method private b()Z
.registers 7
const/4 v0, 0x1
iget-boolean v1, p0, Lcom/iflytek/idata/extension/a;->c:Z
if-eqz v1, :cond_6
:cond_5
:goto_5
return v0
:cond_6
iget-object v1, p0, Lcom/iflytek/idata/extension/a;->a:Landroid/content/Context;
invoke-static {v1}, Lcom/iflytek/thirdparty/av;->b(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v1
if-eqz v1, :cond_5
const-string v2, "last_check_time"
const-wide/16 v4, 0x0
invoke-interface {v1, v2, v4, v5}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J
move-result-wide v2
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v4
sub-long v2, v4, v2
const-wide/32 v4, 0x240c8400
cmp-long v1, v2, v4
if-gtz v1, :cond_5
const/4 v0, 0x0
goto :goto_5
.end method
# virtual methods
.method public run()V
.registers 1
invoke-direct {p0}, Lcom/iflytek/idata/extension/a;->a()V
return-void
.end method