Don't try to report non-existent stats

During OTAPreopt we don't have compilation stats due to the way we
compile things. Don't attempt to report stats in this case since it
will cause an NPE.

Test: manual OTA on a blueline
Bug: 181182967
Bug: 177694884
Change-Id: Ie2eb4d7e2ab562d4436a605bcbdd2ea17517dfc3
This commit is contained in:
Alex Light
2021-03-22 17:43:17 -07:00
parent 71cf0b48ce
commit ed271fcf34

View File

@@ -260,7 +260,8 @@ public class PackageDexOptimizer {
// Only report metrics for base apk for now.
// TODO: add ISA and APK type to metrics.
if (pkg.getBaseApkPath().equals(path)) {
// OTAPreopt doesn't have stats so don't report in that case.
if (pkg.getBaseApkPath().equals(path) && packageStats != null) {
Trace.traceBegin(Trace.TRACE_TAG_PACKAGE_MANAGER, "dex2oat-metrics");
try {
long sessionId = Math.randomLongInternal();