Skip to content

Commit 208a176

Browse files
authored
Merge pull request #1424 from microsoft/develop
Version 3.2.2
2 parents 682d544 + c08f58d commit 208a176

File tree

11 files changed

+142
-158
lines changed

11 files changed

+142
-158
lines changed

.github/workflows/codeql.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Code Scanning - Action"
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: '0 0 * * 0'
7+
8+
jobs:
9+
CodeQL-Build:
10+
11+
strategy:
12+
fail-fast: false
13+
14+
15+
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
16+
runs-on: windows-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
21+
22+
# Initializes the CodeQL tools for scanning.
23+
- name: Initialize CodeQL
24+
uses: github/codeql-action/init@v1
25+
# Override language selection by uncommenting this and choosing your languages
26+
with:
27+
languages: java
28+
29+
# ℹ️ Command-line programs to run using the OS shell.
30+
# 📚 https://git.io/JvXDl
31+
32+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
33+
# and modify them (or add more) to build your code if your project
34+
# uses a compiled language
35+
- run: |
36+
echo "Downloading submodules"
37+
git submodule update --init --recursive
38+
39+
- run: |
40+
echo "Assemble modules"
41+
./gradlew :sdk:appcenter:assemble :sdk:appcenter-analytics:assemble :sdk:appcenter-crashes:assemble :sdk:appcenter-distribute:assemble :sdk:appcenter-push:assemble
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v1

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# App Center SDK for Android Change Log
22

3+
## Version 3.2.2
4+
5+
### App Center
6+
7+
* **[Fix]** Fix possible delays in UI thread when queueing a large number of events.
8+
9+
___
10+
311
## Version 3.2.1
412

513
### App Center Distribute

sdk/appcenter-analytics/src/main/java/com/microsoft/appcenter/analytics/Analytics.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ protected static void trackPage(String name, Map<String, String> properties) {
319319
* Additional validation rules apply depending on the configured secret.
320320
* <p>
321321
* For App Center, the name cannot be longer than 256 and is truncated otherwise.
322-
* For One Collector, the name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.
322+
* For One Collector, the name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.
323323
*
324324
* @param name An event name.
325325
*/
@@ -346,8 +346,8 @@ public static void trackEvent(String name) {
346346
* <p>
347347
* For One Collector:
348348
* <ul>
349-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
350-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
349+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
350+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
351351
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
352352
* </ul>
353353
*
@@ -377,8 +377,8 @@ public static void trackEvent(String name, Map<String, String> properties) {
377377
* <p>
378378
* For One Collector:
379379
* <ul>
380-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
381-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
380+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
381+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
382382
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
383383
* </ul>
384384
*
@@ -415,8 +415,8 @@ public static void trackEvent(String name, Map<String, String> properties, int f
415415
* <p>
416416
* For One Collector:
417417
* <ul>
418-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
419-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
418+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
419+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
420420
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
421421
* </ul>
422422
*
@@ -448,8 +448,8 @@ public static void trackEvent(String name, EventProperties properties) {
448448
* <p>
449449
* For One Collector:
450450
* <ul>
451-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
452-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
451+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
452+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
453453
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
454454
* </ul>
455455
*
@@ -632,6 +632,7 @@ protected long getTriggerInterval() {
632632
*
633633
* @param activity current activity.
634634
*/
635+
@WorkerThread
635636
private void processOnResume(Activity activity) {
636637
if (mSessionTracker != null) {
637638
mSessionTracker.onActivityResumed();

sdk/appcenter-analytics/src/main/java/com/microsoft/appcenter/analytics/AnalyticsTransmissionTarget.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private static void updateProvider(AuthenticationProvider authenticationProvider
154154
* Track a custom event with name.
155155
* <p>
156156
* The name cannot be null and needs to match the
157-
* <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.
157+
* <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.
158158
*
159159
* @param name An event name.
160160
*/
@@ -167,9 +167,9 @@ public void trackEvent(String name) {
167167
* <p>
168168
* The following rules apply:
169169
* <ul>
170-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
170+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
171171
* <li>The property names or values cannot be null.</li>
172-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
172+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
173173
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
174174
* </ul>
175175
*
@@ -185,9 +185,9 @@ public void trackEvent(String name, Map<String, String> properties) {
185185
* <p>
186186
* The following rules apply:
187187
* <ul>
188-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
188+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
189189
* <li>The property names or values cannot be null.</li>
190-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
190+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
191191
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
192192
* </ul>
193193
*
@@ -215,10 +215,10 @@ public void trackEvent(String name, Map<String, String> properties, int flags) {
215215
* <p>
216216
* The following rules apply:
217217
* <ul>
218-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
218+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
219219
* <li>The property names or values cannot be null.</li>
220220
* <li>Double values must be finite (NaN or Infinite values are discarded).</li>
221-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
221+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
222222
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
223223
* </ul>
224224
*
@@ -234,10 +234,10 @@ public void trackEvent(String name, EventProperties properties) {
234234
* <p>
235235
* The following rules apply:
236236
* <ul>
237-
* <li>The event name needs to match the <tt>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</tt> regular expression.</li>
237+
* <li>The event name needs to match the <code>[a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99}</code> regular expression.</li>
238238
* <li>The property names or values cannot be null.</li>
239239
* <li>Double values must be finite (NaN or Infinite values are discarded).</li>
240-
* <li>The <tt>baseData</tt> and <tt>baseDataType</tt> properties are reserved and thus discarded.</li>
240+
* <li>The <code>baseData</code> and <code>baseDataType</code> properties are reserved and thus discarded.</li>
241241
* <li>The full event size when encoded as a JSON string cannot be larger than 1.9MB.</li>
242242
* </ul>
243243
*

sdk/appcenter-analytics/src/main/java/com/microsoft/appcenter/analytics/channel/SessionTracker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import android.os.SystemClock;
99
import android.support.annotation.NonNull;
10+
import android.support.annotation.WorkerThread;
1011

1112
import com.microsoft.appcenter.Flags;
1213
import com.microsoft.appcenter.analytics.Analytics;
@@ -118,6 +119,7 @@ public void onPreparingLog(@NonNull Log log, @NonNull String groupName) {
118119
* the session even when no pages are triggered but at the same time we want to keep using
119120
* the same session as long as the current activity is not paused (long video for example).
120121
*/
122+
@WorkerThread
121123
private void sendStartSessionIfNeeded() {
122124
if (mSid == null || hasSessionTimedOut()) {
123125

@@ -143,6 +145,7 @@ private void sendStartSessionIfNeeded() {
143145
/**
144146
* Call this whenever an activity is resumed to update session tracker state.
145147
*/
148+
@WorkerThread
146149
public void onActivityResumed() {
147150

148151
/* Record resume time for session timeout management. */
@@ -154,6 +157,7 @@ public void onActivityResumed() {
154157
/**
155158
* Call this whenever an activity is paused to update session tracker state.
156159
*/
160+
@WorkerThread
157161
public void onActivityPaused() {
158162

159163
/* Record pause time for session timeout management. */

sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/Distribute.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,20 +1128,12 @@ public void onBeforeCalling(URL url, Map<String, String> headers) {
11281128

11291129
@Override
11301130
public void onCallSucceeded(final HttpResponse httpResponse) {
1131-
1132-
/* onPostExecute is not always called on UI thread due to an old Android bug. */
1133-
HandlerUtils.runOnUiThread(new Runnable() {
1134-
1135-
@Override
1136-
public void run() {
1137-
try {
1138-
String payload = httpResponse.getPayload();
1139-
handleApiCallSuccess(releaseCallId, payload, ReleaseDetails.parse(payload), distributionGroupId);
1140-
} catch (JSONException e) {
1141-
onCallFailed(e);
1142-
}
1143-
}
1144-
});
1131+
try {
1132+
String payload = httpResponse.getPayload();
1133+
handleApiCallSuccess(releaseCallId, payload, ReleaseDetails.parse(payload), distributionGroupId);
1134+
} catch (JSONException e) {
1135+
onCallFailed(e);
1136+
}
11451137
}
11461138

11471139
@Override

sdk/appcenter/src/main/java/com/microsoft/appcenter/AbstractAppCenterService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.content.Context;
1010
import android.os.Bundle;
1111
import android.support.annotation.NonNull;
12+
import android.support.annotation.WorkerThread;
1213

1314
import com.microsoft.appcenter.channel.Channel;
1415
import com.microsoft.appcenter.ingestion.models.json.LogFactory;
@@ -136,6 +137,7 @@ public synchronized boolean isInstanceEnabled() {
136137
return SharedPreferencesManager.getBoolean(getEnabledPreferenceKey(), true);
137138
}
138139

140+
@WorkerThread
139141
@Override
140142
public synchronized void setInstanceEnabled(boolean enabled) {
141143

@@ -173,6 +175,7 @@ public synchronized void setInstanceEnabled(boolean enabled) {
173175
}
174176
}
175177

178+
@WorkerThread
176179
protected synchronized void applyEnabledState(boolean enabled) {
177180

178181
/* Optional callback to react to enabled state change. */
@@ -193,6 +196,7 @@ public final synchronized void onStarting(@NonNull AppCenterHandler handler) {
193196
mHandler = handler;
194197
}
195198

199+
@WorkerThread
196200
@Override
197201
public synchronized void onStarted(@NonNull Context context, @NonNull Channel channel, String appSecret, String transmissionTargetToken, boolean startedFromApp) {
198202
String groupName = getGroupName();

sdk/appcenter/src/main/java/com/microsoft/appcenter/AppCenter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ private void finishConfiguration(boolean configureFromApp) {
840840
AppCenterLog.debug(LOG_TAG, "App Center initialized.");
841841
}
842842

843+
@WorkerThread
843844
private void applyStorageMaxSize() {
844845
boolean resizeResult = mChannel.setMaxStorageSize(mMaxStorageSizeInBytes);
845846
if (mSetMaxStorageSizeFuture != null) {

0 commit comments

Comments
 (0)