From 77d49173ad95d0d4cdb086d23e78e53613d3a784 Mon Sep 17 00:00:00 2001 From: Amir Uval Date: Sun, 24 Feb 2019 16:41:37 +0200 Subject: [PATCH] comment explaining the purpose of the workaround --- .../net/openid/appauth/browser/BrowserSelector.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/java/net/openid/appauth/browser/BrowserSelector.java b/library/java/net/openid/appauth/browser/BrowserSelector.java index e65db5e7..f337b281 100644 --- a/library/java/net/openid/appauth/browser/BrowserSelector.java +++ b/library/java/net/openid/appauth/browser/BrowserSelector.java @@ -49,6 +49,18 @@ public final class BrowserSelector { /** * The service we expect to find on a web browser that indicates it supports custom tabs. + * + * Workaround for Android Jetifier bug (https://issuetracker.google.com/issues/119183822) + * + * Problem: Projects that are using androidx are using a Jetifier compiler as a dependency. + * The Jetifier compiler is replacing "android.support" with "androidx" inside all the + * dependencies, AppAuth included. But "android.support" is still required by the platform in + * order to open a chrome tab. As a result - a chrome tab is not found, and an external browser + * is opened instead. + * Workaround: Using StringBuilder to create the string + * "android.support.customtabs.action.CustomTabsService" in runtime prevents the jetifier static + * regex from matching "android.support" in the compiled class, thus avoiding the androidx + * replacement. */ @SuppressWarnings("StringBufferReplaceableByString") @VisibleForTesting