summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuy Truong <duytruong@google.com>2022-11-30 22:15:12 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-11-30 22:15:12 +0000
commitfdce96c894edd730a9472beb007c7d1e51b3b268 (patch)
treeca3b6cdcd0a3721360831420b5343f969f650709
parent55633b7a34a7dcc45aa8976bbc6d098a9310e927 (diff)
parentfe72b5f50eabaafb59849496d2ed0a235d3da2d9 (diff)
downloadplatform_testing-fdce96c894edd730a9472beb007c7d1e51b3b268.tar.gz
Fix SystemUtil.withProperty documentation and consistent API with other utils am: 00686f1e88 am: 77cab01de8 am: 282dcd9ea5 am: c943fde680 am: d320008a20 am: 6e7b51909f am: 29ce4a2a44 am: fe72b5f50e
Original change: https://googleplex-android-review.googlesource.com/c/platform/platform_testing/+/20591585 Change-Id: I6707b9f2170eab9c5672ddded31154a26c4cb995 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java4
-rw-r--r--libraries/sts-common-util/host-side/src/com/android/sts/common/SystemUtil.java9
2 files changed, 6 insertions, 7 deletions
diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java
index 2e6c746e0..12665b2fb 100644
--- a/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java
+++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java
@@ -68,9 +68,9 @@ public class MallocDebug implements AutoCloseable {
try {
this.setMallocDebugOptionsProperty =
- SystemUtil.withProperty(MALLOC_DEBUG_OPTIONS_PROP, mallocDebugOption, device);
+ SystemUtil.withProperty(device, MALLOC_DEBUG_OPTIONS_PROP, mallocDebugOption);
this.setAttachedProgramProperty =
- SystemUtil.withProperty(MALLOC_DEBUG_PROGRAM_PROP, processName, device);
+ SystemUtil.withProperty(device, MALLOC_DEBUG_PROGRAM_PROP, processName);
// Kill and wait for the process to come back if we're attaching to a service
this.killProcess = null;
diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/SystemUtil.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/SystemUtil.java
index 3cc807f5e..5c2d3ef36 100644
--- a/libraries/sts-common-util/host-side/src/com/android/sts/common/SystemUtil.java
+++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/SystemUtil.java
@@ -31,16 +31,15 @@ public class SystemUtil {
private SystemUtil() {}
/**
- * Set the value of a property until return is closed
+ * Set the value of a property and set it back to old value upon closing.
*
+ * @param device the device to use
* @param name the name of the property to set
* @param value the value that the property should be set to
- * @param device the device to use
- * @return If enabling malloc debug succeeded: an object that will disable malloc debug when
- * closed. If enabling malloc debug did not succeed: null.
+ * @return AutoCloseable that resets the property back to old value upon closing
*/
public static AutoCloseable withProperty(
- final String name, final String value, final ITestDevice device)
+ final ITestDevice device, final String name, final String value)
throws DeviceNotAvailableException {
final String oldValue = device.getProperty(name);
assumeTrue("Could not set property: " + name, device.setProperty(name, value));