News from Nov 17, 2009

  2009/11/17
Mobiil-ID on Android Dev Phone
Last changed: Nov 17, 2009 08:53 by Sven Filatov
Labels: android, mobiil-id

The thing that I seriously missed since I started to use Android Dev Phone 1 was Estonian Mobiil-ID. So in order to visit internet bank I had to use my ID-card again. And as I haven't bothered to set ID-card software up to my Gentoo box, I could only use bank services in Windows.

Android cupcake roadmap says it includes SIM Application Toolkit (STK) 1.0 as a new feature. Mobiil-ID is a SIM application too. This should mean that after upgrading the dev phone to newer SDK with image files provided by HTC I should be able to use my Mobiil-ID again! However, STK application package was not included in the images. Sigh.

BTW, when I look at it, it seems Android consumer phones do not have SIM Application Toolkit either.

So after some googling for solutions and grieving for a while, I decided to do it the hard way: download Android sources and compile STK application package myself.

Before compiling the code blindly, I checked the STK code, just for fun. For some reason, STK's AndroidManifest.xml contains a reference to an activity StkSettings which does not exist anymore (this class did exist before, so it must be a bug in the manifest file). So I simply commented this activity out from the manifest:

sven@galdor ~/mydroid/packages/apps/Stk $ git diff

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b3eae21..ace3fcb 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -61,6 +61,7 @@
         </activity>
 
                <!-- SIM Toolkit settings activity -->
+<!--
                <activity android:name="StkSettings"
                        android:label="@string/app_name">
                        <intent-filter>
@@ -70,6 +71,7 @@
                                        android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
                        </intent-filter>
                </activity>
+-->
 
                <receiver android:name="com.android.stk.StkCmdReceiver">
             <intent-filter>

Alright, typed make and waited for some time. Then finally the compilation finished and a list of shiny application packages are in out/target/product/generic/system/app/. Er... but not Stk.apk that I expected the most. So apparently it is specified somewhere what individual application packages are built by default. It didn't take long to find that the file target/product/generic.mk contained a list of application names that the default run of make produced. Added Stk to the list of application packages in PRODUCT_PACKAGES:

sven@galdor ~/mydroid/build $ git diff

diff --git a/target/product/generic.mk b/target/product/generic.mk
index b9bc070..8aac809 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -16,7 +16,8 @@ PRODUCT_PACKAGES := \
     Updater \
     CalendarProvider \
     SubscribedFeedsProvider \
-    SyncProvider
+    SyncProvider \
+    Stk
 
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)

and then typed make again.

After biting my nails for a short while, the compilation finished and what do I see... Stk.apk in out/target/product/generic/system/app/! Installed the package with adb install out/target/product/generic/system/app/Stk.apk.

According to AndroidManifest.xml, STK listens to android.intent.action.BOOT_COMPLETED intent in order to start its service. Rebooted the phone to make sure it has started the service and is able to process the incoming messages from my mobile operator.

Let's test how it works. Opened my internet bank web site and chose Mobiil-ID as the login method. The phone was unlocked and home screen displayed. Unfortunately the phone did not react on the Mobiil-ID message, and the web site got a timeout finally. Not good. For the next test, I opened SIM Toolkit application and left its front page open:

Trying to log in to internet bank again. In a few moments I could see the PIN1 entry dialog!

Keyed in my PIN1 and in a few more moments I was logged in to internet bank!

So far I haven't made operations in the bank that require the entry of PIN2, yet. Will do this test probably in a few weeks time. Don't see why this should fail though.

Posted at 17 Nov @ 8:45 AM by Sven Filatov | 7 Comments