Merge "Fix permissions." into mnc-dev
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index d6216c5..d9680cf 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1799,13 +1799,19 @@
}
/**
- * Returns the data network type
+ * Returns the data network type.
+ * Legacy call, permission-free.
*
* @Deprecated to be removed Q3 2013 use {@link #getDataNetworkType}.
*/
@Override
- public int getNetworkType(String callingPackage) {
- return getNetworkTypeForSubscriber(getDefaultSubscription(), callingPackage);
+ public int getNetworkType() {
+ final Phone phone = getPhone(getDefaultSubscription());
+ if (phone != null) {
+ return phone.getServiceState().getDataNetworkType();
+ } else {
+ return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ }
}
/**
@@ -1816,6 +1822,7 @@
if (!canReadPhoneState(callingPackage, "getNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
+
final Phone phone = getPhone(subId);
if (phone != null) {
return phone.getServiceState().getDataNetworkType();
@@ -1850,18 +1857,14 @@
}
/**
- * Returns the data network type
- */
- @Override
- public int getVoiceNetworkType() {
- return getVoiceNetworkTypeForSubscriber(getDefaultSubscription());
- }
-
- /**
* Returns the Voice network type for a subId
*/
@Override
- public int getVoiceNetworkTypeForSubscriber(int subId) {
+ public int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage) {
+ if (!canReadPhoneState(callingPackage, "getDataNetworkTypeForSubscriber")) {
+ return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ }
+
final Phone phone = getPhone(subId);
if (phone != null) {
return phone.getServiceState().getVoiceNetworkType();