summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/java/com/android/server/wm/ScreenRotationAnimation.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index 35503d3..4e4f851 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -62,6 +62,7 @@ class ScreenRotationAnimation {
public ScreenRotationAnimation(Context context, SurfaceSession session,
boolean inTransaction, int originalWidth, int originalHeight, int originalRotation) {
+ boolean isTegra = android.os.SystemProperties.get("ro.board.platform","").equals("tegra");
mContext = context;
// Screenshot does NOT include rotation!
@@ -99,7 +100,7 @@ class ScreenRotationAnimation {
try {
try {
mSurface = new Surface(session, 0, "FreezeSurface",
- -1, mWidth, mHeight, PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
+ -1, mWidth, mHeight, PixelFormat.OPAQUE, isTegra ? 0 : (Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN));
if (mSurface == null || !mSurface.isValid()) {
// Screenshot failed, punt.
mSurface = null;
@@ -116,6 +117,35 @@ class ScreenRotationAnimation {
" FREEZE " + mSurface + ": CREATE");
setRotation(originalRotation);
+
+ if (isTegra) {
+ Rect rect = new Rect(0, 0, mWidth, mHeight);
+ Canvas canvas = null;
+
+ try {
+ canvas = mSurface.lockCanvas(rect);
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Unable to lock surface", e);
+ } catch (Surface.OutOfResourcesException e) {
+ Slog.w(TAG, "Unable to lock surface", e);
+ }
+
+ Bitmap screenshot = Surface.screenshot(0, 0);
+ if (canvas == null || screenshot == null) {
+ Slog.w(TAG, "Null surface canvas");
+ mSurface.destroy();
+ mSurface = null;
+ return;
+ }
+
+ Paint paint = new Paint(0);
+ paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
+
+ canvas.drawBitmap(screenshot, 0, 0, paint);
+ mSurface.unlockCanvasAndPost(canvas);
+
+ }
+
} finally {
if (!inTransaction) {
Surface.closeTransaction();