SessionEventTransform.java
4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.crashlytics.android.answers;
import android.annotation.TargetApi;
import android.os.Build.VERSION;
import io.fabric.sdk.android.services.events.EventTransform;
import java.io.IOException;
import org.json.JSONException;
import org.json.JSONObject;
class SessionEventTransform
implements EventTransform<SessionEvent>
{
static final String ADVERTISING_ID_KEY = "advertisingId";
static final String ANDROID_ID_KEY = "androidId";
static final String APP_BUNDLE_ID_KEY = "appBundleId";
static final String APP_VERSION_CODE_KEY = "appVersionCode";
static final String APP_VERSION_NAME_KEY = "appVersionName";
static final String BETA_DEVICE_TOKEN_KEY = "betaDeviceToken";
static final String BUILD_ID_KEY = "buildId";
static final String CUSTOM_ATTRIBUTES = "customAttributes";
static final String CUSTOM_TYPE = "customType";
static final String DETAILS_KEY = "details";
static final String DEVICE_MODEL_KEY = "deviceModel";
static final String EXECUTION_ID_KEY = "executionId";
static final String INSTALLATION_ID_KEY = "installationId";
static final String LIMIT_AD_TRACKING_ENABLED_KEY = "limitAdTrackingEnabled";
static final String OS_VERSION_KEY = "osVersion";
static final String PREDEFINED_ATTRIBUTES = "predefinedAttributes";
static final String PREDEFINED_TYPE = "predefinedType";
static final String TIMESTAMP_KEY = "timestamp";
static final String TYPE_KEY = "type";
@TargetApi(9)
public JSONObject buildJsonForEvent(SessionEvent paramSessionEvent)
throws IOException
{
try
{
JSONObject localJSONObject = new JSONObject();
SessionEventMetadata localSessionEventMetadata = paramSessionEvent.sessionEventMetadata;
localJSONObject.put("appBundleId", localSessionEventMetadata.appBundleId);
localJSONObject.put("executionId", localSessionEventMetadata.executionId);
localJSONObject.put("installationId", localSessionEventMetadata.installationId);
localJSONObject.put("androidId", localSessionEventMetadata.androidId);
localJSONObject.put("advertisingId", localSessionEventMetadata.advertisingId);
localJSONObject.put("limitAdTrackingEnabled", localSessionEventMetadata.limitAdTrackingEnabled);
localJSONObject.put("betaDeviceToken", localSessionEventMetadata.betaDeviceToken);
localJSONObject.put("buildId", localSessionEventMetadata.buildId);
localJSONObject.put("osVersion", localSessionEventMetadata.osVersion);
localJSONObject.put("deviceModel", localSessionEventMetadata.deviceModel);
localJSONObject.put("appVersionCode", localSessionEventMetadata.appVersionCode);
localJSONObject.put("appVersionName", localSessionEventMetadata.appVersionName);
localJSONObject.put("timestamp", paramSessionEvent.timestamp);
localJSONObject.put("type", paramSessionEvent.type.toString());
if (paramSessionEvent.details != null) {
localJSONObject.put("details", new JSONObject(paramSessionEvent.details));
}
localJSONObject.put("customType", paramSessionEvent.customType);
if (paramSessionEvent.customAttributes != null) {
localJSONObject.put("customAttributes", new JSONObject(paramSessionEvent.customAttributes));
}
localJSONObject.put("predefinedType", paramSessionEvent.predefinedType);
if (paramSessionEvent.predefinedAttributes != null) {
localJSONObject.put("predefinedAttributes", new JSONObject(paramSessionEvent.predefinedAttributes));
}
return localJSONObject;
}
catch (JSONException paramSessionEvent)
{
if (Build.VERSION.SDK_INT >= 9) {
throw new IOException(paramSessionEvent.getMessage(), paramSessionEvent);
}
throw new IOException(paramSessionEvent.getMessage());
}
}
public byte[] toBytes(SessionEvent paramSessionEvent)
throws IOException
{
return buildJsonForEvent(paramSessionEvent).toString().getBytes("UTF-8");
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/crashlytics/android/answers/SessionEventTransform.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/