APKPure.apk分析 / a.java


package i.i;

import android.app.Activity;
import android.app.AppOpsManager;
import android.content.ClipData;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.InsetDrawable;
import android.icu.text.DecimalFormatSymbols;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.StrictMode;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.TypedValue;
import android.util.Xml;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.EdgeEffect;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.apkpure.aegon.R;
import com.tencent.shadow.raft.dynamic.host.MessageFormatter;
import com.yalantis.ucrop.view.CropImageView;
import i.i.d.c;
import i.i.d.f.e;
import i.i.d.f.f;
import i.i.d.f.h;
import i.i.e.l.d;
import i.i.i.b;
import i.i.k.a0;
import i.i.k.c0;
import i.i.l.g;
import i.i.l.j;
import i.i.l.k;
import i.i.l.n;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public final class a {

    /* renamed from: a  reason: collision with root package name */
    public static Method f14911a;
    public static boolean b;
    public static Method c;
    public static boolean d;

    /* renamed from: e  reason: collision with root package name */
    public static Field f14912e;

    /* renamed from: f  reason: collision with root package name */
    public static boolean f14913f;

    /* renamed from: g  reason: collision with root package name */
    public static Field f14914g;

    /* renamed from: h  reason: collision with root package name */
    public static boolean f14915h;

    /* renamed from: i  reason: collision with root package name */
    public static Method f14916i;

    /* renamed from: j  reason: collision with root package name */
    public static boolean f14917j;

    /* renamed from: k  reason: collision with root package name */
    public static Field f14918k;

    /* renamed from: l  reason: collision with root package name */
    public static boolean f14919l;

    public static String A(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i2) {
        if (!G(xmlPullParser, str)) {
            return null;
        }
        return typedArray.getString(i2);
    }

    public static Intent B(Activity activity) {
        Intent parentActivityIntent = activity.getParentActivityIntent();
        if (parentActivityIntent != null) {
            return parentActivityIntent;
        }
        try {
            String D = D(activity, activity.getComponentName());
            if (D == null) {
                return null;
            }
            ComponentName componentName = new ComponentName(activity, D);
            try {
                return D(activity, componentName) == null ? Intent.makeMainActivity(componentName) : new Intent().setComponent(componentName);
            } catch (PackageManager.NameNotFoundException unused) {
                return null;
            }
        } catch (PackageManager.NameNotFoundException e2) {
            throw new IllegalArgumentException(e2);
        }
    }

    public static Intent C(Context context, ComponentName componentName) throws PackageManager.NameNotFoundException {
        String D = D(context, componentName);
        if (D == null) {
            return null;
        }
        ComponentName componentName2 = new ComponentName(componentName.getPackageName(), D);
        return D(context, componentName2) == null ? Intent.makeMainActivity(componentName2) : new Intent().setComponent(componentName2);
    }

    public static String D(Context context, ComponentName componentName) throws PackageManager.NameNotFoundException {
        String string;
        PackageManager packageManager = context.getPackageManager();
        int i2 = Build.VERSION.SDK_INT;
        int i3 = 640;
        if (i2 >= 29) {
            i3 = 269222528;
        } else if (i2 >= 24) {
            i3 = 787072;
        }
        ActivityInfo activityInfo = packageManager.getActivityInfo(componentName, i3);
        String str = activityInfo.parentActivityName;
        if (str != null) {
            return str;
        }
        Bundle bundle = activityInfo.metaData;
        if (bundle == null || (string = bundle.getString("android.support.PARENT_ACTIVITY")) == null) {
            return null;
        }
        if (string.charAt(0) != '.') {
            return string;
        }
        return context.getPackageName() + string;
    }

    public static File E(Context context) {
        File cacheDir = context.getCacheDir();
        if (cacheDir == null) {
            return null;
        }
        StringBuilder Z = e.d.a.a.a.Z(".font");
        Z.append(Process.myPid());
        Z.append("-");
        Z.append(Process.myTid());
        Z.append("-");
        String sb = Z.toString();
        for (int i2 = 0; i2 < 100; i2++) {
            File file = new File(cacheDir, e.d.a.a.a.v(sb, i2));
            try {
                if (file.createNewFile()) {
                    return file;
                }
            } catch (IOException unused) {
            }
        }
        return null;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:20:0x005f, code lost:
        if (r9 != 2) goto L_0x0038;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0070, code lost:
        if (r3 != false) goto L_0x0072;
     */
    public static b.a F(TextView textView) {
        int i2;
        int i3;
        TextDirectionHeuristic textDirectionHeuristic;
        int i4 = Build.VERSION.SDK_INT;
        if (i4 >= 28) {
            return new b.a(textView.getTextMetricsParams());
        }
        TextPaint textPaint = new TextPaint(textView.getPaint());
        boolean z = false;
        if (i4 >= 23) {
            i3 = 1;
            i2 = 1;
        } else {
            i3 = 0;
            i2 = 0;
        }
        TextDirectionHeuristic textDirectionHeuristic2 = TextDirectionHeuristics.FIRSTSTRONG_LTR;
        if (i4 >= 23) {
            i3 = textView.getBreakStrategy();
            i2 = textView.getHyphenationFrequency();
        }
        if (!(textView.getTransformationMethod() instanceof PasswordTransformationMethod)) {
            if (i4 < 28 || (textView.getInputType() & 15) != 3) {
                if (textView.getLayoutDirection() == 1) {
                    z = true;
                }
                switch (textView.getTextDirection()) {
                    case 2:
                        textDirectionHeuristic = TextDirectionHeuristics.ANYRTL_LTR;
                        break;
                    case 5:
                        textDirectionHeuristic = TextDirectionHeuristics.LOCALE;
                        break;
                    case 6:
                        textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_LTR;
                        break;
                    case 7:
                        textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_RTL;
                        break;
                }
                return new b.a(textPaint, textDirectionHeuristic, i3, i2);
            }
            byte directionality = Character.getDirectionality(DecimalFormatSymbols.getInstance(textView.getTextLocale()).getDigitStrings()[0].codePointAt(0));
            if (directionality != 1) {
            }
            textDirectionHeuristic = TextDirectionHeuristics.RTL;
            return new b.a(textPaint, textDirectionHeuristic, i3, i2);
        }
        textDirectionHeuristic = TextDirectionHeuristics.LTR;
        return new b.a(textPaint, textDirectionHeuristic, i3, i2);
    }

    public static boolean G(XmlPullParser xmlPullParser, String str) {
        return xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", str) != null;
    }

    public static boolean H(Rect rect, Rect rect2, int i2) {
        if (i2 == 17) {
            int i3 = rect.right;
            int i4 = rect2.right;
            return (i3 > i4 || rect.left >= i4) && rect.left > rect2.left;
        } else if (i2 == 33) {
            int i5 = rect.bottom;
            int i6 = rect2.bottom;
            return (i5 > i6 || rect.top >= i6) && rect.top > rect2.top;
        } else if (i2 == 66) {
            int i7 = rect.left;
            int i8 = rect2.left;
            return (i7 < i8 || rect.right <= i8) && rect.right < rect2.right;
        } else if (i2 == 130) {
            int i9 = rect.top;
            int i10 = rect2.top;
            return (i9 < i10 || rect.bottom <= i10) && rect.bottom < rect2.bottom;
        } else {
            throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
        }
    }

    public static boolean I(ViewGroup viewGroup) {
        if (Build.VERSION.SDK_INT >= 21) {
            return viewGroup.isTransitionGroup();
        }
        Boolean bool = (Boolean) viewGroup.getTag(R.id.arg_RES_2131298605);
        return ((bool == null || !bool.booleanValue()) && viewGroup.getBackground() == null && a0.p(viewGroup) == null) ? false : true;
    }

    public static int J(int i2, Rect rect, Rect rect2) {
        int i3;
        int i4;
        if (i2 == 17) {
            i4 = rect.left;
            i3 = rect2.right;
        } else if (i2 == 33) {
            i4 = rect.top;
            i3 = rect2.bottom;
        } else if (i2 == 66) {
            i4 = rect2.left;
            i3 = rect.right;
        } else if (i2 == 130) {
            i4 = rect2.top;
            i3 = rect.bottom;
        } else {
            throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
        }
        return Math.max(0, i4 - i3);
    }

    public static void K(Intent intent, ArrayList<Uri> arrayList) {
        CharSequence charSequenceExtra = intent.getCharSequenceExtra("android.intent.extra.TEXT");
        String stringExtra = intent.getStringExtra("android.intent.extra.HTML_TEXT");
        ClipData clipData = new ClipData(null, new String[]{intent.getType()}, new ClipData.Item(charSequenceExtra, stringExtra, null, arrayList.get(0)));
        int size = arrayList.size();
        for (int i2 = 1; i2 < size; i2++) {
            clipData.addItem(new ClipData.Item(arrayList.get(i2)));
        }
        intent.setClipData(clipData);
        intent.addFlags(1);
    }

    public static int L(int i2, Rect rect, Rect rect2) {
        int i3;
        int i4;
        int i5;
        if (i2 != 17) {
            if (i2 != 33) {
                if (i2 != 66) {
                    if (i2 != 130) {
                        throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
                    }
                }
            }
            i4 = (rect.width() / 2) + rect.left;
            i5 = rect2.left;
            i3 = rect2.width();
            return Math.abs(i4 - ((i3 / 2) + i5));
        }
        i4 = (rect.height() / 2) + rect.top;
        i5 = rect2.top;
        i3 = rect2.height();
        return Math.abs(i4 - ((i3 / 2) + i5));
    }

    public static ByteBuffer M(Context context, CancellationSignal cancellationSignal, Uri uri) {
        try {
            ParcelFileDescriptor openFileDescriptor = context.getContentResolver().openFileDescriptor(uri, "r", cancellationSignal);
            if (openFileDescriptor == null) {
                if (openFileDescriptor != null) {
                    openFileDescriptor.close();
                }
                return null;
            }
            try {
                FileInputStream fileInputStream = new FileInputStream(openFileDescriptor.getFileDescriptor());
                try {
                    FileChannel channel = fileInputStream.getChannel();
                    MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
                    fileInputStream.close();
                    openFileDescriptor.close();
                    return map;
                } catch (Throwable th) {
                    th.addSuppressed(th);
                }
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
            throw th;
        } catch (IOException unused) {
            return null;
        }
    }

    public static int N(Context context, String str, String str2) {
        if (Build.VERSION.SDK_INT >= 23) {
            return ((AppOpsManager) context.getSystemService(AppOpsManager.class)).noteProxyOpNoThrow(str, str2);
        }
        return 1;
    }

    public static TypedArray O(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) {
        return theme == null ? resources.obtainAttributes(attributeSet, iArr) : theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
    }

    public static void P(EdgeEffect edgeEffect, float f2, float f3) {
        if (Build.VERSION.SDK_INT >= 21) {
            edgeEffect.onPull(f2, f3);
        } else {
            edgeEffect.onPull(f2);
        }
    }

    public static float Q(EdgeEffect edgeEffect, float f2, float f3) {
        if (c.F()) {
            return g.c(edgeEffect, f2, f3);
        }
        if (Build.VERSION.SDK_INT >= 21) {
            edgeEffect.onPull(f2, f3);
        } else {
            edgeEffect.onPull(f2);
        }
        return f2;
    }

    public static e R(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
        int next;
        do {
            next = xmlPullParser.next();
            if (next == 2) {
                break;
            }
        } while (next != 1);
        if (next == 2) {
            xmlPullParser.require(2, null, "font-family");
            if (xmlPullParser.getName().equals("font-family")) {
                TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), b.b);
                String string = obtainAttributes.getString(0);
                String string2 = obtainAttributes.getString(4);
                String string3 = obtainAttributes.getString(5);
                int resourceId = obtainAttributes.getResourceId(1, 0);
                int integer = obtainAttributes.getInteger(2, 1);
                int integer2 = obtainAttributes.getInteger(3, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION);
                String string4 = obtainAttributes.getString(6);
                obtainAttributes.recycle();
                if (string == null || string2 == null || string3 == null) {
                    ArrayList arrayList = new ArrayList();
                    while (xmlPullParser.next() != 3) {
                        if (xmlPullParser.getEventType() == 2) {
                            if (xmlPullParser.getName().equals("font")) {
                                TypedArray obtainAttributes2 = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), b.c);
                                int i2 = 8;
                                if (!obtainAttributes2.hasValue(8)) {
                                    i2 = 1;
                                }
                                int i3 = obtainAttributes2.getInt(i2, 400);
                                boolean z = 1 == obtainAttributes2.getInt(obtainAttributes2.hasValue(6) ? 6 : 2, 0);
                                int i4 = 9;
                                if (!obtainAttributes2.hasValue(9)) {
                                    i4 = 3;
                                }
                                int i5 = 7;
                                if (!obtainAttributes2.hasValue(7)) {
                                    i5 = 4;
                                }
                                String string5 = obtainAttributes2.getString(i5);
                                int i6 = obtainAttributes2.getInt(i4, 0);
                                int i7 = obtainAttributes2.hasValue(5) ? 5 : 0;
                                int resourceId2 = obtainAttributes2.getResourceId(i7, 0);
                                String string6 = obtainAttributes2.getString(i7);
                                obtainAttributes2.recycle();
                                while (xmlPullParser.next() != 3) {
                                    l0(xmlPullParser);
                                }
                                arrayList.add(new i.i.d.f.g(string6, i3, z, string5, i6, resourceId2));
                            } else {
                                l0(xmlPullParser);
                            }
                        }
                    }
                    if (!arrayList.isEmpty()) {
                        return new f((i.i.d.f.g[]) arrayList.toArray(new i.i.d.f.g[arrayList.size()]));
                    }
                } else {
                    while (xmlPullParser.next() != 3) {
                        l0(xmlPullParser);
                    }
                    return new h(new i.i.h.e(string, string2, string3, U(resources, resourceId)), integer, integer2, string4);
                }
            } else {
                l0(xmlPullParser);
            }
            return null;
        }
        throw new XmlPullParserException("No start tag found");
    }

    public static long S(Context context, Uri uri, String str, long j2) {
        AutoCloseable autoCloseable = null;
        try {
            autoCloseable = context.getContentResolver().query(uri, new String[]{str}, null, null, null);
            if (autoCloseable.moveToFirst() && !autoCloseable.isNull(0)) {
                return autoCloseable.getLong(0);
            }
            l(autoCloseable);
            return j2;
        } catch (Exception e2) {
            String str2 = "Failed query: " + e2;
            return j2;
        } finally {
            l(autoCloseable);
        }
    }

    public static String T(Context context, Uri uri, String str, String str2) {
        Cursor cursor;
        Throwable th;
        Exception e2;
        try {
            cursor = context.getContentResolver().query(uri, new String[]{str}, null, null, null);
            try {
                if (!cursor.moveToFirst() || cursor.isNull(0)) {
                    l(cursor);
                    return null;
                }
                String string = cursor.getString(0);
                l(cursor);
                return string;
            } catch (Exception e3) {
                e2 = e3;
                try {
                    String str3 = "Failed query: " + e2;
                    l(cursor);
                    return null;
                } catch (Throwable th2) {
                    th = th2;
                    l(cursor);
                    throw th;
                }
            }
        } catch (Exception e4) {
            e2 = e4;
            cursor = null;
            String str32 = "Failed query: " + e2;
            l(cursor);
            return null;
        } catch (Throwable th3) {
            cursor = null;
            th = th3;
            l(cursor);
            throw th;
        }
    }

    public static List<List<byte[]>> U(Resources resources, int i2) {
        int i3;
        if (i2 == 0) {
            return Collections.emptyList();
        }
        TypedArray obtainTypedArray = resources.obtainTypedArray(i2);
        try {
            if (obtainTypedArray.length() == 0) {
                return Collections.emptyList();
            }
            ArrayList arrayList = new ArrayList();
            if (Build.VERSION.SDK_INT >= 21) {
                i3 = obtainTypedArray.getType(0);
            } else {
                TypedValue typedValue = new TypedValue();
                obtainTypedArray.getValue(0, typedValue);
                i3 = typedValue.type;
            }
            if (i3 == 1) {
                for (int i4 = 0; i4 < obtainTypedArray.length(); i4++) {
                    int resourceId = obtainTypedArray.getResourceId(i4, 0);
                    if (resourceId != 0) {
                        arrayList.add(n0(resources.getStringArray(resourceId)));
                    }
                }
            } else {
                arrayList.add(n0(resources.getStringArray(i2)));
            }
            obtainTypedArray.recycle();
            return arrayList;
        } finally {
            obtainTypedArray.recycle();
        }
    }

    public static void V(CompoundButton compoundButton, ColorStateList colorStateList) {
        if (Build.VERSION.SDK_INT >= 21) {
            compoundButton.setButtonTintList(colorStateList);
        } else if (compoundButton instanceof n) {
            ((n) compoundButton).setSupportButtonTintList(colorStateList);
        }
    }

    public static void W(TextView textView, int i2, int i3, int i4, int i5) {
        textView.setCompoundDrawablesRelativeWithIntrinsicBounds(i2, i3, i4, i5);
    }

    public static void X(LayoutInflater layoutInflater, LayoutInflater.Factory2 factory2) {
        layoutInflater.setFactory2(factory2);
        if (Build.VERSION.SDK_INT < 21) {
            LayoutInflater.Factory factory = layoutInflater.getFactory();
            if (factory instanceof LayoutInflater.Factory2) {
                t(layoutInflater, (LayoutInflater.Factory2) factory);
            } else {
                t(layoutInflater, factory2);
            }
        }
    }

    public static void Y(TextView textView, int i2) {
        h(i2);
        if (Build.VERSION.SDK_INT >= 28) {
            textView.setFirstBaselineToTopHeight(i2);
            return;
        }
        Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
        int i3 = textView.getIncludeFontPadding() ? fontMetricsInt.top : fontMetricsInt.ascent;
        if (i2 > Math.abs(i3)) {
            textView.setPadding(textView.getPaddingLeft(), i2 + i3, textView.getPaddingRight(), textView.getPaddingBottom());
        }
    }

    public static void Z(Drawable drawable, float f2, float f3) {
        if (Build.VERSION.SDK_INT >= 21) {
            drawable.setHotspot(f2, f3);
        }
    }

    public static void a(Drawable drawable, Resources.Theme theme) {
        if (Build.VERSION.SDK_INT >= 21) {
            drawable.applyTheme(theme);
        }
    }

    public static void a0(Drawable drawable, int i2, int i3, int i4, int i5) {
        if (Build.VERSION.SDK_INT >= 21) {
            drawable.setHotspotBounds(i2, i3, i4, i5);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:13:0x0033, code lost:
        if (r10.right <= r12.left) goto L_0x0043;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:15:0x003a, code lost:
        if (r10.top >= r12.bottom) goto L_0x0043;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:17:0x0041, code lost:
        if (r10.left >= r12.right) goto L_0x0043;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:19:0x0045, code lost:
        r7 = false;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0026, code lost:
        if (r10.bottom <= r12.top) goto L_0x0043;
     */
    public static boolean b(int i2, Rect rect, Rect rect2, Rect rect3) {
        int i3;
        int i4;
        boolean c2 = c(i2, rect, rect2);
        if (c(i2, rect, rect3) || !c2) {
            return false;
        }
        if (i2 != 17) {
            if (i2 != 33) {
                if (i2 != 66) {
                    if (i2 != 130) {
                        throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
                    }
                }
            }
        }
        boolean z = true;
        if (!z || i2 == 17 || i2 == 66) {
            return true;
        }
        int J = J(i2, rect, rect2);
        if (i2 == 17) {
            i4 = rect.left;
            i3 = rect3.left;
        } else if (i2 == 33) {
            i4 = rect.top;
            i3 = rect3.top;
        } else if (i2 == 66) {
            i4 = rect3.right;
            i3 = rect.right;
        } else if (i2 == 130) {
            i4 = rect3.bottom;
            i3 = rect.bottom;
        } else {
            throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
        }
        if (J < Math.max(1, i4 - i3)) {
            return true;
        }
        return false;
    }

    public static void b0(TextView textView, int i2) {
        h(i2);
        Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
        int i3 = textView.getIncludeFontPadding() ? fontMetricsInt.bottom : fontMetricsInt.descent;
        if (i2 > Math.abs(i3)) {
            textView.setPadding(textView.getPaddingLeft(), textView.getPaddingTop(), textView.getPaddingRight(), i2 - i3);
        }
    }

    public static boolean c(int i2, Rect rect, Rect rect2) {
        if (i2 != 17) {
            if (i2 != 33) {
                if (i2 != 66) {
                    if (i2 != 130) {
                        throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
                    }
                }
            }
            return rect2.right >= rect.left && rect2.left <= rect.right;
        }
        return rect2.bottom >= rect.top && rect2.top <= rect.bottom;
    }

    public static boolean c0(Drawable drawable, int i2) {
        if (Build.VERSION.SDK_INT >= 23) {
            return drawable.setLayoutDirection(i2);
        }
        if (!b) {
            try {
                Method declaredMethod = Drawable.class.getDeclaredMethod("setLayoutDirection", Integer.TYPE);
                f14911a = declaredMethod;
                declaredMethod.setAccessible(true);
            } catch (NoSuchMethodException unused) {
            }
            b = true;
        }
        Method method = f14911a;
        if (method != null) {
            try {
                method.invoke(drawable, Integer.valueOf(i2));
                return true;
            } catch (Exception unused2) {
                f14911a = null;
            }
        }
        return false;
    }

    public static void d(Object obj, StringBuilder sb) {
        String str;
        int lastIndexOf;
        if (obj == null) {
            str = "null";
        } else {
            String simpleName = obj.getClass().getSimpleName();
            if (simpleName.length() <= 0 && (lastIndexOf = (simpleName = obj.getClass().getName()).lastIndexOf(46)) > 0) {
                simpleName = simpleName.substring(lastIndexOf + 1);
            }
            sb.append(simpleName);
            sb.append(MessageFormatter.DELIM_START);
            str = Integer.toHexString(System.identityHashCode(obj));
        }
        sb.append(str);
    }

    public static void d0(TextView textView, int i2) {
        h(i2);
        int fontMetricsInt = textView.getPaint().getFontMetricsInt(null);
        if (i2 != fontMetricsInt) {
            textView.setLineSpacing((float) (i2 - fontMetricsInt), 1.0f);
        }
    }

    public static boolean e(Drawable drawable) {
        if (Build.VERSION.SDK_INT >= 21) {
            return drawable.canApplyTheme();
        }
        return false;
    }

    public static void e0(PopupWindow popupWindow, boolean z) {
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 23) {
            j.c(popupWindow, z);
        } else if (i2 >= 21) {
            if (!f14919l) {
                try {
                    Field declaredField = PopupWindow.class.getDeclaredField("mOverlapAnchor");
                    f14918k = declaredField;
                    declaredField.setAccessible(true);
                } catch (NoSuchFieldException unused) {
                }
                f14919l = true;
            }
            Field field = f14918k;
            if (field != null) {
                try {
                    field.set(popupWindow, Boolean.valueOf(z));
                } catch (IllegalAccessException unused2) {
                }
            }
        }
    }

    public static boolean f(i.i.e.c[] cVarArr, i.i.e.c[] cVarArr2) {
        if (cVarArr == null || cVarArr2 == null || cVarArr.length != cVarArr2.length) {
            return false;
        }
        for (int i2 = 0; i2 < cVarArr.length; i2++) {
            if (!(cVarArr[i2].f15018a == cVarArr2[i2].f15018a && cVarArr[i2].b.length == cVarArr2[i2].b.length)) {
                return false;
            }
        }
        return true;
    }

    public static void f0(TextView textView, b bVar) {
        if (Build.VERSION.SDK_INT >= 29) {
            Objects.requireNonNull(bVar);
            textView.setText((CharSequence) null);
            return;
        }
        b.a F = F(textView);
        Objects.requireNonNull(bVar);
        if (F.a(null)) {
            textView.setText(bVar);
            return;
        }
        throw new IllegalArgumentException("Given text can not be applied to TextView.");
    }

    public static boolean g(Context context, Uri uri) {
        if (context.checkCallingOrSelfUriPermission(uri, 2) != 0) {
            return false;
        }
        String T = T(context, uri, "mime_type", null);
        int S = (int) S(context, uri, "flags", (long) 0);
        if (TextUtils.isEmpty(T)) {
            return false;
        }
        if ((S & 4) != 0) {
            return true;
        }
        if ("vnd.android.document/directory".equals(T) && (S & 8) != 0) {
            return true;
        }
        if (TextUtils.isEmpty(T) || (S & 2) == 0) {
            return false;
        }
        return true;
    }

    public static void g0(TextView textView, int i2) {
        if (Build.VERSION.SDK_INT >= 23) {
            textView.setTextAppearance(i2);
        } else {
            textView.setTextAppearance(textView.getContext(), i2);
        }
    }

    public static int h(int i2) {
        if (i2 >= 0) {
            return i2;
        }
        throw new IllegalArgumentException();
    }

    public static void h0(Drawable drawable, int i2) {
        if (Build.VERSION.SDK_INT >= 21) {
            drawable.setTint(i2);
        } else if (drawable instanceof d) {
            ((d) drawable).setTint(i2);
        }
    }

    public static <T> T i(T t2, Object obj) {
        if (t2 != null) {
            return t2;
        }
        throw new NullPointerException(String.valueOf(obj));
    }

    public static void i0(Drawable drawable, ColorStateList colorStateList) {
        if (Build.VERSION.SDK_INT >= 21) {
            drawable.setTintList(colorStateList);
        } else if (drawable instanceof d) {
            ((d) drawable).setTintList(colorStateList);
        }
    }

    public static int j(int i2, int i3, int i4) {
        return i2 < i3 ? i3 : i2 > i4 ? i4 : i2;
    }

    public static void j0(Drawable drawable, PorterDuff.Mode mode) {
        if (Build.VERSION.SDK_INT >= 21) {
            drawable.setTintMode(mode);
        } else if (drawable instanceof d) {
            ((d) drawable).setTintMode(mode);
        }
    }

    public static void k(Drawable drawable) {
        DrawableContainer.DrawableContainerState drawableContainerState;
        Drawable b2;
        int i2 = Build.VERSION.SDK_INT;
        if (i2 < 23 && i2 >= 21) {
            drawable.clearColorFilter();
            if (drawable instanceof InsetDrawable) {
                b2 = ((InsetDrawable) drawable).getDrawable();
            } else if (drawable instanceof i.i.e.l.e) {
                b2 = ((i.i.e.l.e) drawable).b();
            } else if ((drawable instanceof DrawableContainer) && (drawableContainerState = (DrawableContainer.DrawableContainerState) ((DrawableContainer) drawable).getConstantState()) != null) {
                int childCount = drawableContainerState.getChildCount();
                for (int i3 = 0; i3 < childCount; i3++) {
                    Drawable child = drawableContainerState.getChild(i3);
                    if (child != null) {
                        k(child);
                    }
                }
                return;
            } else {
                return;
            }
            k(b2);
            return;
        }
        drawable.clearColorFilter();
    }

    public static void k0(PopupWindow popupWindow, int i2) {
        if (Build.VERSION.SDK_INT >= 23) {
            j.d(popupWindow, i2);
            return;
        }
        if (!f14917j) {
            try {
                Method declaredMethod = PopupWindow.class.getDeclaredMethod("setWindowLayoutType", Integer.TYPE);
                f14916i = declaredMethod;
                declaredMethod.setAccessible(true);
            } catch (Exception unused) {
            }
            f14917j = true;
        }
        Method method = f14916i;
        if (method != null) {
            try {
                method.invoke(popupWindow, Integer.valueOf(i2));
            } catch (Exception unused2) {
            }
        }
    }

    public static void l(AutoCloseable autoCloseable) {
        if (autoCloseable != null) {
            try {
                autoCloseable.close();
            } catch (RuntimeException e2) {
                throw e2;
            } catch (Exception unused) {
            }
        }
    }

    public static void l0(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        int i2 = 1;
        while (i2 > 0) {
            int next = xmlPullParser.next();
            if (next == 2) {
                i2++;
            } else if (next == 3) {
                i2--;
            }
        }
    }

    public static float[] m(float[] fArr, int i2, int i3) {
        if (i2 <= i3) {
            int length = fArr.length;
            if (i2 < 0 || i2 > length) {
                throw new ArrayIndexOutOfBoundsException();
            }
            int i4 = i3 - i2;
            int min = Math.min(i4, length - i2);
            float[] fArr2 = new float[i4];
            System.arraycopy(fArr, i2, fArr2, 0, min);
            return fArr2;
        }
        throw new IllegalArgumentException();
    }

    public static Bitmap m0(Drawable drawable, int i2, int i3, Bitmap.Config config, int i4) {
        if ((i4 & 1) != 0) {
            i2 = drawable.getIntrinsicWidth();
        }
        if ((i4 & 2) != 0) {
            i3 = drawable.getIntrinsicHeight();
        }
        int i5 = i4 & 4;
        o.s.c.j.e(drawable, "$this$toBitmap");
        if (drawable instanceof BitmapDrawable) {
            BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
            if (i2 == bitmapDrawable.getIntrinsicWidth() && i3 == bitmapDrawable.getIntrinsicHeight()) {
                Bitmap bitmap = bitmapDrawable.getBitmap();
                o.s.c.j.d(bitmap, "bitmap");
                return bitmap;
            }
            Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), i2, i3, true);
            o.s.c.j.d(createScaledBitmap, "Bitmap.createScaledBitma…map, width, height, true)");
            return createScaledBitmap;
        }
        Rect bounds = drawable.getBounds();
        int i6 = bounds.left;
        int i7 = bounds.top;
        int i8 = bounds.right;
        int i9 = bounds.bottom;
        Bitmap createBitmap = Bitmap.createBitmap(i2, i3, Bitmap.Config.ARGB_8888);
        drawable.setBounds(0, 0, i2, i3);
        drawable.draw(new Canvas(createBitmap));
        drawable.setBounds(i6, i7, i8, i9);
        o.s.c.j.d(createBitmap, "bitmap");
        return createBitmap;
    }

    /* JADX WARNING: Removed duplicated region for block: B:13:0x0014 A[SYNTHETIC, Splitter:B:13:0x0014] */
    public static boolean n(File file, Resources resources, int i2) {
        InputStream inputStream;
        Throwable th;
        try {
            inputStream = resources.openRawResource(i2);
            try {
                boolean o2 = o(file, inputStream);
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException unused) {
                    }
                }
                return o2;
            } catch (Throwable th2) {
                th = th2;
                if (inputStream != null) {
                }
                throw th;
            }
        } catch (Throwable th3) {
            th = th3;
            inputStream = null;
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException unused2) {
                }
            }
            throw th;
        }
    }

    public static List<byte[]> n0(String[] strArr) {
        ArrayList arrayList = new ArrayList();
        for (String str : strArr) {
            arrayList.add(Base64.decode(str, 0));
        }
        return arrayList;
    }

    /* JADX WARNING: Removed duplicated region for block: B:24:0x0030 A[SYNTHETIC, Splitter:B:24:0x0030] */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x0039 A[SYNTHETIC, Splitter:B:30:0x0039] */
    public static boolean o(File file, InputStream inputStream) {
        Throwable th;
        IOException e2;
        StrictMode.ThreadPolicy allowThreadDiskWrites = StrictMode.allowThreadDiskWrites();
        FileOutputStream fileOutputStream = null;
        try {
            FileOutputStream fileOutputStream2 = new FileOutputStream(file, false);
            try {
                byte[] bArr = new byte[RecyclerView.a0.FLAG_ADAPTER_FULLUPDATE];
                while (true) {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    fileOutputStream2.write(bArr, 0, read);
                }
                try {
                    fileOutputStream2.close();
                } catch (IOException unused) {
                }
                StrictMode.setThreadPolicy(allowThreadDiskWrites);
                return true;
            } catch (IOException e3) {
                e2 = e3;
                fileOutputStream = fileOutputStream2;
                try {
                    e2.getMessage();
                    if (fileOutputStream != null) {
                    }
                    StrictMode.setThreadPolicy(allowThreadDiskWrites);
                    return false;
                } catch (Throwable th2) {
                    th = th2;
                    if (fileOutputStream != null) {
                        try {
                            fileOutputStream.close();
                        } catch (IOException unused2) {
                        }
                    }
                    StrictMode.setThreadPolicy(allowThreadDiskWrites);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                fileOutputStream = fileOutputStream2;
                if (fileOutputStream != null) {
                }
                StrictMode.setThreadPolicy(allowThreadDiskWrites);
                throw th;
            }
        } catch (IOException e4) {
            e2 = e4;
            e2.getMessage();
            if (fileOutputStream != null) {
                try {
                    fileOutputStream.close();
                } catch (IOException unused3) {
                }
            }
            StrictMode.setThreadPolicy(allowThreadDiskWrites);
            return false;
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: android.graphics.drawable.Drawable */
    /* JADX WARN: Multi-variable type inference failed */
    public static <T extends Drawable> T o0(Drawable drawable) {
        return drawable instanceof i.i.e.l.e ? (T) ((i.i.e.l.e) drawable).b() : drawable;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:37:0x008b, code lost:
        if (r13 == false) goto L_0x008d;
     */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x0048  */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x0098 A[Catch:{ NumberFormatException -> 0x00ba }, LOOP:3: B:25:0x006d->B:45:0x0098, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:69:0x00d7 A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:79:0x0097 A[SYNTHETIC] */
    public static i.i.e.c[] p(String str) {
        String trim;
        float[] fArr;
        if (str == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        int i2 = 0;
        int i3 = 1;
        int i4 = 0;
        while (i3 < str.length()) {
            while (i3 < str.length()) {
                char charAt = str.charAt(i3);
                if ((charAt - 'Z') * (charAt - 'A') > 0) {
                    if ((charAt - 'z') * (charAt - 'a') > 0) {
                        continue;
                        i3++;
                    }
                }
                if (!(charAt == 'e' || charAt == 'E')) {
                    trim = str.substring(i4, i3).trim();
                    if (trim.length() > 0) {
                        if (trim.charAt(i2) == 'z' || trim.charAt(i2) == 'Z') {
                            fArr = new float[i2];
                        } else {
                            try {
                                float[] fArr2 = new float[trim.length()];
                                int length = trim.length();
                                int i5 = 1;
                                int i6 = 0;
                                while (i5 < length) {
                                    boolean z = false;
                                    boolean z2 = false;
                                    boolean z3 = false;
                                    boolean z4 = false;
                                    int i7 = i5;
                                    while (true) {
                                        if (i7 < trim.length()) {
                                            char charAt2 = trim.charAt(i7);
                                            if (charAt2 != ' ') {
                                                if (charAt2 == 'E' || charAt2 == 'e') {
                                                    z4 = true;
                                                    if (!z) {
                                                        i7++;
                                                    }
                                                } else {
                                                    switch (charAt2) {
                                                        case com.yalantis.ucrop.R.styleable.AppCompatTheme_buttonBarStyle:
                                                            if (i7 != i5) {
                                                            }
                                                            break;
                                                        case com.yalantis.ucrop.R.styleable.AppCompatTheme_buttonStyle:
                                                            if (!z3) {
                                                                z3 = true;
                                                                break;
                                                            }
                                                            z2 = true;
                                                            break;
                                                    }
                                                    z4 = false;
                                                    if (!z) {
                                                    }
                                                }
                                            }
                                            z = true;
                                            z4 = false;
                                            if (!z) {
                                            }
                                        }
                                    }
                                    if (i5 < i7) {
                                        fArr2[i6] = Float.parseFloat(trim.substring(i5, i7));
                                        i6++;
                                    }
                                    if (!z2) {
                                        i7++;
                                    }
                                    i5 = i7;
                                    i2 = 0;
                                }
                                fArr = m(fArr2, i2, i6);
                                i2 = 0;
                            } catch (NumberFormatException e2) {
                                throw new RuntimeException(e.d.a.a.a.J("error in parsing \"", trim, "\""), e2);
                            }
                        }
                        arrayList.add(new i.i.e.c(trim.charAt(i2), fArr));
                    }
                    i4 = i3;
                    i3++;
                    i2 = 0;
                }
                i3++;
            }
            trim = str.substring(i4, i3).trim();
            if (trim.length() > 0) {
            }
            i4 = i3;
            i3++;
            i2 = 0;
        }
        if (i3 - i4 == 1 && i4 < str.length()) {
            arrayList.add(new i.i.e.c(str.charAt(i4), new float[0]));
        }
        return (i.i.e.c[]) arrayList.toArray(new i.i.e.c[arrayList.size()]);
    }

    public static ActionMode.Callback p0(ActionMode.Callback callback) {
        return (!(callback instanceof k) || Build.VERSION.SDK_INT < 26) ? callback : ((k) callback).f15180a;
    }

    public static Path q(String str) {
        Path path = new Path();
        i.i.e.c[] p2 = p(str);
        if (p2 == null) {
            return null;
        }
        try {
            i.i.e.c.b(p2, path);
            return path;
        } catch (RuntimeException e2) {
            throw new RuntimeException(e.d.a.a.a.H("Error in parsing ", str), e2);
        }
    }

    public static Drawable q0(Drawable drawable) {
        int i2 = Build.VERSION.SDK_INT;
        return i2 >= 23 ? drawable : i2 >= 21 ? !(drawable instanceof d) ? new i.i.e.l.g(drawable) : drawable : !(drawable instanceof d) ? new i.i.e.l.f(drawable) : drawable;
    }

    public static i.i.e.c[] r(i.i.e.c[] cVarArr) {
        if (cVarArr == null) {
            return null;
        }
        i.i.e.c[] cVarArr2 = new i.i.e.c[cVarArr.length];
        for (int i2 = 0; i2 < cVarArr.length; i2++) {
            cVarArr2[i2] = new i.i.e.c(cVarArr[i2]);
        }
        return cVarArr2;
    }

    public static ActionMode.Callback r0(TextView textView, ActionMode.Callback callback) {
        int i2 = Build.VERSION.SDK_INT;
        return (i2 < 26 || i2 > 27 || (callback instanceof k) || callback == null) ? callback : new k(callback, textView);
    }

    public static boolean s(Context context, Uri uri) {
        ContentResolver contentResolver = context.getContentResolver();
        boolean z = false;
        Cursor cursor = null;
        try {
            cursor = contentResolver.query(uri, new String[]{"document_id"}, null, null, null);
            if (cursor.getCount() > 0) {
                z = true;
            }
            return z;
        } catch (Exception e2) {
            String str = "Failed query: " + e2;
            return false;
        } finally {
            l(cursor);
        }
    }

    public static void t(LayoutInflater layoutInflater, LayoutInflater.Factory2 factory2) {
        if (!f14913f) {
            try {
                Field declaredField = LayoutInflater.class.getDeclaredField("mFactory2");
                f14912e = declaredField;
                declaredField.setAccessible(true);
            } catch (NoSuchFieldException unused) {
            }
            f14913f = true;
        }
        Field field = f14912e;
        if (field != null) {
            try {
                field.set(layoutInflater, factory2);
            } catch (IllegalAccessException unused2) {
                String str = "forceSetFactory2 could not set the Factory2 on LayoutInflater " + layoutInflater + "; inflation may have unexpected results.";
            }
        }
    }

    public static Drawable u(CompoundButton compoundButton) {
        if (Build.VERSION.SDK_INT >= 23) {
            return compoundButton.getButtonDrawable();
        }
        if (!f14915h) {
            try {
                Field declaredField = CompoundButton.class.getDeclaredField("mButtonDrawable");
                f14914g = declaredField;
                declaredField.setAccessible(true);
            } catch (NoSuchFieldException unused) {
            }
            f14915h = true;
        }
        Field field = f14914g;
        if (field != null) {
            try {
                return (Drawable) field.get(compoundButton);
            } catch (IllegalAccessException unused2) {
                f14914g = null;
            }
        }
        return null;
    }

    public static ColorStateList v(CompoundButton compoundButton) {
        return Build.VERSION.SDK_INT >= 21 ? compoundButton.getButtonTintList() : ((n) compoundButton).getSupportButtonTintList();
    }

    public static final o.x.d<View> w(ViewGroup viewGroup) {
        o.s.c.j.e(viewGroup, "$this$children");
        return new c0(viewGroup);
    }

    public static float x(EdgeEffect edgeEffect) {
        return c.F() ? g.b(edgeEffect) : CropImageView.DEFAULT_ASPECT_RATIO;
    }

    public static int y(Drawable drawable) {
        if (Build.VERSION.SDK_INT >= 23) {
            return drawable.getLayoutDirection();
        }
        if (!d) {
            try {
                Method declaredMethod = Drawable.class.getDeclaredMethod("getLayoutDirection", new Class[0]);
                c = declaredMethod;
                declaredMethod.setAccessible(true);
            } catch (NoSuchMethodException unused) {
            }
            d = true;
        }
        Method method = c;
        if (method != null) {
            try {
                return ((Integer) method.invoke(drawable, new Object[0])).intValue();
            } catch (Exception unused2) {
                c = null;
            }
        }
        return 0;
    }

    public static i.i.d.f.d z(TypedArray typedArray, XmlPullParser xmlPullParser, Resources.Theme theme, String str, int i2, int i3) {
        i.i.d.f.d dVar;
        if (G(xmlPullParser, str)) {
            TypedValue typedValue = new TypedValue();
            typedArray.getValue(i2, typedValue);
            int i4 = typedValue.type;
            if (i4 >= 28 && i4 <= 31) {
                return new i.i.d.f.d(null, null, typedValue.data);
            }
            try {
                dVar = i.i.d.f.d.a(typedArray.getResources(), typedArray.getResourceId(i2, 0), theme);
            } catch (Exception unused) {
                dVar = null;
            }
            if (dVar != null) {
                return dVar;
            }
        }
        return new i.i.d.f.d(null, null, i3);
    }
}