Don't cast IAE to list for getSystemSelectionChannels
Throw error instead of trying to do a cast to list.
Test: atest TelephonyManagerTest
Fix: 179929817
Change-Id: Iae5700b038c8591f0dc1f165bcd33ca97b87528a
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index d39832b..a5ef88b 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1645,8 +1645,8 @@
if (ar.exception == null && ar.result != null) {
request.result = ar.result;
} else {
- request.result = new IllegalArgumentException(
- "Failed to retrieve system selection channels");
+ request.result = new IllegalStateException(
+ "Failed to retrieve system selecton channels");
if (ar.result == null) {
loge("getSystemSelectionChannels: Empty response");
} else {
@@ -9209,9 +9209,11 @@
WorkSource workSource = getWorkSource(Binder.getCallingUid());
final long identity = Binder.clearCallingIdentity();
try {
- List<RadioAccessSpecifier> specifiers =
- (List<RadioAccessSpecifier>) sendRequest(CMD_GET_SYSTEM_SELECTION_CHANNELS,
- null, subId, workSource);
+ Object result = sendRequest(CMD_GET_SYSTEM_SELECTION_CHANNELS, null, subId, workSource);
+ if (result instanceof IllegalStateException) {
+ throw (IllegalStateException) result;
+ }
+ List<RadioAccessSpecifier> specifiers = (List<RadioAccessSpecifier>) result;
if (DBG) log("getSystemSelectionChannels: " + specifiers);
return specifiers;
} finally {