OSDN Git Service

Add a simple dummy memtrack HAL oreo-x86 pie-x86 q-x86 r-x86 s-x86 android-x86-8.1-r2 android-x86-8.1-r3 android-x86-8.1-r4 android-x86-8.1-r5 android-x86-8.1-r6 android-x86-9.0-r1 android-x86-9.0-r2
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 3 Jun 2019 10:13:21 +0000 (18:13 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 3 Jun 2019 10:13:21 +0000 (18:13 +0800)
Android.mk [new file with mode: 0644]
memtrack.c [new file with mode: 0644]

diff --git a/Android.mk b/Android.mk
new file mode 100644 (file)
index 0000000..068d750
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (C) 2019 The Android-x86 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_CFLAGS := -Wall
+LOCAL_SHARED_LIBRARIES := liblog libcutils
+LOCAL_SRC_FILES := $(call all-subdir-c-files)
+LOCAL_MODULE := memtrack.default
+LOCAL_VENDOR_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
diff --git a/memtrack.c b/memtrack.c
new file mode 100644 (file)
index 0000000..efd32ac
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 The Android-x86 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.
+ */
+
+#include <hardware/memtrack.h>
+
+static int memtrack_init(const struct memtrack_module *module)
+{
+    if (!module)
+        return -1;
+
+    return 0;
+}
+
+static struct hw_module_methods_t memtrack_module_methods = {
+    .open = NULL,
+};
+
+struct memtrack_module HAL_MODULE_INFO_SYM = {
+    .common = {
+        .tag = HARDWARE_MODULE_TAG,
+        .module_api_version = MEMTRACK_MODULE_API_VERSION_0_1,
+        .hal_api_version = HARDWARE_HAL_API_VERSION,
+        .id = MEMTRACK_HARDWARE_MODULE_ID,
+        .name = "Dummy Memory Tracker HAL",
+        .author = "The Android-x86 Open Source Project",
+        .methods = &memtrack_module_methods,
+    },
+
+    .init = memtrack_init,
+};