summaryrefslogtreecommitdiff
path: root/src/com/android/se/Terminal.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/se/Terminal.java')
-rw-r--r--src/com/android/se/Terminal.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java
index 4638926..54dc256 100644
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -76,6 +76,9 @@ public class Terminal {
private static final int GET_SERVICE_DELAY_MILLIS = 4 * 1000;
private static final int EVENT_GET_HAL = 1;
+ private final int mMaxGetHalRetryCount = 5;
+ private int mGetHalRetryCount = 0;
+
private ISecureElement mSEHal;
private android.hardware.secure_element.V1_2.ISecureElement mSEHal12;
@@ -186,11 +189,20 @@ public class Terminal {
switch (message.what) {
case EVENT_GET_HAL:
try {
- initialize(true);
+ if (mName.startsWith(SecureElementService.ESE_TERMINAL)) {
+ initialize(true);
+ } else {
+ initialize(false);
+ }
} catch (Exception e) {
Log.e(mTag, mName + " could not be initialized again");
- sendMessageDelayed(obtainMessage(EVENT_GET_HAL, 0),
- GET_SERVICE_DELAY_MILLIS);
+ if (mGetHalRetryCount < mMaxGetHalRetryCount) {
+ mGetHalRetryCount++;
+ sendMessageDelayed(obtainMessage(EVENT_GET_HAL, 0),
+ GET_SERVICE_DELAY_MILLIS);
+ } else {
+ Log.e(mTag, mName + " reach maximum retry count");
+ }
}
break;
default: