summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-12-13 16:28:46 -0800
committerDianne Hackborn <hackbod@google.com>2010-12-13 20:41:17 -0800
commitd2835935d2df8be70d1b37d3ef3b2fe0155b3422 (patch)
tree77bbfae9a915bee48067b25774efe9cfdb9375e4 /core/jni
parent32f4ab457d9f79251413357b75b7a233068a892c (diff)
downloadframeworks_base-d2835935d2df8be70d1b37d3ef3b2fe0155b3422.zip
frameworks_base-d2835935d2df8be70d1b37d3ef3b2fe0155b3422.tar.gz
frameworks_base-d2835935d2df8be70d1b37d3ef3b2fe0155b3422.tar.bz2
Fix issue #3258849: Grab thumbnail when exiting an app via back
Also issue #3281400: Rotating a retained instance fragment leaks the fragment manager And turn off fragment debug logging. Change-Id: Ibdd7db82bb35618021bcba421ba92ced7cd691c2
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_view_Surface.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 206e320..8c30987 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -449,9 +449,11 @@ public:
SkSafeUnref(fCTable);
}
- status_t update(int width, int height) {
+ status_t update(int width, int height, int minLayer, int maxLayer, bool allLayers) {
status_t res = (width > 0 && height > 0)
- ? mScreenshot.update(width, height)
+ ? (allLayers
+ ? mScreenshot.update(width, height)
+ : mScreenshot.update(width, height, minLayer, maxLayer))
: mScreenshot.update();
if (res != NO_ERROR) {
return res;
@@ -493,10 +495,11 @@ private:
typedef SkPixelRef INHERITED;
};
-static jobject Surface_screenshot(JNIEnv* env, jobject clazz, jint width, jint height)
+static jobject doScreenshot(JNIEnv* env, jobject clazz, jint width, jint height,
+ jint minLayer, jint maxLayer, bool allLayers)
{
ScreenshotPixelRef* pixels = new ScreenshotPixelRef(NULL);
- if (pixels->update(width, height) != NO_ERROR) {
+ if (pixels->update(width, height, minLayer, maxLayer, allLayers) != NO_ERROR) {
delete pixels;
return 0;
}
@@ -525,6 +528,17 @@ static jobject Surface_screenshot(JNIEnv* env, jobject clazz, jint width, jint h
return GraphicsJNI::createBitmap(env, bitmap, false, NULL);
}
+static jobject Surface_screenshotAll(JNIEnv* env, jobject clazz, jint width, jint height)
+{
+ return doScreenshot(env, clazz, width, height, 0, 0, true);
+}
+
+static jobject Surface_screenshot(JNIEnv* env, jobject clazz, jint width, jint height,
+ jint minLayer, jint maxLayer, bool allLayers)
+{
+ return doScreenshot(env, clazz, width, height, minLayer, maxLayer, false);
+}
+
static void Surface_setLayer(
JNIEnv* env, jobject clazz, jint zorder)
{
@@ -750,7 +764,8 @@ static JNINativeMethod gSurfaceMethods[] = {
{"setOrientation", "(III)V", (void*)Surface_setOrientation },
{"freezeDisplay", "(I)V", (void*)Surface_freezeDisplay },
{"unfreezeDisplay", "(I)V", (void*)Surface_unfreezeDisplay },
- {"screenshot", "(II)Landroid/graphics/Bitmap;", (void*)Surface_screenshot },
+ {"screenshot", "(II)Landroid/graphics/Bitmap;", (void*)Surface_screenshotAll },
+ {"screenshot", "(IIII)Landroid/graphics/Bitmap;", (void*)Surface_screenshot },
{"setLayer", "(I)V", (void*)Surface_setLayer },
{"setPosition", "(II)V",(void*)Surface_setPosition },
{"setSize", "(II)V",(void*)Surface_setSize },