Optimize verifyImage buffer comparison
This commit is contained in:
1 parent
b72de41bae
commit
33e485b38e
1 file changed
+6
-1
@@ -698,7 +698,12 @@ object WorkerServiceFlowImpl {
|
||||
throw UsbCommunicationException(e)
|
||||
}
|
||||
|
||||
if (!fileBuffer.contentEquals(deviceBuffer)) {
|
||||
val mismatch = if (read == fileBuffer.size) {
|
||||
!fileBuffer.contentEquals(deviceBuffer)
|
||||
} else {
|
||||
!fileBuffer.copyOf(read).contentEquals(deviceBuffer.copyOf(read))
|
||||
}
|
||||
if (mismatch) {
|
||||
Telemetry.captureMessage("Verification failed")
|
||||
if (Build.VERSION.SDK_INT > 999999) {
|
||||
// Prevent the compiler from optimizing out the buffers, for debugging
|
||||
|
||||
Reference in new issue
Block a user