Skip to content

Commit bedf287

Browse files
authored
Merge pull request #503 from Microsoft/develop
merge develop to master
2 parents 833d0a0 + 5b05b97 commit bedf287

File tree

42 files changed

+811
-359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+811
-359
lines changed

apps/sasquatch/src/main/java/com/microsoft/azure/mobile/sasquatch/activities/DeviceInfoActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
import android.widget.Toast;
1313

1414
import com.microsoft.azure.mobile.ingestion.models.Device;
15+
import com.microsoft.azure.mobile.sasquatch.R;
1516
import com.microsoft.azure.mobile.utils.DeviceInfoHelper;
16-
import com.microsoft.azure.mobile.utils.NetworkStateHelper;
1717
import com.microsoft.azure.mobile.utils.MobileCenterLog;
18-
import com.microsoft.azure.mobile.sasquatch.R;
18+
import com.microsoft.azure.mobile.utils.NetworkStateHelper;
1919

2020
import java.lang.reflect.Method;
2121
import java.util.ArrayList;
@@ -28,7 +28,7 @@ public class DeviceInfoActivity extends AppCompatActivity implements NetworkStat
2828
*/
2929
private static final String TAG = "DeviceInfoActivity";
3030

31-
private static final String[] METHOD_BLACK_LIST = {"getClass", "getToffset", "getType"};
31+
private static final String[] METHOD_BLACK_LIST = {"getClass"};
3232

3333
private NetworkStateHelper mNetworkStateHelper;
3434

gradle.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99

1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
12-
# suppress inspection "UnusedProperty"
1312
org.gradle.jvmargs=-Xmx2g
14-
# suppress inspection "UnusedProperty"
15-
org.gradle.daemon=true
1613

1714
# When configured, Gradle will run in incubating parallel mode.
1815
# This option should only be used with decoupled projects. More details, visit

gradle/wrapper/gradle-wrapper.jar

504 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jun 09 15:55:05 PDT 2017
1+
#Wed Aug 16 00:40:50 PDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip

gradlew

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/mobile-center-analytics/src/androidTest/java/com/microsoft/azure/mobile/analytics/AnalyticsSerializerTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.junit.Test;
2020

2121
import java.util.ArrayList;
22+
import java.util.Date;
2223
import java.util.HashMap;
2324
import java.util.List;
2425
import java.util.UUID;
@@ -47,16 +48,20 @@ public void someBatch() throws JSONException {
4748
device.setAppBuild("42");
4849
List<Log> logs = new ArrayList<>();
4950
{
50-
logs.add(new StartSessionLog());
51+
StartSessionLog startSessionLog = new StartSessionLog();
52+
startSessionLog.setTimestamp(new Date());
53+
logs.add(startSessionLog);
5154
}
5255
expectedContainer.setLogs(logs);
5356
{
5457
PageLog pageLog = new PageLog();
58+
pageLog.setTimestamp(new Date());
5559
pageLog.setName("home");
5660
logs.add(pageLog);
5761
}
5862
{
5963
PageLog pageLog = new PageLog();
64+
pageLog.setTimestamp(new Date());
6065
pageLog.setName("settings");
6166
pageLog.setProperties(new HashMap<String, String>() {{
6267
put("from", "home_menu");
@@ -66,12 +71,14 @@ public void someBatch() throws JSONException {
6671
}
6772
{
6873
EventLog eventLog = new EventLog();
74+
eventLog.setTimestamp(new Date());
6975
eventLog.setId(UUIDUtils.randomUUID());
7076
eventLog.setName("subscribe");
7177
logs.add(eventLog);
7278
}
7379
{
7480
EventLog eventLog = new EventLog();
81+
eventLog.setTimestamp(new Date());
7582
eventLog.setId(UUIDUtils.randomUUID());
7683
eventLog.setName("click");
7784
eventLog.setProperties(new HashMap<String, String>() {{

sdk/mobile-center-analytics/src/main/java/com/microsoft/azure/mobile/analytics/channel/SessionTracker.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.microsoft.azure.mobile.utils.UUIDUtils;
1313
import com.microsoft.azure.mobile.utils.storage.StorageHelper;
1414

15+
import java.util.Date;
1516
import java.util.HashSet;
1617
import java.util.Map;
1718
import java.util.NavigableMap;
@@ -124,8 +125,9 @@ public void onEnqueuingLog(@NonNull Log log, @NonNull String groupName) {
124125
* Note that it can also find the current session but that's ok: in that case that means
125126
* its a log that will be associated to current session but won't trigger expiration logic.
126127
*/
127-
if (log.getToffset() > 0) {
128-
Map.Entry<Long, UUID> pastSession = mSessions.lowerEntry(log.getToffset());
128+
Date timestamp = log.getTimestamp();
129+
if (timestamp != null) {
130+
Map.Entry<Long, UUID> pastSession = mSessions.lowerEntry(timestamp.getTime());
129131
if (pastSession != null)
130132
log.setSid(pastSession.getValue());
131133
}

sdk/mobile-center-analytics/src/test/java/com/microsoft/azure/mobile/analytics/channel/SessionTrackerTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.powermock.core.classloader.annotations.PrepareForTest;
2121
import org.powermock.modules.junit4.rule.PowerMockRule;
2222

23+
import java.util.Date;
2324
import java.util.LinkedHashSet;
2425
import java.util.Set;
2526
import java.util.UUID;
@@ -195,7 +196,7 @@ public void longSessionStartingFromBackground() {
195196
/* Background for a long time but correlating a log to first session: should not trigger new session. */
196197
{
197198
Log log = newEvent();
198-
log.setToffset(firstSessionTime + 20);
199+
log.setTimestamp(new Date(firstSessionTime + 20));
199200
mSessionTracker.onEnqueuingLog(log, TEST_GROUP);
200201
mSessionTracker.onEnqueuingLog(expectedStartSessionLog, TEST_GROUP);
201202
assertEquals(firstSid, log.getSid());
@@ -452,7 +453,7 @@ public void pastSessions() {
452453
/* Past log: correlation will fail and use current session. */
453454
{
454455
Log log = newEvent();
455-
log.setToffset(123L);
456+
log.setTimestamp(new Date(123L));
456457
mSessionTracker.onEnqueuingLog(log, TEST_GROUP);
457458
assertEquals(currentSid, log.getSid());
458459
}
@@ -461,7 +462,7 @@ public void pastSessions() {
461462
{
462463
spendTime(30000);
463464
Log log = newEvent();
464-
log.setToffset(firstSessionTime + 1);
465+
log.setTimestamp(new Date(firstSessionTime + 1));
465466
mSessionTracker.onEnqueuingLog(log, TEST_GROUP);
466467
assertEquals(currentSid, log.getSid());
467468
Set<String> sessions = StorageHelper.PreferencesStorage.getStringSet("sessions");
@@ -483,7 +484,7 @@ public void pastSessions() {
483484
{
484485
spendTime(30000);
485486
Log log = newEvent();
486-
log.setToffset(firstSessionTime + 1);
487+
log.setTimestamp(new Date(firstSessionTime + 1));
487488
mSessionTracker.onEnqueuingLog(log, TEST_GROUP);
488489
assertEquals(firstSid, log.getSid());
489490
Set<String> sessions = StorageHelper.PreferencesStorage.getStringSet("sessions");
@@ -495,7 +496,7 @@ public void pastSessions() {
495496
mSessionTracker = new SessionTracker(mChannel, TEST_GROUP);
496497
{
497498
Log log = newEvent();
498-
log.setToffset(firstSessionTime + 1);
499+
log.setTimestamp(new Date(firstSessionTime + 1));
499500
mSessionTracker.onEnqueuingLog(log, TEST_GROUP);
500501
assertEquals(firstSid, log.getSid());
501502
Set<String> sessions = StorageHelper.PreferencesStorage.getStringSet("sessions");
@@ -506,7 +507,7 @@ public void pastSessions() {
506507
/* Failed correlation without an active session will start a new session. */
507508
{
508509
Log log = newEvent();
509-
log.setToffset(1);
510+
log.setTimestamp(new Date(1));
510511
mSessionTracker.onEnqueuingLog(log, TEST_GROUP);
511512
assertNotNull(log.getSid());
512513
Set<String> sessions = StorageHelper.PreferencesStorage.getStringSet("sessions");

sdk/mobile-center-crashes/src/androidTest/java/com/microsoft/azure/mobile/crashes/ingestion/models/ErrorModelTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.junit.Assert;
1313
import org.junit.Test;
1414

15+
import java.util.Date;
1516
import java.util.UUID;
1617

1718
import static com.microsoft.azure.mobile.crashes.ingestion.models.ErrorAttachmentLog.CHARSET;
@@ -143,7 +144,7 @@ private static void checkFrames(LogSerializer serializer, ManagedErrorLog errorL
143144
public void abstractErrorLog() {
144145
MockErrorLog mockErrorLog = new MockErrorLog();
145146
compareSelfNullClass(mockErrorLog);
146-
mockErrorLog.setToffset(1L);
147+
mockErrorLog.setTimestamp(new Date(1L));
147148
checkNotEquals(mockErrorLog, new MockErrorLog());
148149
}
149150

@@ -153,16 +154,18 @@ public void managedErrorLog() throws JSONException {
153154
LogSerializer serializer = new DefaultLogSerializer();
154155
serializer.addLogFactory(ManagedErrorLog.TYPE, ManagedErrorLogFactory.getInstance());
155156

157+
Date timestamp = new Date();
156158
ManagedErrorLog errorLog1 = new ManagedErrorLog();
159+
errorLog1.setTimestamp(timestamp);
157160
ManagedErrorLog errorLog2 = new ManagedErrorLog();
161+
errorLog2.setTimestamp(timestamp);
158162

159163
compareSelfNullClass(errorLog1);
160164
checkEquals(errorLog1, errorLog2);
161165

162166
{
163167
errorLog1.setId(UUID.randomUUID());
164168
checkNotEquals(errorLog1, errorLog2);
165-
checkSerialization(errorLog1, serializer);
166169

167170
errorLog2.setId(UUID.randomUUID());
168171
checkNotEquals(errorLog1, errorLog2);
@@ -173,7 +176,6 @@ public void managedErrorLog() throws JSONException {
173176
{
174177
errorLog1.setProcessId(1);
175178
checkNotEquals(errorLog1, errorLog2);
176-
checkSerialization(errorLog1, serializer);
177179

178180
errorLog2.setProcessId(2);
179181
checkNotEquals(errorLog1, errorLog2);
@@ -184,7 +186,6 @@ public void managedErrorLog() throws JSONException {
184186
{
185187
errorLog1.setProcessName("1");
186188
checkNotEquals(errorLog1, errorLog2);
187-
checkSerialization(errorLog1, serializer);
188189

189190
errorLog2.setProcessName("2");
190191
checkNotEquals(errorLog1, errorLog2);
@@ -195,7 +196,6 @@ public void managedErrorLog() throws JSONException {
195196
{
196197
errorLog1.setParentProcessId(1);
197198
checkNotEquals(errorLog1, errorLog2);
198-
checkSerialization(errorLog1, serializer);
199199

200200
errorLog2.setParentProcessId(2);
201201
checkNotEquals(errorLog1, errorLog2);
@@ -206,7 +206,6 @@ public void managedErrorLog() throws JSONException {
206206
{
207207
errorLog1.setParentProcessName("1");
208208
checkNotEquals(errorLog1, errorLog2);
209-
checkSerialization(errorLog1, serializer);
210209

211210
errorLog2.setParentProcessName("2");
212211
checkNotEquals(errorLog1, errorLog2);
@@ -217,7 +216,6 @@ public void managedErrorLog() throws JSONException {
217216
{
218217
errorLog1.setErrorThreadId(1L);
219218
checkNotEquals(errorLog1, errorLog2);
220-
checkSerialization(errorLog1, serializer);
221219

222220
errorLog2.setErrorThreadId(2L);
223221
checkNotEquals(errorLog1, errorLog2);
@@ -228,7 +226,6 @@ public void managedErrorLog() throws JSONException {
228226
{
229227
errorLog1.setErrorThreadName("1");
230228
checkNotEquals(errorLog1, errorLog2);
231-
checkSerialization(errorLog1, serializer);
232229

233230
errorLog2.setErrorThreadName("2");
234231
checkNotEquals(errorLog1, errorLog2);
@@ -239,7 +236,6 @@ public void managedErrorLog() throws JSONException {
239236
{
240237
errorLog1.setFatal(true);
241238
checkNotEquals(errorLog1, errorLog2);
242-
checkSerialization(errorLog1, serializer);
243239

244240
errorLog2.setFatal(false);
245241
checkNotEquals(errorLog1, errorLog2);
@@ -248,14 +244,14 @@ public void managedErrorLog() throws JSONException {
248244
checkEquals(errorLog1, errorLog2);
249245
}
250246
{
251-
errorLog1.setAppLaunchTOffset(1L);
247+
errorLog1.setAppLaunchTimestamp(new Date(1L));
252248
checkNotEquals(errorLog1, errorLog2);
253249
checkSerialization(errorLog1, serializer);
254250

255-
errorLog2.setAppLaunchTOffset(2L);
251+
errorLog2.setAppLaunchTimestamp(new Date(2L));
256252
checkNotEquals(errorLog1, errorLog2);
257253

258-
errorLog2.setAppLaunchTOffset(errorLog1.getAppLaunchTOffset());
254+
errorLog2.setAppLaunchTimestamp(errorLog1.getAppLaunchTimestamp());
259255
checkEquals(errorLog1, errorLog2);
260256
}
261257
{
@@ -469,8 +465,11 @@ public void errorAttachmentLog() throws JSONException {
469465
LogSerializer serializer = new DefaultLogSerializer();
470466
serializer.addLogFactory(ErrorAttachmentLog.TYPE, ErrorAttachmentLogFactory.getInstance());
471467

468+
Date timestamp = new Date();
472469
ErrorAttachmentLog attachmentLog1 = new ErrorAttachmentLog();
470+
attachmentLog1.setTimestamp(timestamp);
473471
ErrorAttachmentLog attachmentLog2 = new ErrorAttachmentLog();
472+
attachmentLog2.setTimestamp(timestamp);
474473

475474
compareSelfNullClass(attachmentLog1);
476475
checkEquals(attachmentLog1, attachmentLog2);
@@ -550,6 +549,7 @@ public void errorAttachmentLog() throws JSONException {
550549
@Test
551550
public void deserializeInvalidBase64forErrorAttachment() throws JSONException {
552551
ErrorAttachmentLog log = new ErrorAttachmentLog();
552+
log.setTimestamp(new Date());
553553
log.setId(UUID.randomUUID());
554554
log.setErrorId(UUID.randomUUID());
555555
log.setData(new byte[0]);

sdk/mobile-center-crashes/src/main/java/com/microsoft/azure/mobile/crashes/Crashes.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.annotation.SuppressLint;
44
import android.content.Context;
5-
import android.os.SystemClock;
65
import android.support.annotation.NonNull;
76
import android.support.annotation.Nullable;
87
import android.support.annotation.VisibleForTesting;
@@ -455,7 +454,7 @@ public void onCallBack(ErrorReport report) {
455454
/**
456455
* Get initialization timestamp.
457456
*
458-
* @return initialization timestamp expressed using {@link SystemClock#elapsedRealtime()}.
457+
* @return initialization timestamp expressed using {@link System#currentTimeMillis()}.
459458
*/
460459
@VisibleForTesting
461460
synchronized long getInitializeTimestamp() {
@@ -486,7 +485,7 @@ public void run() {
486485

487486
private void initialize() {
488487
boolean enabled = isInstanceEnabled();
489-
mInitializeTimestamp = enabled ? SystemClock.elapsedRealtime() : -1;
488+
mInitializeTimestamp = enabled ? System.currentTimeMillis() : -1;
490489
if (!enabled) {
491490
if (mUncaughtExceptionHandler != null) {
492491
mUncaughtExceptionHandler.unregister();

0 commit comments

Comments
 (0)