increased app update buffer size

This commit is contained in:
LagradOst 2023-02-07 16:01:14 +00:00 committed by GitHub
parent 19b2cae851
commit 329966732f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,7 +91,7 @@ class ApkInstaller(private val service: PackageInstallerService) {
session.openWrite(context.packageName, 0, size) session.openWrite(context.packageName, 0, size)
.use { outputStream -> .use { outputStream ->
val buffer = ByteArray(1024) val buffer = ByteArray(4 * 1024)
var bytesRead = inputStream.read(buffer) var bytesRead = inputStream.read(buffer)
while (bytesRead >= 0) { while (bytesRead >= 0) {
@ -100,6 +100,7 @@ class ApkInstaller(private val service: PackageInstallerService) {
installProgress.invoke(bytesRead) installProgress.invoke(bytesRead)
} }
session.fsync(outputStream)
inputStream.close() inputStream.close()
} }