Memtrack: Fallback to HIDL implementation
Avoid attemptimg to get the HIDL service if we already got the AIDL
service. This can help to reduce the warning logs from servicemanager on
devices with an AIDL memtrack (this should be true for devices launching
on recent desserts).
servicemanager: Could not find android.hardware.memtrack.IMemtrack/default in the VINTF manifest.
On devices still using a HILD implementation
still expect to see service manager logs for the missing AIDL
implemetation.
Bug: 188388088
Test: Logcat
Change-Id: Ifd740ff2d0a17b6fc46b217e0ca8861ef7dc5f1e
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/services/memtrackproxy/MemtrackProxy.cpp b/services/memtrackproxy/MemtrackProxy.cpp
index 4676167..9e41a93 100644
--- a/services/memtrackproxy/MemtrackProxy.cpp
+++ b/services/memtrackproxy/MemtrackProxy.cpp
@@ -97,9 +97,14 @@
return calling_pid == request_pid;
}
-MemtrackProxy::MemtrackProxy()
- : memtrack_hidl_instance_(MemtrackProxy::MemtrackHidlInstance()),
- memtrack_aidl_instance_(MemtrackProxy::MemtrackAidlInstance()) {}
+MemtrackProxy::MemtrackProxy() {
+ memtrack_aidl_instance_ = MemtrackProxy::MemtrackAidlInstance();
+
+ // Only check for a HIDL implementation if we failed to get the AIDL service
+ if (!memtrack_aidl_instance_) {
+ memtrack_hidl_instance_ = MemtrackProxy::MemtrackHidlInstance();
+ }
+}
ndk::ScopedAStatus MemtrackProxy::getMemory(int pid, MemtrackType type,
std::vector<MemtrackRecord>* _aidl_return) {