diff options
author | Eric Erfanian <erfanian@google.com> | 2017-08-31 06:57:16 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-31 16:13:53 +0000 |
commit | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/incallui/call/CallList.java | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) |
Update Dialer source to latest internal Google revision.
Previously, Android's Dialer app was developed in an internal Google
source control system and only exported to public during AOSP drops.
The Dialer team is now switching to a public development model similar
to the telephony team.
This CL represents all internal Google changes that were committed to
Dialer between the public O release and today's tip of tree on internal
master. This CL squashes those changes into a single commit.
In subsequent changes, changes will be exported on a per-commit basis.
Test: make, flash install, run
Merged-In: I45270eaa8ce732d71a1bd84b08c7fa0e99af3160
Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8
PiperOrigin-RevId: 167068436
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); |