Fixes bug in CDMA phones' missed call notification
- There was inconsistency between CallNotifier and NotificationMgr in
which variable to set to "Private number" when the number has its
representation form set.
- This fixed the problem in the missed call case, but we should
re-examine our logic to set the "Private number" string in all our
projects.
Bug: 11275098
Change-Id: I5bb955ebdfa16860cfcb1494ba82789fb40d79c2
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index c9ad397..80807a2 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -802,7 +802,7 @@
if (VDBG) log("CallerInfo query complete, posting missed call notification");
mApplication.notificationMgr.notifyMissedCall(ci.name, ci.phoneNumber,
- ci.phoneLabel, ci.cachedPhoto, ci.cachedPhotoIcon,
+ ci.numberPresentation, ci.phoneLabel, ci.cachedPhoto, ci.cachedPhotoIcon,
((Long) cookie).longValue());
} else if (cookie instanceof Connection) {
final Connection c = (Connection) cookie;
@@ -1715,7 +1715,7 @@
number = PhoneUtils.modifyForSpecialCnapCases(mApplication,
ci, number, ci.numberPresentation);
}
- mApplication.notificationMgr.notifyMissedCall(name, number,
+ mApplication.notificationMgr.notifyMissedCall(name, number, ci.numberPresentation,
ci.phoneLabel, ci.cachedPhoto, ci.cachedPhotoIcon, date);
}
} else {
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 3e30798..d8a91f2 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -398,7 +398,8 @@
}
// We couldn't find person Uri, so we're sure we cannot obtain a photo.
// Call notifyMissedCall() right now.
- notifyMissedCall(n.name, n.number, n.type, null, null, n.date);
+ notifyMissedCall(n.name, n.number, n.presentation, n.type, null, null,
+ n.date);
}
if (DBG) log("closing contact cursor.");
@@ -414,7 +415,7 @@
int token, Drawable photo, Bitmap photoIcon, Object cookie) {
if (DBG) log("Finished loading image: " + photo);
NotificationInfo n = (NotificationInfo) cookie;
- notifyMissedCall(n.name, n.number, n.type, photo, photoIcon, n.date);
+ notifyMissedCall(n.name, n.number, n.presentation, n.type, photo, photoIcon, n.date);
}
/**
@@ -471,8 +472,8 @@
* should be used when non-null.
* @param date the time when the missed call happened
*/
- /* package */ void notifyMissedCall(
- String name, String number, String type, Drawable photo, Bitmap photoIcon, long date) {
+ /* package */ void notifyMissedCall(String name, String number, int presentation, String type,
+ Drawable photo, Bitmap photoIcon, long date) {
// When the user clicks this notification, we go to the call log.
final PendingIntent pendingCallLogIntent = PhoneGlobals.createPendingCallLogIntent(
@@ -542,8 +543,8 @@
// TODO: consider removing equals() checks here, and modify callers of this method instead.
if (mNumberMissedCalls == 1
&& !TextUtils.isEmpty(number)
- && !TextUtils.equals(number, mContext.getString(R.string.private_num))
- && !TextUtils.equals(number, mContext.getString(R.string.unknown))){
+ && (presentation == PhoneConstants.PRESENTATION_ALLOWED ||
+ presentation == PhoneConstants.PRESENTATION_PAYPHONE)) {
if (DBG) log("Add actions with the number " + number);
builder.addAction(R.drawable.stat_sys_phone_call,