Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Optimizely Android X SDK Changelog

## 5.2.1
May 29, 2026

### Fixes

- Upgrade dependency to [Java SDK 4.4.2](https://github.com/optimizely/java-sdk/releases/tag/v4.4.2)
- Block ODP identify event for single identifier

## 5.2.0
May 8, 2026

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repositories {
}

dependencies {
implementation 'com.optimizely.ab:android-sdk:5.2.0'
implementation 'com.optimizely.ab:android-sdk:5.2.1'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void identifyOdpEventSentWhenUserContextCreated() throws InterruptedExcep
verify(odpApiManager, times(1)).sendEvents(eq("p-1"), eq("h-1/v3/events"), captor.capture());
String eventStr = captor.getValue();

// 2 events (client_initialized, identified) will be batched in a single sendEvents() call.
// 2 events batched: client_initialized + identified (identified sent because there are 2 identifiers: vuid + fs_user_id).
JsonArray jsonArray = JsonParser.parseString(eventStr).getAsJsonArray();
assertEquals(jsonArray.size(), 2);

Expand Down Expand Up @@ -146,7 +146,7 @@ public void identifyOdpEventSentWhenUserContextCreated() throws InterruptedExcep
}

@Test
public void identifyOdpEventSentWhenVuidUserContextCreated() throws InterruptedException {
public void identifyOdpEventNotSentWhenVuidUserContextCreated() throws InterruptedException {
optimizelyClient.createUserContext(); // empty userId. vuid will be used.

Thread.sleep(2000); // wait for batch timeout (1sec)
Expand All @@ -155,25 +155,43 @@ public void identifyOdpEventSentWhenVuidUserContextCreated() throws InterruptedE
verify(odpApiManager, times(1)).sendEvents(eq("p-1"), eq("h-1/v3/events"), captor.capture());
String eventStr = captor.getValue();

// 2 events (client_initialized, identified) will be batched in a single sendEvents() call.
// only 1 event (client_initialized) since vuid-only context does not send identified event.
JsonArray jsonArray = JsonParser.parseString(eventStr).getAsJsonArray();
assertEquals(jsonArray.size(), 2);
assertEquals(jsonArray.size(), 1);

// "client_initialized" event (vuid only)
JsonObject firstEvt = jsonArray.get(0).getAsJsonObject();
JsonObject firstIdentifiers = firstEvt.get("identifiers").getAsJsonObject();

// "identified" event (vuid only)
JsonObject secondEvt = jsonArray.get(1).getAsJsonObject();
JsonObject secondIdentifiers = secondEvt.get("identifiers").getAsJsonObject();

assertEquals(firstEvt.get("action").getAsString(), "client_initialized");
assertEquals(firstIdentifiers.size(), 1);
assertEquals(firstIdentifiers.get("vuid").getAsString(), testVuid);
}

assertEquals(secondEvt.get("action").getAsString(), "identified");
assertEquals(secondIdentifiers.size(), 1);
assertEquals(secondIdentifiers.get("vuid").getAsString(), testVuid);
@Test
public void identifyOdpEventNotSentWhenUserContextCreatedWithoutVuid() throws Exception {
// build a separate manager without vuid
ODPApiManager noVuidOdpApiManager = mock(ODPApiManager.class);
when(noVuidOdpApiManager.sendEvents(anyString(), anyString(), anyString())).thenReturn(200);

ODPEventManager noVuidEventManager = new ODPEventManager(noVuidOdpApiManager);
ODPSegmentManager noVuidSegmentManager = new ODPSegmentManager(noVuidOdpApiManager);

OptimizelyManager noVuidManager = OptimizelyManager.builder()
.withSDKKey(testSdkKey)
.withODPEventManager(noVuidEventManager)
.withODPSegmentManager(noVuidSegmentManager)
.build(context);

noVuidManager.initialize(context, odpDatafile);
OptimizelyClient noVuidClient = noVuidManager.getOptimizely();

noVuidClient.createUserContext(testUser); // userId only, no vuid

Thread.sleep(2000); // wait for batch timeout (1sec)

// no ODP events sent without vuid
verify(noVuidOdpApiManager, times(0)).sendEvents(anyString(), anyString(), anyString());
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ext {
build_tools_version = "35.0.0"
min_sdk_version = 21
target_sdk_version = 35
java_core_ver = "4.4.0"
java_core_ver = "4.4.2"
android_logger_ver = "1.3.6"
jacksonversion= "2.11.2"
annotations_ver = "1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = 0.0.0-SNAPSHOT

android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1g
org.gradle.jvmargs=-Xmx4g
Loading