Hikey 960 telephony features: how to add them using Android 8

Once again a new AOSP supported target is available, and I need to use it for developing and testing the RIL: so, like done for the classic Hikey and Android 6, here’s my recipe that explains how to add the Hikey 960 telephony capabilities in an Android 8 image.

Hikey 960 telephony

Customizing the Hikey 960 for Android 8 (Oreo)

Let’s start with inheriting a telephony oriented makefile. Open

device/linaro/hikey960.mk

and replace the line

$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)

with

$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)

If you do not need AOSP messaging application, you can directly use full_base_telephony.mk: that’s the only difference between the two makefile.

Now proper permissions should be set for the devices used by the RIL and this depends on the modem you are using. Permissions are set in

device/linaro/ueventd.common.rc

adding the line

<device path> 0660 system radio

For example if your modem is serial port based, it will likely use Linux kernel cdc-acm or option driver, so for cdc-acm the line will be:

/dev/ttyACMx 0660 system radio

with x a number that identify the correct serial port, or

/dev/ttyUSBx 0660 system radio

with x having the same meaning described before when using option.

Instead, if you are using a mobile broadband adapter based on MBIM or QMI the control device will be:

/dev/cdc-wdmx 0660 system radio

with x as usual a number that identifies your modem.

We can go forward setting the correct native RIL properties in

device/linaro/system.prop

Replace line

rild.libpath=/system/lib/libreference-ril.so

with

rild.libpath=/system/vendor/lib64/libreference-ril.so

and line

# rild.libargs=-d /dev/ttyS0

with

rild.libargs=-d <device path>

being <device path> your modem control device (likely the one already identified for the change in ueventd.common.rc), e.g.

rild.libargs=-d /dev/ttyACM0

This modified system.prop file should be copied to device/linaro/hikey960/

By default Hikey960 comes in Enforced SeLinux mode, so if not properly configured rild won’t be able to use the device: during development it is possible to put SeLinux in permissive mode, in order not to get fiddling with SeLinux rules.

Open

device/linaro/hikey/hikey960/BoardConfig.mk

and add

BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive

The last change is related to the overlays in

device/linaro/hikey/overlay/frameworks/base/core/res/res/values/config.xml

Change

<bool name="config_voice_capable">false</bool>
<bool name="config_sms_capable">false</bool>

to

<bool name="config_voice_capable">true</bool>
<bool name="config_sms_capable">true</bool>

Then add to the networkAttributes string array the value

<item>"mobile,0,0,1,-1,true"</item>

Hikey 960 telephony additional packages

If other additional packages are needed for properly using the modem, they can be added to

device/linaro/hikey/hikey960/device-hikey960.mk

with the following line

PRODUCT_PACKAGES += <package name>

For example, to add the dhcp client

PRODUCT_PACKAGES += dhcpcd-6.8.2

<package name> can be found in the related Android.mk file (LOCAL_MODULE).

Once done, rebuild aosp and hopefully you are ready to enjoy your Hikey 960 telephony features.

Is this enough for exploiting all that your modem can offer?

Probably no, since these steps allow to use the reference ril provided in AOSP, something that is not really useful.

According to the RIL you are using, there will likely be other custom settings to be done (e.g. services like ppp or dhclient): the only advice is to continue following the instructions provided by your modem vendor.

Last thing to note is that the Hikey 960 README file had a few inaccuracies for which I provided a change that has been already merged in master.