package com.splunk.mint;

import android.app.ActivityManager.MemoryInfo;
import android.content.Context;
import java.text.DecimalFormat;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

class ActionError extends BaseDTO
  implements InterfaceDataType
{
  private JSONArray breadcrumbs;
  private String errorHash;
  private EnumStateStatus gpsStatus;
  private Boolean handled;
  private String klass;
  private String memAppAvailable;
  private String memAppMax;
  private String memAppTotal;
  private String memSysAvailable = null;
  private String memSysLow;
  private String memSysThreshold;
  private String memSysTotal = null;
  private String message;
  private Long msFromStart;
  private String stacktrace;
  private String where;

  public ActionError(EnumActionType paramEnumActionType, String paramString, EnumExceptionType paramEnumExceptionType, HashMap<String, Object> paramHashMap)
  {
    super(paramEnumActionType, paramHashMap);
    this.stacktrace = paramString;
    if (paramEnumExceptionType == EnumExceptionType.HANDLED);
    for (this.handled = Boolean.valueOf(true); ; this.handled = Boolean.valueOf(false))
    {
      HashMap localHashMap1 = StacktraceHash.manipulateStacktrace(Properties.APP_PACKAGE, paramString);
      this.klass = ((String)localHashMap1.get("klass"));
      this.message = ((String)localHashMap1.get("message"));
      this.errorHash = ((String)localHashMap1.get("errorHash"));
      this.where = ((String)localHashMap1.get("where"));
      this.gpsStatus = Properties.IS_GPS_ON;
      this.msFromStart = Utils.getMilisFromStart();
      ActivityManager.MemoryInfo localMemoryInfo = new ActivityManager.MemoryInfo();
      Runtime localRuntime = Runtime.getRuntime();
      if (!this.handled.booleanValue())
      {
        HashMap localHashMap2 = Utils.getMemoryInfo();
        this.memSysTotal = ((String)localHashMap2.get("memTotal"));
        this.memSysAvailable = ((String)localHashMap2.get("memFree"));
      }
      DecimalFormat localDecimalFormat = new DecimalFormat("#.##");
      this.memSysThreshold = String.valueOf(localDecimalFormat.format(localMemoryInfo.threshold / 1048576.0D));
      this.memSysLow = String.valueOf(localMemoryInfo.lowMemory);
      this.memAppMax = String.valueOf(localDecimalFormat.format(localRuntime.maxMemory() / 1048576.0D));
      this.memAppAvailable = String.valueOf(localDecimalFormat.format(localRuntime.freeMemory() / 1048576.0D));
      this.memAppTotal = String.valueOf(localDecimalFormat.format(localRuntime.totalMemory() / 1048576.0D));
      this.breadcrumbs = Properties.breadcrumbs.getList();
      return;
    }
  }

  public ActionError(EnumActionType paramEnumActionType, String paramString1, String paramString2, String paramString3, String paramString4, HashMap<String, Object> paramHashMap, EnumExceptionType paramEnumExceptionType)
  {
    super(paramEnumActionType, paramHashMap);
    this.stacktrace = paramString4;
    if (paramEnumExceptionType == EnumExceptionType.HANDLED);
    for (this.handled = Boolean.valueOf(true); ; this.handled = Boolean.valueOf(false))
    {
      this.klass = paramString2;
      this.message = paramString1;
      this.errorHash = StacktraceHash.getMD5ForJavascriptError(paramString4);
      this.where = ("line: " + paramString3);
      this.gpsStatus = Properties.IS_GPS_ON;
      this.msFromStart = Utils.getMilisFromStart();
      ActivityManager.MemoryInfo localMemoryInfo = new ActivityManager.MemoryInfo();
      Runtime localRuntime = Runtime.getRuntime();
      if (!this.handled.booleanValue())
      {
        HashMap localHashMap = Utils.getMemoryInfo();
        this.memSysTotal = ((String)localHashMap.get("memTotal"));
        this.memSysAvailable = ((String)localHashMap.get("memFree"));
      }
      DecimalFormat localDecimalFormat = new DecimalFormat("#.##");
      this.memSysThreshold = String.valueOf(localDecimalFormat.format(localMemoryInfo.threshold / 1048576.0D));
      this.memSysLow = String.valueOf(localMemoryInfo.lowMemory);
      this.memAppMax = String.valueOf(localDecimalFormat.format(localRuntime.maxMemory() / 1048576.0D));
      this.memAppAvailable = String.valueOf(localDecimalFormat.format(localRuntime.freeMemory() / 1048576.0D));
      this.memAppTotal = String.valueOf(localDecimalFormat.format(localRuntime.totalMemory() / 1048576.0D));
      this.breadcrumbs = Properties.breadcrumbs.getList();
      return;
    }
  }

  protected final String getErrorHash()
  {
    return this.errorHash;
  }

  public void save(DataSaver paramDataSaver)
  {
    new DataSaver().save(toJsonLine());
  }

  public void send(Context paramContext, NetSender paramNetSender, boolean paramBoolean)
  {
    paramNetSender.send(toJsonLine(), paramBoolean);
  }

  public void send(NetSender paramNetSender, boolean paramBoolean)
  {
    paramNetSender.send(toJsonLine(), paramBoolean);
  }

  public String toJsonLine()
  {
    JSONObject localJSONObject1 = getBasicDataFixtureJson();
    try
    {
      JSONObject localJSONObject2 = new JSONObject();
      localJSONObject2.put("0", this.stacktrace);
      localJSONObject1.put("stacktrace", localJSONObject2);
      localJSONObject1.put("threadCrashed", "0");
      localJSONObject1.put("handled", this.handled);
      localJSONObject1.put("klass", this.klass);
      localJSONObject1.put("message", this.message);
      localJSONObject1.put("errorHash", this.errorHash);
      localJSONObject1.put("where", this.where);
      localJSONObject1.put("rooted", this.rooted);
      localJSONObject1.put("gpsStatus", this.gpsStatus.toString());
      localJSONObject1.put("msFromStart", this.msFromStart);
      localJSONObject1.put("breadcrumbs", this.breadcrumbs);
      localJSONObject1.put("memSysLow", this.memSysLow);
      if (!this.handled.booleanValue())
      {
        localJSONObject1.put("memSysTotal", this.memSysTotal);
        localJSONObject1.put("memSysAvailable", this.memSysAvailable);
      }
      localJSONObject1.put("memSysThreshold", this.memSysThreshold);
      localJSONObject1.put("memAppMax", this.memAppMax);
      localJSONObject1.put("memAppAvailable", this.memAppAvailable);
      localJSONObject1.put("memAppTotal", this.memAppTotal);
      if (Properties.SEND_LOG)
        localJSONObject1.put("log", Utils.readLogs());
      while (true)
      {
        return localJSONObject1.toString() + Properties.getSeparator(EnumActionType.error);
        localJSONObject1.put("log", "NA");
      }
    }
    catch (JSONException localJSONException)
    {
      while (true)
        localJSONException.printStackTrace();
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.splunk.mint.ActionError
 * JD-Core Version:    0.6.2
 */