Skip to content

Commit

Permalink
don't use actual APKs names in RootlessSAIPackageInstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
Aefyr committed Sep 30, 2019
1 parent b29360c commit d39a51c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private RootlessSAIPackageInstaller(Context c) {
sInstance = this;
}

@SuppressLint("DefaultLocale")
@Override
protected void installApkFiles(ApkSource aApkSource) {
cleanOldSessions();
Expand All @@ -78,8 +79,9 @@ protected void installApkFiles(ApkSource aApkSource) {
mSessionsMap.put(sessionID, getOngoingInstallation().getId());

session = mPackageInstaller.openSession(sessionID);
int currentApkFile = 0;
while (apkSource.nextApk()) {
try (InputStream inputStream = apkSource.openApkInputStream(); OutputStream outputStream = session.openWrite(apkSource.getApkName(), 0, apkSource.getApkLength())) {
try (InputStream inputStream = apkSource.openApkInputStream(); OutputStream outputStream = session.openWrite(String.format("%d.apk", currentApkFile++), 0, apkSource.getApkLength())) {
IOUtils.copyStream(inputStream, outputStream);
session.fsync(outputStream);
}
Expand Down

0 comments on commit d39a51c

Please sign in to comment.