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

Commit e7225b0b authored by Pengquan Meng's avatar Pengquan Meng Committed by android-build-merger
Browse files

Merge "Replace 'No Service' with 'Emergency Call Only'"

am: d160a075

Change-Id: I291b80212f774d470098c2833abd3a096fff5544
parents 68c5a0ed d160a075
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -4003,6 +4003,29 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
            String gid2, String pnn, String spn) {
    }

    /**
     * Check if the device can only make the emergency call. The device is emergency call only if
     * none of the phone is in service, and one of them has the capability to make the emergency
     * call.
     *
     * @return {@code True} if the device is emergency call only, otherwise return {@code False}.
     */
    public static boolean isEmergencyCallOnly() {
        boolean isEmergencyCallOnly = false;
        for (Phone phone : PhoneFactory.getPhones()) {
            if (phone != null) {
                ServiceState ss = phone.getServiceStateTracker().getServiceState();
                // One of the phone is in service, hence the device is not emergency call only.
                if (ss.getState() == ServiceState.STATE_IN_SERVICE
                        || ss.getDataRegState() == ServiceState.STATE_IN_SERVICE) {
                    return false;
                }
                isEmergencyCallOnly |= ss.isEmergencyOnly();
            }
        }
        return isEmergencyCallOnly;
    }

    /**
     * Get data connection tracker based on the transport type
     *
+1 −1
Original line number Diff line number Diff line
@@ -2628,7 +2628,7 @@ public class ServiceStateTracker extends Handler {
                final boolean forceDisplayNoService = mPhone.getContext().getResources().getBoolean(
                        com.android.internal.R.bool.config_display_no_service_when_sim_unready)
                        && !mIsSimReady;
                if (mEmergencyOnly && !forceDisplayNoService) {
                if (!forceDisplayNoService && Phone.isEmergencyCallOnly()) {
                    // No service but emergency call allowed
                    plmn = Resources.getSystem().
                            getText(com.android.internal.R.string.emergency_calls_only).toString();
+3 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.util.LocalLog;
import android.util.SparseArray;

import com.android.internal.telephony.GsmCdmaPhone;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.cdnr.EfData.EFSource;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
import com.android.internal.telephony.uicc.IccRecords;
@@ -380,8 +381,8 @@ public class CarrierDisplayNameResolver {
                com.android.internal.R.bool.config_display_no_service_when_sim_unready)
                && !isSimReady;
        ServiceState ss = getServiceState();
        if (ss.getVoiceRegState() == ServiceState.STATE_POWER_OFF || !ss.isEmergencyOnly()
                || forceDisplayNoService) {
        if (ss.getVoiceRegState() == ServiceState.STATE_POWER_OFF
                || forceDisplayNoService || !Phone.isEmergencyCallOnly()) {
            plmn = mContext.getResources().getString(
                    com.android.internal.R.string.lockscreen_carrier_default);
        } else {