Merge "Fix a Null retval in SM#getSubscriptionsInGroup" into main
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index baacb57..12ab5c3 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -3396,15 +3396,11 @@
             if (iSub != null) {
                 groupUuid = iSub.createSubscriptionGroup(subIdArray, pkgForDebug);
             } else {
-                if (!isSystemProcess()) {
-                    throw new IllegalStateException("telephony service is null.");
-                }
+                throw new IllegalStateException("telephony service is null.");
             }
         } catch (RemoteException ex) {
             loge("createSubscriptionGroup RemoteException " + ex);
-            if (!isSystemProcess()) {
-                ex.rethrowAsRuntimeException();
-            }
+            ex.rethrowAsRuntimeException();
         }
 
         return groupUuid;
@@ -3446,15 +3442,11 @@
             if (iSub != null) {
                 iSub.addSubscriptionsIntoGroup(subIdArray, groupUuid, pkgForDebug);
             } else {
-                if (!isSystemProcess()) {
-                    throw new IllegalStateException("telephony service is null.");
-                }
+                throw new IllegalStateException("telephony service is null.");
             }
         } catch (RemoteException ex) {
             loge("addSubscriptionsIntoGroup RemoteException " + ex);
-            if (!isSystemProcess()) {
-                ex.rethrowAsRuntimeException();
-            }
+            ex.rethrowAsRuntimeException();
         }
     }
 
@@ -3497,15 +3489,11 @@
             if (iSub != null) {
                 iSub.removeSubscriptionsFromGroup(subIdArray, groupUuid, callingPackage);
             } else {
-                if (!isSystemProcess()) {
-                    throw new IllegalStateException("telephony service is null.");
-                }
+                throw new IllegalStateException("telephony service is null.");
             }
         } catch (RemoteException ex) {
             loge("removeSubscriptionsFromGroup RemoteException " + ex);
-            if (!isSystemProcess()) {
-                ex.rethrowAsRuntimeException();
-            }
+            ex.rethrowAsRuntimeException();
         }
     }
 
@@ -3562,6 +3550,11 @@
             }
         }
 
+        // TODO(b/296125268) Really this method should throw, but it's common enough that for
+        // system callers it's worth having a little magic for the system process until it's
+        // made safer.
+        if (result == null) result = Collections.emptyList();
+
         return result;
     }