From 8ca38438602c8addcbce91167d467e6da0ba962b Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 13 Oct 2020 22:39:41 +0300 Subject: [PATCH] fixed a hard to reproduce crash upon returning to the app to reproduce, set the background process limit in the developer options to "1" --- app/src/main/java/net/ktnx/mobileledger/model/Data.java | 5 +++++ .../net/ktnx/mobileledger/ui/activity/SplashActivity.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/model/Data.java b/app/src/main/java/net/ktnx/mobileledger/model/Data.java index f0ba846e..f0f39877 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/Data.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/Data.java @@ -91,6 +91,10 @@ public final class Data { backgroundTasksRunning.postValue(cnt > 0); } public static void setCurrentProfile(@NonNull MobileLedgerProfile newProfile) { + MLDB.setOption(MLDB.OPT_PROFILE_UUID, newProfile.getUuid()); + profile.setValue(newProfile); + } + public static void postCurrentProfile(@NonNull MobileLedgerProfile newProfile) { MLDB.setOption(MLDB.OPT_PROFILE_UUID, newProfile.getUuid()); profile.postValue(newProfile); } @@ -200,6 +204,7 @@ public final class Data { MobileLedgerProfile startupProfile = getProfile(profileUUID); if (startupProfile != null) setCurrentProfile(startupProfile); + Logger.debug("profile", "initProfile() returning " + startupProfile); return startupProfile; } diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java index c1bb4d32..4205c80b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java @@ -105,7 +105,7 @@ public class SplashActivity extends CrashReportingActivity { String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null); MobileLedgerProfile startupProfile = Data.getProfile(profileUUID); if (startupProfile != null) - Data.setCurrentProfile(startupProfile); + Data.postCurrentProfile(startupProfile); return null; } @Override -- 2.39.2