Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update docs about Android 11 support #2139

Closed
bgavrilMS opened this issue Oct 27, 2020 · 18 comments
Closed

Update docs about Android 11 support #2139

bgavrilMS opened this issue Oct 27, 2020 · 18 comments

Comments

@bgavrilMS
Copy link
Member

bgavrilMS commented Oct 27, 2020

Android 11 impact

• Unable to query package manager for and launch browsers that support custom tabs
• Unable to query package manager for and launch regular browsers that don’t support custom tabs
• Unable to query package manager for Broker apps installed on the device (We could still see the Authenticators on the device but when trying to query them via Package Manager it would not be found)

It is important to note that these issues are only observed when the app is targeting SDK 30 & running on Android 11 device

Fix 1

According to Android team, a library can have its own manifest. As far as I know, MSAL.NET does not use this mechanism. To mitigate Android 11 impact, we can update our own manifest, similar to:

https://github.com/AzureAD/microsoft-authentication-library-common-for-android/pull/1095/files

This still requires customers to update to the latest version of MSAL.

Fix 2

Update our docs with app manifest requirements as per:

https://github.com/AzureAD/microsoft-authentication-library-common-for-android/pull/1095/files

@tipa
Copy link

tipa commented Dec 16, 2020

I tried to implement "Fix 2" but the app still launches the browser instead of a custom tab.
Is the fix outdated or anything else to pay attention to?

@tipa
Copy link

tipa commented Jan 21, 2021

Problem is still present with v2.25.0 - cannot use Custom Tabs with Android 29+ - the login flow always opens the browser.
Would it be possible to at least change this code here?

// this is used to check if anything can open custom tabs.
// Must use the classic support. Leaving the reference AndroidX intent
#if __ANDROID_29__
private readonly string _customTabsServiceAction =
"androidx.browser.customtabs.action.CustomTabsService";
#else
private readonly string _customTabsServiceAction =
"android.support.customtabs.action.CustomTabsService";
#endif

The comment itself says that "Must use the classic support" but for Android 29+ the wrong(?) Intent Action is used.
I think it should be android.support.customtabs... and not androidx.browser.customtabs...

@jmprieur
Copy link
Contributor

@henrik-me @trwalke @bgavrilMS @jennyf19
Do we want to take this this sprint?

@tipa
Copy link

tipa commented Jan 21, 2021

Regarding proposed "Fix 1" there has been some talk here about how it would be possible to include the extra stuff to the AndroidManifest.xml: xamarin/Essentials#1392 (comment)

@bgavrilMS bgavrilMS added the bug label Jan 21, 2021
@tipa
Copy link

tipa commented Feb 11, 2021

I still have to use v4.23 on Android because of this issue. Any chance it will be fixed in the next update?

@bgavrilMS bgavrilMS added the P2 label Feb 11, 2021
@bgavrilMS
Copy link
Member Author

@trwalke - can you take a look at this for the next MSAL release? We should not block people on older SDK versions. Also good to better understand differences between Android 10 and 11.

@bgavrilMS bgavrilMS added this to the 4.27.0 milestone Feb 11, 2021
@bgavrilMS bgavrilMS changed the title [Feature Request] Support for Android 11 [Feature Request] [L] Support for Android 11 Feb 11, 2021
@bgavrilMS
Copy link
Member Author

Looks like 2 issues are present here, @trwalke - please split it up if needed.

@bgavrilMS
Copy link
Member Author

@trwalke - given that we need big manifest changes, I wonder if it won't be faster to add the manifest.xml directly to MSAL, similar to what MSAL.Android do ?

This would avoid us having to change all the samples, wiki and MSDN?

@trwalke
Copy link
Member

trwalke commented Feb 25, 2021

@bgavrilMS in my previous attempt I could not get the manifest to work when it was attached to MSAL. it is easier for android as they have a project designed to accept manifest files. I will take another look at it to see if i can get it to work but I may have to reach out to the Xamarin guys

@trwalke
Copy link
Member

trwalke commented Feb 26, 2021

Cannot merge PR until next week due to restrictions in MS Docs. Blocking until then

@trwalke
Copy link
Member

trwalke commented Feb 26, 2021

@tipa The issue you mention here seems to be related to version 29 as well so I am splitting the issue into 2.
The second issue with the custom tab support not working will be tracked here #2418

@tipa
Copy link

tipa commented Mar 18, 2021

This is still not working for me after 4.28, even if it says so in the changelog.
I assume it's because MSAL still queries for the wrong package, as I already suspected here
(androidx.browser.customtabs.action.CustomTabsService instead of android.support.customtabs.action.CustomTabsService)
Or what exactly has been fixed here?

@bgavrilMS bgavrilMS modified the milestones: 4.28.0, 4.29.0 Mar 18, 2021
@bgavrilMS
Copy link
Member Author

CC @trwalke

@trwalke
Copy link
Member

trwalke commented Mar 18, 2021

@tipa This issue is only for adding android 11 support. The issue you mentioned is related to Android 29+ which is android 10 and 11 and is about custom tabs so it does not exactly relate to this issue. I moved your issue to a separate issue here #2418

#2139 (comment)

@trwalke
Copy link
Member

trwalke commented Mar 18, 2021

Information on how to implement Android 11 support can be found here:
https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-xamarin-android-considerations#android-11-support

@trwalke trwalke closed this as completed Mar 18, 2021
@trwalke trwalke modified the milestones: 4.29.0, 4.28.0 Mar 18, 2021
@tipa
Copy link

tipa commented Mar 18, 2021

What exactly does "Android 11 support" mean?
I was able to use MSAL / CustomTabs on Android 11 without issues with v4.23 - but I cannot use CustomTabs with v4.24 to v4.28. Whenever I try, it opens the system browser in a new task (meaning it exits the app).
Your linked docs mention added this part:

  <intent>
    <action android:name="android.support.customtabs.action.CustomTabsService" />
  </intent>

But why?
As I pointed out, a different package is being queried so adding this part to the Manifest shouldn't make any difference.
Or what am I missing here?

@trwalke
Copy link
Member

trwalke commented Mar 18, 2021

@tipa
"Android 11 support" means enabling customers to use our product on Android 11 by following our guidance. This has nothing to do with the issue you are referring to. As I said earlier, the issue you have is being tracked in a separate bug here (#2418). Please see my previous comments

#2139 (comment)
#2139 (comment)

@bgavrilMS
Copy link
Member Author

@trwalke - not having system browser support on Android 11 is pretty big gap that needs to be addressed, and we should mention it in the docs.

@bgavrilMS bgavrilMS changed the title [Feature Request] [L] Support for Android 11 Update docs about Android 11 support Mar 22, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants