summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator_test.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 22:14:26 +0000
commit9dcf7e342fd7f05c7a59f4eaec2627db81a19c83 (patch)
tree5894578401c047e2e87f2e1b9dc0e58263a4726c /tools/aapt2/java/JavaClassGenerator_test.cpp
parent4c888c779c678a0e3253c064044d3326caa52bb3 (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_test.cpp')
0 files changed, 0 insertions, 0 deletions