diff options
Diffstat (limited to 'InCallUI/src/com/android/incallui/Call.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/Call.java | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index d552ecfe5..1ad37e01a 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -21,6 +21,7 @@ import android.hardware.camera2.CameraCharacteristics; import android.net.Uri; import android.os.Bundle; import android.os.Trace; +import android.support.annotation.IntDef; import android.telecom.Call.Details; import android.telecom.Connection; import android.telecom.DisconnectCause; @@ -41,6 +42,8 @@ import com.android.contacts.common.testing.NeededForTesting; import com.android.dialer.util.IntentUtil; import com.android.incallui.util.TelecomCallUtil; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -51,6 +54,19 @@ import java.util.Objects; */ @NeededForTesting public class Call { + + /** + * Specifies whether a number is in the call history or not. + * {@link #CALL_HISTORY_STATUS_UNKNOWN} means there is no result. + */ + @IntDef({CALL_HISTORY_STATUS_UNKNOWN, CALL_HISTORY_STATUS_PRESENT, + CALL_HISTORY_STATUS_NOT_PRESENT}) + @Retention(RetentionPolicy.SOURCE) + public @interface CallHistoryStatus {} + public static final int CALL_HISTORY_STATUS_UNKNOWN = 0; + public static final int CALL_HISTORY_STATUS_PRESENT = 1; + public static final int CALL_HISTORY_STATUS_NOT_PRESENT = 2; + /* Defines different states of this call */ public static class State { public static final int INVALID = 0; @@ -359,7 +375,8 @@ public class Call { } }; - private android.telecom.Call mTelecomCall; + private final android.telecom.Call mTelecomCall; + private final LatencyReport mLatencyReport; private boolean mIsEmergencyCall; private Uri mHandle; private final String mId; @@ -381,6 +398,8 @@ public class Call { private String mLastForwardedNumber; private String mCallSubject; private PhoneAccountHandle mPhoneAccountHandle; + @CallHistoryStatus private int mCallHistoryStatus = CALL_HISTORY_STATUS_UNKNOWN; + private boolean mIsSpam; /** * Indicates whether the phone account associated with this call supports specifying a call @@ -390,7 +409,7 @@ public class Call { private long mTimeAddedMs; - private LogState mLogState = new LogState(); + private final LogState mLogState = new LogState(); /** * Used only to create mock calls for testing @@ -398,6 +417,7 @@ public class Call { @NeededForTesting Call(int state) { mTelecomCall = null; + mLatencyReport = new LatencyReport(); mId = ID_PREFIX + Integer.toString(sIdCounter++); setState(state); } @@ -406,8 +426,8 @@ public class Call { * Creates a new instance of a {@link Call}. Registers a callback for * {@link android.telecom.Call} events. */ - public Call(android.telecom.Call telecomCall) { - this(telecomCall, true /* registerCallback */); + public Call(android.telecom.Call telecomCall, LatencyReport latencyReport) { + this(telecomCall, latencyReport, true /* registerCallback */); } /** @@ -417,8 +437,10 @@ public class Call { * Intended for use when creating a {@link Call} instance for use with the * {@link ContactInfoCache}, where we do not want to register callbacks for the new call. */ - public Call(android.telecom.Call telecomCall, boolean registerCallback) { + public Call(android.telecom.Call telecomCall, LatencyReport latencyReport, + boolean registerCallback) { mTelecomCall = telecomCall; + mLatencyReport = latencyReport; mId = ID_PREFIX + Integer.toString(sIdCounter++); updateFromTelecomCall(registerCallback); @@ -977,4 +999,25 @@ public class Call { public String toSimpleString() { return super.toString(); } + + public void setCallHistoryStatus(@CallHistoryStatus int callHistoryStatus) { + mCallHistoryStatus = callHistoryStatus; + } + + @CallHistoryStatus + public int getCallHistoryStatus() { + return mCallHistoryStatus; + } + + public void setSpam(boolean isSpam) { + mIsSpam = isSpam; + } + + public boolean isSpam() { + return mIsSpam; + } + + public LatencyReport getLatencyReport() { + return mLatencyReport; + } } |