[Android] Switch to DeviceUtils versions of GetMemoryUsageForPid and __str__.

BUG=267773

Review URL: https://codereview.chromium.org/404993004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285097 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 0af49a8f2b05ecca92f3ae64ded123bdafe07c1a
diff --git a/build/android/pylib/forwarder.py b/build/android/pylib/forwarder.py
index be67d7d..c5d4f59 100644
--- a/build/android/pylib/forwarder.py
+++ b/build/android/pylib/forwarder.py
@@ -89,7 +89,7 @@
       instance = Forwarder._GetInstanceLocked(tool)
       instance._InitDeviceLocked(device, tool)
 
-      device_serial = device.old_interface.Adb().GetSerialNumber()
+      device_serial = str(device)
       redirection_commands = [
           ['--serial-id=' + device_serial, '--map', str(device),
            str(host)] for device, host in port_pairs]
@@ -147,7 +147,7 @@
     with _FileLock(Forwarder._LOCK_PATH):
       if not Forwarder._instance:
         return
-      adb_serial = device.old_interface.Adb().GetSerialNumber()
+      adb_serial = str(device)
       if adb_serial not in Forwarder._instance._initialized_devices:
         return
       port_map = Forwarder._GetInstanceLocked(
@@ -224,7 +224,7 @@
     Note that the global lock must be acquired before calling this method.
     """
     instance = Forwarder._GetInstanceLocked(None)
-    serial = device.old_interface.Adb().GetSerialNumber()
+    serial = str(device)
     serial_with_port = (serial, device_port)
     if not serial_with_port in instance._device_to_host_port_map:
       logging.error('Trying to unmap non-forwarded port %d' % device_port)
@@ -286,7 +286,7 @@
       tool: Tool class to use to get wrapper, if necessary, for executing the
             forwarder (see valgrind_tools.py).
     """
-    device_serial = device.old_interface.Adb().GetSerialNumber()
+    device_serial = str(device)
     if device_serial in self._initialized_devices:
       return
     Forwarder._KillDeviceLocked(device, tool)
diff --git a/build/android/pylib/screenshot.py b/build/android/pylib/screenshot.py
index d69bb9a..e21d756 100644
--- a/build/android/pylib/screenshot.py
+++ b/build/android/pylib/screenshot.py
@@ -38,8 +38,8 @@
     self._is_started = False
 
     self._args = ['adb']
-    if self._device.old_interface.GetDevice():
-      self._args += ['-s', self._device.old_interface.GetDevice()]
+    if str(self._device):
+      self._args += ['-s', str(self._device)]
     self._args += ['shell', 'screenrecord', '--verbose']
     self._args += ['--bit-rate', str(megabits_per_second * 1000 * 1000)]
     if size:
diff --git a/build/android/pylib/valgrind_tools.py b/build/android/pylib/valgrind_tools.py
index f11ab03..69f351a 100644
--- a/build/android/pylib/valgrind_tools.py
+++ b/build/android/pylib/valgrind_tools.py
@@ -117,7 +117,7 @@
     """Copies ASan tools to the device."""
     subprocess.call([os.path.join(DIR_SOURCE_ROOT,
                                   'tools/android/asan/asan_device_setup.sh'),
-                     '--device', self._device.old_interface.GetDevice(),
+                     '--device', str(self._device),
                      '--lib', self._lib,
                      '--extra-options', AddressSanitizerTool.EXTRA_OPTIONS])
     self._device.WaitUntilFullyBooted()