Merge "Add AIDL Interface for DebugUtils Service"
diff --git a/debugutils/aidl/Android.bp b/debugutils/aidl/Android.bp
new file mode 100644
index 0000000..13ee37b
--- /dev/null
+++ b/debugutils/aidl/Android.bp
@@ -0,0 +1,25 @@
+aidl_interface {
+    name: "vendor.qti.hardware.debugutils_aidl",
+    vendor_available: true,
+    srcs: ["vendor/qti/hardware/debugutils/*.aidl"],
+    stability: "vintf",
+    backend: {
+        cpp: {
+            enabled: false,
+        },
+        java: {
+            sdk_version: "module_current",
+        },
+        ndk: {
+            enabled: true,
+        },
+    },
+    versions_with_info: [
+        {
+            version: "1",
+            imports: [],
+        },
+    ],
+    frozen: true,
+
+}
diff --git a/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/1/.hash b/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/1/.hash
new file mode 100644
index 0000000..3903390
--- /dev/null
+++ b/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/1/.hash
@@ -0,0 +1 @@
+5b3c569e783d4550ccbfb7e5b4c279c949f36903
diff --git a/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/1/vendor/qti/hardware/debugutils/IDebugUtils.aidl b/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/1/vendor/qti/hardware/debugutils/IDebugUtils.aidl
new file mode 100644
index 0000000..c6f3204
--- /dev/null
+++ b/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/1/vendor/qti/hardware/debugutils/IDebugUtils.aidl
@@ -0,0 +1,47 @@
+/*
+*Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+*SPDX-License-Identifier: BSD-3-Clause-Clear
+*/
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package vendor.qti.hardware.debugutils;
+@VintfStability
+interface IDebugUtils {
+  void collectBinderDebugInfoByPid(in long pid, in boolean isBlocking, in String debugTag);
+  void collectBinderDebugInfoByProcessname(in String processName, in boolean isBlocking, in String debugTag);
+  void collectCPUInfo(in boolean isBlocking, in String debugTag);
+  void collectDependentProcessStackTrace(in long pid, in boolean isBlocking, in String debugTag);
+  void collectFullBinderDebugInfo(in boolean isBlocking, in String debugTag);
+  void collectHprof(in boolean isBlocking, in long pid, in String debugTag);
+  void collectMemoryInfo(in boolean isBlocking, in String debugTag);
+  void collectPeriodicTraces(in long pid, in long duration, in String debugTag);
+  void collectProcessCPUInfo(in boolean isBlocking, in long pid, in String debugTag);
+  void collectProcessMemoryInfo(in boolean isBlocking, in long pid, in String debugTag);
+  void collectRamdump(in String debugTag);
+  void collectStackTraceByPid(in long pid, in boolean isJava, in boolean isBlocking, in String debugTag);
+  void collectStackTraceByProcessName(in String processName, in boolean isJava, in boolean isBlocking, in String debugTag);
+  void collectUserspaceLogs(in String logCmd, in String debugTag, in long duration);
+  void executeDumpsysCommands(in String command, in boolean isBlocking, in String debugTag);
+  void setBreakPoint(in long pid, in boolean isProcess, in String debugTag);
+  void setWatchPoint(in long pid, in long add, in String debugTag);
+  void startPerfettoTracing(in long duration, in String debugTag);
+  void startSimplePerfTracing(in long pid, in long duration, in String debugTag);
+  void stopPerfettoTracing(in String debugTag);
+  void stopSimplePerfTracing(in String debugTag);
+}
diff --git a/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/current/vendor/qti/hardware/debugutils/IDebugUtils.aidl b/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/current/vendor/qti/hardware/debugutils/IDebugUtils.aidl
new file mode 100644
index 0000000..c6f3204
--- /dev/null
+++ b/debugutils/aidl/aidl_api/vendor.qti.hardware.debugutils_aidl/current/vendor/qti/hardware/debugutils/IDebugUtils.aidl
@@ -0,0 +1,47 @@
+/*
+*Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+*SPDX-License-Identifier: BSD-3-Clause-Clear
+*/
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package vendor.qti.hardware.debugutils;
+@VintfStability
+interface IDebugUtils {
+  void collectBinderDebugInfoByPid(in long pid, in boolean isBlocking, in String debugTag);
+  void collectBinderDebugInfoByProcessname(in String processName, in boolean isBlocking, in String debugTag);
+  void collectCPUInfo(in boolean isBlocking, in String debugTag);
+  void collectDependentProcessStackTrace(in long pid, in boolean isBlocking, in String debugTag);
+  void collectFullBinderDebugInfo(in boolean isBlocking, in String debugTag);
+  void collectHprof(in boolean isBlocking, in long pid, in String debugTag);
+  void collectMemoryInfo(in boolean isBlocking, in String debugTag);
+  void collectPeriodicTraces(in long pid, in long duration, in String debugTag);
+  void collectProcessCPUInfo(in boolean isBlocking, in long pid, in String debugTag);
+  void collectProcessMemoryInfo(in boolean isBlocking, in long pid, in String debugTag);
+  void collectRamdump(in String debugTag);
+  void collectStackTraceByPid(in long pid, in boolean isJava, in boolean isBlocking, in String debugTag);
+  void collectStackTraceByProcessName(in String processName, in boolean isJava, in boolean isBlocking, in String debugTag);
+  void collectUserspaceLogs(in String logCmd, in String debugTag, in long duration);
+  void executeDumpsysCommands(in String command, in boolean isBlocking, in String debugTag);
+  void setBreakPoint(in long pid, in boolean isProcess, in String debugTag);
+  void setWatchPoint(in long pid, in long add, in String debugTag);
+  void startPerfettoTracing(in long duration, in String debugTag);
+  void startSimplePerfTracing(in long pid, in long duration, in String debugTag);
+  void stopPerfettoTracing(in String debugTag);
+  void stopSimplePerfTracing(in String debugTag);
+}
diff --git a/debugutils/aidl/vendor/qti/hardware/debugutils/IDebugUtils.aidl b/debugutils/aidl/vendor/qti/hardware/debugutils/IDebugUtils.aidl
new file mode 100644
index 0000000..d88af1c
--- /dev/null
+++ b/debugutils/aidl/vendor/qti/hardware/debugutils/IDebugUtils.aidl
@@ -0,0 +1,120 @@
+/*
+*Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+*SPDX-License-Identifier: BSD-3-Clause-Clear
+*/
+
+package vendor.qti.hardware.debugutils;
+
+
+@VintfStability
+interface IDebugUtils {
+    /**
+     * Read binder_debugfs specific to a process hosted with @param pid
+     */
+    void collectBinderDebugInfoByPid(in long pid, in boolean isBlocking, in String debugTag);
+
+    /**
+     * Read binder_debugfs specific to a process hosted with @param ProcessName
+     */
+    void collectBinderDebugInfoByProcessname(in String processName, in boolean isBlocking,
+        in String debugTag);
+
+    /**
+     * collect CPU specific info
+     */
+    void collectCPUInfo(in boolean isBlocking, in String debugTag);
+
+    /**
+     * Collect the stack trace of processes which in IPC with process
+     * hosted by @param pid
+     */
+    void collectDependentProcessStackTrace(in long pid, in boolean isBlocking,
+        in String debugTag);
+
+    /**
+     * Read binder debugfs and move it to another place
+     */
+    void collectFullBinderDebugInfo(in boolean isBlocking, in String debugTag);
+
+    /**
+     * collect hprof
+     */
+    void collectHprof(in boolean isBlocking, in long pid, in String debugTag);
+
+    /**
+     * collect memory specific info
+     */
+    void collectMemoryInfo(in boolean isBlocking, in String debugTag);
+
+    /**
+     * collect periodic ANR traces
+     */
+    void collectPeriodicTraces(in long pid, in long duration, in String debugTag);
+
+    /**
+     * collect process specific CPU info
+     */
+    void collectProcessCPUInfo(in boolean isBlocking, in long pid, in String debugTag);
+
+    /**
+     * collect process specific Memory info
+     */
+    void collectProcessMemoryInfo(in boolean isBlocking, in long pid, in String debugTag);
+
+    /**
+     * crash the device to collect the ramdump
+     */
+    void collectRamdump(in String debugTag);
+
+    /**
+     * collect stacktrace of a process specified by @param pid
+     */
+    void collectStackTraceByPid(in long pid, in boolean isJava, in boolean isBlocking,
+        in String debugTag);
+
+    /**
+     * collect stacktrace of a process specified by @param ProcessName
+     */
+    void collectStackTraceByProcessName(in String processName, in boolean isJava,
+        in boolean isBlocking, in String debugTag);
+
+    /**
+     * Collect logcat buffer speicified by @param bufferName for duration specified by @param duration
+     */
+    void collectUserspaceLogs(in String logCmd, in String debugTag, in long duration);
+
+    /**
+     * execute am command specified by @param Command
+     */
+    void executeDumpsysCommands(in String command, in boolean isBlocking, in String debugTag);
+
+    /**
+     * set breakpoint in a process hosted by @param pid
+     */
+    void setBreakPoint(in long pid, in boolean isProcess, in String debugTag);
+
+    /**
+     * set watchpoint in a thread hosted by @param pid on address stored in @param add
+     */
+    void setWatchPoint(in long pid, in long add, in String debugTag);
+
+    /**
+     * start Perfetto tracing
+     */
+    void startPerfettoTracing(in long duration, in String debugTag);
+
+    /**
+     * start SimplePerf tracing hosted by @param pid
+     */
+    void startSimplePerfTracing(in long pid, in long duration, in String debugTag);
+
+    /**
+    * stop Perfetto tracing
+    */
+    void stopPerfettoTracing(in String debugTag);
+
+    /**
+     * stop SimplePerf tracing for process
+     */
+    void stopSimplePerfTracing(in String debugTag);
+}