Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff270c6d authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Automerger Merge Worker
Browse files

Merge "Compress .so files for PackageManager to reclaim the space" am:...

Merge "Compress .so files for PackageManager to reclaim the space" am: 97fe9c7a am: e08bbb4a am: 193c6b3e am: a106c74a am: ea415053

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1884703

Change-Id: I440fff1b0dbe9fcc50b3651459b25c2f0a4e6d89
parents 1477b975 ea415053
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include <inttypes.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <linux/fs.h>

#include <memory>

@@ -253,6 +254,16 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
        return INSTALL_FAILED_CONTAINER_ERROR;
    }

    // If a filesystem like f2fs supports per-file compression, set the compression bit before data
    // writes
    unsigned int flags;
    if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1) {
        ALOGE("Failed to call FS_IOC_GETFLAGS on %s: %s\n", localTmpFileName, strerror(errno));
    } else if ((flags & FS_COMPR_FL) == 0) {
        flags |= FS_COMPR_FL;
        ioctl(fd, FS_IOC_SETFLAGS, &flags);
    }

    if (!zipFile->uncompressEntry(zipEntry, fd)) {
        ALOGE("Failed uncompressing %s to %s\n", fileName, localTmpFileName);
        close(fd);