diff options
Diffstat (limited to 'java/com/android/incallui/call/CallList.java')
-rw-r--r-- | java/com/android/incallui/call/CallList.java | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index 34f0cc0d7..d0931dd3d 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -32,6 +32,8 @@ import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.blocking.FilteredNumbersUtil; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; +import com.android.dialer.enrichedcall.EnrichedCallComponent; +import com.android.dialer.enrichedcall.EnrichedCallManager; import com.android.dialer.location.GeoUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; @@ -112,11 +114,16 @@ public class CallList implements DialerCallDelegate { public void onCallAdded( final Context context, final android.telecom.Call telecomCall, LatencyReport latencyReport) { - Trace.beginSection("onCallAdded"); + Trace.beginSection("CallList.onCallAdded"); final DialerCall call = new DialerCall(context, this, telecomCall, latencyReport, true /* registerCallback */); logSecondIncomingCall(context, call); + EnrichedCallManager manager = EnrichedCallComponent.get(context).getEnrichedCallManager(); + manager.registerCapabilitiesListener(call); + manager.registerStateChangedListener(call); + + Trace.beginSection("checkSpam"); final DialerCallListenerImpl dialerCallListener = new DialerCallListenerImpl(call); call.addListener(dialerCallListener); LogUtil.d("CallList.onCallAdded", "callState=" + call.getState()); @@ -163,7 +170,9 @@ public class CallList implements DialerCallDelegate { updateUserMarkedSpamStatus(call, context, number, dialerCallListener); } + Trace.endSection(); + Trace.beginSection("checkBlock"); FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(context); @@ -179,6 +188,7 @@ public class CallList implements DialerCallDelegate { }, call.getNumber(), GeoUtil.getCurrentCountryIso(context)); + Trace.endSection(); if (call.getState() == DialerCall.State.INCOMING || call.getState() == DialerCall.State.CALL_WAITING) { @@ -278,6 +288,10 @@ public class CallList implements DialerCallDelegate { DialerCall call = mCallByTelecomCall.get(telecomCall); Assert.checkArgument(!call.isExternalCall()); + EnrichedCallManager manager = EnrichedCallComponent.get(context).getEnrichedCallManager(); + manager.unregisterCapabilitiesListener(call); + manager.unregisterStateChangedListener(call); + // Don't log an already logged call. logCall() might be called multiple times // for the same call due to b/24109437. if (call.getLogState() != null && !call.getLogState().isLogged) { @@ -289,6 +303,8 @@ public class CallList implements DialerCallDelegate { LogUtil.w( "CallList.onCallRemoved", "Removing call not previously disconnected " + call.getId()); } + + call.onRemovedFromCallList(); } if (!hasLiveCall()) { @@ -341,6 +357,7 @@ public class CallList implements DialerCallDelegate { /** Called when a single call has changed. */ private void onIncoming(DialerCall call) { + Trace.beginSection("CallList.onIncoming"); if (updateCallInMap(call)) { LogUtil.i("CallList.onIncoming", String.valueOf(call)); } @@ -348,6 +365,7 @@ public class CallList implements DialerCallDelegate { for (Listener listener : mListeners) { listener.onIncomingCall(call); } + Trace.endSection(); } public void addListener(@NonNull Listener listener) { @@ -518,6 +536,22 @@ public class CallList implements DialerCallDelegate { } /** + * Return if there is any active or background call which was not a parent call (never had a child + * call) + */ + public boolean hasNonParentActiveOrBackgroundCall() { + for (DialerCall call : mCallById.values()) { + if ((call.getState() == State.ACTIVE + || call.getState() == State.ONHOLD + || call.getState() == State.CONFERENCED) + && !call.wasParentCall()) { + return true; + } + } + return false; + } + + /** * This is called when the service disconnects, either expectedly or unexpectedly. For the * expected case, it's because we have no calls left. For the unexpected case, it is likely a * crash of phone and we need to clean up our calls manually. Without phone, there can be no @@ -556,7 +590,9 @@ public class CallList implements DialerCallDelegate { * * @param call The call to update. */ - private void onUpdateCall(DialerCall call) { + @VisibleForTesting + void onUpdateCall(DialerCall call) { + Trace.beginSection("CallList.onUpdateCall"); LogUtil.d("CallList.onUpdateCall", String.valueOf(call)); if (!mCallById.containsKey(call.getId()) && call.isExternalCall()) { // When a regular call becomes external, it is removed from the call list, and there may be @@ -569,6 +605,7 @@ public class CallList implements DialerCallDelegate { if (updateCallInMap(call)) { LogUtil.i("CallList.onUpdateCall", String.valueOf(call)); } + Trace.endSection(); } /** @@ -593,6 +630,7 @@ public class CallList implements DialerCallDelegate { * @return false if no call previously existed and no call was added, otherwise true. */ private boolean updateCallInMap(DialerCall call) { + Trace.beginSection("CallList.updateCallInMap"); Objects.requireNonNull(call); boolean updated = false; @@ -622,6 +660,7 @@ public class CallList implements DialerCallDelegate { updated = true; } + Trace.endSection(); return updated; } @@ -751,7 +790,7 @@ public class CallList implements DialerCallDelegate { @Override public void onDialerCallUpdate() { - Trace.beginSection("onUpdate"); + Trace.beginSection("CallList.onDialerCallUpdate"); onUpdateCall(mCall); notifyGenericListeners(); Trace.endSection(); @@ -793,6 +832,9 @@ public class CallList implements DialerCallDelegate { } @Override + public void onEnrichedCallSessionUpdate() {} + + @Override public void onDialerCallSessionModificationStateChange() { for (Listener listener : mListeners) { listener.onSessionModificationStateChange(mCall); |