libmemtrack: check return value for getMemory()

libmemtrack does not report an error when the binderized memtrack
service dies during a call to getMemory, so a crash in the memtrack
service can result in the calling process (e.g. system_server)
crashing as well. Add an error check to avoid this problem.

Bug: 35728498
Test: adb shell kill -9 $(adb shell pidof android.hardware.memtrack@1.0-service)
Change-Id: I852d8dfcbc1c92a95f8fe249b607dea8eb01f06a
Signed-off-by: Connor O'Brien <>
1 file changed
tree: 65af46c253ac679f1d163196f30f1d7e65bb7f94
  1. Android.bp
  2. include/
  3. memtrack.cpp
  4. memtrack_test.c