Fix the bug where AppOps information was saved multiple times in StatsCompanionService

pullAppOps method which was overflowing Binder and prevented any log collection from Device

Change-Id: I0532441cc959daebf00c8794c4317a661443061c
Fix: 141543124
Test: ./out/host/linux-x86/bin/statsd_testdrive 10060
This commit is contained in:
Stanislav Zholnin
2019-10-02 17:14:10 +01:00
parent 817d014bf0
commit a700d28fe3

View File

@@ -2079,9 +2079,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
HistoricalOps histOps = ops.get(EXTERNAL_STATS_SYNC_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS);
StatsLogEventWrapper e = new StatsLogEventWrapper(StatsLog.APP_OPS, elapsedNanos,
wallClockNanos);
for (int uidIdx = 0; uidIdx < histOps.getUidCount(); uidIdx++) {
final HistoricalUidOps uidOps = histOps.getUidOpsAt(uidIdx);
final int uid = uidOps.getUid();
@@ -2089,6 +2086,9 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
final HistoricalPackageOps packageOps = uidOps.getPackageOpsAt(pkgIdx);
for (int opIdx = 0; opIdx < packageOps.getOpCount(); opIdx++) {
final AppOpsManager.HistoricalOp op = packageOps.getOpAt(opIdx);
StatsLogEventWrapper e = new StatsLogEventWrapper(StatsLog.APP_OPS,
elapsedNanos, wallClockNanos);
e.writeInt(uid);
e.writeString(packageOps.getPackageName());
e.writeInt(op.getOpCode());