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);