diff options
author | Joe Baker-Malone <jbakermalone@google.com> | 2021-12-20 15:02:59 -0800 |
---|---|---|
committer | Joe Baker-Malone <jbakermalone@google.com> | 2022-01-04 18:22:57 +0000 |
commit | 0cf51481ad94072a38af8a82e1a2add06a4de902 (patch) | |
tree | 3b55579fec38c96ab1aab865ce10cc1ea1fa0939 /layout-inspector/src | |
parent | 72f648c93cb092126d99aec3952f372f5032f782 (diff) | |
download | idea-0cf51481ad94072a38af8a82e1a2add06a4de902.tar.gz |
Log when connection attempts are cancelled
Test: added a test
Bug: 209690693
Change-Id: Ie1c904f777e7f0a940d86a36f7a92e7d6140ef94
Diffstat (limited to 'layout-inspector/src')
-rw-r--r-- | layout-inspector/src/com/android/tools/idea/layoutinspector/pipeline/InspectorClientLauncher.kt | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/layout-inspector/src/com/android/tools/idea/layoutinspector/pipeline/InspectorClientLauncher.kt b/layout-inspector/src/com/android/tools/idea/layoutinspector/pipeline/InspectorClientLauncher.kt index b4d54669401..ff251b2a360 100644 --- a/layout-inspector/src/com/android/tools/idea/layoutinspector/pipeline/InspectorClientLauncher.kt +++ b/layout-inspector/src/com/android/tools/idea/layoutinspector/pipeline/InspectorClientLauncher.kt @@ -25,6 +25,7 @@ import com.android.tools.idea.layoutinspector.pipeline.appinspection.AppInspecti import com.android.tools.idea.layoutinspector.pipeline.legacy.LegacyClient import com.android.tools.idea.layoutinspector.ui.InspectorBannerService import com.google.common.annotations.VisibleForTesting +import com.google.wireless.android.sdk.stats.DynamicLayoutInspectorEvent import com.intellij.openapi.Disposable import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer @@ -181,6 +182,11 @@ class InspectorClientLauncher( // InspectorClientLaunchMonitor should kill it before this, but just in case, don't wait forever. latch.await(1, TimeUnit.MINUTES) + // The current selected process changed out from under us, abort the whole thing. + if (processes.selectedProcess?.isRunning != true || processes.selectedProcess?.pid != process.pid) { + metrics?.logEvent(DynamicLayoutInspectorEvent.DynamicLayoutInspectorEventType.ATTACH_CANCELLED) + return + } // This client didn't work, try the next if (validClientConnected) { break @@ -189,14 +195,11 @@ class InspectorClientLauncher( // Disconnect to clean up any partial connection or leftover process client.disconnect() } - // The current selected process changed out from under us, abort the whole thing. - if (processes.selectedProcess?.isRunning != true || processes.selectedProcess?.pid != process.pid) { - return - } } catch (cancellationException: CancellationException) { // Disconnect to clean up any partial connection or leftover process client.disconnect() + metrics?.logEvent(DynamicLayoutInspectorEvent.DynamicLayoutInspectorEventType.ATTACH_CANCELLED) throw cancellationException } catch (ignored: Exception) { |