导航菜单

页面标题

页面副标题

万能钥匙 v1.1.23 - f0.java 源代码

正在查看: 万能钥匙 v1.1.23 应用的 f0.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package w3;

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;
import java.util.List;
import t3.n0;

@t3.h0
public final class f0 extends b {

    public final Context f19393e;

    @Nullable
    public p f19394f;

    @Nullable
    public AssetFileDescriptor f19395g;

    @Nullable
    public InputStream f19396h;

    public long f19397i;

    public boolean f19398j;

    public static class a extends m {
        @Deprecated
        public a(String str) {
            super(str, null, 2000);
        }

        public a(@Nullable String str, @Nullable Throwable th, int i10) {
            super(str, th, i10);
        }
    }

    public f0(Context context) {
        super(false);
        this.f19393e = context.getApplicationContext();
    }

    @Deprecated
    public static Uri buildRawResourceUri(int i10) {
        return Uri.parse("rawresource:///" + i10);
    }

    public static AssetFileDescriptor g(Context context, p pVar) throws a {
        Resources resourcesForApplication;
        int identifier;
        Uri normalizeScheme = pVar.f19431a.normalizeScheme();
        if (TextUtils.equals("rawresource", normalizeScheme.getScheme())) {
            resourcesForApplication = context.getResources();
            List<String> pathSegments = normalizeScheme.getPathSegments();
            if (pathSegments.size() != 1) {
                throw new a("rawresource:// URI must have exactly one path element, found " + pathSegments.size());
            }
            identifier = h(pathSegments.get(0));
        } else {
            if (!TextUtils.equals("android.resource", normalizeScheme.getScheme())) {
                throw new a("Unsupported URI scheme (" + normalizeScheme.getScheme() + "). Only android.resource is supported.", null, 1004);
            }
            String str = (String) t3.a.f(normalizeScheme.getPath());
            if (str.startsWith("/")) {
                str = str.substring(1);
            }
            String packageName = TextUtils.isEmpty(normalizeScheme.getHost()) ? context.getPackageName() : normalizeScheme.getHost();
            if (packageName.equals(context.getPackageName())) {
                resourcesForApplication = context.getResources();
            } else {
                try {
                    resourcesForApplication = context.getPackageManager().getResourcesForApplication(packageName);
                } catch (PackageManager.NameNotFoundException e10) {
                    throw new a("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e10, 2005);
                }
            }
            if (str.matches("\\d+")) {
                identifier = h(str);
            } else {
                identifier = resourcesForApplication.getIdentifier(packageName + ":" + str, "raw", null);
                if (identifier == 0) {
                    throw new a("Resource not found.", null, 2005);
                }
            }
        }
        try {
            AssetFileDescriptor openRawResourceFd = resourcesForApplication.openRawResourceFd(identifier);
            if (openRawResourceFd != null) {
                return openRawResourceFd;
            }
            throw new a("Resource is compressed: " + normalizeScheme, null, 2000);
        } catch (Resources.NotFoundException e11) {
            throw new a(null, e11, 2005);
        }
    }

    public static int h(String str) throws a {
        try {
            return Integer.parseInt(str);
        } catch (NumberFormatException unused) {
            throw new a("Resource identifier must be an integer.", null, 1004);
        }
    }

    @Override
    public long a(p pVar) throws a {
        this.f19394f = pVar;
        e(pVar);
        AssetFileDescriptor g10 = g(this.f19393e, pVar);
        this.f19395g = g10;
        long length = g10.getLength();
        FileInputStream fileInputStream = new FileInputStream(this.f19395g.getFileDescriptor());
        this.f19396h = fileInputStream;
        if (length != -1) {
            try {
                if (pVar.f19437g > length) {
                    throw new a(null, null, 2008);
                }
            } catch (a e10) {
                throw e10;
            } catch (IOException e11) {
                throw new a(null, e11, 2000);
            }
        }
        long startOffset = this.f19395g.getStartOffset();
        long skip = fileInputStream.skip(pVar.f19437g + startOffset) - startOffset;
        if (skip != pVar.f19437g) {
            throw new a(null, null, 2008);
        }
        if (length == -1) {
            FileChannel channel = fileInputStream.getChannel();
            if (channel.size() == 0) {
                this.f19397i = -1L;
            } else {
                long size = channel.size() - channel.position();
                this.f19397i = size;
                if (size < 0) {
                    throw new a(null, null, 2008);
                }
            }
        } else {
            long j10 = length - skip;
            this.f19397i = j10;
            if (j10 < 0) {
                throw new m(2008);
            }
        }
        long j11 = pVar.f19438h;
        if (j11 != -1) {
            long j12 = this.f19397i;
            if (j12 != -1) {
                j11 = Math.min(j12, j11);
            }
            this.f19397i = j11;
        }
        this.f19398j = true;
        f(pVar);
        long j13 = pVar.f19438h;
        return j13 != -1 ? j13 : this.f19397i;
    }

    @Override
    public void close() throws a {
        this.f19394f = null;
        try {
            try {
                InputStream inputStream = this.f19396h;
                if (inputStream != null) {
                    inputStream.close();
                }
                this.f19396h = null;
                try {
                    try {
                        AssetFileDescriptor assetFileDescriptor = this.f19395g;
                        if (assetFileDescriptor != null) {
                            assetFileDescriptor.close();
                        }
                    } catch (IOException e10) {
                        throw new a(null, e10, 2000);
                    }
                } finally {
                    this.f19395g = null;
                    if (this.f19398j) {
                        this.f19398j = false;
                        d();
                    }
                }
            } catch (IOException e11) {
                throw new a(null, e11, 2000);
            }
        } catch (Throwable th) {
            this.f19396h = null;
            try {
                try {
                    AssetFileDescriptor assetFileDescriptor2 = this.f19395g;
                    if (assetFileDescriptor2 != null) {
                        assetFileDescriptor2.close();
                    }
                    this.f19395g = null;
                    if (this.f19398j) {
                        this.f19398j = false;
                        d();
                    }
                    throw th;
                } catch (IOException e12) {
                    throw new a(null, e12, 2000);
                }
            } finally {
                this.f19395g = null;
                if (this.f19398j) {
                    this.f19398j = false;
                    d();
                }
            }
        }
    }

    @Override
    @Nullable
    public Uri getUri() {
        p pVar = this.f19394f;
        if (pVar != null) {
            return pVar.f19431a;
        }
        return null;
    }

    @Override
    public int read(byte[] bArr, int i10, int i11) throws a {
        if (i11 == 0) {
            return 0;
        }
        long j10 = this.f19397i;
        if (j10 == 0) {
            return -1;
        }
        if (j10 != -1) {
            try {
                i11 = (int) Math.min(j10, i11);
            } catch (IOException e10) {
                throw new a(null, e10, 2000);
            }
        }
        int read = ((InputStream) n0.l(this.f19396h)).read(bArr, i10, i11);
        if (read == -1) {
            if (this.f19397i == -1) {
                return -1;
            }
            throw new a("End of stream reached having not read sufficient data.", new EOFException(), 2000);
        }
        long j11 = this.f19397i;
        if (j11 != -1) {
            this.f19397i = j11 - read;
        }
        c(read);
        return read;
    }
}