Fix IAM display rendering issues on foldable Android devices (Samsung Galaxy Fold/Flip)#2597
Draft
abdulraqeeb33 wants to merge 1 commit intomainfrom
Draft
Fix IAM display rendering issues on foldable Android devices (Samsung Galaxy Fold/Flip)#2597abdulraqeeb33 wants to merge 1 commit intomainfrom
abdulraqeeb33 wants to merge 1 commit intomainfrom
Conversation
This commit addresses rendering issues with In-App Messages (IAM) on foldable Android devices like Samsung Galaxy Fold/Flip. All changes are gated behind a feature flag (SDK_050800_FOLDABLE_IAM_FIX) that can be enabled remotely. When the flag is OFF, the SDK uses legacy behavior. When ON, the new foldable-aware behavior is activated. Root cause: - Foldable devices change screen size without triggering orientation changes - The SDK only listened for CONFIG_ORIENTATION changes, missing fold/unfold events - ViewUtils used deprecated APIs that don't properly handle multi-window scenarios Changes: 1. FoldableIAMFeature.kt (NEW): - Global feature switch for foldable device IAM improvements - Controlled by FeatureManager via remote config 2. FeatureFlag.kt: - Added SDK_050800_FOLDABLE_IAM_FIX feature flag - Uses IMMEDIATE activation mode for instant toggling 3. FeatureManager.kt: - Added side effect handler for the new feature flag - Updates FoldableIAMFeature.isEnabled when flag changes 4. ViewUtils.kt: - getWindowHeight(): Uses WindowMetrics API (API 30+) when FF enabled - getWindowWidth(): Uses WindowMetrics API (API 30+) when FF enabled - getFullbleedWindowWidth(): Uses WindowMetrics API (API 30+) when FF enabled - Falls back to legacy behavior when FF disabled 5. ApplicationService.kt: - Screen size change detection only runs when FF enabled - Detects fold/unfold via screenWidthDp/screenHeightDp changes - Triggers IAM view recreation on screen size change 6. WebViewManager.kt: - Updated comment to clarify fold/unfold handling The fix ensures IAMs are properly resized and repositioned when users fold/unfold their devices, preventing cut-off content and mispositioned messages - but only when the feature flag is enabled. Co-authored-by: abdul <abdul@onesignal.com>
87d5ea4 to
3e55686
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
One Line Summary
Fix In-App Message (IAM) display rendering issues on foldable Android devices, gated behind a remote feature flag.
Details
Motivation
Foldable Android devices like Samsung Galaxy Fold and Flip experience IAM rendering issues when users fold/unfold their devices. The IAM content may appear cut-off, mispositioned, or incorrectly sized because:
Screen size changes without orientation change: When a foldable device transitions between its cover screen and main screen (or vice versa), the screen dimensions change dramatically without triggering an orientation change event.
Deprecated APIs: The SDK was using deprecated
defaultDisplay.getSize()APIs that don't properly handle multi-window and foldable device scenarios on Android 11+.Missing configuration detection: The SDK only listened for
CONFIG_ORIENTATIONchanges, missing theCONFIG_SCREEN_SIZEchanges that foldable devices trigger.Feature Flag Implementation
All changes are gated behind a remote feature flag:
SDK_050800_FOLDABLE_IAM_FIXThis allows for safe rollout and easy rollback if issues are discovered.
Scope
What is affected:
What is NOT affected:
Technical Changes
FoldableIAMFeature.kt (NEW):
ThreadingModeisEnabledproperty controlled byFeatureManagerFeatureFlag.kt:
SDK_050800_FOLDABLE_IAM_FIXfeature flagIMMEDIATEactivation mode for instant togglingFeatureManager.kt:
FoldableIAMFeature.isEnabledwhen flag changesViewUtils.kt:
getWindowHeight(): Uses WindowMetrics API (API 30+) when FF enabledgetWindowWidth(): Uses WindowMetrics API (API 30+) when FF enabledgetFullbleedWindowWidth(): Uses WindowMetrics API (API 30+) when FF enabledApplicationService.kt:
screenWidthDp/screenHeightDpchangesWebViewManager.kt:
Testing
Unit testing
ApplicationServiceTestspassFeatureManagerTestspassSDK_050800_BACKGROUND_THREADINGManual testing
Recommended testing scenarios:
Affected code checklist
Checklist
Overview
Testing
Final pass