summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuy Truong <duytruong@google.com>2022-11-30 18:48:00 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-11-30 18:48:00 +0000
commit282dcd9ea520720fb82a1edb690d8b59d7a99cb7 (patch)
tree8243c2566ac45a1a9c17b636c0a93980da02cce3
parent0861969d50a0100c9cd1c6a295ffc968540f946d (diff)
parent77cab01de895a57c563f09d9b1c0e53f699516c7 (diff)
downloadplatform_testing-282dcd9ea520720fb82a1edb690d8b59d7a99cb7.tar.gz
Fix SystemUtil.withProperty documentation and consistent API with other utils am: 00686f1e88 am: 77cab01de8
Original change: https://googleplex-android-review.googlesource.com/c/platform/platform_testing/+/20591585 Change-Id: Ic549d6901c0bf03036435f33ee95ba66b6013115 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 984ebf0f1..ffab6bd3f 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
@@ -64,9 +64,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));