[Android] Fail fast when CCT callback URI scheme is missing from AndroidManifest - #3009
Merged
wmathurin merged 3 commits intoAug 26, 2026
Merged
Conversation
When advanced auth (Chrome Custom Tab) is enabled, a missing intent-filter for the redirect URI scheme causes the CCT redirect to be silently dropped by Android, leaving the user on a blank screen at the end of the login flow with no diagnostic output. Before launching the CCT, LoginActivity now calls isCallbackSchemeRegistered() to probe the app's PackageManager for a matching intent-filter. If none is found: - An ERROR log line names the missing scheme and the required fix. - In debug builds, a localizable AlertDialog surfaces the issue and aborts the CCT launch. New strings added to sf__strings.xml: sf__advanced_auth_manifest_error_title sf__advanced_auth_manifest_error_message Two instrumented unit tests added to LoginActivityTest.
- Use String.toUri() KTX extension instead of Uri.parse() (two sites) - Add setPackage(packageName) to the probe intent to scope the queryIntentActivities call to the current app only, removing the need for a <queries> manifest declaration (package visibility)
| setPackage(packageName) // scope to this app; avoids <queries> requirement | ||
| } | ||
| return packageManager | ||
| ?.queryIntentActivities(probeIntent, MATCH_DEFAULT_ONLY) |
There was a problem hiding this comment.
Consider adding a <queries> declaration to your manifest when calling this method; see https://g.co/dev/packagevisibility for details |
Contributor
Author
There was a problem hiding this comment.
setPackage(packageName) is already set on the probe intent, which restricts the query to this app's own package. Android's package visibility restrictions (<queries>) only apply when probing external apps — querying your own package is always permitted without a manifest declaration. This warning is a false positive.
brandonpage
approved these changes
Aug 26, 2026
|
|
||
| /** | ||
| * Returns true if the app's manifest contains an intent-filter that handles [redirectUri], | ||
| * false otherwise. A missing registration causes the CCT redirect to be silently dropped by |
Contributor
There was a problem hiding this comment.
Extremely NIT: CCT implies we only support Chrome. Agents tend to propagate this misinformation.
… KDoc The SDK supports any custom tab browser, not only Chrome.
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.
Summary
isCallbackSchemeRegistered()preflight check inLoginActivity.loadLoginPageInCustomTab()that probesPackageManagerfor a matching intent-filter before launching the Chrome Custom Tab (CCT).AlertDialogwith remediation instructions and aborts the CCT launch cleanly.sf__strings.xml(sf__advanced_auth_manifest_error_title,sf__advanced_auth_manifest_error_message).LoginActivityTestverify the registered and unregistered cases.Fixes the silent blank-screen hang that occurs when an app enables advanced auth but omits the callback URI
<intent-filter>from itsAndroidManifest.xml.GUS: W-24000206
Test plan
./gradlew :libs:SalesforceSDK:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.salesforce.androidsdk.ui.LoginActivityTest#test_givenRegisteredScheme_whenIsCallbackSchemeRegistered_thenReturnsTruepasses./gradlew :libs:SalesforceSDK:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.salesforce.androidsdk.ui.LoginActivityTest#test_givenUnregisteredScheme_whenIsCallbackSchemeRegistered_thenReturnsFalsepasses