From 390e02b6a3351b9ff2b0233f52aaf972b16bd0fb Mon Sep 17 00:00:00 2001 From: Yuriy Zabroda Date: Thu, 5 Apr 2012 10:53:13 +0300 Subject: [PATCH] Properly handle quick switch between Home button and Gallery app This change fixes the following bug: 1. Playing a movie (especially Full HD) by Gallery. 2. Press the Home button. 3. Press the Gallery shortcut on Launcher. 4. Very quickly repeat #2 and #3 several times. Result: "Sorry, this video cannot be played" alert is shown. Change-Id: Idf9d222ca1e0bb90bfe06f6dc807dfbc71b6415b Signed-off-by: Yuriy Zabroda --- core/java/android/view/SurfaceView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index fd302dc5b359c..ed4c75cdb4521 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -531,7 +531,7 @@ public class SurfaceView extends View { mSurface.transferFrom(mNewSurface); - if (visible) { + if (visible && mSurface.isValid()) { if (!mSurfaceCreated && (surfaceChanged || visibleChanged)) { mSurfaceCreated = true; mIsCreating = true;