Tracking.java
2.38 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 net.hockeyapp.android;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
public class Tracking
{
protected static final String START_TIME_KEY = "startTime";
protected static final String USAGE_TIME_KEY = "usageTime";
private static boolean a(Context paramContext)
{
if (Constants.APP_VERSION == null)
{
Constants.loadFromContext(paramContext);
if (Constants.APP_VERSION == null) {
return false;
}
}
return true;
}
protected static SharedPreferences getPreferences(Context paramContext)
{
return paramContext.getSharedPreferences("HockeyApp", 0);
}
public static long getUsageTime(Context paramContext)
{
if (!a(paramContext)) {
return 0L;
}
paramContext = getPreferences(paramContext);
long l = paramContext.getLong("usageTime" + Constants.APP_VERSION, 0L);
if (l < 0L)
{
paramContext.edit().remove("usageTime" + Constants.APP_VERSION).apply();
return 0L;
}
return l / 1000L;
}
public static void startUsage(Activity paramActivity)
{
long l = System.currentTimeMillis();
if (paramActivity == null) {
return;
}
SharedPreferences.Editor localEditor = getPreferences(paramActivity).edit();
localEditor.putLong("startTime" + paramActivity.hashCode(), l);
localEditor.apply();
}
public static void stopUsage(Activity paramActivity)
{
long l2 = System.currentTimeMillis();
if (paramActivity == null) {}
SharedPreferences localSharedPreferences;
long l1;
do
{
long l3;
do
{
do
{
return;
} while (!a(paramActivity));
localSharedPreferences = getPreferences(paramActivity);
l3 = localSharedPreferences.getLong("startTime" + paramActivity.hashCode(), 0L);
l1 = localSharedPreferences.getLong("usageTime" + Constants.APP_VERSION, 0L);
} while (l3 <= 0L);
l2 -= l3;
l1 += l2;
} while ((l2 <= 0L) || (l1 < 0L));
paramActivity = localSharedPreferences.edit();
paramActivity.putLong("usageTime" + Constants.APP_VERSION, l1);
paramActivity.apply();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/net/hockeyapp/android/Tracking.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/