Require READ_PHONE_STATE for getNetworkType in R+

Starting with R, apps targeting the R SDK will get a
SecurityException (rather than a silent failure) if they
do not declare the READ_PHONE_STATE permission.

Bug: 132466954
Test: atest TelephonyManagerPermissionTest
Change-Id: I4c06808347ab3749eb3c0d885e7269cb4a3e2ee0
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f329150..f2c15bc 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -3507,7 +3507,10 @@
      */
     @Override
     public int getNetworkTypeForSubscriber(int subId, String callingPackage) {
-        if (getTargetSdk(callingPackage) >= android.os.Build.VERSION_CODES.Q
+        final int targetSdk = getTargetSdk(callingPackage);
+        if (targetSdk > android.os.Build.VERSION_CODES.Q) {
+            return getDataNetworkTypeForSubscriber(subId, callingPackage);
+        } else if (targetSdk == android.os.Build.VERSION_CODES.Q
                 && !TelephonyPermissions.checkCallingOrSelfReadPhoneStateNoThrow(
                         mApp, subId, callingPackage, "getNetworkTypeForSubscriber")) {
             return TelephonyManager.NETWORK_TYPE_UNKNOWN;