summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kalesh Singh <kaleshsingh@google.com> 2023-03-03 13:02:24 -0800
committer Kalesh Singh <kaleshsingh@google.com> 2023-03-03 22:39:53 +0000
commit1163cd3df3040fc41b62b96cf515fe73bee1c485 (patch)
tree4fbbe21872de3f5e99dbc702960350b0f85a96a7
parente813ec150004246acc6242886cc71d70a3736332 (diff)
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>
-rw-r--r--services/memtrackproxy/MemtrackProxy.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/memtrackproxy/MemtrackProxy.cpp b/services/memtrackproxy/MemtrackProxy.cpp
index 467616724a..9e41a9333e 100644
--- a/services/memtrackproxy/MemtrackProxy.cpp
+++ b/services/memtrackproxy/MemtrackProxy.cpp
@@ -97,9 +97,14 @@ bool MemtrackProxy::CheckPid(pid_t calling_pid, pid_t request_pid) {
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) {