Skip to content

Commit e33e22e

Browse files
authored
Merge branch 'staging' into fix_display_size
2 parents fb7a76d + ed3d82c commit e33e22e

File tree

12 files changed

+145
-72
lines changed

12 files changed

+145
-72
lines changed

.github/workflows/build_and_test_sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: The Countly Android SDK Unit Test
22

33
env:
44
EMULATOR_REPO: us-docker.pkg.dev/android-emulator-268719/images/28-playstore-x64:30.1.2
5-
JAVA_V: 11
5+
JAVA_V: 17
66
JAVA_DIST: corretto
77

88
permissions:

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
## XX.XX.XX
2-
* Mitigated an issue where content sizing was handled incorrectly on API level 35 and above.
1+
## 25.4.4
2+
* Improved disk size calculation in crash reports.
3+
4+
* Mitigated an issue displaying Content on API level 35 and above.
35

46
## 25.4.3
57
* Improved Health Check metric information.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ org.gradle.configureondemand=true
2222
android.useAndroidX=true
2323
android.enableJetifier=true
2424
# RELEASE FIELD SECTION
25-
VERSION_NAME=25.4.3
25+
VERSION_NAME=25.4.4
2626
GROUP=ly.count.android
2727
POM_URL=https://github.com/Countly/countly-sdk-android
2828
POM_SCM_URL=https://github.com/Countly/countly-sdk-android

sdk/src/androidTest/java/ly/count/android/sdk/BreadcrumbHelperTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class BreadcrumbHelperTests {
1818
@Test
1919
public void addBreadcrumb() {
2020
BreadcrumbHelper breadcrumbHelper = new BreadcrumbHelper(5, new ModuleLog());
21-
breadcrumbHelper.addBreadcrumb("test", 10);
21+
breadcrumbHelper.addBreadcrumb("test", 10, 5);
2222
Assert.assertEquals(list("test"), breadcrumbHelper.getBreadcrumbs());
2323
}
2424

@@ -75,7 +75,7 @@ public void addBreadcrumb_exceedsLimit() {
7575
@Test
7676
public void clearBreadcrumbs() {
7777
BreadcrumbHelper breadcrumbHelper = new BreadcrumbHelper(2, new ModuleLog());
78-
breadcrumbHelper.addBreadcrumb("Test", 3);
78+
breadcrumbHelper.addBreadcrumb("Test", 3, 2);
7979
Assert.assertEquals(list("Tes"), breadcrumbHelper.getBreadcrumbs());
8080
breadcrumbHelper.clearBreadcrumbs();
8181
Assert.assertEquals(list(), breadcrumbHelper.getBreadcrumbs());

sdk/src/androidTest/java/ly/count/android/sdk/MockedMetricProvider.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.util.DisplayMetrics;
55
import androidx.annotation.NonNull;
66
import androidx.annotation.Nullable;
7+
import java.util.AbstractMap;
8+
import java.util.Map;
79

810
public class MockedMetricProvider implements MetricProvider {
911

@@ -79,14 +81,6 @@ public MockedMetricProvider() {
7981
return "O";
8082
}
8183

82-
@Override public String getDiskCurrent() {
83-
return "23";
84-
}
85-
86-
@Override public String getDiskTotal() {
87-
return "45";
88-
}
89-
9084
@Nullable @Override public String getBatteryLevel(Context context) {
9185
return "6";
9286
}
@@ -118,4 +112,8 @@ public MockedMetricProvider() {
118112
@Override public DisplayMetrics getDisplayMetrics(@NonNull final Context context) {
119113
return new DisplayMetrics();
120114
}
115+
116+
@Override public Map.Entry<String, String> getDiskSpaces(Context context) {
117+
return new AbstractMap.SimpleEntry<>("45", "23");
118+
}
121119
}

sdk/src/androidTest/java/ly/count/android/sdk/ModuleConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public void invalidConfigResponses_AreRejected() {
644644
*/
645645
@Test
646646
public void configurationParameterCount() {
647-
int configParameterCount = 26; // plus config, timestamp and version parameters
647+
int configParameterCount = 31; // plus config, timestamp and version parameters
648648
int count = 0;
649649
for (Field field : ModuleConfiguration.class.getDeclaredFields()) {
650650
if (field.getName().startsWith("keyR")) {

sdk/src/androidTest/java/ly/count/android/sdk/ModuleRemoteConfigTests.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,25 @@ public void automaticRCTriggers() {
7474
config.setRequiresConsent(true);
7575
config.setConsentEnabled(new String[] { Countly.CountlyFeatureNames.remoteConfig });
7676
}
77-
config.immediateRequestGenerator = () -> (ImmediateRequestI) (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
78-
if (!requestData.endsWith("method=sc")) { // this is server config, disabling it for this test
79-
triggerCounter[0]++;
77+
78+
config.immediateRequestGenerator = new ImmediateRequestGenerator() {
79+
@Override public ImmediateRequestI CreateImmediateRequestMaker() {
80+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
81+
if (!requestData.endsWith("method=sc")) { // this is server config, disabling it for this test
82+
triggerCounter[0]++;
83+
}
84+
};
85+
}
86+
87+
@Override public ImmediateRequestI CreatePreflightRequestMaker() {
88+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
89+
if (!requestData.endsWith("method=sc")) { // this is server config, disabling it for this test
90+
triggerCounter[0]++;
91+
}
92+
};
8093
}
8194
};
95+
8296
Countly countly = (new Countly()).init(config);
8397
Assert.assertEquals(++intendedCount, triggerCounter[0]);//init should create a request
8498

@@ -281,8 +295,14 @@ public void rcGlobalCallback() {
281295
config.RemoteConfigRegisterGlobalCallback(c1);
282296
config.RemoteConfigRegisterGlobalCallback(c2);
283297
config.setRemoteConfigAutomaticDownload(true, oldRCC);
284-
config.immediateRequestGenerator = () -> (ImmediateRequestI) (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
285-
callback.callback(null);
298+
config.immediateRequestGenerator = new ImmediateRequestGenerator() {
299+
@Override public ImmediateRequestI CreateImmediateRequestMaker() {
300+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> callback.callback(null);
301+
}
302+
303+
@Override public ImmediateRequestI CreatePreflightRequestMaker() {
304+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> callback.callback(null);
305+
}
286306
};
287307

288308
Countly countly = new Countly().init(config);

sdk/src/androidTest/java/ly/count/android/sdk/RemoteConfigVariantControlTests.java

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,44 @@ public void testFilteringWrongKeys() {
235235
}
236236

237237
ImmediateRequestGenerator createIRGForSpecificResponse(final String targetResponse) {
238-
return () -> (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
239-
if (targetResponse == null) {
240-
callback.callback(null);
241-
return;
238+
return new ImmediateRequestGenerator() {
239+
@Override public ImmediateRequestI CreateImmediateRequestMaker() {
240+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
241+
if (targetResponse == null) {
242+
callback.callback(null);
243+
return;
244+
}
245+
246+
JSONObject jobj = null;
247+
248+
try {
249+
jobj = new JSONObject(targetResponse);
250+
} catch (JSONException e) {
251+
e.printStackTrace();
252+
}
253+
254+
callback.callback(jobj);
255+
};
242256
}
243257

244-
JSONObject jobj = null;
258+
@Override public ImmediateRequestI CreatePreflightRequestMaker() {
259+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
260+
if (targetResponse == null) {
261+
callback.callback(null);
262+
return;
263+
}
245264

246-
try {
247-
jobj = new JSONObject(targetResponse);
248-
} catch (JSONException e) {
249-
e.printStackTrace();
250-
}
265+
JSONObject jobj = null;
266+
267+
try {
268+
jobj = new JSONObject(targetResponse);
269+
} catch (JSONException e) {
270+
e.printStackTrace();
271+
}
251272

252-
callback.callback(jobj);
273+
callback.callback(jobj);
274+
};
275+
}
253276
};
254277
}
255278

sdk/src/androidTest/java/ly/count/android/sdk/TestUtils.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class TestUtils {
4444
public final static String commonAppKey = "appkey";
4545
public final static String commonDeviceId = "1234";
4646
public final static String SDK_NAME = "java-native-android";
47-
public final static String SDK_VERSION = "25.4.3";
47+
public final static String SDK_VERSION = "25.4.4";
4848
public static final int MAX_THREAD_COUNT_PER_STACK_TRACE = 50;
4949

5050
public static class Activity2 extends Activity {
@@ -66,7 +66,16 @@ public static CountlyConfig createConsentCountlyConfig(boolean requiresConsent,
6666
.disableHealthCheck();//mocked tests fail without disabling this
6767
cc.testModuleListener = testModuleListener;
6868
cc.requestQueueProvider = rqp;
69-
cc.immediateRequestGenerator = () -> (ImmediateRequestI) (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
69+
cc.immediateRequestGenerator = new ImmediateRequestGenerator() {
70+
@Override public ImmediateRequestI CreateImmediateRequestMaker() {
71+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
72+
};
73+
}
74+
75+
@Override public ImmediateRequestI CreatePreflightRequestMaker() {
76+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
77+
};
78+
}
7079
};
7180
return cc;
7281
}
@@ -84,8 +93,16 @@ public static CountlyConfig createAttributionCountlyConfig(boolean requiresConse
8493
.disableHealthCheck();//mocked tests fail without disabling this
8594
cc.testModuleListener = testModuleListener;
8695
cc.requestQueueProvider = rqp;
87-
cc.immediateRequestGenerator = () -> (ImmediateRequestI) (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
96+
cc.immediateRequestGenerator = new ImmediateRequestGenerator() {
97+
@Override public ImmediateRequestI CreateImmediateRequestMaker() {
98+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
99+
};
100+
}
88101

102+
@Override public ImmediateRequestI CreatePreflightRequestMaker() {
103+
return (requestData, customEndpoint, cp, requestShouldBeDelayed, networkingIsEnabled, callback, log) -> {
104+
};
105+
}
89106
};
90107
return cc;
91108
}

sdk/src/main/java/ly/count/android/sdk/Countly.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ of this software and associated documentation files (the "Software"), to deal
4747
*/
4848
public class Countly {
4949

50-
private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "25.4.3";
50+
private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "25.4.4";
5151
/**
5252
* Used as request meta data on every request
5353
*/

0 commit comments

Comments
 (0)