summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Petersson <mattias.petersson@sonyericsson.com>2010-11-05 08:25:38 +0100
committerJohan Redestig <johan.redestig@sonyericsson.com>2010-11-05 08:27:14 +0100
commit19f22745aa0fa2344850bac3234460add9d94c4e (patch)
tree3aac17405a8de21d0dd34efda3cfbad77e1e9d84
parent5580e44c250944f5cd011b2682eea5cc2de9706c (diff)
downloadbase-19f22745aa0fa2344850bac3234460add9d94c4e.tar.gz
Prevent system crash when OOM in Binder thread.
When handling large images during an update of a widget, we can run out of memory in the Binder thread. This will cause an OutOfMemoryError to be thrown. When an Error is thrown in the Binder thread, the entire system will crash. This was fixed by catching this OutOfMemoryError and instead throw a RuntimeException to keep the system alive. Change-Id: If27199676c6f8aef23fb249be1197ca5dfe0fe99
-rw-r--r--core/java/android/os/Binder.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index c9df5671ddf2..1db8f68e11c7 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -292,6 +292,10 @@ public class Binder implements IBinder {
} catch (RuntimeException e) {
reply.writeException(e);
res = true;
+ } catch (OutOfMemoryError e) {
+ RuntimeException re = new RuntimeException("Out of memory", e);
+ reply.writeException(re);
+ res = true;
}
reply.recycle();
data.recycle();