Compare Error enum, not string, to get open channel error.
Bug: b/21313437
Change-Id: I682a0e4e0cf16057c0674b1845fe1d80984fc029
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e4b8c35..bde8e02 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -464,10 +464,12 @@
}
int errorCode = IccOpenLogicalChannelResponse.STATUS_UNKNOWN_ERROR;
- if ((ar.exception != null) && (ar.exception instanceof CommandException)) {
- if (ar.exception.getMessage().compareTo("MISSING_RESOURCE") == 0) {
+ if (ar.exception instanceof CommandException) {
+ CommandException.Error error =
+ ((CommandException) (ar.exception)).getCommandError();
+ if (error == CommandException.Error.MISSING_RESOURCE) {
errorCode = IccOpenLogicalChannelResponse.STATUS_MISSING_RESOURCE;
- } else if (ar.exception.getMessage().compareTo("NO_SUCH_ELEMENT") == 0) {
+ } else if (error == CommandException.Error.NO_SUCH_ELEMENT) {
errorCode = IccOpenLogicalChannelResponse.STATUS_NO_SUCH_ELEMENT;
}
}