Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0c49f63 authored by wangqi's avatar wangqi Committed by Copybara-Service
Browse files

Fix crash when saving transcript is called multiple times.

This is caused by transcript set to non-null again in some cases.

Test: manual
PiperOrigin-RevId: 194303928
Change-Id: Ife5e6bad3874751efab1d94a4262d83017b79808
parent a489f515
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
  private volatile boolean feedbackRequested = false;

  @Nullable private PreferredAccountRecorder preferredAccountRecorder;
  private boolean isCallRemoved;

  public static String getNumberFromHandle(Uri handle) {
    return handle == null ? "" : handle.getSchemeSpecificPart();
@@ -1608,15 +1609,17 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
  void onRemovedFromCallList() {
    LogUtil.enterBlock("DialerCall.onRemovedFromCallList");
    // Ensure we clean up when this call is removed.
    if (videoTechManager != null) {
      videoTechManager.dispatchRemovedFromCallList();
    if (rttTranscript != null) {
    }
    // TODO(a bug): Add tests for it to make sure no crash on subsequent call to this method.
    if (rttTranscript != null && !isCallRemoved) {
      Futures.addCallback(
          RttTranscriptUtil.saveRttTranscript(context, rttTranscript),
          new DefaultFutureCallback<>(),
          MoreExecutors.directExecutor());
      // Sets to null so it won't be saved again when called multiple times.
      rttTranscript = null;
    }
    isCallRemoved = true;
  }

  public com.android.dialer.logging.VideoTech.Type getSelectedAvailableVideoTechType() {