QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package c.t.m.g;

import android.location.Location;
import android.os.Build;
import android.os.Looper;
import android.os.Message;
import c.t.m.g.bw;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.mm.ui.widget.dialog.MMTipsBar;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.text.Typography;
import org.xwalk.core.XWalkAppVersion;

public class g extends av {

    private final File f1636d;
    private volatile long l;
    private volatile int m;
    private volatile int n;
    private volatile int o;
    private volatile float p;
    private volatile float q;

    private final StringBuilder f1635c = new StringBuilder();
    private volatile long e = 0;
    private volatile long f = 0;
    private final long[] g = new long[2];
    private final int[] h = new int[2];
    private ArrayList<Float> i = new ArrayList<>();
    private ArrayList<Float> j = new ArrayList<>();
    private HashSet<Integer> k = new HashSet<>();
    private AtomicBoolean r = new AtomicBoolean(false);

    public g(File file) {
        this.f1636d = file;
    }

    private void a(String str) {
        long currentTimeMillis = System.currentTimeMillis();
        if (this.f1635c.length() == 0) {
            this.f1635c.append(g());
            this.f = currentTimeMillis;
        }
        StringBuilder sb = this.f1635c;
        sb.append(Typography.dollar);
        sb.append(str);
        if (this.f1635c.length() >= 15360 || (this.f != 0 && currentTimeMillis - this.f >= 600000)) {
            int[] iArr = this.h;
            if (iArr[0] + iArr[1] >= 3) {
                b(this.f1635c.toString());
            }
            this.f1635c.setLength(0);
            Arrays.fill(this.h, 0);
        }
    }

    private void b(String str) {
        if (bz.a(str)) {
            return;
        }
        try {
            byte[] bytes = str.getBytes("UTF-8");
            byte[] a2 = l.a(bytes, 3);
            if (bu.a()) {
                bu.a("UserTrackPro", "srcBytes.len=" + bytes.length + ",encBytes.len=" + a2.length);
            }
            File file = new File(this.f1636d, "utr_" + bv.a(e.class.getName(), XWalkAppVersion.XWALK_APK_HASH_ALGORITHM).substring(0, 8) + "_" + bi.b("yyyyMMdd"));
            bn.a(file, a2, true);
            if (file.length() > 51200) {
                file.renameTo(new File(file.getParent(), file.getName() + "_" + bi.b("HHmmss")));
            }
        } catch (Throwable th) {
            if (bu.a()) {
                bu.a("UserTrackPro", "writeStrToFile error.", th);
            }
        }
    }

    private void f() {
        this.f = System.currentTimeMillis();
        this.f1635c.setLength(0);
        Arrays.fill(this.h, 0);
        Arrays.fill(this.g, 0L);
    }

    private String g() {
        String str = cc.l().replaceAll("[| _,]", "") + "_" + cc.j() + "_" + cc.m();
        String str2 = ((String) by.a(Build.MANUFACTURER, "")).replaceAll("[| _,]", "") + "_" + ((String) by.a(cc.i(), "")).replaceAll("[| _,]", "");
        String f = cc.f();
        if (bz.a(f) || "0123456789ABCDEF".equals(f)) {
            f = cc.b();
        }
        StringBuilder sb = new StringBuilder();
        sb.append("SYSTEM,");
        sb.append(System.currentTimeMillis());
        sb.append(',');
        sb.append(f);
        sb.append(',');
        sb.append(j.i == null ? "" : j.i.d());
        sb.append(',');
        sb.append(str);
        sb.append(',');
        sb.append(str2);
        sb.append(',');
        sb.append(Build.VERSION.SDK_INT);
        sb.append(',');
        sb.append(m.a());
        sb.append(',');
        sb.append(m.c());
        sb.append(',');
        sb.append(m.d().replaceAll(Constants.COLON_SEPARATOR, "").toLowerCase());
        sb.append(',');
        sb.append(m.b());
        return sb.toString();
    }

    private void h() {
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.e < DateUtils.ONE_MINUTE) {
            if (bu.a()) {
                bu.a("UserTrackPro", "last upload time: < 1min");
                return;
            }
            return;
        }
        this.e = currentTimeMillis;
        bw.a a2 = bw.a();
        boolean z = true;
        if (a2 == bw.a.NETWORK_NONE) {
            z = false;
        } else if (a2 == bw.a.NETWORK_MOBILE) {
            boolean z2 = j.f;
            if (!j.f && j.g) {
                long longValue = ((Long) cb.b("LocationSDK", "log_utr_up_in_m", Long.valueOf(currentTimeMillis))).longValue();
                if (currentTimeMillis - longValue > 86400000) {
                    cb.a("LocationSDK", "log_utr_up_in_m", Long.valueOf(currentTimeMillis));
                    if (bu.a()) {
                        bu.a("UserTrackPro", "upload in mobile once today. lastUpT=" + longValue + ",curT=" + currentTimeMillis);
                    }
                }
            }
            z = z2;
        }
        if (z) {
            bo.a("th_loc_task_t_consume", new Runnable() {
                @Override
                public void run() {
                    if (g.this.r.get()) {
                        return;
                    }
                    g.this.r.set(true);
                    try {
                        g.this.i();
                    } finally {
                        try {
                        } finally {
                        }
                    }
                }
            });
        }
    }

    public void i() {
        File file = this.f1636d;
        File[] listFiles = (file == null || !file.exists()) ? null : this.f1636d.listFiles();
        if (bz.c(listFiles)) {
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        bw.a a2 = bw.a();
        String b2 = bi.b("yyyyMMdd");
        int i = 0;
        for (final File file2 : listFiles) {
            String name = file2.getName();
            if (file2.exists() && file2.isFile() && name.startsWith("utr_") && !name.contains(b2)) {
                if (currentTimeMillis - file2.lastModified() <= 1296000000) {
                    byte[] b3 = bn.b(file2);
                    i += b3.length;
                    if (bu.a()) {
                        bu.a("UserTrackPro", "upload file:" + file2.getName() + ",len=" + b3.length + ",sum=" + i + ",netType=" + a2);
                    }
                    if (b3.length != 0) {
                        j.k.a(j(), b3, new ap() {
                            @Override
                            public void a(String str) {
                                if (bu.a()) {
                                    bu.a("UserTrackPro", "upload succeed:" + str);
                                }
                                file2.delete();
                            }

                            @Override
                            public void b(String str) {
                                if (bu.a()) {
                                    bu.b("UserTrackPro", "upload failed:" + str);
                                }
                            }
                        });
                        if (a2 == bw.a.NETWORK_MOBILE || i >= 512000) {
                            return;
                        }
                    }
                } else if (bu.a()) {
                    bu.a("UserTrackPro", "del file:" + file2.getName());
                }
                file2.delete();
            }
        }
    }

    private String j() {
        String str = j.h ? "https://testdatalbs.sparta.html5.qq.com/tr?utr" : "https://analytics.map.qq.com/tr?utr";
        return !j.e ? str.replace("https:", "http:") : str;
    }

    @Override
    public int a(Looper looper) {
        this.l = 0L;
        this.o = -1;
        this.n = -1;
        a(1001, 0L);
        return 0;
    }

    @Override
    public void a() {
        a(1002, 0L);
        this.i.clear();
        this.j.clear();
        this.k.clear();
    }

    public void a(int i, Location location) {
        synchronized (this.f1246b) {
            if (e()) {
                long currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - this.g[0] < 900) {
                    return;
                }
                this.g[0] = currentTimeMillis;
                int[] iArr = this.h;
                iArr[0] = iArr[0] + 1;
                if (location != null) {
                    try {
                    } catch (Throwable th) {
                        if (bu.a()) {
                            bu.a("UserTrackPro", "set gps loc error.", th);
                        }
                    }
                    if ("gps".equals(location.getProvider())) {
                        if (j.h || Build.VERSION.SDK_INT < 18 || !location.isFromMockProvider()) {
                            bq.a(d(), 1003, 0, 0, currentTimeMillis - this.l > MMTipsBar.DURATION_SHORT ? String.format(Locale.ENGLISH, "%d,G,%d,%d,%.6f,%.6f,%.1f,%.1f,%.1f,%.1f,-1,-1,0,-1,0", Long.valueOf(currentTimeMillis), Long.valueOf(location.getTime()), Integer.valueOf(i), Double.valueOf(location.getLatitude()), Double.valueOf(location.getLongitude()), Double.valueOf(location.getAltitude()), Float.valueOf(location.getAccuracy()), Float.valueOf(location.getSpeed()), Float.valueOf(location.getBearing())) : String.format(Locale.ENGLISH, "%d,G,%d,%d,%.6f,%.6f,%.1f,%.1f,%.1f,%.1f,%d,%d,%.2f,%d,%.2f", Long.valueOf(currentTimeMillis), Long.valueOf(location.getTime()), Integer.valueOf(i), Double.valueOf(location.getLatitude()), Double.valueOf(location.getLongitude()), Double.valueOf(location.getAltitude()), Float.valueOf(location.getAccuracy()), Float.valueOf(location.getSpeed()), Float.valueOf(location.getBearing()), Integer.valueOf(this.m), Integer.valueOf(this.n), Float.valueOf(this.p), Integer.valueOf(this.o), Float.valueOf(this.q)));
                        }
                    }
                }
            }
        }
    }

    public void a(long j) {
        if (j < 0) {
            j = 0;
        }
        a(1004, j);
    }

    public void a(long j, int i, double d2, double d3, double d4) {
    }

    @Override
    public void a(Message message) throws Exception {
        switch (message.what) {
            case 1001:
                f();
                this.e = System.currentTimeMillis() - 40000;
                a(1004, Constants.ASSEMBLE_PUSH_NETWORK_INTERVAL);
                return;
            case 1002:
                bq.b(d());
                int[] iArr = this.h;
                if (iArr[0] + iArr[1] >= 3) {
                    b(this.f1635c.toString());
                }
                f();
                break;
            case 1003:
                a((String) message.obj);
                return;
            case 1004:
                a(1004, 1800000L);
                break;
            default:
                return;
        }
        h();
    }

    @Override
    public String b() {
        return "UserTrackPro";
    }
}