package com.tencent.wxop.stat.event; import android.content.Context; import com.tencent.wxop.stat.StatServiceImpl; import com.tencent.wxop.stat.StatSpecifyReportedInfo; import java.util.Map; import java.util.Properties; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes.dex */ public class b extends e { protected c a; private long m; public b(Context context, int i, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) { super(context, i, statSpecifyReportedInfo); this.a = new c(); this.m = -1L; this.a.a = str; } private void h() { Properties commonKeyValueForKVEvent; String str = this.a.a; if (str == null || (commonKeyValueForKVEvent = StatServiceImpl.getCommonKeyValueForKVEvent(str)) == null || commonKeyValueForKVEvent.size() <= 0) { return; } JSONObject jSONObject = this.a.c; if (jSONObject == null || jSONObject.length() == 0) { this.a.c = new JSONObject(commonKeyValueForKVEvent); return; } for (Map.Entry entry : commonKeyValueForKVEvent.entrySet()) { try { this.a.c.put(entry.getKey().toString(), entry.getValue()); } catch (JSONException e) { e.printStackTrace(); } } } @Override // com.tencent.wxop.stat.event.e public EventType a() { return EventType.CUSTOM; } public void a(long j) { this.m = j; } @Override // com.tencent.wxop.stat.event.e public boolean a(JSONObject jSONObject) { String str; jSONObject.put("ei", this.a.a); long j = this.m; if (j > 0) { jSONObject.put("du", j); } Object obj = this.a.b; if (obj == null) { h(); obj = this.a.c; str = "kv"; } else { str = "ar"; } jSONObject.put(str, obj); return true; } public c b() { return this.a; } }