FileCloudService.smali

.class public Lcom/cleanmaster/filecloud/FileCloudService;
.super Landroid/app/IntentService;
.source "FileCloudService.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;
    }
.end annotation


# static fields
.field public static final ACTION_FILE_CLOUD_START_SCAN:I = 0x100

.field public static final ACTION_INVALID:I = 0x0

.field public static final KEY_ACTION:Ljava/lang/String; = "key_action"

.field public static final KEY_RECEIVER:Ljava/lang/String; = "key_receiver"

.field public static final KEY_VALUE:Ljava/lang/String; = "key_value"

.field private static final TAG:Ljava/lang/String; = "FileCloudService"


# instance fields
.field private mIResultReceiver:Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;

.field private mReceiver:Landroid/os/ResultReceiver;


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

    .prologue
    .line 53
    const-string v0, "FileCloudService"

    invoke-direct {p0, v0}, Landroid/app/IntentService;-><init>(Ljava/lang/String;)V

    .line 39
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mReceiver:Landroid/os/ResultReceiver;

    .line 40
    new-instance v0, Lcom/cleanmaster/filecloud/FileCloudService$1;

    invoke-direct {v0, p0}, Lcom/cleanmaster/filecloud/FileCloudService$1;-><init>(Lcom/cleanmaster/filecloud/FileCloudService;)V

    iput-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mIResultReceiver:Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;

    .line 54
    return-void
.end method

.method static synthetic access$000(Lcom/cleanmaster/filecloud/FileCloudService;)V
    .registers 1

    .prologue
    .line 26
    invoke-direct {p0}, Lcom/cleanmaster/filecloud/FileCloudService;->resultReceiverBackFail()V

    return-void
.end method

.method static synthetic access$100(Lcom/cleanmaster/filecloud/FileCloudService;)V
    .registers 1

    .prologue
    .line 26
    invoke-direct {p0}, Lcom/cleanmaster/filecloud/FileCloudService;->resultReceiverBackSuccess()V

    return-void
.end method

.method private resultReceiverBackFail()V
    .registers 4

    .prologue
    .line 139
    const-string v0, "FileCloudService"

    const-string/jumbo v1, "onResultReceiverBackFail"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 140
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mReceiver:Landroid/os/ResultReceiver;

    if-eqz v0, :cond_17

    .line 141
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mReceiver:Landroid/os/ResultReceiver;

    const/4 v1, -0x1

    new-instance v2, Landroid/os/Bundle;

    invoke-direct {v2}, Landroid/os/Bundle;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/os/ResultReceiver;->send(ILandroid/os/Bundle;)V

    .line 143
    :cond_17
    return-void
.end method

.method private resultReceiverBackSuccess()V
    .registers 4

    .prologue
    .line 146
    const-string v0, "FileCloudService"

    const-string/jumbo v1, "onResultReceiverBackSuccess"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 147
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mReceiver:Landroid/os/ResultReceiver;

    if-eqz v0, :cond_17

    .line 148
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mReceiver:Landroid/os/ResultReceiver;

    const/4 v1, 0x1

    new-instance v2, Landroid/os/Bundle;

    invoke-direct {v2}, Landroid/os/Bundle;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/os/ResultReceiver;->send(ILandroid/os/Bundle;)V

    .line 150
    :cond_17
    return-void
.end method

.method private startFileCloudScan(Landroid/content/Intent;)V
    .registers 11

    .prologue
    .line 92
    :try_start_0
    const-string v0, "key_value"

    invoke-virtual {p1, v0}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 94
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_17

    .line 95
    const/16 v0, 0x2717

    invoke-static {v0}, Lcom/cleanmaster/filecloud/report/cm_cn_wechat_cloud_dev;->reportLuaEnd(I)V

    .line 96
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mIResultReceiver:Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;

    invoke-interface {v0}, Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;->onResultReceiverBackFail()V

    .line 124
    :goto_16
    return-void

    .line 100
    :cond_17
    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    .line 101
    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 102
    invoke-virtual {v4}, Lorg/json/JSONObject;->keys()Ljava/util/Iterator;

    move-result-object v5

    .line 104
    :cond_25
    :goto_25
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_6d

    .line 105
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    .line 106
    invoke-virtual {v4, v0}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v6

    .line 107
    if-eqz v6, :cond_25

    .line 111
    invoke-virtual {v6}, Lorg/json/JSONArray;->length()I

    move-result v7

    .line 112
    new-instance v8, Ljava/util/ArrayList;

    invoke-direct {v8}, Ljava/util/ArrayList;-><init>()V

    .line 113
    const/4 v1, 0x0

    move v2, v1

    :goto_42
    if-ge v2, v7, :cond_51

    .line 114
    invoke-virtual {v6, v2}, Lorg/json/JSONArray;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    invoke-interface {v8, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 113
    add-int/lit8 v1, v2, 0x1

    move v2, v1

    goto :goto_42

    .line 116
    :cond_51
    new-instance v1, Lcom/cleanmaster/filecloud/beans/ScanItem;

    invoke-direct {v1, v0, v8}, Lcom/cleanmaster/filecloud/beans/ScanItem;-><init>(Ljava/lang/String;Ljava/util/List;)V

    invoke-interface {v3, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_59
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_59} :catch_5a

    goto :goto_25

    .line 119
    :catch_5a
    move-exception v0

    .line 120
    const/16 v1, 0x2718

    invoke-static {v1}, Lcom/cleanmaster/filecloud/report/cm_cn_wechat_cloud_dev;->reportLuaEnd(I)V

    .line 121
    const-string v1, "FileCloudService"

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

    move-result-object v0

    invoke-static {v1, v0}, Lcom/cleanmaster/filecloud/utils/LogUtils;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 122
    invoke-direct {p0}, Lcom/cleanmaster/filecloud/FileCloudService;->resultReceiverBackFail()V

    goto :goto_16

    .line 118
    :cond_6d
    :try_start_6d
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mIResultReceiver:Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;

    invoke-static {v3, v0}, Lcom/cleanmaster/filecloud/FileCloudManager;->scan(Ljava/util/List;Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;)V
    :try_end_72
    .catch Ljava/lang/Throwable; {:try_start_6d .. :try_end_72} :catch_5a

    goto :goto_16
.end method


# virtual methods
.method protected onHandleIntent(Landroid/content/Intent;)V
    .registers 5
    .param p1    # Landroid/content/Intent;
        .annotation build Landroid/support/annotation/Nullable;
        .end annotation
    .end param

    .prologue
    const/4 v1, 0x0

    .line 58
    if-nez p1, :cond_4

    .line 88
    :goto_3
    return-void

    .line 62
    :cond_4
    :try_start_4
    const-string v0, "key_receiver"

    invoke-virtual {p1, v0}, Landroid/content/Intent;->hasExtra(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_16

    .line 63
    const-string v0, "key_receiver"

    invoke-virtual {p1, v0}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object v0

    check-cast v0, Landroid/os/ResultReceiver;

    iput-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mReceiver:Landroid/os/ResultReceiver;
    :try_end_16
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_16} :catch_3e

    .line 70
    :cond_16
    :goto_16
    :try_start_16
    const-string v0, "key_action"

    const/4 v2, 0x0

    invoke-virtual {p1, v0, v2}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I
    :try_end_1c
    .catch Ljava/lang/Throwable; {:try_start_16 .. :try_end_1c} :catch_2a

    move-result v0

    .line 75
    :goto_1d
    if-nez v0, :cond_36

    .line 76
    const/16 v0, 0x2716

    invoke-static {v0}, Lcom/cleanmaster/filecloud/report/cm_cn_wechat_cloud_dev;->reportLuaEnd(I)V

    .line 77
    iget-object v0, p0, Lcom/cleanmaster/filecloud/FileCloudService;->mIResultReceiver:Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;

    invoke-interface {v0}, Lcom/cleanmaster/filecloud/FileCloudService$IResultReceiver;->onResultReceiverBackFail()V

    goto :goto_3

    .line 71
    :catch_2a
    move-exception v0

    .line 72
    const-string v2, "FileCloudService"

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

    move-result-object v0

    invoke-static {v2, v0}, Lcom/cleanmaster/filecloud/utils/LogUtils;->e(Ljava/lang/String;Ljava/lang/String;)V

    move v0, v1

    goto :goto_1d

    .line 81
    :cond_36
    packed-switch v0, :pswitch_data_40

    goto :goto_3

    .line 83
    :pswitch_3a
    invoke-direct {p0, p1}, Lcom/cleanmaster/filecloud/FileCloudService;->startFileCloudScan(Landroid/content/Intent;)V

    goto :goto_3

    .line 65
    :catch_3e
    move-exception v0

    goto :goto_16

    .line 81
    :pswitch_data_40
    .packed-switch 0x100
        :pswitch_3a
    .end packed-switch
.end method