pylapp

android

A little story about an insignificant Android app: birth, growth and death sentence

🇺🇸 – Monday, September, 21st 2020

Mots clés : #Android, #GooglePlay, #root, #clicker, #app

How a simple app I forged was used and hacked by users before being kicked by Google without warning.

Few years ago when I was an impetuous-padawan-developer I discovered useless but must-have apps to waste time like Cookie Clicker and Woy !. The aim of Cookie Clicker was simple: tap on the screen to get more cookies. Woy ! was an app created by colleagues which helped to define notifications (useful or dumb) to send to contacts (but was removed from Google Play). Thus I started to work on an app which may help me to trigger a lot of clicks to these kinds of apps, during day and nights. Yes, I need to fill my week-ends and I wanted to spam my friend 😁.

The first issue I met was the open source license to use. 🐧

In fact I wanted to create a free project, and finally chose the MIT license. Much simpler and smaller than Apache 2.0, and didn’t want to use contaminative licences like GPL.I wasn’t yet an enough bearded linuxian. My mood was something like “use it, ant that’s it”

Text of MIT license

Next, the tools. 🛠️

Nothing original, created a repo on GitHub, listed the features I wanted to implement in a poor plain text file (too lazy to create at that time a Trello or Wekan account). I decided to upload the app on Google Play, my first baby project! I thought about alternative stores like F-Droid but decided to not use it ; youngster laziness (remember my baby-linuxian beard? I had only a moustache). First project, wanted to keep it simple.

Then, the tests. ✅

How could I ensure my software was enough stable for release? How could I ensure to find any regressions? So I decided to play with unit tests using JUnit and functional tests with Espresso and UI Automator. Nice choice! I was quite confident about the coverage of my tests (too much?), even if the core of the app was tricky to test with automated tools. I should had used TDD and clean code principles to make things cleaner and better. With hindsight I should have been more careful about the coverage of my sources (to ensure all cases have been properly tested).

Java-written functional test source code

After that, I tried to build an HTML doc using JavaDoc because I chose Java. ☕

Yes, I love comments, and Java was one of the two first programming languages I discovered, it has a special flavor for me. Maybe I wrote too much of comments in that project. But having a nice bunch of HTML pages is fun for me. The boring thing was more about the use of Java instead of Kotlin, but at that time Kotlin was not ready at all. JavaDoc was cool and quite efficient to have a quick look on the API.

Java source code sample of a click async task

First project, so first occasion to use fun third-party components. 🧱

For example I integrated a material arc menu, custom switch buttons, introduction screens, swipe selectors, and material seek bars. I tried to have a simple but nice UI. Time to get pleasure!

Then, the features. ⚙️

At that era, it was not possible for an app to make clicks outside itself ; thus no app was able to click on other components. However if the smartphone in use is rooted, let's party! A whole API is reachable, a lot of funny things can be done using a shell with sudo rights. With this low-level API all actions can be triggered, like clicks or swipes. It worked during a long time but it seems it will be the pretext for Google to use the shotgun. The use case was simple: define a list of points to tap on the screen, apply a configuration (duration of clicks, breaks between them, …), ask for sudo access and go. Simple, isn't it? The app allowed also to export configurations, use predefined scenarii and could be triggered from outside. A more curated list of features is in the README.

One of the cool part of this story was the unexpected third-party contributions, about translations. 🌍

Indeed like a naive developer I used dumbly Google Translate to translate my wording (in english and french) to other languages. In fact I saw thanks to the Play Store developer console a lot of users lived in plenty of countries, from Russia to Spain, Iran to Middle-East, Korea to South America. But the translations I integrated were awful. Users were complaining a lot about how bad it was ; the UI was not usable at all! I should had used only languages I was able to read, write and understand. DeepL was not launched. However a Russian and a German users some day send to me the translations in its mother language, and an Italian user made a pull request for new translations. Motivating! It was free, efficient and clear, thanks to these guys!

Very bad comment on Google Play Store about bad translations

The interesting thing was about the use of the app, and firstly the metrics I got. 📋

I saw there was a two-sided relationship between users and the app: love and hate. Reading the store stars, I had a big split with high stars numbers with the worst mark (1 star) and… the best (5 stars). But why? Why did I received such rude and offensive comments on a side, and enjoying and motivating comment on the other side?

App page review with 322 marks, an average rank to 3.0 and highest scores in 5 stars and 1 star.

It was because… I did not mentioned the app was for rooted device. Woops. Yes the promise was cool (click on everything!) but it was also fucking disappointing for users if the device was not capable. Thus I mentioned in CAPSLOCK in the title of the store page the app was for unleashed smartphones, and things were a bit better. saying in the description of the app was not enough.

Header of the app's page on Google Play Store with the icon, the name and screen shots.

Few months later, I asked search engines like Google and Duck Duck Go... 🦆

...to check if there were some contents about the app, like reviews, counterfeiting and videos about it. I was both kindly surprised and upset about the things I

In the hand I saw the app was available on third-party platforms, kinds of APK aggregators. I was upset: no consent was given to them to steal the app and provide it on foreign platforms. I checked also the content: I found some of the provided APK were compromised! Thank you guys, my project, my app, open sourced it, and you altered it to make I-don't-know-what operations. Sincerely, go fuck yourself. You deserve nothing, and because of you and the stupidity of some users (using blindly such tools) you give to Google too much points to say third-party stores are hazardous (even if Yalp and F-Droid are reliable!).

The other things I got, a more pleasant one, was some users hacked my app so as to use it for other things: get more followers on Instagram! From my point of view we should have the right to hack apps and use them for use cases we want, and that was pleasant to see people talking about Smooth Clicker on YouTube! It was not expected at all but it made my smile 😊. A review here and another here 😄.

However shit had finally come for my app: the Google head shot with a railgun. Painful and rough. 💥

Some day I received an email from Google whistling the end: “Hey guy, we found your app was violating our terms of uses, in fact you altered the state of the device and we disliked that. So, say goodbye to your project! Best regards ❤”. Holly crap. That was unexpected. I tried to have a look and the console but… nothing! Because the app has been blocked, every fucking thing has been hidden or disabled. Comments ? Nope. App reviews? Nope? Crash reports? Ahah, nope. Metrics about the devices of users? Stop dreaming, blocked.

Email of Google saying the app has been ssuspended because of rules 4.8 and 4.9 violations of Play Store terms of uses

Maybe I should have appealed. In fact my app did not changed the state of phones: it only triggered the sudo mode of rooted devices (but did not root them) and call ADB primitives to make clicks. Ok, the app had links in the settings page to help people to make their devices rooted using dedicated tools. But it's ok, be fair-play, it was a bit borderline 😛.

Java code which builds an ADB command and processes it in a SUDO processus

Even if I appealed it won't be very useful for me to get access to the app to make patches: in fact like a moron I formatted my laptop. Guess what was the file I forgot to save? The keystore file with keys to sign the APK 😒. In fact I had a backup, but a too old one. A full jackass. Credentials lost. Woops.

Later I saw my Git history was fucked up (in fact a certain amount of repositories I used were in a big mess). Heavy files commited (woops!), non-linear history, saved secrets, I was a newbie and also my personal email was used in commits. Bots found that and I received between 50 and 100 emails per day with scams. So, I decided to change my emails accounts and burn all my repositories. Fresh start, cleaner history, good base. Not smooth but I didn't care.

And so what?

Smooth Clicker was my first junior side project, and it was pleasant. Doc, tests, design patterns, open source, in production and hacked by people, between 50k and 100K downloads… it was incredible. The main feature with the Shell ADB commands was cool to implement, and I learned a lot. Good skills have been got and will be used in the future. I have a lot of regrets about the Google sentence: I would have liked to have a warning instead of such one-shot. But it's the game: I tried, and it not accepted. But it was a cool journey! I would liked to go further with the app but it's a sad fact: the 2.1.3 version (code name Juicy Jellyfish) will be the last.

Extract of app page saying there was between 50,000 and 100,000 downloads

Error message in Google Play saying the app is not available anymore

Dernière mise à jour : mercredi 9 février 2022 Précédemment sur Medium et paper.wf

Did you enjoy reading this blog? Give me a beer 🍺 or use something else ❤️‍🔥 Licensed under CC-BY-SA 4.0. Opinions are my own. To contact me, feel free to choose the most suitable medium for you, or for example Mastodon.

LineageOS = ❤ (a step by step guide)

🇺🇸 – Thursday, October, 10th 2019

Keywords: #LineageOS, #Cyanogen, #Android, #ROM, #AOSP

Protect your privacy, get rid of blobs with unknown-to-you behaviors, decrease the use of trackers, or keep your smartphone up-to-date to get security patches, or also postpone the replacing of your device by a newer one so as to be “greener”… there are plenty of reasons to move your smartphone from Android (stock)to LineageOS (born from the ashes of Cyanogen). Here you can find a small guide with steps to follow.

Of course, here are only the steps I follow for my 5-years-old OnePlus One. You have to be cautious with your device and the things you do on it. Some steps or files may differ from a version or device to another. I won’t be responsible of course if you break or “brick” your stuff (having a bootlooping smartphone is funny but that’s all). The steps are also compiled in this LineageOS dedicated page. More details are provided also in this wiki.

Moreover I did not try yet other altOS (alternative operating systems) like /e/, GrapheneOS or Replicant. Feel free to have a look on these projects!

You should keep in mind developers cannot do whatever they want about the apps they create and you use. In most of cases, making softwares working with “old” operating systems is always seen as a “massive cost” for chiefs and managers. Capitalism and mass market make things worse: tech giants are more focused on releasing new products than keeping the “old” up-to-date. So please, help and back free and open source projects and people who want to make things more sustainable.

Step 0: Get OS, Google apps (or not) & recovery

The first step consists on getting the binaries you have to flash (i.e. install) on your device.

➡️ One of these magic things is, of course, the operating system for your device. Go to the LineageOS download page and select your device model (for me, OnePlus One, a.k.a. “bacon”). In the selected page you may see a lot of “nightly” builds: these versions are created each night, so choosing the last is not the best idea (e.g. because of possible stability issues or unfixed bugs).

➡️️️ Another step is related to the Google applications you want to add to your device (or not). In fact in the Android ecosystem it is quite complicated to run an app, get updates or install things without any amount of Google apps (the “Gapps”). For example the Google Play Services are almost essential, and clean your device of them may prevent you to get some apps.

To choose the amount of “Google apps” you want, go to the OpenGapps project. Then choose the architecture of your device, the version of the Android OS embedded in your LineageOS ZIP and the variant. For example in my case, I can choose ARM, Android 9.0 and “pico”. In this case I have the bare minimum to get the Google Play functionality.

➡️ Another thing to download is a custom recovery. The recovery is a dedicated bootable partition with very few features like cleaning your data, change the file system or flash components. In fact it allows you to install on your device the LineageOS version you want. For instance you can choose a TWRP recovery from TeamWin. I got my file here.

➡️ Finally you should also download the Android SDK (i.e. “software development kit”). It brings a lot of tools you don’t have to care with, except adb and fastboot.This toolbox is really useful if you want to tinker with your toy. Have a look on this page to download the SDK (see the “Command line tools only” section).

Step 1: Unlock the developer mode

By default your device has its developer mode turned off. You have to enable it if you want to use adb and fastboot commands. So go to your settings, “about the phone” field, then tap many times on the “build” number. If you tapped enough, a message should warn you have enabled the mode. After this step, go back to the new “options for developers” menu which has appeared, and enable the USB debugging option. Finally, run the following command:

adb devices

It should display the list of attached devices, with the name in the right column (here for me “device” and on the left a word with digits and characters (like “2a926c99”)). Note that I use a Linux-powered computer… did I talk about privacy before? Things for macOS or Windows may be the same.

Step 2: Unlock the bootloader

The bootloader deals with the boot of your device (duh!) and loads the first programs to start. Depending to the device you use, it may be mandatory to unlock it. In fact some manufacturers lock them, so… change that. Unlocking your bootloader will allow you to change your recovery and change your OS. First, reboot your bootloader with:

adb reboot bootloader

Your device must restart in the fastboot mode, and display on the screen the “Fastboot mode” message. Note that adb and fastboot are available in the “platform-tools” folder of the SDK zip you got. Then unlock the bootloader with:

fastboot oem unlock

If it succeeded, it should display an “OKAY” message.Finally, install the recovery you got in Step 0, with:

fastboot boot RECOVERY_FILENAME.img

If it succeeded, it should display… another “OKAY” message :)

Step 3: Flash LineageOS and Gapps

The web site of LineageOS is clear enough, so you can follow their instructions (Installing LineageOS from recovery), I won’t make dumb copy/paste. They use here the sideload feature. The way I choose is using the memory of the device to store the ZIP files, and make the install from the recovery.

➡️ You have to boot your device in recovery mode and format the data of your device (caches, system and data for example). It will erase all files and data your device contains. The recovery mode can be triggered with a combination of pressed keys you have to press during several seconds until the device restart (for my bacon, it’s power + volume down buttons).
Then, upload in your device the ZIP of LineageOS and the ZIP for the Gapps you downloaded before in step 0. To do so, run:

adb push LINEAGE-ARCHIVE.zip /sdcard

adb push GAPPS-ARCHIVE.zip /sdcard

Then, from the recovery options, go to the “install” menu and choose the ZIP files you uploaded (first the system, then the Gapps). If the flashes succeeded, the device will restart to the new operating system you just freshly installed!

Step 4: Customize your device!

Once you followed the install instructions, your device will be fully functional. You can now customize it. For example, download the alternative store F-Droid from the web browser. Go to their web site, install the APK file and run the app! If you install F-Droid following this way, a security warning occurs telling you the app is not trusted. You can enable the “unknown sources” option to install the app.Be aware with this option which can be a security flaw if untrusted apps are installed, so disable it after.

From F-Droid you can download the Yalp app. Yalp allows you to download an app without using Google Play nor Google account. Useful isn’t it?

You can also install from Yalp (or F-Droid which is really another store, not a proxy like Yalp) plenty of apps respectful for your privacy. The web browser Brave, which tries to create another model for advertisement more fair and clear, and also block trackers. The Exodus privacy app, which scans in their cloud a lot of Android apps looking for trackers ans flaws, and show you the results thanks to their app. Then Ooni Probe, which tells you if web sites, services or social networks are filtered or blocked in the network you use. Fight against censorship matters, and knowing if your network is spied may be useful. P-R-I-V-A-C-Y I said. If you like Fediverse and decentralized social networks, and have a Mastodon account, get the Tusky app ;–) Twidere is also cool and rich. You don’t want to remember of your passwords? Keepass2Android is a good option :) And what if you want to see videos? NewPipe is a facade for YouTube ;–) About messaging, why not use Silence or Signal! For your mails K-9 is efficient enough. If you are looking for a navigation app, try OsmAnd why uses Open Street Map layers. You can also use the Tor Browser app to surf quite anonymously! If you use 2FA authentication, why not use andOTP?

Finally, why not encipher your device? This option protect your data, messages, SMS et other valuable details from unwanted access. The process to encrypt take some minutes, but privacy and security matter ;–)

Some things to know…

You may encounter problems while flashing the recovery or the OS, or unlocking the bootloader. Sometimes with some devices you cannot unlock the bootloader.I had to make several attempts with different versions of Gapps and recovery to make my LineageOS booting and running.Once you succeeded in having a good configuration and a working device, make a backup of your files. Thus you will be always able to flash the components which worked in the past, it saved me a lot of time

Security, privacy, keep your things as long as possible… it can be tricky to do that but the result worth it!

Last update: Thursday, October, 10th 2019 Previously on Medium and paper.wf

Did you enjoy reading this blog? Give me a beer 🍺 or use something else ❤️‍🔥 Licensed under CC-BY-SA 4.0. Opinions are my own. To contact me, feel free to choose the most suitable medium for you, or for example Mastodon.