Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +29 −9 Original line number Diff line number Diff line Loading @@ -210,6 +210,7 @@ public class ServiceStateTracker extends Handler { protected static final int EVENT_ALL_DATA_DISCONNECTED = 49; protected static final int EVENT_PHONE_TYPE_SWITCHED = 50; protected static final int EVENT_RADIO_POWER_FROM_CARRIER = 51; protected static final int EVENT_SIM_NOT_INSERTED = 52; protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; Loading Loading @@ -354,6 +355,14 @@ public class ServiceStateTracker extends Handler { } // update voicemail count and notify message waiting changed mPhone.updateVoiceMail(); // cancel notifications if we see SIM_NOT_INSERTED (This happens on bootup before // the SIM is first detected and then subsequently on SIM removals) if (mSubscriptionController.getSlotIndex(subId) == SubscriptionManager.SIM_NOT_INSERTED) { // this is handled on the main thread to mitigate racing with setNotification(). sendMessage(obtainMessage(EVENT_SIM_NOT_INSERTED)); } } } }; Loading Loading @@ -446,7 +455,6 @@ public class ServiceStateTracker extends Handler { public static final int CS_NORMAL_ENABLED = 1005; // Access Control blocks normal voice/sms service public static final int CS_EMERGENCY_ENABLED = 1006; // Access Control blocks emergency call service public static final int CS_REJECT_CAUSE_ENABLED = 2001; // Notify MM rejection cause public static final int CS_REJECT_CAUSE_DISABLED = 2002; // Cancel MM rejection cause /** Notification id. */ public static final int PS_NOTIFICATION = 888; // Id to update and cancel PS restricted public static final int CS_NOTIFICATION = 999; // Id to update and cancel CS restricted Loading Loading @@ -1308,6 +1316,11 @@ public class ServiceStateTracker extends Handler { } break; case EVENT_SIM_NOT_INSERTED: if (DBG) log("EVENT_SIM_NOT_INSERTED, cancelling notifications."); cancelAllNotifications(); break; case EVENT_ALL_DATA_DISCONNECTED: int dds = SubscriptionManager.getDefaultDataSubscriptionId(); ProxyController.getInstance().unregisterForAllDataDisconnected(dds, this); Loading Loading @@ -2840,7 +2853,7 @@ public class ServiceStateTracker extends Handler { } if (hasRejectCauseChanged) { setNotification(mRejectCode == 0 ? CS_REJECT_CAUSE_DISABLED : CS_REJECT_CAUSE_ENABLED); setNotification(CS_REJECT_CAUSE_ENABLED); } if (hasChanged) { Loading Loading @@ -3847,6 +3860,17 @@ public class ServiceStateTracker extends Handler { } } /** * Cancels all notifications posted to NotificationManager. These notifications for restricted * state and rejection cause for cs registration are no longer valid after the SIM has been * removed. */ private void cancelAllNotifications() { NotificationManager notificationManager = (NotificationManager) mPhone.getContext().getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancelAll(); } /** * Post a notification to NotificationManager for restricted state and * rejection cause for cs registration Loading Loading @@ -3922,17 +3946,14 @@ public class ServiceStateTracker extends Handler { notificationId = CS_REJECT_CAUSE_NOTIFICATION; int resId = selectResourceForRejectCode(mRejectCode); if (0 == resId) { // cancel notification because current reject code is not handled. notifyType = CS_REJECT_CAUSE_DISABLED; loge("setNotification: mRejectCode=" + mRejectCode + " is not handled."); return; } else { icon = com.android.internal.R.drawable.stat_notify_mmcc_indication_icn; title = Resources.getSystem().getString(resId); details = null; } break; case CS_REJECT_CAUSE_DISABLED: notificationId = CS_REJECT_CAUSE_NOTIFICATION; break; } if (DBG) { Loading @@ -3955,8 +3976,7 @@ public class ServiceStateTracker extends Handler { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (notifyType == PS_DISABLED || notifyType == CS_DISABLED || notifyType == CS_REJECT_CAUSE_DISABLED) { if (notifyType == PS_DISABLED || notifyType == CS_DISABLED) { // cancel previous post notification notificationManager.cancel(notificationId); } else { Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +29 −9 Original line number Diff line number Diff line Loading @@ -210,6 +210,7 @@ public class ServiceStateTracker extends Handler { protected static final int EVENT_ALL_DATA_DISCONNECTED = 49; protected static final int EVENT_PHONE_TYPE_SWITCHED = 50; protected static final int EVENT_RADIO_POWER_FROM_CARRIER = 51; protected static final int EVENT_SIM_NOT_INSERTED = 52; protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; Loading Loading @@ -354,6 +355,14 @@ public class ServiceStateTracker extends Handler { } // update voicemail count and notify message waiting changed mPhone.updateVoiceMail(); // cancel notifications if we see SIM_NOT_INSERTED (This happens on bootup before // the SIM is first detected and then subsequently on SIM removals) if (mSubscriptionController.getSlotIndex(subId) == SubscriptionManager.SIM_NOT_INSERTED) { // this is handled on the main thread to mitigate racing with setNotification(). sendMessage(obtainMessage(EVENT_SIM_NOT_INSERTED)); } } } }; Loading Loading @@ -446,7 +455,6 @@ public class ServiceStateTracker extends Handler { public static final int CS_NORMAL_ENABLED = 1005; // Access Control blocks normal voice/sms service public static final int CS_EMERGENCY_ENABLED = 1006; // Access Control blocks emergency call service public static final int CS_REJECT_CAUSE_ENABLED = 2001; // Notify MM rejection cause public static final int CS_REJECT_CAUSE_DISABLED = 2002; // Cancel MM rejection cause /** Notification id. */ public static final int PS_NOTIFICATION = 888; // Id to update and cancel PS restricted public static final int CS_NOTIFICATION = 999; // Id to update and cancel CS restricted Loading Loading @@ -1308,6 +1316,11 @@ public class ServiceStateTracker extends Handler { } break; case EVENT_SIM_NOT_INSERTED: if (DBG) log("EVENT_SIM_NOT_INSERTED, cancelling notifications."); cancelAllNotifications(); break; case EVENT_ALL_DATA_DISCONNECTED: int dds = SubscriptionManager.getDefaultDataSubscriptionId(); ProxyController.getInstance().unregisterForAllDataDisconnected(dds, this); Loading Loading @@ -2840,7 +2853,7 @@ public class ServiceStateTracker extends Handler { } if (hasRejectCauseChanged) { setNotification(mRejectCode == 0 ? CS_REJECT_CAUSE_DISABLED : CS_REJECT_CAUSE_ENABLED); setNotification(CS_REJECT_CAUSE_ENABLED); } if (hasChanged) { Loading Loading @@ -3847,6 +3860,17 @@ public class ServiceStateTracker extends Handler { } } /** * Cancels all notifications posted to NotificationManager. These notifications for restricted * state and rejection cause for cs registration are no longer valid after the SIM has been * removed. */ private void cancelAllNotifications() { NotificationManager notificationManager = (NotificationManager) mPhone.getContext().getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancelAll(); } /** * Post a notification to NotificationManager for restricted state and * rejection cause for cs registration Loading Loading @@ -3922,17 +3946,14 @@ public class ServiceStateTracker extends Handler { notificationId = CS_REJECT_CAUSE_NOTIFICATION; int resId = selectResourceForRejectCode(mRejectCode); if (0 == resId) { // cancel notification because current reject code is not handled. notifyType = CS_REJECT_CAUSE_DISABLED; loge("setNotification: mRejectCode=" + mRejectCode + " is not handled."); return; } else { icon = com.android.internal.R.drawable.stat_notify_mmcc_indication_icn; title = Resources.getSystem().getString(resId); details = null; } break; case CS_REJECT_CAUSE_DISABLED: notificationId = CS_REJECT_CAUSE_NOTIFICATION; break; } if (DBG) { Loading @@ -3955,8 +3976,7 @@ public class ServiceStateTracker extends Handler { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (notifyType == PS_DISABLED || notifyType == CS_DISABLED || notifyType == CS_REJECT_CAUSE_DISABLED) { if (notifyType == PS_DISABLED || notifyType == CS_DISABLED) { // cancel previous post notification notificationManager.cancel(notificationId); } else { Loading