hikey: hikey960: Add memtrack HAL
Bug: 65159580
Test: Manual
Change-Id: I7f2ee70284a0b548fb7ea93e93f5e31a1825f721
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/device-common.mk b/device-common.mk
index 498abf6..1e05ae0 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -57,6 +57,11 @@
android.hardware.graphics.allocator@2.0-impl \
android.hardware.graphics.mapper@2.0-impl
+# Memtrack
+PRODUCT_PACKAGES += memtrack.default \
+ android.hardware.memtrack@1.0-service \
+ android.hardware.memtrack@1.0-impl
+
PRODUCT_PACKAGES += TIInit_11.8.32.bts \
wl18xx-fw-4.bin \
wl18xx-conf.bin
diff --git a/manifest.xml b/manifest.xml
index 95a1fe7..aa16a8c 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -27,6 +27,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.supplicant</name>
<transport>hwbinder</transport>
<version>1.0</version>
diff --git a/sepolicy/hal_memtrack.te b/sepolicy/hal_memtrack.te
new file mode 100644
index 0000000..c2da124
--- /dev/null
+++ b/sepolicy/hal_memtrack.te
@@ -0,0 +1,11 @@
+type debugfs_kgsl, debugfs_type, fs_type;
+
+allow domain debugfs_kgsl:dir search;
+
+allow hal_memtrack debugfs_kgsl:dir search;
+allow hal_memtrack debugfs_kgsl:file { open read getattr };
+
+# 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;