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

Commit d0a2de06 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Add code cache directory for apps." into lmp-dev

parents a3514c3a 4ed745d3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -7064,6 +7064,7 @@ package android.content {
    method public abstract android.content.res.AssetManager getAssets();
    method public abstract java.io.File getCacheDir();
    method public abstract java.lang.ClassLoader getClassLoader();
    method public abstract java.io.File getCodeCacheDir();
    method public abstract android.content.ContentResolver getContentResolver();
    method public abstract java.io.File getDatabasePath(java.lang.String);
    method public abstract java.io.File getDir(java.lang.String, int);
@@ -7235,6 +7236,7 @@ package android.content {
    method public android.content.Context getBaseContext();
    method public java.io.File getCacheDir();
    method public java.lang.ClassLoader getClassLoader();
    method public java.io.File getCodeCacheDir();
    method public android.content.ContentResolver getContentResolver();
    method public java.io.File getDatabasePath(java.lang.String);
    method public java.io.File getDir(java.lang.String, int);
@@ -29378,6 +29380,7 @@ package android.test.mock {
    method public android.content.res.AssetManager getAssets();
    method public java.io.File getCacheDir();
    method public java.lang.ClassLoader getClassLoader();
    method public java.io.File getCodeCacheDir();
    method public android.content.ContentResolver getContentResolver();
    method public java.io.File getDatabasePath(java.lang.String);
    method public java.io.File getDir(java.lang.String, int);
+12 −0
Original line number Diff line number Diff line
@@ -250,6 +250,8 @@ class ContextImpl extends Context {
    private File mNoBackupFilesDir;
    @GuardedBy("mSync")
    private File mCacheDir;
    @GuardedBy("mSync")
    private File mCodeCacheDir;

    @GuardedBy("mSync")
    private File[] mExternalObbDirs;
@@ -1054,6 +1056,16 @@ class ContextImpl extends Context {
        }
    }

    @Override
    public File getCodeCacheDir() {
        synchronized (mSync) {
            if (mCodeCacheDir == null) {
                mCodeCacheDir = new File(getDataDirFile(), "code_cache");
            }
            return createFilesDirLocked(mCodeCacheDir);
        }
    }

    @Override
    public File getExternalCacheDir() {
        // Operates on primary external storage
+16 −0
Original line number Diff line number Diff line
@@ -866,6 +866,22 @@ public abstract class Context {
     */
    public abstract File getCacheDir();

    /**
     * Returns the absolute path to the application specific cache directory on
     * the filesystem designed for storing cached code. The system will delete
     * any files stored in this location both when your specific application is
     * upgraded, and when the entire platform is upgraded.
     * <p>
     * This location is optimal for storing compiled or optimized code generated
     * by your application at runtime.
     * <p>
     * Apps require no extra permissions to read or write to the returned path,
     * since this path lives in their private storage.
     *
     * @return The path of the directory holding application code cache files.
     */
    public abstract File getCodeCacheDir();

    /**
     * Returns the absolute path to the directory on the primary external filesystem
     * (that is somewhere on {@link android.os.Environment#getExternalStorageDirectory()
+5 −0
Original line number Diff line number Diff line
@@ -231,6 +231,11 @@ public class ContextWrapper extends Context {
        return mBase.getCacheDir();
    }

    @Override
    public File getCodeCacheDir() {
        return mBase.getCodeCacheDir();
    }

    @Override
    public File getExternalCacheDir() {
        return mBase.getExternalCacheDir();
+9 −0
Original line number Diff line number Diff line
@@ -309,6 +309,15 @@ public final class Installer extends SystemService {
        return execute(builder.toString());
    }

    public int deleteCodeCacheFiles(String name, int userId) {
        StringBuilder builder = new StringBuilder("rmcodecache");
        builder.append(' ');
        builder.append(name);
        builder.append(' ');
        builder.append(userId);
        return execute(builder.toString());
    }

    public int createUserData(String name, int uid, int userId, String seinfo) {
        StringBuilder builder = new StringBuilder("mkuserdata");
        builder.append(' ');
Loading