diff options
author | Duy Truong <duytruong@google.com> | 2022-10-12 01:37:08 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-10-12 01:37:08 +0000 |
commit | 72ff7b824ad16225d6d6332752d3494c9bf44d8f (patch) | |
tree | ab199a67d8ba7f4d793fd4b3632aa9ea59671b89 | |
parent | 39567ff77e23cced8db2dac51e6496a05aa0e3fc (diff) | |
parent | 1d9b367fb8e1eb8011d6ec96bf643642f7047fc0 (diff) | |
download | cts-72ff7b824ad16225d6d6332752d3494c9bf44d8f.tar.gz |
Rewrite Libc Malloc Debug and related utils. am: 1d9b367fb8
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/20123480
Change-Id: Id55a10e5b35ed242b919edd4c81f6b65dd8d5b7d
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 32d276841a1..17b9b6a7d35 100644 --- a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java +++ b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java @@ -254,48 +254,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 |