So I relocated to Australia recently and one of the first things I’ve done was openning a bank account at Commonwealth, the largest bank in Australia at the moment. They’ve got a pretty decent mobile app on iOS, however their Android version has a bug that makes it totally useless on my Blackberry. Yes, you read it correctly. I’m using Blackberry OS 10 which supports Android application natively.
The issue happens right at the login view where users are required to input their client ID and password before hitting the ‘Next’ button to jump to the next step. This is how the layout looked like on my Nexus 4:
Funnily with the same apk file installed on my Blackberry, the ‘Next’ button just disappeared. As I mentioned earlier, this makes the app totally unusable:
Believing that I can do something to fix this myself, I decided to give it a try and patch this app. All the fun started with pulling out the apk file from my Nexus device:
$ apktool d base.apk
I: Using Apktool 2.0.2 on base.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /Users/x/Library/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
After looking around, I found the faulty registration layout at res/layout/fragment_register_1.xml, the layout is pretty simple with only 23 lines:
Apparently the designer of this layout wanted to force the container of the text box to take up as much space as is available within the layout element it’s been placed in. This leads to no more space for the “Next” button to show up. This bug is not obvious to most developers because most of the modern Android devices are smart enough to fix the layout problem themselves. However turned out that my Blackberry10’s “Android runtime” component is not that smart.
I made a quick fix to that xml file to set the attribute android:layout_height of the textboxes’ container to “wrap_content” instead of “fill_parent”. Then rebuilt the apk file:
$ apktool b base
I: Using Apktool 2.0.2
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
The new apk file is created at base/dist/base.apk but it would be rejected by the installer because file was still protected from being modifed by a certificate. So the last step is to re-sign the resulting apk file using one of my random keystore:
Now copy the apk file to my blackberry and install it using Snap.
Although this is not a complicated hack, I really hope Commonwealth bank could fix their Android app soon otherwise I would need to re-do all those things everytime they release a new version.