From 090e1b13f8b31363dd95ddddb6302bc3ee2fb700 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Mon, 5 Mar 2018 22:30:48 +0100 Subject: [PATCH 01/11] Add basic Engineering mode. - Insight plugin disabled unless EM enabled - Closed loop constrainted unless EM enabled. --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 8 +++++++- .../plugins/ConstraintsSafety/SafetyPlugin.java | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 412383c6e1..5599e26a68 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -20,6 +20,7 @@ import net.danlew.android.joda.JodaTimeAndroid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.util.ArrayList; import info.nightscout.androidaps.Services.Intents; @@ -95,6 +96,9 @@ public class MainApp extends Application { private static AckAlarmReceiver ackAlarmReciever = new AckAlarmReceiver(); private LocalBroadcastManager lbm; + public static boolean devBranch; + public static boolean engineeringMode; + @Override public void onCreate() { super.onCreate(); @@ -139,7 +143,7 @@ public class MainApp extends Application { if (Config.DANAR) pluginsList.add(DanaRv2Plugin.getPlugin()); if (Config.DANAR) pluginsList.add(DanaRSPlugin.getPlugin()); pluginsList.add(CareportalPlugin.getPlugin()); - // if (Config.DANAR) pluginsList.add(InsightPumpPlugin.getPlugin()); // <-- Enable Insight plugin here + if (Config.DANAR && engineeringMode) pluginsList.add(InsightPumpPlugin.getPlugin()); // <-- Enable Insight plugin here if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin()); if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin()); if (Config.APS) pluginsList.add(LoopPlugin.getPlugin()); @@ -195,6 +199,8 @@ public class MainApp extends Application { } }).start(); + engineeringMode = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode").canRead(); + devBranch = BuildConfig.VERSION.contains("dev"); } private void registerLocalBroadcastReceiver() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java index ef30a0ebb9..37000f345c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java @@ -102,6 +102,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface { **/ @Override public boolean isClosedModeEnabled() { + if (MainApp.devBranch && !MainApp.engineeringMode) return false; String mode = SP.getString("aps_mode", "open"); return mode.equals("closed") && BuildConfig.CLOSEDLOOP; } From 637b0c6189bdccab5ae8afca88de9582bb5618c2 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 10 Mar 2018 09:58:47 +0100 Subject: [PATCH 02/11] On start, show notification if on dev-branch, but not EM, so CL is disabled. --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 7 +++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 5599e26a68..8b85b5ecab 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -47,6 +47,8 @@ import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin; import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin; import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; +import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; +import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin; import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; @@ -201,6 +203,11 @@ public class MainApp extends Application { engineeringMode = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode").canRead(); devBranch = BuildConfig.VERSION.contains("dev"); + + if (devBranch && !engineeringMode) { + Notification n = new Notification(Notification.TOAST_ALARM, gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL); + bus().post(new EventNewNotification(n)); + } } private void registerLocalBroadcastReceiver() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3e923bf821..e9bb24c95f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -969,5 +969,6 @@ Fabric Upload Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service. Please update your G5 app to supported version + Running dev version. Closed loop is disabled From a398d95bb4a232140e6dd95e39f13cb0aaf5dba8 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Mon, 12 Mar 2018 23:03:14 +0100 Subject: [PATCH 03/11] Add info to About dialog when engineering mode is enabled. --- app/src/main/java/info/nightscout/androidaps/MainActivity.java | 2 ++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java index 91446ada32..ef4908a9f1 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java @@ -396,6 +396,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe builder.setIcon(R.mipmap.blueowl); String message = "Build: " + BuildConfig.BUILDVERSION + "\n"; message += MainApp.sResources.getString(R.string.configbuilder_nightscoutversion_label) + " " + ConfigBuilderPlugin.nightscoutVersionName; + if (MainApp.engineeringMode) + message += MainApp.gs(R.string.engineering_mode_enabled); builder.setMessage(message); builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); AlertDialog alertDialog = builder.create(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e9bb24c95f..fd190bf531 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -970,5 +970,6 @@ Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service. Please update your G5 app to supported version Running dev version. Closed loop is disabled + Engineering mode enabled From 39aae28101ea7e679211bacbcd25f57abe228349 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Thu, 15 Mar 2018 21:51:43 +0100 Subject: [PATCH 04/11] Disable profile switch if not in Engineering mode and on dev branch --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 8 +++++++- .../androidaps/plugins/Actions/ActionsFragment.java | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 7db2bbb739..711261ca36 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -201,7 +201,9 @@ public class MainApp extends Application { } }).start(); - engineeringMode = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode").canRead(); + File engineeringModeSemaphore = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode"); + + engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile(); devBranch = BuildConfig.VERSION.contains("dev"); if (devBranch && !engineeringMode) { @@ -374,6 +376,10 @@ public class MainApp extends Application { return null; } + public static boolean isDevModeOrRelease() { + return (devBranch && engineeringMode) || !devBranch; + } + @Override public void onTerminate() { super.onTerminate(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index 0edf29c1e4..08e0ae96d1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -127,7 +127,10 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL return; } final PumpInterface pump = ConfigBuilderPlugin.getActivePump(); - if (!pump.getPumpDescription().isSetBasalProfileCapable || !pump.isInitialized() || pump.isSuspended()) + final boolean basalprofileEnabled = MainApp.isDevModeOrRelease() + && pump.getPumpDescription().isSetBasalProfileCapable; + + if (!basalprofileEnabled || !pump.isInitialized() || pump.isSuspended()) profileSwitch.setVisibility(View.GONE); else profileSwitch.setVisibility(View.VISIBLE); From 2c3f28670c3a43c939b44a8fa156fc2459484087 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Thu, 15 Mar 2018 23:00:08 +0100 Subject: [PATCH 05/11] Disallow profile store on pump if on dev branch but not in engineering mode --- .../androidaps/plugins/Actions/ActionsFragment.java | 1 - .../plugins/Overview/notifications/Notification.java | 1 + .../info/nightscout/androidaps/queue/CommandQueue.java | 8 ++++++++ app/src/main/res/values/strings.xml | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index 08e0ae96d1..12c24b1595 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -135,7 +135,6 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL else profileSwitch.setVisibility(View.VISIBLE); - if (!pump.getPumpDescription().isExtendedBolusCapable || !pump.isInitialized() || pump.isSuspended() || pump.isFakingTempsByExtendedBoluses()) { extendedBolus.setVisibility(View.GONE); extendedBolusCancel.setVisibility(View.GONE); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java index 7f8b94cfa9..38d54bc6fd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java @@ -59,6 +59,7 @@ public class Notification { public static final int MINIMAL_BASAL_VALUE_REPLACED = 29; public static final int BASAL_PROFILE_NOT_ALIGNED_TO_HOURS = 30; public static final int ZERO_VALUE_IN_PROFILE = 31; + public static final int NOT_ENG_MODE_OR_RELEASE = 32; public int id; public Date date; diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index b41a1727b3..3977178e73 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -293,6 +293,14 @@ public class CommandQueue { return false; } + if (!MainApp.isDevModeOrRelease()) { + Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.sResources.getString(R.string.not_eng_mode_or_release), Notification.URGENT); + MainApp.bus().post(new EventNewNotification(notification)); + if (callback != null) + callback.result(new PumpEnactResult().success(false).comment(MainApp.sResources.getString(R.string.not_eng_mode_or_release))).run(); + return false; + } + // Compare with pump limits Profile.BasalValue[] basalValues = profile.getBasalValues(); PumpInterface pump = ConfigBuilderPlugin.getActivePump(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7097b5879d..06f61ac006 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -971,7 +971,6 @@ Fabric Upload Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service. Please update your G5 app to supported version - Suspend for 30 min Start Activity TT Start Eating soon TT @@ -984,5 +983,6 @@ ns_autobackfill Running dev version. Closed loop is disabled Engineering mode enabled + Engineering mode not enabled and not on release branch From 72e8e5fd052b8523773de338a5bafb2dce62db0c Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sat, 17 Mar 2018 21:14:01 +0100 Subject: [PATCH 06/11] Determine directory from logback --- app/src/main/assets/logback.xml | 2 +- app/src/main/java/info/nightscout/androidaps/MainApp.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/assets/logback.xml b/app/src/main/assets/logback.xml index 97e09b3e4d..d6facdb7dd 100644 --- a/app/src/main/assets/logback.xml +++ b/app/src/main/assets/logback.xml @@ -1,6 +1,6 @@ - + ${EXT_FILES_DIR}/AndroidAPS.log diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 711261ca36..455c599c35 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.ArrayList; +import ch.qos.logback.classic.LoggerContext; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.interfaces.InsulinInterface; @@ -201,7 +202,9 @@ public class MainApp extends Application { } }).start(); - File engineeringModeSemaphore = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode"); + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + String extFilesDir = lc.getProperty("EXT_FILES_DIR"); + File engineeringModeSemaphore = new File(extFilesDir,"engineering_mode"); engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile(); devBranch = BuildConfig.VERSION.contains("dev"); From 0d4e8772a9a719f6495cc058ee485918bd019e17 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sat, 17 Mar 2018 21:23:45 +0100 Subject: [PATCH 07/11] Cleanup boolean algrabra, add method for environment retrieval from logcontexxt --- .../main/java/info/nightscout/androidaps/MainApp.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 455c599c35..d6d18576e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -202,8 +202,7 @@ public class MainApp extends Application { } }).start(); - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - String extFilesDir = lc.getProperty("EXT_FILES_DIR"); + String extFilesDir = this.getLogDirectory(); File engineeringModeSemaphore = new File(extFilesDir,"engineering_mode"); engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile(); @@ -380,7 +379,12 @@ public class MainApp extends Application { } public static boolean isDevModeOrRelease() { - return (devBranch && engineeringMode) || !devBranch; + return engineeringMode || !devBranch; + } + + private String getLogDirectory() { + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + return lc.getProperty("EXT_FILES_DIR"); } @Override From c6e8ab35b649b3163f263cc69892aa53b38e5f91 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sat, 17 Mar 2018 21:35:16 +0100 Subject: [PATCH 08/11] Fix boolean stuff in accordance to code review with adrian --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 2 +- .../androidaps/plugins/ConstraintsSafety/SafetyPlugin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index d6d18576e5..620d26bd8a 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -208,7 +208,7 @@ public class MainApp extends Application { engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile(); devBranch = BuildConfig.VERSION.contains("dev"); - if (devBranch && !engineeringMode) { + if (!isDevModeOrRelease()) { Notification n = new Notification(Notification.TOAST_ALARM, gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL); bus().post(new EventNewNotification(n)); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java index 37000f345c..7686d76cc9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java @@ -102,7 +102,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface { **/ @Override public boolean isClosedModeEnabled() { - if (MainApp.devBranch && !MainApp.engineeringMode) return false; + if (!MainApp.isDevModeOrRelease()) return false; String mode = SP.getString("aps_mode", "open"); return mode.equals("closed") && BuildConfig.CLOSEDLOOP; } From 18521d66341234df2cc9ebd134874664a22b8792 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sat, 17 Mar 2018 21:48:58 +0100 Subject: [PATCH 09/11] Unit tests are always in engmode --- .../java/info/nightscout/androidaps/queue/CommandQueueTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java index 31d8636de2..ec9bd6ab08 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java @@ -115,6 +115,7 @@ public class CommandQueueTest extends CommandQueue { PowerMockito.mockStatic(MainApp.class); MainApp mainApp = mock(MainApp.class); when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin); + when(MainApp.isDevModeOrRelease()).thenReturn(true); when(MainApp.instance()).thenReturn(mainApp); PowerMockito.mockStatic(ToastUtils.class); From f0bec534fa1386ca00060e5878eff7930ecb8ece Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sun, 18 Mar 2018 17:38:05 +0100 Subject: [PATCH 10/11] Rename method to reflect jomoto code review --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 4 ++-- .../androidaps/plugins/Actions/ActionsFragment.java | 2 +- .../androidaps/plugins/ConstraintsSafety/SafetyPlugin.java | 2 +- .../java/info/nightscout/androidaps/queue/CommandQueue.java | 2 +- .../info/nightscout/androidaps/queue/CommandQueueTest.java | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 620d26bd8a..d9473b3575 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -208,7 +208,7 @@ public class MainApp extends Application { engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile(); devBranch = BuildConfig.VERSION.contains("dev"); - if (!isDevModeOrRelease()) { + if (!isEngineeringModeOrRelease()) { Notification n = new Notification(Notification.TOAST_ALARM, gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL); bus().post(new EventNewNotification(n)); } @@ -378,7 +378,7 @@ public class MainApp extends Application { return null; } - public static boolean isDevModeOrRelease() { + public static boolean isEngineeringModeOrRelease() { return engineeringMode || !devBranch; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index 12c24b1595..8bc79e3ddc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -127,7 +127,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL return; } final PumpInterface pump = ConfigBuilderPlugin.getActivePump(); - final boolean basalprofileEnabled = MainApp.isDevModeOrRelease() + final boolean basalprofileEnabled = MainApp.isEngineeringModeOrRelease() && pump.getPumpDescription().isSetBasalProfileCapable; if (!basalprofileEnabled || !pump.isInitialized() || pump.isSuspended()) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java index 7686d76cc9..41a7c1eb00 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java @@ -102,7 +102,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface { **/ @Override public boolean isClosedModeEnabled() { - if (!MainApp.isDevModeOrRelease()) return false; + if (!MainApp.isEngineeringModeOrRelease()) return false; String mode = SP.getString("aps_mode", "open"); return mode.equals("closed") && BuildConfig.CLOSEDLOOP; } diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index b3feea3751..a254855cab 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -293,7 +293,7 @@ public class CommandQueue { return false; } - if (!MainApp.isDevModeOrRelease()) { + if (!MainApp.isEngineeringModeOrRelease()) { Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.sResources.getString(R.string.not_eng_mode_or_release), Notification.URGENT); MainApp.bus().post(new EventNewNotification(notification)); if (callback != null) diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java index ec9bd6ab08..f7064c80a8 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.java @@ -1,7 +1,6 @@ package info.nightscout.androidaps.queue; import android.content.Context; -import android.text.Html; import com.squareup.otto.Bus; import com.squareup.otto.ThreadEnforcer; @@ -115,7 +114,7 @@ public class CommandQueueTest extends CommandQueue { PowerMockito.mockStatic(MainApp.class); MainApp mainApp = mock(MainApp.class); when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin); - when(MainApp.isDevModeOrRelease()).thenReturn(true); + when(MainApp.isEngineeringModeOrRelease()).thenReturn(true); when(MainApp.instance()).thenReturn(mainApp); PowerMockito.mockStatic(ToastUtils.class); From 8b7b68003b496442d3ff69d75f11203f58afd35f Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sun, 18 Mar 2018 17:39:55 +0100 Subject: [PATCH 11/11] prepend line feed like suggested on jamoto code review --- app/src/main/java/info/nightscout/androidaps/MainActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java index 13309fb56c..4a02bda1ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java @@ -401,7 +401,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe String message = "Build: " + BuildConfig.BUILDVERSION + "\n"; message += MainApp.sResources.getString(R.string.configbuilder_nightscoutversion_label) + " " + ConfigBuilderPlugin.nightscoutVersionName; if (MainApp.engineeringMode) - message += MainApp.gs(R.string.engineering_mode_enabled); + message += "\n" + MainApp.gs(R.string.engineering_mode_enabled); builder.setMessage(message); builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); AlertDialog alertDialog = builder.create();