From 1459e89ea540e757a7d4308fb3e18c4363db31a5 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 5 Nov 2020 12:56:12 +0100 Subject: [PATCH] Catch OOM on ROOM compute call --- app/src/main/java/androidx/room/RoomTrackingLiveData.java | 2 +- patches/RoomTrackingLiveData.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/androidx/room/RoomTrackingLiveData.java b/app/src/main/java/androidx/room/RoomTrackingLiveData.java index 875beba9bc..7a013c4b2b 100644 --- a/app/src/main/java/androidx/room/RoomTrackingLiveData.java +++ b/app/src/main/java/androidx/room/RoomTrackingLiveData.java @@ -92,7 +92,7 @@ class RoomTrackingLiveData extends LiveData { try { value = mComputeFunction.call(); done = true; - } catch (Exception e) { + } catch (Throwable e) { if (++retry > 10) throw new RuntimeException( "Exception while computing database live data.", e); diff --git a/patches/RoomTrackingLiveData.patch b/patches/RoomTrackingLiveData.patch index bc1729bde9..1154fb7299 100644 --- a/patches/RoomTrackingLiveData.patch +++ b/patches/RoomTrackingLiveData.patch @@ -15,7 +15,7 @@ + try { + value = mComputeFunction.call(); + done = true; -+ } catch (Exception e) { ++ } catch (Throwable e) { + if (++retry > 10) + throw new RuntimeException( + "Exception while computing database live data.", e);