Remove isAdbRoot() check in setProperty() method.
Root is not required for setprop to work.
Test: presubmit
Test: tools/tradefederation/core/tests/run_tradefed_aosp_presubmit.sh
Bug: 150901232
Change-Id: Id59d28048d7e71c50b8e54f127b0134f895a1417
diff --git a/src/com/android/tradefed/device/NativeDevice.java b/src/com/android/tradefed/device/NativeDevice.java
index 1d1799e..32ee2c7 100644
--- a/src/com/android/tradefed/device/NativeDevice.java
+++ b/src/com/android/tradefed/device/NativeDevice.java
@@ -528,10 +528,6 @@
if (propKey == null || propValue == null) {
throw new IllegalArgumentException("set property key or value cannot be null.");
}
- if (!isAdbRoot()) {
- CLog.e("setProperty requires adb root = true.");
- return false;
- }
String setPropCmd = String.format("\"setprop %s '%s'\"", propKey, propValue);
CommandResult result = executeShellV2Command(setPropCmd);
if (CommandStatus.SUCCESS.equals(result.getStatus())) {
diff --git a/tests/src/com/android/tradefed/device/NativeDeviceTest.java b/tests/src/com/android/tradefed/device/NativeDeviceTest.java
index ebf44de..e8992d5 100644
--- a/tests/src/com/android/tradefed/device/NativeDeviceTest.java
+++ b/tests/src/com/android/tradefed/device/NativeDeviceTest.java
@@ -3028,21 +3028,6 @@
EasyMock.verify(mMockRunUtil, mMockIDevice);
}
- /** Unit test for {@link INativeDevice#setProperty(String, String)}. */
- @Test
- public void testSetProperty_notRoot() throws DeviceNotAvailableException {
- mTestDevice =
- new TestableAndroidNativeDevice() {
- @Override
- public boolean isAdbRoot() throws DeviceNotAvailableException {
- return false;
- }
- };
- EasyMock.replay(mMockRunUtil, mMockIDevice);
- assertFalse(mTestDevice.setProperty("test", "value"));
- EasyMock.verify(mMockRunUtil, mMockIDevice);
- }
-
/**
* Verifies that {@link INativeDevice#isExecutable(String)} recognizes regular executable file
*