From 4b181b4517fad106ab1ffbdab01adac9cf8e4bee Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 21 May 2014 18:39:56 +1000 Subject: [PATCH] Fix android black screen crash Change-Id: I7a0eb121ff151b8b6e8f824ee8dbab8d99b73499 --- android/src/org/rockbox/RockboxActivity.java | 1 + android/src/org/rockbox/RockboxFramebuffer.java | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/android/src/org/rockbox/RockboxActivity.java b/android/src/org/rockbox/RockboxActivity.java index a6604418ed..8004046c1b 100644 --- a/android/src/org/rockbox/RockboxActivity.java +++ b/android/src/org/rockbox/RockboxActivity.java @@ -111,6 +111,7 @@ public class RockboxActivity extends Activity { super.onResume(); setVisible(true); + setServiceActivity(true); } /* this is also called when the backlight goes off, diff --git a/android/src/org/rockbox/RockboxFramebuffer.java b/android/src/org/rockbox/RockboxFramebuffer.java index 405a771274..9c4c6a5dc3 100644 --- a/android/src/org/rockbox/RockboxFramebuffer.java +++ b/android/src/org/rockbox/RockboxFramebuffer.java @@ -61,6 +61,9 @@ public class RockboxFramebuffer extends SurfaceView { SurfaceHolder holder = getHolder(); Canvas c = holder.lockCanvas(); + if (c == null) + return; + btm.copyPixelsFromBuffer(framebuffer); synchronized (holder) { /* draw */ @@ -73,6 +76,10 @@ public class RockboxFramebuffer extends SurfaceView { SurfaceHolder holder = getHolder(); Canvas c = holder.lockCanvas(dirty); + + if (c == null) + return; + /* can't copy a partial buffer, but it doesn't make a noticeable difference anyway */ btm.copyPixelsFromBuffer(framebuffer); synchronized (holder)