正在查看: Fancy Optimizer v4.6.3 应用的 AppManagerPresenter.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Fancy Optimizer v4.6.3 应用的 AppManagerPresenter.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.fancyclean.boost.appmanager.ui.presenter;
import a6.a;
import android.annotation.SuppressLint;
import android.app.usage.StorageStats;
import android.app.usage.StorageStatsManager;
import android.app.usage.UsageStats;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Process;
import android.text.TextUtils;
import androidx.core.view.j;
import c.p;
import c7.l;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import vj.h;
import z5.g;
public class AppManagerPresenter extends hl.a<e6.c> implements e6.b {
public static final h p = h.f(AppManagerPresenter.class);
public c e;
public e f;
public d g;
public a6.a h;
public List<b6.a> i;
public ArrayList j;
public z5.h k;
public boolean c = false;
public boolean d = false;
public final a l = new a();
public final c.e m = new c.e(this, 11);
public final p n = new p(this, 9);
public final b o = new b();
public class a implements c.a {
public a() {
}
}
public class b implements a.InterfaceC0001a {
public b() {
}
}
public static class c extends yj.a<Void, Void, List<b6.a>> {
@SuppressLint({"StaticFieldLeak"})
public final Context c;
public a d;
public interface a {
}
public c(Context context) {
this.c = context.getApplicationContext();
}
public final void b(Object obj) {
List<b6.a> list = (List) obj;
a aVar = this.d;
if (aVar != null) {
AppManagerPresenter appManagerPresenter = AppManagerPresenter.this;
appManagerPresenter.i = list;
e6.c cVar = (e6.c) ((hl.a) appManagerPresenter).a;
if (cVar != null) {
cVar.U();
cVar.d(list);
}
appManagerPresenter.u1();
appManagerPresenter.t1();
}
}
public final void c() {
e6.c cVar;
a aVar = this.d;
if (aVar == null || (cVar = (e6.c) ((hl.a) AppManagerPresenter.this).a) == null) {
return;
}
cVar.b();
}
public final Object d(Object[] objArr) {
return z5.h.b(this.c).a();
}
}
public static class d extends yj.a<Void, Void, Boolean> {
@SuppressLint({"StaticFieldLeak"})
public final Context c;
public final List<b6.a> d;
public a e;
public interface a {
}
public d(Context context, List<b6.a> list) {
this.c = context.getApplicationContext();
this.d = list;
}
public final void b(Object obj) {
Boolean bool = (Boolean) obj;
p pVar = this.e;
if (pVar != null) {
bool.booleanValue();
AppManagerPresenter appManagerPresenter = (AppManagerPresenter) pVar.d;
h hVar = AppManagerPresenter.p;
appManagerPresenter.getClass();
AppManagerPresenter.p.c("LoadAllAppsLastUsedTime Completed");
e6.c cVar = (e6.c) ((hl.a) appManagerPresenter).a;
if (cVar != null) {
cVar.d2();
}
}
}
public final Object d(Object[] objArr) {
boolean z10;
Context context = z5.h.b(this.c).a;
boolean e = l.e(context);
h hVar = z5.h.c;
if (e) {
UsageStatsManager usageStatsManager = (UsageStatsManager) context.getSystemService("usagestats");
if (usageStatsManager != null) {
HashSet hashSet = new HashSet();
Iterator<b6.a> it = this.d.iterator();
while (it.hasNext()) {
hashSet.add(it.next().c);
}
try {
Calendar calendar = Calendar.getInstance();
calendar.add(5, -30);
for (UsageStats usageStats : usageStatsManager.queryUsageStats(4, calendar.getTimeInMillis(), System.currentTimeMillis())) {
if (hashSet.contains(usageStats.getPackageName())) {
long lastTimeVisible = Build.VERSION.SDK_INT >= 29 ? usageStats.getLastTimeVisible() : usageStats.getLastTimeStamp();
if (lastTimeVisible == 0) {
z5.d.d().a(-1L, usageStats.getPackageName());
} else {
z5.d.d().a(lastTimeVisible, usageStats.getPackageName());
}
hashSet.remove(usageStats.getPackageName());
}
}
Iterator it2 = hashSet.iterator();
while (it2.hasNext()) {
z5.d.d().a(-1L, (String) it2.next());
}
z10 = true;
} catch (Exception e10) {
hVar.d("Failed to get system cache", e10);
}
return Boolean.valueOf(z10);
}
hVar.d("UsageStatsManager is null", (Throwable) null);
} else {
hVar.d("No permission: android.permission.PACKAGE_USAGE_STATS", (Throwable) null);
}
z10 = false;
return Boolean.valueOf(z10);
}
}
public static class e extends yj.a<Void, Void, Boolean> {
@SuppressLint({"StaticFieldLeak"})
public final Context c;
public final List<b6.a> d;
public a e;
public interface a {
}
public e(Context context, List<b6.a> list) {
this.c = context.getApplicationContext();
this.d = list;
}
public final void b(Object obj) {
Boolean bool = (Boolean) obj;
c.e eVar = this.e;
if (eVar != null) {
bool.booleanValue();
AppManagerPresenter appManagerPresenter = (AppManagerPresenter) eVar.d;
h hVar = AppManagerPresenter.p;
appManagerPresenter.getClass();
AppManagerPresenter.p.c("LoadAllAppsSize Completed");
e6.c cVar = (e6.c) ((hl.a) appManagerPresenter).a;
if (cVar != null) {
cVar.Q1();
}
}
}
public final Object d(Object[] objArr) {
StorageStats queryStatsForPackage;
long appBytes;
long dataBytes;
z5.h b = z5.h.b(this.c);
b.getClass();
androidx.constraintlayout.core.state.e eVar = new androidx.constraintlayout.core.state.e(16);
int i = Build.VERSION.SDK_INT;
h hVar = z5.h.c;
boolean z10 = true;
List<b6.a> list = this.d;
Context context = b.a;
if (i < 26) {
if (!j4.b.G(list)) {
try {
CountDownLatch countDownLatch = new CountDownLatch(list.size());
Iterator<b6.a> it = list.iterator();
while (it.hasNext()) {
String str = it.next().c;
Method method = b.b;
if (method == null) {
countDownLatch.countDown();
} else {
method.invoke(context.getPackageManager(), str, new g(countDownLatch, eVar, str));
}
}
try {
countDownLatch.await(5L, TimeUnit.MINUTES);
} catch (InterruptedException e) {
hVar.d((String) null, e);
}
} catch (Exception e10) {
hVar.d("Get package storage size info failed", e10);
}
hVar.c("scan apps storage size result: " + z10);
return Boolean.valueOf(z10);
}
z10 = false;
hVar.c("scan apps storage size result: " + z10);
return Boolean.valueOf(z10);
}
if (l.e(context)) {
HashSet hashSet = new HashSet();
Iterator<b6.a> it2 = list.iterator();
while (it2.hasNext()) {
hashSet.add(it2.next().c);
}
StorageStatsManager b10 = lh.a.b(context.getSystemService("storagestats"));
if (b10 != null) {
try {
List<PackageInfo> installedPackages = context.getPackageManager().getInstalledPackages(0);
int size = installedPackages.size();
for (int i10 = 0; i10 < size; i10++) {
PackageInfo packageInfo = installedPackages.get(i10);
if (hashSet.contains(packageInfo.packageName)) {
queryStatsForPackage = b10.queryStatsForPackage(j.o(), packageInfo.packageName, Process.myUserHandle());
hVar.c(packageInfo.packageName + " cache size: " + lh.a.a(queryStatsForPackage));
long a10 = lh.a.a(queryStatsForPackage);
appBytes = queryStatsForPackage.getAppBytes();
long j = a10 + appBytes;
dataBytes = queryStatsForPackage.getDataBytes();
long j10 = j + dataBytes;
if (j10 > 0) {
eVar.i(j10, packageInfo.packageName);
}
}
}
} catch (Exception e11) {
hVar.d("Failed to get system cache", e11);
}
hVar.c("scan apps storage size result: " + z10);
return Boolean.valueOf(z10);
}
hVar.d("StorageStatsManager is null", (Throwable) null);
} else {
hVar.d("No permission: android.permission.PACKAGE_USAGE_STATS", (Throwable) null);
}
z10 = false;
hVar.c("scan apps storage size result: " + z10);
return Boolean.valueOf(z10);
}
}
@Override
public final void N(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
this.k.getClass();
String str2 = "https://play.google.com/store/apps/details?id=" + str;
il.e eVar = ((hl.a) this).a;
if (eVar != null) {
((e6.c) eVar).L2(str2);
}
}
@Override
public final void b() {
ArrayList arrayList = this.j;
if (arrayList != null) {
arrayList.clear();
}
e6.c cVar = (e6.c) ((hl.a) this).a;
if (cVar == null) {
return;
}
c cVar2 = new c(cVar.getContext());
this.e = cVar2;
cVar2.d = this.l;
vj.c.a(cVar2, new Void[0]);
}
@Override
public final void f1(Set<String> set) {
if (((e6.c) ((hl.a) this).a) == null) {
return;
}
this.d = true;
r1(set);
}
@Override
public final void h0(Set<String> set) {
this.j = new ArrayList(set);
s1();
}
@Override
public final void l0(String str) {
HashSet hashSet = new HashSet();
hashSet.add(str);
r1(hashSet);
}
public final void n1() {
yj.a aVar = this.e;
if (aVar != null) {
aVar.cancel(true);
this.e.d = null;
this.e = null;
}
yj.a aVar2 = this.f;
if (aVar2 != null) {
aVar2.cancel(true);
this.f.e = null;
this.f = null;
}
yj.a aVar3 = this.g;
if (aVar3 != null) {
aVar3.cancel(true);
this.g.e = null;
this.g = null;
}
yj.a aVar4 = this.h;
if (aVar4 != null) {
aVar4.cancel(true);
this.h.d = null;
this.h = null;
}
z5.e b10 = z5.e.b();
synchronized (b10) {
b10.a.clear();
}
z5.d.d().b();
}
public final void o1() {
throw new UnsupportedOperationException("Method not decompiled: com.fancyclean.boost.appmanager.ui.presenter.AppManagerPresenter.o1():void");
}
public final void q1(il.e eVar) {
boolean z10;
e6.c cVar = (e6.c) eVar;
p.c("==> onTakeView");
this.k = z5.h.b(cVar.getContext());
z5.h b10 = z5.h.b(cVar.getContext());
if (Build.VERSION.SDK_INT < 26) {
b10.getClass();
} else if (!l.e(b10.a)) {
z10 = false;
this.c = !z10;
}
z10 = true;
this.c = !z10;
}
public final void r1(Set<String> set) {
e6.c cVar = (e6.c) ((hl.a) this).a;
if (cVar == null || cVar == null) {
return;
}
a6.a aVar = new a6.a(cVar.getContext(), set);
aVar.d = this.o;
this.h = aVar;
vj.c.a(aVar, new Void[0]);
}
public final boolean s1() {
ArrayList arrayList = this.j;
if (arrayList == null || arrayList.size() <= 0) {
return false;
}
String str = (String) arrayList.get(0);
e6.c cVar = (e6.c) ((hl.a) this).a;
if (cVar == null) {
return true;
}
arrayList.remove(str);
cVar.Z1(str);
return true;
}
public final void t1() {
e6.c cVar = (e6.c) ((hl.a) this).a;
if (cVar == null || this.i == null) {
return;
}
d dVar = new d(cVar.getContext(), this.i);
this.g = dVar;
dVar.e = this.n;
vj.c.a(dVar, new Void[0]);
}
public final void u1() {
e6.c cVar = (e6.c) ((hl.a) this).a;
if (cVar == null || this.i == null) {
return;
}
e eVar = new e(cVar.getContext(), this.i);
this.f = eVar;
eVar.e = this.m;
vj.c.a(eVar, new Void[0]);
}
@Override
public final void y0() {
if (s1()) {
return;
}
b();
}
}