- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
252 lines
11 KiB
Java
252 lines
11 KiB
Java
package com.ea.nimble.tracking;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
|
|
import com.ea.nimble.ApplicationEnvironment;
|
|
import com.ea.nimble.ApplicationLifecycle;
|
|
import com.ea.nimble.Base;
|
|
import com.ea.nimble.Component;
|
|
import com.ea.nimble.IApplicationLifecycle;
|
|
import com.ea.nimble.Log;
|
|
import com.ea.nimble.LogSource;
|
|
import com.ea.nimble.Persistence;
|
|
import com.ea.nimble.PersistenceService;
|
|
import com.ea.nimble.SynergyEnvironment;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
class TrackingEventWrangler extends Component implements IApplicationLifecycle.ApplicationLifecycleCallbacks, LogSource, IApplicationLifecycle.ActivityEventCallbacks {
|
|
private static final String APP_VERSION_PERSISTENCE_ID = "applicationBundleVersion";
|
|
public static final String COMPONENT_ID = "com.ea.nimble.tracking.eventwrangler";
|
|
private Intent m_newIntent;
|
|
private Long m_sessionStartTimestamp;
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public String getComponentId() {
|
|
return COMPONENT_ID;
|
|
}
|
|
|
|
@Override // com.ea.nimble.LogSource
|
|
public String getLogSourceTitle() {
|
|
return "Tracking";
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
|
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
|
public boolean onBackPressed() {
|
|
return true;
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
|
public void onNewIntent(Activity activity, Intent intent) {
|
|
this.m_newIntent = intent;
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
|
public void onWindowFocusChanged(boolean z) {
|
|
}
|
|
|
|
private TrackingEventWrangler() {
|
|
}
|
|
|
|
private static void initialize() {
|
|
Log.Helper.LOGFUNCS("TrackingEventWrangler");
|
|
Base.registerComponent(new TrackingEventWrangler(), COMPONENT_ID);
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void restore() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
ApplicationLifecycle.getComponent().registerApplicationLifecycleCallbacks(this);
|
|
ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this);
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void cleanup() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
ApplicationLifecycle.getComponent().unregisterApplicationLifecycleCallbacks(this);
|
|
ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this);
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
|
public void onApplicationLaunch(Intent intent) {
|
|
if (intent.getData() != null) {
|
|
logAndCheckEvent(Tracking.EVENT_APPSTART_FROMURL);
|
|
return;
|
|
}
|
|
if (intent.getStringExtra("PushNotification") != null) {
|
|
Log.Helper.LOGI(this, "Awesome. PN launched me", new Object[0]);
|
|
HashMap hashMap = new HashMap();
|
|
addPushTNGTrackingParams(intent.getExtras(), hashMap);
|
|
if (hashMap.isEmpty()) {
|
|
logAndCheckEvent(Tracking.EVENT_APPSTART_FROMPUSH);
|
|
return;
|
|
} else {
|
|
logAndCheckEvent(Tracking.EVENT_APPSTART_FROMPUSH, hashMap);
|
|
return;
|
|
}
|
|
}
|
|
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.DOCUMENT);
|
|
String stringValue = persistenceForNimbleComponent.getStringValue(APP_VERSION_PERSISTENCE_ID);
|
|
if (stringValue == null) {
|
|
stringValue = PersistenceService.getPersistenceForNimbleComponent(COMPONENT_ID, Persistence.Storage.CACHE).getStringValue(APP_VERSION_PERSISTENCE_ID);
|
|
}
|
|
String applicationVersion = ApplicationEnvironment.getComponent().getApplicationVersion();
|
|
Log.Helper.LOGD(this, "Current app version, %s. Cached app version, %s", applicationVersion, stringValue);
|
|
if (stringValue == null) {
|
|
persistenceForNimbleComponent.setValue(APP_VERSION_PERSISTENCE_ID, applicationVersion);
|
|
logAndCheckEvent(Tracking.EVENT_APPSTART_AFTERINSTALL);
|
|
} else if (!stringValue.equals(applicationVersion)) {
|
|
persistenceForNimbleComponent.setValue(APP_VERSION_PERSISTENCE_ID, applicationVersion);
|
|
logAndCheckEvent(Tracking.EVENT_APPSTART_AFTERUPGRADE);
|
|
} else {
|
|
logAndCheckEvent(Tracking.EVENT_APPSTART_NORMAL);
|
|
}
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
|
public void onApplicationSuspend() {
|
|
logAndCheckEvent(Tracking.EVENT_SESSION_END);
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
|
public void onApplicationResume() {
|
|
if (ApplicationEnvironment.getCurrentActivity().getIntent().getData() != null) {
|
|
logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMURL);
|
|
return;
|
|
}
|
|
Intent intent = this.m_newIntent;
|
|
if (intent != null) {
|
|
if (intent.getData() != null) {
|
|
logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMURL);
|
|
} else if (this.m_newIntent.getStringExtra("PushNotification") != null) {
|
|
HashMap hashMap = new HashMap();
|
|
addPushTNGTrackingParams(this.m_newIntent.getExtras(), hashMap);
|
|
if (hashMap.isEmpty()) {
|
|
logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMPUSH);
|
|
} else {
|
|
logAndCheckEvent(Tracking.EVENT_APPRESUME_FROMPUSH, hashMap);
|
|
}
|
|
} else {
|
|
logAndCheckEvent(Tracking.EVENT_APPRESUME_NORMAL);
|
|
}
|
|
this.m_newIntent = null;
|
|
return;
|
|
}
|
|
logAndCheckEvent(Tracking.EVENT_APPRESUME_NORMAL);
|
|
}
|
|
|
|
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
|
public void onApplicationQuit() {
|
|
logAndCheckEvent(Tracking.EVENT_SESSION_END);
|
|
}
|
|
|
|
public void logAndCheckEvent(String str) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
logAndCheckEvent(str, null);
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:15:? A[RETURN, SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:9:0x0089 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private void logAndCheckEvent(java.lang.String r9, java.util.Map<java.lang.String, java.lang.String> r10) {
|
|
/*
|
|
r8 = this;
|
|
com.ea.nimble.Log.Helper.LOGFUNC(r8)
|
|
java.lang.String r0 = "com.ea.nimble.tracking"
|
|
com.ea.nimble.Component r0 = com.ea.nimble.Base.getComponent(r0)
|
|
com.ea.nimble.tracking.TrackingWrangler r0 = (com.ea.nimble.tracking.TrackingWrangler) r0
|
|
boolean r1 = com.ea.nimble.tracking.Tracking.isSessionStartEvent(r9)
|
|
r2 = 1
|
|
r3 = 0
|
|
if (r1 == 0) goto L34
|
|
java.lang.Long r1 = r8.m_sessionStartTimestamp
|
|
if (r1 == 0) goto L1f
|
|
java.lang.String r1 = "Pre-existing session start timestamp found while logging new session start! Overwriting previous session start timestamp."
|
|
java.lang.Object[] r4 = new java.lang.Object[r3]
|
|
com.ea.nimble.Log.Helper.LOGE(r8, r1, r4)
|
|
goto L26
|
|
L1f:
|
|
java.lang.String r1 = "Marking session start time."
|
|
java.lang.Object[] r4 = new java.lang.Object[r3]
|
|
com.ea.nimble.Log.Helper.LOGD(r8, r1, r4)
|
|
L26:
|
|
long r4 = java.lang.System.currentTimeMillis()
|
|
java.lang.Long r1 = java.lang.Long.valueOf(r4)
|
|
r8.m_sessionStartTimestamp = r1
|
|
r0.setSessionState(r2)
|
|
goto L86
|
|
L34:
|
|
java.lang.Long r1 = r8.m_sessionStartTimestamp
|
|
if (r1 != 0) goto L42
|
|
java.lang.String r10 = "No current session. %s will not be logged."
|
|
java.lang.Object[] r9 = new java.lang.Object[]{r9}
|
|
com.ea.nimble.Log.Helper.LOGE(r8, r10, r9)
|
|
return
|
|
L42:
|
|
boolean r1 = com.ea.nimble.tracking.Tracking.isSessionEndEvent(r9)
|
|
if (r1 == 0) goto L86
|
|
long r4 = java.lang.System.currentTimeMillis()
|
|
java.lang.Long r1 = r8.m_sessionStartTimestamp
|
|
long r6 = r1.longValue()
|
|
long r4 = r4 - r6
|
|
double r4 = (double) r4
|
|
r6 = 4652007308841189376(0x408f400000000000, double:1000.0)
|
|
double r4 = r4 / r6
|
|
java.util.Locale r1 = java.util.Locale.US
|
|
java.lang.Double r4 = java.lang.Double.valueOf(r4)
|
|
java.lang.Object[] r4 = new java.lang.Object[]{r4}
|
|
java.lang.String r5 = "%.0f"
|
|
java.lang.String r1 = java.lang.String.format(r1, r5, r4)
|
|
java.lang.String r4 = "Logging session time, %s seconds."
|
|
java.lang.Object[] r5 = new java.lang.Object[]{r1}
|
|
com.ea.nimble.Log.Helper.LOGD(r8, r4, r5)
|
|
java.util.HashMap r4 = new java.util.HashMap
|
|
r4.<init>()
|
|
java.lang.String r5 = "NIMBLESTANDARD::KEY_DURATION"
|
|
r4.put(r5, r1)
|
|
java.lang.String r1 = "NIMBLESTANDARD::SESSION_TIME"
|
|
r8.logAndCheckEvent(r1, r4)
|
|
r1 = 0
|
|
r8.m_sessionStartTimestamp = r1
|
|
goto L87
|
|
L86:
|
|
r2 = r3
|
|
L87:
|
|
if (r0 == 0) goto L91
|
|
r0.logEvent(r9, r10)
|
|
if (r2 == 0) goto L91
|
|
r0.setSessionState(r3)
|
|
L91:
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.tracking.TrackingEventWrangler.logAndCheckEvent(java.lang.String, java.util.Map):void");
|
|
}
|
|
|
|
private void addPushTNGTrackingParams(Bundle bundle, Map<String, String> map) {
|
|
Log.Helper.LOGFUNC(this);
|
|
if (bundle == null || bundle.isEmpty()) {
|
|
return;
|
|
}
|
|
if (bundle.containsKey(FCMMessageService.PushIntentExtraKeys.PUSH_ID)) {
|
|
map.put("NIMBLESTANDARD::KEY_PN_MESSAGE_ID", bundle.getString(FCMMessageService.PushIntentExtraKeys.PUSH_ID));
|
|
}
|
|
if (bundle.containsKey(FCMMessageService.PushIntentExtraKeys.PN_TYPE)) {
|
|
map.put(Tracking.KEY_PN_MESSAGE_TYPE, bundle.getString(FCMMessageService.PushIntentExtraKeys.PN_TYPE));
|
|
}
|
|
if (map == null || map.isEmpty()) {
|
|
return;
|
|
}
|
|
map.put(Tracking.KEY_PN_DEVICE_ID, SynergyEnvironment.getComponent().getEADeviceId());
|
|
}
|
|
}
|