九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e

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


package com.tmall.applink.usertracker;

import android.content.Context;
import android.util.Log;
import com.tmall.applink.appinfo.TMAppInfo;
import com.tmall.applink.util.TBAppLinkPhoneUtil;
import com.tmall.applink.util.TBAppLinkUtil;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import org.android.spdy.SpdyRequest;
public class TBMiniUserTrack {
    private CharSequence appkey;
    public CharSequence imei;
    private CharSequence path = "http://mobile.tmall.com/mobile/api/applink.do";
    private List<CharSequence> messages = new ArrayList(30);

    public TBMiniUserTrack(Context context, CharSequence charSequence) {
        this.imei = "unkown";
        try {
            this.appkey = charSequence;
            this.imei = TBAppLinkPhoneUtil.getImei(context);
        } catch (Exception e) {
            Log.d("TBMiniUserTrack", e.getStackTrace().toString());
        }
    }

    public void commitEvent(CharSequence charSequence) {
        synchronized (this) {
            this.messages.add(charSequence);
        }
    }

    public void commitEventAndFlush(CharSequence charSequence) {
        synchronized (this) {
            commitEvent(charSequence);
            try {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        TBMiniUserTrack.this.flush();
                    }
                }).start();
            } catch (Exception e) {
                Log.d("TBMiniUserTrack", "TBMiniUserTrack flush exception" + e.getStackTrace().toString());
            }
        }
    }

    public void flush() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("logtype=2&wappkey=").append(this.appkey).append("&packagename=").append(TMAppInfo.getPackageName(TBAppLinkUtil.getApplication())).append("&os=android&imei=").append(this.imei).append("&t=").append(System.currentTimeMillis()).append("&type=");
        if (this.messages.size() > 0) {
            stringBuffer.append(this.messages.get(0));
        }
        this.messages.clear();
        Log.d("TBMiniUserTrack", "TBMiniUserTrack flush content" + stringBuffer.toString());
        HttpURLConnection httpURLConnection = null;
        try {
            HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL(String.valueOf(this.path)).openConnection();
            try {
                httpURLConnection2.setRequestMethod(SpdyRequest.POST_METHOD);
                httpURLConnection2.setDoOutput(true);
                httpURLConnection2.setDoInput(true);
                httpURLConnection2.setConnectTimeout(5000);
                httpURLConnection2.setReadTimeout(5000);
                OutputStream outputStream = httpURLConnection2.getOutputStream();
                outputStream.write(URLEncoder.encode(stringBuffer.toString(), "UTF-8").getBytes());
                outputStream.flush();
                outputStream.close();
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection2.getInputStream()));
                String str = "";
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str = str + "\n" + readLine;
                }
                Log.d("TBMiniUserTrack", "TBMiniUserTrack flush response" + str);
                if (httpURLConnection2 != null) {
                    httpURLConnection2.disconnect();
                }
            } catch (Throwable th) {
                httpURLConnection = httpURLConnection2;
                th = th;
                try {
                    Log.d("TBMiniUserTrack", "TBMiniUserTrack flush exception" + th.getStackTrace().toString());
                } finally {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                }
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }
}