From 37a8a74162441232f449227a53fb6f9002647b1f Mon Sep 17 00:00:00 2001 From: Amit Pundir Date: Wed, 13 Jun 2018 15:11:20 +0530 Subject: memtrack: Add dummy stub libmemtrack module This doesn't do anything right now, but avoids the constant memtrack error messages. Copied as is from John Stultz' stub implementation for Hikey. Change-Id: If3cc79b54afdd35057e102ee1460e879c112d463 Signed-off-by: Amit Pundir --- device-common.mk | 5 +++++ libmemtrack/Android.mk | 29 ++++++++++++++++++++++++ libmemtrack/memtrack_dragonboard.c | 45 ++++++++++++++++++++++++++++++++++++++ manifest.xml | 9 ++++++++ sepolicy/hal_memtrack.te | 4 ++++ 5 files changed, 92 insertions(+) create mode 100644 libmemtrack/Android.mk create mode 100644 libmemtrack/memtrack_dragonboard.c create mode 100644 sepolicy/hal_memtrack.te diff --git a/device-common.mk b/device-common.mk index 3f9eb9e..0354d41 100644 --- a/device-common.mk +++ b/device-common.mk @@ -106,6 +106,11 @@ PRODUCT_PACKAGES += android.hardware.power@1.0-impl #GNSS HAL PRODUCT_PACKAGES += android.hardware.gnss@1.0-impl +# Memtrack +PRODUCT_PACKAGES += memtrack.default \ + android.hardware.memtrack@1.0-service \ + android.hardware.memtrack@1.0-impl + # Keymaster HAL PRODUCT_PACKAGES += \ android.hardware.keymaster@3.0-impl \ diff --git a/libmemtrack/Android.mk b/libmemtrack/Android.mk new file mode 100644 index 0000000..913cb22 --- /dev/null +++ b/libmemtrack/Android.mk @@ -0,0 +1,29 @@ +# Copyright (C) 2017 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. + +LOCAL_PATH := $(call my-dir) + +# HAL module implemenation stored in +# hw/..so +include $(CLEAR_VARS) + +LOCAL_MODULE_RELATIVE_PATH := hw +LOCAL_PROPRIETARY_MODULE := true +LOCAL_C_INCLUDES += hardware/libhardware/include +LOCAL_CFLAGS := -Wconversion -Wall -Werror -Wno-sign-conversion +LOCAL_CLANG := true +LOCAL_SHARED_LIBRARIES := liblog libhardware +LOCAL_SRC_FILES := memtrack_dragonboard.c +LOCAL_MODULE := memtrack.default +include $(BUILD_SHARED_LIBRARY) diff --git a/libmemtrack/memtrack_dragonboard.c b/libmemtrack/memtrack_dragonboard.c new file mode 100644 index 0000000..cc4a2a1 --- /dev/null +++ b/libmemtrack/memtrack_dragonboard.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2017 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. + */ + +#include + +#include + +int hikey_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 for Dragonboards", + .author = "The Android Open Source Project", + .methods = &memtrack_module_methods, + }, + + .init = hikey_memtrack_init, +}; diff --git a/manifest.xml b/manifest.xml index e6d754d..d76ceb0 100644 --- a/manifest.xml +++ b/manifest.xml @@ -93,6 +93,15 @@ default + + android.hardware.memtrack + hwbinder + 1.0 + + IMemtrack + default + + android.hardware.wifi hwbinder diff --git a/sepolicy/hal_memtrack.te b/sepolicy/hal_memtrack.te new file mode 100644 index 0000000..51bd527 --- /dev/null +++ b/sepolicy/hal_memtrack.te @@ -0,0 +1,4 @@ +# Memtrack reads proc//cmdline to check if process is surfaceflinger. +# Grant access if that's the case; don't log denials for other processes. +allow hal_memtrack surfaceflinger:file read; +dontaudit hal_memtrack { domain -surfaceflinger}:file read; -- cgit v1.2.3