Skip to content

Commit 131ecf2

Browse files
committed
Add support for Caller Name Display
Copied relevant parts from CdmaConnection.java to get the information as/if presented by network operator (Fido/Rogers in canada provide that information, and it get displayed if there's no match in phonebook). Although it works (the nale is displayed when the call is received), the information is not stored (not kept in the log). * Patch Set 2 : correct coding style * Patch Set 3 : promote [get]cnapName, [get]cnapNapePresentation to parent class (Connection) * Patch Set 4 : -remove ref to CDMA in get[CnapName|CnapNamePresentation] headers -remove unnecessary self ref-reference * Patch Set 5 : -add forgoten "protected" modifier to newly promoted class memebers Change-Id: I2279f75d679d5afa716d9904fc3b3e33c77948c6
1 parent 0748a56 commit 131ecf2

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

telephony/java/com/android/internal/telephony/Connection.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public abstract class Connection {
2828
public static int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
2929
public static int PRESENTATION_PAYPHONE = 4; // show pay phone info
3030

31+
//Caller Name Display
32+
protected String cnapName;
33+
protected int cnapNamePresentation = PRESENTATION_ALLOWED;
34+
3135
private static String LOG_TAG = "TelephonyConnection";
3236

3337
public enum DisconnectCause {
@@ -84,11 +88,11 @@ public enum DisconnectCause {
8488
public abstract String getAddress();
8589

8690
/**
87-
* Gets CDMA CNAP name associated with connection.
91+
* Gets CNAP name associated with connection.
8892
* @return cnap name or null if unavailable
8993
*/
9094
public String getCnapName() {
91-
return null;
95+
return cnapName;
9296
}
9397

9498
/**
@@ -100,12 +104,12 @@ public String getOrigDialString(){
100104
}
101105

102106
/**
103-
* Gets CDMA CNAP presentation associated with connection.
107+
* Gets CNAP presentation associated with connection.
104108
* @return cnap name or null if unavailable
105109
*/
106110

107111
public int getCnapNamePresentation() {
108-
return 0;
112+
return cnapNamePresentation;
109113
};
110114

111115
/**

telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public class CdmaConnection extends Connection {
5050
String postDialString; // outgoing calls only
5151
boolean isIncoming;
5252
boolean disconnected;
53-
String cnapName;
5453
int index; // index in CdmaCallTracker.connections[], -1 if unassigned
5554

5655
/*
@@ -76,7 +75,6 @@ public class CdmaConnection extends Connection {
7675
DisconnectCause cause = DisconnectCause.NOT_DISCONNECTED;
7776
PostDialState postDialState = PostDialState.NOT_STARTED;
7877
int numberPresentation = Connection.PRESENTATION_ALLOWED;
79-
int cnapNamePresentation = Connection.PRESENTATION_ALLOWED;
8078

8179

8280
Handler h;
@@ -229,14 +227,6 @@ public String getAddress() {
229227
return address;
230228
}
231229

232-
public String getCnapName() {
233-
return cnapName;
234-
}
235-
236-
public int getCnapNamePresentation() {
237-
return cnapNamePresentation;
238-
}
239-
240230
public CdmaCall getCall() {
241231
return parent;
242232
}

telephony/java/com/android/internal/telephony/gsm/GsmConnection.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.util.Log;
2727
import android.telephony.PhoneNumberUtils;
2828
import android.telephony.ServiceState;
29+
import android.text.TextUtils;
2930

3031
import com.android.internal.telephony.*;
3132

@@ -125,6 +126,8 @@ class MyHandler extends Handler {
125126

126127
isIncoming = dc.isMT;
127128
createTime = System.currentTimeMillis();
129+
cnapName = dc.name;
130+
cnapNamePresentation = dc.namePresentation;
128131
numberPresentation = dc.numberPresentation;
129132
uusInfo = dc.uusInfo;
130133

@@ -151,6 +154,9 @@ class MyHandler extends Handler {
151154
index = -1;
152155

153156
isIncoming = false;
157+
cnapName = null;
158+
cnapNamePresentation = Connection.PRESENTATION_ALLOWED;
159+
numberPresentation = Connection.PRESENTATION_ALLOWED;
154160
createTime = System.currentTimeMillis();
155161

156162
this.parent = parent;
@@ -437,6 +443,21 @@ public void cancelPostDial() {
437443
changed = true;
438444
}
439445

446+
// A null cnapName should be the same as ""
447+
if (TextUtils.isEmpty(dc.name)) {
448+
if (!TextUtils.isEmpty(cnapName)) {
449+
changed = true;
450+
cnapName = "";
451+
}
452+
} else if (!dc.name.equals(cnapName)) {
453+
changed = true;
454+
cnapName = dc.name;
455+
}
456+
457+
if (Phone.DEBUG_PHONE) log("--dssds----"+cnapName);
458+
cnapNamePresentation = dc.namePresentation;
459+
numberPresentation = dc.numberPresentation;
460+
440461
if (newParent != parent) {
441462
if (parent != null) {
442463
parent.detach(this);

0 commit comments

Comments
 (0)