diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2018-06-13 15:11:20 +0530 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2018-06-13 19:23:24 +0530 |
commit | 37a8a74162441232f449227a53fb6f9002647b1f (patch) | |
tree | 53ef70da6bffa38d4dcaa26a4451e61404d8a209 | |
parent | 959179e90cb9b8280adc455358b6d6afa9ae5a64 (diff) | |
download | dragonboard410c-37a8a74162441232f449227a53fb6f9002647b1f.tar.gz |
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 <amit.pundir@linaro.org>
-rw-r--r-- | device-common.mk | 5 | ||||
-rw-r--r-- | libmemtrack/Android.mk | 29 | ||||
-rw-r--r-- | libmemtrack/memtrack_dragonboard.c | 45 | ||||
-rw-r--r-- | manifest.xml | 9 | ||||
-rw-r--r-- | sepolicy/hal_memtrack.te | 4 |
5 files changed, 92 insertions, 0 deletions
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/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.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 <errno.h> + +#include <hardware/memtrack.h> + +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 @@ -94,6 +94,15 @@ </interface> </hal> <hal format="hidl"> + <name>android.hardware.memtrack</name> + <transport>hwbinder</transport> + <version>1.0</version> + <interface> + <name>IMemtrack</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> <name>android.hardware.wifi</name> <transport>hwbinder</transport> <impl level="generic"></impl> 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/<pid>/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; |