Avoid UnsupportedOperationException from getDefaultSmsSubscriptionId()

This is basically reverting to earlier behavior.

Test: basic sanity
Bug: 134375393
Change-Id: I44dc66f9f3d5d4dfcab95220d7a6a6be0ed5a825
This commit is contained in:
Amit Mahajan
2019-06-07 10:40:09 -07:00
parent ab6d2d3152
commit 900aad9924

View File

@@ -1975,9 +1975,11 @@ public final class SmsManager {
*/
public static int getDefaultSmsSubscriptionId() {
try {
return getISmsServiceOrThrow().getPreferredSmsSubscription();
return getISmsService().getPreferredSmsSubscription();
} catch (RemoteException e) {
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
} catch (NullPointerException e) {
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
}