throw securityexception for notifyNetworkChange

throw exception instead of check permission and return.

Bug: 130329121
Test: Build
Change-Id: I9f0e60312ebd0baaf1538a6e658414211b17991b
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index ac584e9..af78b76 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1172,7 +1172,11 @@
                     .filter(i -> TelephonyPermissions.checkCarrierPrivilegeForSubId(i))
                     .findFirst().getAsInt();
         } catch (NoSuchElementException ex) {
-            log("notifyCarrierNetworkChange without carrier privilege");
+            loge("notifyCarrierNetworkChange without carrier privilege");
+        }
+        // the active subId does not have carrier privilege. 
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            throw new SecurityException("notifyCarrierNetworkChange without carrier privilege");
         }
         int phoneId = SubscriptionManager.getPhoneId(subId);
 
@@ -2272,6 +2276,10 @@
         Rlog.d(TAG, s);
     }
 
+    private static void loge(String s) {
+        Rlog.e(TAG, s);
+    }
+
     boolean idMatch(int rSubId, int subId, int phoneId) {
 
         if(subId < 0) {