diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-04-12 23:23:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-12 23:23:09 +0000 |
commit | f599b4bbf9c9c0224f64934d78f00ba6690c6c7f (patch) | |
tree | 0f1f4cc08e164cde9f891f83749edff34eb94a89 /java/com/android/incallui/call/DialerCall.java | |
parent | 9ef6d8c84b7b33e069258d41db9eef16e3d2b9fa (diff) | |
parent | d6b10d559f345eab2dd3dd89b07cfc3fd79c59bc (diff) |
Merge "Add RTT transcript to call details."
Diffstat (limited to 'java/com/android/incallui/call/DialerCall.java')
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 3372c0329..5d32f46ad 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -57,6 +57,8 @@ import com.android.dialer.callintent.CallIntentParser; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; +import com.android.dialer.common.concurrent.DefaultFutureCallback; +import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.duo.DuoComponent; @@ -74,6 +76,7 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.preferredsim.PreferredAccountRecorder; import com.android.dialer.rtt.RttTranscript; +import com.android.dialer.rtt.RttTranscriptUtil; import com.android.dialer.telecom.TelecomCallUtil; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.theme.R; @@ -86,6 +89,9 @@ import com.android.incallui.videotech.duo.DuoVideoTech; import com.android.incallui.videotech.empty.EmptyVideoTech; import com.android.incallui.videotech.ims.ImsVideoTech; import com.android.incallui.videotech.utils.VideoUtils; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; @@ -536,6 +542,28 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa return countryIso; } + /** + * Called when call is disconnected and removed from {@link CallList}, UI may already be destroyed + * at this point. This is last chance to do something for the call. + */ + public void onDestroy() { + LogUtil.enterBlock("DialerCall.onDestroy"); + if (rttTranscript != null) { + RttTranscript rttTranscriptToSave = rttTranscript; + ListenableFuture<Void> future = + DialerExecutorComponent.get(context) + .backgroundExecutor() + .submit( + () -> { + new RttTranscriptUtil(context).saveRttTranscript(rttTranscriptToSave); + return null; + }); + Futures.addCallback(future, new DefaultFutureCallback<>(), MoreExecutors.directExecutor()); + // Sets to null so it won't be saved again when called multiple times. + rttTranscript = null; + } + } + private void updateIsVoiceMailNumber() { if (getHandle() != null && PhoneAccount.SCHEME_VOICEMAIL.equals(getHandle().getScheme())) { isVoicemailNumber = true; |