APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Candyfloss
版本号:3.9.6
包名称:com.stark.candyfloss

MD5 校验值:5b5c91fb96bf669521c42e375c79f86c

反编译源代码说明

kz0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package o;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.XmlResourceParser;
import android.util.Log;
import candybar.lib.R;
import com.afollestad.materialdialogs.c;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.Normalizer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import me.zhanghai.android.materialprogressbar.BuildConfig;
import o.um0;
import o.wy0;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class kz0 {

    public class a extends HashMap {
        public final List e;

        public a(List list) {
            this.e = list;
            put("section", "icon_request");
            put("action", "submit");
            put("item", "pacific");
            put("number_of_icons", Integer.valueOf(list.size()));
        }
    }

    public class b extends HashMap {
        public final boolean e;
        public final List f;

        public b(boolean z, List list) {
            String str;
            this.e = z;
            this.f = list;
            put("section", "icon_request");
            put("action", "submit");
            put("item", "custom");
            if (z) {
                str = "premium";
            } else {
                str = "regular";
            }
            put("type", str);
            put("number_of_icons", Integer.valueOf(list.size()));
        }
    }

    public static class c {
        public static final int[] a;

        static {
            int[] iArr = new int[e.values().length];
            a = iArr;
            try {
                iArr[e.APPFILTER.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[e.APPMAP.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[e.THEME_RESOURCES.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public enum d {
        ACTIVITY("component", "drawable"),
        DRAWABLE("drawable", "component");

        public final String e;
        public final String f;

        d(String str, String str2) {
            this.e = str;
            this.f = str2;
        }

        public void citrus() {
        }

        public final String d() {
            return this.e;
        }

        public final String e() {
            return this.f;
        }
    }

    public enum e {
        APPFILTER("appfilter.xml", "<resources>", "</resources>"),
        APPMAP("appmap.xml", "<appmap>", "</appmap>"),
        THEME_RESOURCES("theme_resources.xml", "<Theme version=\"1\">", "</Theme>");

        public final String e;
        public final String f;
        public final String g;

        e(String str, String str2, String str3) {
            this.e = str;
            this.f = str2;
            this.g = str3;
        }

        public void citrus() {
        }

        public final String f(Context context, uy0 uy0Var) {
            int i = c.a[ordinal()];
            if (i != 1) {
                if (i != 2) {
                    if (i != 3) {
                        return BuildConfig.FLAVOR;
                    }
                    return "\t<!-- " + uy0Var.d() + " -->\n\t<AppIcon name=\"" + uy0Var.b() + "\" image=\"" + kz0.d(uy0Var.d()) + "\"/>\n\n";
                }
                return "\t<!-- " + uy0Var.d() + " -->\n\t<item class=\"" + uy0Var.b().replaceFirst(BuildConfig.FLAVOR + uy0Var.f() + "/", BuildConfig.FLAVOR) + "\" name=\"" + kz0.d(uy0Var.d()) + "\"/>\n\n";
            }
            return "\t<!-- " + uy0Var.d() + " -->\n\t" + context.getString(R.string.appfilter_item).replaceAll("\\{\\{component\\}\\}", Matcher.quoteReplacement(uy0Var.b())).replaceAll("\\{\\{drawable\\}\\}", kz0.d(uy0Var.d())) + "\n\n";
        }

        public final String g() {
            return this.e;
        }

        public final String h() {
            return this.g;
        }

        public final String i() {
            return this.f;
        }
    }

    public static String a(List list) {
        StringBuilder sb = new StringBuilder();
        sb.append("{ \"components\": [\n");
        Iterator it = list.iterator();
        boolean z = true;
        while (it.hasNext()) {
            uy0 uy0Var = (uy0) it.next();
            if (!z) {
                sb.append(",\n");
            }
            sb.append(String.format("{ \"name\": \"%s\", \"pkg\": \"%s\", \"componentInfo\": \"%s\", \"drawable\": \"%s\" }", uy0Var.d(), uy0Var.f(), uy0Var.b(), d(uy0Var.d())));
            z = false;
        }
        sb.append("]}");
        return sb.toString();
    }

    public static File b(Context context, List list, e eVar) {
        try {
            if (eVar == e.APPFILTER && !he.b().A()) {
                return null;
            }
            if (eVar == e.APPMAP && !he.b().B()) {
                return null;
            }
            if ((eVar == e.THEME_RESOURCES) && (true ^ he.b().C())) {
                return null;
            }
            File file = new File(context.getCacheDir().toString(), eVar.g());
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF8"));
            bufferedWriter.append((CharSequence) eVar.i()).append((CharSequence) "\n\n");
            Iterator it = list.iterator();
            while (it.hasNext()) {
                bufferedWriter.append((CharSequence) eVar.f(context, (uy0) it.next()));
            }
            bufferedWriter.append((CharSequence) eVar.h());
            bufferedWriter.flush();
            bufferedWriter.close();
            return file;
        } catch (IOException e2) {
            xh0.b(Log.getStackTraceString(e2));
            return null;
        }
    }

    public static void c(Context context) {
        boolean z = false;
        if (!context.getResources().getBoolean(R.bool.enable_premium_request)) {
            ju0.b(context).a0(false);
            ((nz0) context).l(true);
            return;
        }
        String[] strArr = {"com.chelpus.lackypatch", "com.dimonvideo.luckypatcher", "com.forpda.lp", "com.android.vending.billing.InAppBillingService.LUCK", "com.android.vending.billing.InAppBillingService.LOCK", "cc.madkite.freedom", "com.android.vending.billing.InAppBillingService.LACK", "com.android.vending.billing.InAppBillingService.CLON", "com.android.vending.billing.InAppBillingService.CRAC", "com.android.vending.billing.InAppBillingService.COIN"};
        int i = 0;
        while (true) {
            if (i >= 10) {
                break;
            }
            if (context.getPackageManager().getPackageInfo(strArr[i], 1) != null) {
                z = true;
                break;
            }
            i++;
        }
        ju0.b(context).a0(!z);
        ((nz0) context).l(z);
    }

    public static String d(String str) {
        String normalize = Normalizer.normalize(str.toLowerCase(), Normalizer.Form.NFD);
        try {
            normalize = normalize.replaceAll("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+", BuildConfig.FLAVOR);
        } catch (Exception unused) {
        }
        String replaceAll = normalize.replaceAll("[.\"']", BuildConfig.FLAVOR).replaceAll("[ \\[\\]{}()=!/\\\\,?°|<>;:#~+*-]", "_").replaceAll("&", "_and_");
        if (Character.isDigit(replaceAll.charAt(0))) {
            replaceAll = "_" + replaceAll;
        }
        return replaceAll.replaceAll("_+", "_");
    }

    public static HashMap e(Context context, d dVar) {
        try {
            HashMap hashMap = new HashMap();
            XmlResourceParser xml = context.getResources().getXml(R.xml.appfilter);
            while (xml.getEventType() != 1) {
                if (xml.getEventType() == 2 && xml.getName().equals("item")) {
                    String attributeValue = xml.getAttributeValue(null, dVar.d());
                    String attributeValue2 = xml.getAttributeValue(null, dVar.e());
                    if (attributeValue != null && attributeValue2 != null) {
                        hashMap.put(attributeValue.replace("ComponentInfo{", BuildConfig.FLAVOR).replace("}", BuildConfig.FLAVOR), attributeValue2.replace("ComponentInfo{", BuildConfig.FLAVOR).replace("}", BuildConfig.FLAVOR));
                    } else {
                        xh0.b("Appfilter Error\nKey: " + attributeValue + "\nValue: " + attributeValue2);
                    }
                }
                xml.next();
            }
            return hashMap;
        } catch (Exception e2) {
            xh0.b(Log.getStackTraceString(e2));
            return new HashMap();
        }
    }

    public static String f(String str) {
        return str.substring(0, str.lastIndexOf(".")) + "_" + df1.a(new SimpleDateFormat("dd_MM_yyyy_HH_mm_ss", Locale.ENGLISH)) + ".zip";
    }

    public static List g(Context context) {
        ArrayList arrayList = new ArrayList();
        HashMap e2 = e(context, d.ACTIVITY);
        PackageManager packageManager = context.getPackageManager();
        Intent intent = new Intent("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.LAUNCHER");
        List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 64);
        ef.S = queryIntentActivities.size();
        try {
            Collections.sort(queryIntentActivities, new ResolveInfo.DisplayNameComparator(packageManager));
        } catch (Exception unused) {
        }
        for (ResolveInfo resolveInfo : queryIntentActivities) {
            String str = resolveInfo.activityInfo.packageName + "/" + resolveInfo.activityInfo.name;
            if (((String) e2.get(str)) == null) {
                String d2 = xg0.d(context, new Locale("en"), str);
                if (d2 == null) {
                    d2 = resolveInfo.activityInfo.loadLabel(packageManager).toString();
                }
                arrayList.add(uy0.a().c(d2).e(resolveInfo.activityInfo.packageName).a(str).g(xo.H(context).v0(str)).b());
            }
        }
        return arrayList;
    }

    public static String h(Context context) {
        String string = context.getResources().getString(R.string.premium_request_pacific_api_key);
        if (string.length() == 0) {
            return i(context);
        }
        return string;
    }

    public static String i(Context context) {
        return context.getResources().getString(R.string.regular_request_pacific_api_key);
    }

    public static File j(List list, String str, String str2) {
        try {
            File file = new File(str, str2);
            ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
            byte[] bArr = new byte[2048];
            for (int i = 0; i < list.size(); i++) {
                BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream((String) list.get(i)), 2048);
                zipOutputStream.putNextEntry(new ZipEntry(((String) list.get(i)).substring(((String) list.get(i)).lastIndexOf("/") + 1)));
                while (true) {
                    int read = bufferedInputStream.read(bArr, 0, 2048);
                    if (read != -1) {
                        zipOutputStream.write(bArr, 0, read);
                    }
                }
                bufferedInputStream.close();
            }
            zipOutputStream.close();
            return file;
        } catch (Exception unused) {
            return null;
        }
    }

    public static boolean k(Context context) {
        return (context.getResources().getString(R.string.premium_request_method).length() > 0 && context.getResources().getString(R.string.premium_request_method).contentEquals("custom")) || (context.getResources().getString(R.string.regular_request_method).length() > 0 && context.getResources().getString(R.string.regular_request_method).contentEquals("custom"));
    }

    public static boolean l(Context context) {
        if (context.getResources().getString(R.string.premium_request_method).length() > 0) {
            return context.getResources().getString(R.string.premium_request_method).contentEquals("pacific");
        }
        if (context.getResources().getString(R.string.regular_request_method).length() > 0) {
            return context.getResources().getString(R.string.regular_request_method).contentEquals("pacific");
        }
        return i(context).length() > 0;
    }

    public static boolean m(Context context) {
        boolean s = ju0.b(context).s();
        if (!s) {
            new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.premium_request).e(R.string.premium_request_no_internet).s(R.string.close).w();
        }
        return s;
    }

    public static boolean n(Context context) {
        return context.getResources().getString(R.string.regular_request_method).length() > 0 && context.getResources().getString(R.string.regular_request_method).contentEquals("custom");
    }

    public static boolean o(Context context) {
        if (context.getResources().getString(R.string.regular_request_method).length() > 0) {
            return context.getResources().getString(R.string.regular_request_method).contentEquals("pacific");
        }
        return i(context).length() > 0;
    }

    public static String p(List list, boolean z) {
        he.b().d().b("click", new b(z, list));
        he.b().n();
        xh0.b("Custom icon request failed: No handler configured");
        return "Custom icon request failed: No handler configured";
    }

    public static String q(List list, List list2, File file, String str) {
        he.b().d().b("click", new a(list));
        um0.a a2 = new um0.a().e(um0.k).a("apps", a(list));
        File j = j(list2, file.toString(), "icons.zip");
        Objects.requireNonNull(j);
        try {
            s01 c2 = new kq0().u(new wy0.a().h("https://pacificmanager.app/v1/request").a("TokenID", str).a("Accept", "application/json").a("User-Agent", "afollestad/icon-request").f(a2.b("archive", "icons.zip", bz0.c(j, tk0.e("application/zip"))).d()).b()).c();
            if (c2.g() > 199 && c2.g() < 300) {
                t01 a3 = c2.a();
                Objects.requireNonNull(a3);
                JSONObject jSONObject = new JSONObject(a3.o());
                if (jSONObject.getString("status").equals("error")) {
                    return jSONObject.getString("error");
                }
                return null;
            }
            return "Unknown error.";
        } catch (IOException e2) {
            e = e2;
            xh0.b("PACIFIC_MANAGER: Error");
            xh0.b(Log.getStackTraceString(e));
            return BuildConfig.FLAVOR;
        } catch (JSONException e3) {
            e = e3;
            xh0.b("PACIFIC_MANAGER: Error");
            xh0.b(Log.getStackTraceString(e));
            return BuildConfig.FLAVOR;
        }
    }

    public static void r(Context context) {
        boolean z = context.getResources().getBoolean(R.bool.reset_icon_request_limit);
        String str = context.getResources().getString(R.string.request_limit, Integer.valueOf(context.getResources().getInteger(R.integer.icon_request_limit))) + " " + context.getResources().getString(R.string.request_used, Integer.valueOf(ju0.b(context).l()));
        if (ju0.b(context).B()) {
            str = str + " " + context.getResources().getString(R.string.request_limit_buy);
        }
        if (z) {
            str = str + "\n\n" + context.getResources().getString(R.string.request_limit_reset);
        }
        new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.request_title).h(str).s(R.string.close).w();
    }

    public static void s(Context context) {
        new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.premium_request).e(R.string.premium_request_consume_failed).s(R.string.close).w();
    }

    public static void t(Context context) {
        new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.premium_request).e(R.string.premium_request_exist).s(R.string.close).w();
    }

    public static void u(Context context, int i) {
        new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.premium_request).h(context.getResources().getString(R.string.premium_request_limit, Integer.valueOf(ju0.b(context).i())) + " " + context.getResources().getString(R.string.premium_request_limit1, Integer.valueOf(i))).s(R.string.close).w();
    }

    public static void v(Context context) {
        new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.request_title).e(R.string.premium_request_required).s(R.string.close).w();
    }

    public static void w(Context context) {
        new c.d(context).z(si1.b(context), si1.c(context)).x(R.string.premium_request).h(context.getResources().getString(R.string.premium_request_already_purchased, Integer.valueOf(ju0.b(context).i()))).s(R.string.close).w();
    }
}