Search in sources :

Example 1 with PreciseDataConnectionState

use of android.telephony.PreciseDataConnectionState in project android_frameworks_base by ResurrectionRemix.

the class TelephonyRegistry method notifyDataConnectionFailedForSubscriber.

public void notifyDataConnectionFailedForSubscriber(int subId, String reason, String apnType) {
    if (!checkNotifyPermission("notifyDataConnectionFailed()")) {
        return;
    }
    if (VDBG) {
        log("notifyDataConnectionFailedForSubscriber: subId=" + subId + " reason=" + reason + " apnType=" + apnType);
    }
    synchronized (mRecords) {
        mPreciseDataConnectionState = new PreciseDataConnectionState(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", reason, null, "");
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
                try {
                    r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastDataConnectionFailed(reason, apnType, subId);
    broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", reason, null, "");
}
Also used : RemoteException(android.os.RemoteException) PreciseDataConnectionState(android.telephony.PreciseDataConnectionState)

Example 2 with PreciseDataConnectionState

use of android.telephony.PreciseDataConnectionState in project android_frameworks_base by DirtyUnicorns.

the class TelephonyRegistry method notifyPreciseDataConnectionFailed.

public void notifyPreciseDataConnectionFailed(String reason, String apnType, String apn, String failCause) {
    if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) {
        return;
    }
    synchronized (mRecords) {
        mPreciseDataConnectionState = new PreciseDataConnectionState(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, apn, reason, null, failCause);
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
                try {
                    r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, apn, reason, null, failCause);
}
Also used : RemoteException(android.os.RemoteException) PreciseDataConnectionState(android.telephony.PreciseDataConnectionState)

Example 3 with PreciseDataConnectionState

use of android.telephony.PreciseDataConnectionState in project android_frameworks_base by DirtyUnicorns.

the class TelephonyRegistry method notifyDataConnectionFailedForSubscriber.

public void notifyDataConnectionFailedForSubscriber(int subId, String reason, String apnType) {
    if (!checkNotifyPermission("notifyDataConnectionFailed()")) {
        return;
    }
    if (VDBG) {
        log("notifyDataConnectionFailedForSubscriber: subId=" + subId + " reason=" + reason + " apnType=" + apnType);
    }
    synchronized (mRecords) {
        mPreciseDataConnectionState = new PreciseDataConnectionState(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", reason, null, "");
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
                try {
                    r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastDataConnectionFailed(reason, apnType, subId);
    broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", reason, null, "");
}
Also used : RemoteException(android.os.RemoteException) PreciseDataConnectionState(android.telephony.PreciseDataConnectionState)

Example 4 with PreciseDataConnectionState

use of android.telephony.PreciseDataConnectionState in project platform_frameworks_base by android.

the class TelephonyRegistry method notifyDataConnectionForSubscriber.

public void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, LinkProperties linkProperties, NetworkCapabilities networkCapabilities, int networkType, boolean roaming) {
    if (!checkNotifyPermission("notifyDataConnection()")) {
        return;
    }
    if (VDBG) {
        log("notifyDataConnectionForSubscriber: subId=" + subId + " state=" + state + " isDataConnectivityPossible=" + isDataConnectivityPossible + " reason='" + reason + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType + " mRecords.size()=" + mRecords.size());
    }
    synchronized (mRecords) {
        int phoneId = SubscriptionManager.getPhoneId(subId);
        if (validatePhoneId(phoneId)) {
            boolean modified = false;
            if (state == TelephonyManager.DATA_CONNECTED) {
                if (!mConnectedApns[phoneId].contains(apnType)) {
                    mConnectedApns[phoneId].add(apnType);
                    if (mDataConnectionState[phoneId] != state) {
                        mDataConnectionState[phoneId] = state;
                        modified = true;
                    }
                }
            } else {
                if (mConnectedApns[phoneId].remove(apnType)) {
                    if (mConnectedApns[phoneId].isEmpty()) {
                        mDataConnectionState[phoneId] = state;
                        modified = true;
                    } else {
                    // leave mDataConnectionState as is and
                    // send out the new status for the APN in question.
                    }
                }
            }
            mDataConnectionPossible[phoneId] = isDataConnectivityPossible;
            mDataConnectionReason[phoneId] = reason;
            mDataConnectionLinkProperties[phoneId] = linkProperties;
            mDataConnectionNetworkCapabilities[phoneId] = networkCapabilities;
            if (mDataConnectionNetworkType[phoneId] != networkType) {
                mDataConnectionNetworkType[phoneId] = networkType;
                // need to tell registered listeners about the new network type
                modified = true;
            }
            if (modified) {
                if (DBG) {
                    log("onDataConnectionStateChanged(" + mDataConnectionState[phoneId] + ", " + mDataConnectionNetworkType[phoneId] + ")");
                }
                for (Record r : mRecords) {
                    if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) && idMatch(r.subId, subId, phoneId)) {
                        try {
                            log("Notify data connection state changed on sub: " + subId);
                            r.callback.onDataConnectionStateChanged(mDataConnectionState[phoneId], mDataConnectionNetworkType[phoneId]);
                        } catch (RemoteException ex) {
                            mRemoveList.add(r.binder);
                        }
                    }
                }
                handleRemoveListLocked();
            }
            mPreciseDataConnectionState = new PreciseDataConnectionState(state, networkType, apnType, apn, reason, linkProperties, "");
            for (Record r : mRecords) {
                if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
                    try {
                        r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState);
                    } catch (RemoteException ex) {
                        mRemoveList.add(r.binder);
                    }
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn, apnType, linkProperties, networkCapabilities, roaming, subId);
    broadcastPreciseDataConnectionStateChanged(state, networkType, apnType, apn, reason, linkProperties, "");
}
Also used : RemoteException(android.os.RemoteException) PreciseDataConnectionState(android.telephony.PreciseDataConnectionState)

Example 5 with PreciseDataConnectionState

use of android.telephony.PreciseDataConnectionState in project android_frameworks_base by crdroidandroid.

the class TelephonyRegistry method notifyDataConnectionFailedForSubscriber.

public void notifyDataConnectionFailedForSubscriber(int subId, String reason, String apnType) {
    if (!checkNotifyPermission("notifyDataConnectionFailed()")) {
        return;
    }
    if (VDBG) {
        log("notifyDataConnectionFailedForSubscriber: subId=" + subId + " reason=" + reason + " apnType=" + apnType);
    }
    synchronized (mRecords) {
        mPreciseDataConnectionState = new PreciseDataConnectionState(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", reason, null, "");
        for (Record r : mRecords) {
            if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
                try {
                    r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState);
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastDataConnectionFailed(reason, apnType, subId);
    broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", reason, null, "");
}
Also used : RemoteException(android.os.RemoteException) PreciseDataConnectionState(android.telephony.PreciseDataConnectionState)

Aggregations

PreciseDataConnectionState (android.telephony.PreciseDataConnectionState)20 RemoteException (android.os.RemoteException)15 Test (org.junit.Test)3 ApnSetting (android.telephony.data.ApnSetting)2 NonNull (android.annotation.NonNull)1 LinkProperties (android.net.LinkProperties)1 ServiceState (android.telephony.ServiceState)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 DcTracker (com.android.internal.telephony.dataconnection.DcTracker)1