From a26d3c336b3c72ef4f005bc69a5cd7022a6f1ed7 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Wed, 4 Jun 2025 15:12:52 -0700 Subject: [PATCH 1/7] bug fix --- common/build.gradle | 1 + .../common/internal/ui/DualScreenActivity.java | 15 +++++++++++++++ .../common/java/flighting/CommonFlight.java | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/build.gradle b/common/build.gradle index 727e3fc370..01a2a41a79 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -161,6 +161,7 @@ dependencies { implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion" implementation "com.squareup.moshi:moshi:$rootProject.ext.moshiVersion" implementation "androidx.browser:browser:$rootProject.ext.browserVersion" + implementation "androidx.core:core:1.5.0" implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion" //For Executive Order work implementation "com.yubico.yubikit:android:$rootProject.ext.yubikitAndroidVersion" diff --git a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java index 2862784027..477fe2ba14 100644 --- a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java +++ b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java @@ -35,12 +35,16 @@ import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintSet; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentTransaction; import com.microsoft.device.display.DisplayMask; import com.microsoft.identity.common.R; +import com.microsoft.identity.common.java.flighting.CommonFlightsManager; +import com.microsoft.identity.common.java.flighting.CommonFlight; import com.microsoft.identity.common.logging.Logger; import java.util.List; @@ -58,6 +62,17 @@ public void setContentView(int layoutResID) { private void initializeContentView(){ super.setContentView(R.layout.dual_screen_layout); + if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_HANDLING_FOR_EDGE_TO_EDGE)) { + ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> { + int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left; // Get left system bar inset + int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right; // Get right system bar inset + + view.setPadding(leftInset, topInset, rightInset, bottomInset); + return insets; + }); + } adjustLayoutForDualScreenActivity(); } diff --git a/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java b/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java index c66d14087f..cc59c3d871 100644 --- a/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java +++ b/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java @@ -119,7 +119,12 @@ public enum CommonFlight implements IFlightConfig { /** * Flight to enable exposing the JavaScript API for AuthUx requests */ - ENABLE_JS_API_FOR_AUTHUX("EnableJsApiForAuthUx", true); + ENABLE_JS_API_FOR_AUTHUX("EnableJsApiForAuthUx", true), + + /** + * Flight to enable handling the UI in edge to edge mode + */ + ENABLE_HANDLING_FOR_EDGE_TO_EDGE("EnableHandlingEdgeToEdge", true); private String key; private Object defaultValue; From 1183238f6f870858503ca9d3c33ca50d383a4a4f Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Wed, 11 Jun 2025 19:33:35 -0700 Subject: [PATCH 2/7] move version to version.gradle --- common/build.gradle | 2 +- gradle/versions.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/build.gradle b/common/build.gradle index 01a2a41a79..9792061fa1 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -161,7 +161,7 @@ dependencies { implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion" implementation "com.squareup.moshi:moshi:$rootProject.ext.moshiVersion" implementation "androidx.browser:browser:$rootProject.ext.browserVersion" - implementation "androidx.core:core:1.5.0" + implementation "androidx.core:core:$rootProject.ext.androidxCoreVersion" implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion" //For Executive Order work implementation "com.yubico.yubikit:android:$rootProject.ext.yubikitAndroidVersion" diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 9d2f00350b..f04125a5a9 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -25,6 +25,7 @@ ext { androidxTestCoreVersion = "1.5.0" androidxJunitVersion = "1.1.3" annotationVersion = "1.0.0" + androidxCoreVersion = "1.5.0" appCompatVersion = "1.1.0" browserVersion = "1.0.0" constraintLayoutVersion = "1.1.3" From 3d1574ea1883f60bbffe05c05dda52e3fa0cab54 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Fri, 13 Jun 2025 12:00:11 -0700 Subject: [PATCH 3/7] try catch added for any unexpected errors --- .../internal/ui/DualScreenActivity.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java index 477fe2ba14..586b3e6eaa 100644 --- a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java +++ b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java @@ -63,15 +63,19 @@ public void setContentView(int layoutResID) { private void initializeContentView(){ super.setContentView(R.layout.dual_screen_layout); if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_HANDLING_FOR_EDGE_TO_EDGE)) { - ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> { - int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; - int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; - int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left; // Get left system bar inset - int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right; // Get right system bar inset - - view.setPadding(leftInset, topInset, rightInset, bottomInset); - return insets; - }); + try { + ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> { + int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left; + int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right; + + view.setPadding(leftInset, topInset, rightInset, bottomInset); + return insets; + }); + } catch (final Throwable throwable) { + Logger.warn("DualScreenActivity:initializeContentView", "Failed to set OnApplyWindowInsetsListener"); + } } adjustLayoutForDualScreenActivity(); } From 305ef38db74d332773d0943140b5b9f12d2031b2 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Wed, 4 Jun 2025 15:12:52 -0700 Subject: [PATCH 4/7] bug fix --- common/build.gradle | 1 + .../common/internal/ui/DualScreenActivity.java | 15 +++++++++++++++ .../common/java/flighting/CommonFlight.java | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/build.gradle b/common/build.gradle index 727e3fc370..01a2a41a79 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -161,6 +161,7 @@ dependencies { implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion" implementation "com.squareup.moshi:moshi:$rootProject.ext.moshiVersion" implementation "androidx.browser:browser:$rootProject.ext.browserVersion" + implementation "androidx.core:core:1.5.0" implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion" //For Executive Order work implementation "com.yubico.yubikit:android:$rootProject.ext.yubikitAndroidVersion" diff --git a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java index 2862784027..477fe2ba14 100644 --- a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java +++ b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java @@ -35,12 +35,16 @@ import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintSet; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentTransaction; import com.microsoft.device.display.DisplayMask; import com.microsoft.identity.common.R; +import com.microsoft.identity.common.java.flighting.CommonFlightsManager; +import com.microsoft.identity.common.java.flighting.CommonFlight; import com.microsoft.identity.common.logging.Logger; import java.util.List; @@ -58,6 +62,17 @@ public void setContentView(int layoutResID) { private void initializeContentView(){ super.setContentView(R.layout.dual_screen_layout); + if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_HANDLING_FOR_EDGE_TO_EDGE)) { + ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> { + int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left; // Get left system bar inset + int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right; // Get right system bar inset + + view.setPadding(leftInset, topInset, rightInset, bottomInset); + return insets; + }); + } adjustLayoutForDualScreenActivity(); } diff --git a/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java b/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java index c66d14087f..cc59c3d871 100644 --- a/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java +++ b/common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java @@ -119,7 +119,12 @@ public enum CommonFlight implements IFlightConfig { /** * Flight to enable exposing the JavaScript API for AuthUx requests */ - ENABLE_JS_API_FOR_AUTHUX("EnableJsApiForAuthUx", true); + ENABLE_JS_API_FOR_AUTHUX("EnableJsApiForAuthUx", true), + + /** + * Flight to enable handling the UI in edge to edge mode + */ + ENABLE_HANDLING_FOR_EDGE_TO_EDGE("EnableHandlingEdgeToEdge", true); private String key; private Object defaultValue; From 25e083a2be32adbbd00196a2a3ee786d1ea87b6a Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Wed, 11 Jun 2025 19:33:35 -0700 Subject: [PATCH 5/7] move version to version.gradle --- common/build.gradle | 2 +- gradle/versions.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/build.gradle b/common/build.gradle index 01a2a41a79..9792061fa1 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -161,7 +161,7 @@ dependencies { implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion" implementation "com.squareup.moshi:moshi:$rootProject.ext.moshiVersion" implementation "androidx.browser:browser:$rootProject.ext.browserVersion" - implementation "androidx.core:core:1.5.0" + implementation "androidx.core:core:$rootProject.ext.androidxCoreVersion" implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion" //For Executive Order work implementation "com.yubico.yubikit:android:$rootProject.ext.yubikitAndroidVersion" diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 9d2f00350b..f04125a5a9 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -25,6 +25,7 @@ ext { androidxTestCoreVersion = "1.5.0" androidxJunitVersion = "1.1.3" annotationVersion = "1.0.0" + androidxCoreVersion = "1.5.0" appCompatVersion = "1.1.0" browserVersion = "1.0.0" constraintLayoutVersion = "1.1.3" From 9e189a578747302a89b188111f495f0f5cfeeab7 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Fri, 13 Jun 2025 12:00:11 -0700 Subject: [PATCH 6/7] try catch added for any unexpected errors --- .../internal/ui/DualScreenActivity.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java index 477fe2ba14..586b3e6eaa 100644 --- a/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java +++ b/common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java @@ -63,15 +63,19 @@ public void setContentView(int layoutResID) { private void initializeContentView(){ super.setContentView(R.layout.dual_screen_layout); if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_HANDLING_FOR_EDGE_TO_EDGE)) { - ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> { - int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; - int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; - int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left; // Get left system bar inset - int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right; // Get right system bar inset - - view.setPadding(leftInset, topInset, rightInset, bottomInset); - return insets; - }); + try { + ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> { + int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left; + int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right; + + view.setPadding(leftInset, topInset, rightInset, bottomInset); + return insets; + }); + } catch (final Throwable throwable) { + Logger.warn("DualScreenActivity:initializeContentView", "Failed to set OnApplyWindowInsetsListener"); + } } adjustLayoutForDualScreenActivity(); } From 5e008506663dfd809e0efa5a16f358162c3842e8 Mon Sep 17 00:00:00 2001 From: Sowmya Malayanur Date: Tue, 17 Jun 2025 11:12:59 -0700 Subject: [PATCH 7/7] changelog added --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index c46703fd3d..a3cf252101 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ vNext ---------- - [MINOR] changes accommodating the WrappedKeyAlgoIdentifier module (#2667) +- [MINOR] Fixing the sign in screens when edge to edge is enabled (#2665) Version 21.2.0 ----------