Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0e6324b authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

Merge "Consolidated all data allow/disallow logic into one method"

parents b5fe6bd3 baeec621
Loading
Loading
Loading
Loading
+7 −19
Original line number Diff line number Diff line
@@ -157,10 +157,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {

    private int[] mDataConnectionState;

    private boolean[] mDataConnectionPossible;

    private String[] mDataConnectionReason;

    private ArrayList<String>[] mConnectedApns;

    private LinkProperties[] mDataConnectionLinkProperties;
@@ -310,8 +306,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];
        mCallForwarding = new boolean[numPhones];
        mCellLocation = new Bundle[numPhones];
        mDataConnectionLinkProperties = new LinkProperties[numPhones];
@@ -328,8 +322,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mSignalStrength[i] =  new SignalStrength();
            mMessageWaiting[i] =  false;
            mCallForwarding[i] =  false;
            mDataConnectionPossible[i] = false;
            mDataConnectionReason[i] =  "";
            mCellLocation[i] = new Bundle();
            mCellInfo.add(i, null);
            mConnectedApns[i] = new ArrayList<String>();
@@ -1080,16 +1072,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()" )) {
@@ -1097,7 +1089,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());
@@ -1125,8 +1117,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                        }
                    }
                }
                mDataConnectionPossible[phoneId] = isDataConnectivityPossible;
                mDataConnectionReason[phoneId] = reason;
                mDataConnectionLinkProperties[phoneId] = linkProperties;
                mDataConnectionNetworkCapabilities[phoneId] = networkCapabilities;
                if (mDataConnectionNetworkType[phoneId] != networkType) {
@@ -1173,7 +1163,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, "");
@@ -1414,8 +1404,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("mDataConnectionLinkProperties=" + mDataConnectionLinkProperties[i]);
                pw.println("mDataConnectionNetworkCapabilities=" +
                        mDataConnectionNetworkCapabilities[i]);
@@ -1544,7 +1532,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
@@ -1553,7 +1541,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) {
+3 −2
Original line number Diff line number Diff line
@@ -5371,9 +5371,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;
    }
+1 −1
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ interface ITelephony {
    /**
     * Report whether data connectivity is possible.
     */
    boolean isDataConnectivityPossible();
    boolean isDataConnectivityPossible(int subId);

    Bundle getCellLocation(String callingPkg);