Merge change 21831 into eclair
* changes:
Add reflections to the water
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index ce72e3f..2dedaa7 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -342,8 +342,9 @@
/**
* Remove this service from foreground state, allowing it to be killed if
* more memory is needed.
- * @param keepNotification If true, the notification previously provided
- * to {@link #startForeground} will remain displayed.
+ * @param removeNotification If true, the notification previously provided
+ * to {@link #startForeground} will be removed. Otherwise it will remain
+ * until a later call removes it (or the service is destroyed).
* @see #startForeground(int, Notification)
*/
public final void stopForeground(boolean removeNotification) {
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 50d39b7..81848b9 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -47,14 +47,6 @@
mRS.nAllocationUploadToTexture(mID, baseMipLevel);
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nAllocationDestroy(mID);
- }
-
public void data(int[] d) {
mRS.nAllocationData(mID, d);
}
@@ -98,11 +90,6 @@
mID = id;
}
- public void destroy() {
- mRS.nAdapter1DDestroy(mID);
- mID = 0;
- }
-
public void setConstraint(Dimension dim, int value) {
mRS.nAdapter1DSetConstraint(mID, dim.mID, value);
}
@@ -139,11 +126,6 @@
mID = id;
}
- public void destroy() {
- mRS.nAdapter2DDestroy(mID);
- mID = 0;
- }
-
public void setConstraint(Dimension dim, int value) {
mRS.nAdapter2DSetConstraint(mID, dim.mID, value);
}
@@ -251,7 +233,7 @@
Allocation alloc = createTyped(rs, t);
t.destroy();
return alloc;
- }
+ }
*/
}
diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java
index f760035..c25f16a 100644
--- a/graphics/java/android/renderscript/BaseObj.java
+++ b/graphics/java/android/renderscript/BaseObj.java
@@ -60,10 +60,24 @@
protected void finalize() throws Throwable
{
if (!mDestroyed) {
+ if(mID != 0) {
+ mRS.nObjDestroyOOB(mID);
+ }
+ mID = 0;
+ mDestroyed = true;
Log.v(RenderScript.LOG_TAG,
- "Element finalized without having released the RS reference.");
+ getClass() + " auto finalizing object without having released the RS reference.");
}
super.finalize();
}
+
+ public void destroy() {
+ if(mDestroyed) {
+ throw new IllegalStateException("Object already destroyed.");
+ }
+ mDestroyed = true;
+ mRS.nObjDestroy(mID);
+ }
+
}
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index cf181b7..3f75069 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -138,11 +138,7 @@
if(mIsPredefined) {
throw new IllegalStateException("Attempting to destroy a predefined Element.");
}
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nElementDestroy(mID);
+ super.destroy();
}
public static Element createFromClass(RenderScript rs, Class c) {
diff --git a/graphics/java/android/renderscript/Light.java b/graphics/java/android/renderscript/Light.java
index 8067f19..115ae03 100644
--- a/graphics/java/android/renderscript/Light.java
+++ b/graphics/java/android/renderscript/Light.java
@@ -29,11 +29,6 @@
mID = id;
}
- public void destroy() {
- mRS.nLightDestroy(mID);
- mID = 0;
- }
-
public void setColor(float r, float g, float b) {
mRS.nLightSetColor(mID, r, g, b);
}
diff --git a/graphics/java/android/renderscript/ProgramFragment.java b/graphics/java/android/renderscript/ProgramFragment.java
index 09c4d9a..aad09f6 100644
--- a/graphics/java/android/renderscript/ProgramFragment.java
+++ b/graphics/java/android/renderscript/ProgramFragment.java
@@ -45,14 +45,6 @@
mID = id;
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nProgramFragmentStoreDestroy(mID);
- }
-
public void bindTexture(Allocation va, int slot)
throws IllegalArgumentException {
if((slot < 0) || (slot >= MAX_SLOT)) {
diff --git a/graphics/java/android/renderscript/ProgramStore.java b/graphics/java/android/renderscript/ProgramStore.java
index f8b59bd..b7d987e 100644
--- a/graphics/java/android/renderscript/ProgramStore.java
+++ b/graphics/java/android/renderscript/ProgramStore.java
@@ -80,14 +80,6 @@
mID = id;
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nProgramFragmentStoreDestroy(mID);
- }
-
public static class Builder {
diff --git a/graphics/java/android/renderscript/ProgramVertex.java b/graphics/java/android/renderscript/ProgramVertex.java
index 74c005f..2a11bfb 100644
--- a/graphics/java/android/renderscript/ProgramVertex.java
+++ b/graphics/java/android/renderscript/ProgramVertex.java
@@ -33,14 +33,6 @@
mID = id;
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nProgramVertexDestroy(mID);
- }
-
public void bindAllocation(MatrixAllocation va) {
mRS.nProgramVertexBindAllocation(mID, va.mAlloc.mID);
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index ab263ed..fca1c7a 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -74,6 +74,8 @@
native void nContextAddDefineF(String name, float value);
native void nAssignName(int obj, byte[] name);
+ native void nObjDestroy(int id);
+ native void nObjDestroyOOB(int id);
native int nFileOpen(byte[] name);
native void nElementBegin();
@@ -81,12 +83,10 @@
native void nElementAdd(int kind, int type, int norm, int bits, String s);
native int nElementCreate();
native int nElementGetPredefined(int predef);
- native void nElementDestroy(int obj);
native void nTypeBegin(int elementID);
native void nTypeAdd(int dim, int val);
native int nTypeCreate();
- native void nTypeDestroy(int id);
native void nTypeFinalDestroy(Type t);
native void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs);
@@ -97,7 +97,6 @@
native int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp);
native void nAllocationUploadToTexture(int alloc, int baseMioLevel);
- native void nAllocationDestroy(int alloc);
native void nAllocationData(int id, int[] d);
native void nAllocationData(int id, float[] d);
native void nAllocationSubData1D(int id, int off, int count, int[] d);
@@ -108,7 +107,6 @@
native void nAllocationRead(int id, float[] d);
native void nAllocationDataFromObject(int id, Type t, Object o);
- native void nTriangleMeshDestroy(int id);
native void nTriangleMeshBegin(int vertex, int index);
native void nTriangleMeshAddVertex_XY (float x, float y);
native void nTriangleMeshAddVertex_XYZ (float x, float y, float z);
@@ -118,7 +116,6 @@
native void nTriangleMeshAddTriangle(int i1, int i2, int i3);
native int nTriangleMeshCreate();
- native void nAdapter1DDestroy(int id);
native void nAdapter1DBindAllocation(int ad, int alloc);
native void nAdapter1DSetConstraint(int ad, int dim, int value);
native void nAdapter1DData(int ad, int[] d);
@@ -127,7 +124,6 @@
native void nAdapter1DSubData(int ad, int off, int count, float[] d);
native int nAdapter1DCreate();
- native void nAdapter2DDestroy(int id);
native void nAdapter2DBindAllocation(int ad, int alloc);
native void nAdapter2DSetConstraint(int ad, int dim, int value);
native void nAdapter2DData(int ad, int[] d);
@@ -136,7 +132,6 @@
native void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, float[] d);
native int nAdapter2DCreate();
- native void nScriptDestroy(int script);
native void nScriptBindAllocation(int script, int alloc, int slot);
native void nScriptSetClearColor(int script, float r, float g, float b, float a);
native void nScriptSetClearDepth(int script, float depth);
@@ -151,7 +146,6 @@
native void nScriptCAddDefineI32(String name, int value);
native void nScriptCAddDefineF(String name, float value);
- native void nSamplerDestroy(int sampler);
native void nSamplerBegin();
native void nSamplerSet(int param, int value);
native int nSamplerCreate();
@@ -163,7 +157,6 @@
native void nProgramFragmentStoreBlendFunc(int src, int dst);
native void nProgramFragmentStoreDither(boolean enable);
native int nProgramFragmentStoreCreate();
- native void nProgramFragmentStoreDestroy(int pgm);
native void nProgramFragmentBegin(int in, int out);
native void nProgramFragmentBindTexture(int vpf, int slot, int a);
@@ -172,9 +165,7 @@
native void nProgramFragmentSetEnvMode(int slot, int env);
native void nProgramFragmentSetTexEnable(int slot, boolean enable);
native int nProgramFragmentCreate();
- native void nProgramFragmentDestroy(int pgm);
- native void nProgramVertexDestroy(int pv);
native void nProgramVertexBindAllocation(int pv, int mID);
native void nProgramVertexBegin(int inID, int outID);
native void nProgramVertexSetTextureMatrixEnable(boolean enable);
@@ -185,16 +176,13 @@
native void nLightSetIsMono(boolean isMono);
native void nLightSetIsLocal(boolean isLocal);
native int nLightCreate();
- native void nLightDestroy(int l);
native void nLightSetColor(int l, float r, float g, float b);
native void nLightSetPosition(int l, float x, float y, float z);
- native void nSimpleMeshDestroy(int id);
native int nSimpleMeshCreate(int batchID, int idxID, int[] vtxID, int prim);
native void nSimpleMeshBindVertex(int id, int alloc, int slot);
native void nSimpleMeshBindIndex(int id, int alloc);
- native void nAnimationDestroy(int id);
native void nAnimationBegin(int attribCount, int keyframeCount);
native void nAnimationAdd(float time, float[] attribs);
native int nAnimationCreate();
@@ -229,11 +217,6 @@
super(RenderScript.this);
mID = id;
}
-
- public void destroy() {
- nTriangleMeshDestroy(mID);
- mID = 0;
- }
}
public void triangleMeshBegin(Element vertex, Element index) {
@@ -278,11 +261,6 @@
super(RenderScript.this);
mID = id;
}
-
- public void destroy() {
- //nLightDestroy(mID);
- mID = 0;
- }
}
public File fileOpen(String s) throws IllegalStateException, IllegalArgumentException
diff --git a/graphics/java/android/renderscript/Sampler.java b/graphics/java/android/renderscript/Sampler.java
index dfeac81..5e0b110 100644
--- a/graphics/java/android/renderscript/Sampler.java
+++ b/graphics/java/android/renderscript/Sampler.java
@@ -51,11 +51,6 @@
mID = id;
}
- public void destroy() {
- mRS.nSamplerDestroy(mID);
- mID = 0;
- }
-
public static class Builder {
RenderScript mRS;
Value mMin;
diff --git a/graphics/java/android/renderscript/Script.java b/graphics/java/android/renderscript/Script.java
index 5b9eb55..a402471 100644
--- a/graphics/java/android/renderscript/Script.java
+++ b/graphics/java/android/renderscript/Script.java
@@ -31,14 +31,6 @@
mID = id;
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nScriptDestroy(mID);
- }
-
public void bindAllocation(Allocation va, int slot) {
mRS.nScriptBindAllocation(mID, va.mID, slot);
}
diff --git a/graphics/java/android/renderscript/SimpleMesh.java b/graphics/java/android/renderscript/SimpleMesh.java
index 484849b..d80551e 100644
--- a/graphics/java/android/renderscript/SimpleMesh.java
+++ b/graphics/java/android/renderscript/SimpleMesh.java
@@ -34,14 +34,6 @@
mID = id;
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nSimpleMeshDestroy(mID);
- }
-
public void bindVertexAllocation(Allocation a, int slot) {
mRS.nSimpleMeshBindVertex(mID, a.mID, slot);
}
diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java
index afb0e60..30b952d 100644
--- a/graphics/java/android/renderscript/Type.java
+++ b/graphics/java/android/renderscript/Type.java
@@ -48,14 +48,6 @@
super.finalize();
}
- public void destroy() {
- if(mDestroyed) {
- throw new IllegalStateException("Object already destroyed.");
- }
- mDestroyed = true;
- mRS.nTypeDestroy(mID);
- }
-
public static Type createFromClass(RenderScript rs, Class c, int size) {
Element e = Element.createFromClass(rs, c);
Builder b = new Builder(rs, e);
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index ff997e7..001ecd0 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -78,6 +78,23 @@
_env->ReleasePrimitiveArrayCritical(str, cptr, JNI_ABORT);
}
+static void
+nObjDestroy(JNIEnv *_env, jobject _this, jint obj)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nObjDestroy, con(%p) obj(%p)", con, (void *)obj);
+ rsObjDestroy(con, (void *)obj);
+}
+
+static void
+nObjDestroyOOB(JNIEnv *_env, jobject _this, jint obj)
+{
+ // This function only differs from nObjDestroy in that it calls the
+ // special Out Of Band version of ObjDestroy which is thread safe.
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nObjDestroyOOB, con(%p) obj(%p)", con, (void *)obj);
+ rsObjDestroyOOB(con, (void *)obj);
+}
static jint
nFileOpen(JNIEnv *_env, jobject _this, jbyteArray str)
@@ -183,14 +200,6 @@
return (jint)rsElementGetPredefined(con, (RsElementPredefined)predef);
}
-static void
-nElementDestroy(JNIEnv *_env, jobject _this, jint e)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nElementDestroy, con(%p) e(%p)", con, (RsElement)e);
- rsElementDestroy(con, (RsElement)e);
-}
-
// -----------------------------------
static void
@@ -217,14 +226,6 @@
return (jint)rsTypeCreate(con);
}
-static void
-nTypeDestroy(JNIEnv *_env, jobject _this, jint eID)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTypeDestroy, con(%p), t(%p)", con, (RsType)eID);
- rsTypeDestroy(con, (RsType)eID);
-}
-
static void * SF_LoadInt(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
{
((int32_t *)buffer)[0] = _env->GetIntField(_obj, _field);
@@ -412,14 +413,6 @@
static void
-nAllocationDestroy(JNIEnv *_env, jobject _this, jint a)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nAllocationDestroy, con(%p), a(%p)", con, (RsAllocation)a);
- rsAllocationDestroy(con, (RsAllocation)a);
-}
-
-static void
nAllocationData_i(JNIEnv *_env, jobject _this, jint alloc, jintArray data)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -531,14 +524,6 @@
// -----------------------------------
static void
-nTriangleMeshDestroy(JNIEnv *_env, jobject _this, jint tm)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshDestroy, con(%p), tm(%p)", con, (RsAllocation)tm);
- rsTriangleMeshDestroy(con, (RsTriangleMesh)tm);
-}
-
-static void
nTriangleMeshBegin(JNIEnv *_env, jobject _this, jint v, jint i)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -610,14 +595,6 @@
// -----------------------------------
static void
-nAdapter1DDestroy(JNIEnv *_env, jobject _this, jint adapter)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nAdapter1DDestroy, con(%p), adapter(%p)", con, (RsAdapter1D)adapter);
- rsAdapter1DDestroy(con, (RsAdapter1D)adapter);
-}
-
-static void
nAdapter1DBindAllocation(JNIEnv *_env, jobject _this, jint adapter, jint alloc)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -688,14 +665,6 @@
// -----------------------------------
static void
-nAdapter2DDestroy(JNIEnv *_env, jobject _this, jint adapter)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nAdapter2DDestroy, con(%p), adapter(%p)", con, (RsAdapter2D)adapter);
- rsAdapter2DDestroy(con, (RsAdapter2D)adapter);
-}
-
-static void
nAdapter2DBindAllocation(JNIEnv *_env, jobject _this, jint adapter, jint alloc)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -768,14 +737,6 @@
// -----------------------------------
static void
-nScriptDestroy(JNIEnv *_env, jobject _this, jint script)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nScriptDestroy, con(%p), script(%p)", con, (RsScript)script);
- rsScriptDestroy(con, (RsScript)script);
-}
-
-static void
nScriptBindAllocation(JNIEnv *_env, jobject _this, jint script, jint alloc, jint slot)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -988,14 +949,6 @@
return (jint)rsProgramFragmentStoreCreate(con);
}
-static void
-nProgramFragmentStoreDestroy(JNIEnv *_env, jobject _this, jint pgm)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nProgramFragmentStoreDestroy, con(%p), pgm(%i)", con, pgm);
- rsProgramFragmentStoreDestroy(con, (RsProgramFragmentStore)pgm);
-}
-
// ---------------------------------------------------------------------------
static void
@@ -1054,14 +1007,6 @@
return (jint)rsProgramFragmentCreate(con);
}
-static void
-nProgramFragmentDestroy(JNIEnv *_env, jobject _this, jint pgm)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nProgramFragmentDestroy, con(%p), pgm(%i)", con, pgm);
- rsProgramFragmentDestroy(con, (RsProgramFragment)pgm);
-}
-
// ---------------------------------------------------------------------------
static void
@@ -1104,15 +1049,6 @@
return (jint)rsProgramVertexCreate(con);
}
-static void
-nProgramVertexDestroy(JNIEnv *_env, jobject _this, jint pgm)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nProgramFragmentDestroy, con(%p), pgm(%i)", con, pgm);
- rsProgramFragmentDestroy(con, (RsProgramFragment)pgm);
-}
-
-
// ---------------------------------------------------------------------------
@@ -1173,14 +1109,6 @@
// ---------------------------------------------------------------------------
static void
-nSamplerDestroy(JNIEnv *_env, jobject _this, jint s)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nSamplerDestroy, con(%p), sampler(%p)", con, (RsSampler)s);
- rsSamplerDestroy(con, (RsSampler)s);
-}
-
-static void
nSamplerBegin(JNIEnv *_env, jobject _this)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -1239,14 +1167,6 @@
}
static void
-nLightDestroy(JNIEnv *_env, jobject _this, jint light)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nLightDestroy, con(%p), light(%p)", con, (RsLight)light);
- rsLightDestroy(con, (RsLight)light);
-}
-
-static void
nLightSetColor(JNIEnv *_env, jobject _this, jint light, float r, float g, float b)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -1264,14 +1184,6 @@
// ---------------------------------------------------------------------------
-static void
-nSimpleMeshDestroy(JNIEnv *_env, jobject _this, jint s)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nSimpleMeshDestroy, con(%p), SimpleMesh(%p)", con, (RsSimpleMesh)s);
- rsSimpleMeshDestroy(con, (RsSimpleMesh)s);
-}
-
static jint
nSimpleMeshCreate(JNIEnv *_env, jobject _this, jint batchID, jint indexID, jintArray vtxIDs, jint primID)
{
@@ -1313,6 +1225,8 @@
{"nContextCreate", "(ILandroid/view/Surface;I)I", (void*)nContextCreate },
{"nContextDestroy", "(I)V", (void*)nContextDestroy },
{"nAssignName", "(I[B)V", (void*)nAssignName },
+{"nObjDestroy", "(I)V", (void*)nObjDestroy },
+{"nObjDestroyOOB", "(I)V", (void*)nObjDestroyOOB },
{"nFileOpen", "([B)I", (void*)nFileOpen },
@@ -1321,12 +1235,10 @@
{"nElementAdd", "(IIIILjava/lang/String;)V", (void*)nElementAdd },
{"nElementCreate", "()I", (void*)nElementCreate },
{"nElementGetPredefined", "(I)I", (void*)nElementGetPredefined },
-{"nElementDestroy", "(I)V", (void*)nElementDestroy },
{"nTypeBegin", "(I)V", (void*)nTypeBegin },
{"nTypeAdd", "(II)V", (void*)nTypeAdd },
{"nTypeCreate", "()I", (void*)nTypeCreate },
-{"nTypeDestroy", "(I)V", (void*)nTypeDestroy },
{"nTypeFinalDestroy", "(Landroid/renderscript/Type;)V", (void*)nTypeFinalDestroy },
{"nTypeSetupFields", "(Landroid/renderscript/Type;[I[I[Ljava/lang/reflect/Field;)V", (void*)nTypeSetupFields },
@@ -1336,7 +1248,6 @@
{"nAllocationCreateFromBitmap", "(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmap },
{"nAllocationCreateFromBitmapBoxed","(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmapBoxed },
{"nAllocationUploadToTexture", "(II)V", (void*)nAllocationUploadToTexture },
-{"nAllocationDestroy", "(I)V", (void*)nAllocationDestroy },
{"nAllocationData", "(I[I)V", (void*)nAllocationData_i },
{"nAllocationData", "(I[F)V", (void*)nAllocationData_f },
{"nAllocationSubData1D", "(III[I)V", (void*)nAllocationSubData1D_i },
@@ -1347,7 +1258,6 @@
{"nAllocationRead", "(I[F)V", (void*)nAllocationRead_f },
{"nAllocationDataFromObject", "(ILandroid/renderscript/Type;Ljava/lang/Object;)V", (void*)nAllocationDataFromObject },
-{"nTriangleMeshDestroy", "(I)V", (void*)nTriangleMeshDestroy },
{"nTriangleMeshBegin", "(II)V", (void*)nTriangleMeshBegin },
{"nTriangleMeshAddVertex_XY", "(FF)V", (void*)nTriangleMeshAddVertex_XY },
{"nTriangleMeshAddVertex_XYZ", "(FFF)V", (void*)nTriangleMeshAddVertex_XYZ },
@@ -1357,7 +1267,6 @@
{"nTriangleMeshAddTriangle", "(III)V", (void*)nTriangleMeshAddTriangle },
{"nTriangleMeshCreate", "()I", (void*)nTriangleMeshCreate },
-{"nAdapter1DDestroy", "(I)V", (void*)nAdapter1DDestroy },
{"nAdapter1DBindAllocation", "(II)V", (void*)nAdapter1DBindAllocation },
{"nAdapter1DSetConstraint", "(III)V", (void*)nAdapter1DSetConstraint },
{"nAdapter1DData", "(I[I)V", (void*)nAdapter1DData_i },
@@ -1366,7 +1275,6 @@
{"nAdapter1DSubData", "(III[F)V", (void*)nAdapter1DSubData_f },
{"nAdapter1DCreate", "()I", (void*)nAdapter1DCreate },
-{"nAdapter2DDestroy", "(I)V", (void*)nAdapter2DDestroy },
{"nAdapter2DBindAllocation", "(II)V", (void*)nAdapter2DBindAllocation },
{"nAdapter2DSetConstraint", "(III)V", (void*)nAdapter2DSetConstraint },
{"nAdapter2DData", "(I[I)V", (void*)nAdapter2DData_i },
@@ -1375,7 +1283,6 @@
{"nAdapter2DSubData", "(IIIII[F)V", (void*)nAdapter2DSubData_f },
{"nAdapter2DCreate", "()I", (void*)nAdapter2DCreate },
-{"nScriptDestroy", "(I)V", (void*)nScriptDestroy },
{"nScriptBindAllocation", "(III)V", (void*)nScriptBindAllocation },
{"nScriptSetClearColor", "(IFFFF)V", (void*)nScriptSetClearColor },
{"nScriptSetClearDepth", "(IF)V", (void*)nScriptSetClearDepth },
@@ -1397,7 +1304,6 @@
{"nProgramFragmentStoreBlendFunc", "(II)V", (void*)nProgramFragmentStoreBlendFunc },
{"nProgramFragmentStoreDither", "(Z)V", (void*)nProgramFragmentStoreDither },
{"nProgramFragmentStoreCreate", "()I", (void*)nProgramFragmentStoreCreate },
-{"nProgramFragmentStoreDestroy", "(I)V", (void*)nProgramFragmentStoreDestroy },
{"nProgramFragmentBegin", "(II)V", (void*)nProgramFragmentBegin },
{"nProgramFragmentBindTexture", "(III)V", (void*)nProgramFragmentBindTexture },
@@ -1406,9 +1312,7 @@
{"nProgramFragmentSetEnvMode", "(II)V", (void*)nProgramFragmentSetEnvMode },
{"nProgramFragmentSetTexEnable", "(IZ)V", (void*)nProgramFragmentSetTexEnable },
{"nProgramFragmentCreate", "()I", (void*)nProgramFragmentCreate },
-{"nProgramFragmentDestroy", "(I)V", (void*)nProgramFragmentDestroy },
-{"nProgramVertexDestroy", "(I)V", (void*)nProgramVertexDestroy },
{"nProgramVertexBindAllocation", "(II)V", (void*)nProgramVertexBindAllocation },
{"nProgramVertexBegin", "(II)V", (void*)nProgramVertexBegin },
{"nProgramVertexSetTextureMatrixEnable", "(Z)V", (void*)nProgramVertexSetTextureMatrixEnable },
@@ -1419,7 +1323,6 @@
{"nLightSetIsMono", "(Z)V", (void*)nLightSetIsMono },
{"nLightSetIsLocal", "(Z)V", (void*)nLightSetIsLocal },
{"nLightCreate", "()I", (void*)nLightCreate },
-{"nLightDestroy", "(I)V", (void*)nLightDestroy },
{"nLightSetColor", "(IFFF)V", (void*)nLightSetColor },
{"nLightSetPosition", "(IFFF)V", (void*)nLightSetPosition },
@@ -1428,12 +1331,10 @@
{"nContextBindProgramFragment", "(I)V", (void*)nContextBindProgramFragment },
{"nContextBindProgramVertex", "(I)V", (void*)nContextBindProgramVertex },
-{"nSamplerDestroy", "(I)V", (void*)nSamplerDestroy },
{"nSamplerBegin", "()V", (void*)nSamplerBegin },
{"nSamplerSet", "(II)V", (void*)nSamplerSet },
{"nSamplerCreate", "()I", (void*)nSamplerCreate },
-{"nSimpleMeshDestroy", "(I)V", (void*)nSimpleMeshDestroy },
{"nSimpleMeshCreate", "(II[II)I", (void*)nSimpleMeshCreate },
{"nSimpleMeshBindVertex", "(III)V", (void*)nSimpleMeshBindVertex },
{"nSimpleMeshBindIndex", "(II)V", (void*)nSimpleMeshBindIndex },
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index d7d572e..e4cf00f 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -51,6 +51,7 @@
RsContext rsContextCreate(RsDevice, void *, uint32_t version);
void rsContextDestroy(RsContext);
+void rsObjDestroyOOB(RsContext, void *);
#define RS_MAX_TEXTURE 2
diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
index da9eda8..6d400c5 100644
--- a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
+++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
@@ -67,8 +67,6 @@
private RenderScript mRS;
private Allocation mIntAlloc;
- private Allocation mPartAlloc;
- private Script mScript;
private SimpleMesh mSM;
private SomeData mSD;
private Type mSDType;
@@ -94,9 +92,9 @@
mSM = smb.create();
mSM.setName("PartMesh");
- mPartAlloc = mSM.createVertexAllocation(vtxSlot);
- mPartAlloc.setName("PartBuffer");
- mSM.bindVertexAllocation(mPartAlloc, 0);
+ Allocation partAlloc = mSM.createVertexAllocation(vtxSlot);
+ partAlloc.setName("PartBuffer");
+ mSM.bindVertexAllocation(partAlloc, 0);
// All setup of named objects should be done by this point
// because we are about to compile the script.
@@ -104,12 +102,12 @@
sb.setScript(mRes, R.raw.fountain);
sb.setRoot(true);
sb.setType(mSDType, "Control", 0);
- mScript = sb.create();
- mScript.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ Script script = sb.create();
+ script.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- mScript.bindAllocation(mIntAlloc, 0);
- mScript.bindAllocation(mPartAlloc, 1);
- mRS.contextBindRootScript(mScript);
+ script.bindAllocation(mIntAlloc, 0);
+ script.bindAllocation(partAlloc, 1);
+ mRS.contextBindRootScript(script);
}
}
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 0df237f..1a81021 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -32,6 +32,10 @@
param size_t len
}
+ObjDestroy {
+ param void *obj
+ }
+
ElementBegin {
}
@@ -56,10 +60,6 @@
ret RsElement
}
-ElementDestroy {
- param RsElement ve
- }
-
TypeBegin {
param RsElement type
}
@@ -73,10 +73,6 @@
ret RsType
}
-TypeDestroy {
- param RsType p
- }
-
AllocationCreateTyped {
param RsType type
ret RsAllocation
@@ -130,10 +126,6 @@
param RsAllocation alloc
}
-AllocationDestroy {
- param RsAllocation alloc
- }
-
AllocationData {
param RsAllocation va
@@ -170,10 +162,6 @@
param RsAllocation alloc
}
-Adapter1DDestroy {
- param RsAdapter1D adapter
- }
-
Adapter1DSetConstraint {
param RsAdapter1D adapter
param RsDimension dim
@@ -201,10 +189,6 @@
param RsAllocation alloc
}
-Adapter2DDestroy {
- param RsAdapter2D adapter
- }
-
Adapter2DSetConstraint {
param RsAdapter2D adapter
param RsDimension dim
@@ -237,9 +221,6 @@
ret RsSampler
}
-SamplerDestroy {
- param RsSampler s
- }
TriangleMeshBegin {
param RsElement vertex
@@ -260,9 +241,6 @@
ret RsTriangleMesh
}
-TriangleMeshDestroy {
- param RsTriangleMesh mesh
- }
TriangleMeshRender {
param RsTriangleMesh vtm
@@ -274,9 +252,6 @@
param uint32_t count
}
-ScriptDestroy {
- param RsScript script
- }
ScriptBindAllocation {
param RsScript vtm
@@ -381,9 +356,6 @@
ret RsProgramFragmentStore
}
-ProgramFragmentStoreDestroy {
- param RsProgramFragmentStore pfs
- }
ProgramFragmentBegin {
@@ -422,10 +394,6 @@
ret RsProgramFragment
}
-ProgramFragmentDestroy {
- param RsProgramFragment pf
- }
-
ProgramVertexBegin {
param RsElement in
@@ -464,9 +432,6 @@
ret RsLight light
}
-LightDestroy {
- param RsLight light
- }
LightSetPosition {
param RsLight light
@@ -498,9 +463,6 @@
param uint32_t primType
}
-SimpleMeshDestroy {
- param RsSimpleMesh mesh
- }
SimpleMeshBindIndex {
param RsSimpleMesh mesh
diff --git a/libs/rs/rsAdapter.cpp b/libs/rs/rsAdapter.cpp
index 25f3340..3242e11 100644
--- a/libs/rs/rsAdapter.cpp
+++ b/libs/rs/rsAdapter.cpp
@@ -76,12 +76,6 @@
return a;
}
-void rsi_Adapter1DDestroy(Context *rsc, RsAdapter1D va)
-{
- Adapter1D * a = static_cast<Adapter1D *>(va);
- a->decRef();
-}
-
void rsi_Adapter1DBindAllocation(Context *rsc, RsAdapter1D va, RsAllocation valloc)
{
Adapter1D * a = static_cast<Adapter1D *>(va);
@@ -195,12 +189,6 @@
return a;
}
-void rsi_Adapter2DDestroy(Context *rsc, RsAdapter2D va)
-{
- Adapter2D * a = static_cast<Adapter2D *>(va);
- a->decRef();
-}
-
void rsi_Adapter2DBindAllocation(Context *rsc, RsAdapter2D va, RsAllocation valloc)
{
Adapter2D * a = static_cast<Adapter2D *>(va);
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index ad9c739..3cb76bc 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -201,10 +201,6 @@
alloc->uploadToBufferObject();
}
-void rsi_AllocationDestroy(Context *rsc, RsAllocation)
-{
-}
-
static void mip565(const Adapter2D &out, const Adapter2D &in)
{
uint32_t w = out.getDimX();
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 52389ea..7bfa81ed 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -170,12 +170,14 @@
mDraw = rsc->runRootScript();
eglSwapBuffers(rsc->mDisplay, rsc->mSurface);
}
+ rsc->objDestroyOOBRun();
}
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(rsc->mDisplay, rsc->mSurface);
eglTerminate(rsc->mDisplay);
+ rsc->objDestroyOOBRun();
return NULL;
}
@@ -210,6 +212,8 @@
mWndSurface = sur;
+ objDestroyOOBInit();
+
LOGV("RS Launching thread");
status = pthread_create(&mThreadId, &threadAttr, threadProc, this);
if (status) {
@@ -229,11 +233,14 @@
void *res;
int status = pthread_join(mThreadId, &res);
+ objDestroyOOBRun();
if (mDev) {
mDev->removeContext(this);
pthread_key_delete(gThreadTLSKey);
}
+
+ objDestroyOOBDestroy();
}
void Context::swapBuffers()
@@ -345,6 +352,62 @@
}
}
+bool Context::objDestroyOOBInit()
+{
+ int status = pthread_mutex_init(&mObjDestroy.mMutex, NULL);
+ if (status) {
+ LOGE("Context::ObjDestroyOOBInit mutex init failure");
+ return false;
+ }
+ return true;
+}
+
+void Context::objDestroyOOBRun()
+{
+ if (mObjDestroy.mNeedToEmpty) {
+ int status = pthread_mutex_lock(&mObjDestroy.mMutex);
+ if (status) {
+ LOGE("Context::ObjDestroyOOBRun: error %i locking for OOBRun.", status);
+ return;
+ }
+
+ for (size_t ct = 0; ct < mObjDestroy.mDestroyList.size(); ct++) {
+ mObjDestroy.mDestroyList[ct]->decRef();
+ }
+ mObjDestroy.mDestroyList.clear();
+ mObjDestroy.mNeedToEmpty = false;
+
+ status = pthread_mutex_unlock(&mObjDestroy.mMutex);
+ if (status) {
+ LOGE("Context::ObjDestroyOOBRun: error %i unlocking for set condition.", status);
+ }
+ }
+}
+
+void Context::objDestroyOOBDestroy()
+{
+ rsAssert(!mObjDestroy.mNeedToEmpty);
+ pthread_mutex_destroy(&mObjDestroy.mMutex);
+}
+
+void Context::objDestroyAdd(ObjectBase *obj)
+{
+ int status = pthread_mutex_lock(&mObjDestroy.mMutex);
+ if (status) {
+ LOGE("Context::ObjDestroyOOBRun: error %i locking for OOBRun.", status);
+ return;
+ }
+
+ mObjDestroy.mNeedToEmpty = true;
+ mObjDestroy.mDestroyList.add(obj);
+
+ status = pthread_mutex_unlock(&mObjDestroy.mMutex);
+ if (status) {
+ LOGE("Context::ObjDestroyOOBRun: error %i unlocking for set condition.", status);
+ }
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////
//
@@ -395,6 +458,13 @@
rsc->assignName(ob, name, len);
}
+void rsi_ObjDestroy(Context *rsc, void *obj)
+{
+ ObjectBase *ob = static_cast<ObjectBase *>(obj);
+ rsc->removeName(ob);
+ ob->decRef();
+}
+
void rsi_ContextSetDefineF(Context *rsc, const char* name, float value)
{
rsc->addInt32Define(name, value);
@@ -422,3 +492,9 @@
delete rsc;
}
+void rsObjDestroyOOB(RsContext vrsc, void *obj)
+{
+ Context * rsc = static_cast<Context *>(vrsc);
+ rsc->objDestroyAdd(static_cast<ObjectBase *>(obj));
+}
+
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 3d17298..52901b2 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -118,6 +118,7 @@
ThreadIO mIO;
+ void objDestroyAdd(ObjectBase *);
protected:
Device *mDev;
@@ -142,6 +143,17 @@
ObjectBaseRef<ProgramVertex> mVertex;
ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
+
+ struct ObjDestroyOOB {
+ pthread_mutex_t mMutex;
+ Vector<ObjectBase *> mDestroyList;
+ bool mNeedToEmpty;
+ };
+ ObjDestroyOOB mObjDestroy;
+ bool objDestroyOOBInit();
+ void objDestroyOOBRun();
+ void objDestroyOOBDestroy();
+
private:
Context();
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 97b18c0..389b2c0 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -416,12 +416,6 @@
return se;
}
-void rsi_ElementDestroy(Context *rsc, RsElement vse)
-{
- Element * se = static_cast<Element *>(vse);
- se->decRef();
-}
-
}
}
diff --git a/libs/rs/rsLight.cpp b/libs/rs/rsLight.cpp
index 24b58b6..f780e52 100644
--- a/libs/rs/rsLight.cpp
+++ b/libs/rs/rsLight.cpp
@@ -82,7 +82,7 @@
////////////////////////////////////////////////////
-//
+//
namespace android {
namespace renderscript {
@@ -110,12 +110,6 @@
return l;
}
-void rsi_LightDestroy(Context *rsc, RsLight vl)
-{
- Light *l = static_cast<Light *>(vl);
- l->decRef();
-}
-
void rsi_LightSetColor(Context *rsc, RsLight vl, float r, float g, float b)
{
Light *l = static_cast<Light *>(vl);
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index a315658..9df07bf 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -236,15 +236,6 @@
return pf;
}
-void rsi_ProgramFragmentDestroy(Context *rsc, RsProgramFragment vpf)
-{
- ProgramFragment *pf = (ProgramFragment *)vpf;
- if (pf->getName()) {
- rsc->removeName(pf);
- }
- pf->decRef();
-}
-
}
}
diff --git a/libs/rs/rsProgramFragmentStore.cpp b/libs/rs/rsProgramFragmentStore.cpp
index 27f4015..99eed16 100644
--- a/libs/rs/rsProgramFragmentStore.cpp
+++ b/libs/rs/rsProgramFragmentStore.cpp
@@ -261,17 +261,6 @@
rsc->mStateFragmentStore.mPFS->setDitherEnable(enable);
}
-void rsi_ProgramFragmentStoreDestroy(Context *rsc, RsProgramFragmentStore vpfs)
-{
- ProgramFragmentStore *pfs = (ProgramFragmentStore *)vpfs;
- if (pfs->getName()) {
- rsc->removeName(pfs);
- }
- pfs->decRef();
-}
-
-
-
}
}
diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp
index 418f127..c14c371 100644
--- a/libs/rs/rsSampler.cpp
+++ b/libs/rs/rsSampler.cpp
@@ -138,20 +138,13 @@
SamplerState * ss = &rsc->mStateSampler;
- Sampler * s = new Sampler(ss->mMagFilter,
- ss->mMinFilter,
- ss->mWrapS,
+ Sampler * s = new Sampler(ss->mMagFilter,
+ ss->mMinFilter,
+ ss->mWrapS,
ss->mWrapT,
ss->mWrapR);
return s;
}
-void rsi_SamplerDestroy(Context *rsc, RsSampler vs)
-{
- Sampler * s = static_cast<Sampler *>(vs);
- s->decRef();
-
-}
-
}}
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index 6bcb8f2..fde31a1 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -37,12 +37,6 @@
namespace renderscript {
-void rsi_ScriptDestroy(Context * rsc, RsScript vs)
-{
- Script *s = static_cast<Script *>(vs);
- s->decRef();
-}
-
void rsi_ScriptBindAllocation(Context * rsc, RsScript vs, RsAllocation va, uint32_t slot)
{
Script *s = static_cast<Script *>(vs);
diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp
index 08e36ac..0b745eb 100644
--- a/libs/rs/rsSimpleMesh.cpp
+++ b/libs/rs/rsSimpleMesh.cpp
@@ -135,12 +135,6 @@
sm->mPrimitiveBuffer.set((Allocation *)va);
}
-void rsi_SimpleMeshDestroy(Context *rsc, RsSimpleMesh vtm)
-{
- SimpleMesh * tm = static_cast<SimpleMesh *>(vtm);
- tm->decRef();
-}
-
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index 43c3bda..a40a152 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -177,9 +177,16 @@
mGL.mColor.size = 3;
break;
case Component::ALPHA:
- rsAssert(mGL.mColor.size == 3);
- rsAssert(mGL.mColor.type == c->getGLType());
- mGL.mColor.size = 4;
+ // Can be RGBA or A at this point
+ if (mGL.mColor.size > 0) {
+ rsAssert(mGL.mColor.size == 3);
+ rsAssert(mGL.mColor.type == c->getGLType());
+ mGL.mColor.size = 4;
+ } else {
+ mGL.mColor.size = 1;
+ mGL.mColor.offset = mElement->getComponentOffsetBytes(ct);
+ mGL.mColor.type = c->getGLType();
+ }
break;
case Component::NX:
@@ -352,11 +359,6 @@
return st;
}
-void rsi_TypeDestroy(Context *rsc, RsType vst)
-{
- Type * st = static_cast<Type *>(vst);
- st->decRef();
-}
}
}
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index 6047742..e828681 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -392,6 +392,12 @@
}
}
mContext.unbindService(mWallpaperConnection);
+ try {
+ if (DEBUG) Log.v(TAG, "Removing window token: "
+ + mWallpaperConnection.mToken);
+ mIWindowManager.removeWindowToken(mWallpaperConnection.mToken);
+ } catch (RemoteException e) {
+ }
mWallpaperConnection = null;
}
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 988c3d5..a00a756 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -1205,6 +1205,7 @@
// The window is visible to the compositor... but is it visible
// to the user? That is what the wallpaper cares about.
visible = !w.mObscured;
+ if (DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper visibility: " + visible);
// If the wallpaper target is animating, we may need to copy
// its layer adjustment.
@@ -1354,6 +1355,9 @@
if (rawChanged) {
try {
+ if (DEBUG_WALLPAPER) Log.v(TAG, "Report new wp offset "
+ + wallpaperWin + " x=" + wallpaperWin.mWallpaperX
+ + " y=" + wallpaperWin.mWallpaperY);
wallpaperWin.mClient.dispatchWallpaperOffsets(
wallpaperWin.mWallpaperX, wallpaperWin.mWallpaperY);
} catch (RemoteException e) {
@@ -1390,6 +1394,39 @@
return changed;
}
+ void updateWallpaperVisibilityLocked() {
+ final boolean visible = mWallpaperTarget != null
+ && !mWallpaperTarget.mObscured;
+ final int dw = mDisplay.getWidth();
+ final int dh = mDisplay.getHeight();
+
+ int curTokenIndex = mWallpaperTokens.size();
+ while (curTokenIndex > 0) {
+ curTokenIndex--;
+ WindowToken token = mWallpaperTokens.get(curTokenIndex);
+ int curWallpaperIndex = token.windows.size();
+ while (curWallpaperIndex > 0) {
+ curWallpaperIndex--;
+ WindowState wallpaper = token.windows.get(curWallpaperIndex);
+ if (visible) {
+ updateWallpaperOffsetLocked(mWallpaperTarget,
+ wallpaper, dw, dh);
+ }
+
+ if (wallpaper.mWallpaperVisible != visible) {
+ wallpaper.mWallpaperVisible = visible;
+ try {
+ if (DEBUG_VISIBILITY || DEBUG_WALLPAPER) Log.v(TAG,
+ "Setting visibility of wallpaper " + wallpaper
+ + ": " + visible);
+ wallpaper.mClient.dispatchAppVisibility(visible);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+ }
+ }
+
void sendPointerToWallpaperLocked(WindowState srcWin,
MotionEvent pointer, long eventTime) {
int curTokenIndex = mWallpaperTokens.size();
@@ -1727,11 +1764,6 @@
mInputMethodDialogs.remove(win);
}
- if (win.mAttrs.type == TYPE_WALLPAPER ||
- (win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) {
- adjustWallpaperWindowsLocked();
- }
-
final WindowToken token = win.mToken;
final AppWindowToken atoken = win.mAppToken;
token.windows.remove(win);
@@ -1769,6 +1801,11 @@
}
}
+ if (win.mAttrs.type == TYPE_WALLPAPER ||
+ (win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) {
+ adjustWallpaperWindowsLocked();
+ }
+
if (!mInLayout) {
assignLayersLocked();
mLayoutNeeded = true;
@@ -6323,6 +6360,8 @@
visible.set(vf);
final Rect frame = mFrame;
+ final int fw = frame.width();
+ final int fh = frame.height();
//System.out.println("In: w=" + w + " h=" + h + " container=" +
// container + " x=" + mAttrs.x + " y=" + mAttrs.y);
@@ -6359,6 +6398,12 @@
visibleInsets.right = frame.right-visible.right;
visibleInsets.bottom = frame.bottom-visible.bottom;
+ if (mIsWallpaper && (fw != frame.width() || fh != frame.height())
+ && mWallpaperTarget != null) {
+ updateWallpaperOffsetLocked(mWallpaperTarget, this,
+ mDisplay.getWidth(), mDisplay.getHeight());
+ }
+
if (localLOGV) {
//if ("com.google.android.youtube".equals(mAttrs.packageName)
// && mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) {
@@ -6507,7 +6552,8 @@
Surface.openTransaction();
try {
try {
- mSurface.setPosition(mFrame.left, mFrame.top);
+ mSurface.setPosition(mFrame.left + mXOffset,
+ mFrame.top + mYOffset);
mSurface.setLayer(mAnimLayer);
mSurface.hide();
if ((mAttrs.flags&WindowManager.LayoutParams.FLAG_DITHER) != 0) {
@@ -8900,6 +8946,8 @@
focusDisplayed = true;
}
+ final boolean obscuredChanged = w.mObscured != obscured;
+
// Update effect.
if (!(w.mObscured=obscured)) {
if (w.mSurface != null) {
@@ -9001,6 +9049,13 @@
}
}
}
+
+ if (obscuredChanged && mWallpaperTarget == w) {
+ // This is the wallpaper target and its obscured state
+ // changed... make sure the current wallaper's visibility
+ // has been updated accordingly.
+ updateWallpaperVisibilityLocked();
+ }
}
if (backgroundFillerShown == false && mBackgroundFillerShown) {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index d02d33e..8913e816 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -498,10 +498,10 @@
sentSinceLastRecv = 0;
newActivity = Activity.DATAIN;
} else if (sent == 0 && received == 0) {
- newActivity = Activity.NONE;
+ newActivity = (activity == Activity.DORMANT) ? activity : Activity.NONE;
} else {
sentSinceLastRecv = 0;
- newActivity = Activity.NONE;
+ newActivity = (activity == Activity.DORMANT) ? activity : Activity.NONE;
}
if (activity != newActivity) {
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 76a5acd..d8215e7 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -503,8 +503,23 @@
bool withinActivity = false;
bool isMainActivity = false;
bool isLauncherActivity = false;
+ bool isSearchable = false;
bool withinApplication = false;
bool withinReceiver = false;
+ bool withinService = false;
+ bool withinIntentFilter = false;
+ bool hasMainActivity = false;
+ bool hasOtherActivities = false;
+ bool hasOtherReceivers = false;
+ bool hasOtherServices = false;
+ bool hasWallpaperService = false;
+ bool hasImeService = false;
+ bool hasWidgetReceivers = false;
+ bool hasIntentFilter = false;
+ bool actMainActivity = false;
+ bool actWidgetReceivers = false;
+ bool actImeService = false;
+ bool actWallpaperService = false;
int targetSdk = 0;
int smallScreen = 1;
int normalScreen = 1;
@@ -514,9 +529,48 @@
String8 activityLabel;
String8 activityIcon;
String8 receiverName;
+ String8 serviceName;
while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
if (code == ResXMLTree::END_TAG) {
depth--;
+ if (depth < 2) {
+ withinApplication = false;
+ } else if (depth < 3) {
+ if (withinActivity && isMainActivity && isLauncherActivity) {
+ const char *aName = getComponentName(pkg, activityName);
+ if (aName != NULL) {
+ printf("launchable activity name='%s'", aName);
+ }
+ printf("label='%s' icon='%s'\n",
+ activityLabel.string(),
+ activityIcon.string());
+ }
+ if (!hasIntentFilter) {
+ hasOtherActivities |= withinActivity;
+ hasOtherReceivers |= withinReceiver;
+ hasOtherServices |= withinService;
+ }
+ withinActivity = false;
+ withinService = false;
+ withinReceiver = false;
+ hasIntentFilter = false;
+ isMainActivity = isLauncherActivity = false;
+ } else if (depth < 4) {
+ if (withinIntentFilter) {
+ if (withinActivity) {
+ hasMainActivity |= actMainActivity;
+ hasOtherActivities |= !actMainActivity;
+ } else if (withinReceiver) {
+ hasWidgetReceivers |= actWidgetReceivers;
+ hasOtherReceivers |= !actWidgetReceivers;
+ } else if (withinService) {
+ hasImeService |= actImeService;
+ hasWallpaperService |= actWallpaperService;
+ hasOtherServices |= (!actImeService && !actWallpaperService);
+ }
+ }
+ withinIntentFilter = false;
+ }
continue;
}
if (code != ResXMLTree::START_TAG) {
@@ -524,7 +578,7 @@
}
depth++;
String8 tag(tree.getElementName(&len));
- //printf("Depth %d tag %s\n", depth, tag.string());
+ //printf("Depth %d, %s\n", depth, tag.string());
if (depth == 1) {
if (tag != "manifest") {
fprintf(stderr, "ERROR: manifest does not start with <manifest> tag\n");
@@ -656,6 +710,8 @@
} else if (depth == 3 && withinApplication) {
withinActivity = false;
withinReceiver = false;
+ withinService = false;
+ hasIntentFilter = false;
if(tag == "activity") {
withinActivity = true;
activityName = getAttribute(tree, NAME_ATTR, &error);
@@ -690,76 +746,88 @@
fprintf(stderr, "ERROR getting 'android:name' attribute for receiver: %s\n", error.string());
goto bail;
}
+ } else if (tag == "service") {
+ withinService = true;
+ serviceName = getAttribute(tree, NAME_ATTR, &error);
+
+ if (error != "") {
+ fprintf(stderr, "ERROR getting 'android:name' attribute for service: %s\n", error.string());
+ goto bail;
+ }
}
- } else if (depth == 5) {
- if (withinActivity) {
- if (tag == "action") {
- //printf("LOG: action tag\n");
- String8 action = getAttribute(tree, NAME_ATTR, &error);
- if (error != "") {
- fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
- goto bail;
- }
+ } else if ((depth == 4) && (tag == "intent-filter")) {
+ hasIntentFilter = true;
+ withinIntentFilter = true;
+ actMainActivity = actWidgetReceivers = actImeService = actWallpaperService = false;
+ } else if ((depth == 5) && withinIntentFilter){
+ String8 action;
+ if (tag == "action") {
+ action = getAttribute(tree, NAME_ATTR, &error);
+ if (error != "") {
+ fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string());
+ goto bail;
+ }
+ if (withinActivity) {
if (action == "android.intent.action.MAIN") {
isMainActivity = true;
- //printf("LOG: isMainActivity==true\n");
+ actMainActivity = true;
}
- } else if (tag == "category") {
- String8 category = getAttribute(tree, NAME_ATTR, &error);
- if (error != "") {
- fprintf(stderr, "ERROR getting 'name' attribute: %s\n", error.string());
- goto bail;
+ } else if (withinReceiver) {
+ if (action == "android.appwidget.action.APPWIDGET_UPDATE") {
+ actWidgetReceivers = true;
}
+ } else if (withinService) {
+ if (action == "android.view.InputMethod") {
+ actImeService = true;
+ } else if (action == "android.service.wallpaper.WallpaperService") {
+ actWallpaperService = true;
+ }
+ }
+ if (action == "android.intent.action.SEARCH") {
+ isSearchable = true;
+ }
+ }
+
+ if (tag == "category") {
+ String8 category = getAttribute(tree, NAME_ATTR, &error);
+ if (error != "") {
+ fprintf(stderr, "ERROR getting 'name' attribute: %s\n", error.string());
+ goto bail;
+ }
+ if (withinActivity) {
if (category == "android.intent.category.LAUNCHER") {
isLauncherActivity = true;
- //printf("LOG: isLauncherActivity==true\n");
- }
- }
- } else if (withinReceiver) {
- if (tag == "action") {
- String8 action = getAttribute(tree, NAME_ATTR, &error);
- if (error != "") {
- fprintf(stderr, "ERROR getting 'android:name' attribute for receiver: %s\n", error.string());
- goto bail;
- }
- if (action == "android.appwidget.action.APPWIDGET_UPDATE") {
- const char *rName = getComponentName(pkg, receiverName);
- if (rName != NULL) {
- printf("gadget-receiver:'%s/%s'\n", pkg.string(), rName);
- }
}
}
}
}
-
- if (depth < 2) {
- withinApplication = false;
- }
- if (depth < 3) {
- //if (withinActivity) printf("LOG: withinActivity==false\n");
- withinActivity = false;
- withinReceiver = false;
- }
-
- if (depth < 5) {
- //if (isMainActivity) printf("LOG: isMainActivity==false\n");
- //if (isLauncherActivity) printf("LOG: isLauncherActivity==false\n");
- isMainActivity = false;
- isLauncherActivity = false;
- }
-
- if (withinActivity && isMainActivity && isLauncherActivity) {
- printf("launchable activity:");
- const char *aName = getComponentName(pkg, activityName);
- if (aName != NULL) {
- printf(" name='%s'", aName);
- }
- printf("label='%s' icon='%s'\n",
- activityLabel.string(),
- activityIcon.string());
- }
}
-
+
+ if (hasMainActivity) {
+ printf("main\n");
+ }
+ if (hasWidgetReceivers) {
+ printf("app-widget\n");
+ }
+ if (hasImeService) {
+ printf("ime\n");
+ }
+ if (hasWallpaperService) {
+ printf("wallpaper\n");
+ }
+ if (hasOtherActivities) {
+ printf("other-activities\n");
+ }
+ if (isSearchable) {
+ printf("search\n");
+ }
+ if (hasOtherReceivers) {
+ printf("other-receivers\n");
+ }
+ if (hasOtherServices) {
+ printf("other-services\n");
+ }
+
// Determine default values for any unspecified screen sizes,
// based on the target SDK of the package. As of 4 (donut)
// the screen size support was introduced, so all default to
@@ -778,7 +846,7 @@
if (normalScreen != 0) printf(" 'normal'");
if (largeScreen != 0) printf(" 'large'");
printf("\n");
-
+
printf("locales:");
Vector<String8> locales;
res.getLocales(&locales);
@@ -791,7 +859,7 @@
printf(" '%s'", localeStr);
}
printf("\n");
-
+
Vector<ResTable_config> configs;
res.getConfigurations(&configs);
SortedVector<int> densities;
@@ -801,14 +869,14 @@
if (dens == 0) dens = 160;
densities.add(dens);
}
-
+
printf("densities:");
const size_t ND = densities.size();
for (size_t i=0; i<ND; i++) {
printf(" '%d'", densities[i]);
}
printf("\n");
-
+
AssetDir* dir = assets.openNonAssetDir(assetsCookie, "lib");
if (dir != NULL) {
if (dir->getFileCount() > 0) {