Merge "expose options from test device."
diff --git a/prod-tests/src/com/android/framework/tests/PackageManagerHostTestsNonRoot.java b/prod-tests/src/com/android/framework/tests/PackageManagerHostTestsNonRoot.java
index cb96bf1..c38de20 100644
--- a/prod-tests/src/com/android/framework/tests/PackageManagerHostTestsNonRoot.java
+++ b/prod-tests/src/com/android/framework/tests/PackageManagerHostTestsNonRoot.java
@@ -63,7 +63,7 @@
// If device is currently in adb root, reboot.
if (getDevice().isAdbRoot()) {
- TestDeviceOptions options = new TestDeviceOptions();
+ TestDeviceOptions options = getDevice().getOptions();
options.setEnableAdbRoot(false);
getDevice().setOptions(options);
getDevice().reboot();
diff --git a/src/com/android/tradefed/device/ITestDevice.java b/src/com/android/tradefed/device/ITestDevice.java
index e4fadbe..64eeca1 100644
--- a/src/com/android/tradefed/device/ITestDevice.java
+++ b/src/com/android/tradefed/device/ITestDevice.java
@@ -874,6 +874,13 @@
public void setOptions(TestDeviceOptions options);
/**
+ * Fetch the test options for the device.
+ *
+ * @return {@link TestDeviceOptions} related to the device under test.
+ */
+ public TestDeviceOptions getOptions();
+
+ /**
* Fetch the package names installed on the device.
*
* @return {@link Set} of {@link String} package names currently installed on the device.
diff --git a/src/com/android/tradefed/device/TestDevice.java b/src/com/android/tradefed/device/TestDevice.java
index d4e2dcb..a78d68d 100644
--- a/src/com/android/tradefed/device/TestDevice.java
+++ b/src/com/android/tradefed/device/TestDevice.java
@@ -2366,4 +2366,12 @@
}
return packages;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TestDeviceOptions getOptions() {
+ return mOptions;
+ }
}
diff --git a/tests/src/com/android/tradefed/device/StubTestDevice.java b/tests/src/com/android/tradefed/device/StubTestDevice.java
index 46076a1..5086ab0 100644
--- a/tests/src/com/android/tradefed/device/StubTestDevice.java
+++ b/tests/src/com/android/tradefed/device/StubTestDevice.java
@@ -21,6 +21,7 @@
import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.ITestRunListener;
import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.device.TestDeviceOptions;
import com.android.tradefed.result.InputStreamSource;
import com.android.tradefed.util.CommandResult;
@@ -689,4 +690,13 @@
public boolean isAdbRoot() throws DeviceNotAvailableException {
return false;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TestDeviceOptions getOptions() {
+ // ignore
+ return null;
+ }
}