Use CallerInfo correctly in Telecomm
Remove unused ContactInfo class
Pipe CallerInfo through to CallLogManager.addCall, and correctly
update data usage stats to fix speed dial.
Bug: 16232694
Bug: 15665694
Change-Id: Ibed9f53193b64891bffff30fd37b47062ab60048
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index 4055444..0035aac 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -943,6 +943,10 @@
}
}
+ CallerInfo getCallerInfo() {
+ return mCallerInfo;
+ }
+
/**
* Saves the specified photo information if the specified token matches that of the last query.
*
diff --git a/src/com/android/telecomm/CallActivity.java b/src/com/android/telecomm/CallActivity.java
index 0e66d32..4766310 100644
--- a/src/com/android/telecomm/CallActivity.java
+++ b/src/com/android/telecomm/CallActivity.java
@@ -90,9 +90,8 @@
* @param intent Call intent containing data about the handle to call.
*/
private void processOutgoingCallIntent(Intent intent) {
- ContactInfo contactInfo = null;
NewOutgoingCallIntentBroadcaster broadcaster =
- new NewOutgoingCallIntentBroadcaster(mCallsManager, contactInfo, intent);
+ new NewOutgoingCallIntentBroadcaster(mCallsManager, intent);
broadcaster.processIntent();
}
diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java
index 712551e..cf7e7ae 100644
--- a/src/com/android/telecomm/CallLogManager.java
+++ b/src/com/android/telecomm/CallLogManager.java
@@ -24,6 +24,7 @@
import android.telecomm.PhoneAccount;
import android.telephony.PhoneNumberUtils;
+import com.android.internal.telephony.CallerInfo;
import com.android.internal.telephony.PhoneConstants;
/**
@@ -48,11 +49,11 @@
* @param durationInMillis Duration of the call (milliseconds).
* @param dataUsage Data usage in bytes, or null if not applicable.
*/
- public AddCallArgs(Context context, ContactInfo contactInfo, String number,
+ public AddCallArgs(Context context, CallerInfo callerInfo, String number,
int presentation, int callType, int features, PhoneAccount account,
long creationDate, long durationInMillis, Long dataUsage) {
this.context = context;
- this.contactInfo = contactInfo;
+ this.callerInfo = callerInfo;
this.number = number;
this.presentation = presentation;
this.callType = callType;
@@ -65,7 +66,7 @@
// Since the members are accessed directly, we don't use the
// mXxxx notation.
public final Context context;
- public final ContactInfo contactInfo;
+ public final CallerInfo callerInfo;
public final String number;
public final int presentation;
public final int callType;
@@ -112,24 +113,22 @@
final long creationTime = call.getCreationTimeMillis();
final long age = call.getAgeMillis();
- // TODO(santoscordon): Replace with use of call.getCallerInfo() or similar.
- final ContactInfo contactInfo = null;
final String logNumber = getLogNumber(call);
Log.d(TAG, "logNumber set to: %s", Log.pii(logNumber));
- final int presentation = getPresentation(call, contactInfo);
+ final int presentation = getPresentation(call);
final PhoneAccount account = call.getPhoneAccount();
// TODO: Once features and data usage are available, wire them up here.
- logCall(contactInfo, logNumber, presentation, callLogType, Calls.FEATURES_NONE, account,
- creationTime, age, null);
+ logCall(call.getCallerInfo(), logNumber, presentation, callLogType, Calls.FEATURES_NONE,
+ account, creationTime, age, null);
}
/**
* Inserts a call into the call log, based on the parameters passed in.
*
- * @param contactInfo Caller details.
+ * @param callerInfo Caller details.
* @param number The number the call was made to or from.
* @param presentation
* @param callType The type of call.
@@ -139,7 +138,7 @@
* @param dataUsage The data usage for the call, null if not applicable.
*/
private void logCall(
- ContactInfo contactInfo,
+ CallerInfo callerInfo,
String number,
int presentation,
int callType,
@@ -160,10 +159,10 @@
final boolean isOkToLogThisCall = !isEmergencyNumber || okToLogEmergencyNumber;
if (isOkToLogThisCall) {
- Log.d(TAG, "Logging Calllog entry: " + contactInfo + ", "
+ Log.d(TAG, "Logging Calllog entry: " + callerInfo + ", "
+ Log.pii(number) + "," + presentation + ", " + callType
+ ", " + start + ", " + duration);
- AddCallArgs args = new AddCallArgs(mContext, contactInfo, number, presentation,
+ AddCallArgs args = new AddCallArgs(mContext, callerInfo, number, presentation,
callType, features, account, start, duration, dataUsage);
logCallAsync(args);
} else {
@@ -193,8 +192,7 @@
}
/**
- * Gets the presentation from the {@link ContactInfo} if not null. Otherwise, gets it from the
- * {@link Call}.
+ * Gets the presentation from the {@link Call}.
*
* TODO: There needs to be a way to pass information from
* Connection.getNumberPresentation() into a {@link Call} object. Until then, always return
@@ -202,10 +200,9 @@
* getNumberPresentation to the ContactInfo object as well.
*
* @param call The call object to retrieve caller details from.
- * @param contactInfo The CallerInfo. May be null.
* @return The number presentation constant to insert into the call logs.
*/
- private int getPresentation(Call call, ContactInfo contactInfo) {
+ private int getPresentation(Call call) {
return PhoneConstants.PRESENTATION_ALLOWED;
}
@@ -235,7 +232,7 @@
try {
// May block.
- result[i] = Calls.addCall(null, c.context, c.number, c.presentation,
+ result[i] = Calls.addCall(c.callerInfo, c.context, c.number, c.presentation,
c.callType, c.features, c.mAccount, c.timestamp, c.durationInSec,
c.dataUsage);
} catch (Exception e) {
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 99731d7..0893d38 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -303,8 +303,8 @@
* @param speakerphoneOn Whether or not to turn the speakerphone on once the call connects.
* @param videoState The desired video state for the outgoing call.
*/
- void placeOutgoingCall(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo,
- PhoneAccount account, boolean speakerphoneOn, int videoState) {
+ void placeOutgoingCall(Uri handle, GatewayInfo gatewayInfo, PhoneAccount account,
+ boolean speakerphoneOn, int videoState) {
final Uri uriHandle = (gatewayInfo == null) ? handle : gatewayInfo.getGatewayHandle();
diff --git a/src/com/android/telecomm/ContactInfo.java b/src/com/android/telecomm/ContactInfo.java
deleted file mode 100644
index 649b34d..0000000
--- a/src/com/android/telecomm/ContactInfo.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.android.telecomm;
-
-public class ContactInfo {
-}
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
index c75e184..0b99dc6 100644
--- a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -70,13 +70,10 @@
private static final String SCHEME_SIP = "sip";
private final CallsManager mCallsManager;
- private final ContactInfo mContactInfo;
private final Intent mIntent;
- NewOutgoingCallIntentBroadcaster(CallsManager callsManager, ContactInfo contactInfo,
- Intent intent) {
+ NewOutgoingCallIntentBroadcaster(CallsManager callsManager, Intent intent) {
mCallsManager = callsManager;
- mContactInfo = contactInfo;
mIntent = intent;
}
@@ -121,8 +118,7 @@
GatewayInfo gatewayInfo = getGateWayInfoFromIntent(intent, resultHandleUri);
PhoneAccount account = getAccountFromIntent(intent);
- mCallsManager.placeOutgoingCall(resultHandleUri, mContactInfo, gatewayInfo,
- account,
+ mCallsManager.placeOutgoingCall(resultHandleUri, gatewayInfo, account,
mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
false),
mIntent.getIntExtra(TelecommConstants.EXTRA_START_CALL_WITH_VIDEO_STATE,
@@ -193,8 +189,7 @@
+ " OutgoingCallBroadcastReceiver: %s", intent);
String scheme = isUriNumber ? SCHEME_SIP : SCHEME_TEL;
mCallsManager.placeOutgoingCall(
- Uri.fromParts(scheme, handle, null), mContactInfo, null, null,
- mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
+ Uri.fromParts(scheme, handle, null), null, null, mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
false),
mIntent.getIntExtra(TelecommConstants.EXTRA_START_CALL_WITH_VIDEO_STATE,
VideoCallProfile.VIDEO_STATE_AUDIO_ONLY));