Merge "Fix issue of hearing ring sound twice." am: 97e43b238c
am: 4cce509175
Change-Id: I1335bd63a1cad1bc889d37e7b6fad295d259ce78
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index d084e92..1a7a1d1 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -105,6 +105,10 @@
// they don't step on each others' toes.
public static final int INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE = 22;
+ public static final int UPDATE_TYPE_MWI = 0;
+ public static final int UPDATE_TYPE_CFI = 1;
+ public static final int UPDATE_TYPE_MWI_CFI = 2;
+
/**
* Initialize the singleton CallNotifier instance.
* This is only done once, at startup, from PhoneApp.onCreate().
@@ -578,6 +582,11 @@
}
public void updatePhoneStateListeners(boolean isRefresh) {
+ updatePhoneStateListeners(isRefresh, UPDATE_TYPE_MWI_CFI,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+ }
+
+ public void updatePhoneStateListeners(boolean isRefresh, int updateType, int subIdToUpdate) {
List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList();
// Sort sub id list based on slot id, so that CFI/MWI notifications will be updated for
@@ -609,10 +618,20 @@
Log.d(LOG_TAG, "updatePhoneStateListeners: update CF notifications.");
if (mCFIStatus.containsKey(subId)) {
- mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId));
+ if ((updateType == UPDATE_TYPE_CFI) && (subId == subIdToUpdate)) {
+ mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId),
+ isRefresh);
+ } else {
+ mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId), true);
+ }
}
if (mMWIStatus.containsKey(subId)) {
- mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId), isRefresh);
+ if ((updateType == UPDATE_TYPE_MWI) && (subId == subIdToUpdate)) {
+ mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId),
+ isRefresh);
+ } else {
+ mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId), true);
+ }
}
}
}
@@ -785,7 +804,7 @@
public void onMessageWaitingIndicatorChanged(boolean visible) {
if (VDBG) log("onMessageWaitingIndicatorChanged(): " + this.mSubId + " " + visible);
mMWIStatus.put(this.mSubId, visible);
- updatePhoneStateListeners(false);
+ updatePhoneStateListeners(false, UPDATE_TYPE_MWI, this.mSubId);
}
@Override
@@ -793,7 +812,7 @@
Log.i(LOG_TAG, "onCallForwardingIndicatorChanged(): subId=" + this.mSubId
+ ", visible=" + (visible ? "Y" : "N"));
mCFIStatus.put(this.mSubId, visible);
- updatePhoneStateListeners(false);
+ updatePhoneStateListeners(false, UPDATE_TYPE_CFI, this.mSubId);
}
};
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index dd8bc23..97daa34 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -444,9 +444,19 @@
/**
* Updates the message call forwarding indicator notification.
*
- * @param visible true if there are messages waiting
+ * @param visible true if call forwarding enabled
*/
- /* package */ void updateCfi(int subId, boolean visible) {
+
+ /* package */ void updateCfi(int subId, boolean visible) {
+ updateCfi(subId, visible, false /* isRefresh */);
+ }
+
+ /**
+ * Updates the message call forwarding indicator notification.
+ *
+ * @param visible true if call forwarding enabled
+ */
+ /* package */ void updateCfi(int subId, boolean visible, boolean isRefresh) {
logi("updateCfi: subId= " + subId + ", visible=" + (visible ? "Y" : "N"));
if (visible) {
// If Unconditional Call Forwarding (forward all calls) for VOICE
@@ -484,7 +494,8 @@
.setContentText(mContext.getString(R.string.sum_cfu_enabled_indicator))
.setShowWhen(false)
.setOngoing(true)
- .setChannel(NotificationChannelController.CHANNEL_ID_CALL_FORWARD);
+ .setChannel(NotificationChannelController.CHANNEL_ID_CALL_FORWARD)
+ .setOnlyAlertOnce(isRefresh);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);