Add memtrackproxy system server service

Serve memtrackproxy service from system server.

This service enforces access control on requests for memory usage stats
to the memtrack HAL based on the call context's PID and UID.

Bug: 177664629
Test: memtrackproxy_test
Change-Id: I10829ffcf4e5b2813d4c622268b0b59da6f171b6
This commit is contained in:
Kalesh Singh
2021-03-29 17:03:19 -04:00
parent f906029106
commit 46d2cc8f82
3 changed files with 33 additions and 1 deletions

View File

@@ -453,6 +453,11 @@ public final class SystemServer implements Dumpable {
*/
private static native void startSensorService();
/**
* Start the memtrack proxy service.
*/
private static native void startMemtrackProxyService();
/**
* Start all HIDL services that are run inside the system server. This may take some time.
*/
@@ -1024,6 +1029,12 @@ public final class SystemServer implements Dumpable {
mSystemServiceManager.startService(PowerStatsService.class);
t.traceEnd();
// Start MemtrackProxyService before ActivityManager, so that early calls
// to Memtrack::getMemory() don't fail.
t.traceBegin("MemtrackProxyService");
startMemtrackProxyService();
t.traceEnd();
// Activity manager runs the show.
t.traceBegin("StartActivityManager");
// TODO: Might need to move after migration to WM.