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

应用版本信息
应用名称:Gizmo
版本号:1.7.0
包名称:ai.saveall.app

MD5 校验值:51aae3247d6bd20bca268c4c9a4dd21c

反编译源代码说明

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


package n1;

import ai.saveall.app.R;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.v4.media.session.PlaybackStateCompat;
import android.webkit.MimeTypeMap;
import androidx.core.content.FileProvider;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.collections.AbstractC0827p;
import kotlin.jvm.internal.Intrinsics;

public final class C0902y {

    private final Context f16467a;

    private final String[] f16468b;

    private final boolean f16469c;

    private final HashSet f16470d;

    private final B1.a f16471e;

    private PackageManager f16472f;

    private Uri f16473g;

    public C0902y(Context context, String[] mimeTypeSpecs, boolean z5) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(mimeTypeSpecs, "mimeTypeSpecs");
        this.f16467a = context;
        this.f16468b = mimeTypeSpecs;
        this.f16469c = z5;
        this.f16470d = new HashSet();
        this.f16471e = B1.a.V(context);
        this.f16472f = context.getPackageManager();
        e();
    }

    private final void e() {
        for (String str : this.f16468b) {
            for (String str2 : kotlin.text.g.T(str, new String[]{"[,;\\s]"}, false, 0, 6, null)) {
                if (kotlin.text.g.s(str2, ".", false, 2, null)) {
                    MimeTypeMap singleton = MimeTypeMap.getSingleton();
                    String substring = str2.substring(1);
                    Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
                    str2 = singleton.getMimeTypeFromExtension(substring);
                    if (str2 != null) {
                        this.f16470d.add(str2);
                    }
                } else if (kotlin.text.g.v(str2, "/", false, 2, null)) {
                    this.f16470d.add(str2);
                }
            }
        }
        if (this.f16470d.isEmpty()) {
            this.f16470d.add("*/*");
        }
    }

    private final Intent f() {
        Intent intent = new Intent("android.intent.action.GET_CONTENT");
        intent.setType(AbstractC0827p.F(this.f16470d, ", ", null, null, 0, null, null, 62, null));
        intent.putExtra("android.intent.extra.MIME_TYPES", (String[]) this.f16470d.toArray(new String[0]));
        intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", this.f16469c);
        intent.addCategory("android.intent.category.OPENABLE");
        if (k(intent).isEmpty() && kotlin.text.g.l(Build.MANUFACTURER, "samsung", true)) {
            Intent intent2 = new Intent("com.sec.android.app.myfiles.PICK_DATA");
            intent2.putExtra("CONTENT_TYPE", "*/*");
            intent2.addCategory("android.intent.category.DEFAULT");
            return intent2;
        }
        return intent;
    }

    private final Intent h() {
        if (i()) {
            return new Intent("android.intent.action.PICK", MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        }
        return new Intent("android.intent.action.PICK", MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
    }

    private final boolean i() {
        Context context = this.f16467a;
        Intrinsics.c(context, "null cannot be cast to non-null type android.app.Activity");
        if (!B1.n.b((Activity) context, "android.permission.CAMERA")) {
            return false;
        }
        return b();
    }

    private final boolean j() {
        List k5 = k(new Intent("android.intent.action.PICK", MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
        if (k5.size() == 1 && Intrinsics.a(((ResolveInfo) AbstractC0827p.y(k5)).activityInfo.packageName, "com.google.android.apps.photos")) {
            return true;
        }
        return false;
    }

    private final List k(Intent intent) {
        List<ResolveInfo> queryIntentActivities;
        PackageManager.ResolveInfoFlags of;
        if (Build.VERSION.SDK_INT >= 33) {
            PackageManager packageManager = this.f16472f;
            of = PackageManager.ResolveInfoFlags.of(PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH);
            queryIntentActivities = packageManager.queryIntentActivities(intent, of);
        } else {
            queryIntentActivities = this.f16472f.queryIntentActivities(intent, 65536);
        }
        Intrinsics.b(queryIntentActivities);
        return queryIntentActivities;
    }

    private final boolean l() {
        HashSet<String> hashSet = this.f16470d;
        if ((hashSet instanceof Collection) && hashSet.isEmpty()) {
            return true;
        }
        for (String str : hashSet) {
            if (!kotlin.text.g.s(str, "image/", false, 2, null) && !kotlin.text.g.s(str, "video/", false, 2, null)) {
                return false;
            }
        }
        return true;
    }

    private final ArrayList m() {
        ArrayList arrayList = new ArrayList();
        if (!this.f16471e.f974q) {
            return arrayList;
        }
        File file = new File(this.f16467a.getFilesDir(), "IMG_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date()) + ".jpg");
        Context context = this.f16467a;
        this.f16473g = FileProvider.h(context, context.getApplicationContext().getPackageName() + ".fileprovider", file);
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        for (ResolveInfo resolveInfo : k(intent)) {
            String str = resolveInfo.activityInfo.packageName;
            Intent intent2 = new Intent(intent);
            ActivityInfo activityInfo = resolveInfo.activityInfo;
            intent2.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name));
            intent2.setPackage(str);
            intent2.putExtra("output", this.f16473g);
            arrayList.add(intent2);
        }
        return arrayList;
    }

    private final ArrayList n() {
        ArrayList arrayList = new ArrayList();
        if (!this.f16471e.f974q) {
            return arrayList;
        }
        Intent intent = new Intent("android.media.action.VIDEO_CAPTURE");
        for (ResolveInfo resolveInfo : k(intent)) {
            String str = resolveInfo.activityInfo.packageName;
            Intent intent2 = new Intent(intent);
            ActivityInfo activityInfo = resolveInfo.activityInfo;
            intent2.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name));
            intent2.setPackage(str);
            arrayList.add(intent2);
        }
        return arrayList;
    }

    private final boolean o() {
        Context context = this.f16467a;
        Intrinsics.c(context, "null cannot be cast to non-null type android.app.Activity");
        if (!B1.n.b((Activity) context, "android.permission.CAMERA")) {
            return false;
        }
        return c();
    }

    public final Intent a() {
        ArrayList n5;
        if (i()) {
            n5 = m();
        } else {
            n5 = n();
        }
        return (Intent) AbstractC0827p.y(n5);
    }

    public final boolean b() {
        if (!this.f16470d.contains("*/*")) {
            HashSet hashSet = this.f16470d;
            if ((hashSet instanceof Collection) && hashSet.isEmpty()) {
                return false;
            }
            Iterator it = hashSet.iterator();
            while (it.hasNext()) {
                if (kotlin.text.g.v((String) it.next(), "image/", false, 2, null)) {
                }
            }
            return false;
        }
        return true;
    }

    public final boolean c() {
        if (!this.f16470d.contains("*/*")) {
            HashSet hashSet = this.f16470d;
            if ((hashSet instanceof Collection) && hashSet.isEmpty()) {
                return false;
            }
            Iterator it = hashSet.iterator();
            while (it.hasNext()) {
                if (kotlin.text.g.v((String) it.next(), "video/", false, 2, null)) {
                }
            }
            return false;
        }
        return true;
    }

    public final Intent d() {
        Intent f5;
        ArrayList arrayList = new ArrayList();
        if (i()) {
            arrayList.addAll(m());
        }
        if (o()) {
            arrayList.addAll(n());
        }
        if (i() ^ o()) {
            f5 = h();
        } else if (l() && !j()) {
            f5 = new Intent("android.intent.action.PICK", MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            f5.setType("image/*, video/*");
            f5.putExtra("android.intent.extra.MIME_TYPES", new String[]{"image/*", "video/*"});
        } else {
            f5 = f();
            Intent createChooser = Intent.createChooser(f5, this.f16467a.getString(R.string.choose_action));
            createChooser.putExtra("android.intent.extra.INITIAL_INTENTS", (Parcelable[]) arrayList.toArray(new Parcelable[0]));
            Intrinsics.b(createChooser);
            return createChooser;
        }
        f5.putExtra("android.intent.extra.ALLOW_MULTIPLE", this.f16469c);
        Intent createChooser2 = Intent.createChooser(f5, this.f16467a.getString(R.string.choose_action));
        createChooser2.putExtra("android.intent.extra.INITIAL_INTENTS", (Parcelable[]) arrayList.toArray(new Parcelable[0]));
        Intrinsics.b(createChooser2);
        return createChooser2;
    }

    public final Uri g() {
        return this.f16473g;
    }
}