导航菜单

页面标题

页面副标题

Tasker v6.5.11 - IconProvider.java 源代码

正在查看: Tasker v6.5.11 应用的 IconProvider.java JAVA 源代码文件

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


package com.joaomgcd.taskerm.navigationbar;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import com.joaomgcd.taskerm.util.x2;
import com.joaomgcd.taskerm.util.z2;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.List;
import kotlin.collections.r;
import lj.o;
import net.dinglisch.android.taskerm.br;
import yj.h;
import yj.p;

public final class IconProvider extends ContentProvider {
    public static final a i = new a(null);

    public static final class a {

        public class C0025a {
            public static final int[] a;

            static {
                int[] iArr = new int[br.a.values().length];
                try {
                    iArr[br.a.Launcher.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[br.a.Lock.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                try {
                    iArr[br.a.All.ordinal()] = 3;
                } catch (NoSuchFieldError unused3) {
                }
                a = iArr;
            }
        }

        public a(h hVar) {
            this();
        }

        public static String b(a aVar, String str, String str2, int i, Object obj) {
            if ((i & 2) != 0) {
                str2 = null;
            }
            return aVar.a(str, str2);
        }

        private final String g(String str, String str2) {
            if (str2 != null) {
                return IconProvider.i.h(str, str2);
            }
            return null;
        }

        private final String h(String str, String str2) {
            return "content://net.dinglisch.android.taskerm.iconprovider//" + str + "/" + str2;
        }

        public final String a(String str, String str2) {
            if (str2 != null && str2.length() != 0) {
                str = str + "/" + str2;
            }
            return g("app", str);
        }

        public final String c(String str, String str2) {
            p.i(str, "fileName");
            if (str2 != null) {
                str = str2 + "/" + str;
            }
            return h("cache", str);
        }

        public final String d() {
            return h("clipboard", "image");
        }

        public final String e(File file) {
            String absolutePath;
            return g("file", (file == null || (absolutePath = file.getAbsolutePath()) == null) ? null : z2.x0(absolutePath, "file://"));
        }

        public final String f(String str) {
            if (str != null) {
                return IconProvider.i.e(new File(str));
            }
            return null;
        }

        public final String i(String str) {
            return g("task", str);
        }

        public final String j(br.a aVar) {
            String str;
            p.i(aVar, "type");
            int i = C0025a.a[aVar.ordinal()];
            if (i == 1) {
                str = "launcher";
            } else {
                if (i != 2) {
                    if (i != 3) {
                        throw new o();
                    }
                    throw new RuntimeException("Can't get wallpaper path for type ALL");
                }
                str = "lockscreen";
            }
            return h("wallpaper", str);
        }

        public final br.a k(String str) {
            p.i(str, "type");
            if (p.d(str, "launcher")) {
                return br.a.Launcher;
            }
            if (p.d(str, "lockscreen")) {
                return br.a.Lock;
            }
            return null;
        }

        private a() {
        }
    }

    public static final String a(String str, String str2) {
        return i.a(str, str2);
    }

    private final AssetFileDescriptor b(File file) {
        return new AssetFileDescriptor(ParcelFileDescriptor.open(file, 268435456), 0L, file.length());
    }

    private final e c(String str) {
        switch (str.hashCode()) {
            case -1600397930:
                if (str.equals("clipboard")) {
                    return new c();
                }
                return null;
            case 96801:
                if (str.equals("app")) {
                    return new com.joaomgcd.taskerm.navigationbar.a();
                }
                return null;
            case 3143036:
                if (str.equals("file")) {
                    return new d();
                }
                return null;
            case 3552645:
                if (str.equals("task")) {
                    return new f();
                }
                return null;
            case 94416770:
                if (str.equals("cache")) {
                    return new b();
                }
                return null;
            case 1474694658:
                if (str.equals("wallpaper")) {
                    return new g();
                }
                return null;
            default:
                return null;
        }
    }

    @Override
    public int delete(Uri uri, String str, String[] strArr) {
        p.i(uri, "p0");
        throw new lj.p("An operation is not implemented: not implemented");
    }

    @Override
    public String getType(Uri uri) {
        p.i(uri, "p0");
        return "application/octet-stream";
    }

    @Override
    public Uri insert(Uri uri, ContentValues contentValues) {
        p.i(uri, "p0");
        throw new lj.p("An operation is not implemented: not implemented");
    }

    @Override
    public boolean onCreate() {
        return true;
    }

    @Override
    public AssetFileDescriptor openAssetFile(Uri uri, String str) {
        Bitmap b;
        File c;
        p.i(uri, "uri");
        p.i(str, "mode");
        Context context = getContext();
        if (context == null) {
            return null;
        }
        List<String> pathSegments = uri.getPathSegments();
        String str2 = pathSegments.get(0);
        p.f(pathSegments);
        String m0 = r.m0(r.Y(pathSegments, 1), "/", null, null, 0, null, null, 62, null);
        p.f(str2);
        e c2 = c(str2);
        if (c2 != null && (c = c2.c(context, m0)) != null) {
            return b(c);
        }
        if (c2 == null || (b = c2.b(context, m0)) == null) {
            return null;
        }
        ParcelFileDescriptor[] createPipe = ParcelFileDescriptor.createPipe();
        ParcelFileDescriptor.AutoCloseOutputStream autoCloseOutputStream = new ParcelFileDescriptor.AutoCloseOutputStream(createPipe[1]);
        byte[] m = tf.e.m(b);
        if (m.length > 65535) {
            p.f(m);
            return b(x2.G0(m, context, null, null, 6, null));
        }
        p.f(m);
        vj.a.b(new ByteArrayInputStream(m), autoCloseOutputStream, 0, 2, null);
        autoCloseOutputStream.flush();
        autoCloseOutputStream.close();
        return new AssetFileDescriptor(createPipe[0], 0L, -1L);
    }

    @Override
    public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        p.i(uri, "p0");
        return null;
    }

    @Override
    public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        p.i(uri, "p0");
        throw new lj.p("An operation is not implemented: not implemented");
    }
}