summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuy Truong <duytruong@google.com>2022-10-09 02:53:20 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-10-09 02:53:20 +0000
commitd64a251f0d3d20d4a7c7ccc713cba3b1f563fef2 (patch)
treed8c34d92fd496c1bbcd1ebd76bd0097e737d89c3
parenta0090376e7959d701a9e76fbb43449eca9eb5228 (diff)
parentb3409c0e556430d1ac5547f29b52e6ef08913376 (diff)
downloadcts-d64a251f0d3d20d4a7c7ccc713cba3b1f563fef2.tar.gz
Merge "Rewrite Libc Malloc Debug and related utils." into sc-dev
-rw-r--r--hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java42
1 files changed, 0 insertions, 42 deletions
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
index a1c2dee4461..bef0e9a7558 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
@@ -262,48 +262,6 @@ public class AdbUtils {
}
/**
- * Enables malloc debug on a given process.
- *
- * @param processName the name of the process to run with libc malloc debug
- * @param device the device to use
- * @return true if enabling malloc debug succeeded
- */
- public static boolean enableLibcMallocDebug(String processName, ITestDevice device) throws Exception {
- device.executeShellCommand("setprop libc.debug.malloc.program " + processName);
- device.executeShellCommand("setprop libc.debug.malloc.options \"backtrace guard\"");
- /**
- * The pidof command is being avoided because it does not exist on versions before M, and
- * it behaves differently between M and N.
- * Also considered was the ps -AoPID,CMDLINE command, but ps does not support options on
- * versions before O.
- * The [^]] prefix is being used for the grep command to avoid the case where the output of
- * ps includes the grep command itself.
- */
- String cmdOut = device.executeShellCommand("ps -A | grep '[^]]" + processName + "'");
- /**
- * .hasNextInt() checks if the next token can be parsed as an integer, not if any remaining
- * token is an integer.
- * Example command: $ ps | fgrep mediaserver
- * Out: media 269 1 77016 24416 binder_thr 00f35142ec S /system/bin/mediaserver
- * The second field of the output is the PID, which is needed to restart the process.
- */
- Scanner s = new Scanner(cmdOut).useDelimiter("\\D+");
- if(!s.hasNextInt()) {
- CLog.w("Could not find pid for process: " + processName);
- return false;
- }
-
- String result = device.executeShellCommand("kill -9 " + s.nextInt());
- if(!result.equals("")) {
- CLog.w("Could not restart process: " + processName);
- return false;
- }
-
- TimeUnit.SECONDS.sleep(1);
- return true;
- }
-
- /**
* Pushes and installs an apk to the selected device
*
* @param pathToApk a string path to apk from the /res folder