diff options
author | Android Dialer <noreply@google.com> | 2018-02-01 16:12:25 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-01 16:14:28 -0800 |
commit | 974fc2903d4ecd0d8392a02b988982d24a2e93f4 (patch) | |
tree | 31b457317a4182d97f3dc23d20591e159e3a5501 /java | |
parent | dd7a9f624953ff74edf8beab7903091097749080 (diff) |
internal change
Bug: 68825005
Test: Added unit tests on CallFeedbackListenerImpl, CallFeedbackNotificationManager and DialerCall. Also manually verified the change.
PiperOrigin-RevId: 184211115
Change-Id: I50927036c3cd5d47862704376e2eef108c473fbf
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/incallui/CallCardPresenter.java | 7 | ||||
-rw-r--r-- | java/com/android/incallui/InCallServiceImpl.java | 8 | ||||
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 12 |
3 files changed, 19 insertions, 8 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index bdbbe8f7c..da5d1a8dd 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -48,7 +48,6 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.ActivityCompat; import com.android.dialer.configprovider.ConfigProviderBindings; -import com.android.dialer.feedback.FeedbackComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.multimedia.MultimediaData; @@ -154,11 +153,6 @@ public class CallCardPresenter return !TextUtils.isEmpty(call.getCallSubject()); } - private void addCallFeedbackListener(Context context) { - LogUtil.d("CallCardPresenter.addCallFeedbackListener", "Adding call feedback listener"); - CallList.getInstance().addListener(FeedbackComponent.get(context).getCallFeedbackListener()); - } - @Override public void onInCallScreenDelegateInit(InCallScreen inCallScreen) { Assert.isNotNull(inCallScreen); @@ -173,7 +167,6 @@ public class CallCardPresenter this.inCallScreen.showNoteSentToast(); } call.addListener(this); - addCallFeedbackListener(context); // start processing lookups right away. if (!call.isConferenceCall()) { startContactInfoSearch(call, true, call.getState() == DialerCall.State.INCOMING); diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java index 539dba8dd..1cb6c478e 100644 --- a/java/com/android/incallui/InCallServiceImpl.java +++ b/java/com/android/incallui/InCallServiceImpl.java @@ -24,6 +24,7 @@ import android.telecom.Call; import android.telecom.CallAudioState; import android.telecom.InCallService; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; +import com.android.dialer.feedback.FeedbackComponent; import com.android.incallui.audiomode.AudioModeProvider; import com.android.incallui.call.CallList; import com.android.incallui.call.ExternalCallList; @@ -39,6 +40,7 @@ public class InCallServiceImpl extends InCallService { private ReturnToCallController returnToCallController; private NewReturnToCallController newReturnToCallController; + private CallList.Listener feedbackListener; @Override public void onCallAudioStateChanged(CallAudioState audioState) { @@ -102,6 +104,8 @@ public class InCallServiceImpl extends InCallService { newReturnToCallController = new NewReturnToCallController(this, ContactInfoCache.getInstance(context)); } + feedbackListener = FeedbackComponent.get(context).getCallFeedbackListener(); + CallList.getInstance().addListener(feedbackListener); IBinder iBinder = super.onBind(intent); Trace.endSection(); @@ -134,6 +138,10 @@ public class InCallServiceImpl extends InCallService { newReturnToCallController.tearDown(); newReturnToCallController = null; } + if (feedbackListener != null) { + CallList.getInstance().removeListener(feedbackListener); + feedbackListener = null; + } Trace.endSection(); } } diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index e581ba3b0..1785eceb4 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -173,6 +173,8 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa private List<PhoneAccountHandle> callCapableAccounts; private String countryIso; + private volatile boolean feedbackRequested = false; + public static String getNumberFromHandle(Uri handle) { return handle == null ? "" : handle.getSchemeSpecificPart(); } @@ -438,7 +440,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa /* package-private */ Call getTelecomCall() { return telecomCall; } - + public StatusHints getStatusHints() { return telecomCall.getDetails().getStatusHints(); } @@ -1450,6 +1452,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa return selectedAvailableVideoTechType; } + public void markFeedbackRequested() { + feedbackRequested = true; + } + + public boolean isFeedbackRequested() { + return feedbackRequested; + } + /** * Specifies whether a number is in the call history or not. {@link #CALL_HISTORY_STATUS_UNKNOWN} * means there is no result. |