Fix crash associated with invalid sub id in PhoneInterfaceManager
Bug: 27047908
Change-Id: Idca6654cf5918732f24b8ddaa0e42d3c649764fa
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 32dbfde..68b6823 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -194,8 +194,9 @@
public Object argument;
/** The result of the request that is run on the main thread */
public Object result;
- /** The subscriber id that this request applies to. Null if default. */
- public Integer subId;
+ // The subscriber id that this request applies to. Defaults to
+ // SubscriptionManager.INVALID_SUBSCRIPTION_ID
+ public Integer subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
public MainThreadRequest(Object argument) {
this.argument = argument;
@@ -203,7 +204,9 @@
public MainThreadRequest(Object argument, Integer subId) {
this.argument = argument;
- this.subId = subId;
+ if (subId != null) {
+ this.subId = subId;
+ }
}
}
@@ -779,7 +782,7 @@
* @see #sendRequestAsync
*/
private Object sendRequest(int command, Object argument) {
- return sendRequest(command, argument, null);
+ return sendRequest(command, argument, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
}
/**
@@ -866,7 +869,8 @@
}
private Phone getPhoneFromRequest(MainThreadRequest request) {
- return (request.subId == null) ? mPhone : getPhone(request.subId);
+ return (request.subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID)
+ ? mPhone : getPhone(request.subId);
}
// returns phone associated with the subId.
@@ -1507,7 +1511,8 @@
try {
cells = (ArrayList<NeighboringCellInfo>) sendRequest(
- CMD_HANDLE_NEIGHBORING_CELL, null, null);
+ CMD_HANDLE_NEIGHBORING_CELL, null,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID);
} catch (RuntimeException e) {
Log.e(LOG_TAG, "getNeighboringCellInfo " + e);
}