package com.flurry.android;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.location.Criteria;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.ViewGroup;
import com.flurry.org.apache.avro.file.DataFileConstants;
import com.tapjoy.TapjoyConstants;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.Thread;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;

/* loaded from: /storage/emulated/0/Documents/jadec/sources/com.UBI.A90.WW/dex-files/0.dex */
public final class FlurryAgent implements LocationListener {
    private static final String[] a = {"9774d56d682e549c", "dead00beef"};
    private static volatile String b = null;
    private static volatile String c = "http://data.flurry.com/aap.do";
    private static volatile String d = "https://data.flurry.com/aap.do";
    private static final FlurryAgent e = new FlurryAgent();
    private static long f = 10000;
    private static boolean g = true;
    private static boolean h = false;
    private static boolean i = false;
    private static boolean j = true;
    private static Criteria k = null;
    private static boolean l = false;
    private static AtomicInteger n = new AtomicInteger(0);
    private static AtomicInteger o = new AtomicInteger(0);
    private List<byte[]> A;
    private LocationManager B;
    private String C;
    private boolean E;
    private long F;
    private long H;
    private long I;
    private long J;
    private Long P;
    private int Q;
    private android.location.Location R;
    private boolean U;
    private int V;
    private int X;
    private Map<String, List<String>> Y;
    private final Handler m;
    private File p;
    private long u;
    private String w;
    private String x;
    private String y;
    private File q = null;
    private File r = null;
    private volatile boolean s = false;
    private volatile boolean t = false;
    private Map<Context, Context> v = new WeakHashMap();
    private boolean z = true;
    private Map<Integer, ByteBuffer> D = new HashMap();
    private List<byte[]> G = new ArrayList();
    private String K = "";
    private String L = "";
    private byte M = -1;
    private String N = "";
    private byte O = -1;
    private Map<String, k> S = new HashMap();
    private List<ak> T = new ArrayList();
    private List<au> W = new ArrayList();
    private be Z = new be();
    private ax aa = new ax();
    private ad ab = new ad();

    /* JADX INFO: Access modifiers changed from: package-private */
    public static /* synthetic */ void a(FlurryAgent flurryAgent, Context context, boolean z) {
        android.location.Location location = null;
        if (z) {
            try {
                location = flurryAgent.e(context);
            } catch (Throwable th) {
                bc.b("FlurryAgent", "", th);
                return;
            }
        }
        synchronized (flurryAgent) {
            flurryAgent.R = location;
        }
        byte[] f2 = f(context);
        if (f2 != null) {
            flurryAgent.D.put(Integer.valueOf(be.b), ByteBuffer.wrap(f2));
        }
        flurryAgent.k();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static /* synthetic */ void b(FlurryAgent flurryAgent, Context context) {
        boolean z;
        try {
            synchronized (flurryAgent) {
                z = !flurryAgent.s && SystemClock.elapsedRealtime() - flurryAgent.u > f && flurryAgent.G.size() > 0;
            }
            if (z) {
                flurryAgent.k();
            }
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static boolean a() {
        return e.t && e.s;
    }

    /* loaded from: /storage/emulated/0/Documents/jadec/sources/com.UBI.A90.WW/dex-files/0.dex */
    public class FlurryDefaultExceptionHandler implements Thread.UncaughtExceptionHandler {
        private Thread.UncaughtExceptionHandler a = Thread.getDefaultUncaughtExceptionHandler();

        @Override // java.lang.Thread.UncaughtExceptionHandler
        public void uncaughtException(Thread thread, Throwable th) {
            try {
                FlurryAgent.e.a(th);
            } catch (Throwable th2) {
                bc.b("FlurryAgent", "", th2);
            }
            if (this.a != null) {
                this.a.uncaughtException(thread, th);
            }
        }
    }

    final void a(Throwable th) {
        th.printStackTrace();
        String str = "";
        StackTraceElement[] stackTrace = th.getStackTrace();
        if (stackTrace != null && stackTrace.length > 0) {
            StringBuilder sb = new StringBuilder();
            if (th.getMessage() != null) {
                sb.append(" (" + th.getMessage() + ")\n");
            }
            for (int i2 = 0; i2 < stackTrace.length; i2++) {
                if (i2 != 0) {
                    sb.append('\n');
                }
                StackTraceElement stackTraceElement = stackTrace[i2];
                sb.append(stackTraceElement.getClassName()).append(".").append(stackTraceElement.getMethodName()).append(":").append(stackTraceElement.getLineNumber());
            }
            str = sb.toString();
        } else if (th.getMessage() != null) {
            str = th.getMessage();
        }
        onError("uncaught", str, th.getClass().toString());
        this.v.clear();
        a((Context) null, true);
    }

    private FlurryAgent() {
        HandlerThread handlerThread = new HandlerThread("FlurryAgent");
        handlerThread.start();
        this.m = new Handler(handlerThread.getLooper());
    }

    private void a(Context context) {
        if (!l) {
            if (!this.Z.g()) {
                bc.a("FlurryAgent", "Initializing Flurry Ads");
                n nVar = new n();
                nVar.a = this.w;
                nVar.b = this.aa;
                nVar.c = this.ab;
                nVar.d = this.K;
                nVar.e = this.L;
                this.Z.a(context, nVar);
                this.Z.l();
                bc.a("FlurryAgent", "Flurry Ads initialized");
            }
            this.Z.a(context, this.H, this.I);
            l = true;
        }
    }

    public static boolean getAd(Context context, String str, ViewGroup viewGroup, FlurryAdSize flurryAdSize, long j2) {
        if (context == null) {
            bc.b("FlurryAgent", "Context passed to getAd was null.");
            return false;
        } else if (str == null) {
            bc.b("FlurryAgent", "Ad space name passed to getAd was null.");
            return false;
        } else if (str.length() == 0) {
            bc.b("FlurryAgent", "Ad space name passed to getAd was empty.");
            return false;
        } else if (viewGroup == null) {
            bc.b("FlurryAgent", "ViewGroup passed to getAd was null.");
            return false;
        } else {
            e.a(context);
            try {
                return e.Z.a(context, str, flurryAdSize, viewGroup, j2);
            } catch (Throwable th) {
                bc.b("FlurryAgent", "", th);
                return false;
            }
        }
    }

    public static void initializeAds(Context context) {
        if (context == null) {
            bc.b("FlurryAgent", "Context passed to initializeAds was null.");
            return;
        }
        e.a(context);
        try {
            e.Z.b(context);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static boolean isAdAvailable(Context context, String str, FlurryAdSize flurryAdSize, long j2) {
        if (context == null) {
            bc.b("FlurryAgent", "Context passed to isAdAvailable was null.");
            return false;
        } else if (str == null) {
            bc.b("FlurryAgent", "Ad space name passed to isAdAvailable was null.");
            return false;
        } else if (str.length() == 0) {
            bc.b("FlurryAgent", "Ad space name passed to isAdAvailable was empty.");
            return false;
        } else {
            e.a(context);
            try {
                return e.Z.a(context, str, flurryAdSize, j2);
            } catch (Throwable th) {
                bc.b("FlurryAgent", "", th);
                return false;
            }
        }
    }

    public static boolean fetchAdsForSpace(Context context, String str, FlurryAdSize flurryAdSize) {
        if (context == null) {
            bc.b("FlurryAgent", "Context passed to fetchAdsForSpace was null.");
            return false;
        } else if (str == null) {
            bc.b("FlurryAgent", "Ad space name passed to fetchAdsForSpace was null.");
            return false;
        } else if (str.length() == 0) {
            bc.b("FlurryAgent", "Ad space name passed to fetchAdsForSpace was empty.");
            return false;
        } else {
            e.a(context);
            try {
                return e.Z.a(context, str, flurryAdSize, 0L);
            } catch (Throwable th) {
                bc.b("FlurryAgent", "", th);
                return false;
            }
        }
    }

    public static void removeAd(Context context, String str, ViewGroup viewGroup) {
        if (context == null) {
            bc.b("FlurryAgent", "Context passed to removeAd was null.");
        } else if (str == null) {
            bc.b("FlurryAgent", "Ad space name passed to removeAd was null.");
        } else if (str.length() == 0) {
            bc.b("FlurryAgent", "Ad space name passed to removeAd was empty.");
        } else if (viewGroup == null) {
            bc.b("FlurryAgent", "ViewGroup passed to removeAd was null.");
        } else {
            try {
                e.Z.a(context, viewGroup);
            } catch (Throwable th) {
                bc.b("FlurryAgent", "", th);
            }
        }
    }

    public static void enableTestAds(boolean z) {
        e.Z.a(z);
    }

    public static void setAdListener(FlurryAdListener flurryAdListener) {
        e.Z.a(flurryAdListener);
    }

    public static void setLocation(float f2, float f3) {
        e.Z.a(f2, f3);
    }

    public static void setCustomAdNetworkHandler(ICustomAdNetworkHandler iCustomAdNetworkHandler) {
        e.Z.a(iCustomAdNetworkHandler);
    }

    public static void setUserCookies(Map<String, String> map) {
        e.Z.c(map);
    }

    public static void clearUserCookies() {
        e.Z.h();
    }

    public static void setTargetingKeywords(Map<String, String> map) {
        e.Z.b(map);
    }

    public static void clearTargetingKeywords() {
        e.Z.f();
    }

    public static void setAdServerUrl(String str) {
        e.Z.b(str);
    }

    public static void setAdLogUrl(String str) {
        e.Z.c(str);
    }

    public static void sendAdLogsToServer() {
        e.Z.j();
    }

    public static void setVersionName(String str) {
        synchronized (e) {
            e.y = str;
        }
    }

    public static int getAgentVersion() {
        return 136;
    }

    public static void setReportLocation(boolean z) {
        synchronized (e) {
            e.z = z;
        }
    }

    public static void setLogEnabled(boolean z) {
        synchronized (e) {
            if (z) {
                bc.b();
            } else {
                bc.a();
            }
        }
    }

    public static void setLogLevel(int i2) {
        synchronized (e) {
            bc.a(i2);
        }
    }

    public static void setContinueSessionMillis(long j2) {
        if (j2 < 5000) {
            bc.b("FlurryAgent", "Invalid time set for session resumption: " + j2);
            return;
        }
        synchronized (e) {
            f = j2;
        }
    }

    public static void setLogEvents(boolean z) {
        synchronized (e) {
            g = z;
        }
    }

    public static void setUseHttps(boolean z) {
        h = z;
    }

    public static void setCaptureUncaughtExceptions(boolean z) {
        synchronized (e) {
            if (e.s) {
                bc.b("FlurryAgent", "Cannot setCaptureUncaughtExceptions after onStartSession");
            } else {
                j = z;
            }
        }
    }

    public static void onStartSession(Context context, String str) {
        if (context == null) {
            throw new NullPointerException("Null context");
        }
        if (str == null || str.length() == 0) {
            throw new IllegalArgumentException("Api key not specified");
        }
        try {
            e.a(context, str);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static void onEndSession(Context context) {
        if (context == null) {
            throw new NullPointerException("Null context");
        }
        try {
            e.a(context, false);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static void logEvent(String str) {
        try {
            e.a(str, (Map<String, String>) null, false);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "Failed to log event: " + str, th);
        }
    }

    public static void logEvent(String str, Map<String, String> map) {
        try {
            e.a(str, map, false);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "Failed to log event: " + str, th);
        }
    }

    public static void logEvent(String str, boolean z) {
        try {
            e.a(str, (Map<String, String>) null, z);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "Failed to log event: " + str, th);
        }
    }

    public static void logEvent(String str, Map<String, String> map, boolean z) {
        try {
            e.a(str, map, z);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "Failed to log event: " + str, th);
        }
    }

    public static void endTimedEvent(String str) {
        try {
            e.a(str);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "Failed to signify the end of event: " + str, th);
        }
    }

    public static void onError(String str, String str2, String str3) {
        try {
            e.a(str, str2, str3);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static void onEvent(String str) {
        try {
            e.a(str, (Map<String, String>) null, false);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static void onEvent(String str, Map<String, String> map) {
        try {
            e.a(str, map, false);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static void onPageView() {
        try {
            e.h();
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    public static boolean getUseHttps() {
        return h;
    }

    public static void setReportUrl(String str) {
        b = str;
    }

    public static void setLocationCriteria(Criteria criteria) {
        synchronized (e) {
            k = criteria;
        }
    }

    public static void setAge(int i2) {
        if (i2 > 0 && i2 < 110) {
            Date date = new Date(new Date(System.currentTimeMillis() - (i2 * 31449600000L)).getYear(), 1, 1);
            e.P = Long.valueOf(date.getTime());
        }
    }

    public static void setGender(byte b2) {
        switch (b2) {
            case 0:
            case 1:
                e.O = b2;
                return;
            default:
                e.O = (byte) -1;
                return;
        }
    }

    public static void setUserId(String str) {
        synchronized (e) {
            e.N = y.a(str);
        }
    }

    public static boolean getForbidPlaintextFallback() {
        return false;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public static boolean isCaptureUncaughtExceptions() {
        return j;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static be b() {
        return e.Z;
    }

    private synchronized void a(Context context, String str) {
        if (this.w != null && !this.w.equals(str)) {
            bc.b("FlurryAgent", "onStartSession called with different api keys: " + this.w + " and " + str);
        }
        if (this.v.put(context, context) != null) {
            bc.d("FlurryAgent", "onStartSession called with duplicate context, use a specific Activity or Service as context instead of using a global context");
        }
        if (!this.s) {
            bc.a("FlurryAgent", "Initializing Flurry session");
            n.set(0);
            o.set(0);
            this.w = str;
            this.q = context.getFileStreamPath(".flurryagent." + Integer.toString(this.w.hashCode(), 16));
            this.p = context.getFileStreamPath(".flurryb.");
            this.r = context.getFileStreamPath(".flurryinstallreceiver.");
            if (j) {
                Thread.setDefaultUncaughtExceptionHandler(new FlurryDefaultExceptionHandler());
            }
            Context applicationContext = context.getApplicationContext();
            if (this.y == null) {
                this.y = d(applicationContext);
            }
            String packageName = applicationContext.getPackageName();
            if (this.x != null && !this.x.equals(packageName)) {
                bc.b("FlurryAgent", "onStartSession called from different application packages: " + this.x + " and " + packageName);
            }
            this.x = packageName;
            long elapsedRealtime = SystemClock.elapsedRealtime();
            if (elapsedRealtime - this.u > f) {
                bc.a("FlurryAgent", "New session");
                this.H = System.currentTimeMillis();
                this.I = elapsedRealtime;
                this.J = -1L;
                this.N = "";
                this.Q = 0;
                this.R = null;
                this.L = TimeZone.getDefault().getID();
                this.K = Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
                this.S = new HashMap();
                this.T = new ArrayList();
                this.U = true;
                this.W = new ArrayList();
                this.V = 0;
                this.X = 0;
                if (l) {
                    this.Z.a(context, this.H, this.I);
                }
                a(new e(this, applicationContext, this.z));
            } else {
                bc.a("FlurryAgent", "Continuing previous session");
                if (!this.G.isEmpty()) {
                    this.G.remove(this.G.size() - 1);
                }
                if (l) {
                    this.Z.a(context);
                }
            }
            this.s = true;
        }
    }

    private synchronized void a(Context context, boolean z) {
        if (context != null) {
            if (this.v.remove(context) == null) {
                bc.d("FlurryAgent", "onEndSession called without context from corresponding onStartSession");
            }
        }
        if (this.s && this.v.isEmpty()) {
            bc.a("FlurryAgent", "Ending session");
            n();
            Context applicationContext = context == null ? null : context.getApplicationContext();
            if (context != null) {
                String packageName = applicationContext.getPackageName();
                if (!this.x.equals(packageName)) {
                    bc.b("FlurryAgent", "onEndSession called from different application package, expected: " + this.x + " actual: " + packageName);
                }
            }
            long elapsedRealtime = SystemClock.elapsedRealtime();
            this.u = elapsedRealtime;
            this.J = elapsedRealtime - this.I;
            if (o() == null) {
                bc.b("FlurryAgent", "Not creating report because of bad Android ID or generated ID is null");
            }
            a(new a(this, z, applicationContext));
            if (l) {
                this.Z.a();
            }
            this.s = false;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public synchronized void g() {
        DataOutputStream dataOutputStream;
        DataOutputStream dataOutputStream2 = null;
        try {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            dataOutputStream = new DataOutputStream(byteArrayOutputStream);
            try {
                dataOutputStream.writeShort(1);
                dataOutputStream.writeUTF(this.y);
                dataOutputStream.writeLong(this.H);
                dataOutputStream.writeLong(this.J);
                dataOutputStream.writeLong(0L);
                dataOutputStream.writeUTF(this.K);
                dataOutputStream.writeUTF(this.L);
                dataOutputStream.writeByte(this.M);
                dataOutputStream.writeUTF(this.N == null ? "" : this.N);
                if (this.R == null) {
                    dataOutputStream.writeBoolean(false);
                } else {
                    dataOutputStream.writeBoolean(true);
                    dataOutputStream.writeDouble(a(this.R.getLatitude()));
                    dataOutputStream.writeDouble(a(this.R.getLongitude()));
                    dataOutputStream.writeFloat(this.R.getAccuracy());
                }
                dataOutputStream.writeInt(this.X);
                dataOutputStream.writeByte(-1);
                dataOutputStream.writeByte(-1);
                dataOutputStream.writeByte(this.O);
                if (this.P == null) {
                    dataOutputStream.writeBoolean(false);
                } else {
                    dataOutputStream.writeBoolean(true);
                    dataOutputStream.writeLong(this.P.longValue());
                }
                dataOutputStream.writeShort(this.S.size());
                for (Map.Entry<String, k> entry : this.S.entrySet()) {
                    dataOutputStream.writeUTF(entry.getKey());
                    dataOutputStream.writeInt(entry.getValue().a);
                }
                dataOutputStream.writeShort(this.T.size());
                for (ak akVar : this.T) {
                    dataOutputStream.write(akVar.a());
                }
                dataOutputStream.writeBoolean(this.U);
                int i2 = 0;
                int i3 = 0;
                for (int i4 = 0; i4 < this.W.size() && (i3 = i3 + this.W.get(i4).a().length) <= 16000; i4++) {
                    i2++;
                }
                dataOutputStream.writeInt(this.Q);
                dataOutputStream.writeShort(i2);
                for (int i5 = 0; i5 < i2; i5++) {
                    dataOutputStream.write(this.W.get(i5).a());
                }
                dataOutputStream.writeShort(0);
                dataOutputStream.writeShort(0);
                this.G.add(byteArrayOutputStream.toByteArray());
                y.a(dataOutputStream);
            } catch (IOException e2) {
                e = e2;
                dataOutputStream2 = dataOutputStream;
                try {
                    bc.b("FlurryAgent", "", e);
                    y.a(dataOutputStream2);
                } catch (Throwable th) {
                    th = th;
                    dataOutputStream = dataOutputStream2;
                    y.a(dataOutputStream);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
                y.a(dataOutputStream);
                throw th;
            }
        } catch (IOException e3) {
            e = e3;
        } catch (Throwable th3) {
            th = th3;
            dataOutputStream = null;
        }
    }

    private static double a(double d2) {
        return Math.round(d2 * 1000.0d) / 1000.0d;
    }

    private void a(Runnable runnable) {
        this.m.post(runnable);
    }

    private synchronized void h() {
        this.X++;
    }

    private synchronized void a(String str, Map<String, String> map, boolean z) {
        if (this.T == null) {
            bc.b("FlurryAgent", "onEvent called before onStartSession.  Event: " + str);
        } else {
            long elapsedRealtime = SystemClock.elapsedRealtime() - this.I;
            String a2 = y.a(str);
            if (a2.length() != 0) {
                k kVar = this.S.get(a2);
                if (kVar == null) {
                    if (this.S.size() < 100) {
                        k kVar2 = new k();
                        kVar2.a = 1;
                        this.S.put(a2, kVar2);
                        bc.a("FlurryAgent", "Event count incremented: " + a2);
                    } else if (bc.a("FlurryAgent")) {
                        bc.a("FlurryAgent", "Too many different events. Event not counted: " + a2);
                    }
                } else {
                    kVar.a++;
                    bc.a("FlurryAgent", "Event count incremented: " + a2);
                }
                if (g && this.T.size() < 200 && this.V < 16000) {
                    Map<String, String> emptyMap = map == null ? Collections.emptyMap() : map;
                    if (emptyMap.size() > 10) {
                        if (bc.a("FlurryAgent")) {
                            bc.a("FlurryAgent", "MaxEventParams exceeded: " + emptyMap.size());
                        }
                    } else {
                        ak akVar = new ak(n.incrementAndGet(), a2, emptyMap, elapsedRealtime, z);
                        if (akVar.a().length + this.V <= 16000) {
                            this.T.add(akVar);
                            this.V = akVar.a().length + this.V;
                            bc.a("FlurryAgent", "Logged event: " + a2);
                        } else {
                            this.V = DataFileConstants.DEFAULT_SYNC_INTERVAL;
                            this.U = false;
                            bc.a("FlurryAgent", "Event Log size exceeded. No more event details logged.");
                        }
                    }
                } else {
                    this.U = false;
                }
            }
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:8:0x0019, code lost:
        r0.a(android.os.SystemClock.elapsedRealtime() - r5.I);
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private synchronized void a(java.lang.String r6) {
        /*
            r5 = this;
            monitor-enter(r5)
            java.util.List<com.flurry.android.ak> r0 = r5.T     // Catch: java.lang.Throwable -> L25
            java.util.Iterator r1 = r0.iterator()     // Catch: java.lang.Throwable -> L25
        L7:
            boolean r0 = r1.hasNext()     // Catch: java.lang.Throwable -> L25
            if (r0 == 0) goto L23
            java.lang.Object r0 = r1.next()     // Catch: java.lang.Throwable -> L25
            com.flurry.android.ak r0 = (com.flurry.android.ak) r0     // Catch: java.lang.Throwable -> L25
            boolean r2 = r0.a(r6)     // Catch: java.lang.Throwable -> L25
            if (r2 == 0) goto L7
            long r1 = android.os.SystemClock.elapsedRealtime()     // Catch: java.lang.Throwable -> L25
            long r3 = r5.I     // Catch: java.lang.Throwable -> L25
            long r1 = r1 - r3
            r0.a(r1)     // Catch: java.lang.Throwable -> L25
        L23:
            monitor-exit(r5)
            return
        L25:
            r0 = move-exception
            monitor-exit(r5)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.flurry.android.FlurryAgent.a(java.lang.String):void");
    }

    private synchronized void a(String str, String str2, String str3) {
        au auVar;
        if (this.W == null) {
            bc.b("FlurryAgent", "onError called before onStartSession.  Error: " + str);
        } else {
            boolean z = str != null && "uncaught".equals(str);
            this.Q++;
            if (this.W.size() < 50) {
                this.W.add(new au(o.incrementAndGet(), Long.valueOf(System.currentTimeMillis()).longValue(), str, str2, str3));
                bc.a("FlurryAgent", "Error logged: " + auVar.b());
            } else if (z) {
                int i2 = 0;
                while (true) {
                    if (i2 >= this.W.size()) {
                        break;
                    }
                    au auVar2 = this.W.get(i2);
                    if (auVar2.b() == null || "uncaught".equals(auVar2.b())) {
                        i2++;
                    } else {
                        this.W.set(i2, new au(o.incrementAndGet(), Long.valueOf(System.currentTimeMillis()).longValue(), str, str2, str3));
                        break;
                    }
                }
            } else {
                bc.a("FlurryAgent", "Max errors logged. No more errors logged.");
            }
        }
    }

    /*  JADX ERROR: JadxRuntimeException in pass: j0
        jadx.core.utils.exceptions.JadxRuntimeException: Found unreachable blocks
        	at n9.r0.h(SourceFile:36)
        	at n9.r0.e(SourceFile:1)
        	at n9.j0.u(SourceFile:4)
        	at n9.j0.X(SourceFile:4)
        	at n9.j0.b(SourceFile:18)
        */
    private synchronized byte[] i() {
        /*
            Method dump skipped, instructions count: 541
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.flurry.android.FlurryAgent.i():byte[]");
    }

    private static String j() {
        if (b != null) {
            return b;
        }
        if (i) {
            return c;
        }
        if (h) {
            return d;
        }
        return c;
    }

    private boolean a(byte[] bArr) {
        boolean z;
        String j2 = j();
        if (j2 == null) {
            return false;
        }
        try {
            z = a(bArr, j2);
        } catch (Exception e2) {
            bc.a("FlurryAgent", "Sending report exception: " + e2.getMessage());
            z = false;
        }
        if (!z && b == null && h && !i) {
            synchronized (e) {
                i = true;
                String j3 = j();
                if (j3 == null) {
                    z = false;
                } else {
                    try {
                        z = a(bArr, j3);
                    } catch (Exception e3) {
                    }
                }
            }
            return z;
        }
        return z;
    }

    private boolean a(byte[] bArr, String str) {
        boolean z = true;
        if (!"local".equals(str)) {
            bc.a("FlurryAgent", "Sending report to: " + str);
            ByteArrayEntity byteArrayEntity = new ByteArrayEntity(bArr);
            byteArrayEntity.setContentType("application/octet-stream");
            HttpPost httpPost = new HttpPost(str);
            httpPost.setEntity(byteArrayEntity);
            HttpParams basicHttpParams = new BasicHttpParams();
            HttpConnectionParams.setConnectionTimeout(basicHttpParams, 10000);
            HttpConnectionParams.setSoTimeout(basicHttpParams, 15000);
            httpPost.getParams().setBooleanParameter("http.protocol.expect-continue", false);
            int statusCode = this.aa.a(basicHttpParams).execute(httpPost).getStatusLine().getStatusCode();
            synchronized (this) {
                if (statusCode == 200) {
                    bc.a("FlurryAgent", "Report successful");
                    this.E = true;
                    this.G.removeAll(this.A);
                } else {
                    bc.a("FlurryAgent", "Report failed. HTTP response: " + statusCode);
                    z = false;
                }
                this.A = null;
            }
        }
        return z;
    }

    private void k() {
        try {
            bc.a("FlurryAgent", "generating report");
            byte[] i2 = i();
            if (i2 != null) {
                if (a(i2)) {
                    bc.a("FlurryAgent", "Done sending " + (this.s ? "initial " : "") + "agent report");
                    m();
                }
            } else {
                bc.a("FlurryAgent", "Error generating report");
            }
        } catch (IOException e2) {
            bc.a("FlurryAgent", "", e2);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:14:0x004b A[Catch: Throwable -> 0x00b0, TryCatch #3 {, blocks: (B:3:0x0001, B:5:0x000d, B:11:0x0044, B:17:0x005a, B:19:0x005e, B:20:0x006c, B:22:0x007b, B:24:0x0083, B:25:0x0086, B:46:0x00c1, B:32:0x009b, B:45:0x00b9, B:31:0x0094, B:12:0x0047, B:14:0x004b, B:16:0x0053, B:41:0x00a8), top: B:53:0x0001 }] */
    /* JADX WARN: Removed duplicated region for block: B:19:0x005e A[Catch: all -> 0x009f, TryCatch #3 {, blocks: (B:3:0x0001, B:5:0x000d, B:11:0x0044, B:17:0x005a, B:19:0x005e, B:20:0x006c, B:22:0x007b, B:24:0x0083, B:25:0x0086, B:46:0x00c1, B:32:0x009b, B:45:0x00b9, B:31:0x0094, B:12:0x0047, B:14:0x004b, B:16:0x0053, B:41:0x00a8), top: B:53:0x0001 }] */
    /* JADX WARN: Removed duplicated region for block: B:46:0x00c1 A[Catch: all -> 0x009f, TRY_LEAVE, TryCatch #3 {, blocks: (B:3:0x0001, B:5:0x000d, B:11:0x0044, B:17:0x005a, B:19:0x005e, B:20:0x006c, B:22:0x007b, B:24:0x0083, B:25:0x0086, B:46:0x00c1, B:32:0x009b, B:45:0x00b9, B:31:0x0094, B:12:0x0047, B:14:0x004b, B:16:0x0053, B:41:0x00a8), top: B:53:0x0001 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public synchronized void b(android.content.Context r6) {
        /*
            r5 = this;
            monitor-enter(r5)
            java.lang.String r3 = r5.c(r6)     // Catch: java.lang.Throwable -> L9f
            java.io.File r0 = r5.q     // Catch: java.lang.Throwable -> L9f
            boolean r0 = r0.exists()     // Catch: java.lang.Throwable -> L9f
            if (r0 == 0) goto Lb9
            java.lang.String r0 = "FlurryAgent"
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L9f
            r1.<init>()     // Catch: java.lang.Throwable -> L9f
            java.lang.String r2 = "loading persistent data: "
            java.lang.StringBuilder r1 = r1.append(r2)     // Catch: java.lang.Throwable -> L9f
            java.io.File r2 = r5.q     // Catch: java.lang.Throwable -> L9f
            java.lang.String r2 = r2.getAbsolutePath()     // Catch: java.lang.Throwable -> L9f
            java.lang.StringBuilder r1 = r1.append(r2)     // Catch: java.lang.Throwable -> L9f
            java.lang.String r1 = r1.toString()     // Catch: java.lang.Throwable -> L9f
            com.flurry.android.bc.c(r0, r1)     // Catch: java.lang.Throwable -> L9f
            r2 = 0
            java.io.FileInputStream r0 = new java.io.FileInputStream     // Catch: java.lang.Throwable -> Lc8
            java.io.File r1 = r5.q     // Catch: java.lang.Throwable -> Lc8
            r0.<init>(r1)     // Catch: java.lang.Throwable -> Lc8
            java.io.DataInputStream r1 = new java.io.DataInputStream     // Catch: java.lang.Throwable -> Lc8
            r1.<init>(r0)     // Catch: java.lang.Throwable -> Lc8
            int r0 = r1.readUnsignedShort()     // Catch: java.lang.Throwable -> L93
            r2 = 46586(0xb5fa, float:6.5281E-41)
            if (r0 != r2) goto L8b
            r5.a(r1)     // Catch: java.lang.Throwable -> L93
        L44:
            com.flurry.android.y.a(r1)     // Catch: java.lang.Throwable -> L9f
        L47:
            boolean r0 = r5.t     // Catch: java.lang.Throwable -> Lb0
            if (r0 != 0) goto L5a
            java.io.File r0 = r5.q     // Catch: java.lang.Throwable -> Lb0
            boolean r0 = r0.delete()     // Catch: java.lang.Throwable -> Lb0
            if (r0 == 0) goto La8
            java.lang.String r0 = "FlurryAgent"
            java.lang.String r1 = "Deleted persistence file"
            com.flurry.android.bc.a(r0, r1)     // Catch: java.lang.Throwable -> Lb0
        L5a:
            boolean r0 = r5.t     // Catch: java.lang.Throwable -> L9f
            if (r0 != 0) goto Lc1
            r0 = 0
            r5.E = r0     // Catch: java.lang.Throwable -> L9f
            long r0 = r5.H     // Catch: java.lang.Throwable -> L9f
            r5.F = r0     // Catch: java.lang.Throwable -> L9f
            java.lang.String r0 = r5.b(r6, r3)     // Catch: java.lang.Throwable -> L9f
            r1 = 1
            r5.t = r1     // Catch: java.lang.Throwable -> L9f
        L6c:
            com.flurry.android.be r1 = r5.Z     // Catch: java.lang.Throwable -> L9f
            java.util.Map<java.lang.Integer, java.nio.ByteBuffer> r2 = r5.D     // Catch: java.lang.Throwable -> L9f
            r1.a(r2)     // Catch: java.lang.Throwable -> L9f
            java.lang.String r1 = "AND"
            boolean r1 = r0.startsWith(r1)     // Catch: java.lang.Throwable -> L9f
            if (r1 != 0) goto L86
            java.io.File r1 = r5.p     // Catch: java.lang.Throwable -> L9f
            boolean r1 = r1.exists()     // Catch: java.lang.Throwable -> L9f
            if (r1 != 0) goto L86
            r5.c(r6, r0)     // Catch: java.lang.Throwable -> L9f
        L86:
            r5.l()     // Catch: java.lang.Throwable -> L9f
            monitor-exit(r5)
            return
        L8b:
            java.lang.String r0 = "FlurryAgent"
            java.lang.String r2 = "Unexpected file type"
            com.flurry.android.bc.a(r0, r2)     // Catch: java.lang.Throwable -> L93
            goto L44
        L93:
            r0 = move-exception
        L94:
            java.lang.String r2 = "FlurryAgent"
            java.lang.String r4 = "Error when loading persistent file"
            com.flurry.android.bc.b(r2, r4, r0)     // Catch: java.lang.Throwable -> Lc6
            com.flurry.android.y.a(r1)     // Catch: java.lang.Throwable -> L9f
            goto L47
        L9f:
            r0 = move-exception
            monitor-exit(r5)
            throw r0
        La2:
            r0 = move-exception
            r1 = r2
        La4:
            com.flurry.android.y.a(r1)     // Catch: java.lang.Throwable -> L9f
            throw r0     // Catch: java.lang.Throwable -> L9f
        La8:
            java.lang.String r0 = "FlurryAgent"
            java.lang.String r1 = "Cannot delete persistence file"
            com.flurry.android.bc.b(r0, r1)     // Catch: java.lang.Throwable -> Lb0
            goto L5a
        Lb0:
            r0 = move-exception
            java.lang.String r1 = "FlurryAgent"
            java.lang.String r2 = ""
            com.flurry.android.bc.b(r1, r2, r0)     // Catch: java.lang.Throwable -> L9f
            goto L5a
        Lb9:
            java.lang.String r0 = "FlurryAgent"
            java.lang.String r1 = "Agent cache file doesn't exist."
            com.flurry.android.bc.c(r0, r1)     // Catch: java.lang.Throwable -> L9f
            goto L5a
        Lc1:
            java.lang.String r0 = r5.b(r6, r3)     // Catch: java.lang.Throwable -> L9f
            goto L6c
        Lc6:
            r0 = move-exception
            goto La4
        Lc8:
            r0 = move-exception
            r1 = r2
            goto L94
        */
        throw new UnsupportedOperationException("Method not decompiled: com.flurry.android.FlurryAgent.b(android.content.Context):void");
    }

    private String b(Context context, String str) {
        if (str == null) {
            str = "ID" + Long.toString(Double.doubleToLongBits(Math.random()) + (37 * (System.nanoTime() + (this.w.hashCode() * 37))), 16);
            bc.c("FlurryAgent", "Generated id");
        }
        d(str);
        this.Z.a(this.C);
        return str;
    }

    private void l() {
        if (this.r.exists()) {
            bc.c("FlurryAgent", "Loading referrer info from file:  " + this.r.getAbsolutePath());
            String a2 = a(this.r);
            if (a2 != null) {
                this.Y = b(a2);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x002c  */
    /* JADX WARN: Removed duplicated region for block: B:37:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private static java.lang.String a(java.io.File r7) {
        /*
            r0 = 0
            java.io.FileInputStream r3 = new java.io.FileInputStream     // Catch: java.lang.Throwable -> L3e
            r3.<init>(r7)     // Catch: java.lang.Throwable -> L3e
            java.lang.StringBuffer r2 = new java.lang.StringBuffer     // Catch: java.lang.Throwable -> L42
            r2.<init>()     // Catch: java.lang.Throwable -> L42
            r1 = 1024(0x400, float:1.435E-42)
            byte[] r1 = new byte[r1]     // Catch: java.lang.Throwable -> L1f
        Lf:
            int r4 = r3.read(r1)     // Catch: java.lang.Throwable -> L1f
            if (r4 <= 0) goto L31
            java.lang.String r5 = new java.lang.String     // Catch: java.lang.Throwable -> L1f
            r6 = 0
            r5.<init>(r1, r6, r4)     // Catch: java.lang.Throwable -> L1f
            r2.append(r5)     // Catch: java.lang.Throwable -> L1f
            goto Lf
        L1f:
            r1 = move-exception
        L20:
            java.lang.String r4 = "FlurryAgent"
            java.lang.String r5 = "Error when loading persistent file"
            com.flurry.android.bc.b(r4, r5, r1)     // Catch: java.lang.Throwable -> L3c
            com.flurry.android.y.a(r3)
        L2a:
            if (r2 == 0) goto L30
            java.lang.String r0 = r2.toString()
        L30:
            return r0
        L31:
            com.flurry.android.y.a(r3)
            goto L2a
        L35:
            r1 = move-exception
            r3 = r0
            r0 = r1
        L38:
            com.flurry.android.y.a(r3)
            throw r0
        L3c:
            r0 = move-exception
            goto L38
        L3e:
            r1 = move-exception
            r2 = r0
            r3 = r0
            goto L20
        L42:
            r1 = move-exception
            r2 = r0
            goto L20
        */
        throw new UnsupportedOperationException("Method not decompiled: com.flurry.android.FlurryAgent.a(java.io.File):java.lang.String");
    }

    private static Map<String, List<String>> b(String str) {
        HashMap hashMap = new HashMap();
        String[] split = str.split("&");
        int length = split.length;
        for (int i2 = 0; i2 < length; i2++) {
            String[] split2 = split[i2].split("=");
            if (split2.length != 2) {
                bc.a("FlurryAgent", "Invalid referrer Element: " + split[i2] + " in referrer tag " + str);
            } else {
                String decode = URLDecoder.decode(split2[0]);
                String decode2 = URLDecoder.decode(split2[1]);
                if (hashMap.get(decode) == null) {
                    hashMap.put(decode, new ArrayList());
                }
                ((List) hashMap.get(decode)).add(decode2);
            }
        }
        StringBuilder sb = new StringBuilder();
        if (hashMap.get("utm_source") == null) {
            sb.append("Campaign Source is missing.\n");
        }
        if (hashMap.get("utm_medium") == null) {
            sb.append("Campaign Medium is missing.\n");
        }
        if (hashMap.get("utm_campaign") == null) {
            sb.append("Campaign Name is missing.\n");
        }
        if (sb.length() > 0) {
            Log.w("Detected missing referrer keys", sb.toString());
        }
        return hashMap;
    }

    private synchronized void a(DataInputStream dataInputStream) {
        int i2 = 0;
        synchronized (this) {
            int readUnsignedShort = dataInputStream.readUnsignedShort();
            if (readUnsignedShort > 2) {
                bc.b("FlurryAgent", "Unknown agent file version: " + readUnsignedShort);
                throw new IOException("Unknown agent file version: " + readUnsignedShort);
            } else if (readUnsignedShort >= 2) {
                String readUTF = dataInputStream.readUTF();
                bc.a("FlurryAgent", "Loading API key: " + c(this.w));
                if (readUTF.equals(this.w)) {
                    String readUTF2 = dataInputStream.readUTF();
                    if (o() == null) {
                        bc.a("FlurryAgent", "Loading phoneId: " + readUTF2);
                    }
                    d(readUTF2);
                    this.E = dataInputStream.readBoolean();
                    this.F = dataInputStream.readLong();
                    bc.a("FlurryAgent", "Loading session reports");
                    while (true) {
                        int readUnsignedShort2 = dataInputStream.readUnsignedShort();
                        if (readUnsignedShort2 == 0) {
                            break;
                        }
                        byte[] bArr = new byte[readUnsignedShort2];
                        dataInputStream.readFully(bArr);
                        this.G.add(0, bArr);
                        i2++;
                        bc.a("FlurryAgent", "Session report added: " + i2);
                    }
                    bc.a("FlurryAgent", "Persistent file loaded");
                    this.t = true;
                } else {
                    bc.a("FlurryAgent", "Api keys do not match, old: " + c(readUTF) + ", new: " + c(this.w));
                }
            } else {
                bc.d("FlurryAgent", "Deleting old file version: " + readUnsignedShort);
            }
        }
    }

    private static String c(String str) {
        if (str != null && str.length() > 4) {
            StringBuilder sb = new StringBuilder();
            for (int i2 = 0; i2 < str.length() - 4; i2++) {
                sb.append('*');
            }
            sb.append(str.substring(str.length() - 4));
            return sb.toString();
        }
        return str;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public synchronized void m() {
        DataOutputStream dataOutputStream;
        try {
            if (ad.a(this.q)) {
                dataOutputStream = new DataOutputStream(new FileOutputStream(this.q));
                try {
                    dataOutputStream.writeShort(46586);
                    dataOutputStream.writeShort(2);
                    dataOutputStream.writeUTF(this.w);
                    dataOutputStream.writeUTF(o());
                    dataOutputStream.writeBoolean(this.E);
                    dataOutputStream.writeLong(this.F);
                    int size = this.G.size() - 1;
                    while (true) {
                        if (size < 0) {
                            break;
                        }
                        byte[] bArr = this.G.get(size);
                        int length = bArr.length;
                        if (length + 2 + dataOutputStream.size() > 50000) {
                            bc.a("FlurryAgent", "discarded sessions: " + size);
                            break;
                        }
                        dataOutputStream.writeShort(length);
                        dataOutputStream.write(bArr);
                        size--;
                    }
                    dataOutputStream.writeShort(0);
                    y.a(dataOutputStream);
                } catch (Throwable th) {
                    th = th;
                    bc.b("FlurryAgent", "", th);
                    y.a(dataOutputStream);
                }
            } else {
                y.a((Closeable) null);
            }
        } catch (Throwable th2) {
            th = th2;
            dataOutputStream = null;
        }
    }

    private synchronized void c(Context context, String str) {
        DataOutputStream dataOutputStream;
        this.p = context.getFileStreamPath(".flurryb.");
        if (ad.a(this.p)) {
            try {
                dataOutputStream = new DataOutputStream(new FileOutputStream(this.p));
            } catch (Throwable th) {
                th = th;
                dataOutputStream = null;
            }
            try {
                dataOutputStream.writeInt(1);
                dataOutputStream.writeUTF(str);
                y.a(dataOutputStream);
            } catch (Throwable th2) {
                th = th2;
                bc.b("FlurryAgent", "Error when saving b file", th);
                y.a(dataOutputStream);
            }
        }
    }

    private String c(Context context) {
        DataInputStream dataInputStream;
        boolean z = false;
        String o2 = o();
        if (o2 == null) {
            String string = Settings.System.getString(context.getContentResolver(), TapjoyConstants.TJC_ANDROID_ID);
            if (string != null && string.length() > 0 && !string.equals(DataFileConstants.NULL_CODEC)) {
                String[] strArr = a;
                int length = strArr.length;
                int i2 = 0;
                while (true) {
                    if (i2 >= length) {
                        z = true;
                        break;
                    } else if (string.equals(strArr[i2])) {
                        break;
                    } else {
                        i2++;
                    }
                }
            }
            if (z) {
                return "AND" + string;
            }
            File fileStreamPath = context.getFileStreamPath(".flurryb.");
            if (fileStreamPath.exists()) {
                try {
                    dataInputStream = new DataInputStream(new FileInputStream(fileStreamPath));
                } catch (Throwable th) {
                    th = th;
                    dataInputStream = null;
                }
                try {
                    dataInputStream.readInt();
                    return dataInputStream.readUTF();
                } catch (Throwable th2) {
                    th = th2;
                    try {
                        bc.b("FlurryAgent", "Error when loading b file", th);
                        return o2;
                    } finally {
                        y.a(dataInputStream);
                    }
                }
            }
            return o2;
        }
        return o2;
    }

    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:12:0x0027 -> B:5:0x0013). Please submit an issue!!! */
    private static String d(Context context) {
        PackageInfo packageInfo;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
        if (packageInfo.versionName != null) {
            return packageInfo.versionName;
        }
        if (packageInfo.versionCode != 0) {
            return Integer.toString(packageInfo.versionCode);
        }
        return "Unknown";
    }

    private android.location.Location e(Context context) {
        if (context.checkCallingOrSelfPermission("android.permission.ACCESS_FINE_LOCATION") == 0 || context.checkCallingOrSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == 0) {
            LocationManager locationManager = (LocationManager) context.getSystemService("location");
            synchronized (this) {
                if (this.B == null) {
                    this.B = locationManager;
                } else {
                    locationManager = this.B;
                }
            }
            Criteria criteria = k;
            if (criteria == null) {
                criteria = new Criteria();
            }
            String bestProvider = locationManager.getBestProvider(criteria, true);
            if (bestProvider != null) {
                locationManager.requestLocationUpdates(bestProvider, 0L, 0.0f, this, Looper.getMainLooper());
                return locationManager.getLastKnownLocation(bestProvider);
            }
        }
        return null;
    }

    private static byte[] f(Context context) {
        TelephonyManager telephonyManager;
        String deviceId;
        if (context.checkCallingOrSelfPermission("android.permission.READ_PHONE_STATE") == 0 && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null && (deviceId = telephonyManager.getDeviceId()) != null && deviceId.trim().length() > 0) {
            try {
                byte[] c2 = y.c(deviceId);
                if (c2 == null || c2.length != 20) {
                    bc.b("FlurryAgent", "sha1 is not 20 bytes long: " + Arrays.toString(c2));
                } else {
                    return c2;
                }
            } catch (Exception e2) {
            }
        }
        return null;
    }

    private synchronized void n() {
        if (this.B != null) {
            this.B.removeUpdates(this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static String c() {
        return e.w;
    }

    private synchronized String o() {
        return this.C;
    }

    private synchronized void d(String str) {
        if (str != null) {
            this.C = str;
        }
    }

    public static String getPhoneId() {
        return e.o();
    }

    @Override // android.location.LocationListener
    public final synchronized void onLocationChanged(android.location.Location location) {
        try {
            this.R = location;
            n();
        } catch (Throwable th) {
            bc.b("FlurryAgent", "", th);
        }
    }

    @Override // android.location.LocationListener
    public final void onProviderDisabled(String str) {
    }

    @Override // android.location.LocationListener
    public final void onProviderEnabled(String str) {
    }

    @Override // android.location.LocationListener
    public final void onStatusChanged(String str, int i2, Bundle bundle) {
    }
}
