Open GoogleCodeExporter opened 9 years ago
When SmartCard API evolved in the beginning we discussed the lowmemorykiller.c
problem in Android where a process (=SmartCardService) could get killed and no
resources (=open channels) could get freed as onDestroy() where the cleanup is
implemented never gets called.
Your proposal seems to be the way to go - release all logical channels on all
connected secure elements in onCreate() once the service starts. However, this
implies that SmartCard API is the only entity in Android to control secure
elements...which is not the case.
I don't see 'kill <pid>' in adb shell or ddms in a real world usecase so I
relied on the low-memory strategy in Android:
http://developer.android.com/guide/components/processes-and-threads.html under
'Process lifecycle'
SCAPI service is only killed from the kernel after all other background
activities are removed and one single foreground activity using the service is
left over... then the device has other problems.
Still critical: 'malicious' activities that do not release their service
bindings in onPause/Stop/Destroy()
(any lowmemorykiller.c expert: please correct me here if the interpretation is
wrong!)
Current implementation is a trade-off between SCAPI acquiring control over all
secure elements and Android process lifecycle implementation.
What's your opinion?
Original comment by Daniel.A...@gi-de.com
on 7 Sep 2012 at 10:45
Yes, the step to reproduce the issue is just a sure fire way of showing there's
a problem if the smartcardapi process got killed unsuccessfully.
The real problem is that i have observed the SmartCardAPI process got killed
because of some unexpected/uncaught runTime situation during the execution of
SEEK implementation (e.g. Dead Object, some service SEEK is depending got
killed and restarted). And it happens more/less depending on specific device
timing and lower level (Android platform) implementation. Hence, this is
definitely a legit error need to be address.
Another way, might be, to deal with that is to ensure all the implementation
catching all possible exception and handle it gracefully, so not uncaught
situation occurs. Though that would be a huge change in implementation and
probably a bigger impact on performance to try to catch everything.
There's a way to implement UncaughtException Handler for your process, but it
would be difficult as when the exception is thrown, you don't really know what
it is going on there. So in my humble opinion, that might not be the
feasible/correct direction to approach.
Original comment by tommypo...@gmail.com
on 14 Sep 2012 at 7:55
Agreed, SCAPI relies on the low level components to work properly. If a problem
arises there, SCAPI is not able to deal with such. We have been discussing an
architectural change where the terminals are separated in different APKs than
the service which might help to solve the problem.
Original comment by Daniel.A...@gi-de.com
on 18 Sep 2012 at 10:15
Original issue reported on code.google.com by
tommypo...@gmail.com
on 7 Sep 2012 at 3:44