13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846

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


package com.jirbo.adcolony;

import android.app.Activity;
import android.os.Build;
import com.adsdk.sdk.Const;
import com.jirbo.adcolony.AdManager;
import com.jirbo.adcolony.JSON;
import com.xbtsol.jynvrt161024.IConstants;
public class Analytics {
    static final long AUTOREFRESH_INTERVAL_MS = 600000;
    static Analytics instance;
    boolean active;
    JSON.JSObject properties;
    long start_time_ms;
    MonitorThread update_thread;

    public Analytics() {
        instance = this;
    }

    public void configure(String app_version) {
        if (this.properties == null) {
            try {
                this.properties = JSON.load("analytics.properties");
            } catch (Exception e) {
            }
            if (this.properties == null) {
                this.properties = new JSON.JSObject();
            }
        }
        if (!this.properties.contains("d_session_times")) {
            this.properties.set("d_session_times", new JSON.JSArray());
        }
        this.properties.set("device_os", Build.VERSION.RELEASE);
        this.properties.set("appver", app_version);
        this.properties.set(Const.PREFS_DEVICE_ID, AdColony.getDeviceID());
        this.properties.set(IConstants.IMEI, AdColony.imei);
        this.properties.set(IConstants.ANDROID_ID, AdColony.android_id);
        this.properties.set("custom_id", AdColony.getCustomID());
        this.properties.set("device_type", Build.MODEL);
        this.properties.set("app_id", AdColony.adManager().app_id);
        if (!this.properties.contains("d_plays")) {
            this.properties.set("d_plays", 0L);
        }
        if (!this.properties.contains("d_time")) {
            this.properties.set("d_time", 0L);
        }
        if (this.active) {
            AdColony.logError("Activity monitor restarted.");
        }
        this.active = true;
        this.start_time_ms = System.currentTimeMillis();
        AdColony.logDebug("Activity monitor started.");
        if (this.update_thread != null) {
            this.update_thread.terminate = true;
        }
        this.update_thread = new MonitorThread();
        new Thread(this.update_thread).start();
    }

    void saveProperties() {
        try {
            this.properties.save("analytics.properties");
        } catch (Exception e) {
            AdColony.logError("Failed to save analytics.properties");
        }
    }

    public void updateActiveStatus(boolean new_status) {
        String zone;
        AdManager.VideoZoneInfo zone_info = AdColony.adManager().findVideoZoneInfo();
        if (zone_info == null) {
            zone = "";
        } else {
            zone = zone_info.zone();
        }
        synchronized (this) {
            if (new_status) {
                if (ReportingManager.urgent && NetworkStatus.isConnected()) {
                    ReportingManager.synchronizedSubmit();
                }
            }
            if (this.active != new_status) {
                if (new_status) {
                    AdColony.logDebug("User session started.");
                } else {
                    AdColony.logDebug("User session finished.");
                }
                this.active = new_status;
                if (this.active) {
                    if (StateManager.getLastSession(zone) != null && StateManager.getLastSession(zone).longValue() != 0 && (System.currentTimeMillis() - StateManager.getLastSession(zone).longValue()) / 1000 > 300) {
                        StateManager.clearCurPlays();
                    }
                    this.start_time_ms = System.currentTimeMillis();
                    AdColony.adManager().startRefresh();
                    return;
                }
                long end_time_ms = System.currentTimeMillis();
                int seconds = (int) ((end_time_ms - this.start_time_ms) / 1000);
                StateManager.setLastSession(zone, end_time_ms);
                StateManager.saveState();
                this.properties.set("d_plays", this.properties.getInt("d_plays") + 1);
                this.properties.set("d_time", this.properties.getInt("d_time") + seconds);
                ((JSON.JSArray) this.properties.get("d_session_times")).add(new JSON.JSNumber(seconds));
                String json_data = this.properties.toJSON();
                if (json_data != null) {
                    new AnalyticsSubmission(json_data);
                }
            }
        }
    }

    public class AnalyticsSubmission implements Runnable {
        String json_data;

        AnalyticsSubmission(String json_data) {
            this.json_data = json_data;
            new Thread(this).start();
        }

        @Override
        public void run() {
            String request = "http://www.adtilt.com/clients/index.php?section=tracking&action=appTrack&adcol_version=1.9.13";
            String result = HTTPRequest.post(URLSigner.sign(request, "dinosaur"), this.json_data, "text/json");
            if (result.indexOf(" 200 ") != -1 && result.indexOf("success") != -1) {
                synchronized (Analytics.this) {
                    Analytics.this.properties.set("d_session_times", new JSON.JSArray());
                    Analytics.this.saveProperties();
                }
                return;
            }
            synchronized (Analytics.this) {
                Analytics.this.saveProperties();
            }
        }
    }

    public class MonitorThread implements Runnable {
        volatile boolean terminate = false;

        MonitorThread() {
        }

        @Override
        public void run() {
            Activity activity = AdColony.activity();
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
            }
            if (!this.terminate && !activity.isFinishing()) {
                AdColony.adManager().startRefresh();
            }
            while (true) {
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException e2) {
                }
                if (this.terminate || activity.isFinishing()) {
                    break;
                } else if (System.currentTimeMillis() - AdManager.last_refresh_time_ms > 600000) {
                    AdColony.adManager().startRefresh();
                }
            }
            ReportingManager.flush();
            StateManager.unload();
            Analytics.this.updateActiveStatus(false);
        }
    }
}