diff options
author | Renaud Paquay <rpaquay@google.com> | 2022-08-08 13:01:03 -0700 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2022-08-10 22:36:20 +0000 |
commit | c4195b7f3873b293c8a9824577c8a1f64ea59f84 (patch) | |
tree | 213c0d0f090eb6353e92746305dbd8c0ac20a3ac | |
parent | 28ff9491d617dd734e13bcb5c745208f232130a3 (diff) | |
download | base-c4195b7f3873b293c8a9824577c8a1f64ea59f84.tar.gz |
adblib: Add support for Client.isDdmAware()
Bug: 241411829, 188067646
Test: Included
Change-Id: I7fb07e9bd2ec3f907db8f3811403c6215f17862c
2 files changed, 4 insertions, 2 deletions
diff --git a/adblib-ddmlibcompatibility/src/com/android/adblib/ddmlibcompatibility/debugging/AdblibClientWrapper.kt b/adblib-ddmlibcompatibility/src/com/android/adblib/ddmlibcompatibility/debugging/AdblibClientWrapper.kt index 082242d03a..f6b593224e 100644 --- a/adblib-ddmlibcompatibility/src/com/android/adblib/ddmlibcompatibility/debugging/AdblibClientWrapper.kt +++ b/adblib-ddmlibcompatibility/src/com/android/adblib/ddmlibcompatibility/debugging/AdblibClientWrapper.kt @@ -43,7 +43,9 @@ internal class AdblibClientWrapper( // Note: This should return `true` when there has been DDMS packet seen // on the JDWP connection to the process. This is a signal the process // is a process running on an Android VM. - TODO("Not yet implemented") + // We use vmIdentifier as a proxy for checking a DDM HELO packet has + // been received. + return jdwpProcess.properties.vmIdentifier != null } override fun getClientData(): ClientData { diff --git a/adblib-ddmlibcompatibility/test/src/com/android/adblib/ddmlibcompatibility/debugging/AdbLibDeviceClientManagerTest.kt b/adblib-ddmlibcompatibility/test/src/com/android/adblib/ddmlibcompatibility/debugging/AdbLibDeviceClientManagerTest.kt index dea5ea61b3..0ac445265d 100644 --- a/adblib-ddmlibcompatibility/test/src/com/android/adblib/ddmlibcompatibility/debugging/AdbLibDeviceClientManagerTest.kt +++ b/adblib-ddmlibcompatibility/test/src/com/android/adblib/ddmlibcompatibility/debugging/AdbLibDeviceClientManagerTest.kt @@ -152,7 +152,7 @@ class AdbLibDeviceClientManagerTest { Assert.assertSame(device, client.device) Assert.assertNotNull(client.clientData) Assert.assertEquals(10, client.clientData.pid) - assertThrows { client.isDdmAware } + Assert.assertTrue(client.isDdmAware) assertThrows { client.kill() } Assert.assertTrue(client.isValid) Assert.assertTrue(client.debuggerListenPort > 0) |