360卫士 v7.0.0版本的 MD5 值为:43bd4833fa68f33fd0b83c22ef29ce8a

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


package com.qihoo360.mobilesafe.report;

import android.content.Context;
import com.qihoo360.mobilesafe.api.Pref;
import com.qihoo360.mobilesafe.report.persistence.FileUtils;
import defpackage.iv;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Map;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;

public class ReportConfig {
    public static final String CONFIG_FILE = "report_config.dat";
    private static final boolean DEBUG = false;
    public static final int KEY_REPORT_DISABLED = -2;
    public static final int KEY_REPORT_ENABLED = -1;
    private static final String TAG = "ReportConfig";
    public static String gPRODUCT = Pref.DEFAULT_TEMP;
    public static String gVERSION = "1.0.0.0";
    public static int gCHANNEL = ReportConst.OP_COUNT_KEY;
    public static String gUID = "";
    public static int gRandom = -1;
    public static String dataReportUrl = "http://m.s.360.cn/ps/s.php";
    public static String dataReportDir = "360/MobileSafe/persistence/";
    public static int checkReportInterval = 7200000;
    public static long realtimeTimeInterval = 28800000;
    public static long batchTimeInterval = 28800000;
    public static long historyTimeInterval = 28800000;
    public static int realtimeReportNetType = 30;
    public static int batchReportNetType = 30;
    public static int historyReportNetType = 30;
    public static int maxReportPreTime = 50;
    public static long maxBackupSize = 2097152;
    public static long minStorageSize = 52428800;
    public static int isFullUpdateForBeta = 0;
    public static final Map STAT_RATE_MAP = new HashMap();

    public static boolean setEnv(Context context, String str, String str2, int i, String str3, int i2, boolean z) {
        gPRODUCT = str;
        gVERSION = str2;
        gCHANNEL = i;
        if (str3 != null) {
            gUID = str3;
        }
        gRandom = i2;
        return reload(context, Boolean.valueOf(z));
    }

    public static boolean reload(Context context, Boolean bool) {
        FileInputStream fileInputStream;
        FileInputStream fileInputStream2;
        File fileStreamPath = context.getFileStreamPath(CONFIG_FILE);
        if (fileStreamPath.exists()) {
            if (iv.b(context, CONFIG_FILE) > iv.a(context, CONFIG_FILE)) {
                iv.a(context, CONFIG_FILE, fileStreamPath, true);
            }
        } else {
            iv.a(context, CONFIG_FILE, fileStreamPath, true);
        }
        if (!fileStreamPath.exists()) {
            return false;
        }
        try {
            fileInputStream = new FileInputStream(fileStreamPath);
        } catch (Exception e) {
            fileInputStream2 = null;
        } catch (Throwable th) {
            th = th;
            fileInputStream = null;
        }
        try {
            XmlPullParser newPullParser = XmlPullParserFactory.newInstance().newPullParser();
            newPullParser.setInput(fileInputStream, "UTF-8");
            Rule rule = null;
            for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.next()) {
                String name = newPullParser.getName();
                switch (eventType) {
                    case 2:
                        if (name.equals("Item") && newPullParser.getAttributeCount() == 2) {
                            String attributeValue = newPullParser.getAttributeValue(0);
                            String attributeValue2 = newPullParser.getAttributeValue(1);
                            if (attributeValue.equals("r_url")) {
                                dataReportUrl = attributeValue2;
                            } else if (attributeValue.equals("r_dir")) {
                                dataReportDir = attributeValue2;
                            } else if (attributeValue.equals("r_interval")) {
                                checkReportInterval = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("r_time")) {
                                realtimeTimeInterval = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("b_time")) {
                                batchTimeInterval = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("h_time")) {
                                historyTimeInterval = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("r_per_time")) {
                                maxReportPreTime = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("r_net_type")) {
                                realtimeReportNetType = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("b_net_type")) {
                                batchReportNetType = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("h_net_type")) {
                                historyReportNetType = Integer.parseInt(attributeValue2);
                            } else if (attributeValue.equals("max_backup_size")) {
                                maxBackupSize = Long.parseLong(attributeValue2);
                            } else if (attributeValue.equals("min_storage_size")) {
                                minStorageSize = Long.parseLong(attributeValue2);
                            } else if (attributeValue.equals("is_full_update_for_beta")) {
                                int parseInt = Integer.parseInt(attributeValue2);
                                isFullUpdateForBeta = parseInt;
                                if (parseInt == 1 && bool.booleanValue()) {
                                    gRandom = -1;
                                }
                            }
                        }
                        if (name.equals("r_rule") && newPullParser.getAttributeCount() == 1) {
                            String attributeName = newPullParser.getAttributeName(0);
                            String attributeValue3 = newPullParser.getAttributeValue(0);
                            rule = new Rule(null);
                            if (attributeName.equals("combo")) {
                                rule.combo = attributeValue3;
                            }
                        }
                        if (name.equals("rule") && newPullParser.getAttributeCount() == 2) {
                            String attributeValue4 = newPullParser.getAttributeValue(0);
                            String attributeValue5 = newPullParser.getAttributeValue(1);
                            if (rule != null) {
                                int parseInt2 = Integer.parseInt(attributeValue4);
                                int parseInt3 = Integer.parseInt(attributeValue5);
                                if (parseInt2 >= 1000 && parseInt3 >= 0 && rule != null) {
                                    STAT_RATE_MAP.put(String.valueOf(rule.combo) + "#" + String.valueOf(parseInt2), Integer.valueOf(parseInt3));
                                    break;
                                }
                            } else {
                                break;
                            }
                        }
                        break;
                    case 3:
                        if (name.equals("r_rule")) {
                            rule = null;
                            break;
                        } else {
                            break;
                        }
                }
            }
            FileUtils.closeQuietly(fileInputStream);
            return true;
        } catch (Exception e2) {
            fileInputStream2 = fileInputStream;
            FileUtils.closeQuietly(fileInputStream2);
            return false;
        } catch (Throwable th2) {
            th = th2;
            FileUtils.closeQuietly(fileInputStream);
            throw th;
        }
    }

    public class Rule {
        String combo;

        private Rule() {
        }

        Rule(Rule rule) {
            this();
        }
    }
}