APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:eSamudaay Seller
版本号:0.6.80
包名称:in.foore.mobile

MD5 校验值:63f8e52e07318fa084f03ba71262387f

反编译源代码说明

a.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package e8;

import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.util.DisplayMetrics;
import e8.e;
import f8.f;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

public class a {

    private static final Map<Context, a> f8638d = new HashMap();

    private final h f8639a = d();

    protected final Context f8640b;

    protected final e8.d f8641c;

    public static class C0128a extends d {

        private final String f8642c;

        private final JSONObject f8643d;

        private final boolean f8644e;

        public C0128a(String str, JSONObject jSONObject, String str2) {
            this(str, jSONObject, str2, false, new JSONObject());
        }

        public C0128a(String str, JSONObject jSONObject, String str2, boolean z10, JSONObject jSONObject2) {
            super(str2, jSONObject);
            this.f8642c = str;
            this.f8644e = z10;
            this.f8643d = jSONObject2;
        }

        public String c() {
            return this.f8642c;
        }

        public JSONObject d() {
            return b();
        }

        public JSONObject e() {
            return this.f8643d;
        }
    }

    static class b extends d {
        public b(JSONObject jSONObject, String str) {
            super(str, jSONObject);
        }

        public String toString() {
            return b().toString();
        }
    }

    public static class c {

        private final String f8645a;

        public c(String str) {
            this.f8645a = str;
        }

        public String a() {
            return this.f8645a;
        }
    }

    public static class d extends c {

        private final JSONObject f8646b;

        public d(String str, JSONObject jSONObject) {
            super(str);
            if (jSONObject != null && jSONObject.length() > 0) {
                Iterator<String> keys = jSONObject.keys();
                while (keys.hasNext()) {
                    String next = keys.next();
                    try {
                        jSONObject.get(next).toString();
                    } catch (AssertionError e10) {
                        jSONObject.remove(next);
                        f8.d.d("MixpanelAPI.Messages", "Removing people profile property from update (see https://github.com/mixpanel/mixpanel-android/issues/567)", e10);
                    } catch (JSONException unused) {
                    }
                }
            }
            this.f8646b = jSONObject;
        }

        public JSONObject b() {
            return this.f8646b;
        }
    }

    static class e extends d {
        public e(JSONObject jSONObject, String str) {
            super(str, jSONObject);
        }

        public boolean c() {
            return !b().has("$distinct_id");
        }

        public String toString() {
            return b().toString();
        }
    }

    static class f extends c {

        private final String f8647b;

        public f(String str, String str2) {
            super(str2);
            this.f8647b = str;
        }

        public String b() {
            return this.f8647b;
        }

        public String toString() {
            return this.f8647b;
        }
    }

    static class g extends c {

        private final Map<String, String> f8648b;

        public Map<String, String> b() {
            return this.f8648b;
        }
    }

    public class h {

        private l f8654f;

        private final Object f8649a = new Object();

        private long f8651c = 0;

        private long f8652d = 0;

        private long f8653e = -1;

        private Handler f8650b = f();

        public class HandlerC0129a extends Handler {

            private e8.e f8656a;

            private final long f8657b;

            private long f8658c;

            private int f8659d;

            public HandlerC0129a(Looper looper) {
                super(looper);
                this.f8656a = null;
                h.this.f8654f = l.f(a.this.f8640b);
                this.f8657b = a.this.f8641c.h();
            }

            private JSONObject a() {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("mp_lib", "android");
                jSONObject.put("$lib_version", "7.3.2");
                jSONObject.put("$os", "Android");
                String str = Build.VERSION.RELEASE;
                if (str == null) {
                    str = "UNKNOWN";
                }
                jSONObject.put("$os_version", str);
                String str2 = Build.MANUFACTURER;
                if (str2 == null) {
                    str2 = "UNKNOWN";
                }
                jSONObject.put("$manufacturer", str2);
                String str3 = Build.BRAND;
                if (str3 == null) {
                    str3 = "UNKNOWN";
                }
                jSONObject.put("$brand", str3);
                String str4 = Build.MODEL;
                jSONObject.put("$model", str4 != null ? str4 : "UNKNOWN");
                DisplayMetrics e10 = h.this.f8654f.e();
                jSONObject.put("$screen_dpi", e10.densityDpi);
                jSONObject.put("$screen_height", e10.heightPixels);
                jSONObject.put("$screen_width", e10.widthPixels);
                String b10 = h.this.f8654f.b();
                if (b10 != null) {
                    jSONObject.put("$app_version", b10);
                    jSONObject.put("$app_version_string", b10);
                }
                Integer a10 = h.this.f8654f.a();
                if (a10 != null) {
                    String valueOf = String.valueOf(a10);
                    jSONObject.put("$app_release", valueOf);
                    jSONObject.put("$app_build_number", valueOf);
                }
                Boolean valueOf2 = Boolean.valueOf(h.this.f8654f.g());
                if (valueOf2 != null) {
                    jSONObject.put("$has_nfc", valueOf2.booleanValue());
                }
                Boolean valueOf3 = Boolean.valueOf(h.this.f8654f.h());
                if (valueOf3 != null) {
                    jSONObject.put("$has_telephone", valueOf3.booleanValue());
                }
                String d10 = h.this.f8654f.d();
                if (d10 != null && !d10.trim().isEmpty()) {
                    jSONObject.put("$carrier", d10);
                }
                Boolean j10 = h.this.f8654f.j();
                if (j10 != null) {
                    jSONObject.put("$wifi", j10.booleanValue());
                }
                Boolean i10 = h.this.f8654f.i();
                if (i10 != null) {
                    jSONObject.put("$bluetooth_enabled", i10);
                }
                String c10 = h.this.f8654f.c();
                if (c10 != null) {
                    jSONObject.put("$bluetooth_version", c10);
                }
                return jSONObject;
            }

            private JSONObject b(C0128a c0128a) {
                JSONObject jSONObject = new JSONObject();
                JSONObject d10 = c0128a.d();
                JSONObject a10 = a();
                a10.put("token", c0128a.a());
                if (d10 != null) {
                    Iterator<String> keys = d10.keys();
                    while (keys.hasNext()) {
                        String next = keys.next();
                        a10.put(next, d10.get(next));
                    }
                }
                jSONObject.put("event", c0128a.c());
                jSONObject.put("properties", a10);
                jSONObject.put("$mp_metadata", c0128a.e());
                return jSONObject;
            }

            private void c(e8.e eVar, String str) {
                f8.f i10 = a.this.i();
                a aVar = a.this;
                if (!i10.b(aVar.f8640b, aVar.f8641c.o())) {
                    a.this.k("Not flushing data to Mixpanel because the device is not connected to the internet.");
                    return;
                }
                d(eVar, str, e.b.EVENTS, a.this.f8641c.f());
                d(eVar, str, e.b.PEOPLE, a.this.f8641c.p());
                d(eVar, str, e.b.GROUPS, a.this.f8641c.j());
            }

            private void d(e8.e eVar, String str, e.b bVar, String str2) {
                a aVar;
                StringBuilder sb;
                StringBuilder sb2;
                f8.f i10 = a.this.i();
                String[] o10 = eVar.o(bVar, str);
                int i11 = 0;
                Integer valueOf = o10 != null ? Integer.valueOf(o10[2]) : 0;
                while (o10 != null && valueOf.intValue() > 0) {
                    String str3 = o10[i11];
                    String str4 = o10[1];
                    String c10 = f8.a.c(str4);
                    HashMap hashMap = new HashMap();
                    hashMap.put("data", c10);
                    if (e8.d.f8666u) {
                        hashMap.put("verbose", "1");
                    }
                    try {
                        try {
                            byte[] a10 = i10.a(str2, hashMap, a.this.f8641c.r());
                            if (a10 != null) {
                                try {
                                    String str5 = new String(a10, "UTF-8");
                                    if (this.f8659d > 0) {
                                        this.f8659d = i11;
                                        removeMessages(2, str);
                                    }
                                    a.this.k("Successfully posted to " + str2 + ": \n" + str4);
                                    a aVar2 = a.this;
                                    StringBuilder sb3 = new StringBuilder();
                                    sb3.append("Response was ");
                                    sb3.append(str5);
                                    aVar2.k(sb3.toString());
                                    i11 = 1;
                                } catch (UnsupportedEncodingException e10) {
                                    throw new RuntimeException("UTF not supported on this platform?", e10);
                                    break;
                                }
                            } else {
                                try {
                                    a.this.k("Response was null, unexpected failure posting to " + str2 + ".");
                                } catch (OutOfMemoryError e11) {
                                    e = e11;
                                    sb2 = new StringBuilder();
                                    sb2.append("Out of memory when posting to ");
                                    sb2.append(str2);
                                    sb2.append(".");
                                    f8.d.d("MixpanelAPI.Messages", sb2.toString(), e);
                                    if (i11 != 0) {
                                    }
                                } catch (MalformedURLException e12) {
                                    e = e12;
                                    sb2 = new StringBuilder();
                                    sb2.append("Cannot interpret ");
                                    sb2.append(str2);
                                    sb2.append(" as a URL.");
                                    f8.d.d("MixpanelAPI.Messages", sb2.toString(), e);
                                    if (i11 != 0) {
                                    }
                                }
                            }
                        } catch (OutOfMemoryError e13) {
                            e = e13;
                            i11 = 1;
                        } catch (MalformedURLException e14) {
                            e = e14;
                            i11 = 1;
                        }
                    } catch (f.a e15) {
                        a.this.l("Cannot post message to " + str2 + ".", e15);
                        this.f8658c = (long) (e15.a() * com.android.volley.toolbox.i.DEFAULT_IMAGE_TIMEOUT_MS);
                        i11 = 0;
                        if (i11 != 0) {
                        }
                    } catch (SocketTimeoutException e16) {
                        e = e16;
                        aVar = a.this;
                        sb = new StringBuilder();
                        sb.append("Cannot post message to ");
                        sb.append(str2);
                        sb.append(".");
                        aVar.l(sb.toString(), e);
                        i11 = 0;
                        if (i11 != 0) {
                        }
                    } catch (IOException e17) {
                        e = e17;
                        aVar = a.this;
                        sb = new StringBuilder();
                        sb.append("Cannot post message to ");
                        sb.append(str2);
                        sb.append(".");
                        aVar.l(sb.toString(), e);
                        i11 = 0;
                        if (i11 != 0) {
                        }
                    }
                    if (i11 != 0) {
                        removeMessages(2, str);
                        long max = Math.max(((long) Math.pow(2.0d, this.f8659d)) * 60000, this.f8658c);
                        this.f8658c = max;
                        this.f8658c = Math.min(max, 600000L);
                        Message obtain = Message.obtain();
                        obtain.what = 2;
                        obtain.obj = str;
                        sendMessageDelayed(obtain, this.f8658c);
                        this.f8659d++;
                        a.this.k("Retrying this batch of events in " + this.f8658c + " ms");
                        return;
                    }
                    a.this.k("Not retrying this batch of events, deleting them from DB.");
                    eVar.m(str3, bVar, str);
                    o10 = eVar.o(bVar, str);
                    if (o10 != null) {
                        valueOf = Integer.valueOf(o10[2]);
                    }
                    i11 = 0;
                }
            }

            @Override
            public void handleMessage(Message message) {
                String a10;
                e8.e eVar;
                e.b bVar;
                String str;
                if (this.f8656a == null) {
                    a aVar = a.this;
                    e8.e m10 = aVar.m(aVar.f8640b);
                    this.f8656a = m10;
                    m10.l(System.currentTimeMillis() - a.this.f8641c.b(), e.b.EVENTS);
                    this.f8656a.l(System.currentTimeMillis() - a.this.f8641c.b(), e.b.PEOPLE);
                }
                int i10 = -3;
                try {
                    int i11 = message.what;
                    if (i11 == 0) {
                        e eVar2 = (e) message.obj;
                        e.b bVar2 = eVar2.c() ? e.b.ANONYMOUS_PEOPLE : e.b.PEOPLE;
                        a.this.k("Queuing people record for sending later");
                        a.this.k("    " + eVar2.toString());
                        a10 = eVar2.a();
                        i10 = this.f8656a.j(eVar2.b(), a10, bVar2);
                        if (eVar2.c()) {
                            i10 = 0;
                        }
                    } else if (i11 == 3) {
                        b bVar3 = (b) message.obj;
                        a.this.k("Queuing group record for sending later");
                        a.this.k("    " + bVar3.toString());
                        a10 = bVar3.a();
                        i10 = this.f8656a.j(bVar3.b(), a10, e.b.GROUPS);
                    } else if (i11 == 1) {
                        C0128a c0128a = (C0128a) message.obj;
                        try {
                            JSONObject b10 = b(c0128a);
                            a.this.k("Queuing event for sending later");
                            a.this.k("    " + b10.toString());
                            str = c0128a.a();
                            try {
                                i10 = this.f8656a.j(b10, str, e.b.EVENTS);
                            } catch (JSONException e10) {
                                e = e10;
                                f8.d.d("MixpanelAPI.Messages", "Exception tracking event " + c0128a.c(), e);
                                a10 = str;
                                if (i10 < a.this.f8641c.a()) {
                                }
                                a.this.k("Flushing queue due to bulk upload limit (" + i10 + ") for project " + a10);
                                h.this.h();
                                c(this.f8656a, a10);
                                return;
                            }
                        } catch (JSONException e11) {
                            e = e11;
                            str = null;
                        }
                        a10 = str;
                    } else if (i11 == 4) {
                        f fVar = (f) message.obj;
                        String b11 = fVar.b();
                        a10 = fVar.a();
                        i10 = this.f8656a.r(a10, b11);
                    } else {
                        if (i11 == 7) {
                            a10 = ((c) message.obj).a();
                            eVar = this.f8656a;
                            bVar = e.b.ANONYMOUS_PEOPLE;
                        } else {
                            if (i11 == 8) {
                                g gVar = (g) message.obj;
                                f8.d.a("MixpanelAPI.Messages", this.f8656a.s(gVar.b(), gVar.a()) + " stored events were updated with new properties.");
                            } else if (i11 == 2) {
                                a.this.k("Flushing queue due to scheduled or forced flush");
                                h.this.h();
                                a10 = (String) message.obj;
                                c(this.f8656a, a10);
                            } else if (i11 == 6) {
                                a10 = ((c) message.obj).a();
                                this.f8656a.k(e.b.EVENTS, a10);
                                this.f8656a.k(e.b.PEOPLE, a10);
                                this.f8656a.k(e.b.GROUPS, a10);
                                eVar = this.f8656a;
                                bVar = e.b.ANONYMOUS_PEOPLE;
                            } else if (i11 == 5) {
                                f8.d.k("MixpanelAPI.Messages", "Worker received a hard kill. Dumping all events and force-killing. Thread id " + Thread.currentThread().getId());
                                synchronized (h.this.f8649a) {
                                    this.f8656a.n();
                                    h.this.f8650b = null;
                                    Looper.myLooper().quit();
                                }
                            } else if (i11 == 9) {
                                f8.c.a((File) message.obj);
                            } else {
                                f8.d.c("MixpanelAPI.Messages", "Unexpected message received by Mixpanel worker: " + message);
                            }
                            a10 = null;
                        }
                        eVar.k(bVar, a10);
                    }
                    if ((i10 < a.this.f8641c.a() || i10 == -2) && this.f8659d <= 0 && a10 != null) {
                        a.this.k("Flushing queue due to bulk upload limit (" + i10 + ") for project " + a10);
                        h.this.h();
                        c(this.f8656a, a10);
                        return;
                    }
                    if (i10 <= 0 || hasMessages(2, a10)) {
                        return;
                    }
                    a.this.k("Queue depth " + i10 + " - Adding flush in " + this.f8657b);
                    if (this.f8657b >= 0) {
                        Message obtain = Message.obtain();
                        obtain.what = 2;
                        obtain.obj = a10;
                        obtain.arg1 = 1;
                        sendMessageDelayed(obtain, this.f8657b);
                    }
                } catch (RuntimeException e12) {
                    f8.d.d("MixpanelAPI.Messages", "Worker threw an unhandled exception", e12);
                    synchronized (h.this.f8649a) {
                        h.this.f8650b = null;
                        try {
                            Looper.myLooper().quit();
                            f8.d.d("MixpanelAPI.Messages", "Mixpanel will not process any more analytics messages", e12);
                        } catch (Exception e13) {
                            f8.d.d("MixpanelAPI.Messages", "Could not halt looper", e13);
                        }
                    }
                }
            }
        }

        public h() {
        }

        public void h() {
            long currentTimeMillis = System.currentTimeMillis();
            long j10 = this.f8651c;
            long j11 = 1 + j10;
            long j12 = this.f8653e;
            if (j12 > 0) {
                long j13 = ((currentTimeMillis - j12) + (this.f8652d * j10)) / j11;
                this.f8652d = j13;
                a.this.k("Average send frequency approximately " + (j13 / 1000) + " seconds.");
            }
            this.f8653e = currentTimeMillis;
            this.f8651c = j11;
        }

        protected Handler f() {
            HandlerThread handlerThread = new HandlerThread("com.mixpanel.android.AnalyticsWorker", 10);
            handlerThread.start();
            return new HandlerC0129a(handlerThread.getLooper());
        }

        public void g(Message message) {
            synchronized (this.f8649a) {
                Handler handler = this.f8650b;
                if (handler == null) {
                    a.this.k("Dead mixpanel worker dropping a message: " + message.what);
                } else {
                    handler.sendMessage(message);
                }
            }
        }
    }

    a(Context context) {
        this.f8640b = context;
        this.f8641c = g(context);
        i().c();
    }

    public static a h(Context context) {
        a aVar;
        Map<Context, a> map = f8638d;
        synchronized (map) {
            Context applicationContext = context.getApplicationContext();
            if (map.containsKey(applicationContext)) {
                aVar = map.get(applicationContext);
            } else {
                aVar = new a(applicationContext);
                map.put(applicationContext, aVar);
            }
        }
        return aVar;
    }

    public void k(String str) {
        f8.d.i("MixpanelAPI.Messages", str + " (Thread " + Thread.currentThread().getId() + ")");
    }

    public void l(String str, Throwable th) {
        f8.d.j("MixpanelAPI.Messages", str + " (Thread " + Thread.currentThread().getId() + ")", th);
    }

    public void c(c cVar) {
        Message obtain = Message.obtain();
        obtain.what = 7;
        obtain.obj = cVar;
        this.f8639a.g(obtain);
    }

    protected h d() {
        return new h();
    }

    public void e(c cVar) {
        Message obtain = Message.obtain();
        obtain.what = 6;
        obtain.obj = cVar;
        this.f8639a.g(obtain);
    }

    public void f(C0128a c0128a) {
        Message obtain = Message.obtain();
        obtain.what = 1;
        obtain.obj = c0128a;
        this.f8639a.g(obtain);
    }

    protected e8.d g(Context context) {
        return e8.d.k(context);
    }

    protected f8.f i() {
        return new f8.b();
    }

    public void j(b bVar) {
        Message obtain = Message.obtain();
        obtain.what = 3;
        obtain.obj = bVar;
        this.f8639a.g(obtain);
    }

    protected e8.e m(Context context) {
        return e8.e.q(context);
    }

    public void n(e eVar) {
        Message obtain = Message.obtain();
        obtain.what = 0;
        obtain.obj = eVar;
        this.f8639a.g(obtain);
    }

    public void o(c cVar) {
        Message obtain = Message.obtain();
        obtain.what = 2;
        obtain.obj = cVar.a();
        obtain.arg1 = 0;
        this.f8639a.g(obtain);
    }

    public void p(f fVar) {
        Message obtain = Message.obtain();
        obtain.what = 4;
        obtain.obj = fVar;
        this.f8639a.g(obtain);
    }

    public void q(File file) {
        Message obtain = Message.obtain();
        obtain.what = 9;
        obtain.obj = file;
        this.f8639a.g(obtain);
    }
}