I am struggling with a strange situation over past week. I am trying to delete an applet and i get 0x6985 in response of delete command.
Scenario:
- An applet X is present in Sim card.
- Sim card is inserted in mobile phone.
- An android application will receive commands from server and will send these commands to Sim Card via Telephony Manager.
- Server controls all the commands and has all required KEYS for authentication and all AID's are known.
- Android application works as a bridge to channel the commands to Sim card and send response back to server.
How applets are connected to each other in my ecosystem?
- There is one more applet i.e. Y, which holds the reference of an applet i.e. X. [It is known to me that delete will not work until Y releases the reference of X applet]
- In X applet's uninstall() method i am calling Y applet(via shared interface) and there i am releasing the reference of X applet.
Problem Scenario:
- In offline mode via reader any time when i send delete command for X applet. It gets deleted successfully.
- To verify that Y applet is getting call from X applet i set some data in one of buffer present in Y applet. [That confirms Y applet got the call and reference was released in that way successfully. I get this buffer data by some in house designed command by me, which confirms that happened or not.]
Situation when Sim card in mobile
When server sends delete command for an X applet, in response i get 0x6985.
I call the Y applet and check what data is present in Y's buffer that holds accountability of call received by X. There, call from X is never received.
Situation when done with card reader not in mobile
With PCSC reader when delete command is sent to X. Applet X gets delete successfully.
Y applet's buffer data confirms that call was received from X applet.
My Observation:
I tried every possible way to get this done but failed every time. The cap file of both applet X and Y is same i.e. used in Mobile phone and via card reader.
I feel there is some issue with Telephony manager as i couldn't find any other culprit here but i lack in experience with telephony manager.
Any help on this topic is much appreciated.