Merge "Disable the AssetAtlas when running under valgrind Bug #9191438"
This commit is contained in:
@@ -649,6 +649,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)}.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -27,6 +27,13 @@ import android.view.GraphicBuffer;
|
||||
* @hide
|
||||
*/
|
||||
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.
|
||||
|
||||
@@ -99,6 +99,11 @@ jint android_os_Process_myPid(JNIEnv* env, jobject clazz)
|
||||
return getpid();
|
||||
}
|
||||
|
||||
jint android_os_Process_myPpid(JNIEnv* env, jobject clazz)
|
||||
{
|
||||
return getppid();
|
||||
}
|
||||
|
||||
jint android_os_Process_myUid(JNIEnv* env, jobject clazz)
|
||||
{
|
||||
return getuid();
|
||||
@@ -990,6 +995,7 @@ jintArray android_os_Process_getPidsForCommands(JNIEnv* env, jobject clazz,
|
||||
|
||||
static const JNINativeMethod methods[] = {
|
||||
{"myPid", "()I", (void*)android_os_Process_myPid},
|
||||
{"myPpid", "()I", (void*)android_os_Process_myPpid},
|
||||
{"myTid", "()I", (void*)android_os_Process_myTid},
|
||||
{"myUid", "()I", (void*)android_os_Process_myUid},
|
||||
{"getUidForName", "(Ljava/lang/String;)I", (void*)android_os_Process_getUidForName},
|
||||
|
||||
@@ -369,6 +369,11 @@ public class AssetAtlasService extends IAssetAtlas.Stub {
|
||||
private static native void nReleaseAtlasCanvas(Canvas canvas, int bitmap);
|
||||
private static native boolean nUploadAtlas(GraphicBuffer buffer, int bitmap);
|
||||
|
||||
@Override
|
||||
public boolean isCompatible(int ppid) {
|
||||
return ppid == android.os.Process.myPpid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphicBuffer getBuffer() throws RemoteException {
|
||||
return mAtlasReady.get() ? mBuffer : null;
|
||||
|
||||
Reference in New Issue
Block a user