diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-08-31 16:17:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-31 16:17:04 +0000 |
commit | c39ea3c55fac807c0b98aabdf56c70dc8a49036c (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/incallui/incall/protocol/PrimaryCallState.java | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) | |
parent | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (diff) |
Merge "Update Dialer source to latest internal Google revision."
Diffstat (limited to 'java/com/android/incallui/incall/protocol/PrimaryCallState.java')
-rw-r--r-- | java/com/android/incallui/incall/protocol/PrimaryCallState.java | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java index 2ae6a18e5..fe80276c9 100644 --- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java +++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java @@ -17,13 +17,33 @@ package com.android.incallui.incall.protocol; import android.graphics.drawable.Drawable; +import android.support.annotation.IntDef; +import android.support.annotation.Nullable; import android.telecom.DisconnectCause; +import android.text.TextUtils; +import com.android.dialer.common.Assert; import com.android.incallui.call.DialerCall; +import com.android.incallui.call.DialerCall.State; import com.android.incallui.videotech.utils.SessionModificationState; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Locale; /** State of the primary call. */ public class PrimaryCallState { + + /** + * Button state that will be invisible if not supported, visible but invalid if disabled, or + * visible if enabled. + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({ButtonState.NOT_SUPPORT, ButtonState.DISABLED, ButtonState.ENABLED}) + public @interface ButtonState { + int NOT_SUPPORT = 0; + int DISABLED = 1; + int ENABLED = 2; + } + public final int state; public final boolean isVideoCall; @SessionModificationState public final int sessionModificationState; @@ -44,11 +64,20 @@ public class PrimaryCallState { public final boolean isVoiceMailNumber; public final boolean isRemotelyHeld; public final boolean isBusinessNumber; + public final boolean supportsCallOnHold; + public final @ButtonState int swapToSecondaryButtonState; + public final boolean isAssistedDialed; + @Nullable public final String customLabel; // TODO: Convert to autovalue. b/34502119 public static PrimaryCallState createEmptyPrimaryCallState() { + return createEmptyPrimaryCallStateWithState(DialerCall.State.IDLE, null); + } + + public static PrimaryCallState createEmptyPrimaryCallStateWithState( + int state, String customLabel) { return new PrimaryCallState( - DialerCall.State.IDLE, + state, false, /* isVideoCall */ SessionModificationState.NO_REQUEST, new DisconnectCause(DisconnectCause.UNKNOWN), @@ -67,7 +96,11 @@ public class PrimaryCallState { 0, false /* isVoiceMailNumber */, false /* isRemotelyHeld */, - false /* isBusinessNumber */); + false /* isBusinessNumber */, + true /* supportsCallOnHold */, + ButtonState.NOT_SUPPORT /* swapToSecondaryButtonState */, + false /* isAssistedDialed */, + customLabel); } public PrimaryCallState( @@ -90,7 +123,11 @@ public class PrimaryCallState { long connectTimeMillis, boolean isVoiceMailNumber, boolean isRemotelyHeld, - boolean isBusinessNumber) { + boolean isBusinessNumber, + boolean supportsCallOnHold, + @ButtonState int swapToSecondaryButtonState, + boolean isAssistedDialed, + @Nullable String customLabel) { this.state = state; this.isVideoCall = isVideoCall; this.sessionModificationState = sessionModificationState; @@ -111,6 +148,13 @@ public class PrimaryCallState { this.isVoiceMailNumber = isVoiceMailNumber; this.isRemotelyHeld = isRemotelyHeld; this.isBusinessNumber = isBusinessNumber; + this.supportsCallOnHold = supportsCallOnHold; + this.swapToSecondaryButtonState = swapToSecondaryButtonState; + this.isAssistedDialed = isAssistedDialed; + if (!TextUtils.isEmpty(customLabel)) { + Assert.checkArgument(state == State.CALL_PENDING); + } + this.customLabel = customLabel; } @Override |