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
This commit is contained in:
committed by
Johan Redestig
parent
5580e44c25
commit
19f22745aa
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user