ProcessInfoHelper.smali

.class public Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;
.super Ljava/lang/Object;
.source "ProcessInfoHelper.java"


# static fields
.field private static final CLEAN_PROTECT_DURATION:I = 0x13880

.field private static sInstance:Lcom/cm/plugincluster/common/ModuleInterface;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/cm/plugincluster/common/ModuleInterface",
            "<",
            "Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .registers 3

    .prologue
    .line 31
    new-instance v0, Lcom/cm/plugincluster/common/ModuleInterface;

    const v1, 0x22c065

    new-instance v2, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelperProxy;

    invoke-direct {v2}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelperProxy;-><init>()V

    invoke-direct {v0, v1, v2}, Lcom/cm/plugincluster/common/ModuleInterface;-><init>(ILjava/lang/Object;)V

    sput-object v0, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->sInstance:Lcom/cm/plugincluster/common/ModuleInterface;

    return-void
.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 private static acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;
    .registers 1

    .prologue
    .line 35
    sget-object v0, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->sInstance:Lcom/cm/plugincluster/common/ModuleInterface;

    invoke-virtual {v0}, Lcom/cm/plugincluster/common/ModuleInterface;->getInterfaceImpl()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    return-object v0
.end method

.method public static getAvailableMemoryByte()J
    .registers 2

    .prologue
    .line 39
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getAvailableMemoryByte()J

    move-result-wide v0

    return-wide v0
.end method

.method public static getAvailableMemoryByteFast()J
    .registers 2

    .prologue
    .line 64
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getAvailableMemoryByteFast()J

    move-result-wide v0

    return-wide v0
.end method

.method public static getDetailMem([I)[J
    .registers 2

    .prologue
    .line 68
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0, p0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getDetailMem([I)[J

    move-result-object v0

    return-object v0
.end method

.method public static getPackageInfoList(Ljava/util/Comparator;)Ljava/util/List;
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Comparator",
            "<",
            "Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;",
            ">;)",
            "Ljava/util/List",
            "<",
            "Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;",
            ">;"
        }
    .end annotation

    .prologue
    .line 94
    new-instance v0, Lcom/cleanmaster/hpcommonlib/utils/PackageManagerWrapper;

    invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getAppContext()Landroid/content/Context;

    move-result-object v1

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

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/cleanmaster/hpcommonlib/utils/PackageManagerWrapper;-><init>(Landroid/content/pm/PackageManager;)V

    const/4 v1, 0x0

    const/16 v2, 0x8

    invoke-virtual {v0, v1, v2}, Lcom/cleanmaster/hpcommonlib/utils/PackageManagerWrapper;->getInstalledPackages(II)Ljava/util/List;

    move-result-object v0

    .line 95
    new-instance v1, Ljava/util/ArrayList;

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

    .line 96
    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_1d
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3c

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/pm/PackageInfo;

    .line 97
    new-instance v3, Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;

    invoke-direct {v3}, Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;-><init>()V

    .line 98
    iput-object v0, v3, Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;->packageInfo:Landroid/content/pm/PackageInfo;

    .line 99
    iget-wide v4, v0, Landroid/content/pm/PackageInfo;->firstInstallTime:J

    iput-wide v4, v3, Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;->firstInstallTime:J

    .line 100
    iget-wide v4, v0, Landroid/content/pm/PackageInfo;->lastUpdateTime:J

    iput-wide v4, v3, Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;->lastUpdateTime:J

    .line 101
    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_1d

    .line 103
    :cond_3c
    if-eqz p0, :cond_41

    .line 104
    invoke-static {v1, p0}, Ljava/util/Collections;->sort(Ljava/util/List;Ljava/util/Comparator;)V

    .line 106
    :cond_41
    return-object v1
.end method

.method public static getPackageInfoListSortByLastUpdateTime()Ljava/util/List;
    .registers 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/cleanmaster/hpsharelib/dao/PackageInfoWrapper;",
            ">;"
        }
    .end annotation

    .prologue
    .line 78
    new-instance v0, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper$1;

    invoke-direct {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper$1;-><init>()V

    invoke-static {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->getPackageInfoList(Ljava/util/Comparator;)Ljava/util/List;

    move-result-object v0

    return-object v0
.end method

.method public static getPhoneMemoryInfo()Lcom/cm/plugincluster/boost/aidl/IPhoneMemoryInfo;
    .registers 1

    .prologue
    .line 56
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getPhoneMemoryInfo()Lcom/cm/plugincluster/boost/aidl/IPhoneMemoryInfo;

    move-result-object v0

    return-object v0
.end method

.method public static getProcessMemory(Landroid/app/ActivityManager;Ljava/util/ArrayList;)J
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/app/ActivityManager;",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/Integer;",
            ">;)J"
        }
    .end annotation

    .prologue
    .line 110
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0, p0, p1}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getProcessMemory(Landroid/app/ActivityManager;Ljava/util/ArrayList;)J

    move-result-wide v0

    return-wide v0
.end method

.method public static getProcessMemory(Ljava/util/ArrayList;)J
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/Integer;",
            ">;)J"
        }
    .end annotation

    .prologue
    .line 114
    invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getAppContext()Landroid/content/Context;

    move-result-object v0

    const-string v1, "activity"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    .line 115
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v1

    invoke-interface {v1, v0, p0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getProcessMemory(Landroid/app/ActivityManager;Ljava/util/ArrayList;)J

    move-result-wide v0

    return-wide v0
.end method

.method public static getTotalMemoryByte()J
    .registers 2

    .prologue
    .line 44
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getTotalMemoryByte()J

    move-result-wide v0

    return-wide v0
.end method

.method public static getTotalMemoryByteFast()J
    .registers 2

    .prologue
    .line 60
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getTotalMemoryByteFast()J

    move-result-wide v0

    return-wide v0
.end method

.method public static getUsedMemoryPercentage()I
    .registers 1

    .prologue
    .line 48
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->getUsedMemoryPercentage()I

    move-result v0

    return v0
.end method

.method public static isCleanProtect(I)Z
    .registers 8

    .prologue
    const-wide/16 v0, 0x0

    .line 124
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v4

    .line 126
    sget v2, Lcom/cleanmaster/hpsharelib/boost/boostengine/BoostEngine;->BOOST_TASK_MEM:I

    if-ne p0, v2, :cond_20

    .line 127
    invoke-static {}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManagerExt;->getBoostLastCleanTime()J

    move-result-wide v2

    .line 133
    :goto_e
    cmp-long v6, v4, v2

    if-gez v6, :cond_2b

    .line 134
    invoke-static {p0}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->resetLastScanCleanTime(I)V

    .line 138
    :goto_15
    sub-long v0, v4, v0

    const-wide/32 v2, 0x13880

    cmp-long v0, v0, v2

    if-gez v0, :cond_29

    const/4 v0, 0x1

    :goto_1f
    return v0

    .line 128
    :cond_20
    sget v2, Lcom/cleanmaster/hpsharelib/boost/boostengine/BoostEngine;->BOOST_TASK_POWER_SAVE:I

    if-ne p0, v2, :cond_2d

    .line 129
    invoke-static {}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManagerExt;->getPowerLastCleanTime()J

    move-result-wide v2

    goto :goto_e

    .line 138
    :cond_29
    const/4 v0, 0x0

    goto :goto_1f

    :cond_2b
    move-wide v0, v2

    goto :goto_15

    :cond_2d
    move-wide v2, v0

    goto :goto_e
.end method

.method public static isMemoryInCache()Z
    .registers 1

    .prologue
    .line 52
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->isMemoryInCache()Z

    move-result v0

    return v0
.end method

.method public static onAppOpen(Ljava/lang/String;)V
    .registers 2

    .prologue
    .line 72
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0, p0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->onAppOpen(Ljava/lang/String;)V

    .line 73
    return-void
.end method

.method private static resetLastScanCleanTime(I)V
    .registers 5

    .prologue
    const-wide/16 v2, 0x0

    .line 142
    sget v0, Lcom/cleanmaster/hpsharelib/boost/boostengine/BoostEngine;->BOOST_TASK_MEM:I

    if-ne p0, v0, :cond_d

    .line 144
    invoke-static {v2, v3}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManagerExt;->setBoostLastCleanTime(J)V

    .line 145
    invoke-static {v2, v3}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManagerExt;->setBoostLastScanTime(J)V

    .line 152
    :cond_c
    :goto_c
    return-void

    .line 147
    :cond_d
    sget v0, Lcom/cleanmaster/hpsharelib/boost/boostengine/BoostEngine;->BOOST_TASK_POWER_SAVE:I

    if-ne p0, v0, :cond_c

    .line 149
    invoke-static {v2, v3}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManagerExt;->setPowertLastCleanTime(J)V

    .line 150
    invoke-static {v2, v3}, Lcom/cleanmaster/hpsharelib/configmanager/ServiceConfigManagerExt;->setPowertLastScanTime(J)V

    goto :goto_c
.end method

.method public static setMemoryChange(Lcom/cleanmaster/hpsharelib/synipc/MemoryChangeParam;)I
    .registers 2

    .prologue
    .line 184
    invoke-static {}, Lcom/cleanmaster/hpsharelib/boost/process/util/ProcessInfoHelper;->acquire()Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;

    move-result-object v0

    invoke-interface {v0, p0}, Lcom/cleanmaster/hpsharelib/boost/process/util/IProcessInfoHelper;->setMemoryChange(Lcom/cleanmaster/hpsharelib/synipc/MemoryChangeParam;)I

    move-result v0

    return v0
.end method

.method public static writeTotalMemoryInfoAllDirect(Ljava/lang/String;)V
    .registers 6

    .prologue
    .line 159
    const-string v0, "/proc/meminfo"

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

    move-result v1

    if-eqz v1, :cond_a

    .line 162
    const-string v1, ""

    .line 165
    :cond_a
    :try_start_a
    new-instance v1, Ljava/io/FileReader;

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

    .line 166
    new-instance v2, Ljava/io/BufferedReader;

    const/16 v0, 0x2000

    invoke-direct {v2, v1, v0}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;I)V

    .line 167
    new-instance v1, Ljava/lang/StringBuilder;

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

    .line 168
    const/4 v0, 0x0

    .line 169
    :goto_1c
    invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    if-eqz v3, :cond_38

    const/16 v4, 0xa

    if-ge v0, v4, :cond_38

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

    move-result v4

    if-nez v4, :cond_35

    .line 171
    const-string v4, "\n"

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

    move-result-object v4

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

    .line 173
    :cond_35
    add-int/lit8 v0, v0, 0x1

    goto :goto_1c

    .line 177
    :cond_38
    invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
    :try_end_3b
    .catch Ljava/lang/Exception; {:try_start_a .. :try_end_3b} :catch_3c

    .line 181
    :goto_3b
    return-void

    .line 178
    :catch_3c
    move-exception v0

    goto :goto_3b
.end method