profcollect: check hardware capability on a background thread

This is a blocking event, needs to be moved off from the main thread.

Also, don't schedule background processing service if the hardware
has no tracing support.

Test: manual
Bug: 79161490
Bug: 206986559
Change-Id: I039211b26f25ead66cf125f152e794b0c08057ee
This commit is contained in:
Yi Kong
2021-11-19 16:23:37 +08:00
parent 9b6a363c8c
commit da9d0e669b

View File

@@ -91,10 +91,12 @@ public final class ProfcollectForwardingService extends SystemService {
if (mIProfcollect == null) {
return;
}
if (serviceHasSupportedTraceProvider()) {
registerObservers();
}
ProfcollectBGJobService.schedule(getContext());
BackgroundThread.get().getThreadHandler().post(() -> {
if (serviceHasSupportedTraceProvider()) {
registerObservers();
ProfcollectBGJobService.schedule(getContext());
}
});
}
}