Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

Starting with androidx.activity:activity:1.12.0, edge-to-edge display is automatically enforced for ComponentActivity, causing MSAL's redirect activities to render blank WebView pages when launched from apps using the newer library version. The content is drawn behind system bars without proper inset handling.

Changes

  • Created MsalRedirectActivity theme with android:windowOptOutEdgeToEdgeEnforcement for Android 15 compatibility
  • Added programmatic opt-out via WindowCompat.setDecorFitsSystemWindows(getWindow(), true) in activity onCreate() for Android 16+ where theme attribute is removed
  • Applied to all redirect handlers: BrowserTabActivity, CurrentTaskBrowserTabActivity, BrokerHelperActivity, and base DualScreenActivity

Implementation

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    // Opt out of edge-to-edge - prevents blank WebView when user's activity
    // extends ComponentActivity with androidx.activity:activity:1.12.0+
    WindowCompat.setDecorFitsSystemWindows(getWindow(), true);
    
    // ... rest of onCreate
}
<!-- AndroidManifest.xml -->
<activity
    android:name=".BrowserTabActivity"
    android:theme="@style/MsalRedirectActivity" />

<!-- themes.xml -->
<style name="MsalRedirectActivity" parent="@android:style/Theme.Translucent.NoTitleBar">
    <item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

The dual approach handles both Android 15 (where theme opt-out works) and Android 16+ (where it's removed). No functional changes to authentication flows.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=512m -XX:&#43;HeapDumpOnOutOfMemoryError -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
  • www.puppycrawl.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.7/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.7/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.7/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/microsoft-authentication-library-for-android/.codeql-scratch/dbs/java/working/files-to-index11309665717789529233.list --sourceArchiveDir=/home/REDACTED/work/microsoft-authentication-library-for-android/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/microsoft-authentication-library-for-android/.codeql-scratch/dbs/java/trap/java -j ACCEPT (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Blank WebView page if the application depends on androidx.activity:activity:1.12.0 or higher</issue_title>
<issue_description>Describe the bug

Android System WebView renders a completely blank page for authentication, but elements are still selectable (buttons, input fields) if the project depends on androidx.activity:activity:1.12.0 or higher.

Smartphone (please complete the following information):

  • Device: Pixel 10 Pro XL
  • Android Version: Android 16
  • Browser: Android System WebView 142.0.7444.171
  • MSAL Version: 8.1.1

To Reproduce

Steps to reproduce the behavior:

  1. Call IPublicClientApplication.acquireToken with an Activity that extends ComponentActivity
  2. Wait for the WebView to show up

Expected behavior

Authentication web page is rendered correctly with all the elements visible

Actual Behavior

A blank page is rendered instead, but elements can be tapped (if lucky) or highlighted via TalkBack</issue_description>

<agent_instructions>Use the most recent set of ai instructions to assist with this issue</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: fadidurah <88730756+fadidurah@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix blank WebView page for authentication when using activity 1.12.0 Fix blank WebView with androidx.activity:activity:1.12.0+ Dec 17, 2025
Copilot AI requested a review from fadidurah December 17, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blank WebView page if the application depends on androidx.activity:activity:1.12.0 or higher

2 participants