BatchedAnalyticsService.java
2.31 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
89
90
91
92
93
94
package com.bitstrips.imoji.analytics;
import android.app.Activity;
import android.os.Handler;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
public abstract class BatchedAnalyticsService
implements BaseAnalyticsService
{
final LinkedHashSet<AnalyticsEventBuilder.AnalyticsEvent> a = new LinkedHashSet();
final LinkedHashSet<AnalyticsEventBuilder.AnalyticsEvent> b = new LinkedHashSet();
boolean c = false;
private final Handler d = new Handler();
private final Runnable e = new Runnable()
{
public final void run()
{
BatchedAnalyticsService.this.reportAllEvents();
}
};
private List<AnalyticsEventBuilder.AnalyticsEvent> b()
{
if (this.a.isEmpty()) {
return null;
}
synchronized (this.a)
{
Iterator localIterator = this.a.iterator();
if (localIterator.hasNext()) {
((AnalyticsEventBuilder.AnalyticsEvent)localIterator.next()).incrementRetryCount();
}
}
ArrayList localArrayList = new ArrayList(this.a);
this.a.clear();
this.b.addAll(localArrayList);
a();
return localArrayList;
}
final void a()
{
ArrayList localArrayList = new ArrayList(this.a);
localArrayList.addAll(this.b);
b(localArrayList);
}
abstract void a(List<AnalyticsEventBuilder.AnalyticsEvent> paramList);
abstract void b(List<AnalyticsEventBuilder.AnalyticsEvent> paramList);
public void logEvent(@NonNull AnalyticsEventBuilder.AnalyticsEvent paramAnalyticsEvent)
{
if (paramAnalyticsEvent.hasBeenLogged()) {
return;
}
synchronized (this.a)
{
this.a.add(paramAnalyticsEvent);
a();
if (this.a.size() >= 5) {
reportAllEvents();
}
return;
}
}
public void reportAllEvents()
{
a(b());
}
public void reportStart(@NonNull Activity paramActivity)
{
this.d.removeCallbacks(this.e);
this.d.postDelayed(this.e, 30000L);
}
public void reportStop(@NonNull Activity paramActivity)
{
reportAllEvents();
this.d.removeCallbacks(this.e);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/analytics/BatchedAnalyticsService.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/