summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camera/libcameraservice/CameraService.cpp87
-rw-r--r--camera/libcameraservice/CameraService.h6
-rw-r--r--core/java/android/webkit/WebView.java14
-rw-r--r--libs/rs/rsContext.cpp1
-rw-r--r--libs/rs/rsProgram.h4
-rw-r--r--services/java/com/android/server/status/StatusBarService.java28
6 files changed, 94 insertions, 46 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index b63e97f..6880144 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -309,7 +309,7 @@ status_t CameraService::Client::connect(const sp<ICameraClient>& client)
oldClient = mCameraClient;
// did the client actually change?
- if (client->asBinder() == mCameraClient->asBinder()) {
+ if ((mCameraClient != NULL) && (client->asBinder() == mCameraClient->asBinder())) {
LOGD("Connect to the same client");
return NO_ERROR;
}
@@ -878,7 +878,10 @@ void CameraService::Client::handleShutter()
mSurface->unregisterBuffers();
}
- mCameraClient->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
+ sp<ICameraClient> c = mCameraClient;
+ if (c != NULL) {
+ c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
+ }
mHardware->disableMsgType(CAMERA_MSG_SHUTTER);
// It takes some time before yuvPicture callback to be called.
@@ -932,31 +935,38 @@ void CameraService::Client::handlePreviewData(const sp<IMemory>& mem)
}
}
- // Is the callback enabled or not?
- if (!(mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_ENABLE_MASK)) {
+ // local copy of the callback flags
+ int flags = mPreviewCallbackFlag;
+
+ // is callback enabled?
+ if (!(flags & FRAME_CALLBACK_FLAG_ENABLE_MASK)) {
// If the enable bit is off, the copy-out and one-shot bits are ignored
LOGV("frame callback is diabled");
return;
}
- // Is the received frame copied out or not?
- if (mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_COPY_OUT_MASK) {
- LOGV("frame is copied out");
- copyFrameAndPostCopiedFrame(heap, offset, size);
- } else {
- LOGV("frame is directly sent out without copying");
- mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, mem);
- }
+ // hold a strong pointer to the client
+ sp<ICameraClient> c = mCameraClient;
- // Is this is one-shot only?
- if (mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_ONE_SHOT_MASK) {
- LOGV("One-shot only, thus clear the bits and disable frame callback");
+ // clear callback flags if no client or one-shot mode
+ if ((c == NULL) || (mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_ONE_SHOT_MASK)) {
+ LOGV("Disable preview callback");
mPreviewCallbackFlag &= ~(FRAME_CALLBACK_FLAG_ONE_SHOT_MASK |
FRAME_CALLBACK_FLAG_COPY_OUT_MASK |
FRAME_CALLBACK_FLAG_ENABLE_MASK);
+ // TODO: Shouldn't we use this API for non-overlay hardware as well?
if (mUseOverlay)
mHardware->disableMsgType(CAMERA_MSG_PREVIEW_FRAME);
}
+
+ // Is the received frame copied out or not?
+ if (flags & FRAME_CALLBACK_FLAG_COPY_OUT_MASK) {
+ LOGV("frame is copied");
+ copyFrameAndPostCopiedFrame(c, heap, offset, size);
+ } else {
+ LOGV("frame is forwarded");
+ c->dataCallback(CAMERA_MSG_PREVIEW_FRAME, mem);
+ }
}
// picture callback - postview image ready
@@ -972,7 +982,10 @@ void CameraService::Client::handlePostview(const sp<IMemory>& mem)
}
#endif
- mCameraClient->dataCallback(CAMERA_MSG_POSTVIEW_FRAME, mem);
+ sp<ICameraClient> c = mCameraClient;
+ if (c != NULL) {
+ c->dataCallback(CAMERA_MSG_POSTVIEW_FRAME, mem);
+ }
mHardware->disableMsgType(CAMERA_MSG_POSTVIEW_FRAME);
}
@@ -997,7 +1010,10 @@ void CameraService::Client::handleRawPicture(const sp<IMemory>& mem)
mSurface->postBuffer(offset);
}
- mCameraClient->dataCallback(CAMERA_MSG_RAW_IMAGE, mem);
+ sp<ICameraClient> c = mCameraClient;
+ if (c != NULL) {
+ c->dataCallback(CAMERA_MSG_RAW_IMAGE, mem);
+ }
mHardware->disableMsgType(CAMERA_MSG_RAW_IMAGE);
}
@@ -1014,7 +1030,10 @@ void CameraService::Client::handleCompressedPicture(const sp<IMemory>& mem)
}
#endif
- mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mem);
+ sp<ICameraClient> c = mCameraClient;
+ if (c != NULL) {
+ c->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mem);
+ }
mHardware->disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);
}
@@ -1032,7 +1051,10 @@ void CameraService::Client::notifyCallback(int32_t msgType, int32_t ext1, int32_
client->handleShutter();
break;
default:
- client->mCameraClient->notifyCallback(msgType, ext1, ext2);
+ sp<ICameraClient> c = client->mCameraClient;
+ if (c != NULL) {
+ c->notifyCallback(msgType, ext1, ext2);
+ }
break;
}
@@ -1053,10 +1075,13 @@ void CameraService::Client::dataCallback(int32_t msgType, const sp<IMemory>& dat
return;
}
+ sp<ICameraClient> c = client->mCameraClient;
if (dataPtr == NULL) {
LOGE("Null data returned in data callback");
- client->mCameraClient->notifyCallback(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0);
- client->mCameraClient->dataCallback(msgType, NULL);
+ if (c != NULL) {
+ c->notifyCallback(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0);
+ c->dataCallback(msgType, NULL);
+ }
return;
}
@@ -1074,7 +1099,9 @@ void CameraService::Client::dataCallback(int32_t msgType, const sp<IMemory>& dat
client->handleCompressedPicture(dataPtr);
break;
default:
- client->mCameraClient->dataCallback(msgType, dataPtr);
+ if (c != NULL) {
+ c->dataCallback(msgType, dataPtr);
+ }
break;
}
@@ -1095,15 +1122,20 @@ void CameraService::Client::dataCallbackTimestamp(nsecs_t timestamp, int32_t msg
if (client == 0) {
return;
}
+ sp<ICameraClient> c = client->mCameraClient;
if (dataPtr == NULL) {
LOGE("Null data returned in data with timestamp callback");
- client->mCameraClient->notifyCallback(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0);
- client->mCameraClient->dataCallbackTimestamp(0, msgType, NULL);
+ if (c != NULL) {
+ c->notifyCallback(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0);
+ c->dataCallbackTimestamp(0, msgType, NULL);
+ }
return;
}
- client->mCameraClient->dataCallbackTimestamp(timestamp, msgType, dataPtr);
+ if (c != NULL) {
+ c->dataCallbackTimestamp(timestamp, msgType, dataPtr);
+ }
#if DEBUG_CLIENT_REFERENCES
if (client->getStrongCount() == 1) {
@@ -1161,7 +1193,8 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a
return mHardware->sendCommand(cmd, arg1, arg2);
}
-void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, size_t offset, size_t size)
+void CameraService::Client::copyFrameAndPostCopiedFrame(const sp<ICameraClient>& client,
+ const sp<IMemoryHeap>& heap, size_t offset, size_t size)
{
LOGV("copyFrameAndPostCopiedFrame");
// It is necessary to copy out of pmem before sending this to
@@ -1186,7 +1219,7 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, si
LOGE("failed to allocate space for frame callback");
return;
}
- mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame);
+ client->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame);
}
status_t CameraService::dump(int fd, const Vector<String16>& args)
diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h
index 2e3597f..2fcf839 100644
--- a/camera/libcameraservice/CameraService.h
+++ b/camera/libcameraservice/CameraService.h
@@ -23,10 +23,9 @@
#include <ui/CameraHardwareInterface.h>
#include <ui/Camera.h>
-class android::MemoryHeapBase;
-
namespace android {
+class MemoryHeapBase;
class MediaPlayer;
// ----------------------------------------------------------------------------
@@ -151,7 +150,8 @@ private:
void handleRawPicture(const sp<IMemory>&);
void handleCompressedPicture(const sp<IMemory>&);
- void copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, size_t offset, size_t size);
+ void copyFrameAndPostCopiedFrame(const sp<ICameraClient>& client,
+ const sp<IMemoryHeap>& heap, size_t offset, size_t size);
// camera operation mode
enum camera_mode {
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 4bc1a0e..eb09c66 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2926,12 +2926,12 @@ public class WebView extends AbsoluteLayout
animateScroll);
if (mNativeClass == 0) return;
- if (mShiftIsPressed) {
+ if (mShiftIsPressed && !animateZoom) {
if (mTouchSelection) {
nativeDrawSelectionRegion(canvas);
} else {
- nativeDrawSelection(canvas, mSelectX, mSelectY,
- mExtendSelection);
+ nativeDrawSelection(canvas, mInvActualScale, getTitleHeight(),
+ mSelectX, mSelectY, mExtendSelection);
}
} else if (drawCursorRing) {
if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
@@ -4065,6 +4065,9 @@ public class WebView extends AbsoluteLayout
return true;
}
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ if (mShiftIsPressed) {
+ return true; // discard press if copy in progress
+ }
mTrackballDown = true;
if (mNativeClass == 0) {
return false;
@@ -4093,6 +4096,7 @@ public class WebView extends AbsoluteLayout
} else {
mExtendSelection = true;
}
+ return true; // discard press if copy in progress
}
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "onTrackballEvent up ev=" + ev
@@ -5600,8 +5604,8 @@ public class WebView extends AbsoluteLayout
private native void nativeDestroy();
private native void nativeDrawCursorRing(Canvas content);
private native void nativeDrawMatches(Canvas canvas);
- private native void nativeDrawSelection(Canvas content
- , int x, int y, boolean extendSelection);
+ private native void nativeDrawSelection(Canvas content, float scale,
+ int offset, int x, int y, boolean extendSelection);
private native void nativeDrawSelectionRegion(Canvas content);
private native void nativeDumpDisplayTree(String urlOrNull);
private native int nativeFindAll(String findLower, String findUpper);
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 2b3d076..cc39dac 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -438,6 +438,7 @@ void Context::setVertex(ProgramVertex *pv)
} else {
mVertex.set(pv);
}
+ mVertex->forceDirty();
}
void Context::assignName(ObjectBase *obj, const char *name, uint32_t len)
diff --git a/libs/rs/rsProgram.h b/libs/rs/rsProgram.h
index 26b78dd..57c654f 100644
--- a/libs/rs/rsProgram.h
+++ b/libs/rs/rsProgram.h
@@ -44,6 +44,10 @@ protected:
ObjectBaseRef<Allocation> mConstants;
mutable bool mDirty;
+
+
+public:
+ void forceDirty() {mDirty = true;}
};
diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java
index fe761ea..59e9832 100644
--- a/services/java/com/android/server/status/StatusBarService.java
+++ b/services/java/com/android/server/status/StatusBarService.java
@@ -140,7 +140,7 @@ public class StatusBarService extends IStatusBar.Stub
boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
- if (down) {
+ if (!down) {
StatusBarService.this.deactivate();
}
return true;
@@ -973,15 +973,24 @@ public class StatusBarService extends IStatusBar.Stub
}
void animateCollapse() {
- if (SPEW) Log.d(TAG, "Animate collapse: expanded=" + mExpanded
- + " expanded visible=" + mExpandedVisible);
+ if (SPEW) {
+ Log.d(TAG, "animateCollapse(): mExpanded=" + mExpanded
+ + " mExpandedVisible=" + mExpandedVisible
+ + " mAnimating=" + mAnimating
+ + " mAnimVel=" + mAnimVel);
+ }
if (!mExpandedVisible) {
return;
}
- prepareTracking(mDisplay.getHeight()-1);
- performFling(mDisplay.getHeight()-1, -2000.0f, true);
+ if (mAnimating) {
+ return;
+ }
+
+ int y = mDisplay.getHeight()-1;
+ prepareTracking(y);
+ performFling(y, -2000.0f, true);
}
void performExpand() {
@@ -1096,7 +1105,7 @@ public class StatusBarService extends IStatusBar.Stub
mTracking = true;
mVelocityTracker = VelocityTracker.obtain();
boolean opening = !mExpanded;
- if (!mExpanded) {
+ if (opening) {
mAnimAccel = 2000.0f;
mAnimVel = 200;
mAnimY = mStatusBarView.getHeight();
@@ -1111,16 +1120,13 @@ public class StatusBarService extends IStatusBar.Stub
mAnimating = true;
mHandler.sendMessageAtTime(mHandler.obtainMessage(MSG_ANIMATE_REVEAL),
mCurAnimationTime);
+ makeExpandedVisible();
} else {
// it's open, close it?
if (mAnimating) {
mAnimating = false;
mHandler.removeMessages(MSG_ANIMATE);
}
- }
- if (opening) {
- makeExpandedVisible();
- } else {
updateExpandedViewPos(y + mViewDelta);
}
}
@@ -1547,7 +1553,7 @@ public class StatusBarService extends IStatusBar.Stub
void updateExpandedViewPos(int expandedPosition) {
if (SPEW) {
- Log.d(TAG, "updateExpandedViewPos before pos=" + expandedPosition
+ Log.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
+ " mTrackingParams.y=" + mTrackingParams.y
+ " mTrackingPosition=" + mTrackingPosition);
}