Merge "[WifiManager] Fix 2 UUIDs issue for test_energy_info_connected()"
diff --git a/acts/framework/acts/controllers/adb.py b/acts/framework/acts/controllers/adb.py
index 0c753cb..89d324d 100644
--- a/acts/framework/acts/controllers/adb.py
+++ b/acts/framework/acts/controllers/adb.py
@@ -32,6 +32,7 @@
 # Uses a regex to be backwards compatible with previous versions of ADB
 # (N and above add the serial to the error msg).
 DEVICE_NOT_FOUND_REGEX = re.compile('^error: device (?:\'.*?\' )?not found')
+DEVICE_OFFLINE_REGEX = re.compile('device offline')
 
 
 def parsing_parcel_output(output):
@@ -126,6 +127,8 @@
 
         logging.debug("cmd: %s, stdout: %s, stderr: %s, ret: %s", cmd, out,
                       err, ret)
+        if DEVICE_OFFLINE_REGEX.match(err):
+            raise AdbError(cmd=cmd, stdout=out, stderr=err, ret_code=ret)
         if "Result: Parcel" in out:
             return parsing_parcel_output(out)
         if ignore_status: