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

Commit 292f8bc9 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Plumb information from the framework about asec container size.

Change-Id: Ie0ec3cb6d463aefa341a8cbea80be790451ba5e3
parent cde73245
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5896,6 +5896,7 @@ package android.content.pm {
    field public long codeSize;
    field public long dataSize;
    field public long externalCacheSize;
    field public long externalCodeSize;
    field public long externalDataSize;
    field public long externalMediaSize;
    field public long externalObbSize;
+13 −2
Original line number Diff line number Diff line
@@ -288,8 +288,9 @@ int protect(char *pkgname, gid_t gid)
}

int get_size(const char *pkgname, const char *apkpath,
             const char *fwdlock_apkpath,
             int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize)
             const char *fwdlock_apkpath, const char *asecpath,
             int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
             int64_t* _asecsize)
{
    DIR *d;
    int dfd;
@@ -300,6 +301,7 @@ int get_size(const char *pkgname, const char *apkpath,
    int64_t codesize = 0;
    int64_t datasize = 0;
    int64_t cachesize = 0;
    int64_t asecsize = 0;

        /* count the source apk as code -- but only if it's not
         * on the /system partition and its not on the sdcard.
@@ -324,6 +326,14 @@ int get_size(const char *pkgname, const char *apkpath,
        }
    }

        /* compute asec size if it is given
         */
    if (asecpath != NULL && asecpath[0] != '!') {
        if (stat(asecpath, &s) == 0) {
            asecsize += stat_size(&s);
        }
    }

    if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, 0)) {
        goto done;
    }
@@ -370,6 +380,7 @@ done:
    *_codesize = codesize;
    *_datasize = datasize;
    *_cachesize = cachesize;
    *_asecsize = asecsize;
    return 0;
}

+5 −3
Original line number Diff line number Diff line
@@ -77,16 +77,18 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
    int64_t codesize = 0;
    int64_t datasize = 0;
    int64_t cachesize = 0;
    int64_t asecsize = 0;
    int res = 0;

        /* pkgdir, apkpath */
    res = get_size(arg[0], arg[1], arg[2], &codesize, &datasize, &cachesize);
    res = get_size(arg[0], arg[1], arg[2], arg[3], &codesize, &datasize, &cachesize, &asecsize);

    /*
     * Each int64_t can take up 22 characters printed out. Make sure it
     * doesn't go over REPLY_MAX in the future.
     */
    snprintf(reply, REPLY_MAX, "%" PRId64 " %" PRId64 " %" PRId64, codesize, datasize, cachesize);
    snprintf(reply, REPLY_MAX, "%" PRId64 " %" PRId64 " %" PRId64 " %" PRId64,
            codesize, datasize, cachesize, asecsize);
    return res;
}

@@ -137,7 +139,7 @@ struct cmdinfo cmds[] = {
    { "freecache",            1, do_free_cache },
    { "rmcache",              1, do_rm_cache },
    { "protect",              2, do_protect },
    { "getsize",              3, do_get_size },
    { "getsize",              4, do_get_size },
    { "rmuserdata",           2, do_rm_user_data },
    { "movefiles",            0, do_movefiles },
    { "linklib",              2, do_linklib },
+2 −1
Original line number Diff line number Diff line
@@ -143,7 +143,8 @@ int move_dex(const char *src, const char *dst);
int rm_dex(const char *path);
int protect(char *pkgname, gid_t gid);
int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath,
             int64_t *codesize, int64_t *datasize, int64_t *cachesize);
             const char *asecpath, int64_t *codesize, int64_t *datasize, int64_t *cachesize,
             int64_t *asecsize);
int free_cache(int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, int is_public);
int movefiles();
+11 −0
Original line number Diff line number Diff line
@@ -39,6 +39,12 @@ public class PackageStats implements Parcelable {
    /** Size of cache used by the application. (e.g., /data/data/<app>/cache) */
    public long cacheSize;

    /**
     * Size of the secure container on external storage holding the
     * application's code.
     */
    public long externalCodeSize;

    /**
     * Size of the external data used by the application (e.g.,
     * <sdcard>/Android/data/<app>)
@@ -80,6 +86,8 @@ public class PackageStats implements Parcelable {
        sb.append(dataSize);
        sb.append(",cacheSize=");
        sb.append(cacheSize);
        sb.append(",externalCodeSize=");
        sb.append(externalCodeSize);
        sb.append(",externalDataSize=");
        sb.append(externalDataSize);
        sb.append(",externalCacheSize=");
@@ -100,6 +108,7 @@ public class PackageStats implements Parcelable {
        codeSize = source.readLong();
        dataSize = source.readLong();
        cacheSize = source.readLong();
        externalCodeSize = source.readLong();
        externalDataSize = source.readLong();
        externalCacheSize = source.readLong();
        externalMediaSize = source.readLong();
@@ -111,6 +120,7 @@ public class PackageStats implements Parcelable {
        codeSize = pStats.codeSize;
        dataSize = pStats.dataSize;
        cacheSize = pStats.cacheSize;
        externalCodeSize = pStats.externalCodeSize;
        externalDataSize = pStats.externalDataSize;
        externalCacheSize = pStats.externalCacheSize;
        externalMediaSize = pStats.externalMediaSize;
@@ -126,6 +136,7 @@ public class PackageStats implements Parcelable {
        dest.writeLong(codeSize);
        dest.writeLong(dataSize);
        dest.writeLong(cacheSize);
        dest.writeLong(externalCodeSize);
        dest.writeLong(externalDataSize);
        dest.writeLong(externalCacheSize);
        dest.writeLong(externalMediaSize);
Loading