Merge change I6869df3a into eclair
* changes:
Add new audio sources to support the A1026 recording configurations.
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index bf3d26e..596fd98 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3964,8 +3964,7 @@
mHighlightPath = new Path();
if (selStart == selEnd) {
- if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK)
- < BLINK) {
+ if ((SystemClock.uptimeMillis() - mShowCursor) % (2 * BLINK) < BLINK) {
if (mHighlightPathBogus) {
mHighlightPath.reset();
mLayout.getCursorPath(selStart, mHighlightPath, mText);
@@ -5344,21 +5343,24 @@
* will happen at measure).
*/
makeNewLayout(want, hintWant, UNKNOWN_BORING, UNKNOWN_BORING,
- mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(), false);
+ mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(),
+ false);
- // In a fixed-height view, so use our new text layout.
- if (mLayoutParams.height != LayoutParams.WRAP_CONTENT &&
- mLayoutParams.height != LayoutParams.FILL_PARENT) {
- invalidate();
- return;
- }
-
- // Dynamic height, but height has stayed the same,
- // so use our new text layout.
- if (mLayout.getHeight() == oldht &&
- (mHintLayout == null || mHintLayout.getHeight() == oldht)) {
- invalidate();
- return;
+ if (mEllipsize != TextUtils.TruncateAt.MARQUEE) {
+ // In a fixed-height view, so use our new text layout.
+ if (mLayoutParams.height != LayoutParams.WRAP_CONTENT &&
+ mLayoutParams.height != LayoutParams.FILL_PARENT) {
+ invalidate();
+ return;
+ }
+
+ // Dynamic height, but height has stayed the same,
+ // so use our new text layout.
+ if (mLayout.getHeight() == oldht &&
+ (mHintLayout == null || mHintLayout.getHeight() == oldht)) {
+ invalidate();
+ return;
+ }
}
// We lose: the height has changed and we have a dynamic height.
diff --git a/graphics/java/android/renderscript/RSSurfaceView.java b/graphics/java/android/renderscript/RSSurfaceView.java
index 53466cc..1bc03ac 100644
--- a/graphics/java/android/renderscript/RSSurfaceView.java
+++ b/graphics/java/android/renderscript/RSSurfaceView.java
@@ -80,6 +80,9 @@
*/
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return
+ if (mRS != null) {
+ mRS.contextSetSurface(null);
+ }
//Log.v(RenderScript.LOG_TAG, "surfaceDestroyed");
}
@@ -88,6 +91,9 @@
* not normally called or subclassed by clients of RSSurfaceView.
*/
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ if (mRS != null) {
+ mRS.contextSetSurface(holder.getSurface());
+ }
//Log.v(RenderScript.LOG_TAG, "surfaceChanged");
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 1f2ea38..f1e5af1 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -64,6 +64,7 @@
native void nDeviceSetConfig(int dev, int param, int value);
native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth);
native void nContextDestroy(int con);
+ native void nContextSetSurface(Surface sur);
native void nContextBindRootScript(int script);
native void nContextBindSampler(int sampler, int slot);
@@ -276,6 +277,11 @@
mMessageThread.start();
}
+ public void contextSetSurface(Surface sur) {
+ mSurface = sur;
+ nContextSetSurface(mSurface);
+ }
+
public void destroy() {
nContextDeinitToClient();
mMessageThread.mRun = false;
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index fa3baa20..f3dda41 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -171,6 +171,24 @@
}
static void
+nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nContextSetSurface, con(%p), surface(%p)", con, (Surface *)wnd);
+
+ Surface * window = NULL;
+ if (wnd == NULL) {
+
+ } else {
+ jclass surface_class = _env->FindClass("android/view/Surface");
+ jfieldID surfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I");
+ window = (Surface*)_env->GetIntField(wnd, surfaceFieldID);
+ }
+
+ rsContextSetSurface(con, window);
+}
+
+static void
nContextDestroy(JNIEnv *_env, jobject _this, jint con)
{
LOG_API("nContextDestroy, con(%p)", (RsContext)con);
@@ -1328,6 +1346,7 @@
{"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy },
{"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig },
{"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate },
+{"nContextSetSurface", "(Landroid/view/Surface;)V", (void*)nContextSetSurface },
{"nContextDestroy", "(I)V", (void*)nContextDestroy },
{"nContextPause", "()V", (void*)nContextPause },
{"nContextResume", "()V", (void*)nContextResume },
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index c371a23..86c3df6 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -14,10 +14,13 @@
* limitations under the License.
*/
+#define LOG_TAG "IPCThreadState"
+
#include <binder/IPCThreadState.h>
#include <binder/Binder.h>
#include <binder/BpBinder.h>
+#include <cutils/sched_policy.h>
#include <utils/Debug.h>
#include <utils/Log.h>
#include <utils/TextOutput.h>
@@ -418,7 +421,32 @@
alog << "Processing top-level Command: "
<< getReturnString(cmd) << endl;
}
+
+ bool isTainted = false;
+
+ {
+ SchedPolicy policy;
+ get_sched_policy(getpid(), &policy);
+
+ if (policy == SP_BACKGROUND) {
+ isTainted = true;
+ }
+ }
+
result = executeCommand(cmd);
+
+ // Make sure that after executing the commands that we put the thread back into the
+ // default cgroup.
+ {
+ int pid = getpid();
+ SchedPolicy policy;
+ get_sched_policy(pid, &policy);
+
+ if (!isTainted && policy == SP_BACKGROUND) {
+ LOGW("*** THREAD %p (PID %p) was left in SP_BACKGROUND with a priority of %d\n",
+ (void*)pthread_self(), pid, getpriority(PRIO_PROCESS, pid));
+ }
+ }
}
// Let this thread exit the thread pool if it is no longer
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index a393e2f..865e435 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -36,6 +36,10 @@
ContextResume {
}
+ContextSetSurface {
+ param void *sur
+ }
+
AssignName {
param void *obj
param const char *name
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 2cbfe17..38cec64 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -54,6 +54,17 @@
{
free(mPtr);
mPtr = NULL;
+
+ if (mBufferID) {
+ // Causes a SW crash....
+ //LOGV(" mBufferID %i", mBufferID);
+ //glDeleteBuffers(1, &mBufferID);
+ //mBufferID = 0;
+ }
+ if (mTextureID) {
+ glDeleteTextures(1, &mTextureID);
+ mTextureID = 0;
+ }
}
void Allocation::setCpuWritable(bool)
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 961ec0b..3e4cc36 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -85,17 +85,6 @@
}
//eglChooseConfig(mEGL.mDisplay, configAttribs, &mEGL.mConfig, 1, &mEGL.mNumConfigs);
- if (mWndSurface) {
- mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig, mWndSurface, NULL);
- } else {
- mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig,
- android_createDisplaySurface(),
- NULL);
- }
- checkEglError("eglCreateWindowSurface");
- if (mEGL.mSurface == EGL_NO_SURFACE) {
- LOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
- }
mEGL.mContext = eglCreateContext(mEGL.mDisplay, mEGL.mConfig, EGL_NO_CONTEXT, NULL);
checkEglError("eglCreateContext");
@@ -104,10 +93,10 @@
}
gGLContextCount++;
- EGLBoolean ret = eglMakeCurrent(mEGL.mDisplay, mEGL.mSurface, mEGL.mSurface, mEGL.mContext);
- checkEglError("eglCreateContext", ret);
- if (mEGL.mContext == EGL_NO_CONTEXT) {
- LOGE("eglCreateContext returned EGL_NO_CONTEXT");
+ if (mWndSurface) {
+ setSurface(mWndSurface);
+ } else {
+ setSurface((Surface *)android_createDisplaySurface());
}
eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
@@ -134,12 +123,7 @@
void Context::deinitEGL()
{
- EGLBoolean ret = eglMakeCurrent(mEGL.mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- checkEglError("eglCreateContext", ret);
- if (mEGL.mContext == EGL_NO_CONTEXT) {
- LOGE("eglCreateContext returned EGL_NO_CONTEXT");
- }
-
+ setSurface(NULL);
eglDestroyContext(mEGL.mDisplay, mEGL.mContext);
checkEglError("eglDestroyContext");
@@ -311,6 +295,7 @@
while (!rsc->mExit) {
mDraw |= rsc->mIO.playCoreCommands(rsc, !mDraw);
mDraw &= (rsc->mRootScript.get() != NULL);
+ mDraw &= (rsc->mWndSurface != NULL);
if (mDraw) {
mDraw = rsc->runRootScript() && !rsc->mPaused;
@@ -342,6 +327,9 @@
rsc->mStateFragmentStore.deinit(rsc);
ObjectBase::zeroAllUserRef(rsc);
+ rsc->mObjDestroy.mNeedToEmpty = true;
+ rsc->objDestroyOOBRun();
+
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
@@ -350,8 +338,6 @@
rsc->deinitEGL();
pthread_mutex_unlock(&gInitMutex);
- rsc->mObjDestroy.mNeedToEmpty = true;
- rsc->objDestroyOOBRun();
LOGV("RS Thread exited");
return NULL;
}
@@ -440,6 +426,32 @@
objDestroyOOBDestroy();
}
+void Context::setSurface(Surface *sur)
+{
+ EGLBoolean ret;
+ if (mEGL.mSurface != NULL) {
+ ret = eglMakeCurrent(mEGL.mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ checkEglError("eglMakeCurrent", ret);
+
+ ret = eglDestroySurface(mEGL.mDisplay, mEGL.mSurface);
+ checkEglError("eglDestroySurface", ret);
+
+ mEGL.mSurface = NULL;
+ }
+
+ mWndSurface = sur;
+ if (mWndSurface != NULL) {
+ mEGL.mSurface = eglCreateWindowSurface(mEGL.mDisplay, mEGL.mConfig, mWndSurface, NULL);
+ checkEglError("eglCreateWindowSurface");
+ if (mEGL.mSurface == EGL_NO_SURFACE) {
+ LOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
+ }
+
+ ret = eglMakeCurrent(mEGL.mDisplay, mEGL.mSurface, mEGL.mSurface, mEGL.mContext);
+ checkEglError("eglMakeCurrent", ret);
+ }
+}
+
void Context::pause()
{
mPaused = true;
@@ -755,6 +767,11 @@
rsc->resume();
}
+void rsi_ContextSetSurface(Context *rsc, void *sur)
+{
+ rsc->setSurface((Surface *)sur);
+}
+
}
}
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index c80fd5a..bffc55b 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -94,6 +94,7 @@
void pause();
void resume();
+ void setSurface(Surface *sur);
void assignName(ObjectBase *obj, const char *name, uint32_t len);
void removeName(ObjectBase *obj);
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index 1b442ba..b7d67cc 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -113,12 +113,7 @@
void ObjectBase::setName(const char *name)
{
- delete mName;
- mName = NULL;
- if (name) {
- mName = new char[strlen(name) +1];
- strcpy(mName, name);
- }
+ setName(name, strlen(name));
}
void ObjectBase::setName(const char *name, uint32_t len)
diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h
index 8aa4542..bc40854 100644
--- a/libs/rs/rsScript.h
+++ b/libs/rs/rsScript.h
@@ -54,7 +54,7 @@
ObjectBaseRef<ProgramRaster> mRaster;
ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS];
- const char * mScriptText;
+ char * mScriptText;
uint32_t mScriptTextLength;
};
Enviroment_t mEnviroment;
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 9da7766..073d98b 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -46,6 +46,8 @@
if (mAccScript) {
accDeleteScript(mAccScript);
}
+ free(mEnviroment.mScriptText);
+ mEnviroment.mScriptText = NULL;
}
void ScriptC::setupScript()
@@ -404,7 +406,11 @@
void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len)
{
ScriptCState *ss = &rsc->mScriptC;
- ss->mScript->mEnviroment.mScriptText = text;
+
+ char *t = (char *)malloc(len + 1);
+ memcpy(t, text, len);
+ t[len] = 0;
+ ss->mScript->mEnviroment.mScriptText = t;
ss->mScript->mEnviroment.mScriptTextLength = len;
}
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index ae124b4..69afc18 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -41,10 +41,6 @@
virtual ~ScriptC();
struct Program_t {
- const char * mScriptText;
- uint32_t mScriptTextLength;
-
-
int mVersionMajor;
int mVersionMinor;
diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp
index 21ef50e..3c50977 100644
--- a/opengl/libagl/matrix.cpp
+++ b/opengl/libagl/matrix.cpp
@@ -741,20 +741,19 @@
void point4__mvui(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) {
// this used for transforming light positions back to object space.
- // Lights have 3 components positions, so w is always 1.
- // however, it is used as a switch for directional lights, so we need
+ // w is used as a switch for directional lights, so we need
// to preserve it.
const GLfixed* const m = mx->matrix.m;
const GLfixed rx = rhs->x;
const GLfixed ry = rhs->y;
const GLfixed rz = rhs->z;
- lhs->x = mla3a(rx, m[ 0], ry, m[ 4], rz, m[ 8], m[12]);
- lhs->y = mla3a(rx, m[ 1], ry, m[ 5], rz, m[ 9], m[13]);
- lhs->z = mla3a(rx, m[ 2], ry, m[ 6], rz, m[10], m[14]);
- lhs->w = rhs->w;
+ const GLfixed rw = rhs->w;
+ lhs->x = mla4(rx, m[ 0], ry, m[ 4], rz, m[ 8], rw, m[12]);
+ lhs->y = mla4(rx, m[ 1], ry, m[ 5], rz, m[ 9], rw, m[13]);
+ lhs->z = mla4(rx, m[ 2], ry, m[ 6], rz, m[10], rw, m[14]);
+ lhs->w = rw;
}
-
void point2__nop(transform_t const*, vec4_t* lhs, vec4_t const* rhs) {
lhs->z = 0;
lhs->w = 0x10000;
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index f75f7195..93b469f 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -1760,7 +1760,8 @@
try {
if (mScreenBrightnessOverride >= 0) {
return mScreenBrightnessOverride;
- } else if (mLightSensorBrightness >= 0 && mUseSoftwareAutoBrightness) {
+ } else if (mLightSensorBrightness >= 0 && mUseSoftwareAutoBrightness
+ && mAutoBrightessEnabled) {
return mLightSensorBrightness;
}
final int brightness = Settings.System.getInt(mContext.getContentResolver(),
diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java
index 59e9832..8d73904 100644
--- a/services/java/com/android/server/status/StatusBarService.java
+++ b/services/java/com/android/server/status/StatusBarService.java
@@ -692,6 +692,7 @@
mTicker.addEntry(n, StatusBarIcon.getIcon(mContext, data), n.tickerText);
}
}
+ updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
}
// icon
@@ -950,7 +951,9 @@
panelSlightlyVisible(true);
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
- mExpandedDialog.show();
+ mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ mExpandedDialog.getWindow().setAttributes(mExpandedParams);
mExpandedView.requestFocus(View.FOCUS_FORWARD);
mTrackingView.setVisibility(View.VISIBLE);
@@ -1027,7 +1030,9 @@
}
mExpandedVisible = false;
panelSlightlyVisible(false);
- mExpandedDialog.hide();
+ mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ mExpandedDialog.getWindow().setAttributes(mExpandedParams);
mTrackingView.setVisibility(View.GONE);
if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) {
@@ -1056,6 +1061,7 @@
else if (mAnimY < mStatusBarView.getHeight()) {
if (SPEW) Log.d(TAG, "Animation completed to collapsed state.");
mAnimating = false;
+ updateExpandedViewPos(0);
performCollapse();
}
else {
@@ -1508,17 +1514,18 @@
}
}
+ final int disph = mDisplay.getHeight();
lp = mExpandedDialog.getWindow().getAttributes();
lp.width = ViewGroup.LayoutParams.FILL_PARENT;
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.x = 0;
- lp.y = 0;
+ mTrackingPosition = lp.y = -disph; // sufficiently large negative
lp.type = WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;
lp.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
- | WindowManager.LayoutParams.FLAG_DITHER;
+ | WindowManager.LayoutParams.FLAG_DITHER
+ | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
lp.format = pixelFormat;
lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
lp.setTitle("StatusBarExpanded");
@@ -1531,7 +1538,6 @@
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
mExpandedDialog.show();
- mExpandedDialog.hide();
FrameLayout hack = (FrameLayout)mExpandedView.getParent();
hack.setForeground(null);
}
@@ -1558,15 +1564,24 @@
+ " mTrackingPosition=" + mTrackingPosition);
}
- // If the expanded view is not visible, there is no reason to do
- // any work.
- if (!mExpandedVisible) {
- return;
- }
-
- // tracking view...
int h = mStatusBarView.getHeight();
int disph = mDisplay.getHeight();
+
+ // If the expanded view is not visible, make sure they're still off screen.
+ // Maybe the view was resized.
+ if (!mExpandedVisible) {
+ if (mTrackingView != null) {
+ mTrackingPosition = mTrackingParams.y = -disph;
+ WindowManagerImpl.getDefault().updateViewLayout(mTrackingView, mTrackingParams);
+ }
+ if (mExpandedParams != null) {
+ mExpandedParams.y = -disph;
+ mExpandedDialog.getWindow().setAttributes(mExpandedParams);
+ }
+ return;
+ }
+
+ // tracking view...
int pos;
if (expandedPosition == EXPANDED_FULL_OPEN) {
pos = h;
@@ -1677,7 +1692,7 @@
private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
public void onClick(View v) {
mNotificationCallbacks.onClearAll();
- performCollapse();
+ addPendingOp(OP_EXPAND, null, false);
}
};
diff --git a/services/java/com/android/server/status/TrackingPatternView.java b/services/java/com/android/server/status/TrackingPatternView.java
index 0ae9984..4cb8eff 100644
--- a/services/java/com/android/server/status/TrackingPatternView.java
+++ b/services/java/com/android/server/status/TrackingPatternView.java
@@ -55,8 +55,6 @@
final int textureWidth = mTextureWidth;
final int textureHeight = mTextureHeight;
- Log.d("TrackingPatternView", "width=" + width + " textureWidth=" + textureWidth);
-
int x = 0;
int y;