Merge "Consolidated all data allow/disallow logic into one method"
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index f45beb6..1cada64 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -154,10 +154,6 @@
private int[] mDataConnectionState;
- private boolean[] mDataConnectionPossible;
-
- private String[] mDataConnectionReason;
-
private String[] mDataConnectionApn;
private ArrayList<String>[] mConnectedApns;
@@ -307,8 +303,6 @@
mDataActivationState = new int[numPhones];
mSignalStrength = new SignalStrength[numPhones];
mMessageWaiting = new boolean[numPhones];
- mDataConnectionPossible = new boolean[numPhones];
- mDataConnectionReason = new String[numPhones];
mDataConnectionApn = new String[numPhones];
mCallForwarding = new boolean[numPhones];
mCellLocation = new Bundle[numPhones];
@@ -326,8 +320,6 @@
mSignalStrength[i] = new SignalStrength();
mMessageWaiting[i] = false;
mCallForwarding[i] = false;
- mDataConnectionPossible[i] = false;
- mDataConnectionReason[i] = "";
mDataConnectionApn[i] = "";
mCellLocation[i] = new Bundle();
mCellInfo.add(i, null);
@@ -1081,16 +1073,16 @@
}
}
- public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
+ public void notifyDataConnection(int state, boolean isDataAllowed,
String reason, String apn, String apnType, LinkProperties linkProperties,
NetworkCapabilities networkCapabilities, int networkType, boolean roaming) {
notifyDataConnectionForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, state,
- isDataConnectivityPossible,reason, apn, apnType, linkProperties,
+ isDataAllowed,reason, apn, apnType, linkProperties,
networkCapabilities, networkType, roaming);
}
public void notifyDataConnectionForSubscriber(int subId, int state,
- boolean isDataConnectivityPossible, String reason, String apn, String apnType,
+ boolean isDataAllowed, String reason, String apn, String apnType,
LinkProperties linkProperties, NetworkCapabilities networkCapabilities,
int networkType, boolean roaming) {
if (!checkNotifyPermission("notifyDataConnection()" )) {
@@ -1098,7 +1090,7 @@
}
if (VDBG) {
log("notifyDataConnectionForSubscriber: subId=" + subId
- + " state=" + state + " isDataConnectivityPossible=" + isDataConnectivityPossible
+ + " state=" + state + " isDataAllowed=" + isDataAllowed
+ " reason='" + reason
+ "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType
+ " mRecords.size()=" + mRecords.size());
@@ -1126,8 +1118,6 @@
}
}
}
- mDataConnectionPossible[phoneId] = isDataConnectivityPossible;
- mDataConnectionReason[phoneId] = reason;
mDataConnectionLinkProperties[phoneId] = linkProperties;
mDataConnectionNetworkCapabilities[phoneId] = networkCapabilities;
if (mDataConnectionNetworkType[phoneId] != networkType) {
@@ -1171,7 +1161,7 @@
}
handleRemoveListLocked();
}
- broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
+ broadcastDataConnectionStateChanged(state, isDataAllowed, reason, apn,
apnType, linkProperties, networkCapabilities, roaming, subId);
broadcastPreciseDataConnectionStateChanged(state, networkType, apnType, apn, reason,
linkProperties, "");
@@ -1412,8 +1402,6 @@
pw.println(" mCallForwarding=" + mCallForwarding[i]);
pw.println(" mDataActivity=" + mDataActivity[i]);
pw.println(" mDataConnectionState=" + mDataConnectionState[i]);
- pw.println(" mDataConnectionPossible=" + mDataConnectionPossible[i]);
- pw.println(" mDataConnectionReason=" + mDataConnectionReason[i]);
pw.println(" mDataConnectionApn=" + mDataConnectionApn[i]);
pw.println(" mDataConnectionLinkProperties=" + mDataConnectionLinkProperties[i]);
pw.println(" mDataConnectionNetworkCapabilities=" +
@@ -1521,7 +1509,7 @@
}
private void broadcastDataConnectionStateChanged(int state,
- boolean isDataConnectivityPossible,
+ boolean isDataAllowed,
String reason, String apn, String apnType, LinkProperties linkProperties,
NetworkCapabilities networkCapabilities, boolean roaming, int subId) {
// Note: not reporting to the battery stats service here, because the
@@ -1530,7 +1518,7 @@
Intent intent = new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(PhoneConstants.STATE_KEY,
PhoneConstantConversions.convertDataState(state).toString());
- if (!isDataConnectivityPossible) {
+ if (!isDataAllowed) {
intent.putExtra(PhoneConstants.NETWORK_UNAVAILABLE_KEY, true);
}
if (reason != null) {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 3fcb280..5c718c7 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5321,9 +5321,10 @@
try {
ITelephony telephony = getITelephony();
if (telephony != null)
- return telephony.isDataConnectivityPossible();
+ return telephony.isDataConnectivityPossible(getSubId(SubscriptionManager
+ .getDefaultDataSubscriptionId()));
} catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#isDataConnectivityPossible", e);
+ Log.e(TAG, "Error calling ITelephony#isDataAllowed", e);
}
return false;
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index c542879..fb6782e 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -371,7 +371,7 @@
/**
* Report whether data connectivity is possible.
*/
- boolean isDataConnectivityPossible();
+ boolean isDataConnectivityPossible(int subId);
Bundle getCellLocation(String callingPkg);