Loading src/java/com/android/internal/telephony/uicc/euicc/apdu/ApduSender.java +28 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony.uicc.euicc.apdu; import android.annotation.Nullable; import android.os.Handler; import android.os.Looper; import android.telephony.IccOpenLogicalChannelResponse; import android.telephony.Rlog; Loading Loading @@ -50,10 +51,16 @@ public class ApduSender { private static final int STATUS_NO_ERROR = 0x9000; private static final int SW1_NO_ERROR = 0x91; private static final int WAIT_TIME_MS = 2000; private static void logv(String msg) { Rlog.v(LOG_TAG, msg); } private static void logd(String msg) { Rlog.d(LOG_TAG, msg); } private final String mAid; private final boolean mSupportExtendedApdu; private final OpenLogicalChannelInvocation mOpenChannel; Loading Loading @@ -93,12 +100,27 @@ public class ApduSender { ApduSenderResultCallback resultCallback, Handler handler) { synchronized (mChannelLock) { if (mChannelOpened) { if (!Looper.getMainLooper().equals(Looper.myLooper())) { logd("Logical channel has already been opened. Wait."); try { mChannelLock.wait(WAIT_TIME_MS); } catch (InterruptedException e) { // nothing to do } if (mChannelOpened) { AsyncResultHelper.throwException( new ApduException("Logical channel has already been opened."), new ApduException("The logical channel is still in use."), resultCallback, handler); return; } } else { AsyncResultHelper.throwException( new ApduException("The logical channel is in use."), resultCallback, handler); return; } } mChannelOpened = true; } Loading @@ -111,6 +133,7 @@ public class ApduSender { || status != IccOpenLogicalChannelResponse.STATUS_NO_ERROR) { synchronized (mChannelLock) { mChannelOpened = false; mChannelLock.notify(); } resultCallback.onException( new ApduException("Failed to open logical channel opened for AID: " Loading Loading @@ -245,6 +268,7 @@ public class ApduSender { public void onResult(Boolean aBoolean) { synchronized (mChannelLock) { mChannelOpened = false; mChannelLock.notify(); } if (exception == null) { Loading Loading
src/java/com/android/internal/telephony/uicc/euicc/apdu/ApduSender.java +28 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony.uicc.euicc.apdu; import android.annotation.Nullable; import android.os.Handler; import android.os.Looper; import android.telephony.IccOpenLogicalChannelResponse; import android.telephony.Rlog; Loading Loading @@ -50,10 +51,16 @@ public class ApduSender { private static final int STATUS_NO_ERROR = 0x9000; private static final int SW1_NO_ERROR = 0x91; private static final int WAIT_TIME_MS = 2000; private static void logv(String msg) { Rlog.v(LOG_TAG, msg); } private static void logd(String msg) { Rlog.d(LOG_TAG, msg); } private final String mAid; private final boolean mSupportExtendedApdu; private final OpenLogicalChannelInvocation mOpenChannel; Loading Loading @@ -93,12 +100,27 @@ public class ApduSender { ApduSenderResultCallback resultCallback, Handler handler) { synchronized (mChannelLock) { if (mChannelOpened) { if (!Looper.getMainLooper().equals(Looper.myLooper())) { logd("Logical channel has already been opened. Wait."); try { mChannelLock.wait(WAIT_TIME_MS); } catch (InterruptedException e) { // nothing to do } if (mChannelOpened) { AsyncResultHelper.throwException( new ApduException("Logical channel has already been opened."), new ApduException("The logical channel is still in use."), resultCallback, handler); return; } } else { AsyncResultHelper.throwException( new ApduException("The logical channel is in use."), resultCallback, handler); return; } } mChannelOpened = true; } Loading @@ -111,6 +133,7 @@ public class ApduSender { || status != IccOpenLogicalChannelResponse.STATUS_NO_ERROR) { synchronized (mChannelLock) { mChannelOpened = false; mChannelLock.notify(); } resultCallback.onException( new ApduException("Failed to open logical channel opened for AID: " Loading Loading @@ -245,6 +268,7 @@ public class ApduSender { public void onResult(Boolean aBoolean) { synchronized (mChannelLock) { mChannelOpened = false; mChannelLock.notify(); } if (exception == null) { Loading