From 80b12fcaaec458377d966803c3a61504f0897ea1 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 29 May 2013 15:54:25 -0700 Subject: Disable the AssetAtlas when running under valgrind Bug #9191438 When running under valgrind, the ppid will be different from the ppid of the system server (which always gets forked from zygote.) Change-Id: I42cbf99fd0084aeab76c30de9beb7c49ed1fc7d8 --- core/java/android/os/Process.java | 6 ++++++ core/java/android/view/HardwareRenderer.java | 12 +++++++----- core/java/android/view/IAssetAtlas.aidl | 7 +++++++ 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'core/java') diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 476b4ea..93b1255 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -650,6 +650,12 @@ public class Process { public static final native int myPid(); /** + * Returns the identifier of this process' parent. + * @hide + */ + public static native int myPpid(); + + /** * Returns the identifier of the calling thread, which be used with * {@link #setThreadPriority(int, int)}. */ diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 8dada90..c07b187 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -1931,11 +1931,13 @@ public abstract class HardwareRenderer { IAssetAtlas atlas = IAssetAtlas.Stub.asInterface(binder); try { - GraphicBuffer buffer = atlas.getBuffer(); - if (buffer != null) { - int[] map = atlas.getMap(); - if (map != null) { - GLES20Canvas.initAtlas(buffer, map); + if (atlas.isCompatible(android.os.Process.myPpid())) { + GraphicBuffer buffer = atlas.getBuffer(); + if (buffer != null) { + int[] map = atlas.getMap(); + if (map != null) { + GLES20Canvas.initAtlas(buffer, map); + } } } } catch (RemoteException e) { diff --git a/core/java/android/view/IAssetAtlas.aidl b/core/java/android/view/IAssetAtlas.aidl index 2595179..5f1e238 100644 --- a/core/java/android/view/IAssetAtlas.aidl +++ b/core/java/android/view/IAssetAtlas.aidl @@ -28,6 +28,13 @@ import android.view.GraphicBuffer; */ interface IAssetAtlas { /** + * Indicates whether the atlas is compatible with the specified + * parent process id. If the atlas' ppid does not match, this + * method will return false. + */ + boolean isCompatible(int ppid); + + /** * Returns the atlas buffer (texture) or null if the atlas is * not available yet. */ -- cgit v1.1