diff --git a/java/com/android/incallui/ActiveCallsCallListListener.java b/java/com/android/incallui/ActiveCallsCallListListener.java
index ce9f9a3..3e4cb93 100644
--- a/java/com/android/incallui/ActiveCallsCallListListener.java
+++ b/java/com/android/incallui/ActiveCallsCallListListener.java
@@ -22,7 +22,7 @@
 import com.android.dialer.activecalls.ActiveCallsComponent;
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 
@@ -49,7 +49,7 @@
   public void onCallListChange(CallList callList) {
     ImmutableList.Builder<ActiveCallInfo> activeCalls = ImmutableList.builder();
     for (DialerCall call : callList.getAllCalls()) {
-      if (call.getState() != State.DISCONNECTED) {
+      if (call.getState() != DialerCallState.DISCONNECTED) {
         activeCalls.add(
             ActiveCallInfo.builder()
                 .setPhoneAccountHandle(Optional.fromNullable(call.getAccountHandle()))
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index e30c70f..3fd3ee6 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -44,8 +44,8 @@
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
 import com.android.incallui.call.DialerCall.CameraDirection;
-import com.android.incallui.call.DialerCall.State;
 import com.android.incallui.call.TelecomAdapter;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.incall.protocol.InCallButtonIds;
 import com.android.incallui.incall.protocol.InCallButtonUi;
 import com.android.incallui.incall.protocol.InCallButtonUiDelegate;
@@ -458,7 +458,7 @@
         !showSwap
             && call.can(android.telecom.Call.Details.CAPABILITY_SUPPORT_HOLD)
             && call.can(android.telecom.Call.Details.CAPABILITY_HOLD);
-    final boolean isCallOnHold = call.getState() == DialerCall.State.ONHOLD;
+    final boolean isCallOnHold = call.getState() == DialerCallState.ONHOLD;
 
     final boolean showAddCall =
         TelecomAdapter.getInstance().canAddCall() && UserManagerCompat.isUserUnlocked(context);
@@ -480,20 +480,20 @@
     // Disabling local video doesn't seem to work when dialing. See a bug.
     final boolean showPauseVideo =
         isVideo
-            && call.getState() != DialerCall.State.DIALING
-            && call.getState() != DialerCall.State.CONNECTING;
+            && call.getState() != DialerCallState.DIALING
+            && call.getState() != DialerCallState.CONNECTING;
 
     otherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle());
     boolean showSwapSim =
         !call.isEmergencyCall()
             && otherAccount != null
             && !call.isVoiceMailNumber()
-            && DialerCall.State.isDialing(call.getState())
+            && DialerCallState.isDialing(call.getState())
             // Most devices cannot make calls on 2 SIMs at the same time.
             && InCallPresenter.getInstance().getCallList().getAllCalls().size() == 1;
 
     boolean showUpgradeToRtt = call.canUpgradeToRttCall();
-    boolean enableUpgradeToRtt = showUpgradeToRtt && call.getState() == State.ACTIVE;
+    boolean enableUpgradeToRtt = showUpgradeToRtt && call.getState() == DialerCallState.ACTIVE;
 
     inCallButtonUi.showButton(InCallButtonIds.BUTTON_AUDIO, true);
     inCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP, showSwap);
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index 1f7a0d3..83c1aff 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -65,8 +65,8 @@
 import com.android.incallui.InCallPresenter.IncomingCallListener;
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
-import com.android.incallui.call.DialerCall.State;
 import com.android.incallui.call.DialerCallListener;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.calllocation.CallLocation;
 import com.android.incallui.calllocation.CallLocationComponent;
 import com.android.incallui.incall.protocol.ContactPhotoType;
@@ -171,7 +171,7 @@
       call.addListener(this);
       // start processing lookups right away.
       if (!call.isConferenceCall()) {
-        startContactInfoSearch(call, true, call.getState() == DialerCall.State.INCOMING);
+        startContactInfoSearch(call, true, call.getState() == DialerCallState.INCOMING);
       } else {
         updateContactEntry(null, true);
       }
@@ -323,7 +323,7 @@
 
       primaryContactInfo =
           ContactInfoCache.buildCacheEntryFromCall(
-              context, this.primary, this.primary.getState() == DialerCall.State.INCOMING);
+              context, this.primary, this.primary.getState() == DialerCallState.INCOMING);
       updatePrimaryDisplayInfo();
       maybeStartSearch(this.primary, true);
     }
@@ -341,14 +341,14 @@
         // secondary call has changed
         secondaryContactInfo =
             ContactInfoCache.buildCacheEntryFromCall(
-                context, this.secondary, this.secondary.getState() == DialerCall.State.INCOMING);
+                context, this.secondary, this.secondary.getState() == DialerCallState.INCOMING);
         updateSecondaryDisplayInfo();
         maybeStartSearch(this.secondary, false);
       }
     }
 
     // Set the call state
-    int callState = DialerCall.State.IDLE;
+    int callState = DialerCallState.IDLE;
     if (this.primary != null) {
       callState = this.primary.getState();
       updatePrimaryCallState();
@@ -362,7 +362,7 @@
     getUi()
         .setEndCallButtonEnabled(
             shouldShowEndCallButton(this.primary, callState),
-            callState != DialerCall.State.INCOMING /* animate */);
+            callState != DialerCallState.INCOMING /* animate */);
 
     maybeSendAccessibilityEvent(oldState, newState, primaryChanged);
     Trace.endSection();
@@ -520,7 +520,7 @@
     if (secondary == null) {
       return ButtonState.NOT_SUPPORT;
     }
-    if (primary.getState() == State.ACTIVE) {
+    if (primary.getState() == DialerCallState.ACTIVE) {
       return ButtonState.ENABLED;
     }
     return ButtonState.DISABLED;
@@ -580,7 +580,7 @@
   private void maybeStartSearch(DialerCall call, boolean isPrimary) {
     // no need to start search for conference calls which show generic info.
     if (call != null && !call.isConferenceCall()) {
-      startContactInfoSearch(call, isPrimary, call.getState() == DialerCall.State.INCOMING);
+      startContactInfoSearch(call, isPrimary, call.getState() == DialerCallState.INCOMING);
     }
   }
 
@@ -978,7 +978,7 @@
     if (primary == null) {
       return false;
     }
-    return DialerCall.State.isDialing(primary.getState())
+    return DialerCallState.isDialing(primary.getState())
         && primary.getGatewayInfo() != null
         && !primary.getGatewayInfo().isEmpty();
   }
@@ -1040,17 +1040,17 @@
   }
 
   private boolean isPrimaryCallActive() {
-    return primary != null && primary.getState() == DialerCall.State.ACTIVE;
+    return primary != null && primary.getState() == DialerCallState.ACTIVE;
   }
 
   private boolean shouldShowEndCallButton(DialerCall primary, int callState) {
     if (primary == null) {
       return false;
     }
-    if ((!DialerCall.State.isConnectingOrConnected(callState)
-            && callState != DialerCall.State.DISCONNECTING
-            && callState != DialerCall.State.DISCONNECTED)
-        || callState == DialerCall.State.INCOMING) {
+    if ((!DialerCallState.isConnectingOrConnected(callState)
+            && callState != DialerCallState.DISCONNECTING
+            && callState != DialerCallState.DISCONNECTED)
+        || callState == DialerCallState.INCOMING) {
       return false;
     }
     if (this.primary.getVideoTech().getSessionModificationState()
@@ -1141,8 +1141,8 @@
     }
 
     boolean isIncomingOrWaiting =
-        primary.getState() == DialerCall.State.INCOMING
-            || primary.getState() == DialerCall.State.CALL_WAITING;
+        primary.getState() == DialerCallState.INCOMING
+            || primary.getState() == DialerCallState.CALL_WAITING;
     return isIncomingOrWaiting
         && !TextUtils.isEmpty(call.getCallSubject())
         && call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED
@@ -1159,8 +1159,8 @@
   private boolean shouldShowNoteSentToast(DialerCall call) {
     return call != null
         && hasCallSubject(call)
-        && (call.getState() == DialerCall.State.DIALING
-            || call.getState() == DialerCall.State.CONNECTING);
+        && (call.getState() == DialerCallState.DIALING
+            || call.getState() == DialerCallState.CONNECTING);
   }
 
   private InCallScreen getUi() {
diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java
index dc793f7..597702b 100644
--- a/java/com/android/incallui/ConferenceParticipantListAdapter.java
+++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java
@@ -41,6 +41,7 @@
 import com.android.incallui.ContactInfoCache.ContactCacheEntry;
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
+import com.android.incallui.call.state.DialerCallState;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -223,7 +224,7 @@
     if (!participantInfo.isCacheLookupComplete()) {
       cache.findInfo(
           participantInfo.getCall(),
-          participantInfo.getCall().getState() == DialerCall.State.INCOMING,
+          participantInfo.getCall().getState() == DialerCallState.INCOMING,
           new ContactLookupCallback(this));
     }
 
@@ -299,7 +300,7 @@
     final View endButton = view.findViewById(R.id.conferenceCallerDisconnect);
     final View separateButton = view.findViewById(R.id.conferenceCallerSeparate);
 
-    if (callState == DialerCall.State.ONHOLD) {
+    if (callState == DialerCallState.ONHOLD) {
       setViewsOnHold(photoView, statusTextView, nameTextView, numberTextView);
     } else {
       setViewsNotOnHold(photoView, statusTextView, nameTextView, numberTextView);
@@ -401,7 +402,7 @@
       if (contactCache == null) {
         contactCache =
             ContactInfoCache.buildCacheEntryFromCall(
-                getContext(), call, call.getState() == DialerCall.State.INCOMING);
+                getContext(), call, call.getState() == DialerCallState.INCOMING);
       }
 
       if (participantsByCallId.containsKey(callId)) {
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index 02335b6..0f0e9d9 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -83,8 +83,8 @@
 import com.android.incallui.audiomode.AudioModeProvider;
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
-import com.android.incallui.call.DialerCall.State;
 import com.android.incallui.call.TelecomAdapter;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.callpending.CallPendingActivity;
 import com.android.incallui.disconnectdialog.DisconnectMessage;
 import com.android.incallui.incall.bindings.InCallBindings;
@@ -348,7 +348,7 @@
       // If there's only one line in use, AND it's on hold, then we're sure the user
       // wants to use the dialpad toward the exact line, so un-hold the holding line.
       DialerCall call = CallList.getInstance().getActiveOrBackgroundCall();
-      if (call != null && call.getState() == State.ONHOLD) {
+      if (call != null && call.getState() == DialerCallState.ONHOLD) {
         call.unhold();
       }
     }
@@ -1449,7 +1449,7 @@
     if (call == null) {
       call = CallList.getInstance().getBackgroundCall();
     }
-    if (didShowAnswerScreen && (call == null || call.getState() == State.DISCONNECTED)) {
+    if (didShowAnswerScreen && (call == null || call.getState() == DialerCallState.DISCONNECTED)) {
       LogUtil.i("InCallActivity.getShouldShowAnswerUi", "found disconnecting incoming call");
       return new ShouldShowUiResult(true, call);
     }
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 6386c56..670af9d 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -66,6 +66,7 @@
 import com.android.incallui.call.DialerCall;
 import com.android.incallui.call.ExternalCallList;
 import com.android.incallui.call.TelecomAdapter;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.disconnectdialog.DisconnectMessage;
 import com.android.incallui.incalluilock.InCallUiLock;
 import com.android.incallui.latencyreport.LatencyReport;
@@ -1356,7 +1357,7 @@
       LogUtil.v("InCallPresenter.handleCallKey", "heldCall: " + heldCall + ", canHold: " + canHold);
 
       // (4) unhold call
-      if (heldCall.getState() == DialerCall.State.ONHOLD && canHold) {
+      if (heldCall.getState() == DialerCallState.ONHOLD && canHold) {
         heldCall.unhold();
         return true;
       }
@@ -1428,7 +1429,7 @@
 
   /** Instruct the in-call activity to show an error dialog or toast for a disconnected call. */
   private void showDialogOrToastForDisconnectedCall(DialerCall call) {
-    if (call.getState() != DialerCall.State.DISCONNECTED) {
+    if (call.getState() != DialerCallState.DISCONNECTED) {
       return;
     }
 
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 9a27532..32d2025 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -85,6 +85,7 @@
 import com.android.incallui.call.DialerCall;
 import com.android.incallui.call.DialerCallListener;
 import com.android.incallui.call.TelecomAdapter;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.ringtone.DialerRingtoneManager;
 import com.android.incallui.ringtone.InCallTonePlayer;
 import com.android.incallui.ringtone.ToneGeneratorFactory;
@@ -117,7 +118,7 @@
   private final DialerRingtoneManager dialerRingtoneManager;
   @Nullable private ContactsPreferences contactsPreferences;
   private int currentNotification = NOTIFICATION_NONE;
-  private int callState = DialerCall.State.INVALID;
+  private int callState = DialerCallState.INVALID;
   private int videoState = VideoProfile.STATE_AUDIO_ONLY;
   private int savedIcon = 0;
   private String savedContent = null;
@@ -244,8 +245,8 @@
   private void showNotification(final DialerCall call) {
     Trace.beginSection("StatusBarNotifier.showNotification");
     final boolean isIncoming =
-        (call.getState() == DialerCall.State.INCOMING
-            || call.getState() == DialerCall.State.CALL_WAITING);
+        (call.getState() == DialerCallState.INCOMING
+            || call.getState() == DialerCallState.CALL_WAITING);
     setStatusBarCallListener(new StatusBarCallListener(call));
 
     // we make a call to the contact info cache to query for supplemental data to what the
@@ -287,8 +288,8 @@
         call.getVideoTech().getSessionModificationState()
             == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST;
     final int notificationType;
-    if (callState == DialerCall.State.INCOMING
-        || callState == DialerCall.State.CALL_WAITING
+    if (callState == DialerCallState.INCOMING
+        || callState == DialerCallState.CALL_WAITING
         || isVideoUpgradeRequest) {
       if (ConfigProviderBindings.get(context)
           .getBoolean("quiet_incoming_call_if_ui_showing", true)) {
@@ -437,12 +438,12 @@
     setNotificationWhen(call, state, builder);
 
     // Add hang up option for any active calls (active | onhold), outgoing calls (dialing).
-    if (state == DialerCall.State.ACTIVE
-        || state == DialerCall.State.ONHOLD
-        || DialerCall.State.isDialing(state)) {
+    if (state == DialerCallState.ACTIVE
+        || state == DialerCallState.ONHOLD
+        || DialerCallState.isDialing(state)) {
       addHangupAction(builder);
       addSpeakerAction(builder, callAudioState);
-    } else if (state == DialerCall.State.INCOMING || state == DialerCall.State.CALL_WAITING) {
+    } else if (state == DialerCallState.INCOMING || state == DialerCallState.CALL_WAITING) {
       addDismissAction(builder);
       if (call.isVideoCall()) {
         addVideoCallAction(builder);
@@ -458,7 +459,7 @@
    * at which the notification was created.
    */
   private void setNotificationWhen(DialerCall call, int state, Notification.Builder builder) {
-    if (state == DialerCall.State.ACTIVE) {
+    if (state == DialerCallState.ACTIVE) {
       builder.setUsesChronometer(true);
       builder.setWhen(call.getConnectTimeMillis());
     } else {
@@ -642,7 +643,7 @@
     // different calls.  So if both lines are in use, display info
     // from the foreground call.  And if there's a ringing call,
     // display that regardless of the state of the other calls.
-    if (call.getState() == DialerCall.State.ONHOLD) {
+    if (call.getState() == DialerCallState.ONHOLD) {
       return R.drawable.quantum_ic_phone_paused_vd_theme_24;
     } else if (call.getVideoTech().getSessionModificationState()
             == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST
@@ -668,8 +669,8 @@
   /** Returns the message to use with the notification. */
   private CharSequence getContentString(DialerCall call, @UserType long userType) {
     boolean isIncomingOrWaiting =
-        call.getState() == DialerCall.State.INCOMING
-            || call.getState() == DialerCall.State.CALL_WAITING;
+        call.getState() == DialerCallState.INCOMING
+            || call.getState() == DialerCallState.CALL_WAITING;
 
     if (isIncomingOrWaiting
         && call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED) {
@@ -701,14 +702,14 @@
       } else {
         resId = R.string.notification_incoming_call;
       }
-    } else if (call.getState() == DialerCall.State.ONHOLD) {
+    } else if (call.getState() == DialerCallState.ONHOLD) {
       resId = R.string.notification_on_hold;
     } else if (call.isVideoCall()) {
       resId =
           call.getVideoTech().isPaused()
               ? R.string.notification_ongoing_paused_video_call
               : R.string.notification_ongoing_video_call;
-    } else if (DialerCall.State.isDialing(call.getState())) {
+    } else if (DialerCallState.isDialing(call.getState())) {
       resId = R.string.notification_dialing;
     } else if (call.getVideoTech().getSessionModificationState()
         == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java
index 050ce98..41c3354 100644
--- a/java/com/android/incallui/VideoCallPresenter.java
+++ b/java/com/android/incallui/VideoCallPresenter.java
@@ -38,9 +38,9 @@
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
 import com.android.incallui.call.DialerCall.CameraDirection;
-import com.android.incallui.call.DialerCall.State;
 import com.android.incallui.call.InCallVideoCallCallbackNotifier;
 import com.android.incallui.call.InCallVideoCallCallbackNotifier.SurfaceChangeListener;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.util.AccessibilityUtil;
 import com.android.incallui.video.protocol.VideoCallScreen;
 import com.android.incallui.video.protocol.VideoCallScreenDelegate;
@@ -101,7 +101,7 @@
   /** Determines if the current UI state represents a video call. */
   private int currentVideoState;
   /** DialerCall's current state */
-  private int currentCallState = DialerCall.State.INVALID;
+  private int currentCallState = DialerCallState.INVALID;
   /** Determines the device orientation (portrait/lanscape). */
   private int deviceOrientation = InCallOrientationEventListener.SCREEN_ORIENTATION_UNKNOWN;
   /** Tracks the state of the preview surface negotiation with the telephony layer. */
@@ -166,10 +166,10 @@
   static boolean showIncomingVideo(int videoState, int callState) {
 
     boolean isPaused = VideoProfile.isPaused(videoState);
-    boolean isCallActive = callState == DialerCall.State.ACTIVE;
+    boolean isCallActive = callState == DialerCallState.ACTIVE;
     // Show incoming Video for dialing calls to support early media
     boolean isCallOutgoingPending =
-        DialerCall.State.isDialing(callState) || callState == DialerCall.State.CONNECTING;
+        DialerCallState.isDialing(callState) || callState == DialerCallState.CONNECTING;
 
     return !isPaused
         && (isCallActive || isCallOutgoingPending)
@@ -318,7 +318,7 @@
     // Register for surface and video events from {@link InCallVideoCallListener}s.
     InCallVideoCallCallbackNotifier.getInstance().addSurfaceChangeListener(this);
     currentVideoState = VideoProfile.STATE_AUDIO_ONLY;
-    currentCallState = DialerCall.State.INVALID;
+    currentCallState = DialerCallState.INVALID;
 
     InCallPresenter.InCallState inCallState = InCallPresenter.getInstance().getInCallState();
     onStateChange(inCallState, inCallState, CallList.getInstance());
@@ -541,7 +541,8 @@
       updateFullscreenAndGreenScreenMode(
           primaryCall.getState(), primaryCall.getVideoTech().getSessionModificationState());
     } else {
-      updateFullscreenAndGreenScreenMode(State.INVALID, SessionModificationState.NO_REQUEST);
+      updateFullscreenAndGreenScreenMode(
+          DialerCallState.INVALID, SessionModificationState.NO_REQUEST);
     }
   }
 
@@ -640,7 +641,7 @@
   private void updateCallCache(DialerCall call) {
     if (call == null) {
       currentVideoState = VideoProfile.STATE_AUDIO_ONLY;
-      currentCallState = DialerCall.State.INVALID;
+      currentCallState = DialerCallState.INVALID;
       videoCall = null;
       primaryCall = null;
     } else {
@@ -699,9 +700,9 @@
     if (videoCallScreen != null) {
       boolean shouldShowFullscreen = InCallPresenter.getInstance().isFullscreen();
       boolean shouldShowGreenScreen =
-          callState == State.DIALING
-              || callState == State.CONNECTING
-              || callState == State.INCOMING
+          callState == DialerCallState.DIALING
+              || callState == DialerCallState.CONNECTING
+              || callState == DialerCallState.INCOMING
               || isVideoUpgrade(sessionModificationState);
       videoCallScreen.updateFullscreenAndGreenScreenMode(
           shouldShowFullscreen, shouldShowGreenScreen);
@@ -850,7 +851,7 @@
 
     showVideoUi(
         VideoProfile.STATE_AUDIO_ONLY,
-        DialerCall.State.ACTIVE,
+        DialerCallState.ACTIVE,
         SessionModificationState.NO_REQUEST,
         false /* isRemotelyHeld */);
     enableCamera(primaryCall, false);
@@ -1019,7 +1020,7 @@
       return;
     }
 
-    if (!isVideoCall(call) || call.getState() == DialerCall.State.INCOMING) {
+    if (!isVideoCall(call) || call.getState() == DialerCallState.INCOMING) {
       LogUtil.i("VideoCallPresenter.maybeExitFullscreen", "exiting fullscreen");
       InCallPresenter.getInstance().setFullScreen(false);
     }
@@ -1038,7 +1039,7 @@
     }
 
     if (call == null
-        || call.getState() != DialerCall.State.ACTIVE
+        || call.getState() != DialerCallState.ACTIVE
         || !isBidirectionalVideoCall(call)
         || InCallPresenter.getInstance().isFullscreen()
         || (context != null && AccessibilityUtil.isTouchExplorationEnabled(context))) {
@@ -1263,11 +1264,11 @@
       return false;
     }
     final int state = call.getState();
-    return (state == DialerCall.State.INCOMING) || (state == DialerCall.State.CALL_WAITING);
+    return (state == DialerCallState.INCOMING) || (state == DialerCallState.CALL_WAITING);
   }
 
   private static boolean isActiveVideoCall(DialerCall call) {
-    return isVideoCall(call) && call.getState() == DialerCall.State.ACTIVE;
+    return isVideoCall(call) && call.getState() == DialerCallState.ACTIVE;
   }
 
   private static boolean isOutgoingVideoCall(DialerCall call) {
@@ -1275,9 +1276,9 @@
       return false;
     }
     final int state = call.getState();
-    return DialerCall.State.isDialing(state)
-        || state == DialerCall.State.CONNECTING
-        || state == DialerCall.State.SELECT_PHONE_ACCOUNT;
+    return DialerCallState.isDialing(state)
+        || state == DialerCallState.CONNECTING
+        || state == DialerCallState.SELECT_PHONE_ACCOUNT;
   }
 
   private static boolean isAudioCall(DialerCall call) {
diff --git a/java/com/android/incallui/VideoPauseController.java b/java/com/android/incallui/VideoPauseController.java
index 1a65010..2bdbce3 100644
--- a/java/com/android/incallui/VideoPauseController.java
+++ b/java/com/android/incallui/VideoPauseController.java
@@ -24,7 +24,7 @@
 import com.android.incallui.InCallPresenter.IncomingCallListener;
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import java.util.Objects;
 
 /**
@@ -43,7 +43,7 @@
    *
    * <p>These values are stored to detect specific changes in state between onStateChange calls.
    */
-  private int prevCallState = State.INVALID;
+  private int prevCallState = DialerCallState.INVALID;
 
   private boolean wasVideoCall = false;
 
@@ -74,8 +74,8 @@
    */
   private static boolean isIncomingCall(DialerCall call) {
     return call != null
-        && (call.getState() == DialerCall.State.CALL_WAITING
-            || call.getState() == DialerCall.State.INCOMING);
+        && (call.getState() == DialerCallState.CALL_WAITING
+            || call.getState() == DialerCallState.INCOMING);
   }
 
   /**
@@ -84,7 +84,7 @@
    * @return {@code true} if the call is dialing, {@code false} otherwise.
    */
   private boolean wasDialing() {
-    return DialerCall.State.isDialing(prevCallState);
+    return DialerCallState.isDialing(prevCallState);
   }
 
   /**
@@ -115,7 +115,7 @@
   private void clear() {
     inCallPresenter = null;
     primaryCall = null;
-    prevCallState = State.INVALID;
+    prevCallState = DialerCallState.INVALID;
     wasVideoCall = false;
     isInBackground = false;
   }
@@ -237,7 +237,7 @@
   private void updatePrimaryCallContext(DialerCall call) {
     if (call == null) {
       primaryCall = null;
-      prevCallState = State.INVALID;
+      prevCallState = DialerCallState.INVALID;
       wasVideoCall = false;
     } else {
       primaryCall = call;
@@ -322,6 +322,6 @@
   }
 
   private static boolean videoCanPause(DialerCall call) {
-    return call != null && call.isVideoCall() && call.getState() == DialerCall.State.ACTIVE;
+    return call != null && call.isVideoCall() && call.getState() == DialerCallState.ACTIVE;
   }
 }
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 77352f9..fb1de05 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -69,7 +69,7 @@
 import com.android.incallui.answer.protocol.AnswerScreen;
 import com.android.incallui.answer.protocol.AnswerScreenDelegate;
 import com.android.incallui.answer.protocol.AnswerScreenDelegateFactory;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.contactgrid.ContactGridManager;
 import com.android.incallui.incall.protocol.ContactPhotoType;
 import com.android.incallui.incall.protocol.InCallScreen;
@@ -889,7 +889,7 @@
   public void onAnswerProgressUpdate(@FloatRange(from = -1f, to = 1f) float answerProgress) {
     // Don't fade the window background for call waiting or video upgrades. Fading the background
     // shows the system wallpaper which looks bad because on reject we switch to another call.
-    if (primaryCallState.state() == State.INCOMING && !isVideoCall()) {
+    if (primaryCallState.state() == DialerCallState.INCOMING && !isVideoCall()) {
       answerScreenDelegate.updateWindowBackgroundColor(answerProgress);
     }
 
@@ -1079,9 +1079,9 @@
 
   private boolean canRejectCallWithSms() {
     return primaryCallState != null
-        && !(primaryCallState.state() == State.DISCONNECTED
-            || primaryCallState.state() == State.DISCONNECTING
-            || primaryCallState.state() == State.IDLE);
+        && !(primaryCallState.state() == DialerCallState.DISCONNECTED
+            || primaryCallState.state() == DialerCallState.DISCONNECTING
+            || primaryCallState.state() == DialerCallState.IDLE);
   }
 
   private void createInCallScreenDelegate() {
diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
index 50f6ae6..939d120 100644
--- a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
+++ b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
@@ -24,8 +24,8 @@
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.configprovider.ConfigProviderBindings;
 import com.android.incallui.call.DialerCall;
-import com.android.incallui.call.DialerCall.State;
 import com.android.incallui.call.DialerCallListener;
+import com.android.incallui.call.state.DialerCallState;
 
 /**
  * This class prevents users from accidentally answering calls by keeping the screen off until the
@@ -47,7 +47,7 @@
     Trace.beginSection("AnswerProximitySensor.shouldUse");
     // Don't use the AnswerProximitySensor for call waiting and other states. Those states are
     // handled by the general ProximitySensor code.
-    if (call.getState() != State.INCOMING) {
+    if (call.getState() != DialerCallState.INCOMING) {
       LogUtil.i("AnswerProximitySensor.shouldUse", "call state is not incoming");
       Trace.endSection();
       return false;
@@ -129,7 +129,7 @@
 
   @Override
   public void onDialerCallUpdate() {
-    if (call.getState() != State.INCOMING) {
+    if (call.getState() != DialerCallState.INCOMING) {
       LogUtil.i("AnswerProximitySensor.onDialerCallUpdate", "no longer incoming, cleaning up");
       cleanup();
     }
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java
index 6b17962..5d9db32 100644
--- a/java/com/android/incallui/call/CallList.java
+++ b/java/com/android/incallui/call/CallList.java
@@ -42,7 +42,7 @@
 import com.android.dialer.spam.Spam;
 import com.android.dialer.spam.SpamComponent;
 import com.android.dialer.telecom.TelecomCallUtil;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.latencyreport.LatencyReport;
 import com.android.incallui.videotech.utils.SessionModificationState;
 import java.util.Collection;
@@ -155,8 +155,8 @@
                 @Override
                 public void onComplete(boolean isSpam) {
                   boolean isIncomingCall =
-                      call.getState() == DialerCall.State.INCOMING
-                          || call.getState() == DialerCall.State.CALL_WAITING;
+                      call.getState() == DialerCallState.INCOMING
+                          || call.getState() == DialerCallState.CALL_WAITING;
                   if (isSpam) {
                     if (!isIncomingCall) {
                       LogUtil.i(
@@ -211,8 +211,8 @@
         call.getCountryIso());
     Trace.endSection();
 
-    if (call.getState() == DialerCall.State.INCOMING
-        || call.getState() == DialerCall.State.CALL_WAITING) {
+    if (call.getState() == DialerCallState.INCOMING
+        || call.getState() == DialerCallState.CALL_WAITING) {
       if (call.isActiveRttCall()) {
         Logger.get(context)
             .logCallImpression(
@@ -233,7 +233,7 @@
       notifyGenericListeners();
     }
 
-    if (call.getState() != State.INCOMING) {
+    if (call.getState() != DialerCallState.INCOMING) {
       // Only report outgoing calls
       ShortcutUsageReporter.onOutgoingCallAdded(context, call.getNumber());
     }
@@ -444,46 +444,46 @@
 
   /** A call that is waiting for {@link PhoneAccount} selection */
   public DialerCall getWaitingForAccountCall() {
-    return getFirstCallWithState(DialerCall.State.SELECT_PHONE_ACCOUNT);
+    return getFirstCallWithState(DialerCallState.SELECT_PHONE_ACCOUNT);
   }
 
   public DialerCall getPendingOutgoingCall() {
-    return getFirstCallWithState(DialerCall.State.CONNECTING);
+    return getFirstCallWithState(DialerCallState.CONNECTING);
   }
 
   public DialerCall getOutgoingCall() {
-    DialerCall call = getFirstCallWithState(DialerCall.State.DIALING);
+    DialerCall call = getFirstCallWithState(DialerCallState.DIALING);
     if (call == null) {
-      call = getFirstCallWithState(DialerCall.State.REDIALING);
+      call = getFirstCallWithState(DialerCallState.REDIALING);
     }
     if (call == null) {
-      call = getFirstCallWithState(DialerCall.State.PULLING);
+      call = getFirstCallWithState(DialerCallState.PULLING);
     }
     return call;
   }
 
   public DialerCall getActiveCall() {
-    return getFirstCallWithState(DialerCall.State.ACTIVE);
+    return getFirstCallWithState(DialerCallState.ACTIVE);
   }
 
   public DialerCall getSecondActiveCall() {
-    return getCallWithState(DialerCall.State.ACTIVE, 1);
+    return getCallWithState(DialerCallState.ACTIVE, 1);
   }
 
   public DialerCall getBackgroundCall() {
-    return getFirstCallWithState(DialerCall.State.ONHOLD);
+    return getFirstCallWithState(DialerCallState.ONHOLD);
   }
 
   public DialerCall getDisconnectedCall() {
-    return getFirstCallWithState(DialerCall.State.DISCONNECTED);
+    return getFirstCallWithState(DialerCallState.DISCONNECTED);
   }
 
   public DialerCall getDisconnectingCall() {
-    return getFirstCallWithState(DialerCall.State.DISCONNECTING);
+    return getFirstCallWithState(DialerCallState.DISCONNECTING);
   }
 
   public DialerCall getSecondBackgroundCall() {
-    return getCallWithState(DialerCall.State.ONHOLD, 1);
+    return getCallWithState(DialerCallState.ONHOLD, 1);
   }
 
   public DialerCall getActiveOrBackgroundCall() {
@@ -495,9 +495,9 @@
   }
 
   public DialerCall getIncomingCall() {
-    DialerCall call = getFirstCallWithState(DialerCall.State.INCOMING);
+    DialerCall call = getFirstCallWithState(DialerCallState.INCOMING);
     if (call == null) {
-      call = getFirstCallWithState(DialerCall.State.CALL_WAITING);
+      call = getFirstCallWithState(DialerCallState.CALL_WAITING);
     }
 
     return call;
@@ -512,7 +512,7 @@
       result = getOutgoingCall();
     }
     if (result == null) {
-      result = getFirstCallWithState(DialerCall.State.ACTIVE);
+      result = getFirstCallWithState(DialerCallState.ACTIVE);
     }
     if (result == null) {
       result = getDisconnectingCall();
@@ -592,9 +592,9 @@
    */
   public boolean hasNonParentActiveOrBackgroundCall() {
     for (DialerCall call : callById.values()) {
-      if ((call.getState() == State.ACTIVE
-              || call.getState() == State.ONHOLD
-              || call.getState() == State.CONFERENCED)
+      if ((call.getState() == DialerCallState.ACTIVE
+              || call.getState() == DialerCallState.ONHOLD
+              || call.getState() == DialerCallState.CONFERENCED)
           && !call.wasParentCall()) {
         return true;
       }
@@ -611,11 +611,11 @@
   public void clearOnDisconnect() {
     for (DialerCall call : callById.values()) {
       final int state = call.getState();
-      if (state != DialerCall.State.IDLE
-          && state != DialerCall.State.INVALID
-          && state != DialerCall.State.DISCONNECTED) {
+      if (state != DialerCallState.IDLE
+          && state != DialerCallState.INVALID
+          && state != DialerCallState.DISCONNECTED) {
 
-        call.setState(DialerCall.State.DISCONNECTED);
+        call.setState(DialerCallState.DISCONNECTED);
         call.setDisconnectCause(new DisconnectCause(DisconnectCause.UNKNOWN));
         updateCallInMap(call);
       }
@@ -688,7 +688,7 @@
 
     boolean updated = false;
 
-    if (call.getState() == DialerCall.State.DISCONNECTED) {
+    if (call.getState() == DialerCallState.DISCONNECTED) {
       // update existing (but do not add!!) disconnected calls
       if (callById.containsKey(call.getId())) {
         // For disconnected calls, we want to keep them alive for a few seconds so that the
@@ -718,7 +718,7 @@
   }
 
   private int getDelayForDisconnect(DialerCall call) {
-    if (call.getState() != DialerCall.State.DISCONNECTED) {
+    if (call.getState() != DialerCallState.DISCONNECTED) {
       throw new IllegalStateException();
     }
 
@@ -748,7 +748,7 @@
 
   private boolean isCallDead(DialerCall call) {
     final int state = call.getState();
-    return DialerCall.State.IDLE == state || DialerCall.State.INVALID == state;
+    return DialerCallState.IDLE == state || DialerCallState.INVALID == state;
   }
 
   /** Sets up a call for deletion and notifies listeners of change. */
@@ -756,7 +756,7 @@
     if (pendingDisconnectCalls.contains(call)) {
       pendingDisconnectCalls.remove(call);
     }
-    call.setState(DialerCall.State.IDLE);
+    call.setState(DialerCallState.IDLE);
     updateCallInMap(call);
     notifyGenericListeners();
   }
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java
index da05b9d..d57de15 100644
--- a/java/com/android/incallui/call/DialerCall.java
+++ b/java/com/android/incallui/call/DialerCall.java
@@ -81,6 +81,7 @@
 import com.android.dialer.theme.R;
 import com.android.dialer.util.PermissionsUtil;
 import com.android.incallui.audiomode.AudioModeProvider;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.latencyreport.LatencyReport;
 import com.android.incallui.speakeasy.runtime.Constraints;
 import com.android.incallui.videotech.VideoTech;
@@ -146,7 +147,7 @@
   private boolean isSpeakEasyCall;
   private boolean isEmergencyCall;
   private Uri handle;
-  private int state = State.INVALID;
+  private int state = DialerCallState.INVALID;
   private DisconnectCause disconnectCause;
 
   private boolean hasShownLteToWiFiHandoverToast;
@@ -200,7 +201,8 @@
 
   /**
    * Whether the call is put on hold by remote party. This is different than the {@link
-   * State#ONHOLD} state which indicates that the call is being held locally on the device.
+   * DialerCallState#ONHOLD} state which indicates that the call is being held locally on the
+   * device.
    */
   private boolean isRemotelyHeld;
 
@@ -427,25 +429,25 @@
     switch (state) {
       case Call.STATE_NEW:
       case Call.STATE_CONNECTING:
-        return DialerCall.State.CONNECTING;
+        return DialerCallState.CONNECTING;
       case Call.STATE_SELECT_PHONE_ACCOUNT:
-        return DialerCall.State.SELECT_PHONE_ACCOUNT;
+        return DialerCallState.SELECT_PHONE_ACCOUNT;
       case Call.STATE_DIALING:
-        return DialerCall.State.DIALING;
+        return DialerCallState.DIALING;
       case Call.STATE_PULLING_CALL:
-        return DialerCall.State.PULLING;
+        return DialerCallState.PULLING;
       case Call.STATE_RINGING:
-        return DialerCall.State.INCOMING;
+        return DialerCallState.INCOMING;
       case Call.STATE_ACTIVE:
-        return DialerCall.State.ACTIVE;
+        return DialerCallState.ACTIVE;
       case Call.STATE_HOLDING:
-        return DialerCall.State.ONHOLD;
+        return DialerCallState.ONHOLD;
       case Call.STATE_DISCONNECTED:
-        return DialerCall.State.DISCONNECTED;
+        return DialerCallState.DISCONNECTED;
       case Call.STATE_DISCONNECTING:
-        return DialerCall.State.DISCONNECTING;
+        return DialerCallState.DISCONNECTING;
       default:
-        return DialerCall.State.INVALID;
+        return DialerCallState.INVALID;
     }
   }
 
@@ -570,7 +572,7 @@
     videoTech = null;
     // We want to potentially register a video call callback here.
     updateFromTelecomCall();
-    if (oldState != getState() && getState() == DialerCall.State.DISCONNECTED) {
+    if (oldState != getState() && getState() == DialerCallState.DISCONNECTED) {
       for (DialerCallListener listener : listeners) {
         listener.onDialerCallDisconnect();
       }
@@ -596,7 +598,7 @@
     videoTechManager.dispatchCallStateChanged(telecomCall.getState(), getAccountHandle());
 
     final int translatedState = translateState(telecomCall.getState());
-    if (state != State.BLOCKED) {
+    if (state != DialerCallState.BLOCKED) {
       setState(translatedState);
       setDisconnectCause(telecomCall.getDetails().getDisconnectCause());
     }
@@ -805,7 +807,7 @@
 
   public void blockCall() {
     telecomCall.reject(false, null);
-    setState(State.BLOCKED);
+    setState(DialerCallState.BLOCKED);
   }
 
   @Nullable
@@ -846,7 +848,7 @@
 
   public int getState() {
     if (telecomCall != null && telecomCall.getParent() != null) {
-      return State.CONFERENCED;
+      return DialerCallState.CONFERENCED;
     } else {
       return state;
     }
@@ -857,9 +859,9 @@
   }
 
   public void setState(int state) {
-    if (state == State.INCOMING) {
+    if (state == DialerCallState.INCOMING) {
       logState.isIncoming = true;
-    } else if (state == State.DISCONNECTED) {
+    } else if (state == DialerCallState.DISCONNECTED) {
       long newDuration =
           getConnectTimeMillis() == 0 ? 0 : System.currentTimeMillis() - getConnectTimeMillis();
       if (this.state != state) {
@@ -927,7 +929,7 @@
 
   /** Returns call disconnect cause, defined by {@link DisconnectCause}. */
   public DisconnectCause getDisconnectCause() {
-    if (state == State.DISCONNECTED || state == State.IDLE) {
+    if (state == DialerCallState.DISCONNECTED || state == DialerCallState.IDLE) {
       return disconnectCause;
     }
 
@@ -1146,7 +1148,7 @@
               .setCallInitiationType(CallInitiationType.Type.EXTERNAL_INITIATION)
               .build();
     }
-    if (getState() == State.INCOMING) {
+    if (getState() == DialerCallState.INCOMING) {
       logState.callSpecificAppData =
           logState
               .callSpecificAppData
@@ -1169,7 +1171,7 @@
         "[%s, %s, %s, %s, children:%s, parent:%s, "
             + "conferenceable:%s, videoState:%s, mSessionModificationState:%d, CameraDir:%s]",
         id,
-        State.toString(getState()),
+        DialerCallState.toString(getState()),
         Details.capabilitiesToString(telecomCall.getDetails().getCallCapabilities()),
         Details.propertiesToString(telecomCall.getDetails().getCallProperties()),
         childCallIds,
@@ -1366,7 +1368,7 @@
 
   public void disconnect() {
     LogUtil.i("DialerCall.disconnect", "");
-    setState(DialerCall.State.DISCONNECTING);
+    setState(DialerCallState.DISCONNECTING);
     for (DialerCallListener listener : listeners) {
       listener.onDialerCallUpdate();
     }
@@ -1686,88 +1688,6 @@
   @Retention(RetentionPolicy.SOURCE)
   public @interface CallHistoryStatus {}
 
-  /* Defines different states of this call */
-  public static class State {
-
-    public static final int INVALID = 0;
-    public static final int NEW = 1; /* The call is new. */
-    public static final int IDLE = 2; /* The call is idle.  Nothing active */
-    public static final int ACTIVE = 3; /* There is an active call */
-    public static final int INCOMING = 4; /* A normal incoming phone call */
-    public static final int CALL_WAITING = 5; /* Incoming call while another is active */
-    public static final int DIALING = 6; /* An outgoing call during dial phase */
-    public static final int REDIALING = 7; /* Subsequent dialing attempt after a failure */
-    public static final int ONHOLD = 8; /* An active phone call placed on hold */
-    public static final int DISCONNECTING = 9; /* A call is being ended. */
-    public static final int DISCONNECTED = 10; /* State after a call disconnects */
-    public static final int CONFERENCED = 11; /* DialerCall part of a conference call */
-    public static final int SELECT_PHONE_ACCOUNT = 12; /* Waiting for account selection */
-    public static final int CONNECTING = 13; /* Waiting for Telecom broadcast to finish */
-    public static final int BLOCKED = 14; /* The number was found on the block list */
-    public static final int PULLING = 15; /* An external call being pulled to the device */
-    public static final int CALL_PENDING = 16; /* A call is pending on a long process to finish */
-
-    public static boolean isConnectingOrConnected(int state) {
-      switch (state) {
-        case ACTIVE:
-        case INCOMING:
-        case CALL_WAITING:
-        case CONNECTING:
-        case DIALING:
-        case PULLING:
-        case REDIALING:
-        case ONHOLD:
-        case CONFERENCED:
-          return true;
-        default:
-          return false;
-      }
-    }
-
-    public static boolean isDialing(int state) {
-      return state == DIALING || state == PULLING || state == REDIALING;
-    }
-
-    public static String toString(int state) {
-      switch (state) {
-        case INVALID:
-          return "INVALID";
-        case NEW:
-          return "NEW";
-        case IDLE:
-          return "IDLE";
-        case ACTIVE:
-          return "ACTIVE";
-        case INCOMING:
-          return "INCOMING";
-        case CALL_WAITING:
-          return "CALL_WAITING";
-        case DIALING:
-          return "DIALING";
-        case PULLING:
-          return "PULLING";
-        case REDIALING:
-          return "REDIALING";
-        case ONHOLD:
-          return "ONHOLD";
-        case DISCONNECTING:
-          return "DISCONNECTING";
-        case DISCONNECTED:
-          return "DISCONNECTED";
-        case CONFERENCED:
-          return "CONFERENCED";
-        case SELECT_PHONE_ACCOUNT:
-          return "SELECT_PHONE_ACCOUNT";
-        case CONNECTING:
-          return "CONNECTING";
-        case BLOCKED:
-          return "BLOCKED";
-        default:
-          return "UNKNOWN";
-      }
-    }
-  }
-
   /** Camera direction constants */
   public static class CameraDirection {
     public static final int CAMERA_DIRECTION_UNKNOWN = -1;
diff --git a/java/com/android/incallui/call/state/DialerCallState.java b/java/com/android/incallui/call/state/DialerCallState.java
new file mode 100644
index 0000000..266d6d6
--- /dev/null
+++ b/java/com/android/incallui/call/state/DialerCallState.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.incallui.call.state;
+
+/** Defines different states of {@link com.android.incallui.call.DialerCall} */
+public class DialerCallState {
+
+  public static final int INVALID = 0;
+  public static final int NEW = 1; /* The call is new. */
+  public static final int IDLE = 2; /* The call is idle.  Nothing active */
+  public static final int ACTIVE = 3; /* There is an active call */
+  public static final int INCOMING = 4; /* A normal incoming phone call */
+  public static final int CALL_WAITING = 5; /* Incoming call while another is active */
+  public static final int DIALING = 6; /* An outgoing call during dial phase */
+  public static final int REDIALING = 7; /* Subsequent dialing attempt after a failure */
+  public static final int ONHOLD = 8; /* An active phone call placed on hold */
+  public static final int DISCONNECTING = 9; /* A call is being ended. */
+  public static final int DISCONNECTED = 10; /* State after a call disconnects */
+  public static final int CONFERENCED = 11; /* DialerCall part of a conference call */
+  public static final int SELECT_PHONE_ACCOUNT = 12; /* Waiting for account selection */
+  public static final int CONNECTING = 13; /* Waiting for Telecom broadcast to finish */
+  public static final int BLOCKED = 14; /* The number was found on the block list */
+  public static final int PULLING = 15; /* An external call being pulled to the device */
+  public static final int CALL_PENDING = 16; /* A call is pending on a long process to finish */
+
+  public static boolean isConnectingOrConnected(int state) {
+    switch (state) {
+      case ACTIVE:
+      case INCOMING:
+      case CALL_WAITING:
+      case CONNECTING:
+      case DIALING:
+      case PULLING:
+      case REDIALING:
+      case ONHOLD:
+      case CONFERENCED:
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  public static boolean isDialing(int state) {
+    return state == DIALING || state == PULLING || state == REDIALING;
+  }
+
+  public static String toString(int state) {
+    switch (state) {
+      case INVALID:
+        return "INVALID";
+      case NEW:
+        return "NEW";
+      case IDLE:
+        return "IDLE";
+      case ACTIVE:
+        return "ACTIVE";
+      case INCOMING:
+        return "INCOMING";
+      case CALL_WAITING:
+        return "CALL_WAITING";
+      case DIALING:
+        return "DIALING";
+      case PULLING:
+        return "PULLING";
+      case REDIALING:
+        return "REDIALING";
+      case ONHOLD:
+        return "ONHOLD";
+      case DISCONNECTING:
+        return "DISCONNECTING";
+      case DISCONNECTED:
+        return "DISCONNECTED";
+      case CONFERENCED:
+        return "CONFERENCED";
+      case SELECT_PHONE_ACCOUNT:
+        return "SELECT_PHONE_ACCOUNT";
+      case CONNECTING:
+        return "CONNECTING";
+      case BLOCKED:
+        return "BLOCKED";
+      default:
+        return "UNKNOWN";
+    }
+  }
+}
diff --git a/java/com/android/incallui/callpending/CallPendingActivity.java b/java/com/android/incallui/callpending/CallPendingActivity.java
index 831ebbd..3c69f97 100644
--- a/java/com/android/incallui/callpending/CallPendingActivity.java
+++ b/java/com/android/incallui/callpending/CallPendingActivity.java
@@ -31,7 +31,7 @@
 import com.android.dialer.enrichedcall.Session;
 import com.android.dialer.multimedia.MultimediaData;
 import com.android.incallui.audiomode.AudioModeProvider;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.incall.bindings.InCallBindings;
 import com.android.incallui.incall.protocol.ContactPhotoType;
 import com.android.incallui.incall.protocol.InCallButtonIds;
@@ -148,7 +148,7 @@
     inCallScreen.setPrimary(createPrimaryInfo());
     inCallScreen.setCallState(
         PrimaryCallState.builder()
-            .setState(State.CALL_PENDING)
+            .setState(DialerCallState.CALL_PENDING)
             .setCustomLabel(getCallPendingLabel())
             .build());
     inCallScreen.setEndCallButtonEnabled(true, true);
diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java
index dc86d81..7388c50 100644
--- a/java/com/android/incallui/contactgrid/BottomRow.java
+++ b/java/com/android/incallui/contactgrid/BottomRow.java
@@ -22,7 +22,7 @@
 import android.text.BidiFormatter;
 import android.text.TextDirectionHeuristics;
 import android.text.TextUtils;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.incall.protocol.PrimaryCallState;
 import com.android.incallui.incall.protocol.PrimaryInfo;
 
@@ -74,7 +74,7 @@
 
   public static Info getInfo(Context context, PrimaryCallState state, PrimaryInfo primaryInfo) {
     CharSequence label;
-    boolean isTimerVisible = state.state() == State.ACTIVE;
+    boolean isTimerVisible = state.state() == DialerCallState.ACTIVE;
     boolean isForwardIconVisible = state.isForwardedNumber();
     boolean isWorkIconVisible = state.isWorkCall();
     boolean isHdIconVisible = state.isHdAudioCall() && !isForwardIconVisible;
@@ -86,13 +86,13 @@
       label = context.getString(R.string.contact_grid_incoming_suspected_spam);
       isSpamIconVisible = true;
       isHdIconVisible = false;
-    } else if (state.state() == State.DISCONNECTING) {
+    } else if (state.state() == DialerCallState.DISCONNECTING) {
       // While in the DISCONNECTING state we display a "Hanging up" message in order to make the UI
       // feel more responsive.  (In GSM it's normal to see a delay of a couple of seconds while
       // negotiating the disconnect with the network, so the "Hanging up" state at least lets the
       // user know that we're doing something.  This state is currently not used with CDMA.)
       label = context.getString(R.string.incall_hanging_up);
-    } else if (state.state() == State.DISCONNECTED) {
+    } else if (state.state() == DialerCallState.DISCONNECTED) {
       label = state.disconnectCause().getLabel();
       if (TextUtils.isEmpty(label)) {
         label = context.getString(R.string.incall_call_ended);
@@ -134,6 +134,7 @@
   }
 
   private static boolean isIncoming(PrimaryCallState state) {
-    return state.state() == State.INCOMING || state.state() == State.CALL_WAITING;
+    return state.state() == DialerCallState.INCOMING
+        || state.state() == DialerCallState.CALL_WAITING;
   }
 }
diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java
index 89300ca..82a103a 100644
--- a/java/com/android/incallui/contactgrid/TopRow.java
+++ b/java/com/android/incallui/contactgrid/TopRow.java
@@ -25,7 +25,7 @@
 import android.text.TextUtils;
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.incall.protocol.PrimaryCallState;
 import com.android.incallui.incall.protocol.PrimaryInfo;
 import com.android.incallui.videotech.utils.SessionModificationState;
@@ -69,7 +69,8 @@
       icon = context.getDrawable(R.drawable.quantum_ic_network_wifi_vd_theme_24);
     }
 
-    if (state.state() == State.INCOMING || state.state() == State.CALL_WAITING) {
+    if (state.state() == DialerCallState.INCOMING
+        || state.state() == DialerCallState.CALL_WAITING) {
       // Call from
       // [Wi-Fi icon] Video call from
       // Hey Jake, pick up!
@@ -87,18 +88,20 @@
     } else if (VideoUtils.hasSentVideoUpgradeRequest(state.sessionModificationState())
         || VideoUtils.hasReceivedVideoUpgradeRequest(state.sessionModificationState())) {
       label = getLabelForVideoRequest(context, state);
-    } else if (state.state() == State.PULLING) {
+    } else if (state.state() == DialerCallState.PULLING) {
       label = context.getString(R.string.incall_transferring);
-    } else if (state.state() == State.DIALING || state.state() == State.CONNECTING) {
+    } else if (state.state() == DialerCallState.DIALING
+        || state.state() == DialerCallState.CONNECTING) {
       // [Wi-Fi icon] Calling via Google Guest
       // Calling...
       label = getLabelForDialing(context, state);
-    } else if (state.state() == State.ACTIVE && state.isRemotelyHeld()) {
+    } else if (state.state() == DialerCallState.ACTIVE && state.isRemotelyHeld()) {
       label = context.getString(R.string.incall_remotely_held);
-    } else if (state.state() == State.ACTIVE
+    } else if (state.state() == DialerCallState.ACTIVE
         && shouldShowNumber(primaryInfo, false /* isIncoming */)) {
       label = spanDisplayNumber(primaryInfo.number());
-    } else if (state.state() == State.CALL_PENDING && !TextUtils.isEmpty(state.customLabel())) {
+    } else if (state.state() == DialerCallState.CALL_PENDING
+        && !TextUtils.isEmpty(state.customLabel())) {
       label = state.customLabel();
     } else {
       // Video calling...
diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
index 1d23036..423f868 100644
--- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java
+++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
@@ -24,8 +24,7 @@
 import com.android.dialer.assisteddialing.TransformationInfo;
 import com.android.dialer.common.Assert;
 import com.android.dialer.preferredsim.suggestion.SuggestionProvider;
-import com.android.incallui.call.DialerCall;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.videotech.utils.SessionModificationState;
 import com.google.auto.value.AutoValue;
 import java.lang.annotation.Retention;
@@ -111,7 +110,7 @@
 
   public static Builder builder() {
     return new AutoValue_PrimaryCallState.Builder()
-        .setState(DialerCall.State.IDLE)
+        .setState(DialerCallState.IDLE)
         .setIsVideoCall(false)
         .setSessionModificationState(SessionModificationState.NO_REQUEST)
         .setDisconnectCause(new DisconnectCause(DisconnectCause.UNKNOWN))
@@ -193,7 +192,7 @@
     public PrimaryCallState build() {
       PrimaryCallState primaryCallState = autoBuild();
       if (!TextUtils.isEmpty(primaryCallState.customLabel())) {
-        Assert.checkArgument(primaryCallState.state() == State.CALL_PENDING);
+        Assert.checkArgument(primaryCallState.state() == DialerCallState.CALL_PENDING);
       }
       return primaryCallState;
     }
diff --git a/java/com/android/incallui/ringtone/DialerRingtoneManager.java b/java/com/android/incallui/ringtone/DialerRingtoneManager.java
index b8a3071..777133e 100644
--- a/java/com/android/incallui/ringtone/DialerRingtoneManager.java
+++ b/java/com/android/incallui/ringtone/DialerRingtoneManager.java
@@ -22,7 +22,7 @@
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import com.android.incallui.call.CallList;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import java.util.Objects;
 
 /**
@@ -44,7 +44,7 @@
    * Creates the DialerRingtoneManager with the given {@link InCallTonePlayer}.
    *
    * @param inCallTonePlayer the tone player used to play in-call tones.
-   * @param callList the CallList used to check for {@link State#CALL_WAITING}
+   * @param callList the CallList used to check for {@link DialerCallState#CALL_WAITING}
    * @throws NullPointerException if inCallTonePlayer or callList are null
    */
   public DialerRingtoneManager(
@@ -54,8 +54,8 @@
   }
 
   /**
-   * Determines if a ringtone should be played for the given call state (see {@link State}) and
-   * {@link Uri}.
+   * Determines if a ringtone should be played for the given call state (see {@link
+   * DialerCallState}) and {@link Uri}.
    *
    * @param callState the call state for the call being checked.
    * @param ringtoneUri the ringtone to potentially play.
@@ -63,7 +63,7 @@
    */
   public boolean shouldPlayRingtone(int callState, @Nullable Uri ringtoneUri) {
     return isDialerRingingEnabled()
-        && translateCallStateForCallWaiting(callState) == State.INCOMING
+        && translateCallStateForCallWaiting(callState) == DialerCallState.INCOMING
         && ringtoneUri != null;
   }
 
@@ -79,14 +79,16 @@
   }
 
   /**
-   * The incoming callState is never set as {@link State#CALL_WAITING} because {@link
+   * The incoming callState is never set as {@link DialerCallState#CALL_WAITING} because {@link
    * DialerCall#translateState(int)} doesn't account for that case, check for it here
    */
   private int translateCallStateForCallWaiting(int callState) {
-    if (callState != State.INCOMING) {
+    if (callState != DialerCallState.INCOMING) {
       return callState;
     }
-    return callList.getActiveCall() == null ? State.INCOMING : State.CALL_WAITING;
+    return callList.getActiveCall() == null
+        ? DialerCallState.INCOMING
+        : DialerCallState.CALL_WAITING;
   }
 
   private boolean isDialerRingingEnabled() {
@@ -97,14 +99,14 @@
 
   /**
    * Determines if a call waiting tone should be played for the the given call state (see {@link
-   * State}).
+   * DialerCallState}).
    *
    * @param callState the call state for the call being checked.
    * @return {@code true} if the call waiting tone should be played, {@code false} otherwise.
    */
   public boolean shouldPlayCallWaitingTone(int callState) {
     return isDialerRingingEnabled()
-        && translateCallStateForCallWaiting(callState) == State.CALL_WAITING
+        && translateCallStateForCallWaiting(callState) == DialerCallState.CALL_WAITING
         && !inCallTonePlayer.isPlayingTone();
   }
 
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java
index 13e013f..1c43f51 100644
--- a/java/com/android/incallui/rtt/impl/RttChatFragment.java
+++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java
@@ -55,7 +55,7 @@
 import com.android.dialer.rtt.RttTranscriptMessage;
 import com.android.dialer.util.DrawableConverter;
 import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter;
-import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.state.DialerCallState;
 import com.android.incallui.hold.OnHoldFragment;
 import com.android.incallui.incall.protocol.ContactPhotoType;
 import com.android.incallui.incall.protocol.InCallButtonIds;
@@ -452,7 +452,7 @@
   public void setCallState(@NonNull PrimaryCallState primaryCallState) {
     LogUtil.i("RttChatFragment.setCallState", primaryCallState.toString());
     this.primaryCallState = primaryCallState;
-    if (!isTimerStarted && primaryCallState.state() == State.ACTIVE) {
+    if (!isTimerStarted && primaryCallState.state() == DialerCallState.ACTIVE) {
       LogUtil.i(
           "RttChatFragment.setCallState", "starting timer with base: %d", chronometer.getBase());
       chronometer.setBase(
@@ -469,12 +469,12 @@
       }
       adapter.showAdvisory();
     }
-    if (primaryCallState.state() == State.DIALING) {
+    if (primaryCallState.state() == DialerCallState.DIALING) {
       showWaitingForJoinBanner();
     } else {
       hideWaitingForJoinBanner();
     }
-    if (primaryCallState.state() == State.DISCONNECTED) {
+    if (primaryCallState.state() == DialerCallState.DISCONNECTED) {
       rttCallScreenDelegate.onSaveRttTranscript();
     }
   }
