summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivya Amaravathy <addivya@google.com>2024-04-22 20:48:45 -0700
committerDivya Amaravathy <addivya@google.com>2024-04-25 17:26:00 +0000
commit2e26bdb6698ea0295d0495a5aa5483a695ec68cd (patch)
tree2773f8d201fe3396753711e80101352324ae44b8
parent7c34b283a8179edfb347738ff70faa615c959024 (diff)
downloadbase-2e26bdb6698ea0295d0495a5aa5483a695ec68cd.tar.gz
Set skeleton for LeakCanary supporting library
Follow the setup of adblib. Bug: 336417209 Test: N/A Change-Id: If3f8571a63aa2f6542a29193cc88721c0f721ef6
-rw-r--r--leakcanarylib/BUILD14
-rw-r--r--leakcanarylib/OWNERS1
-rw-r--r--leakcanarylib/README.md6
-rw-r--r--leakcanarylib/android.sdktools.leakcanarylib.iml13
-rw-r--r--leakcanarylib/src/com/android/leakcanarylib/LeakCanarySerializer.kt27
5 files changed, 61 insertions, 0 deletions
diff --git a/leakcanarylib/BUILD b/leakcanarylib/BUILD
new file mode 100644
index 0000000000..2e665d22f7
--- /dev/null
+++ b/leakcanarylib/BUILD
@@ -0,0 +1,14 @@
+load("//tools/base/bazel:bazel.bzl", "iml_module")
+
+# managed by go/iml_to_build
+iml_module(
+ name = "studio.android.sdktools.leakcanarylib",
+ srcs = ["src"],
+ iml_files = ["android.sdktools.leakcanarylib.iml"],
+ visibility = ["//visibility:public"],
+ # do not sort: must match IML order
+ deps = [
+ "@intellij//:intellij-sdk",
+ "@intellij//:com.intellij.java",
+ ],
+)
diff --git a/leakcanarylib/OWNERS b/leakcanarylib/OWNERS
new file mode 100644
index 0000000000..7215bec3ce
--- /dev/null
+++ b/leakcanarylib/OWNERS
@@ -0,0 +1 @@
+include platform/tools/base:/owners/profilers_OWNERS \ No newline at end of file
diff --git a/leakcanarylib/README.md b/leakcanarylib/README.md
new file mode 100644
index 0000000000..9e7943afee
--- /dev/null
+++ b/leakcanarylib/README.md
@@ -0,0 +1,6 @@
+# Overview
+
+The `leakcanarylib` is the interface between Android Studio and the
+LeakCanary memory leak detection tool (https://square.github.io/leakcanary/).
+This Kotlin-based library facilitates integration and streamlines the process
+of identifying and addressing memory leaks in Android applications.
diff --git a/leakcanarylib/android.sdktools.leakcanarylib.iml b/leakcanarylib/android.sdktools.leakcanarylib.iml
new file mode 100644
index 0000000000..a0d3a1016e
--- /dev/null
+++ b/leakcanarylib/android.sdktools.leakcanarylib.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="library" name="studio-sdk" level="project" />
+ <orderEntry type="library" name="studio-plugin-com.intellij.java" level="project" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
diff --git a/leakcanarylib/src/com/android/leakcanarylib/LeakCanarySerializer.kt b/leakcanarylib/src/com/android/leakcanarylib/LeakCanarySerializer.kt
new file mode 100644
index 0000000000..c3d1ded9e8
--- /dev/null
+++ b/leakcanarylib/src/com/android/leakcanarylib/LeakCanarySerializer.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.leakcanarylib
+
+class LeakCanarySerializer {
+ var logcatMessage: String = ""
+
+ /** Test function **/
+ fun test(logcatMessage: String): String {
+ return logcatMessage
+ }
+}
+