SD Maid v5.6.3版本的 MD5 值为:b283f6effbd880c54f4e4da72852de99

以下内容为反编译后的 ReportFragment.java 源代码,内容仅作参考


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

import a1.z;
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.fragment.app.q;
import androidx.recyclerview.widget.LinearLayoutManager;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.yahoo.squidb.sql.SqlStatement;
import ed.e;
import ed.f;
import eu.thedarken.sdm.App;
import eu.thedarken.sdm.R;
import eu.thedarken.sdm.SDMContext;
import eu.thedarken.sdm.tools.forensics.Location;
import eu.thedarken.sdm.ui.recyclerview.SDMRecyclerView;
import fd.i;
import h3.n;
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 l5.p1;
import m5.k;
import mb.v;
import ta.p;
import ua.d;
import ua.h;
import uc.p;
public final class ReportFragment extends p {
    public static final String f4916o0;
    @BindView
    public EditText commentInput;
    @BindView
    public View container;
    @BindView
    public View containerCurrentOwners;
    @BindView
    public View containerSuggestedOwners;
    @BindView
    public SDMRecyclerView currentOwnerList;
    public v f4917e0;
    public List<db.a> f4918f0;
    public ArrayList f4919g0;
    public List<db.a> f4920h0;
    public boolean f4921i0;
    public boolean f4922j0;
    public hb.d f4923k0;
    @BindView
    public CheckBox keeperBox;
    public ua.a f4924l0;
    public final e f4925m0 = new e(new a());
    public final e f4926n0 = new e(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 qd.d implements pd.a<OwnerAdapter> {
        public a() {
            super(0);
        }

        @Override
        public final OwnerAdapter a() {
            return new OwnerAdapter(ReportFragment.this.A3());
        }
    }

    public static final class b extends qd.d implements pd.a<f> {
        public final String f4929j;

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

        @Override
        public final f a() {
            h hVar;
            String str;
            String str2;
            String p10;
            ReportFragment reportFragment = ReportFragment.this;
            if (!reportFragment.f4921i0) {
                ua.d iPCFunnel = App.f3954s.getIPCFunnel();
                ua.a aVar = reportFragment.f4924l0;
                if (aVar == null) {
                    qd.c.k("appRepo");
                    throw null;
                }
                Collection<h> values = aVar.c(ua.c.f10104e).values();
                ArrayList arrayList = new ArrayList(fd.e.H0(values));
                for (h hVar2 : values) {
                    String str3 = (String) iPCFunnel.a(new d.b(hVar2.g()));
                    if (str3 == null) {
                        str3 = this.f4929j;
                    }
                    String str4 = str3;
                    String g10 = hVar2.g();
                    String p11 = hVar2.p();
                    arrayList.add(new db.a(str4, g10, p11 == null ? "" : p11, hVar2.o()));
                }
                reportFragment.f4920h0 = i.c1(arrayList, new db.f());
                hb.a fileForensics = App.f3954s.getFileForensics();
                v vVar = reportFragment.f4917e0;
                if (vVar == null) {
                    qd.c.k("targetFile");
                    throw null;
                }
                hb.d d = fileForensics.d(vVar);
                reportFragment.f4923k0 = d;
                ArrayList arrayList2 = d.f5979i;
                qd.c.e("ownerInfo.owners", arrayList2);
                ArrayList arrayList3 = new ArrayList(fd.e.H0(arrayList2));
                Iterator it = arrayList2.iterator();
                while (it.hasNext()) {
                    hb.c cVar = (hb.c) it.next();
                    Boolean b10 = cVar.b();
                    qd.c.e("owner.isInstalled", b10);
                    boolean booleanValue = b10.booleanValue();
                    String str5 = cVar.h;
                    if (booleanValue) {
                        qd.c.e("owner.packageName", str5);
                        hVar = (h) iPCFunnel.a(new d.C0223d(str5, 0));
                    } else {
                        hVar = null;
                    }
                    Boolean b11 = cVar.b();
                    qd.c.e("owner.isInstalled", b11);
                    if (b11.booleanValue()) {
                        str = (String) iPCFunnel.a(new d.b(str5));
                        if (str == null) {
                            str2 = "";
                            String str6 = (hVar != null || (p10 = hVar.p()) == null) ? "" : p10;
                            long o10 = hVar == null ? hVar.o() : -1L;
                            qd.c.e("packageName", str5);
                            arrayList3.add(new db.a(str2, str5, str6, o10));
                        }
                    } else {
                        str = SqlStatement.REPLACEABLE_PARAMETER;
                    }
                    str2 = str;
                    if (hVar != null) {
                    }
                    if (hVar == null) {
                    }
                    qd.c.e("packageName", str5);
                    arrayList3.add(new db.a(str2, str5, str6, o10));
                }
                reportFragment.f4918f0 = i.g1(arrayList3);
            }
            q I2 = reportFragment.I2();
            if (I2 != null) {
                I2.runOnUiThread(new n(10, reportFragment));
            }
            return f.f3946a;
        }
    }

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

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

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

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

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

        @Override
        public final OwnerAdapter a() {
            return new OwnerAdapter(ReportFragment.this.A3());
        }
    }

    static {
        String d10 = App.d("ClutterReport");
        qd.c.e("logTag(\"ClutterReport\")", d10);
        f4916o0 = d10;
    }

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

    @Override
    public final void N3(Menu menu) {
        qd.c.f("menu", menu);
        menu.findItem(R.id.menu_send).setVisible(this.f4922j0);
    }

    public final void O3() {
        boolean z4;
        boolean z10;
        List<db.a> list = this.f4918f0;
        if (list == null) {
            qd.c.k("currentOwners");
            throw null;
        }
        Iterator<db.a> it = list.iterator();
        while (true) {
            z4 = false;
            if (!it.hasNext()) {
                z10 = false;
                break;
            } else if (it.next().f3569l) {
                z10 = true;
                break;
            }
        }
        if (!z10) {
            EditText editText = this.commentInput;
            if (editText == null) {
                qd.c.k("commentInput");
                throw null;
            } else if (editText.getText().length() <= 16) {
                ArrayList arrayList = this.f4919g0;
                if (arrayList == null) {
                    qd.c.k("suggestedOwners");
                    throw null;
                }
            }
        }
        z4 = true;
        this.f4922j0 = z4;
        y3().invalidateOptionsMenu();
    }

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

    public final OwnerAdapter Q3() {
        return (OwnerAdapter) this.f4926n0.getValue();
    }

    @Override
    public final void X2(Bundle bundle) {
        super.X2(bundle);
        e.i iVar = (e.i) y3();
        Toolbar toolbar = this.toolbar;
        if (toolbar == null) {
            qd.c.k("toolbar");
            throw null;
        }
        iVar.z1(toolbar);
        if (bundle == null) {
            Toast.makeText(K2(), (int) R.string.progress_working, 0).show();
        }
        String R2 = R2(R.string.unknown);
        qd.c.e("getString(R.string.unknown)", R2);
        z.q0(false, null, new b(R2), 31);
    }

    @Override
    public final void a3(Bundle bundle) {
        Application application = y3().getApplication();
        qd.c.d("null cannot be cast to non-null type eu.thedarken.sdm.App", application);
        this.f4924l0 = ((App) application).h.O.get();
        super.a3(bundle);
        Parcelable parcelable = z3().getParcelable("file");
        qd.c.c(parcelable);
        this.f4917e0 = (v) parcelable;
        if (bundle != null) {
            ArrayList parcelableArrayList = bundle.getParcelableArrayList("suggestedOwners");
            qd.c.c(parcelableArrayList);
            this.f4919g0 = parcelableArrayList;
            ArrayList parcelableArrayList2 = bundle.getParcelableArrayList("currentOwners");
            qd.c.c(parcelableArrayList2);
            this.f4918f0 = parcelableArrayList2;
            ArrayList parcelableArrayList3 = bundle.getParcelableArrayList("installedApps");
            qd.c.c(parcelableArrayList3);
            this.f4920h0 = parcelableArrayList3;
            this.f4922j0 = bundle.getBoolean("allowedToSend");
            this.f4921i0 = true;
        } else {
            this.f4919g0 = new ArrayList();
            this.f4918f0 = new ArrayList();
            this.f4920h0 = new ArrayList();
        }
        E3(true);
    }

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

    @Override
    public final boolean i3(MenuItem menuItem) {
        String str;
        StringBuilder sb2;
        char c10;
        int i10;
        Iterator it;
        String str2;
        String str3;
        String str4;
        qd.c.f("item", menuItem);
        if (menuItem.getItemId() == R.id.menu_send) {
            hb.d dVar = this.f4923k0;
            if (dVar == null) {
                qd.c.k("ownerInfo");
                throw null;
            }
            SDMContext sDMContext = App.f3954s;
            String str5 = p1.f7798a;
            PackageInfo a10 = p1.a(sDMContext.getContext());
            EditText editText = this.commentInput;
            if (editText == null) {
                qd.c.k("commentInput");
                throw null;
            }
            String obj = editText.getText().toString();
            List<db.a> list = this.f4918f0;
            if (list == null) {
                qd.c.k("currentOwners");
                throw null;
            }
            ArrayList arrayList = this.f4919g0;
            if (arrayList == null) {
                qd.c.k("suggestedOwners");
                throw null;
            }
            CheckBox checkBox = this.keeperBox;
            if (checkBox == null) {
                qd.c.k("keeperBox");
                throw null;
            }
            boolean isChecked = checkBox.isChecked();
            qd.c.e("getPackageInfo(sdmContext)", a10);
            qd.c.f("comment", obj);
            StringBuilder sb3 = new StringBuilder();
            Locale locale = Locale.US;
            hb.b bVar = dVar.h;
            String format = String.format(locale, "Clutterreport: %s", Arrays.copyOf(new Object[]{bVar.f5974k.getPath()}, 1));
            qd.c.e("format(locale, format, *args)", format);
            sb3.append(format);
            Boolean F = dVar.F();
            qd.c.e("itemInfo.isCurrentlyOwned", F);
            try {
                if (!F.booleanValue()) {
                    Boolean bool = bVar.f5973j;
                    qd.c.e("itemInfo.locationInfo.isBlackListLocation", bool);
                    if (!bool.booleanValue()) {
                        if (dVar.f5979i.isEmpty()) {
                            str = " (new)";
                            sb3.append(str);
                        }
                        sb2 = new StringBuilder();
                        Object[] objArr = new Object[7];
                        v vVar = bVar.f5974k;
                        objArr[0] = vVar.getPath();
                        objArr[1] = bVar.a();
                        c10 = 2;
                        objArr[2] = bVar.h;
                        qd.c.e("itemInfo.item", vVar);
                        objArr[3] = !vVar.A() ? "DIRECTORY" : vVar.C() ? "FILE" : vVar.s() ? "SYMBOLIC LINK" : "UNKNOWN";
                        Location location = bVar.f5972i;
                        i10 = 4;
                        objArr[4] = location;
                        objArr[5] = Boolean.valueOf(dVar.G());
                        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));
                        qd.c.e("format(locale, format, *args)", format2);
                        sb2.append(format2);
                        sb2.append("\n### Suggested owners\n");
                        it = arrayList.iterator();
                        while (true) {
                            str2 = "\n";
                            if (it.hasNext()) {
                                break;
                            }
                            db.a aVar = (db.a) it.next();
                            Locale locale2 = Locale.US;
                            Object[] objArr2 = new Object[i10];
                            objArr2[0] = aVar.h;
                            objArr2[1] = aVar.f3566i;
                            objArr2[c10] = aVar.f3567j;
                            objArr2[3] = Long.valueOf(aVar.f3568k);
                            String format3 = String.format(locale2, "Appname: `%s`\nPackagename: `%s`\nVersion: `%s (%d)`\n", Arrays.copyOf(objArr2, 4));
                            qd.c.e("format(locale, format, *args)", format3);
                            sb2.append(format3);
                            sb2.append("\n");
                            obj = obj;
                            c10 = 2;
                            i10 = 4;
                        }
                        str3 = obj;
                        sb2.append("### Current owners\n");
                        if (list.isEmpty()) {
                            for (db.a aVar2 : list) {
                                String str6 = str2;
                                String format4 = String.format(Locale.US, aVar2.f3569l ? "~~Appname: `%s`~~\n~~Packagename: `%s`~~\n~~Version: `%s (%d)`~~\n" : "Appname: `%s`\nPackagename: `%s`\nVersion: `%s (%d)`\n", Arrays.copyOf(new Object[]{aVar2.h, aVar2.f3566i, aVar2.f3567j, Long.valueOf(aVar2.f3568k)}, 4));
                                qd.c.e("format(locale, format, *args)", format4);
                                sb2.append(format4);
                                sb2.append(str6);
                                str2 = str6;
                            }
                        } else {
                            sb2.append("None\n");
                        }
                        String str7 = str2;
                        sb2.append(str7);
                        Locale locale3 = Locale.US;
                        String format5 = String.format(locale3, "### SD Maid\nVersion: `%s (%d)`\n", Arrays.copyOf(new Object[]{a10.versionName, Integer.valueOf(a10.versionCode)}, 2));
                        qd.c.e("format(locale, format, *args)", format5);
                        sb2.append(format5);
                        sb2.append(str7);
                        String format6 = String.format(locale3, "### Device\nFingerprint: `%s`\n", Arrays.copyOf(new Object[]{Build.FINGERPRINT}, 1));
                        qd.c.e("format(locale, format, *args)", format6);
                        sb2.append(format6);
                        sb2.append(str7);
                        if (!TextUtils.isEmpty(str3)) {
                            String format7 = String.format(locale3, "### Comment\n`%s`\n", Arrays.copyOf(new Object[]{str3}, 1));
                            qd.c.e("format(locale, format, *args)", format7);
                            sb2.append(format7);
                        }
                        Uri build = Uri.parse("https://github.com/d4rken/sdmaid-public/issues/new").buildUpon().appendQueryParameter("title", sb3.toString()).appendQueryParameter("body", sb2.toString()).build();
                        qd.c.e("parse(URL_TARGET)\n      …                 .build()", build);
                        str4 = f4916o0;
                        ne.a.d(str4).g(build.toString(), new Object[0]);
                        p.d d10 = new ta.p(K2()).d(build.toString());
                        d10.f9768f = true;
                        d10.c();
                        y3().finish();
                    }
                }
                d10.f9768f = true;
                d10.c();
                y3().finish();
            } catch (Exception e10) {
                e = e10;
                ta.b.a(str4, e, null, null);
                Toast.makeText(K2(), (int) R.string.error, 0).show();
                return true;
            }
            str = " (FP)";
            sb3.append(str);
            sb2 = new StringBuilder();
            Object[] objArr3 = new Object[7];
            v vVar2 = bVar.f5974k;
            objArr3[0] = vVar2.getPath();
            objArr3[1] = bVar.a();
            c10 = 2;
            objArr3[2] = bVar.h;
            qd.c.e("itemInfo.item", vVar2);
            objArr3[3] = !vVar2.A() ? "DIRECTORY" : vVar2.C() ? "FILE" : vVar2.s() ? "SYMBOLIC LINK" : "UNKNOWN";
            Location location2 = bVar.f5972i;
            i10 = 4;
            objArr3[4] = location2;
            objArr3[5] = Boolean.valueOf(dVar.G());
            objArr3[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(objArr3, 7));
            qd.c.e("format(locale, format, *args)", format22);
            sb2.append(format22);
            sb2.append("\n### Suggested owners\n");
            it = arrayList.iterator();
            while (true) {
                str2 = "\n";
                if (it.hasNext()) {
                }
                db.a aVar3 = (db.a) it.next();
                Locale locale22 = Locale.US;
                Object[] objArr22 = new Object[i10];
                objArr22[0] = aVar3.h;
                objArr22[1] = aVar3.f3566i;
                objArr22[c10] = aVar3.f3567j;
                objArr22[3] = Long.valueOf(aVar3.f3568k);
                String format32 = String.format(locale22, "Appname: `%s`\nPackagename: `%s`\nVersion: `%s (%d)`\n", Arrays.copyOf(objArr22, 4));
                qd.c.e("format(locale, format, *args)", format32);
                sb2.append(format32);
                sb2.append("\n");
                obj = obj;
                c10 = 2;
                i10 = 4;
            }
            str3 = obj;
            sb2.append("### Current owners\n");
            if (list.isEmpty()) {
            }
            String str72 = str2;
            sb2.append(str72);
            Locale locale32 = Locale.US;
            String format52 = String.format(locale32, "### SD Maid\nVersion: `%s (%d)`\n", Arrays.copyOf(new Object[]{a10.versionName, Integer.valueOf(a10.versionCode)}, 2));
            qd.c.e("format(locale, format, *args)", format52);
            sb2.append(format52);
            sb2.append(str72);
            String format62 = String.format(locale32, "### Device\nFingerprint: `%s`\n", Arrays.copyOf(new Object[]{Build.FINGERPRINT}, 1));
            qd.c.e("format(locale, format, *args)", format62);
            sb2.append(format62);
            sb2.append(str72);
            if (!TextUtils.isEmpty(str3)) {
            }
            Uri build2 = Uri.parse("https://github.com/d4rken/sdmaid-public/issues/new").buildUpon().appendQueryParameter("title", sb3.toString()).appendQueryParameter("body", sb2.toString()).build();
            qd.c.e("parse(URL_TARGET)\n      …                 .build()", build2);
            str4 = f4916o0;
            ne.a.d(str4).g(build2.toString(), new Object[0]);
            p.d d102 = new ta.p(K2()).d(build2.toString());
        } else if (menuItem.getItemId() != 16908332) {
            return false;
        } else {
            y3().finish();
        }
        return true;
    }

    @Override
    public final void m3(Bundle bundle) {
        ArrayList arrayList = this.f4919g0;
        if (arrayList == null) {
            qd.c.k("suggestedOwners");
            throw null;
        }
        bundle.putParcelableArrayList("suggestedOwners", new ArrayList<>(arrayList));
        List<db.a> list = this.f4918f0;
        if (list == null) {
            qd.c.k("currentOwners");
            throw null;
        }
        bundle.putParcelableArrayList("currentOwners", new ArrayList<>(list));
        List<db.a> list2 = this.f4920h0;
        if (list2 == null) {
            qd.c.k("installedApps");
            throw null;
        }
        bundle.putParcelableArrayList("installedApps", new ArrayList<>(list2));
        bundle.putBoolean("allowedToSend", this.f4922j0);
    }

    @Override
    public final void p3(View view, Bundle bundle) {
        qd.c.f("view", view);
        SDMRecyclerView sDMRecyclerView = this.currentOwnerList;
        if (sDMRecyclerView == null) {
            qd.c.k("currentOwnerList");
            throw null;
        }
        K2();
        sDMRecyclerView.setLayoutManager(new LinearLayoutManager(1));
        SDMRecyclerView sDMRecyclerView2 = this.currentOwnerList;
        if (sDMRecyclerView2 == null) {
            qd.c.k("currentOwnerList");
            throw null;
        }
        sDMRecyclerView2.setAdapter(P3());
        SDMRecyclerView sDMRecyclerView3 = this.currentOwnerList;
        if (sDMRecyclerView3 == null) {
            qd.c.k("currentOwnerList");
            throw null;
        }
        sDMRecyclerView3.setOnItemClickListener(new db.e(this, 0));
        SDMRecyclerView sDMRecyclerView4 = this.suggestedOwnerList;
        if (sDMRecyclerView4 == null) {
            qd.c.k("suggestedOwnerList");
            throw null;
        }
        K2();
        sDMRecyclerView4.setLayoutManager(new LinearLayoutManager(1));
        SDMRecyclerView sDMRecyclerView5 = this.suggestedOwnerList;
        if (sDMRecyclerView5 == null) {
            qd.c.k("suggestedOwnerList");
            throw null;
        }
        sDMRecyclerView5.setAdapter(Q3());
        SDMRecyclerView sDMRecyclerView6 = this.suggestedOwnerList;
        if (sDMRecyclerView6 == null) {
            qd.c.k("suggestedOwnerList");
            throw null;
        }
        sDMRecyclerView6.setOnItemClickListener(new db.e(this, 1));
        Button button = this.suggestOwnersButton;
        if (button == null) {
            qd.c.k("suggestOwnersButton");
            throw null;
        }
        button.setOnClickListener(new k(25, this));
        EditText editText = this.commentInput;
        if (editText == null) {
            qd.c.k("commentInput");
            throw null;
        }
        editText.addTextChangedListener(new c());
        super.p3(view, bundle);
    }
}