Puntnomads

How I prevented myself side-loading Android apps

June 03, 2019

I wanted to stop wasting time on the internet watching tv shows. I needed a website blocker like SelfControl that I use on my mac but there is no equivalent on Android. Therefore I turned to Android app blockers.

Stay Focused is a really good app blocker because the premium version has strict mode that prevents me from uninstalling the app or changing the settings until the next day. I can block browsers to prevent visiting time wasting websites. I can block the play store to prevent installling new browsers. Stay Focused also has a screen time feature, enabling me to set limits on my phone usage.

However, I could always install browser apps by downloading the apk and install them using ADB. I needed a way to prevent this. I looked for Android apps that disabled ADB on the phone but I couldn’t find any. I decided to create my own. For an Android app to turn ADB off it needs to be a system app and that requires a custom rom.

Custom roms was a painful experience for me. A lot of the roms off the internet for my phone had issues and me going on holiday had complicated things. I used a broken rom on my 2 weeks holiday that would restart if I picked up a call. Had to make excuses to a lot of relatives. After the holiday, I managed to get a stable rom and that was Resurrection Remix.

Building the app was straightforward as it was a matter of toggling a boolean. A service turns off adb every 3 seconds to counteract any user action. When the service is turned off, adb is turned on again. I decided to write it in Kotlin as that is much nicer to use for Android developent than Java. I named the app ADBToggle and used it to disable ADB and Stay Focused blocks ADBToggle.

ADBToggle UI
Basic UI as I am the only user!

You can find the complete code for this post in the following Github repository.


Zakariya Moallin

Personal blog by Zakariya Moallin.