diff options
Diffstat (limited to 'java/com/android/incallui/InCallPresenter.java')
-rw-r--r-- | java/com/android/incallui/InCallPresenter.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index a1643d67c..a5ba31c50 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -34,13 +34,13 @@ import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.view.Window; import android.view.WindowManager; -import com.android.contacts.common.GeoUtil; import com.android.contacts.common.compat.CallCompat; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener; import com.android.dialer.blocking.FilteredNumbersUtil; import com.android.dialer.common.LogUtil; import com.android.dialer.enrichedcall.EnrichedCallComponent; +import com.android.dialer.location.GeoUtil; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; import com.android.dialer.postcall.PostCall; @@ -249,7 +249,7 @@ public class InCallPresenter implements CallList.Listener { private VideoSurfaceTexture mLocalVideoSurfaceTexture; private VideoSurfaceTexture mRemoteVideoSurfaceTexture; - /** Inaccessible constructor. Must use getInstance() to get this singleton. */ + /** Inaccessible constructor. Must use getRunningInstance() to get this singleton. */ @VisibleForTesting InCallPresenter() {} @@ -260,6 +260,11 @@ public class InCallPresenter implements CallList.Listener { return sInCallPresenter; } + @VisibleForTesting + public static synchronized void setInstanceForTesting(InCallPresenter inCallPresenter) { + sInCallPresenter = inCallPresenter; + } + /** * Determines whether or not a call has no valid phone accounts that can be used to make the call * with. Emergency calls do not require a phone account. @@ -762,11 +767,17 @@ public class InCallPresenter implements CallList.Listener { if (!mCallList.hasLiveCall() && !call.getLogState().isIncoming + && !isSecretCode(call.getNumber()) && !CallerInfoUtils.isVoiceMailNumber(mContext, call)) { - PostCall.onCallDisconnected(mContext, call.getNumber(), call.getTimeAddedMs()); + PostCall.onCallDisconnected(mContext, call.getNumber(), call.getConnectTimeMillis()); } } + private boolean isSecretCode(@Nullable String number) { + return number != null + && (number.length() <= 8 || number.startsWith("*#*#") || number.endsWith("#*#*")); + } + /** Given the call list, return the state in which the in-call screen should be. */ public InCallState getPotentialStateFromCallList(CallList callList) { |