Mobiil-ID on Android Dev Phone

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.

Labels

android android Delete
mobiil-id mobiil-id Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Nov 24

    Sven Filatov says:

    As expected, PIN2 worked just fine as well.

    As expected, PIN2 worked just fine as well.

  2. Nov 30

    Anonymous says:

    This is just awesome!! Congrats!

    This is just awesome!! Congrats!

    1. Nov 30

      Anonymous says:

      Just for the reference, as it was posted "Anonymous".. It was me, AhtiK :)

      Just for the reference, as it was posted "Anonymous".. It was me, AhtiK :)

  3. Feb 03

    Anonymous says:

    Hi there ! Any chance I could get some help for enabling mobiil-ID on a Nexus O...

    Hi there !

    Any chance I could get some help for enabling mobiil-ID on a Nexus One ?

    allan@smail.ee

    1. Mar 05

      Sven Filatov says:

      Cannot get it working on Nexus One. When installing the package, I get INSTALL_...

      Cannot get it working on Nexus One. When installing the package, I get INSTALL_FAILED_UPDATE_INCOMPATIBLE, and in the log there is Package ... has no signatures that match those in shared user android.uid.phone; ignoring!

      STK has to have the same user ID as android.uid.phone application. It is needed for accessing each other's data. The problem is that both applications have to be signed by the same certificate, which I cannot do because I only have my own certificate.

      I think it would work on one of these cases:

      1. A larger part of the system in Nexus One is replaced by customised system applications. However, this is too heavy task to undertake right now
      2. Use a rooted phone
  4. Feb 09

    Sven Filatov says:

    Here's one more tip for building your own SIM Application Toolkit package. My D...

    Here's one more tip for building your own SIM Application Toolkit package.

    My Dev Phone runs SDK 1.6 – the is the latest image available at the time of this writing. If you download the latest sources from the repository, you have to change a few parameters in order to make it work on a Dev Phone. Without changing the parameters, you will end up with a package that requires SDK 2.0 installed to the phone.

    According to the report on the platform SDK versions usage, the lowest SDK in wide use is 1.5. In order to make the application package compatible with SDK versions starting from 1.5, let's change the parameters accordingly:

    sven@galdor ~/mydroid/build $ git diff core
    
    diff --git a/core/version_defaults.mk b/core/version_defaults.mk
    index 7115eac..4c4d3bb 100644
    --- a/core/version_defaults.mk
    +++ b/core/version_defaults.mk
    @@ -41,7 +41,7 @@ ifeq "" "$(PLATFORM_VERSION)"
       # which is the version that we reveal to the end user.
       # Update this value when the platform version changes (rather
       # than overriding it somewhere else).  Can be an arbitrary string.
    -  PLATFORM_VERSION := AOSP
    +  PLATFORM_VERSION := 1.5
     endif
     
     ifeq "" "$(PLATFORM_SDK_VERSION)"
    @@ -53,13 +53,13 @@ ifeq "" "$(PLATFORM_SDK_VERSION)"
       # intermediate builds).  During development, this number remains at the
       # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
       # the code-name of the new development work.
    -  PLATFORM_SDK_VERSION := 5          
    +  PLATFORM_SDK_VERSION := 3
     endif
     
     ifeq "" "$(PLATFORM_VERSION_CODENAME)"
       # This is the current development code-name, if the build is not a final
       # release build.  If this is a final release build, it is simply "REL".
    -  PLATFORM_VERSION_CODENAME := AOSP
    +  PLATFORM_VERSION_CODENAME := REL
     endif
     
     ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
    

    Recall that platform SDK version 5 means Android SDK 2.0, and 3 means Android SDK 1.5.

    Now, compile with

    make

    and install with

    adb install out/target/product/generic/system/app/Stk.apk

    This time I also noticed that it's not necessary to open SIM Application Toolkit before receiving a Mobiil-ID message. You can just have your Home screen open and Mobiil-ID should work.

  5. Feb 23

    Anonymous says:

    Hi Sven Filatov, I use the stk's source code of Eclair, but it doesn't work. ...

    Hi Sven Filatov,

    I use the stk's source code of Eclair, but it doesn't work.

    I found that android would reset the app install state every time the device boots in file Eclair/packages/apps/Stk/src/com/android/stk/BootCompletedReceiver.java

Add Comment