TopAppQuery.smali
.class public Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;
.super Ljava/lang/Object;
.source "TopAppQuery.java"
# static fields
.field private static lastQueryTime:J
# instance fields
.field private mIsRoot:Z
# direct methods
.method static constructor <clinit>()V
.registers 2
.prologue
.line 25
const-wide/16 v0, 0x0
sput-wide v0, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->lastQueryTime:J
return-void
.end method
.method public constructor <init>()V
.registers 2
.prologue
.line 24
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 27
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->mIsRoot:Z
return-void
.end method
.method private static getCurTop()Ljava/lang/String;
.registers 3
.prologue
.line 68
const-string v1, ""
.line 69
invoke-static {}, Lcom/cleanmaster/hpsharelib/base/ipc/ServiceManager;->getInstance()Lcom/cleanmaster/hpsharelib/base/ipc/ServiceManager;
move-result-object v0
sget-object v2, Lcom/cleanmaster/hpsharelib/synipc/ServiceDefine;->BOOST_SCENE_SERVICE:Ljava/lang/String;
invoke-virtual {v0, v2}, Lcom/cleanmaster/hpsharelib/base/ipc/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IInterface;
move-result-object v0
check-cast v0, Lcom/cleanmaster/hpsharelib/synipc/IBoostSceneService;
.line 70
if-eqz v0, :cond_19
.line 72
:try_start_10
invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/synipc/IBoostSceneService;->getCurrentTopPkgName()Ljava/lang/String;
:try_end_13
.catch Landroid/os/RemoteException; {:try_start_10 .. :try_end_13} :catch_15
move-result-object v0
.line 77
:goto_14
return-object v0
.line 73
:catch_15
move-exception v0
.line 74
invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V
:cond_19
move-object v0, v1
goto :goto_14
.end method
.method public static getTopAppPkgName(Landroid/content/Context;)Ljava/lang/String;
.registers 5
.prologue
.line 38
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x15
if-lt v0, v1, :cond_1f
.line 50
invoke-static {p0}, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->getTopAppPkgNameAbove21(Landroid/content/Context;)Ljava/lang/String;
move-result-object v0
.line 53
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v1
if-eqz v1, :cond_14
.line 54
invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->getCurTop()Ljava/lang/String;
move-result-object v0
.line 57
:cond_14
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v2
sput-wide v2, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->lastQueryTime:J
.line 63
:goto_1a
if-nez v0, :cond_1e
const-string v0, ""
:cond_1e
return-object v0
.line 60
:cond_1f
invoke-static {p0}, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->getTopAppPkgNameBelow21(Landroid/content/Context;)Ljava/lang/String;
move-result-object v0
goto :goto_1a
.end method
.method private static getTopAppPkgNameAbove21(Landroid/content/Context;)Ljava/lang/String;
.registers 6
.prologue
const/4 v2, 0x0
.line 107
const-string v0, "activity"
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/ActivityManager;
.line 108
if-nez v0, :cond_d
move-object v0, v2
.line 135
:goto_c
return-object v0
.line 110
:cond_d
new-instance v0, Lcom/cleanmaster/activitymanagerhelper/ActivityManagerHelper;
invoke-direct {v0}, Lcom/cleanmaster/activitymanagerhelper/ActivityManagerHelper;-><init>()V
.line 111
invoke-static {}, Lcom/cmcm/rtstub/RTApiClient;->getInst()Lcom/cmcm/rtstub/RTApiClient;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/cleanmaster/activitymanagerhelper/ActivityManagerHelper;->setSkeyclient(Lcom/cmcm/rtstub/RTApiClient;)V
.line 112
invoke-virtual {v0, p0}, Lcom/cleanmaster/activitymanagerhelper/ActivityManagerHelper;->getRunningAppProcesses(Landroid/content/Context;)Ljava/util/List;
move-result-object v0
.line 114
if-nez v0, :cond_21
move-object v0, v2
goto :goto_c
.line 116
:cond_21
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v3
:cond_25
:goto_25
invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_5b
invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/cleanmaster/activitymanagerhelper/RunningAppProcessInfo;
.line 117
const/16 v1, 0x64
iget v4, v0, Lcom/cleanmaster/activitymanagerhelper/RunningAppProcessInfo;->importance:I
if-ne v1, v4, :cond_25
.line 119
:try_start_37
invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v1
.line 120
const-string/jumbo v4, "processState"
invoke-virtual {v1, v4}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v1
.line 121
const/4 v4, 0x1
invoke-virtual {v1, v4}, Ljava/lang/reflect/Field;->setAccessible(Z)V
.line 123
invoke-virtual {v1, v0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/Integer;
.line 124
if-eqz v1, :cond_25
.line 125
invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I
move-result v1
const/4 v4, 0x2
if-ne v1, v4, :cond_25
.line 126
iget-object v0, v0, Lcom/cleanmaster/activitymanagerhelper/RunningAppProcessInfo;->pkgList:[Ljava/lang/String;
const/4 v1, 0x0
aget-object v0, v0, v1
:try_end_5a
.catch Ljava/lang/NoSuchFieldException; {:try_start_37 .. :try_end_5a} :catch_61
.catch Ljava/lang/IllegalAccessException; {:try_start_37 .. :try_end_5a} :catch_5f
.catch Ljava/lang/IllegalArgumentException; {:try_start_37 .. :try_end_5a} :catch_5d
goto :goto_c
:cond_5b
move-object v0, v2
.line 135
goto :goto_c
.line 130
:catch_5d
move-exception v0
goto :goto_25
.line 129
:catch_5f
move-exception v0
goto :goto_25
.line 128
:catch_61
move-exception v0
goto :goto_25
.end method
.method private static getTopAppPkgNameBelow21(Landroid/content/Context;)Ljava/lang/String;
.registers 4
.prologue
const/4 v1, 0x0
.line 81
const-string v0, "activity"
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/ActivityManager;
.line 82
if-nez v0, :cond_d
move-object v0, v1
.line 103
:goto_c
return-object v0
.line 87
:cond_d
const/4 v2, 0x1
:try_start_e
invoke-virtual {v0, v2}, Landroid/app/ActivityManager;->getRunningTasks(I)Ljava/util/List;
:try_end_11
.catch Ljava/lang/SecurityException; {:try_start_e .. :try_end_11} :catch_2c
.catch Ljava/lang/NullPointerException; {:try_start_e .. :try_end_11} :catch_2f
.catch Ljava/lang/NoSuchFieldError; {:try_start_e .. :try_end_11} :catch_32
move-result-object v0
.line 93
:goto_12
if-eqz v0, :cond_35
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v2
if-lez v2, :cond_35
.line 94
const/4 v2, 0x0
invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/ActivityManager$RunningTaskInfo;
.line 95
if-eqz v0, :cond_35
.line 96
iget-object v0, v0, Landroid/app/ActivityManager$RunningTaskInfo;->topActivity:Landroid/content/ComponentName;
.line 97
if-eqz v0, :cond_35
.line 98
invoke-virtual {v0}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;
move-result-object v0
goto :goto_c
.line 88
:catch_2c
move-exception v0
move-object v0, v1
.line 91
goto :goto_12
.line 89
:catch_2f
move-exception v0
move-object v0, v1
.line 91
goto :goto_12
.line 90
:catch_32
move-exception v0
move-object v0, v1
goto :goto_12
:cond_35
move-object v0, v1
.line 103
goto :goto_c
.end method
# virtual methods
.method public setRootProgress(Z)V
.registers 2
.prologue
.line 33
iput-boolean p1, p0, Lcom/cleanmaster/hpsharelib/base/util/system/TopAppQuery;->mIsRoot:Z
.line 34
return-void
.end method