LINE.apk(点击下载) / z.java


package k43;

import android.content.ContentResolver;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.webkit.MimeTypeMap;
import em3.q;
import i5.c;
import io.jsonwebtoken.JwtParser;
import j5.d;
import j5.k;
import j5.l;
import j5.n;
import j5.o;
import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import jp.naver.line.android.chathistory.model.PixelResolution;
import k43.y;
import km3.j;
import kotlin.jvm.internal.DefaultConstructorMarker;
import sm3.x;

public final class z {

    /* renamed from: b  reason: collision with root package name */
    public static final b f100626b = new b(null);

    /* renamed from: a  reason: collision with root package name */
    public final Map<c0, y> f100627a = new ConcurrentHashMap();

    public static abstract class a {

        /* renamed from: k43.z$a$a  reason: collision with other inner class name */
        public static final class C1567a extends a {

            /* renamed from: a  reason: collision with root package name */
            public final y f100628a;

            public C1567a(y yVar) {
                super(null);
                this.f100628a = yVar;
            }
        }

        public static final class b extends a {

            /* renamed from: a  reason: collision with root package name */
            public static final b f100629a = new b();

            public b() {
                super(null);
            }
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
        }
    }

    public static final class b {
        public b(DefaultConstructorMarker defaultConstructorMarker) {
        }

        /* JADX WARNING: Code restructure failed: missing block: B:10:0x0038, code lost:
            throw r9;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:28:0x0063, code lost:
            r0 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:29:0x0064, code lost:
            am3.c.a(r8, r9);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:30:0x0067, code lost:
            throw r0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:8:0x0034, code lost:
            r9 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:9:0x0035, code lost:
            am3.c.a(r0, r8);
         */
        /* JADX WARNING: Removed duplicated region for block: B:46:0x009d A[Catch:{ b -> 0x00b9 }, RETURN] */
        /* JADX WARNING: Removed duplicated region for block: B:47:0x009e A[Catch:{ b -> 0x00b9 }] */
        public final boolean a(Context context, Uri uri) {
            PixelResolution pixelResolution;
            c cVar;
            k kVar;
            q.f(context, "context");
            q.f(uri, "uri");
            ContentResolver contentResolver = context.getContentResolver();
            q.e(contentResolver, "context.contentResolver");
            InputStream a14 = com.linecorp.voip2.common.tracking.uts.a.a(contentResolver, uri);
            String str = null;
            if (a14 != null) {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inJustDecodeBounds = true;
                BitmapFactory.decodeStream(a14, null, options);
                pixelResolution = new PixelResolution(options.outWidth, options.outHeight);
                am3.c.a(a14, null);
            } else {
                pixelResolution = null;
            }
            if (!(pixelResolution != null && pixelResolution.f96888c * 2 == pixelResolution.f96887b)) {
                return false;
            }
            ContentResolver contentResolver2 = context.getContentResolver();
            q.e(contentResolver2, "context.contentResolver");
            InputStream a15 = com.linecorp.voip2.common.tracking.uts.a.a(contentResolver2, uri);
            if (a15 != null) {
                cVar = p82.b.a(a15);
                am3.c.a(a15, null);
            } else {
                cVar = null;
            }
            if (cVar != null) {
                try {
                    l lVar = (l) cVar;
                    d.b("http://ns.google.com/photos/1.0/panorama/");
                    d.a("ProjectionType");
                    n d14 = o.d(lVar.f90522b, k5.b.a("http://ns.google.com/photos/1.0/panorama/", "ProjectionType"), false, null);
                    if (d14 != null) {
                        String str2 = d14.f90526c;
                        if (str2 == null) {
                            if (!d14.n().j()) {
                                str2 = "";
                            }
                        }
                        kVar = new k(lVar, str2, d14);
                        if (kVar != null) {
                            return false;
                        }
                        Object obj = kVar.f90521a;
                        if (obj != null) {
                            str = obj.toString();
                        }
                        if (q.b("equirectangular", str) || q.b("cylindrical", str)) {
                            return true;
                        }
                        return false;
                    }
                } catch (i5.b unused) {
                    return false;
                }
            }
            kVar = null;
            if (kVar != null) {
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:43:0x00ca, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:0x00cb, code lost:
        am3.c.a(r10, r11);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00ce, code lost:
        throw r0;
     */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x0094  */
    /* JADX WARNING: Removed duplicated region for block: B:31:0x0096  */
    /* JADX WARNING: Removed duplicated region for block: B:37:0x00ae A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:48:0x00d3  */
    public final y a(Context context, c0 c0Var) {
        y yVar;
        String str;
        int i14;
        InputStream a14;
        q.f(context, "context");
        q.f(c0Var, "mediaData");
        y yVar2 = this.f100627a.get(c0Var);
        if (yVar2 != null) {
            return yVar2;
        }
        Uri uri = c0Var.f100506g;
        if (!c0Var.f100507h) {
            b bVar = f100626b;
            String scheme = uri.getScheme();
            Long l14 = null;
            if (scheme != null) {
                int hashCode = scheme.hashCode();
                if (hashCode != 3143036) {
                    if (hashCode == 951530617 && scheme.equals("content")) {
                        str = context.getContentResolver().getType(uri);
                        if (!q.b("image/gif", str)) {
                            i14 = 2;
                        } else {
                            i14 = bVar.a(context, uri) ? 3 : 1;
                        }
                        ContentResolver contentResolver = context.getContentResolver();
                        q.e(contentResolver, "context.contentResolver");
                        a14 = com.linecorp.voip2.common.tracking.uts.a.a(contentResolver, uri);
                        if (a14 != null) {
                            BitmapFactory.Options options = new BitmapFactory.Options();
                            options.inJustDecodeBounds = true;
                            BitmapFactory.decodeStream(a14, null, options);
                            Long valueOf = Long.valueOf(((long) options.outHeight) * ((long) options.outWidth));
                            am3.c.a(a14, null);
                            l14 = valueOf;
                        }
                        long j14 = 0;
                        if (l14 != null) {
                            j14 = j.c(l14.longValue(), 0);
                        }
                        yVar = new y(i14, j14);
                    }
                } else if (scheme.equals("file")) {
                    String lastPathSegment = uri.getLastPathSegment();
                    Integer valueOf2 = lastPathSegment != null ? Integer.valueOf(x.U(lastPathSegment, JwtParser.SEPARATOR_CHAR, 0, false, 6)) : null;
                    if (valueOf2 != null && valueOf2.intValue() >= 0) {
                        String substring = lastPathSegment.substring(valueOf2.intValue() + 1);
                        q.e(substring, "this as java.lang.String).substring(startIndex)");
                        str = MimeTypeMap.getSingleton().getMimeTypeFromExtension(substring);
                        if (str == null) {
                            str = "application/octet-stream";
                        }
                        if (!q.b("image/gif", str)) {
                        }
                        ContentResolver contentResolver2 = context.getContentResolver();
                        q.e(contentResolver2, "context.contentResolver");
                        a14 = com.linecorp.voip2.common.tracking.uts.a.a(contentResolver2, uri);
                        if (a14 != null) {
                        }
                        long j142 = 0;
                        if (l14 != null) {
                        }
                        yVar = new y(i14, j142);
                    }
                    str = null;
                    if (!q.b("image/gif", str)) {
                    }
                    ContentResolver contentResolver22 = context.getContentResolver();
                    q.e(contentResolver22, "context.contentResolver");
                    a14 = com.linecorp.voip2.common.tracking.uts.a.a(contentResolver22, uri);
                    if (a14 != null) {
                    }
                    long j1422 = 0;
                    if (l14 != null) {
                    }
                    yVar = new y(i14, j1422);
                }
            }
            uri.getScheme();
            str = null;
            if (!q.b("image/gif", str)) {
            }
            ContentResolver contentResolver222 = context.getContentResolver();
            q.e(contentResolver222, "context.contentResolver");
            a14 = com.linecorp.voip2.common.tracking.uts.a.a(contentResolver222, uri);
            if (a14 != null) {
            }
            long j14222 = 0;
            if (l14 != null) {
            }
            yVar = new y(i14, j14222);
        } else {
            y.a aVar = y.f100623b;
            yVar = y.f100624c;
        }
        this.f100627a.put(c0Var, yVar);
        return yVar;
    }
}