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

Commit d2c13e28 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add upgrade to RTT call button."

parents f5f774df f6be6172
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.provider.CallLog.Calls;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresPermission;
@@ -299,6 +300,11 @@ public abstract class TelecomUtil {
    return instance.isDefaultDialer(context);
  }

  public static boolean isRttEnabled(Context context) {
    return Settings.System.getInt(context.getContentResolver(), Settings.System.RTT_CALLING_MODE, 0)
        != 0;
  }

  /** @return the other SIM based PhoneAccountHandle that is not {@code currentAccount} */
  @Nullable
  @RequiresPermission(permission.READ_PHONE_STATE)
+9 −0
Original line number Diff line number Diff line
@@ -303,6 +303,12 @@ public class CallButtonPresenter
    call.getVideoTech().upgradeToVideo(context);
  }

  @Override
  public void changeToRttClicked() {
    LogUtil.enterBlock("CallButtonPresenter.changeToRttClicked");
    call.sendRttUpgradeRequest();
  }

  @Override
  public void onEndCallClicked() {
    LogUtil.i("CallButtonPresenter.onEndCallClicked", "call: " + call);
@@ -473,6 +479,8 @@ public class CallButtonPresenter
            // Most devices cannot make calls on 2 SIMs at the same time.
            && InCallPresenter.getInstance().getCallList().getAllCalls().size() == 1;

    boolean showUpgradeToRtt = TelecomUtil.isRttEnabled(context) && call.canUpgradeToRttCall();

    inCallButtonUi.showButton(InCallButtonIds.BUTTON_AUDIO, true);
    inCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP, showSwap);
    inCallButtonUi.showButton(InCallButtonIds.BUTTON_HOLD, showHold);
@@ -482,6 +490,7 @@ public class CallButtonPresenter
    inCallButtonUi.showButton(InCallButtonIds.BUTTON_ADD_CALL, true);
    inCallButtonUi.enableButton(InCallButtonIds.BUTTON_ADD_CALL, showAddCall);
    inCallButtonUi.showButton(InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo);
    inCallButtonUi.showButton(InCallButtonIds.BUTTON_UPGRADE_TO_RTT, showUpgradeToRtt);
    inCallButtonUi.showButton(InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio);
    inCallButtonUi.showButton(
        InCallButtonIds.BUTTON_SWITCH_CAMERA,
+2 −2
Original line number Diff line number Diff line
@@ -1468,7 +1468,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
      return new ShouldShowUiResult(false, null);
    }

    if (call.isRttCall()) {
    if (call.isActiveRttCall()) {
      LogUtil.i("InCallActivity.getShouldShowRttUi", "found rtt call");
      return new ShouldShowUiResult(true, call);
    }
@@ -1520,7 +1520,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
    AnswerScreen answerScreen =
        AnswerBindings.createAnswerScreen(
            call.getId(),
            call.isRttCall(),
            call.isActiveRttCall(),
            call.isVideoCall(),
            isVideoUpgradeRequest,
            call.getVideoTech().isSelfManagedCamera(),
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ public class ProximitySensor

    DialerCall activeCall = callList.getActiveCall();
    boolean isVideoCall = activeCall != null && activeCall.isVideoCall();
    boolean isRttCall = activeCall != null && activeCall.isRttCall();
    boolean isRttCall = activeCall != null && activeCall.isActiveRttCall();

    if (isOffhook != isPhoneOffhook
        || this.isVideoCall != isVideoCall
+9 −0
Original line number Diff line number Diff line
@@ -514,6 +514,15 @@ public class CallList implements DialerCallDelegate {
    return call != null && call != getDisconnectingCall() && call != getDisconnectedCall();
  }

  boolean hasActiveRttCall() {
    for (DialerCall call : getAllCalls()) {
      if (call.isActiveRttCall()) {
        return true;
      }
    }
    return false;
  }

  /**
   * Returns the first call found in the call map with the upgrade to video modification state.
   *
Loading