summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-09-13 18:19:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-09-13 18:19:09 +0000
commitd3c0ca0b8bc6d147abc8c0ff357ab0d833f10cd5 (patch)
treed6710c58ec9396cf28f907bd53f30fe02a8b4f47
parent1f2b086996855848f45408fb961acdcdf61d08cf (diff)
parente234ef87d85f738fbd2af7379014ac3ce16f1d51 (diff)
downloadInCallUI-d3c0ca0b8bc6d147abc8c0ff357ab0d833f10cd5.tar.gz
Merge "Display no-caller ID reason in InCallUI" into mnc-dr-dev
-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();
}