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

Commit 7664e618 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge "Offer to measure disk stats using quotas." am: f8720b95 am: 4b80a4a3

am: 1e1cdbea

Change-Id: Ic00acfb0efb6188a15357322528075d41467310b
parents 5f0dad0e 1e1cdbea
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -509,10 +509,23 @@ class ContextImpl extends Context {
     * Common-path handling of app data dir creation
     */
    private static File ensurePrivateDirExists(File file) {
        return ensurePrivateDirExists(file, 0771, -1);
    }

    private static File ensurePrivateCacheDirExists(File file) {
        final int gid = UserHandle.getCacheAppGid(Process.myUid());
        return ensurePrivateDirExists(file, 02771, gid);
    }

    private static File ensurePrivateDirExists(File file, int mode, int gid) {
        if (!file.exists()) {
            final String path = file.getAbsolutePath();
            try {
                Os.mkdir(file.getAbsolutePath(), 0771);
                Os.chmod(file.getAbsolutePath(), 0771);
                Os.mkdir(path, mode);
                Os.chmod(path, mode);
                if (gid != -1) {
                    Os.chown(path, -1, gid);
                }
            } catch (ErrnoException e) {
                if (e.errno == OsConstants.EEXIST) {
                    // We must have raced with someone; that's okay
@@ -581,7 +594,7 @@ class ContextImpl extends Context {
            if (mCacheDir == null) {
                mCacheDir = new File(getDataDir(), "cache");
            }
            return ensurePrivateDirExists(mCacheDir);
            return ensurePrivateCacheDirExists(mCacheDir);
        }
    }

@@ -591,7 +604,7 @@ class ContextImpl extends Context {
            if (mCodeCacheDir == null) {
                mCodeCacheDir = new File(getDataDir(), "code_cache");
            }
            return ensurePrivateDirExists(mCodeCacheDir);
            return ensurePrivateCacheDirExists(mCodeCacheDir);
        }
    }

+5 −1
Original line number Diff line number Diff line
@@ -783,7 +783,7 @@ public class Build {
     */
    public static boolean isBuildConsistent() {
        // Don't care on eng builds.  Incremental build may trigger false negative.
        if ("eng".equals(TYPE)) return true;
        if (IS_ENG) return true;

        final String system = SystemProperties.get("ro.build.fingerprint");
        final String vendor = SystemProperties.get("ro.vendor.build.fingerprint");
@@ -847,6 +847,10 @@ public class Build {
    public static final boolean IS_DEBUGGABLE =
            SystemProperties.getInt("ro.debuggable", 0) == 1;

    /** {@hide} */
    public static final boolean IS_ENG =
            "eng".equals(getString("ro.build.type"));

    /**
     * Specifies whether the permissions needed by a legacy app should be
     * reviewed before any of its components can run. A legacy app is one
+5 −0
Original line number Diff line number Diff line
@@ -184,6 +184,11 @@ public class Process {
     */
    public static final int LAST_SHARED_APPLICATION_GID = 59999;

    /** {@hide} */
    public static final int FIRST_APPLICATION_CACHE_GID = 20000;
    /** {@hide} */
    public static final int LAST_APPLICATION_CACHE_GID = 29999;

    /**
     * Standard priority of application threads.
     * Use with {@link #setThreadPriority(int)} and
+9 −0
Original line number Diff line number Diff line
@@ -212,6 +212,15 @@ public final class UserHandle implements Parcelable {
        return appId;
    }

    /**
     * Returns the cache GID for a given UID or appId.
     * @hide
     */
    public static int getCacheAppGid(int id) {
        return Process.FIRST_APPLICATION_CACHE_GID + (id % PER_USER_RANGE)
                - Process.FIRST_APPLICATION_UID;
    }

    /**
     * Generate a text representation of the uid, breaking out its individual
     * components -- user, app, isolated, etc.
+2 −1
Original line number Diff line number Diff line
@@ -154,7 +154,8 @@ option java_package com.android.server
3110 unknown_sources_enabled (value|1)
# Package Manager critical info
3120 pm_critical_info (msg|3)

# Disk usage stats for verifying quota correctness
3121 pm_package_stats (manual_time|2|3),(quota_time|2|3),(manual_data|2|2),(quota_data|2|2),(manual_cache|2|2),(quota_cache|2|2)

# ---------------------------
# WindowManagerService.java
Loading