summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-09-09 15:30:32 -0700
committerRoshan Pius <rpius@google.com>2015-09-10 09:41:11 -0700
commite234ef87d85f738fbd2af7379014ac3ce16f1d51 (patch)
tree0828826487e6636499f1da617829b419253bdf85
parent46e581fa8b4ae7a9c58441d39c080252a1eb60af (diff)
downloadInCallUI-e234ef87d85f738fbd2af7379014ac3ce16f1d51.tar.gz
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--src/com/android/incallui/CallCardPresenter.java3
-rw-r--r--src/com/android/incallui/CallerInfo.java6
-rw-r--r--src/com/android/incallui/CallerInfoUtils.java1
-rw-r--r--src/com/android/incallui/ContactInfoCache.java26
-rw-r--r--src/com/android/incallui/StatusBarNotifier.java4
5 files changed, 29 insertions, 11 deletions
diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java
index 6961e8a2..6c2b6b6c 100644
--- a/src/com/android/incallui/CallCardPresenter.java
+++ b/src/com/android/incallui/CallCardPresenter.java
@@ -920,7 +920,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
boolean isIncomingOrWaiting = mPrimary.getState() == Call.State.INCOMING ||
mPrimary.getState() == Call.State.CALL_WAITING;
- return isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject());
+ return isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject()) &&
+ call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED;
}
/**
diff --git a/src/com/android/incallui/CallerInfo.java b/src/com/android/incallui/CallerInfo.java
index 88d1be1a..2f0fc833 100644
--- a/src/com/android/incallui/CallerInfo.java
+++ b/src/com/android/incallui/CallerInfo.java
@@ -141,6 +141,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/src/com/android/incallui/CallerInfoUtils.java b/src/com/android/incallui/CallerInfoUtils.java
index 21e492b7..681f273a 100644
--- a/src/com/android/incallui/CallerInfoUtils.java
+++ b/src/com/android/incallui/CallerInfoUtils.java
@@ -58,6 +58,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/src/com/android/incallui/ContactInfoCache.java b/src/com/android/incallui/ContactInfoCache.java
index 73209742..0206e0a4 100644
--- a/src/com/android/incallui/ContactInfoCache.java
+++ b/src/com/android/incallui/ContactInfoCache.java
@@ -442,13 +442,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.
@@ -485,7 +485,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 {
@@ -530,14 +530,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;
}
diff --git a/src/com/android/incallui/StatusBarNotifier.java b/src/com/android/incallui/StatusBarNotifier.java
index e583434d..3a3cb376 100644
--- a/src/com/android/incallui/StatusBarNotifier.java
+++ b/src/com/android/incallui/StatusBarNotifier.java
@@ -29,6 +29,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.telecom.Call.Details;
import android.telecom.PhoneAccount;
+import android.telecom.TelecomManager;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
@@ -425,7 +426,8 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
boolean isIncomingOrWaiting = call.getState() == Call.State.INCOMING ||
call.getState() == Call.State.CALL_WAITING;
- if (isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject())) {
+ if (isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject()) &&
+ call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED) {
return call.getCallSubject();
}