Removing the 'SIM is HD capable' notification from AOSP

An unremovable notification that says "SIM is HD capable" is one of the annoying things about the AOSP. I tried to remove it by patching the APK responsible for it.

The right way

I looked at patches of other devices to see how they have done it. From this commit it seems to be by modifying the carrier config.

The config file is present at device/oneplus/guacamole/overlay/packages/apps/CarrierConfig/res/xml/vendor.xml and it contains settings for many carriers. It is easy to just disable the notification for all of them. The key that is responsible is config_update_service_status and setting it to false should do the trick.

<carrier_config mcc="abc" mnc="xyz">
    <boolean name="config_update_service_status" value="false"/>

But unfortunately it didn't and I don't know why. May be the IMS service app doesn't recognize this anymore. IMS is the service that provides telephony services via IP stack. Things like VoLTE, RCS etc. need IMS service to function.

I didn't spend much time on debugging this because I had plan B - patch IMS apk.

Decompile ims.apk

The location of IMS apk is vendor/oneplus/guacamole/proprietary/system_ext/priv-app/ims/ims.apk.

I made a copy of it and decompiled it with apktool:

apktool d ims.apk

Remove notification

Edit ims/smali/org/codeaurora/ims/ImsServiceStateReceiver.smali by commenting out this line:

.method private showHDIcon(Z)V
    # invoke-virtual {v3, v4, v2}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V
.end method

This is the line that is actually responsible to show the notification. This seems to be the easiest patch. I'm unsure if it could cause exceptions when IMS service tries to remove the notification while it doesn't exist. Will see what happens.

Using the patch

I recompiled it with apktool:

apktool b ims

I replaced the apk file in ROM with new one in ims/dist/ims.apk. Rebuilt the ROM. Flashed it. And it works fine and I'm in peace.