ComponentUtils.smali
.class public Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;
.super Ljava/lang/Object;
.source "ComponentUtils.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;
}
.end annotation
# static fields
.field static final synthetic $assertionsDisabled:Z
.field public static final FLAG_ACTIVITY_CLEAR_TASK:I = 0x8000
.field public static final START_INTENT_FAILED_NOT_EXPORTED:I = -0x2
.field public static final START_INTENT_FAILED_NO_ACTIVITY_FOUND:I = -0x1
.field public static final START_INTENT_FAILED_NULL_POINTER:I = -0x3
.field public static final START_INTENT_SUCCESS:I = 0x0
.field public static final TAG:Ljava/lang/String; = "ComponentUtils"
# direct methods
.method static constructor <clinit>()V
.registers 1
.prologue
.line 30
const-class v0, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;
invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z
move-result v0
if-nez v0, :cond_c
const/4 v0, 0x1
:goto_9
sput-boolean v0, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->$assertionsDisabled:Z
return-void
:cond_c
const/4 v0, 0x0
goto :goto_9
.end method
.method public constructor <init>()V
.registers 1
.prologue
.line 30
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static addClearTaskFlag(Landroid/content/Intent;)V
.registers 2
.annotation build Landroid/annotation/TargetApi;
value = 0xb
.end annotation
.prologue
.line 208
sget-boolean v0, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->$assertionsDisabled:Z
if-nez v0, :cond_c
if-nez p0, :cond_c
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
throw v0
.line 209
:cond_c
const v0, 0x8000
invoke-virtual {p0, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
.line 210
return-void
.end method
.method public static cancelActivityTransition(Landroid/content/Context;)V
.registers 6
.prologue
.line 124
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 v1, 0x5
if-lt v0, v1, :cond_1f
.line 127
:try_start_5
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
const-string/jumbo v1, "overridePendingTransition"
const/4 v2, 0x2
new-array v2, v2, [Ljava/lang/Class;
const/4 v3, 0x0
sget-object v4, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
aput-object v4, v2, v3
const/4 v3, 0x1
sget-object v4, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
aput-object v4, v2, v3
invoke-virtual {v0, v1, v2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
move-result-object v0
.line 128
if-nez v0, :cond_20
.line 136
:cond_1f
:goto_1f
return-void
.line 132
:cond_20
const/4 v1, 0x2
new-array v1, v1, [Ljava/lang/Object;
const/4 v2, 0x0
const/4 v3, -0x1
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
aput-object v3, v1, v2
const/4 v2, 0x1
const/4 v3, -0x1
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v3
aput-object v3, v1, v2
invoke-virtual {v0, p0, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
:try_end_36
.catch Ljava/lang/Exception; {:try_start_5 .. :try_end_36} :catch_37
goto :goto_1f
.line 133
:catch_37
move-exception v0
goto :goto_1f
.end method
.method public static checkIsFinishing(Landroid/content/Context;)Z
.registers 2
.prologue
.line 225
if-eqz p0, :cond_10
instance-of v0, p0, Landroid/app/Activity;
if-eqz v0, :cond_10
.line 226
check-cast p0, Landroid/app/Activity;
invoke-virtual {p0}, Landroid/app/Activity;->isFinishing()Z
move-result v0
if-eqz v0, :cond_10
.line 227
const/4 v0, 0x1
.line 230
:goto_f
return v0
:cond_10
const/4 v0, 0x0
goto :goto_f
.end method
.method public static getCurrentMusicPkgName()Ljava/lang/String;
.registers 3
.prologue
const/4 v1, 0x0
.line 256
:try_start_1
invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getAppContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v2
.line 257
const-string v0, "audio"
invoke-virtual {v2, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/AudioManager;
.line 258
invoke-virtual {v0}, Landroid/media/AudioManager;->isMusicActive()Z
move-result v0
if-eqz v0, :cond_37
.line 259
const-string v0, "media_button_receiver"
.line 260
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v2, "media_button_receiver"
invoke-static {v0, v2}, Landroid/provider/Settings$System;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
.line 261
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-nez v2, :cond_37
.line 262
invoke-static {v0}, Landroid/content/ComponentName;->unflattenFromString(Ljava/lang/String;)Landroid/content/ComponentName;
move-result-object v0
.line 263
if-eqz v0, :cond_37
.line 264
invoke-virtual {v0}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;
:try_end_32
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_32} :catch_34
move-result-object v0
.line 272
:goto_33
return-object v0
.line 268
:catch_34
move-exception v0
move-object v0, v1
.line 269
goto :goto_33
:cond_37
move-object v0, v1
goto :goto_33
.end method
.method public static getCurrentMusicPkgName(Landroid/content/Context;)Ljava/lang/String;
.registers 4
.prologue
const/4 v1, 0x0
.line 285
if-nez p0, :cond_4
.line 306
:goto_3
return-object v1
.line 291
:cond_4
:try_start_4
const-string v0, "audio"
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/AudioManager;
.line 292
invoke-virtual {v0}, Landroid/media/AudioManager;->isMusicActive()Z
move-result v0
if-eqz v0, :cond_33
.line 293
const-string v0, "media_button_receiver"
.line 294
invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v2, "media_button_receiver"
invoke-static {v0, v2}, Landroid/provider/Settings$System;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
.line 295
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-nez v2, :cond_33
.line 296
invoke-static {v0}, Landroid/content/ComponentName;->unflattenFromString(Ljava/lang/String;)Landroid/content/ComponentName;
move-result-object v0
.line 297
if-eqz v0, :cond_33
.line 298
invoke-virtual {v0}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;
:try_end_2d
.catch Ljava/lang/Exception; {:try_start_4 .. :try_end_2d} :catch_30
move-result-object v0
:goto_2e
move-object v1, v0
.line 306
goto :goto_3
.line 302
:catch_30
move-exception v0
move-object v0, v1
.line 303
goto :goto_2e
:cond_33
move-object v0, v1
goto :goto_2e
.end method
.method public static getProcessStateByAbove21(Landroid/app/ActivityManager$RunningAppProcessInfo;)I
.registers 4
.prologue
const/4 v1, -0x1
.line 234
.line 235
if-eqz p0, :cond_25
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x15
if-lt v0, v2, :cond_25
.line 237
:try_start_9
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
.line 238
const-string/jumbo v2, "processState"
invoke-virtual {v0, v2}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v0
.line 239
const/4 v2, 0x1
invoke-virtual {v0, v2}, Ljava/lang/reflect/Field;->setAccessible(Z)V
.line 240
invoke-virtual {v0, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Integer;
.line 241
if-eqz v0, :cond_28
.line 242
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
:try_end_23
.catch Ljava/lang/Throwable; {:try_start_9 .. :try_end_23} :catch_26
move-result v0
:goto_24
move v1, v0
.line 248
:cond_25
:goto_25
return v1
.line 244
:catch_26
move-exception v0
goto :goto_25
:cond_28
move v0, v1
goto :goto_24
.end method
.method public static hasAction(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Z
.registers 7
.prologue
const/4 v1, 0x0
.line 50
new-instance v0, Landroid/content/Intent;
invoke-direct {v0, p1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 53
:try_start_6
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
const/4 v3, 0x2
invoke-virtual {v2, v0, v3}, Landroid/content/pm/PackageManager;->queryBroadcastReceivers(Landroid/content/Intent;I)Ljava/util/List;
:try_end_e
.catch Ljava/lang/Exception; {:try_start_6 .. :try_end_e} :catch_33
move-result-object v0
.line 59
if-eqz v0, :cond_36
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v2
if-lez v2, :cond_36
.line 60
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v2
:cond_1b
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_36
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/content/pm/ResolveInfo;
.line 61
iget-object v0, v0, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
iget-object v0, v0, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;
invoke-virtual {v0, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1b
.line 62
const/4 v0, 0x1
.line 66
:goto_32
return v0
.line 54
:catch_33
move-exception v0
move v0, v1
.line 56
goto :goto_32
:cond_36
move v0, v1
.line 66
goto :goto_32
.end method
.method public static isInMainThread()Z
.registers 2
.prologue
.line 203
invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;
move-result-object v0
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
move-result-object v1
if-ne v0, v1, :cond_c
const/4 v0, 0x1
:goto_b
return v0
:cond_c
const/4 v0, 0x0
goto :goto_b
.end method
.method public static startAPKDownload(Ljava/lang/String;Ljava/lang/String;Landroid/content/Context;)V
.registers 6
.prologue
.line 185
if-nez p0, :cond_3
.line 200
:cond_2
:goto_2
return-void
.line 189
:cond_3
const/4 v0, 0x0
.line 190
invoke-static {p2}, Lcom/cleanmaster/hpsharelib/base/util/system/PackageUtils;->isGPAvailable(Landroid/content/Context;)Z
move-result v1
if-eqz v1, :cond_e
.line 191
invoke-static {p0, p2}, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->startGooglePlay(Ljava/lang/String;Landroid/content/Context;)Z
move-result v0
.line 193
:cond_e
if-nez v0, :cond_2
.line 194
if-nez p1, :cond_25
.line 195
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "https://play.google.com/store/apps/details?id="
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
.line 197
:cond_25
new-instance v0, Landroid/content/Intent;
const-string v1, "android.intent.action.VIEW"
invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v2
invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
.line 198
invoke-static {p2, v0}, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->startActivity(Landroid/content/Context;Landroid/content/Intent;)Z
goto :goto_2
.end method
.method public static startActivity(Landroid/content/Context;Landroid/content/Intent;)Z
.registers 5
.prologue
.line 72
:try_start_0
invoke-virtual {p0, p1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
:try_end_3
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_3} :catch_5
.line 85
const/4 v0, 0x1
:goto_4
return v0
.line 73
:catch_5
move-exception v0
.line 78
instance-of v1, v0, Landroid/util/AndroidRuntimeException;
if-eqz v1, :cond_1f
invoke-virtual {v0}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;
move-result-object v1
const-string v2, "FLAG_ACTIVITY_NEW_TASK"
invoke-virtual {v1, v2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v1
if-eqz v1, :cond_1f
.line 79
invoke-static {}, Lcom/cm/plugincluster/crash/MyCrashHandlerHostProxy;->getInstance()Lcom/cm/plugincluster/common/interfaces/IMyCrashHandler;
move-result-object v1
const-string v2, "5005"
invoke-interface {v1, v2, v0}, Lcom/cm/plugincluster/common/interfaces/IMyCrashHandler;->recordCustomException(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 83
:cond_1f
const/4 v0, 0x0
goto :goto_4
.end method
.method public static startActivityByStat(Landroid/content/Context;Landroid/content/Intent;)I
.registers 3
.prologue
.line 109
const/4 v0, 0x0
.line 111
:try_start_1
invoke-virtual {p0, p1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
:try_end_4
.catch Landroid/content/ActivityNotFoundException; {:try_start_1 .. :try_end_4} :catch_5
.catch Ljava/lang/SecurityException; {:try_start_1 .. :try_end_4} :catch_8
.catch Ljava/lang/NullPointerException; {:try_start_1 .. :try_end_4} :catch_b
.line 119
:goto_4
return v0
.line 112
:catch_5
move-exception v0
.line 113
const/4 v0, -0x1
.line 118
goto :goto_4
.line 114
:catch_8
move-exception v0
.line 115
const/4 v0, -0x2
.line 118
goto :goto_4
.line 116
:catch_b
move-exception v0
.line 117
const/4 v0, -0x3
goto :goto_4
.end method
.method public static startActivityClearTask(Landroid/content/Context;Landroid/content/Intent;)Z
.registers 5
.prologue
.line 213
const/4 v0, 0x0
.line 214
if-eqz p1, :cond_15
.line 215
const/high16 v0, 0x10000000
.line 216
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0xb
if-lt v1, v2, :cond_e
.line 217
const v0, 0x10008000
.line 218
:cond_e
invoke-virtual {p1, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
.line 219
invoke-static {p0, p1}, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->startActivity(Landroid/content/Context;Landroid/content/Intent;)Z
move-result v0
.line 221
:cond_15
return v0
.end method
.method public static startActivityNeedResult(Landroid/content/Context;Landroid/content/Intent;)Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;
.registers 3
.prologue
.line 91
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
.line 92
invoke-virtual {p1, v0}, Landroid/content/Intent;->resolveActivity(Landroid/content/pm/PackageManager;)Landroid/content/ComponentName;
move-result-object v0
.line 93
if-nez v0, :cond_d
.line 94
sget-object v0, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;->RESOLVE:Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;
.line 105
:goto_c
return-object v0
.line 97
:cond_d
:try_start_d
invoke-virtual {p0, p1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
.line 98
sget-object v0, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;->SUCCESS:Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;
:try_end_12
.catch Ljava/lang/Exception; {:try_start_d .. :try_end_12} :catch_13
goto :goto_c
.line 99
:catch_13
move-exception v0
.line 100
sget-object v0, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;->EXCEPTION:Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils$StartActivityResult;
goto :goto_c
.end method
.method public static startGooglePlay(Ljava/lang/String;Landroid/content/Context;)Z
.registers 5
.prologue
.line 139
if-eqz p0, :cond_8
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v0
if-nez v0, :cond_a
.line 140
:cond_8
const/4 v0, 0x0
.line 146
:goto_9
return v0
.line 142
:cond_a
new-instance v0, Landroid/content/Intent;
const-string v1, "android.intent.action.VIEW"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 143
const/high16 v1, 0x10000000
invoke-virtual {v0, v1}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
.line 144
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "market://details?id="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/content/Intent;->setData(Landroid/net/Uri;)Landroid/content/Intent;
.line 146
invoke-static {p1, v0}, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->startActivity(Landroid/content/Context;Landroid/content/Intent;)Z
move-result v0
goto :goto_9
.end method
.method public static startGooglePlayByUrl(Ljava/lang/String;Landroid/content/Context;)Z
.registers 5
.prologue
const/4 v0, 0x0
.line 154
if-eqz p0, :cond_9
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v1
if-nez v1, :cond_a
.line 173
:cond_9
:goto_9
return v0
.line 159
:cond_a
:try_start_a
new-instance v1, Landroid/content/Intent;
const-string v2, "android.intent.action.VIEW"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 161
const-string v2, "com.android.vending"
invoke-virtual {v1, v2}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
.line 162
instance-of v2, p1, Landroid/app/Activity;
if-nez v2, :cond_2b
.line 163
const/high16 v2, 0x10000000
invoke-virtual {v1, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
.line 168
:goto_1f
invoke-static {p0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v2
invoke-virtual {v1, v2}, Landroid/content/Intent;->setData(Landroid/net/Uri;)Landroid/content/Intent;
.line 170
invoke-static {p1, v1}, Lcom/cleanmaster/hpsharelib/base/util/system/ComponentUtils;->startActivity(Landroid/content/Context;Landroid/content/Intent;)Z
move-result v0
goto :goto_9
.line 165
:cond_2b
const/high16 v2, 0x80000
invoke-virtual {v1, v2}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
:try_end_30
.catch Ljava/lang/Exception; {:try_start_a .. :try_end_30} :catch_31
goto :goto_1f
.line 171
:catch_31
move-exception v1
.line 172
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_9
.end method