summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-09-14 07:06:15 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-09-14 07:06:15 +0000
commit6428e1e19b96485dd9b2d226d7c71cc8c5951284 (patch)
tree9314fd0e6e5a4ee715124727c997afba9c1a55a3
parentd8f9cd52f9803495130459544540fb65e0eb31fd (diff)
parent5f805a259ca004e65c6b9091b05f5af5220ccd84 (diff)
downloadInCallUI-6428e1e19b96485dd9b2d226d7c71cc8c5951284.tar.gz
am 5f805a25: am d3c0ca0b: Merge "Display no-caller ID reason in InCallUI" into mnc-dr-dev
* commit '5f805a259ca004e65c6b9091b05f5af5220ccd84': Display no-caller ID reason in InCallUI
-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();
}