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

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


package c.t.m.g;

import android.net.wifi.ScanResult;
import android.os.Looper;
import android.os.Message;
import android.util.Base64;
import c.t.m.g.bw;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import kotlin.text.Typography;

public class h extends av implements ao, Runnable {
    private volatile an f;
    private File g;

    private volatile boolean f1640c = false;
    private String h = "wf4_bf";
    private String i = "wf4";
    private StringBuilder j = new StringBuilder(100);
    private s e = new s(8192, 5);

    private List<String> f1641d = new ArrayList();

    public h(File file) {
        this.g = file;
        if (bu.a()) {
            bu.a("WifiInfoPro", "data dir:" + this.g.getAbsolutePath());
        }
    }

    private String a(ScanResult scanResult) {
        this.j.setLength(0);
        try {
            StringBuilder sb = this.j;
            sb.append(scanResult.BSSID);
            sb.append(',');
            StringBuilder sb2 = this.j;
            sb2.append(Base64.encodeToString(scanResult.SSID.getBytes("UTF-8"), 2));
            sb2.append(',');
            StringBuilder sb3 = this.j;
            sb3.append(scanResult.frequency);
            sb3.append(',');
            this.j.append(Base64.encodeToString(scanResult.capabilities.getBytes("UTF-8"), 2));
        } catch (Throwable unused) {
            this.j.setLength(0);
        }
        return this.j.toString();
    }

    private void b(List<String> list) throws IOException {
        if (this.f1640c || bz.a((Collection) list) || bz.a(this.f)) {
            return;
        }
        long length = this.f.b().length();
        if (bu.a()) {
            bu.a("WifiInfoPro", "wf file len:" + length);
        }
        if (length <= 51200) {
            StringBuilder sb = new StringBuilder(500);
            sb.append("1|");
            sb.append(list.size());
            for (String str : list) {
                sb.append('|');
                sb.append(str);
            }
            this.f.a(sb.toString());
        }
        list.clear();
    }

    @Override
    public int a(Looper looper) {
        a(100, 0L);
        return 0;
    }

    @Override
    public void a() {
        bq.b(d());
        a(101, 0L);
    }

    @Override
    public void a(Message message) throws Exception {
        String str;
        bw.a a2;
        if (this.g == null) {
            return;
        }
        boolean z = false;
        switch (message.what) {
            case 100:
                this.f = new an(new File(this.g, this.i));
                this.f.a(this);
                byte[] b2 = bn.b(new File(this.g, this.h));
                long longValue = ((Long) cb.b("LocationSDK", "log_fc_wf_bf_create_t_ms", (Object) 0L)).longValue();
                long currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - longValue >= 2592000000L || bz.a(b2)) {
                    cb.a("LocationSDK", "log_fc_wf_bf_create_t_ms", Long.valueOf(currentTimeMillis));
                    str = "bf reset.";
                } else {
                    this.e.a(b2);
                    str = "bf init.";
                }
                bu.a("WifiInfoPro", str);
                a(103, Constants.ASSEMBLE_PUSH_NETWORK_INTERVAL);
                bn.a(new File(this.g, this.h), this.e.a(), false);
                a(104, Constants.ASSEMBLE_PUSH_NETWORK_INTERVAL);
                return;
            case 101:
                b(this.f1641d);
                bn.a(new File(this.g, this.h), this.e.a(), false);
                if (this.f != null) {
                    this.f.a();
                    this.f = null;
                }
                bq.b(d(), 103);
                if (message.what != 101 && e()) {
                    a(103, 1800000L);
                }
                long currentTimeMillis2 = System.currentTimeMillis();
                long longValue2 = ((Long) cb.b("LocationSDK", "log_fc_wf_up_t_ms", (Object) 0L)).longValue();
                a2 = bw.a();
                if (a2 != bw.a.NETWORK_WIFI || (a2 == bw.a.NETWORK_MOBILE && (j.f || j.g))) {
                    z = true;
                }
                if (bu.a()) {
                    bu.a("WifiInfoPro", "lastUpT:" + longValue2 + ",deltaT:" + (currentTimeMillis2 - longValue2) + ",network status:" + a2 + ",isUpload:" + z);
                }
                if (z) {
                    return;
                }
                if (longValue2 != 0 && currentTimeMillis2 - longValue2 >= 86400000) {
                    bo.a("th_loc_task_t_consume", this);
                    cb.a("LocationSDK", "log_fc_wf_up_t_ms", Long.valueOf(currentTimeMillis2));
                    return;
                } else {
                    if (longValue2 == 0) {
                        cb.a("LocationSDK", "log_fc_wf_up_t_ms", Long.valueOf(currentTimeMillis2));
                        return;
                    }
                    return;
                }
            case 102:
                for (ScanResult scanResult : (List) message.obj) {
                    if (!this.e.b(scanResult.BSSID)) {
                        this.e.a(scanResult.BSSID);
                        this.f1641d.add(a(scanResult));
                    }
                }
                if (bu.a()) {
                    bu.a("WifiInfoPro", "wf list size:" + this.f1641d.size());
                }
                if (this.f1641d.size() >= 30) {
                    b(this.f1641d);
                    return;
                }
                return;
            case 103:
                bq.b(d(), 103);
                if (message.what != 101) {
                    a(103, 1800000L);
                    break;
                }
                long currentTimeMillis22 = System.currentTimeMillis();
                long longValue22 = ((Long) cb.b("LocationSDK", "log_fc_wf_up_t_ms", (Object) 0L)).longValue();
                a2 = bw.a();
                if (a2 != bw.a.NETWORK_WIFI) {
                    break;
                }
                z = true;
                if (bu.a()) {
                }
                if (z) {
                }
                break;
            case 104:
                bn.a(new File(this.g, this.h), this.e.a(), false);
                a(104, Constants.ASSEMBLE_PUSH_NETWORK_INTERVAL);
                return;
            default:
                return;
        }
    }

    public void a(List<ScanResult> list) {
        if (!e() || bz.a((Collection) list)) {
            return;
        }
        Message obtainMessage = d().obtainMessage(102);
        obtainMessage.obj = list;
        a(obtainMessage, 0L);
    }

    @Override
    public byte[] a(byte[] bArr) {
        byte[] a2 = bk.a(bg.a(bArr), bk.a("fc_wf_up"));
        if (!bz.a(a2)) {
            byte[] encode = Base64.encode(a2, 2);
            if (!bz.a(encode)) {
                try {
                    return (new String(encode) + Typography.dollar).getBytes("UTF-8");
                } catch (Throwable unused) {
                }
            }
        }
        return new byte[0];
    }

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

    @Override
    public void run() {
        try {
            this.f1640c = true;
            if (this.f != null) {
                this.f.a();
                this.f = null;
            }
            final File file = new File(this.g, this.i);
            if (bu.a()) {
                bu.a("WifiInfoPro", "upload:" + file.getName() + Constants.ACCEPT_TIME_SEPARATOR_SP + file.length());
            }
            byte[] a2 = bg.a(bn.b(file));
            String str = j.h ? "https://testdatalbs.sparta.html5.qq.com/tr?wf4" : "https://analytics.map.qq.com/?wf4";
            if (!j.e) {
                str = str.replace("https:", "http:");
            }
            j.k.a(str, a2, new ap() {
                @Override
                public void a(String str2) {
                    file.delete();
                    if (bu.a()) {
                        bu.a("WifiInfoPro", "upload suc & del:" + str2);
                    }
                }

                @Override
                public void b(String str2) {
                    if (bu.a()) {
                        bu.a("WifiInfoPro", "upload failed:" + str2);
                    }
                }
            });
            if (e()) {
                this.f = new an(new File(this.g, this.i));
                this.f.a(this);
            }
        } finally {
            try {
            } finally {
            }
        }
    }
}