summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator.cpp
diff options
context:
space:
mode:
authorMike Ma <yanmin@google.com>2018-09-18 10:32:34 -0700
committerMike Ma <yanmin@google.com>2018-09-18 23:43:11 +0000
commit5371273f02baf54c1b84771ea4a208976f75f114 (patch)
tree8b3046a90f084ed349949c221065012f10df7c66 /tools/aapt2/java/JavaClassGenerator.cpp
parent82b413428e6b10d8d25d00ccb4c3b0b20e05e0a0 (diff)
More robust read mechanism in KernelCpuProcReader
KernelCpuProcReader used FileChannel to dump bytes into a large enough ByteBuffer. However, FileChannel#read stops as soon as there is nothing left to read. Since the kernel may not deliver all parts of a proc file simultaneously, previous read mechanism would possibly read only a portion of the proc file. The impact is that KernelUidCpuFreqTimeReader gets an incomplete UID list. New mechanism uses a loop to turn non-blocking FileChannel#read into a blocking operation. It does not return until hitting EOF. The reason not to use Files#readAllBytes is that we want to reuse the byte[]. Bug: 111805985 Test: atest KernelCpuProcReaderTest Test: compared KernelCpuProcReader#readBytes against Files#readAllBytes locally Change-Id: If0d2b6742489632e22c8fec34c627851cda875f2
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
0 files changed, 0 insertions, 0 deletions