summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-09-09 15:30:32 -0700
committerJay Shrauner <shrauner@google.com>2016-01-11 10:28:57 -0800
commit699fc20598c9dd933ba1c8be0e3cb7992ef71aad (patch)
treebe710c40e3882fdb4415312d9d6ba8c148da9a29
parent88599c8292f04513519f3871510608993f8e9bc6 (diff)
DO NOT MERGE Display no-caller ID reason in InCallUI
Changes to fetch the no-caller ID reason from callsubject extra in the call object to display in the InCall UI. The callsubject extra would be populated by the RIL to hold the non-caller ID reason in case of number presentation that is set to RESTRICTED/UNKOWN and hence we need to differentiate the contents of this extra in InCallUI. PS: We should ideally be creating a different extra for the no-caller ID reason at telephony layer even if RIL sends it in the same exta as call subject, but that would require API changes. BUG: 22683773 Change-Id: I4ae51754d7660e4b8c1082d142e2c1860d3f1604
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfo.java6
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfoUtils.java1
-rw-r--r--InCallUI/src/com/android/incallui/ContactInfoCache.java26
3 files changed, 24 insertions, 9 deletions
diff --git a/InCallUI/src/com/android/incallui/CallerInfo.java b/InCallUI/src/com/android/incallui/CallerInfo.java
index f11ea850b..4ea4970a3 100644
--- a/InCallUI/src/com/android/incallui/CallerInfo.java
+++ b/InCallUI/src/com/android/incallui/CallerInfo.java
@@ -148,6 +148,12 @@ public class CallerInfo {
*/
public boolean isCachedPhotoCurrent;
+ /**
+ * String which holds the call subject sent as extra from the lower layers for this call. This
+ * is used to display the no-caller ID reason for restricted/unknown number presentation.
+ */
+ public String callSubject;
+
private boolean mIsEmergency;
private boolean mIsVoiceMail;
diff --git a/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java
index 26542c384..31fc9f1e6 100644
--- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java
+++ b/InCallUI/src/com/android/incallui/CallerInfoUtils.java
@@ -62,6 +62,7 @@ public class CallerInfoUtils {
info.name = info.cnapName;
info.numberPresentation = call.getNumberPresentation();
info.namePresentation = call.getCnapNamePresentation();
+ info.callSubject = call.getCallSubject();
String number = call.getNumber();
if (!TextUtils.isEmpty(number)) {
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java
index 6bbe52f46..9894f5532 100644
--- a/InCallUI/src/com/android/incallui/ContactInfoCache.java
+++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java
@@ -490,13 +490,13 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
if (TextUtils.isEmpty(number)) {
// No name *or* number! Display a generic "unknown" string
// (or potentially some other default based on the presentation.)
- displayName = getPresentationString(context, presentation);
+ displayName = getPresentationString(context, presentation, info.callSubject);
Log.d(TAG, " ==> no name *or* number! displayName = " + displayName);
} else if (presentation != TelecomManager.PRESENTATION_ALLOWED) {
// This case should never happen since the network should never send a phone #
// AND a restricted presentation. However we leave it here in case of weird
// network behavior
- displayName = getPresentationString(context, presentation);
+ displayName = getPresentationString(context, presentation, info.callSubject);
Log.d(TAG, " ==> presentation not allowed! displayName = " + displayName);
} else if (!TextUtils.isEmpty(info.cnapName)) {
// No name, but we do have a valid CNAP name, so use that.
@@ -533,7 +533,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
// This case should never happen since the network should never send a name
// AND a restricted presentation. However we leave it here in case of weird
// network behavior
- displayName = getPresentationString(context, presentation);
+ displayName = getPresentationString(context, presentation, info.callSubject);
Log.d(TAG, " ==> valid name, but presentation not allowed!" +
" displayName = " + displayName);
} else {
@@ -594,14 +594,22 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
}
/**
- * Gets name strings based on some special presentation modes.
+ * Gets name strings based on some special presentation modes and the associated custom label.
*/
- private static String getPresentationString(Context context, int presentation) {
+ private static String getPresentationString(Context context, int presentation,
+ String customLabel) {
String name = context.getString(R.string.unknown);
- if (presentation == TelecomManager.PRESENTATION_RESTRICTED) {
- name = context.getString(R.string.private_num);
- } else if (presentation == TelecomManager.PRESENTATION_PAYPHONE) {
- name = context.getString(R.string.payphone);
+ if (!TextUtils.isEmpty(customLabel) &&
+ ((presentation == TelecomManager.PRESENTATION_UNKNOWN) ||
+ (presentation == TelecomManager.PRESENTATION_RESTRICTED))) {
+ name = customLabel;
+ return name;
+ } else {
+ if (presentation == TelecomManager.PRESENTATION_RESTRICTED) {
+ name = context.getString(R.string.private_num);
+ } else if (presentation == TelecomManager.PRESENTATION_PAYPHONE) {
+ name = context.getString(R.string.payphone);
+ }
}
return name;
}