[PR #1673] [MERGED] remove "singleTask" launch mode on Android 11+ #44648

Closed
opened 2026-04-26 11:53:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1673
Author: @jlf0dev
Created: 12/6/2021
Status: Merged
Merged: 12/6/2021
Merged by: @jlf0dev

Base: masterHead: bug/a11y-draw-over-build-mode


📝 Commits (3)

  • dd73b9a remove "singleTask" launch mode on Android 12+
  • 7a7d49e remove commented and unneccesary code
  • 2b1b531 fix formatting and change from Android 12 to Android 11

📊 Changes

6 files changed (+58 additions, -25 deletions)

View changed files

📝 src/Android/Android.csproj (+5 -0)
📝 src/Android/MainActivity.cs (+13 -20)
📝 src/Android/Properties/AndroidManifest.xml (+25 -3)
src/Android/Resources/values-v30/manifest.xml (+4 -0)
src/Android/Resources/values/manifest.xml (+4 -0)
📝 src/App/App.xaml.cs (+7 -2)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

This bug fix has multiple parts:

  1. Android 11 has introduced new lifecycle changes and fixes that break our Accessibility Service. When our app is open in the background, the Accessibility Service uses that instance and runs through OnNewIntent. Although OnNewIntent is not new, we haven't seen this behavior, thus we had no code yet in OnNewIntent to handle accessibility interactions.

  2. The second problem is that even though we now handle accessibility calls in OnNewIntent, the autofill page does not return our login information to our Accessibility Service. Our Accessibility Service uses a StartActivityForResult call that opens the main app and loads the autofill page. StartActivityForResult is incompatible with LaunchMode.SingleTask because it pulls the existing app to the front, that app is in a different Task. Tasks cannot communicate, meaning no data was being passed back to the Accessibility Service. We require LaunchMode.SingleTask to mitigate Strandhogg vulnerabilities in earlier versions of Android, but it can be removed in Android 11+.

tl;dr
The Android Accessibility Service on Android 11+ should now correctly show the autofill page and autofill credentials when selected.

Asana Task: https://app.asana.com/0/1169444489336079/1201373745150061/f
Closes #1645
Might impact #1389

Code changes

  • src/Android/MainActivity.cs: Remove [Activity] and [IntentFilter] attributes and declare manually in AndroidManifest.xml so we can use a resource string for LaunchMode. Handle Accessibility Service calls in OnNewIntent.
  • src/App/App.xaml.cs: Show Autofill Page if Accessibility Service comes through OnNewIntent.
  • src/Android/Properties/AndroidManifest.xml: Create <activity> and <intent-filter> manually so we can use a resource string for LaunchMode.
  • src/Android/Resources/values-v31/manifest.xml: Set LaunchMode to LaunchMode.Multiple if Android 11+.
  • src/Android/Resources/values/manifest.xml: Set LaunchMode to LaunchMode.SingleTask if Android 10-.
  • src/Android/Android.csproj: New files

Testing requirements

  • Android 10- Accessibility Service should still work correctly.
    • With/without app open in background.
  • Android 11+ Accessibility Service should now work correctly.
    • With/without app open in background.
  • Testing around the Android lifecycle to make sure the new LaunchMode in Android 11+ didn't make any unintentional changes.
    • Two Factor Authentication workflow.
    • Returning from application in background.
    • Autofill Service.
    • Main app launcher still works correctly.

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/1673 **Author:** [@jlf0dev](https://github.com/jlf0dev) **Created:** 12/6/2021 **Status:** ✅ Merged **Merged:** 12/6/2021 **Merged by:** [@jlf0dev](https://github.com/jlf0dev) **Base:** `master` ← **Head:** `bug/a11y-draw-over-build-mode` --- ### 📝 Commits (3) - [`dd73b9a`](https://github.com/bitwarden/android/commit/dd73b9a13163217bb9f20bae3c2766c4b888b652) remove "singleTask" launch mode on Android 12+ - [`7a7d49e`](https://github.com/bitwarden/android/commit/7a7d49edb0cec9d749a7cf4b81920e40d429a28c) remove commented and unneccesary code - [`2b1b531`](https://github.com/bitwarden/android/commit/2b1b531c05794807376f3a7200227da43cdb8e02) fix formatting and change from Android 12 to Android 11 ### 📊 Changes **6 files changed** (+58 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/Android.csproj` (+5 -0) 📝 `src/Android/MainActivity.cs` (+13 -20) 📝 `src/Android/Properties/AndroidManifest.xml` (+25 -3) ➕ `src/Android/Resources/values-v30/manifest.xml` (+4 -0) ➕ `src/Android/Resources/values/manifest.xml` (+4 -0) 📝 `src/App/App.xaml.cs` (+7 -2) </details> ### 📄 Description ## Type of change - [x] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> This bug fix has multiple parts: 1) Android 11 has introduced new lifecycle changes and fixes that break our Accessibility Service. When our app is open in the background, the Accessibility Service uses that instance and runs through `OnNewIntent`. Although `OnNewIntent` is not new, we haven't seen this behavior, thus we had no code yet in `OnNewIntent` to handle accessibility interactions. 2) The second problem is that even though we now handle accessibility calls in `OnNewIntent`, the autofill page does not return our login information to our Accessibility Service. Our Accessibility Service uses a `StartActivityForResult` call that opens the main app and loads the autofill page. `StartActivityForResult` is incompatible with `LaunchMode.SingleTask` because it pulls the existing app to the front, that app is in a different Task. Tasks cannot communicate, meaning no data was being passed back to the Accessibility Service. We require `LaunchMode.SingleTask` to mitigate Strandhogg vulnerabilities in earlier versions of Android, but it can be removed in Android 11+. **tl;dr** The Android Accessibility Service on Android 11+ should now correctly show the autofill page and autofill credentials when selected. Asana Task: https://app.asana.com/0/1169444489336079/1201373745150061/f Closes #1645 Might impact #1389 ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **src/Android/MainActivity.cs:** Remove `[Activity]` and `[IntentFilter]` attributes and declare manually in AndroidManifest.xml so we can use a resource string for LaunchMode. Handle Accessibility Service calls in `OnNewIntent`. * **src/App/App.xaml.cs:** Show Autofill Page if Accessibility Service comes through `OnNewIntent`. * **src/Android/Properties/AndroidManifest.xml:** Create `<activity>` and `<intent-filter>` manually so we can use a resource string for LaunchMode. * **src/Android/Resources/values-v31/manifest.xml:** Set LaunchMode to `LaunchMode.Multiple` if Android 11+. * **src/Android/Resources/values/manifest.xml:** Set LaunchMode to `LaunchMode.SingleTask` if Android 10-. * **src/Android/Android.csproj:** New files ## Testing requirements <!--What functionality requires testing by QA? This includes testing new behavior and regression testing--> - Android 10- Accessibility Service should still work correctly. - With/without app open in background. - Android 11+ Accessibility Service should now work correctly. - With/without app open in background. - Testing around the Android lifecycle to make sure the new LaunchMode in Android 11+ didn't make any unintentional changes. - Two Factor Authentication workflow. - Returning from application in background. - Autofill Service. - Main app launcher still works correctly. ## Before you submit - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] This change has particular **deployment requirements** (notify the DevOps team) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-26 11:53:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#44648