summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jack Yu <jackyu@google.com> 2022-07-20 23:22:09 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-07-20 23:22:09 +0000
commit572a3587236937fa7eb216111a5a6ec2e150851a (patch)
treecdd4fcfd09655f882f9c252f65ed128b38d8a365
parentd66bbc72089bad5bb135d5c30e031900451c8b32 (diff)
parent58ac838baaf7e7bfd2795b7f8e4cb9c5937cb5ed (diff)
Merge "Throw illegal state exception when service is not available"
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index d2858eca8171..f25498022087 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -3040,8 +3040,9 @@ public class SubscriptionManager {
* @param callback Callback will be triggered once it succeeds or failed.
* Pass null if don't care about the result.
*
+ * @throws IllegalStateException when subscription manager service is not available.
+ * @throws SecurityException when clients do not have MODIFY_PHONE_STATE permission.
* @hide
- *
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@@ -3051,7 +3052,9 @@ public class SubscriptionManager {
if (VDBG) logd("[setPreferredDataSubscriptionId]+ subId:" + subId);
try {
ISub iSub = TelephonyManager.getSubscriptionService();
- if (iSub == null) return;
+ if (iSub == null) {
+ throw new IllegalStateException("subscription manager service is null.");
+ }
ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
@Override
@@ -3071,7 +3074,8 @@ public class SubscriptionManager {
};
iSub.setPreferredDataSubscriptionId(subId, needValidation, callbackStub);
} catch (RemoteException ex) {
- // ignore it
+ loge("setPreferredDataSubscriptionId RemoteException=" + ex);
+ ex.rethrowFromSystemServer();
}
}