Skip to content

Commit 6fa3586

Browse files
mnoman09jaeopt
andauthored
[FSSDK-8952] chore: prepare 3.13.4 branch for release (#451)
* fix(EventRescheduler): catch exception for event service restart (#446) (cherry picked from commit 585f099) * [FSSDK-8952] doc: Full Stack to Feature Experimentation Rename (#450) * [FSSDK-8952] doc: Full Stack to Feature Experimentation Rename --------- Co-authored-by: mnoman09 <[email protected]> (cherry picked from commit 390c464) * changed java version to 3.10.3 * [FSSDK-8952] chore: prepare for release 3.13.4 (#452) * chore: prepare for release 3.13.4 * set java core version to 3.10.3 * removed comment * Revert "removed comment" This reverts commit a326808. * Revert "set java core version to 3.10.3" This reverts commit fe586f6. --------- (cherry picked from commit cbcdd1e) --------- Co-authored-by: Jae Kim <[email protected]>
1 parent 9d43ce0 commit 6fa3586

File tree

7 files changed

+95
-115
lines changed

7 files changed

+95
-115
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Optimizely Android X SDK Changelog
22

3+
## 3.13.4
4+
March 15th, 2023
5+
6+
- Update README.md and other non-functional code to reflect that this SDK supports both Optimizely Feature Experimentation and Optimizely Full Stack. ([#450](https://github.com/optimizely/android-sdk/pull/450)).
7+
8+
### Bug Fixes
9+
* Catch exception from event service and restart the service. ([#446](https://github.com/optimizely/android-sdk/pull/446)).
10+
311
## 3.13.3
412
December 1st, 2022
513

README.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,20 @@
22
[![Apache 2.0](https://img.shields.io/github/license/nebula-plugins/gradle-extra-configurations-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0)
33
[![Build Status](https://travis-ci.org/optimizely/android-sdk.svg?branch=master)](https://travis-ci.org/optimizely/android-sdk)
44

5-
## Overview
5+
This repository houses the Android SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy). The Android SDK depends on the [Optimizely Java SDK](https://github.com/optimizely/java-sdk).
66

7-
This repository houses the Android SDK for use with Optimizely Full Stack and Optimizely Rollouts. The Android SDK depends on the [Optimizely Java SDK](https://github.com/optimizely/java-sdk).
7+
Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams, letting you experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome).
88

9-
Optimizely Full Stack is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/platform/full-stack/, or see the [documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome).
9+
Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feature-flagging/) for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap.
1010

11-
Optimizely Rollouts is free feature flags for development teams. Easily roll out and roll back features in any application without code deploys. Mitigate risk for every feature on your roadmap. Learn more at https://www.optimizely.com/rollouts/, or see the [documentation](https://docs.developers.optimizely.com/experimentation/v3.1.0-full-stack/docs/introduction-to-rollouts).
11+
## Get Started
1212

13-
## Getting Started
14-
15-
### Using the SDK
16-
See the [Android SDK developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/install-sdk-android) to learn how to set
17-
up an Optimizely project and start using the SDK.
13+
Refer to the [Android SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/android-sdk) for detailed instructions on getting started with using the SDK.
1814

1915
### Requirements
2016
* Android API 14 or higher
2117

22-
### Installing the SDK
18+
### Install the SDK
2319
To add the android-sdk and all modules to your project, include the following in your app's `build.gradle`:
2420

2521
---
@@ -37,7 +33,7 @@ repositories {
3733
}
3834
3935
dependencies {
40-
implementation 'com.optimizely.ab:android-sdk:3.13.3'
36+
implementation 'com.optimizely.ab:android-sdk:3.13.4'
4137
}
4238
```
4339

@@ -60,6 +56,10 @@ optimizelyManager.initialize(this, null, (OptimizelyClient optimizely) -> {
6056
6157
```
6258

59+
## Use the Android SDK
60+
61+
See the Optimizely Feature Experimentation [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0-full-stack/docs/android-sdk) to learn how to set up your first Android project and use the SDK.
62+
6363
## Architecture
6464

6565
This project includes 5 library modules and a test app.
@@ -82,7 +82,7 @@ This project includes 5 library modules and a test app.
8282
6. Test App
8383
- A simple app showing how to use the Optimizely Android SDK
8484

85-
## Development
85+
## SDK Development
8686

8787
### Command Line
8888

@@ -111,6 +111,7 @@ You can import this project into Android Studio by opening Android Studio and se
111111
Tests can be run by right clicking the file in the project pane or by clicking the method name in source and selecting run. You will be prompted to create an AVD or connect a device if one isn't connected.
112112

113113
### Contributing
114+
114115
Please see [CONTRIBUTING](CONTRIBUTING.md).
115116

116117
### Credits
@@ -128,3 +129,26 @@ Additional credits from java-sdk:[https://github.com/optimizely/java-sdk/blob/ma
128129
**Android Logger** [https://github.com/noveogroup/android-logger](https://github.com/noveogroup/android-logger)
129130
License (Public Domain): [https://github.com/noveogroup/android-logger/blob/master/LICENSE.txt](https://github.com/noveogroup/android-logger/blob/master/LICENSE.txt)
130131

132+
### Other Optimzely SDKs
133+
134+
- Agent - https://github.com/optimizely/agent
135+
136+
- C# - https://github.com/optimizely/csharp-sdk
137+
138+
- Flutter - https://github.com/optimizely/optimizely-flutter-sdk
139+
140+
- Go - https://github.com/optimizely/go-sdk
141+
142+
- Java - https://github.com/optimizely/java-sdk
143+
144+
- JavaScript - https://github.com/optimizely/javascript-sdk
145+
146+
- PHP - https://github.com/optimizely/php-sdk
147+
148+
- Python - https://github.com/optimizely/python-sdk
149+
150+
- React - https://github.com/optimizely/react-sdk
151+
152+
- Ruby - https://github.com/optimizely/ruby-sdk
153+
154+
- Swift - https://github.com/optimizely/swift-sdk

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ext {
6161
build_tools_version = "30.0.3"
6262
min_sdk_version = 14
6363
target_sdk_version = 33
64-
java_core_ver = "3.10.2"
64+
java_core_ver = "3.10.3"
6565
android_logger_ver = "1.3.6"
6666
jacksonversion= "2.11.2"
6767
annotations_ver = "1.2.0"
@@ -193,7 +193,7 @@ configure(publishedProjects) {
193193

194194
customizePom(pom, docTitle)
195195
// "description" is required by MavenCentral but it does not work in customizePom(). added here explicitly.
196-
pom.description = 'The Android SDK for Optimizely Full Stack (feature flag management for product development teams)'
196+
pom.description = 'The Android SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts'
197197

198198
from components.release
199199
artifact releaseSourcesJar

event-handler/src/test/java/com/optimizely/ab/android/event_handler/EventReschedulerTest.java renamed to event-handler/src/androidTest/java/com/optimizely/ab/android/event_handler/EventReschedulerTest.java

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
/****************************************************************************
2-
* Copyright 2016,2021, Optimizely, Inc. and contributors *
3-
* *
4-
* Licensed under the Apache License, Version 2.0 (the "License"); *
5-
* you may not use this file except in compliance with the License. *
6-
* You may obtain a copy of the License at *
7-
* *
8-
* http://www.apache.org/licenses/LICENSE-2.0 *
9-
* *
10-
* Unless required by applicable law or agreed to in writing, software *
11-
* distributed under the License is distributed on an "AS IS" BASIS, *
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13-
* See the License for the specific language governing permissions and *
14-
* limitations under the License. *
15-
***************************************************************************/
1+
// Copyright 2016,2021,2023, Optimizely, Inc. and contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1614

1715
package com.optimizely.ab.android.event_handler;
1816

1917
import android.content.Context;
2018
import android.content.Intent;
19+
import android.net.NetworkInfo;
2120
import android.net.wifi.WifiManager;
2221

2322
import org.junit.Before;
@@ -26,15 +25,23 @@
2625
import org.junit.runner.RunWith;
2726
import org.mockito.runners.MockitoJUnitRunner;
2827
import org.slf4j.Logger;
28+
29+
import static org.mockito.Matchers.any;
30+
import static org.mockito.Matchers.matches;
31+
import static org.mockito.Mockito.doNothing;
32+
import static org.mockito.Mockito.doReturn;
33+
import static org.mockito.Mockito.doThrow;
2934
import static org.mockito.Mockito.mock;
35+
import static org.mockito.Mockito.spy;
3036
import static org.mockito.Mockito.verify;
3137
import static org.mockito.Mockito.when;
3238

39+
import androidx.test.ext.junit.runners.AndroidJUnit4;
40+
3341
/**
3442
* Unit tests for {@link EventRescheduler}
3543
*/
36-
@RunWith(MockitoJUnitRunner.class)
37-
@Ignore
44+
@RunWith(AndroidJUnit4.class)
3845
public class EventReschedulerTest {
3946

4047
private Context context;
@@ -47,8 +54,7 @@ public void setupEventRescheduler() {
4754
context = mock(Context.class);
4855
intent = mock(Intent.class);
4956
logger = mock(Logger.class);
50-
rescheduler = mock(EventRescheduler.class);
51-
rescheduler = new EventRescheduler();
57+
rescheduler = spy(new EventRescheduler());
5258
rescheduler.logger = logger;
5359
}
5460

@@ -71,6 +77,13 @@ public void onReceiveInvalidAction() {
7177
verify(logger).warn("Received unsupported broadcast action to event rescheduler");
7278
}
7379

80+
@Test
81+
public void onReceiveWhenRescheduleWithException() {
82+
when(intent.getAction()).thenThrow(new IllegalStateException());
83+
rescheduler.onReceive(context, intent);
84+
verify(logger).warn(matches("WorkScheduler failed to reschedule an event service.*"));
85+
}
86+
7487
@Test
7588
public void onReceiveValidBootComplete() {
7689
when(intent.getAction()).thenReturn(Intent.ACTION_BOOT_COMPLETED);
@@ -88,10 +101,12 @@ public void onReceiveValidPackageReplaced() {
88101
@Test
89102
public void flushOnWifiConnectionIfScheduled() {
90103
final Intent eventServiceIntent = mock(Intent.class);
91-
when(intent.getAction()).thenReturn(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
92-
when(intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED, false)).thenReturn(true);
104+
when(intent.getAction()).thenReturn(WifiManager.WIFI_STATE_CHANGED_ACTION);
105+
NetworkInfo info = mock(NetworkInfo.class);
106+
when(info.isConnected()).thenReturn(true);
107+
when(intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO)).thenReturn(info);
108+
93109
rescheduler.reschedule(context, intent);
94-
verify(context).startService(eventServiceIntent);
95110
verify(logger).info("Preemptively flushing events since wifi became available");
96111
}
97112
}

event-handler/src/main/java/com/optimizely/ab/android/event_handler/EventRescheduler.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2016-2021, Optimizely, Inc. and contributors *
2+
* Copyright 2016-2021, 2023 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -62,10 +62,17 @@ public class EventRescheduler extends BroadcastReceiver {
6262
*/
6363
@Override
6464
public void onReceive(Context context, Intent intent) {
65-
if (context != null && intent != null) {
66-
reschedule(context, intent);
67-
} else {
65+
if (context == null || intent == null) {
6866
logger.warn("Received invalid broadcast to event rescheduler");
67+
return;
68+
}
69+
70+
try {
71+
reschedule(context, intent);
72+
} catch (Exception e) {
73+
// Rare exceptions (IllegalStateException: "WorkManager is not initialized properly...") with WorkerScheduler.startService(), probably related to a WorkManager start timing issue.
74+
// Gracefully handled here, and it's safe for those rare cases since event-dispatch service will be scheduled again on next events.
75+
logger.warn("WorkScheduler failed to reschedule an event service: " + e.getMessage());
6976
}
7077
}
7178

event-handler/src/test/java/com/optimizely/ab/android/event_handler/DefaultEventHandlerTest.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

test-app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939
}
4040

4141
dependencies {
42-
// Includes the Optimizely X Full Stack Java SDK, event handler, and user profile
42+
// Includes the Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts Java SDK, event handler, and user profile
4343
//implementation "com.optimizely.ab:android-sdk:1.0.0"
4444
implementation (project(':android-sdk')) {
4545
exclude group: 'com.google.code.gson', module:'gson'

0 commit comments

Comments
 (0)