导航菜单

页面标题

页面副标题

Antivirus Cleaner v1.2.0.0 - a.java 源代码

正在查看: Antivirus Cleaner v1.2.0.0 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package x9;

import android.app.ActivityManager;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.thinkup.core.common.o0.mo;
import com.thinkup.expressad.foundation.on.o;
import com.thinkup.expressad.foundation.on.om.on.m;
import com.trustlook.sdk.R$array;
import com.trustlook.sdk.job.TlJobService;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import o7.g0;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class a {
    public static String m;
    public static final Map<com.trustlook.sdk.data.e, String> n;
    public Context a;
    public com.trustlook.sdk.data.e b;
    public String c;
    public int d;
    public int e;
    public int f;
    public int g;
    public x9.b h;
    public Boolean i;
    public com.trustlook.sdk.data.b j;
    public boolean k;
    public Handler l;

    public static class C0283a {
        public Context a;
        public com.trustlook.sdk.data.e b;
        public int c = 10000;
        public int d = 10000;

        public C0283a(Context context) {
            this.a = context.getApplicationContext();
            String unused = a.m = context.getClass().getSimpleName();
        }

        public a c() {
            return new a(this, null);
        }

        public C0283a d(int i) {
            this.c = i;
            return this;
        }

        public C0283a e(com.trustlook.sdk.data.e eVar) {
            this.b = eVar;
            return this;
        }

        public C0283a f(int i) {
            this.d = i;
            return this;
        }
    }

    public class b extends Handler {
        public b(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == 1) {
                a.p(a.this);
                return;
            }
            if (i == 7) {
                a.M(a.this);
                return;
            }
            if (i == 3) {
                a.x(a.this, 1);
                a aVar = a.this;
                a.q(aVar, aVar.g, a.this.f, (com.trustlook.sdk.data.b) message.obj);
            } else if (i != 4) {
                if (i != 5) {
                    return;
                }
                a.F(a.this, (List) message.obj);
            } else {
                Object obj = message.obj;
                if (obj instanceof Integer) {
                    a.s(a.this, ((Integer) obj).intValue(), "");
                } else {
                    a.s(a.this, 0, obj.toString());
                }
            }
        }
    }

    public class c implements Runnable {
        public final x9.b b;

        public c(x9.b bVar) {
            this.b = bVar;
        }

        @Override
        public void run() {
            try {
                List y = a.this.y();
                if (a.this.h != null) {
                    return;
                }
                a.this.h = this.b;
                a.this.i = Boolean.FALSE;
                a.this.m(1, null);
                HashSet hashSet = new HashSet();
                HashSet hashSet2 = new HashSet();
                Iterator it = ((ArrayList) a.L(a.this)).iterator();
                while (it.hasNext()) {
                    String str = (String) it.next();
                    if (str != null && !str.isEmpty()) {
                        File file = new File(str);
                        ArrayList arrayList = new ArrayList();
                        ArrayList arrayList2 = new ArrayList();
                        w9.b.a(file, arrayList, arrayList2);
                        hashSet.addAll(arrayList);
                        hashSet2.addAll(arrayList2);
                    }
                }
                List j = a.j(a.this, y);
                ArrayList arrayList3 = (ArrayList) j;
                a.this.f = arrayList3.size() + hashSet.size() + hashSet2.size();
                a.this.g = 0;
                if (arrayList3.isEmpty() && hashSet.isEmpty() && hashSet2.isEmpty()) {
                    a.this.m(4, 2);
                    return;
                }
                List arrayList4 = new ArrayList();
                if (!arrayList3.isEmpty()) {
                    arrayList3.size();
                    arrayList4 = a.this.i(y, false);
                    arrayList4.toString();
                }
                if (!hashSet.isEmpty()) {
                    hashSet.size();
                    arrayList4.addAll(a.this.i(new ArrayList(hashSet), true));
                }
                Iterator it2 = arrayList4.iterator();
                while (it2.hasNext()) {
                    String b = ((com.trustlook.sdk.data.b) it2.next()).b();
                    if (hashSet.contains(b)) {
                        hashSet.remove(b);
                    }
                }
                if (!hashSet.isEmpty()) {
                    hashSet2.addAll(hashSet);
                }
                hashSet2.size();
                List A = a.A(a.this, new ArrayList(hashSet2));
                if (A != null && !A.isEmpty()) {
                    arrayList4.addAll(A);
                }
                a.this.m(5, arrayList4);
                a.I(a.this);
            } catch (Exception e) {
                e.getMessage();
                a.this.m(4, Integer.valueOf(a.this.a(e)));
            }
        }
    }

    static {
        HashMap hashMap = new HashMap();
        n = hashMap;
        hashMap.put(com.trustlook.sdk.data.e.INTL, "https://sla-intl.trustlook.com/");
        hashMap.put(com.trustlook.sdk.data.e.CHN, "https://api.luweitech.com/");
        hashMap.put(com.trustlook.sdk.data.e.BAIDU, "http://queryapi-1431840856.bceapp.com/");
    }

    public a(C0283a c0283a, b bVar) {
        this(c0283a);
    }

    public static List A(a aVar, List list) {
        aVar.getClass();
        ArrayList arrayList = new ArrayList();
        String c2 = x9.c.c("l2DWQm4YwLbZFALHwaIojw==");
        String c3 = x9.c.c("DNfI+dH+oZBelg9WhrUsmQ==");
        String c4 = x9.c.c("9QaXiXZwoRpLXuXGp4Sphg==");
        String c5 = x9.c.c("0Hv3t6TxAeH94Cxqm127vjwKjbgOqD38txypA4YdaOWCxD80AW4K1mvU//VRD9NE");
        Iterator it = list.iterator();
        while (it.hasNext()) {
            String str = (String) it.next();
            if (aVar.i.booleanValue()) {
                aVar.m(7, 0);
                return null;
            }
            com.trustlook.sdk.data.b bVar = new com.trustlook.sdk.data.b("", "");
            bVar.o(str);
            if (aVar.v(str, c2, c3, c4, c5)) {
                String a = z9.a.a(new File(str), 8192);
                bVar.v(8);
                bVar.u(a);
                bVar.A("EICAR-Test-File (not a virus)");
                arrayList.add(bVar);
            }
            aVar.m(3, bVar);
        }
        return arrayList;
    }

    public static void F(a aVar, List list) {
        if (aVar.h != null && !aVar.i.booleanValue()) {
            aVar.h.c(list);
        }
        aVar.h = null;
    }

    public static void I(a aVar) {
        aVar.getClass();
        if (d(aVar.a) > 1024) {
            ((JobScheduler) aVar.a.getSystemService("jobscheduler")).schedule(new JobInfo.Builder(1, new ComponentName(aVar.a, (Class<?>) TlJobService.class)).setRequiredNetworkType(2).setRequiresCharging(true).setPeriodic(10800000L).build());
        }
    }

    public static List L(a aVar) {
        aVar.getClass();
        ArrayList arrayList = new ArrayList();
        File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath());
        aVar.u(file.listFiles(), arrayList);
        arrayList.add(file.getAbsolutePath());
        return arrayList;
    }

    public static boolean M(a aVar) {
        if (!aVar.i.booleanValue()) {
            return false;
        }
        x9.b bVar = aVar.h;
        if (bVar != null) {
            bVar.a();
            aVar.h = null;
        }
        return true;
    }

    public static long d(Context context) {
        ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
        ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
        activityManager.getMemoryInfo(memoryInfo);
        return (memoryInfo.availMem / 1024) / 1024;
    }

    public static List j(a aVar, List list) {
        PackageManager packageManager;
        String str;
        File file;
        String parent;
        File file2;
        File[] listFiles;
        String[] stringArray;
        a aVar2 = aVar;
        PackageManager packageManager2 = aVar2.a.getPackageManager();
        ArrayList arrayList = new ArrayList();
        Iterator it = list.iterator();
        while (it.hasNext()) {
            String str2 = (String) it.next();
            try {
                str = packageManager2.getPackageInfo(str2, 64).applicationInfo.publicSourceDir;
                file = new File(str);
                parent = file.getParent();
                file2 = new File(parent);
                listFiles = file2.listFiles();
                stringArray = aVar2.a.getResources().getStringArray(R$array.languages);
            } catch (PackageManager.NameNotFoundException unused) {
                packageManager = packageManager2;
            } catch (Exception e) {
                e = e;
                packageManager = packageManager2;
            }
            if (listFiles == null) {
                file2.toString();
                if (file.exists() && str.endsWith(".apk")) {
                    arrayList.add(str);
                }
            }
            int length = listFiles.length;
            int i = 0;
            while (i < length) {
                File file3 = listFiles[i];
                if (file3.getName().endsWith(".apk") && !file3.getName().contains("dpi.apk")) {
                    int length2 = stringArray.length;
                    int i2 = 0;
                    while (true) {
                        if (i2 >= length2) {
                            packageManager = packageManager2;
                            arrayList.add(parent + "/" + file3.getName());
                            break;
                        }
                        String str3 = stringArray[i2];
                        String name = file3.getName();
                        StringBuilder sb = new StringBuilder();
                        packageManager = packageManager2;
                        try {
                            sb.append(mo.om0);
                            sb.append(str3);
                            sb.append(".apk");
                            if (name.contains(sb.toString())) {
                                file3.getName();
                                break;
                            }
                            i2++;
                            packageManager2 = packageManager;
                        } catch (PackageManager.NameNotFoundException unused2) {
                            Log.e("TL", "Package Name Not Found: " + str2 + ", may not installed.");
                            aVar2 = aVar;
                            packageManager2 = packageManager;
                        } catch (Exception e2) {
                            e = e2;
                            e.getMessage();
                            aVar2 = aVar;
                            packageManager2 = packageManager;
                        }
                    }
                } else {
                    packageManager = packageManager2;
                }
                i++;
                packageManager2 = packageManager;
            }
            aVar2 = aVar;
        }
        return arrayList;
    }

    public static void p(a aVar) {
        x9.b bVar = aVar.h;
        if (bVar != null) {
            bVar.e();
        }
    }

    public static void q(a aVar, int i, int i2, com.trustlook.sdk.data.b bVar) {
        if (aVar.h == null || aVar.i.booleanValue()) {
            return;
        }
        aVar.h.d(i, i2, bVar);
    }

    public static void s(a aVar, int i, String str) {
        x9.b bVar = aVar.h;
        if (bVar != null) {
            bVar.b(i, str);
        }
        aVar.h = null;
    }

    public static int x(a aVar, int i) {
        int i2 = aVar.g + i;
        aVar.g = i2;
        return i2;
    }

    public final void B(JSONObject jSONObject) throws JSONException {
        String e = com.trustlook.sdk.data.c.e(this.a, "extra_info_field", "");
        if (w9.c.a(e)) {
            return;
        }
        String[] split = e.split(",");
        ?? arrayList = new ArrayList();
        if (com.trustlook.sdk.data.c.a(this.a, "extra_info_sent", false)) {
            for (String str : split) {
                if (str.equals("longitude") || str.equals("latitude")) {
                    arrayList.add(str);
                }
            }
        } else {
            arrayList = Arrays.asList(split);
        }
        List<com.trustlook.sdk.data.g> d = x9.c.d(this.a, arrayList);
        if (d == null || d.size() < 1) {
            return;
        }
        JSONObject jSONObject2 = new JSONObject();
        for (com.trustlook.sdk.data.g gVar : d) {
            jSONObject2.put(gVar.a(), gVar.b());
        }
        jSONObject.put("exif", jSONObject2);
        jSONObject.getString("exif");
    }

    public final void E(JSONObject jSONObject) throws JSONException {
        String str;
        jSONObject.put(o.nm0, "5.0.5.20240528");
        jSONObject.put("hpn", this.a.getPackageName());
        String f = f();
        if (f != null) {
            jSONObject.put("hcs1", f);
        }
        jSONObject.put("ha", m);
        Integer num = null;
        try {
            str = this.a.getPackageManager().getPackageInfo(this.a.getPackageName(), 0).versionName;
        } catch (Exception unused) {
            str = null;
        }
        if (str != null) {
            jSONObject.put("hvn", str);
        }
        try {
            num = Integer.valueOf(this.a.getPackageManager().getPackageInfo(this.a.getPackageName(), 0).versionCode);
        } catch (Exception unused2) {
        }
        if (num != null) {
            jSONObject.put("hvc", num.toString());
        }
    }

    public void G() {
        this.i = Boolean.TRUE;
    }

    public i H(List<com.trustlook.sdk.data.d> list, boolean z) {
        boolean z2;
        i iVar;
        int i;
        if (e.d(this.a)) {
            int i2 = 3;
            while (true) {
                if (i2 < 0) {
                    i = 0;
                    break;
                }
                int i3 = i2 - 1;
                try {
                    if (System.currentTimeMillis() / 1000 < com.trustlook.sdk.data.c.c(this.a, "key_expire", 0L)) {
                        i = 200;
                        break;
                    }
                    URL url = new URL(com.trustlook.sdk.data.c.e(this.a, "host_url", "https://sla-intl.trustlook.com/") + "verify");
                    url.toString();
                    HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
                    String f = x9.c.f(this.a);
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setRequestProperty(m.o, "application/json");
                    httpURLConnection.setRequestProperty("Accept", "application/json");
                    httpURLConnection.setRequestProperty("X-TL-APIKEY", f);
                    httpURLConnection.setConnectTimeout(this.d);
                    httpURLConnection.setReadTimeout(this.e);
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("host_pkg_name", this.a.getPackageName());
                    jSONObject.put("hcs", f());
                    jSONObject.toString();
                    BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(httpURLConnection.getOutputStream(), "UTF-8"));
                    bufferedWriter.write(jSONObject.toString());
                    bufferedWriter.close();
                    i = httpURLConnection.getResponseCode();
                    if (i != 200) {
                        break;
                    }
                    if (!httpURLConnection.getHeaderField("Cache-Control").contains("=")) {
                        break;
                    }
                    com.trustlook.sdk.data.c.h(this.a, "key_expire", Integer.valueOf(r0.split("=")[1]).intValue() + (System.currentTimeMillis() / 1000));
                    y9.b.b(this.a).a().d();
                    break;
                } catch (Exception e) {
                    e.printStackTrace();
                    Log.w("TL", "Verify API key error:" + e.getMessage());
                    i2 = i3;
                }
            }
            if (i == 403) {
                m(4, 8);
                return null;
            }
            if (i != 200) {
                m(4, 12);
                return null;
            }
        }
        if (list == null || list.size() == 0) {
            return null;
        }
        list.size();
        list.size();
        i iVar2 = new i();
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        for (com.trustlook.sdk.data.d dVar : list) {
            try {
                com.trustlook.sdk.data.b e2 = y9.b.b(this.a).a().e(dVar);
                if (e2 != null && e2.i() >= 0) {
                    dVar.d();
                    e2.i();
                    e2.h();
                    e2.n();
                    arrayList.add(e2);
                    arrayList2.add(dVar);
                    m(3, e2);
                }
            } catch (Exception e3) {
                e3.getMessage();
            }
        }
        if (!arrayList2.isEmpty()) {
            Iterator it = arrayList2.iterator();
            while (it.hasNext()) {
                list.remove((com.trustlook.sdk.data.d) it.next());
            }
        }
        if (arrayList.isEmpty()) {
            z2 = true;
        } else {
            iVar2.f(arrayList);
            z2 = true;
            iVar2.d(true);
        }
        arrayList.size();
        list.size();
        if (list.size() == 0) {
            iVar2.d(z2);
            return iVar2;
        }
        if (!e.d(this.a)) {
            Log.w("TL", "No network, return without cloud scan");
            m(4, 6);
            return iVar2;
        }
        this.i = Boolean.FALSE;
        i iVar3 = new i();
        new ArrayList();
        try {
        } catch (Exception e4) {
            e4.getLocalizedMessage();
            int a = a(e4);
            m(4, Integer.valueOf(a));
            iVar3.d(false);
            iVar3.c(a);
        }
        if (this.c == null || this.b == null) {
            throw new j(1);
        }
        JSONArray jSONArray = new JSONArray();
        Iterator<com.trustlook.sdk.data.d> it2 = list.iterator();
        while (it2.hasNext()) {
            jSONArray.put(it2.next().s(this.a, z));
        }
        JSONObject jSONObject2 = new JSONObject();
        E(jSONObject2);
        jSONObject2.put("pks", jSONArray);
        jSONObject2.getString("pks");
        o(jSONObject2);
        e eVar = new e(this.a, this.d, this.e);
        String e5 = com.trustlook.sdk.data.c.e(this.a, "sdk_info_api_version", "5");
        B(jSONObject2);
        this.c = com.trustlook.sdk.data.c.e(this.a, "host_url", "https://sla-intl.trustlook.com/");
        jSONObject2.toString();
        List<com.trustlook.sdk.data.b> b2 = eVar.b(this.c + "v" + e5 + "/virus/scan", jSONObject2.toString(), list);
        if (b2.isEmpty()) {
            iVar3.d(false);
            iVar3.c(13);
        } else {
            b2.size();
            if (jSONObject2.has("exif")) {
                com.trustlook.sdk.data.c.f(this.a, "extra_info_sent", true);
            }
            ArrayList arrayList3 = new ArrayList();
            for (com.trustlook.sdk.data.b bVar : b2) {
                if (this.i.booleanValue()) {
                    m(7, 0);
                    iVar = null;
                    break;
                }
                if (bVar.l() == 1) {
                    bVar.h();
                    bVar.g();
                    arrayList3.add(bVar);
                }
                n(bVar);
                m(3, bVar);
            }
            if (arrayList3.size() > 0) {
                f.c(this.a, arrayList3);
            }
            y9.b.b(this.a).a().g(500L);
            y9.f.b(this.a).a().a();
            iVar3.d(true);
            iVar3.f(b2);
        }
        iVar = iVar3;
        if (iVar != null && iVar.e() != null) {
            iVar.e().size();
            if (iVar2.e() != null) {
                iVar2.e().addAll(iVar.e());
            } else {
                iVar2 = iVar;
            }
            iVar2.d(true);
        }
        return iVar2;
    }

    public void N(int i, x9.b bVar) {
        w9.a.i = i;
        O(bVar);
    }

    public void O(x9.b bVar) {
        new Thread(new c(bVar)).start();
    }

    public final int a(Exception exc) {
        if (exc instanceof j) {
            StringBuilder a = bg.b.a("========== HTTP_REQUEST_EXCEPTION: ");
            j jVar = (j) exc;
            a.append(jVar.b);
            a.append(" ========");
            Log.e("TL", a.toString());
            int i = jVar.b;
            if (i == 403) {
                i = 8;
            } else if (i == 406) {
                i = 2;
            } else if (i == 504 || i == 502) {
                i = 9;
            }
            bg.a.a(exc, bg.b.a("handleExceptions HttpRequestException: "), "TL");
            return i;
        }
        if (exc instanceof JSONException) {
            Log.e("TL", "========== JSON_EXCEPTION ========");
            StringBuilder sb = new StringBuilder();
            sb.append("handleExceptions JSON_EXCEPTION: ");
            bg.a.a(exc, sb, "TL");
            return 4;
        }
        if (exc instanceof UnknownHostException) {
            Log.e("TL", "========== NO NETWORK ========");
            StringBuilder sb2 = new StringBuilder();
            sb2.append("handleExceptions NO_NETWORK: ");
            bg.a.a(exc, sb2, "TL");
            return 6;
        }
        if (exc instanceof SocketTimeoutException) {
            Log.e("TL", "========== SOCKET TIMEOUT EXCEPTION ========");
            StringBuilder sb3 = new StringBuilder();
            sb3.append("handleExceptions SOCKET_TIMEOUT_EXCEPTION: ");
            bg.a.a(exc, sb3, "TL");
            return 7;
        }
        if (exc instanceof IOException) {
            Log.e("TL", "========== IO EXCEPTION ========");
            exc.printStackTrace();
            StringBuilder sb4 = new StringBuilder();
            sb4.append("handleExceptions IO_EXCEPTION: ");
            bg.a.a(exc, sb4, "TL");
            return 5;
        }
        Log.e("TL", "========== UNKNOWN ERROR ========");
        exc.printStackTrace();
        StringBuilder sb5 = new StringBuilder();
        sb5.append("handleExceptions UNKNOWN_ERROR: ");
        bg.a.a(exc, sb5, "TL");
        return 0;
    }

    public final String f() {
        try {
            CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
            Signature[] signatureArr = this.a.getPackageManager().getPackageInfo(this.a.getPackageName(), 64).signatures;
            if (signatureArr.length <= 0) {
                return null;
            }
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(signatureArr[0].toByteArray());
            X509Certificate x509Certificate = (X509Certificate) certificateFactory.generateCertificate(byteArrayInputStream);
            com.trustlook.sdk.data.a aVar = new com.trustlook.sdk.data.a();
            aVar.b(x509Certificate.getIssuerDN().toString());
            aVar.d(x509Certificate.getNotBefore().getTime() / 1000);
            aVar.a(x509Certificate.getNotAfter().getTime() / 1000);
            aVar.c(x509Certificate.getSerialNumber().toString(16));
            MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
            messageDigest.update(x509Certificate.getEncoded());
            byte[] digest = messageDigest.digest();
            byteArrayInputStream.close();
            return f.a(digest);
        } catch (Exception unused) {
            return null;
        }
    }

    public final ArrayList<com.trustlook.sdk.data.b> h(ExecutorService executorService, List<y9.g> list, y9.d dVar, HashMap<String, y9.g> hashMap, boolean z) {
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList<com.trustlook.sdk.data.b> arrayList3 = new ArrayList<>();
        for (y9.g gVar : list) {
            Callable gVar2 = z ? new g(this.a, gVar) : new h(gVar);
            try {
            } catch (NullPointerException e) {
                e.getMessage();
            } catch (RejectedExecutionException e2) {
                e2.getMessage();
            } catch (Exception e3) {
                e3.getMessage();
            } catch (Throwable th) {
                th.getMessage();
            }
            if (!executorService.isShutdown() && !executorService.isTerminated()) {
                if ((new File(gVar.a()).length() / 1024) / 1024 > d(this.a)) {
                    gVar.a();
                } else {
                    gVar.a();
                    arrayList.add(executorService.submit(gVar2));
                }
            }
            m(7, 0);
            return null;
        }
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            Future future = (Future) it.next();
            try {
            } catch (InterruptedException e4) {
                e4.getMessage();
            } catch (ExecutionException e5) {
                e5.getMessage();
            } catch (Exception e6) {
                e6.getMessage();
            }
            if (this.i.booleanValue()) {
                executorService.shutdownNow();
                m(7, 0);
                return null;
            }
            com.trustlook.sdk.data.d dVar2 = (com.trustlook.sdk.data.d) future.get();
            if (dVar2 != null) {
                arrayList2.add(dVar2);
                t(dVar, dVar2, hashMap);
                dVar2.e();
                dVar2.d();
            }
        }
        i H = H(arrayList2, z);
        if (H != null && H.e() != null) {
            arrayList3.addAll(H.e());
            H.e().size();
        } else if (H != null && !H.b()) {
            m(4, Integer.valueOf(H.a()));
            return null;
        }
        return arrayList3;
    }

    public final java.util.List<com.trustlook.sdk.data.b> i(java.util.List<java.lang.String> r39, boolean r40) {
        throw new UnsupportedOperationException("Method not decompiled: x9.a.i(java.util.List, boolean):java.util.List");
    }

    public final void m(int i, Object obj) {
        Message message = new Message();
        message.what = i;
        message.obj = obj;
        this.l.sendMessage(message);
    }

    public final void n(com.trustlook.sdk.data.b bVar) {
        if (bVar.i() <= 7) {
            bVar.g();
            bVar.i();
            bVar.b();
            if (bVar.b() == null || bVar.b().isEmpty()) {
                bVar.g();
                return;
            }
            if (v(bVar.b(), x9.c.c("l2DWQm4YwLbZFALHwaIojw=="), x9.c.c("DNfI+dH+oZBelg9WhrUsmQ=="), x9.c.c("9QaXiXZwoRpLXuXGp4Sphg=="), x9.c.c("0Hv3t6TxAeH94Cxqm127vjwKjbgOqD38txypA4YdaOWCxD80AW4K1mvU//VRD9NE"))) {
                bVar.v(8);
                bVar.A("EICAR-Test-File (not a virus)");
                bVar.g();
                bVar.i();
                bVar.b();
            }
        }
    }

    public final void o(JSONObject jSONObject) throws JSONException {
        JSONObject jSONObject2 = new JSONObject();
        try {
            Context context = this.a;
            if (context != null) {
                Objects.toString(context.getResources().getConfiguration().locale);
                Locale locale = this.a.getResources().getConfiguration().locale;
                if (locale != null) {
                    jSONObject2.put("lc", locale.toString().toLowerCase());
                } else {
                    jSONObject2.put("lc", Locale.US.toString().toLowerCase());
                }
            }
            String str = Build.MODEL;
            if (str != null) {
                jSONObject2.put("mod", str);
            }
            String str2 = Build.VERSION.RELEASE;
            if (str2 != null) {
                jSONObject2.put("os", str2);
            }
            String str3 = Build.VERSION.SECURITY_PATCH;
            if (str3 != null) {
                jSONObject2.put("pat", str3);
            }
            if (x9.c.e(this.a) != null) {
                jSONObject2.put("di", x9.c.e(this.a));
            }
        } catch (JSONException unused) {
        }
        jSONObject.put("info", jSONObject2);
    }

    public final void t(y9.d dVar, com.trustlook.sdk.data.d dVar2, HashMap<String, y9.g> hashMap) {
        y9.g gVar;
        if (dVar.b(dVar2.f()) == null) {
            String f = dVar2.f();
            Iterator<Map.Entry<String, y9.g>> it = hashMap.entrySet().iterator();
            while (true) {
                if (!it.hasNext()) {
                    gVar = null;
                    break;
                }
                Map.Entry<String, y9.g> next = it.next();
                if (next.getKey().equalsIgnoreCase(f)) {
                    Objects.toString(next.getValue());
                    gVar = next.getValue();
                    break;
                }
            }
            if (gVar != null) {
                gVar.m(dVar2.d());
                dVar.c(dVar2.f(), gVar.r().toString());
            }
        }
    }

    public final void u(File[] fileArr, List<String> list) {
        if (fileArr != null) {
            for (File file : fileArr) {
                if (file.isDirectory()) {
                    u(file.listFiles(), list);
                } else if (file.getName().endsWith(".apk")) {
                    list.add(file.getPath());
                }
            }
        }
    }

    public final boolean v(String str, String str2, String str3, String str4, String str5) {
        try {
        } catch (IOException e) {
            e.getMessage();
        }
        if (new File(str).length() > 500) {
            return false;
        }
        byte[] bArr = new byte[512];
        FileInputStream fileInputStream = new FileInputStream(str);
        if (fileInputStream.read(bArr) == -1) {
            fileInputStream.close();
            return false;
        }
        if (d.a(bArr, str2.getBytes()) <= -1) {
            fileInputStream.close();
            return false;
        }
        if (d.a(bArr, str3.getBytes()) <= -1) {
            fileInputStream.close();
            return false;
        }
        if (d.a(bArr, str4.getBytes()) <= -1) {
            fileInputStream.close();
            return false;
        }
        if (d.a(bArr, str5.getBytes()) > -1) {
            fileInputStream.close();
            return true;
        }
        fileInputStream.close();
        return false;
    }

    public final List<String> y() {
        List<PackageInfo> list;
        ArrayList arrayList = new ArrayList();
        PackageManager packageManager = this.a.getPackageManager();
        if (Build.VERSION.SDK_INT < 33) {
            try {
                list = packageManager.getInstalledPackages(64);
            } catch (Exception e) {
                bg.a.a(e, bg.b.a("getInstalledPackages failed:"), "TL");
                list = null;
            }
            if (list != null) {
                list.size();
                for (PackageInfo packageInfo : list) {
                    if (!packageInfo.packageName.equals(this.a.getPackageName())) {
                        try {
                            if ((packageInfo.applicationInfo.flags & 1) == 0) {
                                arrayList.add(packageInfo.packageName);
                            }
                        } catch (Exception unused) {
                            StringBuilder a = bg.b.a("Can not find ");
                            a.append(packageInfo.packageName);
                            a.append("installed on device");
                            Log.w("TL", a.toString());
                        }
                    }
                }
            } else {
                Log.w("TL", "Fail to get installed packages");
            }
        } else {
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.LAUNCHER");
            List<ResolveInfo> a2 = g0.a(packageManager, intent, com.adjust.sdk.c.a(64L));
            if (!a2.isEmpty()) {
                for (ResolveInfo resolveInfo : a2) {
                    try {
                        if (resolveInfo.activityInfo.packageName.equals(this.a.getPackageName())) {
                            String str = resolveInfo.activityInfo.packageName;
                        } else {
                            ActivityInfo activityInfo = resolveInfo.activityInfo;
                            if ((activityInfo.applicationInfo.flags & 1) != 0) {
                                String str2 = activityInfo.packageName;
                            } else {
                                arrayList.add(activityInfo.packageName);
                            }
                        }
                    } catch (Exception e2) {
                        e2.getMessage();
                    }
                }
            }
        }
        return arrayList;
    }

    public final List<com.trustlook.sdk.data.b> z(ExecutorService executorService, List<y9.g> list, y9.d dVar, HashMap<String, y9.g> hashMap, boolean z) {
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        for (y9.g gVar : list) {
            if (new File(gVar.a()).length() <= 104857600) {
                arrayList.add(gVar);
            } else {
                arrayList2.add(gVar);
            }
        }
        System.currentTimeMillis();
        ArrayList arrayList3 = new ArrayList();
        if (arrayList.size() > 0) {
            arrayList.size();
            ArrayList<com.trustlook.sdk.data.b> h = h(executorService, arrayList, dVar, hashMap, z);
            if (h != null && h.size() > 0) {
                arrayList3.addAll(h);
            }
            System.currentTimeMillis();
        }
        if (arrayList2.size() > 0) {
            arrayList2.size();
            ArrayList<com.trustlook.sdk.data.b> h2 = h(executorService, arrayList2, dVar, hashMap, z);
            if (h2 != null && h2.size() > 0) {
                arrayList3.addAll(h2);
            }
            System.currentTimeMillis();
        }
        return arrayList3;
    }

    public a(C0283a c0283a) {
        this.f = 0;
        this.g = 0;
        this.i = Boolean.FALSE;
        this.j = null;
        this.k = false;
        this.l = new b(Looper.getMainLooper());
        this.a = c0283a.a;
        com.trustlook.sdk.data.e eVar = c0283a.b;
        this.b = eVar;
        this.c = (String) ((HashMap) n).get(eVar);
        this.d = c0283a.c;
        this.e = c0283a.d;
        long c2 = com.trustlook.sdk.data.c.c(this.a, "key_expire", 0L);
        SharedPreferences.Editor edit = this.a.getSharedPreferences("trustlook_cloudscan_sdk_shared_pref", 0).edit();
        edit.clear();
        edit.commit();
        com.trustlook.sdk.data.c.h(this.a, "key_expire", c2);
        com.trustlook.sdk.data.c.i(c0283a.a, c0283a.b);
        com.trustlook.sdk.data.c.g(c0283a.a, "client_connection_timeout", c0283a.c);
        com.trustlook.sdk.data.c.g(c0283a.a, "client_socket_timeout", c0283a.d);
    }
}