xiaodi8 v1.0.0版本的 MD5 值为:6b857c57f508176c5ba1afb422bbb5a9

以下内容为反编译后的 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.j3;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.smtt.sdk.TbsListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class h extends c2 implements s1, Runnable {

    public volatile r1 f3432h;
    public File i;

    public volatile boolean f3429e = false;
    public String j = "wf4_bf";
    public String k = "wf4";
    public StringBuilder l = new StringBuilder(100);

    public p0 f3431g = new p0(8192, 5);

    public List<String> f3430f = new ArrayList();

    public class a implements t1 {

        public final File f3433a;

        public a(h hVar, File file) {
            this.f3433a = file;
        }

        @Override
        public void a(String str) {
            if (g3.a()) {
                String str2 = "upload failed:" + str;
            }
        }

        @Override
        public void b(String str) {
            this.f3433a.delete();
            if (g3.a()) {
                String str2 = "upload suc & del:" + str;
            }
        }
    }

    public h(File file) {
        this.i = file;
        if (g3.a()) {
            String str = "data dir:" + this.i.getAbsolutePath();
        }
    }

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

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

    public final void b(List<String> list) throws IOException {
        if (this.f3429e || m3.a((Collection) list) || m3.a(this.f3432h)) {
            return;
        }
        long length = this.f3432h.b().length();
        if (g3.a()) {
            String str = "wf file len:" + length;
        }
        if (length <= 51200) {
            StringBuilder sb = new StringBuilder(TbsListener.ErrorCode.INFO_CODE_MINIQB);
            sb.append("1|");
            sb.append(list.size());
            for (String str2 : list) {
                sb.append('|');
                sb.append(str2);
            }
            this.f3432h.a(sb.toString());
        }
        list.clear();
    }

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

    @Override
    public void run() {
        try {
            this.f3429e = true;
            if (this.f3432h != null) {
                this.f3432h.a();
                this.f3432h = null;
            }
            File file = new File(this.i, this.k);
            if (g3.a()) {
                String str = "upload:" + file.getName() + "," + file.length();
            }
            byte[] a2 = r2.a(z2.b(file));
            String str2 = j.f3492h ? "https://testdatalbs.sparta.html5.qq.com/tr?wf4" : "https://analytics.map.qq.com/?wf4";
            if (!j.f3489e) {
                str2 = str2.replace("https:", "http:");
            }
            j.k.a(str2, a2, new a(this, file));
            if (b()) {
                this.f3432h = new r1(new File(this.i, this.k));
                this.f3432h.a(this);
            }
        } catch (Throwable unused) {
        }
        this.f3429e = false;
    }

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

    @Override
    public void a(Message message) throws Exception {
        j3.a b2;
        if (this.i == null) {
            return;
        }
        boolean z = false;
        switch (message.what) {
            case 100:
                this.f3432h = new r1(new File(this.i, this.k));
                this.f3432h.a(this);
                byte[] b3 = z2.b(new File(this.i, this.j));
                long longValue = ((Long) p3.a("LocationSDK", "log_fc_wf_bf_create_t_ms", (Object) 0L)).longValue();
                long currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - longValue < 2592000000L && !m3.a(b3)) {
                    this.f3431g.a(b3);
                } else {
                    p3.b("LocationSDK", "log_fc_wf_bf_create_t_ms", Long.valueOf(currentTimeMillis));
                }
                a(103, 300000L);
                z2.a(new File(this.i, this.j), this.f3431g.a(), false);
                a(104, 300000L);
                return;
            case 101:
                b(this.f3430f);
                z2.a(new File(this.i, this.j), this.f3431g.a(), false);
                if (this.f3432h != null) {
                    this.f3432h.a();
                    this.f3432h = null;
                }
                c3.a(d(), 103);
                if (message.what != 101 && b()) {
                    a(103, 1800000L);
                }
                long currentTimeMillis2 = System.currentTimeMillis();
                long longValue2 = ((Long) p3.a("LocationSDK", "log_fc_wf_up_t_ms", (Object) 0L)).longValue();
                b2 = j3.b();
                if (b2 != j3.a.NETWORK_WIFI || (b2 == j3.a.NETWORK_MOBILE && (j.f3490f || j.f3491g))) {
                    z = true;
                }
                if (g3.a()) {
                    String str = "lastUpT:" + longValue2 + ",deltaT:" + (currentTimeMillis2 - longValue2) + ",network status:" + b2 + ",isUpload:" + z;
                }
                if (z) {
                    return;
                }
                if (longValue2 != 0 && currentTimeMillis2 - longValue2 >= DateUtils.ONE_DAY) {
                    a3.a("th_loc_task_t_consume", this);
                    p3.b("LocationSDK", "log_fc_wf_up_t_ms", Long.valueOf(currentTimeMillis2));
                    return;
                } else {
                    if (longValue2 == 0) {
                        p3.b("LocationSDK", "log_fc_wf_up_t_ms", Long.valueOf(currentTimeMillis2));
                        return;
                    }
                    return;
                }
            case 102:
                for (ScanResult scanResult : (List) message.obj) {
                    if (!this.f3431g.b(scanResult.BSSID)) {
                        this.f3431g.a(scanResult.BSSID);
                        this.f3430f.add(a(scanResult));
                    }
                }
                if (g3.a()) {
                    String str2 = "wf list size:" + this.f3430f.size();
                }
                if (this.f3430f.size() >= 30) {
                    b(this.f3430f);
                    return;
                }
                return;
            case 103:
                c3.a(d(), 103);
                if (message.what != 101) {
                    a(103, 1800000L);
                    break;
                }
                long currentTimeMillis22 = System.currentTimeMillis();
                long longValue22 = ((Long) p3.a("LocationSDK", "log_fc_wf_up_t_ms", (Object) 0L)).longValue();
                b2 = j3.b();
                if (b2 != j3.a.NETWORK_WIFI) {
                    break;
                }
                z = true;
                if (g3.a()) {
                }
                if (z) {
                }
                break;
            case 104:
                z2.a(new File(this.i, this.j), this.f3431g.a(), false);
                a(104, 300000L);
                return;
            default:
                return;
        }
    }

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

    @Override
    public byte[] a(byte[] bArr) {
        byte[] a2 = v2.a(r2.a(bArr), v2.a("fc_wf_up"));
        if (!m3.a(a2)) {
            byte[] encode = Base64.encode(a2, 2);
            if (!m3.a(encode)) {
                try {
                    return (new String(encode) + '$').getBytes("UTF-8");
                } catch (Throwable unused) {
                }
            }
        }
        return new byte[0];
    }
}