I am interested in being able to communicate with SIM card in Android. I know that only system applications that have MODIFY_PHONE_STATE permission or applications that have carrier priveledges on API >22 (https://source.android.com/devices/tech/config/uicc) are able to call TelephonyManager.iccOpenLogicalChannel() method and perform further APDU exchange with SIM card. However there is a wonderful project that can add open interface to communicate with secure elements, sim cards etc called SEEK-for-android (https://github.com/seek-for-android/pool). The big problem is that you have to manually patch the OS yourself to use it. And so while I was debugging an application I have seen this line in logcat output:
09-20 12:27:35.613 14942-14954/? W/System.err: java.lang.NullPointerException: Attempt to read from null array
at android.os.Parcel.readException(Parcel.java:1627)
at android.os.Parcel.readException(Parcel.java:1574)
at com.android.internal.telephony.ITelephony$Stub$Proxy.hasIccCard(ITelephony.java:3922)
at org.simalliance.openmobileapi.uiccterminal.UiccTerminal$TerminalServiceImplementation.isCardPresent(UiccTerminal.java:432)
at org.simalliance.openmobileapi.service.Terminal.isCardPresent(Terminal.java:497)
at org.simalliance.openmobileapi.service.Terminal.initializeAccessControl(Terminal.java:242)
at org.simalliance.openmobileapi.service.Terminal$InitialiseTask.doInBackground(Terminal.java:121)
at org.simalliance.openmobileapi.service.Terminal$InitialiseTask.doInBackground(Terminal.java:109)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
You can see org.simalliance.openmobileapi.* classes in the stacktrace. So it seems that my device (Samsung galaxy J2 - SM-G532F) actually HAS this patch applied to OS! Now my question is: can I somehow use them? I have tried to instanciate it by calling Class.forName("org.simalliance.openmobileapi.uiccterminal.UiccTerminal")
but I had no success and received ClassNotFoundException. So is it possible to instanciate and use those classes? Maybe I am missing something? Thank you in advance
Aucun commentaire:
Enregistrer un commentaire