From feb8636c48c881030fbcc3760f1bf0a0f998c5c2 Mon Sep 17 00:00:00 2001 From: ChinYing-Li Date: Sat, 20 Feb 2021 05:18:07 +0800 Subject: [PATCH] Bug 1654207: Remove LEGACY_TAG_PINGS from the Android GleanDebugActivity --- .../glean/debug/GleanDebugActivity.kt | 10 +----- .../glean/debug/GleanDebugActivityTest.kt | 33 ------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt index c03a4c592e..51daf12c71 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt @@ -40,7 +40,6 @@ class GleanDebugActivity : Activity() { * The value must match the pattern `[a-zA-Z0-9-]{1,20}`. */ const val TAG_DEBUG_VIEW_EXTRA_KEY = "debugViewTag" - const val LEGACY_TAG_PINGS = "tagPings" /** * Tags all outgoing pings as debug pings to make them available for real-time validation. @@ -94,7 +93,7 @@ class GleanDebugActivity : Activity() { // Make sure that at least one of the supported commands was used. val supportedCommands = listOf( SEND_PING_EXTRA_KEY, LOG_PINGS_EXTRA_KEY, NEXT_ACTIVITY_TO_RUN, - TAG_DEBUG_VIEW_EXTRA_KEY, SOURCE_TAGS_KEY, LEGACY_TAG_PINGS + TAG_DEBUG_VIEW_EXTRA_KEY, SOURCE_TAGS_KEY ) var nextActivityName: String? = null @@ -114,13 +113,6 @@ class GleanDebugActivity : Activity() { // Set the debug view tag, if the tag is invalid it won't be set debugViewTag?.let { Glean.setDebugViewTag(debugViewTag) - } ?: run { - // If the 'debugViewTag' was not used, try to look for the legacy - // way of setting debug view tags. We should leave this block of - // code around at most until December 2020. - intent.getStringExtra(LEGACY_TAG_PINGS)?.let { legacyTag -> - Glean.setDebugViewTag(legacyTag) - } } val logPings: Boolean? = intent.getBooleanExtra(LOG_PINGS_EXTRA_KEY, false) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt index 301c7f5104..8bc4007a91 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt @@ -214,39 +214,6 @@ class GleanDebugActivityTest { server.shutdown() } - @Test - fun `pings are correctly tagged using legacy tagPings`() { - val pingTag = "legacy-debug-ID" - - // Use the test client in the Glean configuration - val context = ApplicationProvider.getApplicationContext() - resetGlean(context, Glean.configuration.copy( - httpClient = TestPingTagClient(debugHeaderValue = pingTag) - )) - - // Create a custom ping for testing. Since we're testing headers, - // it's fine for this to be empty. - val customPing = PingType( - name = "custom", - includeClientId = false, - sendIfEmpty = true, - reasonCodes = listOf() - ) - - // Set the extra values and start the intent. - val intent = Intent(ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java) - intent.putExtra(GleanDebugActivity.SEND_PING_EXTRA_KEY, "metrics") - intent.putExtra(GleanDebugActivity.LEGACY_TAG_PINGS, pingTag) - launch(intent) - - customPing.submit() - - // This will trigger the call to `fetch()` in the TestPingTagClient which is where the - // test assertions will occur - triggerWorkManager(context) - } - @Test fun `pings are correctly tagged using sourceTags`() { val testTags = setOf("tag1", "tag2")