Index: build/android/gyp/util/build_device.py |
diff --git a/build/android/gyp/util/build_device.py b/build/android/gyp/util/build_device.py |
index 928bd02f8c2f60ff4c716d5248dc4b86f090b898..8d694c12a67946ab962c07a7eaf6992de90ab9f3 100644 |
--- a/build/android/gyp/util/build_device.py |
+++ b/build/android/gyp/util/build_device.py |
@@ -17,6 +17,7 @@ BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..', '..') |
sys.path.append(BUILD_ANDROID_DIR) |
from pylib import android_commands |
+from pylib.device import device_errors |
from pylib.device import device_utils |
GetAttachedDevices = android_commands.GetAttachedDevices |
@@ -57,16 +58,21 @@ def GetConfigurationForDevice(device_id): |
device = device_utils.DeviceUtils(device_id) |
configuration = None |
has_root = False |
- is_online = device.old_interface.IsOnline() |
+ is_online = device.IsOnline() |
if is_online: |
cmd = 'ls -l /data/app; getprop ro.build.description' |
cmd_output = device.old_interface.RunShellCommand(cmd) |
has_root = not 'Permission denied' in cmd_output[0] |
if not has_root: |
- # Disable warning log messages from EnableAdbRoot() |
+ # Disable warning log messages from EnableRoot() |
logging.getLogger().disabled = True |
- has_root = device.old_interface.EnableAdbRoot() |
- logging.getLogger().disabled = False |
+ try: |
+ device.EnableRoot() |
+ has_root = True |
+ except device_errors.CommandFailedError: |
+ has_root = False |
+ finally: |
+ logging.getLogger().disabled = False |
cmd_output = device.old_interface.RunShellCommand(cmd) |
configuration = { |