Skip to content

Commit c4819f8

Browse files
committed
Address review comments on PR #3121
- Use {@code lastLoadedDomain} in javadoc instead of markdown backticks - Emit STEP_BROKER_INSTALL_PROMPTED from processPlayStoreURL and processPlayStoreURLForBrokerApps so Play Store dispatch paths populate the onboarding step timeline (previously only processInstallRequest and processIntentToInstallBrokerApp did) - Test: use OnboardingTelemetryConstants.STEP_BROKER_INSTALL_PROMPTED and LAST_LOADED_DOMAIN constants instead of hardcoded string literals - Test: clear OnboardingSessionCorrelationStore in @after teardown to keep tests isolated from other onboarding tests
1 parent bf6b1c1 commit c4819f8

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

common/src/main/java/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public class AzureActiveDirectoryWebViewClient extends OAuth2WebViewClient {
159159
* after this client is constructed (the recorder is created by the host fragment/activity
160160
* when a seed JSON arrives, which is typically later than WebView construction).
161161
* When non-null, key URL transitions (broker install, MDM enrollment, Company Portal
162-
* launch, etc.) and `lastLoadedDomain` are recorded for the onboarding telemetry blob.
162+
* launch, etc.) and {@code lastLoadedDomain} are recorded for the onboarding telemetry blob.
163163
*/
164164
@Nullable
165165
private com.microsoft.identity.common.internal.telemetry.OnboardingTelemetryRecorder mOnboardingTelemetryRecorder;
@@ -917,6 +917,7 @@ private boolean processPlayStoreURL(@NonNull final WebView view, @NonNull final
917917
}
918918
final String appPackageName = getBrokerAppPackageNameFromUrl(url);
919919
Logger.info(methodTag, "Request to open PlayStore to install package : '" + appPackageName + "'");
920+
recordOnboardingStep(com.microsoft.identity.common.java.telemetry.OnboardingTelemetryConstants.STEP_BROKER_INSTALL_PROMPTED);
920921

921922
try {
922923
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAY_STORE_INSTALL_PREFIX + appPackageName));
@@ -936,6 +937,7 @@ private boolean processPlayStoreURLForBrokerApps(@NonNull final WebView view, @N
936937

937938
final String appPackageName = getBrokerAppPackageNameFromUrl(url);
938939
Logger.info(methodTag, "Request to open PlayStore to install package : '" + appPackageName + "'");
940+
recordOnboardingStep(com.microsoft.identity.common.java.telemetry.OnboardingTelemetryConstants.STEP_BROKER_INSTALL_PROMPTED);
939941

940942
try {
941943
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAY_STORE_INSTALL_APP_PREFIX + appPackageName));

common/src/test/java/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClientTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ public void onPageLoaded(final String url) {
183183
@After
184184
public void cleanUp(){
185185
CommonFlightsManager.INSTANCE.resetFlightsManager();
186+
// Clear onboarding session-correlation SharedPreferences to keep tests isolated;
187+
// OnboardingTelemetryRecorder.addBlockingError persists to this store.
188+
if (mContext != null) {
189+
new com.microsoft.identity.common.internal.telemetry.OnboardingSessionCorrelationStore(mContext)
190+
.save("");
191+
}
186192
}
187193

188194
@Test(expected = IllegalArgumentException.class)
@@ -1128,7 +1134,8 @@ public void testProcessInstallRequest_RecordsBrokerInstallPromptedStep() throws
11281134
final org.json.JSONArray steps = blob.getJSONArray("steps_list");
11291135
boolean foundStep = false;
11301136
for (int i = 0; i < steps.length(); i++) {
1131-
if ("BrokerInstallPrompted".equals(steps.getJSONObject(i).getString("step_id"))) {
1137+
if (com.microsoft.identity.common.java.telemetry.OnboardingTelemetryConstants
1138+
.STEP_BROKER_INSTALL_PROMPTED.equals(steps.getJSONObject(i).getString("step_id"))) {
11321139
foundStep = true;
11331140
break;
11341141
}
@@ -1165,7 +1172,8 @@ public void testOnPageFinished_RecordsLastLoadedDomain() throws Exception {
11651172
mWebViewClient.onPageFinished(mMockWebView, "https://login.microsoftonline.com/common/oauth2/authorize");
11661173

11671174
final org.json.JSONObject blob = new org.json.JSONObject(recorder.finalizeBlob());
1168-
assertEquals("login.microsoftonline.com", blob.getString("last_loaded_domain"));
1175+
assertEquals("login.microsoftonline.com", blob.getString(
1176+
com.microsoft.identity.common.java.telemetry.OnboardingTelemetryConstants.LAST_LOADED_DOMAIN));
11691177
}
11701178

11711179
/**

0 commit comments

Comments
 (0)