Skip to content

Commit ef16828

Browse files
Copilotp3dr0rv
andauthored
Add Auth Tab Switch Browser feature flag and telemetry constants to common4j, Fixes AB#3561423 (#3072)
Adds the feature flag and attribute constants needed to instrument the Auth Tab switch browser feature. ## Changes ### `CommonFlight.java` - New flight: `ENABLE_AUTH_TAB_FOR_SWITCH_BROWSER("EnableAuthTabForSwitchBrowser", false)` ### `AttributeName.java` Four new attributes adjacent to existing switch browser attributes: | Constant | Type | Description | |---|---|---| | `auth_tab_used` | boolean | Whether Auth Tab was used | | `auth_tab_result_code` | integer | Android Activity result code from Auth Tab | | `is_auth_tab_supported` | boolean | Whether Auth Tab is supported | | `auth_tab_fallback_to_custom_tabs` | boolean | Whether Auth Tab fell back to Custom Tabs | > **Note:** Per `AttributeName.java` policy, the four new attribute constants must also be mirrored in the Broker repo's (`AzureAD/ad-accounts-for-android`) `AttributeName.java`. Auth Tab telemetry attributes will be recorded on the existing `SwitchBrowserProcess` span via span context propagation, rather than a dedicated new span. <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > ## Objective > Add the feature flag enum entry and telemetry constants (attribute names + span name) in the `common4j` module to support the Auth Tab switch browser feature. > > ## Target Repository > - Repo: AzureAD/microsoft-authentication-library-common-for-android > - Base Branch: dev > - Module: common4j > > ## Technical Requirements > > 1. **CommonFlight.java** — Add enum entry: > `ENABLE_AUTH_TAB_FOR_SWITCH_BROWSER("EnableAuthTabForSwitchBrowser", false),` > Follow existing pattern. Default value `false`. > > 2. **AttributeName.java** — Add 4 new enum constants: > `auth_tab_used,` > `auth_tab_result_code,` > `is_auth_tab_supported,` > `auth_tab_fallback_to_custom_tabs,` > > 3. **SpanName.java** — Add 1 new enum constant near existing Switch Browser entries: > `SwitchBrowserAuthTab,` > > ## Files to Modify > - `common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java` > - `common4j/src/main/com/microsoft/identity/common/java/opentelemetry/AttributeName.java` > - `common4j/src/main/com/microsoft/identity/common/java/opentelemetry/SpanName.java` > > ## Acceptance Criteria > - `CommonFlight.ENABLE_AUTH_TAB_FOR_SWITCH_BROWSER` exists with key `"EnableAuthTabForSwitchBrowser"` and default `false` > - `AttributeName` contains: `auth_tab_used`, `auth_tab_result_code`, `is_auth_tab_supported`, `auth_tab_fallback_to_custom_tabs` > - `SpanName` contains: `SwitchBrowserAuthTab` > - Compile check passes > > Fixes [AB#3561423](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3561423) > Follow .github/copilot-instructions.md strictly > </details> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: p3dr0rv <76129899+p3dr0rv@users.noreply.github.com> Co-authored-by: p3dr0rv <pedroro@microsoft.com>
1 parent 4f86977 commit ef16828

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ public enum CommonFlight implements IFlightConfig {
262262
*/
263263
ENABLE_SERVER_CLIENT_DATA_TELEMETRY("EnableServerClientDataTelemetry", true),
264264

265+
/**
266+
* Flight to enable Auth Tab for the switch browser feature.
267+
*/
268+
ENABLE_AUTH_TAB_FOR_SWITCH_BROWSER("EnableAuthTabForSwitchBrowser", false),
269+
265270
/**
266271
* Flight to enable filter-then-clone optimization in SharedPreferencesAccountCredentialCacheWithMemoryCache.
267272
* When enabled, getCredentialsFilteredBy()/getAccountsFilteredBy() filters on in-memory

common4j/src/main/com/microsoft/identity/common/java/opentelemetry/AttributeName.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,26 @@ public enum AttributeName {
405405
*/
406406
is_switch_browser_resume_handled,
407407

408+
/**
409+
* Records if the Auth Tab was used in the switch browser flow (boolean).
410+
*/
411+
auth_tab_used,
412+
413+
/**
414+
* Records the Android Activity result code returned by the Auth Tab in the switch browser flow (integer).
415+
*/
416+
auth_tab_result_code,
417+
418+
/**
419+
* Records if Auth Tab is supported for the switch browser flow (boolean).
420+
*/
421+
is_auth_tab_supported,
422+
423+
/**
424+
* Records if the Auth Tab fell back to custom tabs in the switch browser flow (boolean).
425+
*/
426+
auth_tab_fallback_to_custom_tabs,
427+
408428
/**
409429
* The tenant id for the home tenant of the account for which PRT is required.
410430
*/

0 commit comments

Comments
 (0)