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

Commit 8489b3de authored by Haiyang Liu's avatar Haiyang Liu
Browse files

SystemUI: show network name on status bar pull down curtain

For SSSS mode, it shows "EMERGENCY CALL ONLY" on pull down
curtain and no carrier label shows. Per requirement from
carriers, it should show "No SIM card".

For DSDS mode, it shows sub information, like
"SUB1:XXX SUB2:XXX" and "NO INTERNET CONNECTION", operators
require not to show "NO INTERNET CONNECTION".

Change-Id: I6dae7ed381745da197364ed3d9390cdf76bc72fc

CRs-Fixed: 562620
parent 0e7f271a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -110,5 +110,9 @@

    <!-- milliseconds before the heads up notification accepts touches. -->
    <integer name="heads_up_sensitivity_delay">700</integer>

    <!-- Show emergency call label only without carrier label on expanded notification area -->
    <bool name="config_showEmergencyCallLabelOnly">true</bool>
    <bool name="config_showDataConnectionView">true</bool>
</resources>
+5 −1
Original line number Diff line number Diff line
@@ -1192,7 +1192,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
                    mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
        }

        final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
        final boolean showEmergencyCallLabelOnly = mContext.getResources().getBoolean(
                R.bool.config_showEmergencyCallLabelOnly);
        final boolean emergencyCallsShownElsewhere
                = showEmergencyCallLabelOnly && (mEmergencyCallLabel != null);

        final boolean makeVisible;
        if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) {
            makeVisible =
+14 −5
Original line number Diff line number Diff line
@@ -363,10 +363,17 @@ public class MSimNetworkController extends NetworkController {
    private void setCarrierText() {
        String carrierName = mCarrierTextSub[MSimConstants.SUB1]
                  + "    " + mCarrierTextSub[MSimConstants.SUB2];
        if (mContext.getResources().getBoolean(R.bool.config_showDataConnectionView)) {
            for (int i = 0; i < mSubsLabelViews.size(); i++) {
                TextView v = mSubsLabelViews.get(i);
                v.setText(carrierName);
            }
        } else {
            for (int i = 0; i < mMobileLabelViews.size(); i++) {
                TextView v = mMobileLabelViews.get(i);
                v.setText(carrierName);
            }
        }
    }


@@ -491,7 +498,9 @@ public class MSimNetworkController extends NetworkController {
        if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
            simState = IccCardConstants.State.ABSENT;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
        else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)
            || IccCardConstants.INTENT_VALUE_ICC_IMSI.equals(stateExtra)
            || IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra)) {
            simState = IccCardConstants.State.READY;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
@@ -1156,7 +1165,6 @@ public class MSimNetworkController extends NetworkController {
        }

        // mobile label
        setCarrierText();
        N = mMobileLabelViews.size();
        for (int i=0; i<N; i++) {
            TextView v = mMobileLabelViews.get(i);
@@ -1167,6 +1175,7 @@ public class MSimNetworkController extends NetworkController {
                v.setVisibility(View.VISIBLE);
            }
        }
        setCarrierText();
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args, int subscription) {
+56 −1
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
    boolean mShowAtLeastThreeGees = false;
    boolean mAlwaysShowCdmaRssi = false;

    private String mCarrierText = "";

    String mContentDescriptionPhoneSignal;
    String mContentDescriptionWifi;
    String mContentDescriptionWimax;
@@ -485,6 +487,55 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
        }
    };


    private void updateCarrierText() {
        int textResId = 0;
        if (mAirplaneMode) {
            textResId = com.android.internal.R.string.lockscreen_airplane_mode_on;
        } else {
            switch (mSimState) {
                case ABSENT:
                case UNKNOWN:
                case NOT_READY:
                    textResId = com.android.internal.R.string.lockscreen_missing_sim_message_short;
                    break;
                case PIN_REQUIRED:
                    textResId = com.android.internal.R.string.lockscreen_sim_locked_message;
                    break;
                case PUK_REQUIRED:
                    textResId = com.android.internal.R.string.lockscreen_sim_puk_locked_message;
                    break;
                case READY:
                    // If the state is ready, set the text as network name.
                    mCarrierText = mNetworkName;
                    break;
                case PERM_DISABLED:
                    textResId = com.android.internal.
                            R.string.lockscreen_permanent_disabled_sim_message_short;
                    break;
                case CARD_IO_ERROR:
                    textResId = com.android.internal.R.string.lockscreen_sim_error_message_short;
                    break;
                default:
                    textResId = com.android.internal.R.string.lockscreen_missing_sim_message_short;
                    break;
            }
        }

        if (textResId != 0) {
            mCarrierText = mContext.getString(textResId);
        }
    }

    private void setCarrierText() {
        updateCarrierText();

        for (TextView v : mMobileLabelViews) {
            v.setText(mCarrierText);
            v.setVisibility(View.VISIBLE);
        }
    }

    protected void updateSimState(Intent intent) {
        String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
        if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
@@ -493,7 +544,9 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
        else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) {
            mSimState = IccCardConstants.State.CARD_IO_ERROR;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
        else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)
            || IccCardConstants.INTENT_VALUE_ICC_IMSI.equals(stateExtra)
            || IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra)) {
            mSimState = IccCardConstants.State.READY;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
@@ -1306,6 +1359,8 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
                v.setVisibility(View.VISIBLE);
            }
        }

        setCarrierText();
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {