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

Commit 2c228821 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Plumb information from the framework about asec container size."

parents 9e1fb41b 292f8bc9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -5897,6 +5897,7 @@ package android.content.pm {
    field public long codeSize;
    field public long codeSize;
    field public long dataSize;
    field public long dataSize;
    field public long externalCacheSize;
    field public long externalCacheSize;
    field public long externalCodeSize;
    field public long externalDataSize;
    field public long externalDataSize;
    field public long externalMediaSize;
    field public long externalMediaSize;
    field public long externalObbSize;
    field public long externalObbSize;
+13 −2
Original line number Original line 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,
int get_size(const char *pkgname, const char *apkpath,
             const char *fwdlock_apkpath,
             const char *fwdlock_apkpath, const char *asecpath,
             int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize)
             int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
             int64_t* _asecsize)
{
{
    DIR *d;
    DIR *d;
    int dfd;
    int dfd;
@@ -300,6 +301,7 @@ int get_size(const char *pkgname, const char *apkpath,
    int64_t codesize = 0;
    int64_t codesize = 0;
    int64_t datasize = 0;
    int64_t datasize = 0;
    int64_t cachesize = 0;
    int64_t cachesize = 0;
    int64_t asecsize = 0;


        /* count the source apk as code -- but only if it's not
        /* count the source apk as code -- but only if it's not
         * on the /system partition and its not on the sdcard.
         * 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)) {
    if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, 0)) {
        goto done;
        goto done;
    }
    }
@@ -370,6 +380,7 @@ done:
    *_codesize = codesize;
    *_codesize = codesize;
    *_datasize = datasize;
    *_datasize = datasize;
    *_cachesize = cachesize;
    *_cachesize = cachesize;
    *_asecsize = asecsize;
    return 0;
    return 0;
}
}


+5 −3
Original line number Original line 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 codesize = 0;
    int64_t datasize = 0;
    int64_t datasize = 0;
    int64_t cachesize = 0;
    int64_t cachesize = 0;
    int64_t asecsize = 0;
    int res = 0;
    int res = 0;


        /* pkgdir, apkpath */
        /* 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
     * Each int64_t can take up 22 characters printed out. Make sure it
     * doesn't go over REPLY_MAX in the future.
     * 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;
    return res;
}
}


@@ -137,7 +139,7 @@ struct cmdinfo cmds[] = {
    { "freecache",            1, do_free_cache },
    { "freecache",            1, do_free_cache },
    { "rmcache",              1, do_rm_cache },
    { "rmcache",              1, do_rm_cache },
    { "protect",              2, do_protect },
    { "protect",              2, do_protect },
    { "getsize",              3, do_get_size },
    { "getsize",              4, do_get_size },
    { "rmuserdata",           2, do_rm_user_data },
    { "rmuserdata",           2, do_rm_user_data },
    { "movefiles",            0, do_movefiles },
    { "movefiles",            0, do_movefiles },
    { "linklib",              2, do_linklib },
    { "linklib",              2, do_linklib },
+2 −1
Original line number Original line 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 rm_dex(const char *path);
int protect(char *pkgname, gid_t gid);
int protect(char *pkgname, gid_t gid);
int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath,
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 free_cache(int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, int is_public);
int dexopt(const char *apk_path, uid_t uid, int is_public);
int movefiles();
int movefiles();
+11 −0
Original line number Original line 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) */
    /** Size of cache used by the application. (e.g., /data/data/<app>/cache) */
    public long cacheSize;
    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.,
     * Size of the external data used by the application (e.g.,
     * <sdcard>/Android/data/<app>)
     * <sdcard>/Android/data/<app>)
@@ -80,6 +86,8 @@ public class PackageStats implements Parcelable {
        sb.append(dataSize);
        sb.append(dataSize);
        sb.append(",cacheSize=");
        sb.append(",cacheSize=");
        sb.append(cacheSize);
        sb.append(cacheSize);
        sb.append(",externalCodeSize=");
        sb.append(externalCodeSize);
        sb.append(",externalDataSize=");
        sb.append(",externalDataSize=");
        sb.append(externalDataSize);
        sb.append(externalDataSize);
        sb.append(",externalCacheSize=");
        sb.append(",externalCacheSize=");
@@ -100,6 +108,7 @@ public class PackageStats implements Parcelable {
        codeSize = source.readLong();
        codeSize = source.readLong();
        dataSize = source.readLong();
        dataSize = source.readLong();
        cacheSize = source.readLong();
        cacheSize = source.readLong();
        externalCodeSize = source.readLong();
        externalDataSize = source.readLong();
        externalDataSize = source.readLong();
        externalCacheSize = source.readLong();
        externalCacheSize = source.readLong();
        externalMediaSize = source.readLong();
        externalMediaSize = source.readLong();
@@ -111,6 +120,7 @@ public class PackageStats implements Parcelable {
        codeSize = pStats.codeSize;
        codeSize = pStats.codeSize;
        dataSize = pStats.dataSize;
        dataSize = pStats.dataSize;
        cacheSize = pStats.cacheSize;
        cacheSize = pStats.cacheSize;
        externalCodeSize = pStats.externalCodeSize;
        externalDataSize = pStats.externalDataSize;
        externalDataSize = pStats.externalDataSize;
        externalCacheSize = pStats.externalCacheSize;
        externalCacheSize = pStats.externalCacheSize;
        externalMediaSize = pStats.externalMediaSize;
        externalMediaSize = pStats.externalMediaSize;
@@ -126,6 +136,7 @@ public class PackageStats implements Parcelable {
        dest.writeLong(codeSize);
        dest.writeLong(codeSize);
        dest.writeLong(dataSize);
        dest.writeLong(dataSize);
        dest.writeLong(cacheSize);
        dest.writeLong(cacheSize);
        dest.writeLong(externalCodeSize);
        dest.writeLong(externalDataSize);
        dest.writeLong(externalDataSize);
        dest.writeLong(externalCacheSize);
        dest.writeLong(externalCacheSize);
        dest.writeLong(externalMediaSize);
        dest.writeLong(externalMediaSize);
Loading