Search in sources :

Example 36 with ServiceState

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

the class NetworkControllerSignalTest method testNoEmengencyNoSubscriptions.

public void testNoEmengencyNoSubscriptions() {
    setupDefaultSignal();
    setSubscriptions();
    mNetworkController.mLastServiceState = new ServiceState();
    mNetworkController.mLastServiceState.setEmergencyOnly(false);
    mNetworkController.recalculateEmergency();
    verifyEmergencyOnly(false);
}
Also used : ServiceState(android.telephony.ServiceState)

Example 37 with ServiceState

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

the class TelephonyRegistry method notifyServiceState.

public void notifyServiceState(ServiceState state) {
    if (!checkNotifyPermission("notifyServiceState()")) {
        return;
    }
    synchronized (mRecords) {
        mServiceState = state;
        for (Record r : mRecords) {
            if ((r.events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
                try {
                    r.callback.onServiceStateChanged(new ServiceState(state));
                } catch (RemoteException ex) {
                    mRemoveList.add(r.binder);
                }
            }
        }
        handleRemoveListLocked();
    }
    broadcastServiceStateChanged(state);
}
Also used : ServiceState(android.telephony.ServiceState) RemoteException(android.os.RemoteException)

Example 38 with ServiceState

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

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 39 with ServiceState

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

the class CarrierText method updateCarrierText.

protected void updateCarrierText() {
    boolean allSimsMissing = true;
    boolean anySimReadyAndInService = false;
    CharSequence displayText = null;
    List<SubscriptionInfo> subs = mKeyguardUpdateMonitor.getSubscriptionInfo(false);
    final int N = subs.size();
    if (DEBUG)
        Log.d(TAG, "updateCarrierText(): " + N);
    for (int i = 0; i < N; i++) {
        int subId = subs.get(i).getSubscriptionId();
        State simState = mKeyguardUpdateMonitor.getSimState(subId);
        CharSequence carrierName = subs.get(i).getCarrierName();
        CharSequence carrierTextForSimState = getCarrierTextForSimState(simState, carrierName);
        if (DEBUG) {
            Log.d(TAG, "Handling (subId=" + subId + "): " + simState + " " + carrierName);
        }
        if (carrierTextForSimState != null) {
            allSimsMissing = false;
            displayText = concatenate(displayText, carrierTextForSimState);
        }
        if (simState == IccCardConstants.State.READY) {
            ServiceState ss = mKeyguardUpdateMonitor.mServiceStates.get(subId);
            if (ss != null && ss.getDataRegState() == ServiceState.STATE_IN_SERVICE) {
                // Wi-Fi is disassociated or disabled
                if (ss.getRilDataRadioTechnology() != ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN || (mWifiManager.isWifiEnabled() && mWifiManager.getConnectionInfo() != null && mWifiManager.getConnectionInfo().getBSSID() != null)) {
                    if (DEBUG) {
                        Log.d(TAG, "SIM ready and in service: subId=" + subId + ", ss=" + ss);
                    }
                    anySimReadyAndInService = true;
                }
            }
        }
    }
    if (allSimsMissing) {
        if (N != 0) {
            // Shows "No SIM card | Emergency calls only" on devices that are voice-capable.
            // This depends on mPlmn containing the text "Emergency calls only" when the radio
            // has some connectivity. Otherwise, it should be null or empty and just show
            // "No SIM card"
            // Grab the first subscripton, because they all should contain the emergency text,
            // described above.
            displayText = makeCarrierStringOnEmergencyCapable(getContext().getText(R.string.keyguard_missing_sim_message_short), subs.get(0).getCarrierName());
        } else {
            // We don't have a SubscriptionInfo to get the emergency calls only from.
            // Grab it from the old sticky broadcast if possible instead. We can use it
            // here because no subscriptions are active, so we don't have
            // to worry about MSIM clashing.
            CharSequence text = getContext().getText(com.android.internal.R.string.emergency_calls_only);
            Intent i = getContext().registerReceiver(null, new IntentFilter(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION));
            if (i != null) {
                String spn = "";
                String plmn = "";
                if (i.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) {
                    spn = i.getStringExtra(TelephonyIntents.EXTRA_SPN);
                }
                if (i.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false)) {
                    plmn = i.getStringExtra(TelephonyIntents.EXTRA_PLMN);
                }
                if (DEBUG)
                    Log.d(TAG, "Getting plmn/spn sticky brdcst " + plmn + "/" + spn);
                if (Objects.equals(plmn, spn)) {
                    text = plmn;
                } else {
                    text = concatenate(plmn, spn);
                }
            }
            displayText = makeCarrierStringOnEmergencyCapable(getContext().getText(R.string.keyguard_missing_sim_message_short), text);
        }
    }
    // (e.g. WFC = Wi-Fi calling) which may operate in APM.
    if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
        displayText = getContext().getString(R.string.airplane_mode);
    }
    setText(displayText);
}
Also used : IntentFilter(android.content.IntentFilter) ServiceState(android.telephony.ServiceState) ServiceState(android.telephony.ServiceState) State(com.android.internal.telephony.IccCardConstants.State) SubscriptionInfo(android.telephony.SubscriptionInfo) Intent(android.content.Intent)

Example 40 with ServiceState

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

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)

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