diff options
author | Nathan Harold <nharold@google.com> | 2023-08-18 10:43:48 -0700 |
---|---|---|
committer | Nathan Harold <nharold@google.com> | 2023-08-22 19:35:54 +0000 |
commit | b8757d6b0abe5224232dc6e21ddafbac93ceea48 (patch) | |
tree | b80ead5a9e479a3ca3f51afbb9789f3777fe2d0d | |
parent | de94b95a009647637b20e7436ec89999480c8f05 (diff) | |
download | AlternativeNetworkAccess-b8757d6b0abe5224232dc6e21ddafbac93ceea48.tar.gz |
Add safety to complement a fix in SubMan
SubscriptionManager will now throw an exception in the event
that a subscription group cannot be created, in accordance with
the API contract. To avoid any possible regression do a
try/catch in this code to preserve the old behavior in this code.
Bug: 296125268
Test: atest FrameworksTelephonyTests
Test: MO/MT voice call, MO/MT sms, data
Change-Id: I29bce09d513f7f7eb54fdd05a1168eee1c735a90
-rw-r--r-- | src/com/android/ons/ONSProfileConfigurator.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/ons/ONSProfileConfigurator.java b/src/com/android/ons/ONSProfileConfigurator.java index 84bcdad..c949a5c 100644 --- a/src/com/android/ons/ONSProfileConfigurator.java +++ b/src/com/android/ons/ONSProfileConfigurator.java @@ -133,7 +133,12 @@ public class ONSProfileConfigurator { Log.d(TAG, "Grouping opportunistc eSIM and CBRS pSIM"); ArrayList<Integer> subList = new ArrayList<>(); subList.add(opportunisticESIM.getSubscriptionId()); - mSubscriptionManager.addSubscriptionsIntoGroup(subList, groupUuid); + try { + mSubscriptionManager.addSubscriptionsIntoGroup(subList, groupUuid); + } catch (RuntimeException re) { + // Telephony not found + Log.e(TAG, "Subscription group add failed.", re); + } } if (!opportunisticESIM.isOpportunistic()) { @@ -245,7 +250,14 @@ public class ONSProfileConfigurator { Log.d(TAG, "Creating Group for Primary SIM"); List<Integer> pSubList = new ArrayList<>(); pSubList.add(primaryCBRSSubInfo.getSubscriptionId()); - return mSubscriptionManager.createSubscriptionGroup(pSubList); + ParcelUuid puid = null; + try { + puid = mSubscriptionManager.createSubscriptionGroup(pSubList); + } catch (RuntimeException re) { + // Telephony not found + Log.e(TAG, "Subscription group creation failed.", re); + } + return puid; } /** |