Search in sources :

Example 16 with ServiceState

use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.

the class TelephonyRegistry method notifyServiceStateForPhoneId.

public void notifyServiceStateForPhoneId(int phoneId, int subId, ServiceState state) {
    if (!checkNotifyPermission("notifyServiceState()")) {
        return;
    }
    synchronized (mRecords) {
        if (VDBG) {
            log("notifyServiceStateForSubscriber: subId=" + subId + " phoneId=" + phoneId + " state=" + state);
        }
        if (validatePhoneId(phoneId)) {
            mServiceState[phoneId] = state;
            logServiceStateChanged("notifyServiceStateForSubscriber", subId, phoneId, state);
            if (VDBG)
                toStringLogSSC("notifyServiceStateForSubscriber");
            for (Record r : mRecords) {
                if (VDBG) {
                    log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId + " phoneId=" + phoneId + " state=" + state);
                }
                if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_SERVICE_STATE) && idMatch(r.subId, subId, phoneId)) {
                    try {
                        if (DBG) {
                            log("notifyServiceStateForSubscriber: callback.onSSC r=" + r + " subId=" + subId + " phoneId=" + phoneId + " state=" + state);
                        }
                        r.callback.onServiceStateChanged(new ServiceState(state));
                    } catch (RemoteException ex) {
                        mRemoveList.add(r.binder);
                    }
                }
            }
        } else {
            log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId);
        }
        handleRemoveListLocked();
    }
    broadcastServiceStateChanged(state, phoneId, subId);
}
Also used : VoLteServiceState(android.telephony.VoLteServiceState) ServiceState(android.telephony.ServiceState) RemoteException(android.os.RemoteException)

Example 17 with ServiceState

use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.

the class KeyguardUpdateMonitor method isEmergencyOnly.

public boolean isEmergencyOnly() {
    boolean isEmerg = false;
    ServiceState state;
    for (int slotId = 0; slotId < TelephonyManager.getDefault().getPhoneCount(); slotId++) {
        state = null;
        int[] subId = mSubscriptionManager.getSubId(slotId);
        if (subId != null && subId.length > 0) {
            state = mServiceStates.get(subId[0]);
        }
        if (state != null) {
            if (state.getVoiceRegState() == ServiceState.STATE_IN_SERVICE)
                return false;
            else if (state.isEmergencyOnly()) {
                isEmerg = true;
            }
        }
    }
    return isEmerg;
}
Also used : ServiceState(android.telephony.ServiceState)

Example 18 with ServiceState

use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.

the class KeyguardUpdateMonitor method isOOS.

public boolean isOOS() {
    boolean ret = true;
    int phoneCount = TelephonyManager.getDefault().getPhoneCount();
    for (int phoneId = 0; phoneId < phoneCount; phoneId++) {
        ServiceState state = mServiceStates.get(phoneId);
        if (state != null) {
            if (state.isEmergencyOnly())
                ret = false;
            if ((state.getVoiceRegState() != ServiceState.STATE_OUT_OF_SERVICE) && (state.getVoiceRegState() != ServiceState.STATE_POWER_OFF))
                ret = false;
            if (DEBUG) {
                Log.d(TAG, "phoneId: " + phoneId + ", is emergency: " + state.isEmergencyOnly() + ", voice state: " + state.getVoiceRegState());
            }
        } else {
            if (DEBUG)
                Log.d(TAG, "phoneId: " + phoneId + ", state is NULL");
        }
    }
    if (DEBUG)
        Log.d(TAG, "is Emergency supported: " + !ret);
    return ret;
}
Also used : ServiceState(android.telephony.ServiceState)

Example 19 with ServiceState

use of android.telephony.ServiceState in project android_frameworks_base by AOSPA.

the class ComprehensiveCountryDetector method addPhoneStateListener.

protected synchronized void addPhoneStateListener() {
    if (mPhoneStateListener == null) {
        mPhoneStateListener = new PhoneStateListener() {

            @Override
            public void onServiceStateChanged(ServiceState serviceState) {
                mCountServiceStateChanges++;
                mTotalCountServiceStateChanges++;
                if (!isNetworkCountryCodeAvailable()) {
                    return;
                }
                if (DEBUG)
                    Slog.d(TAG, "onServiceStateChanged: " + serviceState.getState());
                detectCountry(true, true);
            }
        };
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
    }
}
Also used : ServiceState(android.telephony.ServiceState) PhoneStateListener(android.telephony.PhoneStateListener)

Example 20 with ServiceState

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

the class KeyguardUpdateMonitor method isEmergencyOnly.

public boolean isEmergencyOnly() {
    boolean isEmerg = false;
    ServiceState state;
    for (int slotId = 0; slotId < TelephonyManager.getDefault().getPhoneCount(); slotId++) {
        state = null;
        int[] subId = mSubscriptionManager.getSubId(slotId);
        if (subId != null && subId.length > 0) {
            state = mServiceStates.get(subId[0]);
        }
        if (state != null) {
            if (state.getVoiceRegState() == ServiceState.STATE_IN_SERVICE)
                return false;
            else if (state.isEmergencyOnly()) {
                isEmerg = true;
            }
        }
    }
    return isEmerg;
}
Also used : ServiceState(android.telephony.ServiceState) Fingerprint(android.hardware.fingerprint.Fingerprint)

Aggregations

ServiceState (android.telephony.ServiceState)55 RemoteException (android.os.RemoteException)19 VoLteServiceState (android.telephony.VoLteServiceState)15 Bundle (android.os.Bundle)11 PhoneStateListener (android.telephony.PhoneStateListener)10 SubscriptionInfo (android.telephony.SubscriptionInfo)7 IBinder (android.os.IBinder)6 SignalStrength (android.telephony.SignalStrength)6 Intent (android.content.Intent)5 IntentFilter (android.content.IntentFilter)5 State (com.android.internal.telephony.IccCardConstants.State)5 TelephonyManager (android.telephony.TelephonyManager)3 Paint (android.graphics.Paint)2 Fingerprint (android.hardware.fingerprint.Fingerprint)2 CdmaCellLocation (android.telephony.cdma.CdmaCellLocation)2 BitSet (java.util.BitSet)2 LinkCapabilities (android.net.LinkCapabilities)1 LinkProperties (android.net.LinkProperties)1 GsmCellLocation (android.telephony.gsm.GsmCellLocation)1 Phone (com.android.internal.telephony.Phone)1