Merge "Throw illegal state exception when service is not available" am: 572a358723
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2160225 Change-Id: I5663f4bba2e8722cbe3423da40264944cd23ed61 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3113,8 +3113,9 @@ public class SubscriptionManager {
|
|||||||
* @param callback Callback will be triggered once it succeeds or failed.
|
* @param callback Callback will be triggered once it succeeds or failed.
|
||||||
* Pass null if don't care about the result.
|
* 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
|
* @hide
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
@@ -3124,7 +3125,9 @@ public class SubscriptionManager {
|
|||||||
if (VDBG) logd("[setPreferredDataSubscriptionId]+ subId:" + subId);
|
if (VDBG) logd("[setPreferredDataSubscriptionId]+ subId:" + subId);
|
||||||
try {
|
try {
|
||||||
ISub iSub = TelephonyManager.getSubscriptionService();
|
ISub iSub = TelephonyManager.getSubscriptionService();
|
||||||
if (iSub == null) return;
|
if (iSub == null) {
|
||||||
|
throw new IllegalStateException("subscription manager service is null.");
|
||||||
|
}
|
||||||
|
|
||||||
ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
|
ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
@@ -3144,7 +3147,8 @@ public class SubscriptionManager {
|
|||||||
};
|
};
|
||||||
iSub.setPreferredDataSubscriptionId(subId, needValidation, callbackStub);
|
iSub.setPreferredDataSubscriptionId(subId, needValidation, callbackStub);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
loge("setPreferredDataSubscriptionId RemoteException=" + ex);
|
||||||
|
ex.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user