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

Commit f64cff33 authored by Toshiya Ikenaga's avatar Toshiya Ikenaga Committed by Jordan Liu
Browse files

Display "No service" on status bar when SIM unready

Introduce carrier config to forcibly display "No Service" instead of
"Emergency calls only" when SIM is unready.

Test: manual - checked displaying "No service" on status bar
Bug: 29191964
Merged-In: I744ec9a3c70376199ba94d68331604276ea761c3
Change-Id: I744ec9a3c70376199ba94d68331604276ea761c3
parent 0e454d9c
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -452,6 +452,10 @@ public class ServiceStateTracker extends Handler {
    public static final int CS_NOTIFICATION = 999;  // Id to update and cancel CS restricted
    public static final int CS_REJECT_CAUSE_NOTIFICATION = 111; // Id to update and cancel MM
                                                                // rejection cause

    /** To identify whether EVENT_SIM_READY is received or not */
    private boolean mIsSimReady = false;

    private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -1064,6 +1068,11 @@ public class ServiceStateTracker extends Handler {

            case EVENT_ICC_CHANGED:
                onUpdateIccAvailability();
                if (mUiccApplcation != null
                        && mUiccApplcation.getState() != AppState.APPSTATE_READY) {
                    mIsSimReady = false;
                    updateSpnDisplay();
                }
                break;

            case EVENT_GET_CELL_INFO_LIST: {
@@ -1121,6 +1130,7 @@ public class ServiceStateTracker extends Handler {
                // Reset the mPreviousSubId so we treat a SIM power bounce
                // as a first boot.  See b/19194287
                mOnSubscriptionsChangedListener.mPreviousSubId.set(-1);
                mIsSimReady = true;
                pollState();
                // Signal strength polling stops when radio is off
                queueNextSignalStrengthPoll();
@@ -2216,7 +2226,12 @@ public class ServiceStateTracker extends Handler {
            if (combinedRegState == ServiceState.STATE_OUT_OF_SERVICE
                    || combinedRegState == ServiceState.STATE_EMERGENCY_ONLY) {
                showPlmn = true;
                if (mEmergencyOnly) {

                // Force display no service
                final boolean forceDisplayNoService = mPhone.getContext().getResources().getBoolean(
                        com.android.internal.R.bool.config_display_no_service_when_sim_unready)
                                && !mIsSimReady;
                if (mEmergencyOnly && !forceDisplayNoService) {
                    // No service but emergency call allowed
                    plmn = Resources.getSystem().
                            getText(com.android.internal.R.string.emergency_calls_only).toString();