SessionInstaller: Open write sessions with packageName only

This allows to open same sessions multiple times when required untill it's
abandoned. Also specifiy file length as it is known.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-05-02 13:24:33 +05:30
parent a75838a57d
commit 65fc2a2dbd

View File

@@ -139,7 +139,7 @@ class SessionInstaller(context: Context) : InstallerBase(context) {
Log.i("Writing splits to session for $packageName")
getFiles(packageName, versionCode, sharedLibPkgName).forEach {
it.inputStream().use { input ->
session.openWrite("${sharedLibPkgName.ifBlank { packageName }}_${System.currentTimeMillis()}", 0, -1).use { output ->
session.openWrite(sharedLibPkgName.ifBlank { packageName }, 0, it.length()).use { output ->
input.copyTo(output)
session.fsync(output)
}