Skip to content

@W-24296713: Add Android ephemeral auth sessions - #3052

Merged
brandonpage merged 3 commits into
forcedotcom:devfrom
brandonpage:ephemeral-advanced-auth-session
Sep 28, 2026
Merged

brandonpage merged 3 commits into
forcedotcom:devfrom
brandonpage:ephemeral-advanced-auth-session

Conversation

@brandonpage

@brandonpage brandonpage commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a default-on useEphemeralSessionForAdvancedAuth SDK option
  • request ephemeral Custom Tabs and warn when provider support cannot be confirmed
  • expose the option in Login Options and developer-support output
Screenshot_20260924_195949 Screenshot_20260924_200002

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
2 Warnings
⚠️ libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.kt#L1293 - Consider adding a <queries> declaration to your manifest when calling this method; see https://g.co/dev/packagevisibility for details
⚠️ libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginOptionsActivity.kt#L443 - This method should only be accessed from tests or within private scope

Generated by 🚫 Danger

@wmathurin wmathurin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review against the W-24296713 spec/plan (Workspace PR #117). The implementation matches the spec closely and CI is green — 4 non-blocking follow-ups below (2 test-coverage gaps that the plan explicitly promised, 1 spec-wording divergence, 1 cosmetic).


// endregion

// region Ephemeral Custom Tabs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test: prompt=login independence. Plan §1 (bullet 6), the spec acceptance criterion ("sharedBrowserSession continues to control prompt=login independently"), and the test-plan "URL policy" row all call for extending an existing sharedBrowserSession test to assert prompt=login stays independent of the new ephemeral option. This region adds the ephemeral tests but that independence assertion is absent. Low risk (the new flag never enters buildCustomTabAuthorizeUrl, so independence is structural) but it was an explicitly promised test.

@brandonpage brandonpage Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added buildCustomTabAuthorizeUrl_promptLoginDependsOnlyOnSharedBrowserSession, which exercises both ephemeral values and verifies that only sharedBrowserSession controls whether prompt=login is present.

setOpenInBrowserButtonState(OPEN_IN_BROWSER_STATE_OFF)
setInstantAppsEnabled(false)
setBackgroundInteractionEnabled(false)
configureEphemeralBrowsing(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration wiring is untested. The three configureEphemeralBrowsing_* tests exercise the extension in isolation (mocked LoginActivity + real CustomTabsIntent.Builder via callOriginal()). Nothing verifies that loadLoginPageInCustomTab actually calls it here with enabled = sdkManager.useEphemeralSessionForAdvancedAuth and the resolved provider. So reading the SDK flag and the takeIf provider resolution have no coverage — the test-plan’s "Custom Tab enabled/disabled" rows are satisfied only at the helper level, not at the launch path. Suggest one test asserting the wiring.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an ActivityScenario integration test that invokes the real loadLoginPageInCustomTab method twice, captures the launched AndroidX intents, and verifies the current manager setting plus configured browser package. The test bypasses only callback registration through a narrow injected check, so no test AndroidManifest change is required.

setBackgroundInteractionEnabled(false)
configureEphemeralBrowsing(
enabled = sdkManager.useEphemeralSessionForAdvancedAuth,
provider = customTabBrowser.takeIf { customTabBrowserExists },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capability check skips the default-browser fallback. Spec (Custom Tab Launch, step 2) says resolve the provider using the configured-browser and default-browser fallback. Here provider is null whenever the configured browser isn’t installed, so isEphemeralBrowsingSupported() is skipped and no diagnostic warning fires even if the OS default browser lacks ephemeral support. Behavior is still correct (ephemeral is still requested, launch proceeds) — only the best-effort warning is missing for that path. For true parity with the spec, resolve via CustomTabsClient.getPackageName(this, null) when the configured package is absent; otherwise tighten the spec to say the warning is best-effort for the configured browser only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I removed this from the code to include as few behavior/code changes as possible but did not update the spec.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the workspace spec, plan, and test plan in SalesforceMobileSDK-Workspace#117 to remove default-browser fallback capability resolution. The documented check/warning is now scoped to an installed configured customTabBrowser; the existing fallback remains unchanged and unpinned.

}

@Test
fun devSupportInfo_IncludesEphemeralAdvancedAuthentication_WithCurrentValue() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetic: Plan §1 named DevSupportInfoTest.kt as the location for the developer-support test; it landed here in LoginOptionsActivityTest.kt instead. The test exists and passes, so this is purely a location note — no change needed unless you want to match the plan.

@brandonpage brandonpage Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned the workspace plan and test plan with the actual test location in LoginOptionsActivityTest.kt; the unused DevSupportInfoTest.kt location is no longer listed.

@brandonpage
brandonpage marked this pull request as ready for review September 25, 2026 16:42

@wmathurin wmathurin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. All four review findings are addressed:

  • Default-browser fallback divergence and dev-support test location — reconciled by updating the spec/plan/test-plan in Workspace PR #117 to match the code.
  • prompt=login independence — covered by the extended buildCustomTabAuthorizeUrl_promptLoginDependsOnlyOnSharedBrowserSession test (loops both ephemeral × both sharedBrowserSession values).
  • Integration wiring — covered by the new loadLoginPageInCustomTab_usesCurrentEphemeralSettingAndConfiguredBrowser scenario test, which asserts the real launched Intent's ephemeral extra tracks the SDK flag and the configured browser package. The injected callbackSchemeRegistered seam keeps production behavior unchanged.

Implementation matches the spec, API usage is correct against AndroidX Browser 1.10.0, and the change is appropriately scoped. Please just confirm the pending unit-tests-pr / ui-tests-pr jobs go green before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants