diff --git a/app/build.gradle b/app/build.gradle
index 6d781a8962..b5e47ec4ae 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -308,6 +308,9 @@ dependencies {
implementation "com.squareup.retrofit2:adapter-rxjava2:2.6.2"
implementation "com.squareup.retrofit2:converter-gson:2.6.2"
+ // Phone checker
+ implementation 'com.scottyab:rootbeer-lib:0.0.7'
+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.3.0-alpha03'
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt
new file mode 100644
index 0000000000..7dbb642f45
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt
@@ -0,0 +1,35 @@
+package info.nightscout.androidaps.plugins.constraints.phoneChecker
+
+import android.os.Build
+import com.scottyab.rootbeer.RootBeer
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.interfaces.ConstraintsInterface
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
+
+object PhoneCheckerPlugin : PluginBase(PluginDescription()
+ .mainType(PluginType.CONSTRAINTS)
+ .neverVisible(true)
+ .alwaysEnabled(true)
+ .showInList(false)
+ .pluginName(R.string.phonechecker)
+), ConstraintsInterface {
+
+ var phoneRooted: Boolean = false
+ var devMode: Boolean = false
+ val phoneModel: String = Build.MODEL
+ val manufacturer: String = Build.MANUFACTURER
+
+ private fun isDevModeEnabled(): Boolean {
+ return android.provider.Settings.Secure.getInt(MainApp.instance().contentResolver,
+ android.provider.Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
+ }
+
+ override fun onStart() {
+ super.onStart()
+ phoneRooted = RootBeer(MainApp.instance()).isRootedWithoutBusyBoxCheck()
+ devMode = isDevModeEnabled()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4de153a543..9bd5ae7254 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1690,5 +1690,6 @@
Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it?
Closed loop disabled because of running Extended bolus
EB
+ \"PhoneChecker\"