Merge "Enable preventSystemServerAndPhoneDeadlock fix" into 24D1-dev
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index e171064..2d1aba4 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1132,20 +1132,17 @@
             return;
         }
 
-        int phoneId = -1;
         int subscriptionId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
-        if(Flags.preventSystemServerAndPhoneDeadlock()) {
-            // Legacy applications pass SubscriptionManager.DEFAULT_SUB_ID,
-            // force all illegal subId to SubscriptionManager.DEFAULT_SUB_ID
-            if (!SubscriptionManager.isValidSubscriptionId(subId)) {
-                if (DBG) {
-                    log("invalid subscription id, use default id");
-                }
-            } else { //APP specify subID
-                subscriptionId = subId;
+        // Legacy applications pass SubscriptionManager.DEFAULT_SUB_ID,
+        // force all illegal subId to SubscriptionManager.DEFAULT_SUB_ID
+        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+            if (DBG) {
+                log("invalid subscription id, use default id");
             }
-            phoneId = getPhoneIdFromSubId(subscriptionId);
+        } else { //APP specify subID
+            subscriptionId = subId;
         }
+        int phoneId = getPhoneIdFromSubId(subscriptionId);
 
         synchronized (mRecords) {
             // register
@@ -1166,23 +1163,8 @@
             r.renounceFineLocationAccess = renounceFineLocationAccess;
             r.callerUid = Binder.getCallingUid();
             r.callerPid = Binder.getCallingPid();
-
-            if(!Flags.preventSystemServerAndPhoneDeadlock()) {
-                // Legacy applications pass SubscriptionManager.DEFAULT_SUB_ID,
-                // force all illegal subId to SubscriptionManager.DEFAULT_SUB_ID
-                if (!SubscriptionManager.isValidSubscriptionId(subId)) {
-                    if (DBG) {
-                        log("invalid subscription id, use default id");
-                    }
-                    r.subId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
-                } else {//APP specify subID
-                    r.subId = subId;
-                }
-                r.phoneId = getPhoneIdFromSubId(r.subId);
-            } else {
-                r.subId = subscriptionId;
-                r.phoneId = phoneId;
-            }
+            r.subId = subscriptionId;
+            r.phoneId = phoneId;
             r.eventList = events;
 
             if (DBG) {
@@ -1928,14 +1910,8 @@
     }
 
     private void notifyCarrierNetworkChangeWithPermission(int subId, boolean active) {
-        int phoneId = -1;
-        if(Flags.preventSystemServerAndPhoneDeadlock()) {
-            phoneId = getPhoneIdFromSubId(subId);
-        }
+        int phoneId = getPhoneIdFromSubId(subId);
         synchronized (mRecords) {
-            if(!Flags.preventSystemServerAndPhoneDeadlock()) {
-                phoneId = getPhoneIdFromSubId(subId);
-            }
             mCarrierNetworkChangeState[phoneId] = active;
 
             if (VDBG) {