diff options
| author | 2017-05-01 17:01:11 -0700 | |
|---|---|---|
| committer | 2017-05-17 21:16:39 -0700 | |
| commit | bd7d89c13372f37e171db09506afc345adb07d76 (patch) | |
| tree | ee9e2c7a7daa783730a6a6fad9cd0ef350c4533c | |
| parent | 0373340b07580232548e4702c644d10f16392065 (diff) | |
Consolidated all data allow/disallow logic into one method
Consolidated all data allow/disallow logic into one method
and got rid of the obsolete isDataPossible. This is the
preliminary work for checking if data is allowed just right
before data connection entering connected state.
Test: Telephony sanity tests and unit tests
bug: 33847610
Merged-In: I24f1415bbb59990e9e8e9920724be9e3f17e3e60
Change-Id: I24f1415bbb59990e9e8e9920724be9e3f17e3e60
3 files changed, 11 insertions, 22 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index f45beb6fb093..1cada648841f 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -154,10 +154,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private int[] mDataConnectionState; - private boolean[] mDataConnectionPossible; - - private String[] mDataConnectionReason; - private String[] mDataConnectionApn; private ArrayList<String>[] mConnectedApns; @@ -307,8 +303,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } - 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } } - mDataConnectionPossible[phoneId] = isDataConnectivityPossible; - mDataConnectionReason[phoneId] = reason; mDataConnectionLinkProperties[phoneId] = linkProperties; mDataConnectionNetworkCapabilities[phoneId] = networkCapabilities; if (mDataConnectionNetworkType[phoneId] != networkType) { @@ -1171,7 +1161,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { 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 3fcb2806bad4..5c718c75e68a 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5321,9 +5321,10 @@ public class TelephonyManager { 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 c5428791de6f..fb6782e17f4b 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -371,7 +371,7 @@ interface ITelephony { /** * Report whether data connectivity is possible. */ - boolean isDataConnectivityPossible(); + boolean isDataConnectivityPossible(int subId); Bundle getCellLocation(String callingPkg); |