diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 23 | ||||
| -rw-r--r-- | core/java/android/view/HardwareRenderer.java | 19 |
2 files changed, 41 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index a4714ca..f9896f7 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -45,6 +45,7 @@ import android.graphics.Canvas; import android.net.IConnectivityManager; import android.net.Proxy; import android.net.ProxyProperties; +import android.opengl.GLUtils; import android.os.AsyncTask; import android.os.Bundle; import android.os.Debug; @@ -3714,6 +3715,24 @@ public final class ActivityThread { } } + private void setupGraphicsSupport(LoadedApk info) { + try { + int uid = Process.myUid(); + String[] packages = getPackageManager().getPackagesForUid(uid); + + // If there are several packages in this application we won't + // initialize the graphics disk caches + if (packages.length == 1) { + ContextImpl appContext = new ContextImpl(); + appContext.init(info, null, this); + + HardwareRenderer.setupDiskCache(appContext.getCacheDir()); + } + } catch (RemoteException e) { + // Ignore + } + } + private void handleBindApplication(AppBindData data) { mBoundApplication = data; mConfiguration = new Configuration(data.config); @@ -3737,7 +3756,7 @@ public final class ActivityThread { HardwareRenderer.disable(false); } } - + if (mProfiler.profileFd != null) { mProfiler.startProfiling(); } @@ -3773,6 +3792,8 @@ public final class ActivityThread { data.info = getPackageInfoNoCheck(data.appInfo, data.compatInfo); + setupGraphicsSupport(data.info); + /** * For system applications on userdebug/eng builds, log stack * traces of disk and network access to dropbox for analysis. diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index b86d21d..c2ac79d 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -34,6 +34,8 @@ import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL; +import java.io.File; + import static javax.microedition.khronos.egl.EGL10.*; /** @@ -45,6 +47,11 @@ public abstract class HardwareRenderer { static final String LOG_TAG = "HardwareRenderer"; /** + * Name of the file that holds the shaders cache. + */ + private static final String CACHE_PATH_SHADERS = "com.android.opengl.shaders_cache"; + + /** * Turn on to only refresh the parts of the screen that need updating. * When turned on the property defined by {@link #RENDER_DIRTY_REGIONS_PROPERTY} * must also have the value "true". @@ -200,6 +207,18 @@ public abstract class HardwareRenderer { abstract int getHeight(); /** + * Sets the directory to use as a persistent storage for hardware rendering + * resources. + * + * @param cacheDir A directory the current process can write to + */ + public static void setupDiskCache(File cacheDir) { + nSetupShadersDiskCache(new File(cacheDir, CACHE_PATH_SHADERS).getAbsolutePath()); + } + + private static native void nSetupShadersDiskCache(String cacheFile); + + /** * Interface used to receive callbacks whenever a view is drawn by * a hardware renderer instance. */ |
