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
diff --git a/packages/SystemUI/res/layout/signal_cluster_view.xml b/packages/SystemUI/res/layout/signal_cluster_view.xml
index 5889c55..3d9ec66 100644
--- a/packages/SystemUI/res/layout/signal_cluster_view.xml
+++ b/packages/SystemUI/res/layout/signal_cluster_view.xml
@@ -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
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index b71c9bf..4ae9ea8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -46,6 +46,7 @@
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 @@
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 @@
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 @@
mMobileGroup = null;
mMobile = null;
mMobileType = null;
+ mNoSimSlot = null;
mAirplane = null;
super.onDetachedFromWindow();
@@ -144,7 +147,7 @@
@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 @@
mMobileTypeDescription = typeContentDescription;
mRoaming = roaming;
mIsMobileTypeIconWide = isTypeIconWide;
+ mNoSimIconId = noSimIcon;
apply();
}
@@ -227,6 +231,7 @@
mMobileType.setImageResource(mMobileTypeId);
mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
mMobileGroup.setVisibility(View.VISIBLE);
+ mNoSimSlot.setImageResource(mNoSimIconId);
} else {
mMobileGroup.setVisibility(View.GONE);
}
@@ -238,7 +243,7 @@
mAirplane.setVisibility(View.GONE);
}
- if (mIsAirplaneMode && mWifiVisible) {
+ if (mWifiVisible && ((mIsAirplaneMode) || (mNoSimIconId != 0))) {
mWifiAirplaneSpacer.setVisibility(View.VISIBLE);
} else {
mWifiAirplaneSpacer.setVisibility(View.GONE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index d1e12a7..23aa424 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -168,7 +168,7 @@
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 @@
mContentDescriptionWimax,
mContentDescriptionDataType,
mDataTypeIconId == TelephonyIcons.ROAMING_ICON,
- false /* isTypeIconWide */ );
+ false /* isTypeIconWide */,
+ mNoSimIconId);
} else {
// normal mobile data
cluster.setMobileDataIndicators(
@@ -413,7 +414,8 @@
mContentDescriptionPhoneSignal,
mContentDescriptionDataType,
mDataTypeIconId == TelephonyIcons.ROAMING_ICON,
- isTypeIconWide(mDataTypeIconId));
+ isTypeIconWide(mDataTypeIconId),
+ mNoSimIconId);
}
cluster.setIsAirplaneMode(mAirplaneMode, mAirplaneIconId);
}
@@ -490,6 +492,7 @@
} 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 @@
} else {
mSimState = IccCardConstants.State.UNKNOWN;
}
+
if (DEBUG) Log.d(TAG, "updateSimState: mSimState=" + mSimState);
+ updateSimIcon();
}
private boolean isCdma() {
@@ -853,6 +858,16 @@
}
}
+ 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 @@
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 @@
+ " 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 @@
|| 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 @@
mLastDataDirectionIconId = mDataDirectionIconId;
}
+ if (mLastSimIconId != mNoSimIconId) {
+ mLastSimIconId = mNoSimIconId;
+ }
+
// the wifi icon on phones
if (mLastWifiIconId != mWifiIconId) {
mLastWifiIconId = mWifiIconId;
@@ -1632,7 +1654,8 @@
"Demo",
"Demo",
mDemoDataTypeIconId == TelephonyIcons.ROAMING_ICON,
- isTypeIconWide(mDemoDataTypeIconId));
+ isTypeIconWide(mDemoDataTypeIconId),
+ mNoSimIconId);
}
refreshViews();
}