그늘 v4.6.9版本的 MD5 值为:45bd3dac9e441bb87fea09c92b437adc

以下内容为反编译后的 a.java 源代码,内容仅作参考


package df;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.FileObserver;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Base64;
import com.meizu.cloud.pushsdk.notification.model.NotifyType;
import java.io.File;
import java.util.Arrays;
import java.util.LinkedList;
import ph.u0;
public final class a {
    public static Context f6421a;
    public static HandlerThread f6422b;
    public static b f6423c;
    public static c f6425e;
    public static IntentFilter f6426f;
    public static boolean f6427g;
    public static final Object f6424d = new Object();
    public static final LinkedList<String> f6428h = new LinkedList<>();
    public static final C0103a i = new C0103a();

    public static class C0103a extends BroadcastReceiver {
        @Override
        public final void onReceive(Context context, Intent intent) {
            ConnectivityManager connectivityManager;
            if (context != null && intent != null) {
                try {
                    if (intent.getAction() != null && intent.getAction().equals("android.net.conn.CONNECTIVITY_CHANGE")) {
                        Context applicationContext = context.getApplicationContext();
                        a.f6421a = applicationContext;
                        if (applicationContext != null && (connectivityManager = (ConnectivityManager) applicationContext.getSystemService("connectivity")) != null) {
                            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
                            if (activeNetworkInfo != null && activeNetworkInfo.isAvailable()) {
                                a.f6427g = true;
                                u0.g0("MobclickRT", "--->>>网络可用: 触发2号数据仓信封消费动作。");
                                a.b(274);
                            } else {
                                u0.g0("MobclickRT", "--->>>网络断连: 2号数据仓");
                                a.f6427g = false;
                            }
                        }
                    }
                } catch (Throwable th2) {
                    ze.a.b(context, th2);
                }
            }
        }
    }

    public class b extends Handler {
        public b(Looper looper) {
            super(looper);
        }

        @Override
        public final void handleMessage(Message message) {
            File b10;
            byte[] bArr;
            Context context;
            File[] fileArr;
            String pollFirst;
            byte[] bArr2;
            String str;
            String str2;
            String str3;
            Object obj;
            int i = message.what;
            if (i != 512) {
                switch (i) {
                    case 273:
                        if (a.f6427g && a.f6421a != null) {
                            do {
                                try {
                                    b10 = df.c.b(a.f6421a);
                                    if (b10 != null && b10.getParentFile() != null && !TextUtils.isEmpty(b10.getParentFile().getName())) {
                                        df.b bVar = new df.b(a.f6421a);
                                        String str4 = new String(Base64.decode(b10.getParentFile().getName(), 0));
                                        if (!"umpx_internal".equalsIgnoreCase(str4) && !"umpx_crash".equalsIgnoreCase(str4) && !"umpx_oplus_lbs".equalsIgnoreCase(str4)) {
                                            wf.d.f0("walle", "[stateless] handleProcessNext, pathUrl is " + str4);
                                            try {
                                                bArr = df.c.f(b10.getAbsolutePath());
                                            } catch (Exception unused) {
                                                bArr = null;
                                            }
                                            String str5 = "";
                                            int i10 = lf.a.f9781a;
                                            if ("explog".equalsIgnoreCase(str4)) {
                                                str5 = "https://pslog.umeng.com";
                                            }
                                            String str6 = "u";
                                            if ("umpx_share".equalsIgnoreCase(str4)) {
                                                str6 = NotifyType.SOUND;
                                            }
                                            if (bVar.a(str4, str5, ("umpx_push_launch".equalsIgnoreCase(str4) || "umpx_push_register".equalsIgnoreCase(str4) || "umpx_push_logs".equalsIgnoreCase(str4)) ? "p" : "p", bArr)) {
                                                wf.d.f0("walle", "[stateless] Send envelope file success, delete it.");
                                                File file = new File(b10.getAbsolutePath());
                                                if (file.delete()) {
                                                    continue;
                                                } else {
                                                    wf.d.f0("walle", "[stateless] Failed to delete already processed file. We try again after delete failed.");
                                                    file.delete();
                                                    continue;
                                                }
                                            } else {
                                                wf.d.f0("walle", "[stateless] Send envelope file failed, abandon and wait next trigger!");
                                                return;
                                            }
                                        }
                                        new File(b10.getAbsolutePath()).delete();
                                    }
                                } catch (Throwable th2) {
                                    ze.a.b(a.f6421a, th2);
                                }
                            } while (b10 != null);
                            try {
                                File file2 = new File(a.f6421a.getFilesDir() + File.separator + "stateless");
                                if (file2.exists() && file2.isDirectory()) {
                                    u0.g0("MobclickRT", "--->>> 2号数据仓:删除stateless目录。");
                                    df.c.e(file2);
                                    return;
                                }
                                return;
                            } catch (Throwable unused2) {
                                return;
                            }
                        }
                        return;
                    case 274:
                        if (a.f6427g && (context = a.f6421a) != null) {
                            try {
                                obj = df.c.f6430a;
                            } catch (Throwable th3) {
                                ze.a.b(context, th3);
                            }
                            synchronized (obj) {
                                String str7 = context.getApplicationContext().getFilesDir() + File.separator + ".emitter";
                                if (!TextUtils.isEmpty(str7)) {
                                    File file3 = new File(str7);
                                    synchronized (obj) {
                                        fileArr = file3.listFiles();
                                        if (fileArr != null && fileArr.length != 0) {
                                            Arrays.sort(fileArr, new d());
                                        }
                                    }
                                }
                                fileArr = null;
                            }
                            if (fileArr != null) {
                                LinkedList<String> linkedList = a.f6428h;
                                if (linkedList.size() > 0) {
                                    linkedList.clear();
                                }
                                for (File file4 : fileArr) {
                                    a.f6428h.add(file4.getAbsolutePath());
                                }
                            }
                            LinkedList<String> linkedList2 = a.f6428h;
                            if (linkedList2.size() <= 0) {
                                u0.g0("MobclickRT", "--->>> todoList无内容,无需处理。");
                            } else {
                                do {
                                    pollFirst = linkedList2.pollFirst();
                                    if (!TextUtils.isEmpty(pollFirst)) {
                                        File file5 = new File(pollFirst);
                                        if (!file5.exists()) {
                                            u0.g0("MobclickRT", "--->>> 信封文件不存在,处理下一个文件。");
                                            continue;
                                        } else {
                                            df.b bVar2 = new df.b(a.f6421a);
                                            try {
                                                bArr2 = df.c.f(pollFirst);
                                            } catch (Exception unused3) {
                                                bArr2 = null;
                                            }
                                            String name = file5.getName();
                                            if (!TextUtils.isEmpty(name)) {
                                                str = name.substring(0, 1);
                                            } else {
                                                str = "u";
                                            }
                                            try {
                                                str2 = new String(Base64.decode(df.c.g(name), 0));
                                            } catch (Throwable unused4) {
                                                str2 = "";
                                            }
                                            int i11 = lf.a.f9781a;
                                            if ("explog".equalsIgnoreCase(str2)) {
                                                str3 = "https://pslog.umeng.com";
                                            } else {
                                                str3 = "https://ulogs.umeng.com";
                                            }
                                            if (bVar2.a(str2, str3, str, bArr2) && !file5.delete()) {
                                                file5.delete();
                                                continue;
                                            }
                                        }
                                    }
                                } while (pollFirst != null);
                                linkedList2.clear();
                            }
                            a.b(275);
                            return;
                        }
                        return;
                    case 275:
                        try {
                            File file6 = new File(a.f6421a.getFilesDir() + File.separator + "stateless");
                            if (file6.exists() && file6.isDirectory()) {
                                u0.g0("MobclickRT", "--->>>2号数据仓:检测到stateless目录。");
                                a.b(273);
                                break;
                            }
                        } catch (Throwable unused5) {
                            break;
                        }
                        break;
                    default:
                        return;
                }
            }
            Context context2 = a.f6421a;
        }
    }

    public static class c extends FileObserver {
        public c(String str) {
            super(str);
        }

        @Override
        public final void onEvent(int i, String str) {
            b bVar;
            if ((i & 8) == 8) {
                u0.s0("MobclickRT", "--->>> envelope file created >>> " + str);
                if (a.f6427g && (bVar = a.f6423c) != null) {
                    Message obtainMessage = bVar.obtainMessage();
                    obtainMessage.what = 274;
                    a.f6423c.sendMessage(obtainMessage);
                }
            }
        }
    }

    public a(Context context) {
        synchronized (f6424d) {
            if (context != null) {
                try {
                    Context applicationContext = context.getApplicationContext();
                    f6421a = applicationContext;
                    if (applicationContext != null && f6422b == null) {
                        HandlerThread handlerThread = new HandlerThread("SL-NetWorkSender");
                        f6422b = handlerThread;
                        handlerThread.start();
                        if (f6425e == null) {
                            String str = f6421a.getFilesDir() + File.separator + ".emitter";
                            File file = new File(str);
                            if (!file.exists()) {
                                u0.g0("MobclickRT", "--->>> 2号数据仓目录不存在,创建之。");
                                file.mkdir();
                            }
                            c cVar = new c(str);
                            f6425e = cVar;
                            cVar.startWatching();
                            u0.g0("MobclickRT", "--->>> 2号数据仓File Monitor启动.");
                        }
                        if (f6423c == null) {
                            f6423c = new b(f6422b.getLooper());
                        }
                        if (ff.b.b(f6421a, "android.permission.ACCESS_NETWORK_STATE")) {
                            wf.d.f0("walle", "[stateless] begin register receiver");
                            if (f6426f == null) {
                                IntentFilter intentFilter = new IntentFilter();
                                f6426f = intentFilter;
                                intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
                                C0103a c0103a = i;
                                if (c0103a != null) {
                                    u0.g0("MobclickRT", "--->>> 2号数据仓:注册网络状态监听器。");
                                    f6421a.registerReceiver(c0103a, f6426f);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    public static boolean a() {
        synchronized (f6424d) {
            if (f6425e != null) {
                return true;
            }
            return false;
        }
    }

    public static void b(int i10) {
        b bVar;
        try {
            if (f6427g && (bVar = f6423c) != null && !bVar.hasMessages(i10)) {
                Message obtainMessage = f6423c.obtainMessage();
                obtainMessage.what = i10;
                f6423c.sendMessage(obtainMessage);
            }
        } catch (Throwable th2) {
            ze.a.b(f6421a, th2);
        }
    }
}