remove "singleTask" launch mode on Android 11+#1673
Merged
Conversation
mpbw2
reviewed
Dec 6, 2021
| @"text/*" | ||
| })] | ||
| // Activity and IntentFilter declarations have been moved to Properties/AndroidManifest.xml | ||
| // They have been hardcoded so we can use the default LaunchMode on Android 12+ |
Contributor
There was a problem hiding this comment.
Can you add a note about making sure any future changes are made in both manifest files? (I can see forgetting about the values-v31 version)
mpbw2
reviewed
Dec 6, 2021
| <AndroidResource Include="Resources\values\styles.xml" /> | ||
| <AndroidResource Include="Resources\values\colors.xml" /> | ||
| <AndroidResource Include="Resources\values\manifest.xml"> | ||
| <SubType></SubType> |
Contributor
There was a problem hiding this comment.
Remove the empty SubType and Generator tags for both manifests
mpbw2
reviewed
Dec 6, 2021
|
|
||
| <!-- Support for LG "Dual Window" mode (for Android < 7.0 users) --> | ||
| <meta-data android:name="com.lge.support.SPLIT_WINDOW" android:value="true" /> | ||
| <activity android:name="com.x8bit.bitwarden.MainActivity" android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|uiMode" android:exported="true" android:icon="@mipmap/ic_launcher" android:label="Bitwarden" android:launchMode="@integer/launchModeAPIlevel" android:theme="@style/LaunchTheme"> |
Contributor
There was a problem hiding this comment.
Formatting - can you break this line up
fedemkr
reviewed
Dec 6, 2021
Comment on lines
+145
to
+146
| var uri = intent?.GetStringExtra("uri"); | ||
| if (uri != null) |
Member
There was a problem hiding this comment.
I think we could make it one line (not sure if there is an standard that is against this):
if(intent?.GetStringExtra("uri") is string uri)
{
....
}
mpbw2
approved these changes
Dec 6, 2021
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.
Type of change
Objective
This bug fix has multiple parts:
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. AlthoughOnNewIntentis not new, we haven't seen this behavior, thus we had no code yet inOnNewIntentto handle accessibility interactions.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 aStartActivityForResultcall that opens the main app and loads the autofill page.StartActivityForResultis incompatible withLaunchMode.SingleTaskbecause 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 requireLaunchMode.SingleTaskto 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
[Activity]and[IntentFilter]attributes and declare manually in AndroidManifest.xml so we can use a resource string for LaunchMode. Handle Accessibility Service calls inOnNewIntent.OnNewIntent.<activity>and<intent-filter>manually so we can use a resource string for LaunchMode.LaunchMode.Multipleif Android 11+.LaunchMode.SingleTaskif Android 10-.Testing requirements
Before you submit