Background

This application exists because malicious or just improperly programmed applications can, intentionally or not, block your device from the ability to call emergency numbers. If you are in such a situation, this app helps you to find the culprit – which you then can uninstall (or disable).

For the exact details on the vulnerability (why this happens, how it was discovered, fixes timeline, ...), please check the article by Mishaal Rahman hereopen in new window.

About permissions

This application requires two call management permissions:

This is because on Android, in order to read which applications are adding PhoneAccounts to Android's TelecomManager, these permissions are necessary.

Permission READ_PHONE_STATE is used in all supported Android versions, whereas READ_PHONE_NUMBERS is requested on Android 12 and onwards exclusively.

No permission is (ab)used to log, collect or process any personally identifiable user information.

Application usage

The application is very simple, and contains 2 components:

  • A message at the top of the device, explaining if the application detected a possible abuse of this functionality which may cause issues while attempting to call Emergency Services.
  • A list of the applications that have registered a Phone Account in your device, usually including your own SIM Cards, Google Duo, Teams, among others. Alongside each app, the number of accounts is displayed to facilitate the identification of the malfunctioning/hijacking application.

Check this video if you have doubts on how to interpret this data:

(Thanks to Explaining Androidopen in new window for the video)

Screenshots

Permissions necessary for the app to work:

Permission management

Case where Teams added 4 PhoneAccounts to TelecomManager:

Abnormal case

The app flags this as abnormal behaviour

Case without any abnormal app behaviour"

Normal case

Building the app

You can use Android Studio to build the application, or you can build it by using the CLI.

Navigate to the folder where the source code is located:
cd /path/where/you/downloaded/PhoneAccountDetector/

Then, check that Gradle runs properly by executing:
For Linux/MacOS: ./gradlew tasks
For Windows: gradlew tasks

You can now build the application in release or debug flavor:
./gradlew assemble

After it's done building, you will now need to sign the resulting APK by using apksigner, or jarsigner. Here's an example:
apksigner sign --ks /path/to/example.keystore --ks-pass pass:"EXAMPLEPASSWORD" --v1-signing-enabled true --v2-signing-enabled true --verity-enabled true *.apk