diff --git a/adb/adb.cpp b/adb/adb.cpp
index 3005652..35e5945 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -33,6 +33,7 @@
 #include <string>
 #include <vector>
 
+#include <android-base/errors.h>
 #include <android-base/logging.h>
 #include <android-base/macros.h>
 #include <android-base/parsenetaddress.h>
@@ -473,7 +474,7 @@
         // Show the handle value to give us a clue in case we have problems
         // with pseudo-handle values.
         fprintf(stderr, "Cannot make handle 0x%p non-inheritable: %s\n",
-                h, SystemErrorCodeToString(GetLastError()).c_str());
+                h, android::base::SystemErrorCodeToString(GetLastError()).c_str());
         return false;
     }
 
@@ -489,7 +490,7 @@
     HANDLE pipe_write_raw = NULL;
     if (!CreatePipe(&pipe_read_raw, &pipe_write_raw, sa, 0)) {
         fprintf(stderr, "Cannot create pipe: %s\n",
-                SystemErrorCodeToString(GetLastError()).c_str());
+                android::base::SystemErrorCodeToString(GetLastError()).c_str());
         return false;
     }
 
@@ -528,7 +529,7 @@
                 return EXIT_SUCCESS;
             } else {
                 fprintf(stderr, "Failed to read from %s: %s\n", output_name,
-                        SystemErrorCodeToString(err).c_str());
+                        android::base::SystemErrorCodeToString(err).c_str());
                 return EXIT_FAILURE;
             }
         }
@@ -540,7 +541,7 @@
             if (!WriteFile(write_handle, buf, bytes_read, &bytes_written,
                            NULL)) {
                 fprintf(stderr, "Failed to write to %s: %s\n", output_name,
-                        SystemErrorCodeToString(GetLastError()).c_str());
+                        android::base::SystemErrorCodeToString(GetLastError()).c_str());
                 return EXIT_FAILURE;
             }
 
@@ -591,7 +592,7 @@
             FILE_ATTRIBUTE_NORMAL, NULL));
     if (nul_read.get() == INVALID_HANDLE_VALUE) {
         fprintf(stderr, "Cannot open 'nul': %s\n",
-                SystemErrorCodeToString(GetLastError()).c_str());
+                android::base::SystemErrorCodeToString(GetLastError()).c_str());
         return -1;
     }
 
@@ -661,7 +662,7 @@
     if ((module_result >= arraysize(program_path)) || (module_result == 0)) {
         // String truncation or some other error.
         fprintf(stderr, "Cannot get executable path: %s\n",
-                SystemErrorCodeToString(GetLastError()).c_str());
+                android::base::SystemErrorCodeToString(GetLastError()).c_str());
         return -1;
     }
 
@@ -687,7 +688,7 @@
             &startup,                 /* startup info, i.e. std handles */
             &pinfo )) {
         fprintf(stderr, "Cannot create process: %s\n",
-                SystemErrorCodeToString(GetLastError()).c_str());
+                android::base::SystemErrorCodeToString(GetLastError()).c_str());
         return -1;
     }
 
@@ -753,7 +754,7 @@
             fprintf(stderr, "could not read ok from ADB Server%s\n",
                     err == ERROR_BROKEN_PIPE ? "" :
                     android::base::StringPrintf(": %s",
-                            SystemErrorCodeToString(err).c_str()).c_str());
+                            android::base::SystemErrorCodeToString(err).c_str()).c_str());
         }
     }
 
@@ -784,7 +785,7 @@
 
     if (wait_result != WAIT_OBJECT_0) {
         fprintf(stderr, "Unexpected result waiting for threads: %lu: %s\n",
-                wait_result, SystemErrorCodeToString(GetLastError()).c_str());
+                wait_result, android::base::SystemErrorCodeToString(GetLastError()).c_str());
         return -1;
     }
 
diff --git a/adb/adb_auth_host.cpp b/adb/adb_auth_host.cpp
index facacef..8f154fd 100644
--- a/adb/adb_auth_host.cpp
+++ b/adb/adb_auth_host.cpp
@@ -43,6 +43,7 @@
 #include "mincrypt/rsa.h"
 #undef RSA_verify
 
+#include <android-base/errors.h>
 #include <android-base/strings.h>
 #include <cutils/list.h>
 
@@ -307,8 +308,7 @@
         WCHAR path[MAX_PATH];
         const HRESULT hr = SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path);
         if (FAILED(hr)) {
-            D("SHGetFolderPathW failed: %s",
-              SystemErrorCodeToString(hr).c_str());
+            D("SHGetFolderPathW failed: %s", android::base::SystemErrorCodeToString(hr).c_str());
             return -1;
         }
         if (!android::base::WideToUTF8(path, &home_str)) {
diff --git a/adb/client/main.cpp b/adb/client/main.cpp
index b37d04d..b7b30c5 100644
--- a/adb/client/main.cpp
+++ b/adb/client/main.cpp
@@ -27,6 +27,7 @@
 #include <sched.h>
 #endif
 
+#include <android-base/errors.h>
 #include <android-base/file.h>
 #include <android-base/logging.h>
 #include <android-base/stringprintf.h>
@@ -54,7 +55,7 @@
     if ((nchars >= arraysize(temp_path)) || (nchars == 0)) {
         // If string truncation or some other error.
         fatal("cannot retrieve temporary file path: %s\n",
-              SystemErrorCodeToString(GetLastError()).c_str());
+              android::base::SystemErrorCodeToString(GetLastError()).c_str());
     }
 
     std::string temp_path_utf8;
@@ -134,7 +135,7 @@
         DWORD written = 0;
         if (!WriteFile(ack_reply_handle, ack, bytes_to_write, &written, NULL)) {
             fatal("adb: cannot write ACK to handle 0x%p: %s", ack_reply_handle,
-                  SystemErrorCodeToString(GetLastError()).c_str());
+                  android::base::SystemErrorCodeToString(GetLastError()).c_str());
         }
         if (written != bytes_to_write) {
             fatal("adb: cannot write %lu bytes of ACK: only wrote %lu bytes",
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index 0abade4..d89f0de 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -253,9 +253,6 @@
     return isalpha(path[0]) && path[1] == ':' && path[2] == '\\';
 }
 
-// Like strerror(), but for Win32 error codes.
-std::string SystemErrorCodeToString(DWORD error_code);
-
 // We later define a macro mapping 'stat' to 'adb_stat'. This causes:
 //   struct stat s;
 //   stat(filename, &s);
diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp
index bea47a2..dece96f 100644
--- a/adb/sysdeps_win32.cpp
+++ b/adb/sysdeps_win32.cpp
@@ -32,6 +32,7 @@
 
 #include <cutils/sockets.h>
 
+#include <android-base/errors.h>
 #include <android-base/logging.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
@@ -93,36 +94,6 @@
         if (!(cond)) fatal("assertion failed '%s' on %s:%d\n", #cond, __FILE__, __LINE__); \
     } while (0)
 
-std::string SystemErrorCodeToString(const DWORD error_code) {
-  const int kErrorMessageBufferSize = 256;
-  WCHAR msgbuf[kErrorMessageBufferSize];
-  DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
-  DWORD len = FormatMessageW(flags, nullptr, error_code, 0, msgbuf,
-                             arraysize(msgbuf), nullptr);
-  if (len == 0) {
-    return android::base::StringPrintf(
-        "Error (%lu) while retrieving error. (%lu)", GetLastError(),
-        error_code);
-  }
-
-  // Convert UTF-16 to UTF-8.
-  std::string msg;
-  if (!android::base::WideToUTF8(msgbuf, &msg)) {
-      return android::base::StringPrintf(
-          "Error (%d) converting from UTF-16 to UTF-8 while retrieving error. (%lu)", errno,
-          error_code);
-  }
-
-  // Messages returned by the system end with line breaks.
-  msg = android::base::Trim(msg);
-  // There are many Windows error messages compared to POSIX, so include the
-  // numeric error code for easier, quicker, accurate identification. Use
-  // decimal instead of hex because there are decimal ranges like 10000-11999
-  // for Winsock.
-  android::base::StringAppendF(&msg, " (%lu)", error_code);
-  return msg;
-}
-
 void handle_deleter::operator()(HANDLE h) {
     // CreateFile() is documented to return INVALID_HANDLE_FILE on error,
     // implying that NULL is a valid handle, but this is probably impossible.
@@ -134,7 +105,7 @@
     if (h != INVALID_HANDLE_VALUE) {
         if (!CloseHandle(h)) {
             D("CloseHandle(%p) failed: %s", h,
-              SystemErrorCodeToString(GetLastError()).c_str());
+              android::base::SystemErrorCodeToString(GetLastError()).c_str());
         }
     }
 }
@@ -470,8 +441,7 @@
                 return -1;
 
             default:
-                D( "unknown error: %s",
-                   SystemErrorCodeToString( err ).c_str() );
+                D("unknown error: %s", android::base::SystemErrorCodeToString(err).c_str());
                 errno = ENOENT;
                 return -1;
         }
@@ -517,8 +487,7 @@
                 return -1;
 
             default:
-                D( "unknown error: %s",
-                   SystemErrorCodeToString( err ).c_str() );
+                D("unknown error: %s", android::base::SystemErrorCodeToString(err).c_str());
                 errno = ENOENT;
                 return -1;
         }
@@ -708,7 +677,7 @@
     f->event     = WSACreateEvent();
     if (f->event == WSA_INVALID_EVENT) {
         D("WSACreateEvent failed: %s",
-          SystemErrorCodeToString(WSAGetLastError()).c_str());
+          android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
 
         // _event_socket_start assumes that this field is INVALID_HANDLE_VALUE
         // on failure, instead of NULL which is what Windows really returns on
@@ -727,19 +696,19 @@
             // minimize logging spam, so don't log these errors for now.
 #if 0
             D("socket shutdown failed: %s",
-              SystemErrorCodeToString(WSAGetLastError()).c_str());
+              android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
 #endif
         }
         if (closesocket(f->fh_socket) == SOCKET_ERROR) {
             D("closesocket failed: %s",
-              SystemErrorCodeToString(WSAGetLastError()).c_str());
+              android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         }
         f->fh_socket = INVALID_SOCKET;
     }
     if (f->event != NULL) {
         if (!CloseHandle(f->event)) {
             D("CloseHandle failed: %s",
-              SystemErrorCodeToString(GetLastError()).c_str());
+              android::base::SystemErrorCodeToString(GetLastError()).c_str());
         }
         f->event = NULL;
     }
@@ -760,7 +729,7 @@
         // that to reduce spam and confusion.
         if (err != WSAEWOULDBLOCK) {
             D("recv fd %d failed: %s", _fh_to_int(f),
-              SystemErrorCodeToString(err).c_str());
+              android::base::SystemErrorCodeToString(err).c_str());
         }
         _socket_set_errno(err);
         result = -1;
@@ -776,7 +745,7 @@
         // that to reduce spam and confusion.
         if (err != WSAEWOULDBLOCK) {
             D("send fd %d failed: %s", _fh_to_int(f),
-              SystemErrorCodeToString(err).c_str());
+              android::base::SystemErrorCodeToString(err).c_str());
         }
         _socket_set_errno(err);
         result = -1;
@@ -811,8 +780,8 @@
         WSADATA  wsaData;
         int      rc = WSAStartup( MAKEWORD(2,2), &wsaData);
         if (rc != 0) {
-            fatal( "adb: could not initialize Winsock: %s",
-                   SystemErrorCodeToString( rc ).c_str());
+            fatal("adb: could not initialize Winsock: %s",
+                  android::base::SystemErrorCodeToString(rc).c_str());
         }
         _winsock_init = 1;
 
@@ -870,7 +839,7 @@
     s = socket(AF_INET, type, GetSocketProtocolFromSocketType(type));
     if(s == INVALID_SOCKET) {
         *error = android::base::StringPrintf("cannot create socket: %s",
-                SystemErrorCodeToString(WSAGetLastError()).c_str());
+                android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         D("%s", error->c_str());
         return -1;
     }
@@ -881,7 +850,7 @@
         const DWORD err = WSAGetLastError();
         *error = android::base::StringPrintf("cannot connect to %s:%u: %s",
                 inet_ntoa(addr.sin_addr), ntohs(addr.sin_port),
-                SystemErrorCodeToString(err).c_str());
+                android::base::SystemErrorCodeToString(err).c_str());
         D("could not connect to %s:%d: %s",
           type != SOCK_STREAM ? "udp" : "tcp", port, error->c_str());
         return -1;
@@ -924,7 +893,7 @@
     s = socket(AF_INET, type, GetSocketProtocolFromSocketType(type));
     if (s == INVALID_SOCKET) {
         *error = android::base::StringPrintf("cannot create socket: %s",
-                SystemErrorCodeToString(WSAGetLastError()).c_str());
+                android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         D("%s", error->c_str());
         return -1;
     }
@@ -938,7 +907,7 @@
                    sizeof(n)) == SOCKET_ERROR) {
         *error = android::base::StringPrintf(
                 "cannot set socket option SO_EXCLUSIVEADDRUSE: %s",
-                SystemErrorCodeToString(WSAGetLastError()).c_str());
+                android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         D("%s", error->c_str());
         return -1;
     }
@@ -948,7 +917,7 @@
         const DWORD err = WSAGetLastError();
         *error = android::base::StringPrintf("cannot bind to %s:%u: %s",
                 inet_ntoa(addr.sin_addr), ntohs(addr.sin_port),
-                SystemErrorCodeToString(err).c_str());
+                android::base::SystemErrorCodeToString(err).c_str());
         D("could not bind to %s:%d: %s",
           type != SOCK_STREAM ? "udp" : "tcp", port, error->c_str());
         return -1;
@@ -956,7 +925,7 @@
     if (type == SOCK_STREAM) {
         if (listen(s, LISTEN_BACKLOG) == SOCKET_ERROR) {
             *error = android::base::StringPrintf("cannot listen on socket: %s",
-                    SystemErrorCodeToString(WSAGetLastError()).c_str());
+                    android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
             D("could not listen on %s:%d: %s",
               type != SOCK_STREAM ? "udp" : "tcp", port, error->c_str());
             return -1;
@@ -1010,7 +979,7 @@
     if (getaddrinfo(host.c_str(), port_str, &hints, &addrinfo_ptr) != 0) {
         *error = android::base::StringPrintf(
                 "cannot resolve host '%s' and port %s: %s", host.c_str(),
-                port_str, SystemErrorCodeToString(WSAGetLastError()).c_str());
+                port_str, android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         D("%s", error->c_str());
         return -1;
     }
@@ -1025,7 +994,7 @@
                       addrinfo->ai_protocol);
     if(s == INVALID_SOCKET) {
         *error = android::base::StringPrintf("cannot create socket: %s",
-                SystemErrorCodeToString(WSAGetLastError()).c_str());
+                android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         D("%s", error->c_str());
         return -1;
     }
@@ -1037,7 +1006,7 @@
         // TODO: Use WSAAddressToString or inet_ntop on address.
         *error = android::base::StringPrintf("cannot connect to %s:%s: %s",
                 host.c_str(), port_str,
-                SystemErrorCodeToString(WSAGetLastError()).c_str());
+                android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
         D("could not connect to %s:%s:%s: %s",
           type != SOCK_STREAM ? "udp" : "tcp", host.c_str(), port_str,
           error->c_str());
@@ -1075,7 +1044,7 @@
     if (fh->fh_socket == INVALID_SOCKET) {
         const DWORD err = WSAGetLastError();
         LOG(ERROR) << "adb_socket_accept: accept on fd " << serverfd <<
-                      " failed: " + SystemErrorCodeToString(err);
+                      " failed: " + android::base::SystemErrorCodeToString(err);
         _socket_set_errno( err );
         return -1;
     }
@@ -1106,9 +1075,8 @@
                              reinterpret_cast<const char*>(optval), optlen );
     if ( result == SOCKET_ERROR ) {
         const DWORD err = WSAGetLastError();
-        D( "adb_setsockopt: setsockopt on fd %d level %d optname %d "
-           "failed: %s\n", fd, level, optname,
-           SystemErrorCodeToString(err).c_str() );
+        D("adb_setsockopt: setsockopt on fd %d level %d optname %d failed: %s\n",
+          fd, level, optname, android::base::SystemErrorCodeToString(err).c_str());
         _socket_set_errno( err );
         result = -1;
     }
@@ -1130,7 +1098,7 @@
     if (shutdown(f->fh_socket, SD_BOTH) == SOCKET_ERROR) {
         const DWORD err = WSAGetLastError();
         D("socket shutdown fd %d failed: %s", fd,
-          SystemErrorCodeToString(err).c_str());
+          android::base::SystemErrorCodeToString(err).c_str());
         _socket_set_errno(err);
         return -1;
     }
@@ -2575,7 +2543,7 @@
         memset(input_record, 0, sizeof(*input_record));
         if (!ReadConsoleInputA(console, input_record, 1, &read_count)) {
             D("_get_key_event_record: ReadConsoleInputA() failed: %s\n",
-              SystemErrorCodeToString(GetLastError()).c_str());
+              android::base::SystemErrorCodeToString(GetLastError()).c_str());
             errno = EIO;
             return false;
         }
@@ -3344,7 +3312,7 @@
     if (!SetConsoleMode(in, new_console_mode)) {
         // This really should not fail.
         D("stdin_raw_init: SetConsoleMode() failed: %s",
-          SystemErrorCodeToString(GetLastError()).c_str());
+          android::base::SystemErrorCodeToString(GetLastError()).c_str());
     }
 
     // Once this is set, it means that stdin has been configured for
@@ -3364,7 +3332,7 @@
         if (!SetConsoleMode(in, _old_console_mode)) {
             // This really should not fail.
             D("stdin_raw_restore: SetConsoleMode() failed: %s",
-              SystemErrorCodeToString(GetLastError()).c_str());
+              android::base::SystemErrorCodeToString(GetLastError()).c_str());
         }
     }
 }
diff --git a/adb/usb_windows.cpp b/adb/usb_windows.cpp
index 8d3501e..e79008f 100644
--- a/adb/usb_windows.cpp
+++ b/adb/usb_windows.cpp
@@ -27,6 +27,8 @@
 #include <windows.h>
 #include <winerror.h>
 
+#include <android-base/errors.h>
+
 #include "adb.h"
 #include "transport.h"
 
@@ -221,7 +223,7 @@
   if (!instance) {
     // This is such a common API call that this should never fail.
     fatal("GetModuleHandleW failed: %s",
-          SystemErrorCodeToString(GetLastError()).c_str());
+          android::base::SystemErrorCodeToString(GetLastError()).c_str());
   }
 
   WNDCLASSEXW wndclass;
@@ -232,14 +234,14 @@
   wndclass.lpszClassName = kPowerNotificationWindowClassName;
   if (!RegisterClassExW(&wndclass)) {
     fatal("RegisterClassExW failed: %s",
-          SystemErrorCodeToString(GetLastError()).c_str());
+          android::base::SystemErrorCodeToString(GetLastError()).c_str());
   }
 
   if (!CreateWindowExW(WS_EX_NOACTIVATE, kPowerNotificationWindowClassName,
                        L"ADB Power Notification Window", WS_POPUP, 0, 0, 0, 0,
                        NULL, NULL, instance, NULL)) {
     fatal("CreateWindowExW failed: %s",
-          SystemErrorCodeToString(GetLastError()).c_str());
+          android::base::SystemErrorCodeToString(GetLastError()).c_str());
   }
 
   MSG msg;
@@ -285,7 +287,7 @@
   ret->adb_interface = AdbCreateInterfaceByName(interface_name);
   if (NULL == ret->adb_interface) {
     D("AdbCreateInterfaceByName failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     goto fail;
   }
 
@@ -296,7 +298,7 @@
                                    AdbOpenSharingModeReadWrite);
   if (NULL == ret->adb_read_pipe) {
     D("AdbOpenDefaultBulkReadEndpoint failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     goto fail;
   }
 
@@ -307,7 +309,7 @@
                                     AdbOpenSharingModeReadWrite);
   if (NULL == ret->adb_write_pipe) {
     D("AdbOpenDefaultBulkWriteEndpoint failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     goto fail;
   }
 
@@ -319,7 +321,7 @@
                       false);
   if (0 == name_len) {
     D("AdbGetInterfaceName returned name length of zero: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     goto fail;
   }
 
@@ -335,7 +337,7 @@
                            &name_len,
                            false)) {
     D("AdbGetInterfaceName failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     goto fail;
   }
 
@@ -370,7 +372,7 @@
                             &written,
                             time_out)) {
     D("AdbWriteEndpointSync failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     err = EIO;
     goto fail;
   }
@@ -394,7 +396,7 @@
                               &written,
                               time_out)) {
       D("AdbWriteEndpointSync of zero length packet failed: %s",
-        SystemErrorCodeToString(GetLastError()).c_str());
+        android::base::SystemErrorCodeToString(GetLastError()).c_str());
       err = EIO;
       goto fail;
     }
@@ -431,7 +433,7 @@
     if (!AdbReadEndpointSync(handle->adb_read_pipe, data, len, &read,
                              time_out)) {
       D("AdbReadEndpointSync failed: %s",
-        SystemErrorCodeToString(GetLastError()).c_str());
+        android::base::SystemErrorCodeToString(GetLastError()).c_str());
       err = EIO;
       goto fail;
     }
@@ -460,7 +462,7 @@
 static void _adb_close_handle(ADBAPIHANDLE adb_handle) {
   if (!AdbCloseHandle(adb_handle)) {
     D("AdbCloseHandle(%p) failed: %s", adb_handle,
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
   }
 }
 
@@ -539,7 +541,7 @@
   if (!AdbGetUsbDeviceDescriptor(handle->adb_interface,
                                  &device_desc)) {
     D("AdbGetUsbDeviceDescriptor failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     return 0;
   }
 
@@ -549,7 +551,7 @@
   if (!AdbGetUsbInterfaceDescriptor(handle->adb_interface,
                                     &interf_desc)) {
     D("AdbGetUsbInterfaceDescriptor failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     return 0;
   }
 
@@ -569,7 +571,7 @@
         D("device zero_mask: 0x%x", handle->zero_mask);
       } else {
         D("AdbGetEndpointInformation failed: %s",
-          SystemErrorCodeToString(GetLastError()).c_str());
+          android::base::SystemErrorCodeToString(GetLastError()).c_str());
       }
     }
 
@@ -591,7 +593,7 @@
 
   if (NULL == enum_handle) {
     D("AdbEnumInterfaces failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
     return;
   }
 
@@ -627,7 +629,7 @@
             }
           } else {
             D("cannot get serial number: %s",
-              SystemErrorCodeToString(GetLastError()).c_str());
+              android::base::SystemErrorCodeToString(GetLastError()).c_str());
             usb_cleanup_handle(handle);
             free(handle);
           }
@@ -644,7 +646,7 @@
   if (GetLastError() != ERROR_NO_MORE_ITEMS) {
     // Only ERROR_NO_MORE_ITEMS is expected at the end of enumeration.
     D("AdbNextInterface failed: %s",
-      SystemErrorCodeToString(GetLastError()).c_str());
+      android::base::SystemErrorCodeToString(GetLastError()).c_str());
   }
 
   _adb_close_handle(enum_handle);
