[FSSDK-11136] add cmab support #514
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces significant enhancements to the Android SDK, primarily by adding support for a new Contextual Multi-Armed Bandit (CMAB) service and improving user context handling for decision APIs. The main changes include the introduction of the
OptimizelyUserContextAndroidclass for better synchronous and asynchronous decision support, integration of CMAB service components into the SDK, and updates to the builder and manager classes to support these new features.User Context and Decision API Improvements:
OptimizelyUserContextAndroidclass, extendingOptimizelyUserContextto provide both synchronous and asynchronous decision APIs, ensuring backward compatibility and improved usability for Android clients. (android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyUserContextAndroid.java)OptimizelyClientclass to returnOptimizelyUserContextAndroidinstances from allcreateUserContextmethods, with improved null checks and logging for invalid parameters. (android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyClient.java)CMAB Service Integration:
OptimizelyManager, including new fields, constructor parameters, and wiring through the builder pattern. This enables configuration and use of the CMAB service within the SDK. (android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java) [1] [2] [3] [4] [5] [6]android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java) [1] [2]New CMAB Client Implementation:
CMABClientclass, which handles HTTP requests to the CMAB prediction endpoint, including request/response handling, error management, and exponential backoff for retries. (android-sdk/src/main/java/com/optimizely/ab/android/sdk/cmab/CMABClient.kt)Other Minor Changes:
DefaultPersistenceDelegate(appears unused and may be cleanup in a later revision). (android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java)These changes collectively enhance the SDK's flexibility and robustness, especially around user context management and support for advanced decisioning features like CMAB."
Test plan
Issues