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

Commit 635997fd authored by Beena More's avatar Beena More Committed by Ricardo Cerqueira
Browse files

Telephony: No Sim annunciator

Display no sim annunciator symbol on status bar
when sim is removed.

CRs-Fixed: 707886

Conflicts:
packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
Change-Id: I21c7e4c71330207dc4691aef4ff0093832f11ea9
parent 1c4b077e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                />
            <ImageView
                android:id="@+id/no_sim"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                />
        </FrameLayout>
    </FrameLayout>
    <View
+8 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public class SignalClusterView
    private int mWifiStrengthId = 0;
    private boolean mMobileVisible = false;
    private int mMobileStrengthId = 0, mMobileTypeId = 0;
    private int mNoSimIconId = 0;
    private boolean mIsAirplaneMode = false;
    private int mAirplaneIconId = 0;
    private String mWifiDescription, mMobileDescription, mMobileTypeDescription;
@@ -53,7 +54,7 @@ public class SignalClusterView
    private boolean mIsMobileTypeIconWide;

    ViewGroup mWifiGroup, mMobileGroup;
    ImageView mVpn, mWifi, mMobile, mMobileType, mAirplane;
    ImageView mVpn, mWifi, mMobile, mMobileType, mAirplane, mNoSimSlot;
    View mWifiAirplaneSpacer;
    View mWifiSignalSpacer;

@@ -100,6 +101,7 @@ public class SignalClusterView
        mMobileGroup    = (ViewGroup) findViewById(R.id.mobile_combo);
        mMobile         = (ImageView) findViewById(R.id.mobile_signal);
        mMobileType     = (ImageView) findViewById(R.id.mobile_type);
        mNoSimSlot      = (ImageView) findViewById(R.id.no_sim);
        mAirplane       = (ImageView) findViewById(R.id.airplane);
        mWifiAirplaneSpacer =         findViewById(R.id.wifi_airplane_spacer);
        mWifiSignalSpacer =           findViewById(R.id.wifi_signal_spacer);
@@ -115,6 +117,7 @@ public class SignalClusterView
        mMobileGroup    = null;
        mMobile         = null;
        mMobileType     = null;
        mNoSimSlot      = null;
        mAirplane       = null;

        super.onDetachedFromWindow();
@@ -144,7 +147,7 @@ public class SignalClusterView
    @Override
    public void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon,
            String contentDescription, String typeContentDescription, boolean roaming,
            boolean isTypeIconWide) {
            boolean isTypeIconWide, int noSimIcon) {
        mMobileVisible = visible;
        mMobileStrengthId = strengthIcon;
        mMobileTypeId = typeIcon;
@@ -152,6 +155,7 @@ public class SignalClusterView
        mMobileTypeDescription = typeContentDescription;
        mRoaming = roaming;
        mIsMobileTypeIconWide = isTypeIconWide;
        mNoSimIconId = noSimIcon;

        apply();
    }
@@ -227,6 +231,7 @@ public class SignalClusterView
            mMobileType.setImageResource(mMobileTypeId);
            mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
            mMobileGroup.setVisibility(View.VISIBLE);
            mNoSimSlot.setImageResource(mNoSimIconId);
        } else {
            mMobileGroup.setVisibility(View.GONE);
        }
@@ -238,7 +243,7 @@ public class SignalClusterView
            mAirplane.setVisibility(View.GONE);
        }

        if (mIsAirplaneMode && mWifiVisible) {
        if (mWifiVisible && ((mIsAirplaneMode) || (mNoSimIconId != 0))) {
            mWifiAirplaneSpacer.setVisibility(View.VISIBLE);
        } else {
            mWifiAirplaneSpacer.setVisibility(View.GONE);
+28 −5
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
        void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription);
        void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon,
                String contentDescription, String typeContentDescription, boolean roaming,
                boolean isTypeIconWide);
                boolean isTypeIconWide, int noSimIcon);
        void setIsAirplaneMode(boolean is, int airplaneIcon);
    }

@@ -403,7 +403,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
                    mContentDescriptionWimax,
                    mContentDescriptionDataType,
                    mDataTypeIconId == TelephonyIcons.ROAMING_ICON,
                    false /* isTypeIconWide */ );
                    false /* isTypeIconWide */,
                    mNoSimIconId);
        } else {
            // normal mobile data
            cluster.setMobileDataIndicators(
@@ -413,7 +414,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
                    mContentDescriptionPhoneSignal,
                    mContentDescriptionDataType,
                    mDataTypeIconId == TelephonyIcons.ROAMING_ICON,
                    isTypeIconWide(mDataTypeIconId));
                    isTypeIconWide(mDataTypeIconId),
                    mNoSimIconId);
        }
        cluster.setIsAirplaneMode(mAirplaneMode, mAirplaneIconId);
    }
@@ -490,6 +492,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
        } else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
            refreshLocale();
            updateAirplaneMode();
            updateSimIcon();
            refreshViews();
        } else if (action.equals(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION) ||
                action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION) ||
@@ -586,7 +589,9 @@ public class NetworkControllerImpl extends BroadcastReceiver
        } else {
            mSimState = IccCardConstants.State.UNKNOWN;
        }

        if (DEBUG) Log.d(TAG, "updateSimState: mSimState=" + mSimState);
        updateSimIcon();
    }

    private boolean isCdma() {
@@ -853,6 +858,16 @@ public class NetworkControllerImpl extends BroadcastReceiver
        }
    }

    private final void updateSimIcon() {
        Log.d(TAG,"In updateSimIcon simState= " + mSimState);
        if (mSimState ==  IccCardConstants.State.ABSENT) {
            mNoSimIconId = R.drawable.stat_sys_no_sim;
        } else {
            mNoSimIconId = 0;
        }
        refreshViews();
    }

    private final void updateDataIcon() {
        int iconId;
        boolean visible = true;
@@ -1219,6 +1234,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
            mAirplaneIconId = TelephonyIcons.FLIGHT_MODE_ICON;
            mPhoneSignalIconId = mDataSignalIconId = mDataTypeIconId = mQSDataTypeIconId = 0;
            mQSPhoneSignalIconId = 0;
            mNoSimIconId = 0;

            // combined values from connected wifi take precedence over airplane mode
            if (mWifiConnected) {
@@ -1287,6 +1303,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
                    + " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId)
                    + " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId)
                    + " mQSDataTypeIconId=0x" + Integer.toHexString(mQSDataTypeIconId)
                    + " mNoSimIconId=0x" + Integer.toHexString(mNoSimIconId)
                    + " mWifiIconId=0x" + Integer.toHexString(mWifiIconId)
                    + " mQSWifiIconId=0x" + Integer.toHexString(mQSWifiIconId)
                    + " mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId));
@@ -1304,7 +1321,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
         || mLastDataTypeIconId             != mDataTypeIconId
         || mLastAirplaneMode               != mAirplaneMode
         || mLastLocale                     != mLocale
         || mLastConnectedNetworkType       != mConnectedNetworkType)
         || mLastConnectedNetworkType       != mConnectedNetworkType
         || mLastSimIconId                  != mNoSimIconId)
        {
            // NB: the mLast*s will be updated later
            for (SignalCluster cluster : mSignalClusters) {
@@ -1330,6 +1348,10 @@ public class NetworkControllerImpl extends BroadcastReceiver
            mLastDataDirectionIconId = mDataDirectionIconId;
        }

        if (mLastSimIconId != mNoSimIconId) {
            mLastSimIconId = mNoSimIconId;
        }

        // the wifi icon on phones
        if (mLastWifiIconId != mWifiIconId) {
            mLastWifiIconId = mWifiIconId;
@@ -1632,7 +1654,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
                            "Demo",
                            "Demo",
                            mDemoDataTypeIconId == TelephonyIcons.ROAMING_ICON,
                            isTypeIconWide(mDemoDataTypeIconId));
                            isTypeIconWide(mDemoDataTypeIconId),
                            mNoSimIconId);
                }
                refreshViews();
            }