diff options
author | Duy Truong <duytruong@google.com> | 2022-10-09 03:27:28 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-10-09 03:27:28 +0000 |
commit | 4f1dc64623c97da5d6b3e0b9fcab5a6b152f0922 (patch) | |
tree | 8860d48835313b2cb48265b12e195dae7a2dd92a | |
parent | 295fc350bb8702b050cd2d5b510c07594faf076b (diff) | |
parent | d64a251f0d3d20d4a7c7ccc713cba3b1f563fef2 (diff) | |
download | cts-4f1dc64623c97da5d6b3e0b9fcab5a6b152f0922.tar.gz |
Merge "Rewrite Libc Malloc Debug and related utils." into sc-dev am: d64a251f0d
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/20123490
Change-Id: If16739e5b598da219b2e3aedad2efa45d30a8121
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java | 42 |
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 |