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

应用版本信息
应用名称:SD Maid
版本号:5.5.9
包名称:eu.thedarken.sdm

MD5 校验值:66bdc43743bbe9109f1c82a63c9f5e2f

反编译源代码说明

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


package eu.thedarken.sdm.tools.clutter.report;

import a1.z;
import a5.o1;
import android.app.Application;
import android.content.pm.PackageInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import b5.k;
import b5.m;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.thedarken.sdm.App;
import eu.thedarken.sdm.R;
import eu.thedarken.sdm.SDMContext;
import eu.thedarken.sdm.ui.recyclerview.SDMRecyclerView;
import fa.p;
import fd.g;
import fd.h;
import ga.d;
import ic.p;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import sc.e;
import sc.f;
import tc.i;
import za.v;

public final class ReportFragment extends p {

    public static final String f4870o0;

    @BindView
    public EditText commentInput;

    @BindView
    public View container;

    @BindView
    public View containerCurrentOwners;

    @BindView
    public SDMRecyclerView currentOwnerList;

    public v f4871e0;

    public List<qa.a> f4872f0;

    public ArrayList f4873g0;

    public List<qa.a> f4874h0;

    public boolean f4875i0;

    public boolean f4876j0;

    public ua.d f4877k0;

    @BindView
    public CheckBox keeperBox;

    public ga.a f4878l0;

    public final e f4879m0 = z.i0(new a());

    public final e f4880n0 = z.i0(new d());

    @BindView
    public View placeHolder;

    @BindView
    public Button suggestOwnersButton;

    @BindView
    public SDMRecyclerView suggestedOwnerList;

    @BindView
    public TextView targetPath;

    @BindView
    public Toolbar toolbar;

    public static final class a extends h implements ed.a<OwnerAdapter> {
        public a() {
            super(0);
        }

        @Override
        public final OwnerAdapter invoke() {
            return new OwnerAdapter(ReportFragment.this.z3());
        }
    }

    public static final class b extends h implements ed.a<f> {

        public final String f4881i;

        public b(String str) {
            super(0);
            this.f4881i = str;
        }

        @Override
        public final f invoke() {
            ga.h hVar;
            String str;
            String str2;
            String str3;
            long j10;
            String p5;
            String str4;
            String str5;
            if (!ReportFragment.this.f4875i0) {
                ga.d iPCFunnel = App.f3930v.getIPCFunnel();
                ReportFragment reportFragment = ReportFragment.this;
                ga.a aVar = reportFragment.f4878l0;
                if (aVar != null) {
                    Collection<ga.h> values = aVar.c(ga.c.f5550e).values();
                    String str6 = this.f4881i;
                    ArrayList arrayList = new ArrayList(tc.e.W0(values));
                    for (ga.h hVar2 : values) {
                        String str7 = (String) iPCFunnel.a(new d.b(hVar2.g()));
                        if (str7 == null) {
                            str4 = str6;
                        } else {
                            str4 = str7;
                        }
                        String g4 = hVar2.g();
                        String p10 = hVar2.p();
                        if (p10 == null) {
                            str5 = "";
                        } else {
                            str5 = p10;
                        }
                        arrayList.add(new qa.a(str4, g4, str5, hVar2.o()));
                    }
                    reportFragment.f4874h0 = i.u1(arrayList, new qa.f());
                    ReportFragment reportFragment2 = ReportFragment.this;
                    reportFragment2.getClass();
                    ua.a fileForensics = App.f3930v.getFileForensics();
                    v vVar = ReportFragment.this.f4871e0;
                    if (vVar != null) {
                        reportFragment2.f4877k0 = fileForensics.d(vVar);
                        ReportFragment reportFragment3 = ReportFragment.this;
                        ua.d dVar = reportFragment3.f4877k0;
                        if (dVar != null) {
                            ArrayList arrayList2 = dVar.f9510i;
                            g.e(arrayList2, "ownerInfo.owners");
                            ArrayList arrayList3 = new ArrayList(tc.e.W0(arrayList2));
                            Iterator it = arrayList2.iterator();
                            while (it.hasNext()) {
                                ua.c cVar = (ua.c) it.next();
                                Boolean A = cVar.A();
                                g.e(A, "owner.isInstalled");
                                if (A.booleanValue()) {
                                    String str8 = cVar.h;
                                    g.e(str8, "owner.packageName");
                                    hVar = (ga.h) iPCFunnel.a(new d.C0120d(str8, 0));
                                } else {
                                    hVar = null;
                                }
                                String str9 = cVar.h;
                                Boolean A2 = cVar.A();
                                g.e(A2, "owner.isInstalled");
                                if (A2.booleanValue()) {
                                    str = (String) iPCFunnel.a(new d.b(cVar.h));
                                    if (str == null) {
                                        str2 = "";
                                        if (hVar != null || (p5 = hVar.p()) == null) {
                                            str3 = "";
                                        } else {
                                            str3 = p5;
                                        }
                                        if (hVar == null) {
                                            j10 = hVar.o();
                                        } else {
                                            j10 = -1;
                                        }
                                        g.e(str9, "packageName");
                                        arrayList3.add(new qa.a(str2, str9, str3, j10));
                                    }
                                } else {
                                    str = "?";
                                }
                                str2 = str;
                                if (hVar != null) {
                                }
                                str3 = "";
                                if (hVar == null) {
                                }
                                g.e(str9, "packageName");
                                arrayList3.add(new qa.a(str2, str9, str3, j10));
                            }
                            reportFragment3.f4872f0 = i.y1(arrayList3);
                        } else {
                            g.k("ownerInfo");
                            throw null;
                        }
                    } else {
                        g.k("targetFile");
                        throw null;
                    }
                } else {
                    g.k("appRepo");
                    throw null;
                }
            }
            androidx.fragment.app.p H2 = ReportFragment.this.H2();
            if (H2 != null) {
                H2.runOnUiThread(new m(9, ReportFragment.this));
            }
            return f.f8981a;
        }
    }

    public static final class c implements TextWatcher {
        public c() {
        }

        @Override
        public final void afterTextChanged(Editable editable) {
            g.f(editable, "s");
            ReportFragment.this.N3();
        }

        @Override
        public final void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
            g.f(charSequence, "s");
        }

        @Override
        public final void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
            g.f(charSequence, "s");
        }
    }

    public static final class d extends h implements ed.a<OwnerAdapter> {
        public d() {
            super(0);
        }

        @Override
        public final OwnerAdapter invoke() {
            return new OwnerAdapter(ReportFragment.this.z3());
        }
    }

    static {
        String d10 = App.d("ClutterReport");
        g.e(d10, "logTag(\"ClutterReport\")");
        f4870o0 = d10;
    }

    @Override
    public final void L3(Menu menu, MenuInflater menuInflater) {
        g.f(menu, "menu");
        g.f(menuInflater, "inflater");
        menuInflater.inflate(R.menu.clutterreporter_menu, menu);
    }

    @Override
    public final void M3(Menu menu) {
        g.f(menu, "menu");
        menu.findItem(R.id.menu_send).setVisible(this.f4876j0);
    }

    public final void N3() {
        boolean z10;
        boolean z11;
        List<qa.a> list = this.f4872f0;
        if (list != null) {
            Iterator<qa.a> it = list.iterator();
            while (true) {
                z10 = false;
                if (it.hasNext()) {
                    if (it.next().f8614l) {
                        z11 = true;
                        break;
                    }
                } else {
                    z11 = false;
                    break;
                }
            }
            if (!z11) {
                EditText editText = this.commentInput;
                if (editText != null) {
                    if (editText.getText().length() <= 16) {
                        ArrayList arrayList = this.f4873g0;
                        if (arrayList == null) {
                            g.k("suggestedOwners");
                            throw null;
                        }
                    }
                } else {
                    g.k("commentInput");
                    throw null;
                }
            }
            z10 = true;
            this.f4876j0 = z10;
            x3().invalidateOptionsMenu();
            return;
        }
        g.k("currentOwners");
        throw null;
    }

    public final OwnerAdapter O3() {
        return (OwnerAdapter) this.f4879m0.getValue();
    }

    public final OwnerAdapter P3() {
        return (OwnerAdapter) this.f4880n0.getValue();
    }

    @Override
    public final void W2(Bundle bundle) {
        super.W2(bundle);
        e.i iVar = (e.i) x3();
        Toolbar toolbar = this.toolbar;
        if (toolbar != null) {
            iVar.B1(toolbar);
            if (bundle == null) {
                Toast.makeText(J2(), R.string.progress_working, 0).show();
            }
            String Q2 = Q2(R.string.unknown);
            g.e(Q2, "getString(R.string.unknown)");
            o.a.E(false, null, new b(Q2), 31);
            return;
        }
        g.k("toolbar");
        throw null;
    }

    @Override
    public final void Z2(Bundle bundle) {
        Application application = x3().getApplication();
        g.d(application, "null cannot be cast to non-null type eu.thedarken.sdm.App");
        this.f4878l0 = ((App) application).h.P.get();
        super.Z2(bundle);
        Parcelable parcelable = y3().getParcelable("file");
        g.c(parcelable);
        this.f4871e0 = (v) parcelable;
        if (bundle != null) {
            ArrayList parcelableArrayList = bundle.getParcelableArrayList("suggestedOwners");
            g.c(parcelableArrayList);
            this.f4873g0 = parcelableArrayList;
            ArrayList parcelableArrayList2 = bundle.getParcelableArrayList("currentOwners");
            g.c(parcelableArrayList2);
            this.f4872f0 = parcelableArrayList2;
            ArrayList parcelableArrayList3 = bundle.getParcelableArrayList("installedApps");
            g.c(parcelableArrayList3);
            this.f4874h0 = parcelableArrayList3;
            this.f4876j0 = bundle.getBoolean("allowedToSend");
            this.f4875i0 = true;
        } else {
            this.f4873g0 = new ArrayList();
            this.f4872f0 = new ArrayList();
            this.f4874h0 = new ArrayList();
        }
        D3(true);
    }

    @Override
    public final View b3(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        g.f(layoutInflater, "inflater");
        View inflate = layoutInflater.inflate(R.layout.core_clutterreport_fragment, viewGroup, false);
        J3(ButterKnife.a(inflate, this));
        return inflate;
    }

    @Override
    public final boolean h3(MenuItem menuItem) {
        v vVar;
        String str;
        String str2;
        boolean z10;
        g.f(menuItem, "item");
        if (menuItem.getItemId() == R.id.menu_send) {
            ua.d dVar = this.f4877k0;
            if (dVar != null) {
                SDMContext sDMContext = App.f3930v;
                String str3 = o1.f226a;
                PackageInfo a3 = o1.a(sDMContext.getContext());
                EditText editText = this.commentInput;
                if (editText != null) {
                    String obj = editText.getText().toString();
                    List<qa.a> list = this.f4872f0;
                    if (list != null) {
                        ArrayList<qa.a> arrayList = this.f4873g0;
                        if (arrayList != null) {
                            CheckBox checkBox = this.keeperBox;
                            if (checkBox != null) {
                                boolean isChecked = checkBox.isChecked();
                                g.e(a3, "getPackageInfo(sdmContext)");
                                g.f(obj, "comment");
                                StringBuilder sb2 = new StringBuilder();
                                Locale locale = Locale.US;
                                String format = String.format(locale, "Clutterreport: %s", Arrays.copyOf(new Object[]{dVar.h.f9505k.a()}, 1));
                                g.e(format, "format(locale, format, *args)");
                                sb2.append(format);
                                Boolean G = dVar.G();
                                g.e(G, "itemInfo.isCurrentlyOwned");
                                try {
                                    if (!G.booleanValue()) {
                                        Boolean bool = dVar.h.f9504j;
                                        g.e(bool, "itemInfo.locationInfo.isBlackListLocation");
                                        if (!bool.booleanValue()) {
                                            if (dVar.f9510i.isEmpty()) {
                                                sb2.append(" (new)");
                                            }
                                            StringBuilder sb3 = new StringBuilder();
                                            Object[] objArr = new Object[7];
                                            objArr[0] = dVar.h.f9505k.a();
                                            objArr[1] = dVar.h.f();
                                            ua.b bVar = dVar.h;
                                            char c10 = 2;
                                            objArr[2] = bVar.h;
                                            vVar = bVar.f9505k;
                                            g.e(vVar, "itemInfo.item");
                                            if (!vVar.w()) {
                                                str = "DIRECTORY";
                                            } else if (vVar.y()) {
                                                str = "FILE";
                                            } else if (vVar.o()) {
                                                str = "SYMBOLIC LINK";
                                            } else {
                                                str = "UNKNOWN";
                                            }
                                            objArr[3] = str;
                                            int i10 = 4;
                                            objArr[4] = dVar.h.f9503i;
                                            objArr[5] = Boolean.valueOf(dVar.H());
                                            objArr[6] = Boolean.valueOf(isChecked);
                                            String format2 = String.format(locale, "### Target\nTarget: `%s`\nPrefix-free: `%s`\nPath-prefix: `%s`\nType: `%s`\nLocation: `%s`\nCurrent keeper state: `%b`\nSuggested keeper state: `%b`\n", Arrays.copyOf(objArr, 7));
                                            g.e(format2, "format(locale, format, *args)");
                                            sb3.append(format2);
                                            sb3.append("\n");
                                            sb3.append("### Suggested owners\n");
                                            for (qa.a aVar : arrayList) {
                                                Locale locale2 = Locale.US;
                                                Object[] objArr2 = new Object[4];
                                                objArr2[0] = aVar.h;
                                                objArr2[1] = aVar.f8611i;
                                                objArr2[c10] = aVar.f8612j;
                                                objArr2[3] = Long.valueOf(aVar.f8613k);
                                                String format3 = String.format(locale2, "Appname: `%s`\nPackagename: `%s`\nVersion: `%s (%d)`\n", Arrays.copyOf(objArr2, 4));
                                                g.e(format3, "format(locale, format, *args)");
                                                sb3.append(format3);
                                                sb3.append("\n");
                                                a3 = a3;
                                                c10 = 2;
                                            }
                                            PackageInfo packageInfo = a3;
                                            sb3.append("### Current owners\n");
                                            if (!list.isEmpty()) {
                                                sb3.append("None\n");
                                            } else {
                                                for (qa.a aVar2 : list) {
                                                    Locale locale3 = Locale.US;
                                                    if (!aVar2.f8614l) {
                                                        str2 = "Appname: `%s`\nPackagename: `%s`\nVersion: `%s (%d)`\n";
                                                    } else {
                                                        str2 = "~~Appname: `%s`~~\n~~Packagename: `%s`~~\n~~Version: `%s (%d)`~~\n";
                                                    }
                                                    Object[] objArr3 = new Object[i10];
                                                    objArr3[0] = aVar2.h;
                                                    objArr3[1] = aVar2.f8611i;
                                                    objArr3[2] = aVar2.f8612j;
                                                    objArr3[3] = Long.valueOf(aVar2.f8613k);
                                                    i10 = 4;
                                                    String format4 = String.format(locale3, str2, Arrays.copyOf(objArr3, 4));
                                                    g.e(format4, "format(locale, format, *args)");
                                                    sb3.append(format4);
                                                    sb3.append("\n");
                                                }
                                            }
                                            sb3.append("\n");
                                            Locale locale4 = Locale.US;
                                            String format5 = String.format(locale4, "### SD Maid\nVersion: `%s (%d)`\n", Arrays.copyOf(new Object[]{packageInfo.versionName, Integer.valueOf(packageInfo.versionCode)}, 2));
                                            g.e(format5, "format(locale, format, *args)");
                                            sb3.append(format5);
                                            sb3.append("\n");
                                            String format6 = String.format(locale4, "### Device\nFingerprint: `%s`\n", Arrays.copyOf(new Object[]{Build.FINGERPRINT}, 1));
                                            g.e(format6, "format(locale, format, *args)");
                                            sb3.append(format6);
                                            sb3.append("\n");
                                            if (!TextUtils.isEmpty(obj)) {
                                                String format7 = String.format(locale4, "### Comment\n`%s`\n", Arrays.copyOf(new Object[]{obj}, 1));
                                                g.e(format7, "format(locale, format, *args)");
                                                sb3.append(format7);
                                            }
                                            Uri build = Uri.parse("https://github.com/d4rken/sdmaid-public/issues/new").buildUpon().appendQueryParameter("title", sb2.toString()).appendQueryParameter("body", sb3.toString()).build();
                                            g.e(build, "parse(URL_TARGET)\n      …                 .build()");
                                            ee.a.d(f4870o0).h(build.toString(), new Object[0]);
                                            p.d d10 = new fa.p(J2()).d(build.toString());
                                            z10 = true;
                                            d10.f5275f = true;
                                            d10.c();
                                            x3().finish();
                                            return true;
                                        }
                                    }
                                    d10.f5275f = true;
                                    d10.c();
                                    x3().finish();
                                    return true;
                                } catch (Exception e10) {
                                    e = e10;
                                    fa.b.a(f4870o0, e, null, null);
                                    Toast.makeText(J2(), R.string.error, 0).show();
                                    return z10;
                                }
                                sb2.append(" (FP)");
                                StringBuilder sb32 = new StringBuilder();
                                Object[] objArr4 = new Object[7];
                                objArr4[0] = dVar.h.f9505k.a();
                                objArr4[1] = dVar.h.f();
                                ua.b bVar2 = dVar.h;
                                char c102 = 2;
                                objArr4[2] = bVar2.h;
                                vVar = bVar2.f9505k;
                                g.e(vVar, "itemInfo.item");
                                if (!vVar.w()) {
                                }
                                objArr4[3] = str;
                                int i102 = 4;
                                objArr4[4] = dVar.h.f9503i;
                                objArr4[5] = Boolean.valueOf(dVar.H());
                                objArr4[6] = Boolean.valueOf(isChecked);
                                String format22 = String.format(locale, "### Target\nTarget: `%s`\nPrefix-free: `%s`\nPath-prefix: `%s`\nType: `%s`\nLocation: `%s`\nCurrent keeper state: `%b`\nSuggested keeper state: `%b`\n", Arrays.copyOf(objArr4, 7));
                                g.e(format22, "format(locale, format, *args)");
                                sb32.append(format22);
                                sb32.append("\n");
                                sb32.append("### Suggested owners\n");
                                while (r2.hasNext()) {
                                }
                                PackageInfo packageInfo2 = a3;
                                sb32.append("### Current owners\n");
                                if (!list.isEmpty()) {
                                }
                                sb32.append("\n");
                                Locale locale42 = Locale.US;
                                String format52 = String.format(locale42, "### SD Maid\nVersion: `%s (%d)`\n", Arrays.copyOf(new Object[]{packageInfo2.versionName, Integer.valueOf(packageInfo2.versionCode)}, 2));
                                g.e(format52, "format(locale, format, *args)");
                                sb32.append(format52);
                                sb32.append("\n");
                                String format62 = String.format(locale42, "### Device\nFingerprint: `%s`\n", Arrays.copyOf(new Object[]{Build.FINGERPRINT}, 1));
                                g.e(format62, "format(locale, format, *args)");
                                sb32.append(format62);
                                sb32.append("\n");
                                if (!TextUtils.isEmpty(obj)) {
                                }
                                Uri build2 = Uri.parse("https://github.com/d4rken/sdmaid-public/issues/new").buildUpon().appendQueryParameter("title", sb2.toString()).appendQueryParameter("body", sb32.toString()).build();
                                g.e(build2, "parse(URL_TARGET)\n      …                 .build()");
                                ee.a.d(f4870o0).h(build2.toString(), new Object[0]);
                                p.d d102 = new fa.p(J2()).d(build2.toString());
                                z10 = true;
                            } else {
                                g.k("keeperBox");
                                throw null;
                            }
                        } else {
                            g.k("suggestedOwners");
                            throw null;
                        }
                    } else {
                        g.k("currentOwners");
                        throw null;
                    }
                } else {
                    g.k("commentInput");
                    throw null;
                }
            } else {
                g.k("ownerInfo");
                throw null;
            }
        } else {
            if (menuItem.getItemId() == 16908332) {
                x3().finish();
                return true;
            }
            return false;
        }
    }

    @Override
    public final void l3(Bundle bundle) {
        ArrayList arrayList = this.f4873g0;
        if (arrayList != null) {
            bundle.putParcelableArrayList("suggestedOwners", new ArrayList<>(arrayList));
            List<qa.a> list = this.f4872f0;
            if (list != null) {
                bundle.putParcelableArrayList("currentOwners", new ArrayList<>(list));
                List<qa.a> list2 = this.f4874h0;
                if (list2 != null) {
                    bundle.putParcelableArrayList("installedApps", new ArrayList<>(list2));
                    bundle.putBoolean("allowedToSend", this.f4876j0);
                    return;
                } else {
                    g.k("installedApps");
                    throw null;
                }
            }
            g.k("currentOwners");
            throw null;
        }
        g.k("suggestedOwners");
        throw null;
    }

    @Override
    public final void o3(View view, Bundle bundle) {
        g.f(view, "view");
        SDMRecyclerView sDMRecyclerView = this.currentOwnerList;
        if (sDMRecyclerView != null) {
            J2();
            int i10 = 1;
            sDMRecyclerView.setLayoutManager(new LinearLayoutManager(1));
            SDMRecyclerView sDMRecyclerView2 = this.currentOwnerList;
            if (sDMRecyclerView2 != null) {
                sDMRecyclerView2.setAdapter(O3());
                SDMRecyclerView sDMRecyclerView3 = this.currentOwnerList;
                if (sDMRecyclerView3 != null) {
                    sDMRecyclerView3.setOnItemClickListener(new qa.e(this, 0));
                    SDMRecyclerView sDMRecyclerView4 = this.suggestedOwnerList;
                    if (sDMRecyclerView4 != null) {
                        J2();
                        sDMRecyclerView4.setLayoutManager(new LinearLayoutManager(1));
                        SDMRecyclerView sDMRecyclerView5 = this.suggestedOwnerList;
                        if (sDMRecyclerView5 != null) {
                            sDMRecyclerView5.setAdapter(P3());
                            SDMRecyclerView sDMRecyclerView6 = this.suggestedOwnerList;
                            if (sDMRecyclerView6 != null) {
                                sDMRecyclerView6.setOnItemClickListener(new qa.e(this, i10));
                                Button button = this.suggestOwnersButton;
                                if (button != null) {
                                    button.setOnClickListener(new k(25, this));
                                    EditText editText = this.commentInput;
                                    if (editText != null) {
                                        editText.addTextChangedListener(new c());
                                        super.o3(view, bundle);
                                        return;
                                    } else {
                                        g.k("commentInput");
                                        throw null;
                                    }
                                }
                                g.k("suggestOwnersButton");
                                throw null;
                            }
                            g.k("suggestedOwnerList");
                            throw null;
                        }
                        g.k("suggestedOwnerList");
                        throw null;
                    }
                    g.k("suggestedOwnerList");
                    throw null;
                }
                g.k("currentOwnerList");
                throw null;
            }
            g.k("currentOwnerList");
            throw null;
        }
        g.k("currentOwnerList");
        throw null;
    }
}