导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - e.java 源代码

正在查看: 小柿子 v1.3.8 应用的 e.java JAVA 源代码文件

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


package com.mbridge.msdk.mbdownload;

import android.R;
import android.app.ActivityManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.SparseArray;
import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import androidx.core.content.FileProvider;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.tools.SameMD5;
import com.mbridge.msdk.foundation.tools.ab;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.foundation.tools.x;
import com.mbridge.msdk.mbdownload.b;
import com.ss.android.downloadad.api.constant.AdBaseConstants;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;

class e {
    private static final String a = "com.mbridge.msdk.mbdownload.e";
    private SparseArray<b> b;
    private Map<b.a, Messenger> c;
    private i d;

    public static class b {
        public k a;
        public a b;
        public int c;
        public int d;
        public b.a e;
        public long[] f = new long[3];

        public b(b.a aVar, int i) {
            this.c = i;
            this.e = aVar;
        }
    }

    public class c extends AsyncTask<String, Void, Integer> {
        public int a;
        public String b;
        private b.a d;
        private Context e;
        private NotificationManager f;

        public c(Context context, int i, b.a aVar, String str) {
            Context applicationContext = context.getApplicationContext();
            this.e = applicationContext;
            this.f = (NotificationManager) applicationContext.getSystemService("notification");
            j.a();
            this.a = i;
            this.d = aVar;
            this.b = str;
        }

        @Override
        public final Integer doInBackground(String[] strArr) {
            return 1;
        }

        @Override
        public final void onPostExecute(Integer num) {
            Uri uriForFile;
            try {
                if (num.intValue() != 1) {
                    this.f.cancel(this.a + 1);
                    Bundle bundle = new Bundle();
                    bundle.putString(com.sigmob.sdk.downloader.core.breakpoint.f.e, this.b);
                    Message obtain = Message.obtain();
                    obtain.what = 5;
                    obtain.arg1 = 3;
                    obtain.arg2 = this.a;
                    obtain.setData(bundle);
                    try {
                        if (e.this.c.get(this.d) != null) {
                            ((Messenger) e.this.c.get(this.d)).send(obtain);
                            return;
                        }
                        return;
                    } catch (RemoteException unused) {
                        e.this.a(this.e, this.a);
                        return;
                    }
                }
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.addFlags(268435456);
                try {
                    if (ab.E(this.e) < 24 || Build.VERSION.SDK_INT < 24) {
                        intent.setDataAndType(Uri.fromFile(new File(this.b)), AdBaseConstants.MIME_APK);
                    } else {
                        Uri uri = null;
                        try {
                            String g6 = com.mbridge.msdk.foundation.controller.c.q().g();
                            if (TextUtils.isEmpty(g6)) {
                                g6 = this.e.getApplicationContext().getPackageName();
                            }
                            if (TextUtils.isEmpty(MBridgeConstans.FILE_PROVIDE_CUSTOM_PATH)) {
                                uriForFile = FileProvider.getUriForFile(this.e, g6 + ".mbFileProvider", new File(this.b));
                            } else {
                                uriForFile = (Uri) Class.forName(MBridgeConstans.FILE_PROVIDE_CUSTOM_PATH).getMethod("getUriForFile", Context.class, String.class, File.class).invoke(null, this.e, g6 + ".mbFileProvider", new File(this.b));
                            }
                            uri = uriForFile;
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (uri != null) {
                            intent.setDataAndType(uri, AdBaseConstants.MIME_APK);
                            intent.addFlags(1);
                        }
                    }
                } catch (Exception unused2) {
                    intent.setDataAndType(Uri.fromFile(new File(this.b)), AdBaseConstants.MIME_APK);
                }
                PendingIntent activity = PendingIntent.getActivity(this.e, 0, intent, 134217728);
                Context context = this.e;
                Notification a = e.a(context, g.g(context), activity);
                if (a != null) {
                    a.flags = 16;
                    this.f.notify(this.a + 1, a);
                }
                if (e.this.a(this.e)) {
                    this.f.cancel(this.a + 1);
                    this.e.startActivity(intent);
                }
                Bundle bundle2 = new Bundle();
                bundle2.putString(com.sigmob.sdk.downloader.core.breakpoint.f.e, this.b);
                Message obtain2 = Message.obtain();
                obtain2.what = 5;
                obtain2.arg1 = 1;
                obtain2.arg2 = this.a;
                obtain2.setData(bundle2);
                try {
                    if (e.this.c.get(this.d) != null) {
                        ((Messenger) e.this.c.get(this.d)).send(obtain2);
                    }
                } catch (RemoteException unused3) {
                    e.this.a(this.e, this.a);
                }
            } catch (Throwable unused4) {
            }
        }

        @Override
        public final void onPreExecute() {
            super.onPreExecute();
        }
    }

    public e(SparseArray<b> sparseArray, Map<b.a, Messenger> map, i iVar) {
        this.b = sparseArray;
        this.c = map;
        this.d = iVar;
    }

    private void b(Context context, int i) {
        Context applicationContext = context.getApplicationContext();
        NotificationManager notificationManager = (NotificationManager) applicationContext.getSystemService("notification");
        j.a();
        b bVar = this.b.get(i);
        bVar.b.e();
        a(applicationContext, bVar.b, i, 1);
        bVar.b.c(bVar.e.c).a(bVar.e.h).b(true);
        if (bVar.e.i) {
            bVar.b.c();
        }
        notificationManager.notify(i, bVar.b.d());
    }

    public final a a(Context context, b.a aVar, int i, int i5) {
        Context applicationContext = context.getApplicationContext();
        a aVar2 = new a(applicationContext);
        PendingIntent.getActivity(applicationContext, 0, new Intent(), 134217728);
        if (aVar.q) {
            aVar2.e();
            a(applicationContext, aVar2, i, 2);
        }
        a(applicationContext, aVar2, i, 3);
        aVar2.a(aVar.j);
        g.f(applicationContext);
        aVar2.a(R.drawable.stat_sys_download).a(System.currentTimeMillis());
        if (aVar.i) {
            aVar2.a();
        }
        aVar2.c(aVar.c).a((CharSequence) (i5 + "%")).a(100, i5, false);
        aVar2.a(aVar.h).b(true);
        return aVar2;
    }

    public static class a extends h {
        public String a;
        public String b;
        public String c;
        public Context d;

        public a(Context context) {
            super(context);
            this.d = context;
        }

        public final a a(CharSequence charSequence) {
            Context context = this.d;
            int E = context != null ? ab.E(context) : 0;
            if (!TextUtils.isEmpty(charSequence) && charSequence.toString().contains("%")) {
                this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_progress_status", "id"), 8);
            }
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_progress_progess", "id"), 0);
            if (E >= 26 && Build.VERSION.SDK_INT >= 26) {
                this.j.setTextViewText(x.a(this.e, "mbridge_download_notify_progress_progess", "id"), charSequence);
            } else if (Build.VERSION.SDK_INT >= 16) {
                this.j.setTextViewText(x.a(this.e, "mbridge_download_notify_progress_progess", "id"), charSequence);
            } else {
                this.b = charSequence.toString();
            }
            return this;
        }

        public final a b(CharSequence charSequence) {
            Context context = this.d;
            int E = context != null ? ab.E(context) : 0;
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_progress_status", "id"), 0);
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_progress_progess", "id"), 8);
            if (E >= 26 && Build.VERSION.SDK_INT >= 26) {
                this.j.setTextViewText(x.a(this.e, "mbridge_download_notify_progress_status", "id"), charSequence);
            } else if (Build.VERSION.SDK_INT >= 16) {
                this.j.setTextViewText(x.a(this.e, "mbridge_download_notify_progress_status", "id"), charSequence);
            } else {
                this.b = charSequence.toString();
            }
            return this;
        }

        public final a c(CharSequence charSequence) {
            Context context = this.d;
            if ((context != null ? ab.E(context) : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
                this.j.setTextViewText(x.a(this.e, "mbridge_download_notify_target_name", "id"), charSequence);
            } else if (Build.VERSION.SDK_INT >= 16) {
                this.j.setTextViewText(x.a(this.e, "mbridge_download_notify_target_name", "id"), charSequence);
            } else {
                this.a = charSequence.toString();
            }
            return this;
        }

        public final Notification d() {
            Context context = this.d;
            if ((context != null ? ab.E(context) : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
                return this.h.build();
            }
            int i = Build.VERSION.SDK_INT;
            if (i >= 16) {
                return this.f60g.build();
            }
            if (i < 16) {
                this.f = new NotificationCompat.Builder(this.e).setTicker(this.a).setContentIntent(this.i).build();
            } else {
                this.f = new Notification.Builder(this.e).setTicker(this.a).setContentIntent(this.i).build();
            }
            return this.f;
        }

        public final a c() {
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_pause", "id"), 8);
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_continue", "id"), 0);
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_progress_status", "id"), 8);
            return this;
        }

        public final a b() {
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_pause", "id"), 8);
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_continue", "id"), 8);
            return this;
        }

        public final a a(String str) {
            Context context = this.d;
            if (context != null) {
                ab.E(context);
            }
            if (!TextUtils.isEmpty(str)) {
                com.mbridge.msdk.foundation.same.c.b.a(this.d).a(str, new com.mbridge.msdk.foundation.same.c.c() {
                    @Override
                    public final void onFailedLoad(String str2, String str3) {
                    }

                    @Override
                    public final void onSuccessLoad(Bitmap bitmap, String str2) {
                        if (bitmap.isRecycled()) {
                            return;
                        }
                        a aVar = a.this;
                        aVar.j.setImageViewBitmap(x.a(aVar.e, "mbridge_download_notify_target_icon", "id"), bitmap);
                    }
                });
            }
            return this;
        }

        public final a a() {
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_pause", "id"), 0);
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_continue", "id"), 8);
            this.j.setViewVisibility(x.a(this.d, "mbridge_download_notify_progress_status", "id"), 8);
            return this;
        }

        public final a a(int i, int i5, boolean z) {
            if (Build.VERSION.SDK_INT >= 16) {
                try {
                    this.j.setProgressBar(x.a(this.e, "mbridge_download_notify_progress", "id"), i, i5, z);
                } catch (Exception e) {
                    af.b(e.a, e.getMessage());
                }
            } else {
                this.c = i5 + "%";
            }
            return this;
        }
    }

    public static boolean b(Context context) {
        PackageManager packageManager;
        String g6;
        try {
            packageManager = context.getPackageManager();
            g6 = com.mbridge.msdk.foundation.controller.c.q().g();
            if (TextUtils.isEmpty(g6)) {
                g6 = context.getPackageName();
            }
        } catch (Exception unused) {
        }
        return packageManager.checkPermission("android.permission.ACCESS_NETWORK_STATE", g6) == 0 && ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo().isConnectedOrConnecting();
    }

    private void a(Context context, a aVar, int i, int i5) {
        if (Build.VERSION.SDK_INT >= 16) {
            PendingIntent a5 = j.a(context, j.a(i, "continue"));
            PendingIntent a6 = j.a(context, j.a(i, "install or active"));
            PendingIntent a7 = j.a(context, j.a(i, "continue"));
            PendingIntent a8 = j.a(context, j.a(i, "parent_view_click"));
            if (i5 == 1) {
                aVar.j.setOnClickPendingIntent(x.a(context, "mbridge_download_notify_continue", "id"), a5);
            } else if (i5 == 2) {
                aVar.j.setOnClickPendingIntent(x.a(context, "mbridge_download_notify_pause", "id"), a7);
            } else if (i5 == 3) {
                aVar.j.setOnClickPendingIntent(x.a(context, "mbridge_download_notify_progress_status", "id"), a6);
            }
            aVar.j.setOnClickPendingIntent(x.a(context, "mbridge_download_notify_parent_view", "id"), a8);
        }
    }

    public final boolean a(Context context) {
        List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = ((ActivityManager) context.getSystemService("activity")).getRunningAppProcesses();
        if (runningAppProcesses == null) {
            return false;
        }
        String g6 = com.mbridge.msdk.foundation.controller.c.q().g();
        if (TextUtils.isEmpty(g6)) {
            g6 = context.getPackageName();
        }
        for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
            if (runningAppProcessInfo.importance == 100 && runningAppProcessInfo.processName.equals(g6)) {
                return true;
            }
        }
        return false;
    }

    public final boolean a(b.a aVar, boolean z, Messenger messenger) {
        if (z) {
            int nextInt = new Random().nextInt(1000);
            Map<b.a, Messenger> map = this.c;
            if (map != null) {
                for (b.a aVar2 : map.keySet()) {
                    af.a(a, "_" + nextInt + " downling  " + aVar2.c + "   " + aVar2.d);
                }
            } else {
                af.a(a, "_" + nextInt + "downling  null");
            }
        }
        Map<b.a, Messenger> map2 = this.c;
        if (map2 == null) {
            return false;
        }
        for (b.a aVar3 : map2.keySet()) {
            String str = aVar.f;
            if (str != null && str.equals(aVar3.f)) {
                this.c.put(aVar3, messenger);
                return true;
            }
            if (aVar3.d.equals(aVar.d)) {
                this.c.put(aVar3, messenger);
                return true;
            }
        }
        return false;
    }

    public final int a(b.a aVar) {
        for (int i = 0; i < this.b.size(); i++) {
            int keyAt = this.b.keyAt(i);
            String str = aVar.f;
            if (str != null && str.equals(this.b.get(keyAt).e.f)) {
                return this.b.get(keyAt).c;
            }
            if (this.b.get(keyAt).e.d.equals(aVar.d)) {
                return this.b.get(keyAt).c;
            }
        }
        return -1;
    }

    public final void a(Context context, int i) {
        NotificationManager notificationManager = (NotificationManager) context.getApplicationContext().getSystemService("notification");
        b bVar = this.b.get(i);
        if (bVar != null) {
            af.a(a, "download service clear cache " + bVar.e.c);
            k kVar = bVar.a;
            if (kVar != null) {
                kVar.a(2);
            }
            notificationManager.cancel(bVar.c);
            if (this.c.containsKey(bVar.e)) {
                this.c.remove(bVar.e);
            }
            SparseArray<b> sparseArray = this.b;
            if (sparseArray.indexOfKey(bVar.c) >= 0) {
                sparseArray.remove(bVar.c);
            }
            this.d.b(i);
        }
    }

    public final boolean a(com.mbridge.msdk.mbdownload.c cVar, Intent intent) {
        Context applicationContext;
        String string;
        try {
            applicationContext = cVar.c().getApplicationContext();
            string = intent.getExtras().getString("com.mbridge.msdk.broadcast.download.msg");
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        if (string == null) {
            return false;
        }
        String[] split = string.split(":");
        int parseInt = Integer.parseInt(split[0]);
        String trim = split[1].trim();
        if (parseInt == 0 || TextUtils.isEmpty(trim) || this.b.indexOfKey(parseInt) < 0) {
            return false;
        }
        b bVar = this.b.get(parseInt);
        k kVar = bVar.a;
        long[] jArr = bVar.f;
        long j = jArr[0];
        long j5 = jArr[1];
        long j6 = jArr[2];
        if ("continue".equals(trim)) {
            if (kVar == null) {
                af.a(a, "Receive action do play click new thread.");
                if (!b(applicationContext)) {
                    Toast.makeText(applicationContext, g.d, 1).show();
                    return false;
                }
                k kVar2 = new k(cVar, bVar.e, parseInt, bVar.d);
                bVar.a = kVar2;
                kVar2.start();
                Message obtain = Message.obtain();
                obtain.what = 2;
                obtain.arg1 = 7;
                obtain.arg2 = parseInt;
                try {
                    if (this.c.get(bVar.e) != null) {
                        this.c.get(bVar.e).send(obtain);
                    }
                } catch (RemoteException e5) {
                    af.b(a, "", e5);
                }
                return true;
            }
            if (kVar.c() == k.b) {
                af.a(a, "Receive action do play click.");
                if (!b(applicationContext)) {
                    Toast.makeText(applicationContext, g.d, 1).show();
                    return false;
                }
                kVar.b();
                Message obtain2 = Message.obtain();
                obtain2.what = 2;
                obtain2.arg1 = 7;
                obtain2.arg2 = parseInt;
                try {
                    if (this.c.get(bVar.e) != null) {
                        this.c.get(bVar.e).send(obtain2);
                    }
                } catch (RemoteException e6) {
                    af.b(a, "", e6);
                }
                return true;
            }
            af.a(a, "Receive action do pause click.");
            kVar.a();
            try {
                kVar.interrupt();
            } catch (Exception e7) {
                e7.printStackTrace();
            }
            b(applicationContext, parseInt);
            Message obtain3 = Message.obtain();
            obtain3.what = 2;
            obtain3.arg1 = 6;
            obtain3.arg2 = parseInt;
            try {
                if (this.c.get(bVar.e) != null) {
                    this.c.get(bVar.e).send(obtain3);
                }
            } catch (RemoteException e8) {
                af.b(a, "", e8);
            }
            return true;
        }
        if ("cancel".equals(trim)) {
            af.a(a, "Receive action do stop click.");
            try {
                if (kVar != null) {
                    try {
                        kVar.a(2);
                    } catch (Exception unused) {
                        Message obtain4 = Message.obtain();
                        obtain4.what = 5;
                        obtain4.arg1 = 5;
                        obtain4.arg2 = parseInt;
                        if (this.c.get(bVar.e) != null) {
                            this.c.get(bVar.e).send(obtain4);
                        }
                    } catch (Throwable th) {
                        Message obtain5 = Message.obtain();
                        obtain5.what = 5;
                        obtain5.arg1 = 5;
                        obtain5.arg2 = parseInt;
                        try {
                            if (this.c.get(bVar.e) != null) {
                                this.c.get(bVar.e).send(obtain5);
                                throw th;
                            }
                            throw th;
                        } catch (RemoteException unused2) {
                            a(applicationContext, parseInt);
                            throw th;
                        }
                    }
                }
                Message obtain6 = Message.obtain();
                obtain6.what = 5;
                obtain6.arg1 = 5;
                obtain6.arg2 = parseInt;
                if (this.c.get(bVar.e) != null) {
                    this.c.get(bVar.e).send(obtain6);
                }
            } catch (RemoteException unused3) {
                a(applicationContext, parseInt);
            }
            return true;
        }
        if ("install or active".equals(trim)) {
            if (kVar != null) {
                kVar.d();
                return false;
            }
            a(applicationContext, parseInt);
            return false;
        }
        if (!"parent_view_click".equals(trim)) {
            return false;
        }
        af.a("workthread", "clickParentView");
        int c5 = com.mbridge.msdk.foundation.db.f.a(com.mbridge.msdk.foundation.db.j.a(applicationContext)).c(bVar.e.f57g);
        if (c5 != 5 && c5 != 6) {
            if ((c5 != 1 && c5 != 9 && c5 != 10 && c5 != 11) || kVar == null) {
                return false;
            }
            kVar.d();
            return false;
        }
        String str = a;
        af.a(str, "Receive action clickParentView to do play click.");
        if (kVar == null) {
            af.a(str, "Receive action do play click.");
            if (!b(applicationContext)) {
                Toast.makeText(applicationContext, g.d, 1).show();
                return false;
            }
            k kVar3 = new k(cVar, bVar.e, bVar.c, bVar.d);
            bVar.a = kVar3;
            kVar3.start();
            Message obtain7 = Message.obtain();
            obtain7.what = 2;
            obtain7.arg1 = 7;
            obtain7.arg2 = bVar.c;
            try {
                if (this.c.get(bVar.e) == null) {
                    return false;
                }
                this.c.get(bVar.e).send(obtain7);
                return false;
            } catch (RemoteException e9) {
                af.b(a, "", e9);
                return false;
            }
        }
        if (kVar.c() == k.b) {
            af.a(str, "Receive action do play click.");
            if (!b(applicationContext)) {
                Toast.makeText(applicationContext, g.d, 1).show();
                return false;
            }
            kVar.b();
            Message obtain8 = Message.obtain();
            obtain8.what = 2;
            obtain8.arg1 = 7;
            obtain8.arg2 = bVar.c;
            try {
                if (this.c.get(bVar.e) == null) {
                    return false;
                }
                this.c.get(bVar.e).send(obtain8);
                return false;
            } catch (RemoteException e10) {
                af.b(a, "", e10);
                return false;
            }
        }
        af.a(str, "Receive action do pause click.");
        kVar.a();
        b(applicationContext, bVar.c);
        Message obtain9 = Message.obtain();
        obtain9.what = 2;
        obtain9.arg1 = 6;
        obtain9.arg2 = bVar.c;
        try {
            if (this.c.get(bVar.e) == null) {
                return false;
            }
            this.c.get(bVar.e).send(obtain9);
            return false;
        } catch (RemoteException e11) {
            af.b(a, "", e11);
            return false;
        }
        e.printStackTrace();
        return false;
    }

    public static String a(String str) {
        if (str == null) {
            return null;
        }
        try {
            byte[] bytes = str.getBytes();
            MessageDigest messageDigest = MessageDigest.getInstance(SameMD5.TAG);
            messageDigest.reset();
            messageDigest.update(bytes);
            byte[] digest = messageDigest.digest();
            StringBuffer stringBuffer = new StringBuffer();
            for (byte b5 : digest) {
                stringBuffer.append(String.format("%02X", Byte.valueOf(b5)));
            }
            return stringBuffer.toString();
        } catch (Exception unused) {
            return str.replaceAll("[^[a-z][A-Z][0-9][.][_]]", "");
        }
    }

    public static String a() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date());
    }

    private static boolean a(String str, int i, int i5, int i6) {
        try {
            Class<?> cls = Class.forName("android.os.FileUtils");
            Class<?> cls2 = Integer.TYPE;
            cls.getMethod("setPermissions", String.class, cls2, cls2, cls2).invoke(null, str, Integer.valueOf(i), -1, -1);
            return true;
        } catch (ClassNotFoundException e) {
            af.a(a, "error when set permissions:", e);
            return false;
        } catch (IllegalAccessException e5) {
            af.a(a, "error when set permissions:", e5);
            return false;
        } catch (IllegalArgumentException e6) {
            af.a(a, "error when set permissions:", e6);
            return false;
        } catch (NoSuchMethodException e7) {
            af.a(a, "error when set permissions:", e7);
            return false;
        } catch (InvocationTargetException e8) {
            af.a(a, "error when set permissions:", e8);
            return false;
        }
    }

    public static Notification a(Context context, String str, PendingIntent pendingIntent) {
        Notification build;
        if ((context != null ? ab.E(context) : 0) >= 26) {
            try {
                if (Build.VERSION.SDK_INT >= 26) {
                    Resources resources = context.getResources();
                    if (resources == null) {
                        build = new NotificationCompat.Builder(context, "download").setSmallIcon(R.drawable.stat_sys_download_done).setTicker(str).setWhen(System.currentTimeMillis()).setContentIntent(pendingIntent).build();
                    } else {
                        build = new NotificationCompat.Builder(context, "download").setSmallIcon(R.drawable.stat_sys_download_done).setLargeIcon(BitmapFactory.decodeResource(resources, R.drawable.stat_sys_download_done)).setTicker(str).setWhen(System.currentTimeMillis()).setContentIntent(pendingIntent).build();
                    }
                    return build;
                }
            } catch (Throwable th) {
                af.a("DownloadTool", th.getMessage());
                return null;
            }
        }
        if (Build.VERSION.SDK_INT < 16) {
            build = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.stat_sys_download).setTicker(str).setWhen(System.currentTimeMillis()).setContentIntent(pendingIntent).build();
        } else {
            build = new Notification.Builder(context).setSmallIcon(R.drawable.stat_sys_download).setTicker(str).setWhen(System.currentTimeMillis()).setContentIntent(pendingIntent).build();
        }
        return build;
    }

    public static File a(String str, Context context, boolean[] zArr) throws IOException {
        if (Environment.getExternalStorageState().equals("mounted")) {
            File file = new File(com.mbridge.msdk.foundation.same.b.e.a(com.mbridge.msdk.foundation.same.b.c.MBRIDGE_700_APK) + "/download/.mb" + str);
            file.mkdirs();
            if (file.exists()) {
                zArr[0] = true;
                return file;
            }
        }
        String absolutePath = context.getCacheDir().getAbsolutePath();
        new File(absolutePath).mkdir();
        a(absolutePath, 505, -1, -1);
        String str2 = absolutePath + "/mbdownload";
        new File(str2).mkdir();
        a(str2, 505, -1, -1);
        File file2 = new File(str2);
        zArr[0] = false;
        return file2;
    }
}