diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index f9311f8..a55770c 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -81,6 +81,7 @@
   public static final int PENDING_INTENT_REQUEST_CODE_BUBBLE = 2;
 
   private static final String TAG_ANSWER_SCREEN = "tag_answer_screen";
+  private static final String TAG_DIALPAD_FRAGMENT = "tag_dialpad_fragment";
   private static final String TAG_INTERNATIONAL_CALL_ON_WIFI = "tag_international_call_on_wifi";
   private static final String TAG_IN_CALL_SCREEN = "tag_in_call_screen";
   private static final String TAG_VIDEO_CALL_SCREEN = "tag_video_call_screen";
@@ -92,6 +93,7 @@
   private static final String CONFIG_ANSWER_AND_RELEASE_ENABLED = "answer_and_release_enabled";
 
   private final InCallActivityCommon common;
+  private InCallOrientationEventListener inCallOrientationEventListener;
   private boolean didShowAnswerScreen;
   private boolean didShowInCallScreen;
   private boolean didShowVideoCallScreen;
@@ -144,6 +146,7 @@
     }
 
     common.onCreate(icicle);
+    inCallOrientationEventListener = new InCallOrientationEventListener(this);
 
     getWindow()
         .getDecorView()
@@ -346,7 +349,21 @@
   }
 
   public boolean isDialpadVisible() {
-    return common.isDialpadVisible();
+    DialpadFragment dialpadFragment = getDialpadFragment();
+    return dialpadFragment != null && dialpadFragment.isVisible();
+  }
+
+  /**
+   * Returns the {@link DialpadFragment} that's shown by this activity, or {@code null}
+   * TODO(a bug): Make this method private after InCallActivityCommon is deleted.
+   */
+  @Nullable
+  DialpadFragment getDialpadFragment() {
+    FragmentManager fragmentManager = getDialpadFragmentManager();
+    if (fragmentManager == null) {
+      return null;
+    }
+    return (DialpadFragment) fragmentManager.findFragmentByTag(TAG_DIALPAD_FRAGMENT);
   }
 
   public void onForegroundCallChanged(DialerCall newForegroundCall) {
@@ -489,8 +506,13 @@
     needDismissPendingDialogs = false;
   }
 
-  private void enableInCallOrientationEventListener(boolean enable) {
-    common.enableInCallOrientationEventListener(enable);
+  // TODO(a bug): Make this method private after InCallActivityCommon is deleted.
+  void enableInCallOrientationEventListener(boolean enable) {
+    if (enable) {
+      inCallOrientationEventListener.enable(true /* notifyDeviceOrientationChange */);
+    } else {
+      inCallOrientationEventListener.disable();
+    }
   }
 
   public void setExcludeFromRecents(boolean exclude) {
diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java
index 5e68ce8..f92e785 100644
--- a/java/com/android/incallui/InCallActivityCommon.java
+++ b/java/com/android/incallui/InCallActivityCommon.java
@@ -107,7 +107,6 @@
   private String showPostCharWaitDialogChars;
   private Dialog errorDialog;
   private SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment;
-  private InCallOrientationEventListener inCallOrientationEventListener;
   private Animation dialpadSlideInAnimation;
   private Animation dialpadSlideOutAnimation;
   private boolean animateDialpadOnShow;
@@ -242,14 +241,12 @@
           "InCallActivityCommon.onCreate", "international fragment exists attaching callback");
       existingInternationalFragment.setCallback(internationalCallOnWifiCallback);
     }
-
-    inCallOrientationEventListener = new InCallOrientationEventListener(inCallActivity);
   }
 
   public void onSaveInstanceState(Bundle out) {
     // TODO: The dialpad fragment should handle this as part of its own state
-    out.putBoolean(INTENT_EXTRA_SHOW_DIALPAD, isDialpadVisible());
-    DialpadFragment dialpadFragment = getDialpadFragment();
+    out.putBoolean(INTENT_EXTRA_SHOW_DIALPAD, inCallActivity.isDialpadVisible());
+    DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
     if (dialpadFragment != null) {
       out.putString(DIALPAD_TEXT_KEY, dialpadFragment.getDtmfText());
     }
@@ -259,7 +256,7 @@
     Trace.beginSection("InCallActivityCommon.onStart");
     // setting activity should be last thing in setup process
     InCallPresenter.getInstance().setActivity(inCallActivity);
-    enableInCallOrientationEventListener(
+    inCallActivity.enableInCallOrientationEventListener(
         inCallActivity.getRequestedOrientation()
             == InCallOrientationEventListener.ACTIVITY_PREFERENCE_ALLOW_ROTATION);
 
@@ -288,20 +285,20 @@
         inCallActivity.showDialpadFragment(true /* show */, animateDialpadOnShow /* animate */);
         animateDialpadOnShow = false;
 
-        DialpadFragment dialpadFragment = getDialpadFragment();
+        DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
         if (dialpadFragment != null) {
           dialpadFragment.setDtmfText(dtmfTextToPreopulate);
           dtmfTextToPreopulate = null;
         }
       } else {
         LogUtil.i("InCallActivityCommon.onResume", "force hide dialpad");
-        if (getDialpadFragment() != null) {
+        if (inCallActivity.getDialpadFragment() != null) {
           inCallActivity.showDialpadFragment(false /* show */, false /* animate */);
         }
       }
       showDialpadRequest = DIALPAD_REQUEST_NONE;
     }
-    updateNavigationBar(isDialpadVisible());
+    updateNavigationBar(inCallActivity.isDialpadVisible());
 
     if (showPostCharWaitDialogOnResume) {
       showPostCharWaitDialog(showPostCharWaitDialogCallId, showPostCharWaitDialogChars);
@@ -316,7 +313,7 @@
   // onPause is guaranteed to be called when the InCallActivity goes
   // in the background.
   public void onPause() {
-    DialpadFragment dialpadFragment = getDialpadFragment();
+    DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
     if (dialpadFragment != null) {
       dialpadFragment.onDialerKeyUp(null);
     }
@@ -340,7 +337,7 @@
       }
     }
 
-    enableInCallOrientationEventListener(false);
+    inCallActivity.enableInCallOrientationEventListener(false);
     InCallPresenter.getInstance().updateIsChangingConfigurations();
     InCallPresenter.getInstance().onActivityStopped();
     if (!isRecreating) {
@@ -392,7 +389,7 @@
       return true;
     }
 
-    DialpadFragment dialpadFragment = getDialpadFragment();
+    DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
     if (dialpadFragment != null && dialpadFragment.isVisible()) {
       inCallActivity.showDialpadFragment(false /* show */, true /* animate */);
       return true;
@@ -410,7 +407,7 @@
   }
 
   public boolean onKeyUp(int keyCode, KeyEvent event) {
-    DialpadFragment dialpadFragment = getDialpadFragment();
+    DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
     // push input to the dialer.
     if (dialpadFragment != null
         && (dialpadFragment.isVisible())
@@ -515,7 +512,7 @@
     // As soon as the user starts typing valid dialable keys on the
     // keyboard (presumably to type DTMF tones) we start passing the
     // key events to the DTMFDialer's onDialerKeyDown.
-    DialpadFragment dialpadFragment = getDialpadFragment();
+    DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
     if (dialpadFragment != null && dialpadFragment.isVisible()) {
       return dialpadFragment.onDialerKeyDown(event);
     }
@@ -602,14 +599,6 @@
     CallList.getInstance().onErrorDialogDismissed();
   }
 
-  public void enableInCallOrientationEventListener(boolean enable) {
-    if (enable) {
-      inCallOrientationEventListener.enable(true);
-    } else {
-      inCallOrientationEventListener.disable();
-    }
-  }
-
   public void setExcludeFromRecents(boolean exclude) {
     List<AppTask> tasks = inCallActivity.getSystemService(ActivityManager.class).getAppTasks();
     int taskId = inCallActivity.getTaskId();
@@ -717,7 +706,7 @@
 
   public boolean showDialpadFragment(boolean show, boolean animate) {
     // If the dialpad is already visible, don't animate in. If it's gone, don't animate out.
-    boolean isDialpadVisible = isDialpadVisible();
+    boolean isDialpadVisible = inCallActivity.isDialpadVisible();
     LogUtil.i(
         "InCallActivityCommon.showDialpadFragment",
         "show: %b, animate: %b, " + "isDialpadVisible: %b",
@@ -746,9 +735,10 @@
     } else {
       if (show) {
         performShowDialpadFragment(dialpadFragmentManager);
-        getDialpadFragment().animateShowDialpad();
+        inCallActivity.getDialpadFragment().animateShowDialpad();
       }
-      getDialpadFragment()
+      inCallActivity
+          .getDialpadFragment()
           .getView()
           .startAnimation(show ? dialpadSlideInAnimation : dialpadSlideOutAnimation);
     }
@@ -763,7 +753,7 @@
 
   private void performShowDialpadFragment(@NonNull FragmentManager dialpadFragmentManager) {
     FragmentTransaction transaction = dialpadFragmentManager.beginTransaction();
-    DialpadFragment dialpadFragment = getDialpadFragment();
+    DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
     if (dialpadFragment == null) {
       transaction.add(
           inCallActivity.getDialpadContainerId(), new DialpadFragment(), TAG_DIALPAD_FRAGMENT);
@@ -796,21 +786,6 @@
     updateNavigationBar(false /* isDialpadVisible */);
   }
 
-  public boolean isDialpadVisible() {
-    DialpadFragment dialpadFragment = getDialpadFragment();
-    return dialpadFragment != null && dialpadFragment.isVisible();
-  }
-
-  /** Returns the {@link DialpadFragment} that's shown by this activity, or {@code null} */
-  @Nullable
-  private DialpadFragment getDialpadFragment() {
-    FragmentManager fragmentManager = inCallActivity.getDialpadFragmentManager();
-    if (fragmentManager == null) {
-      return null;
-    }
-    return (DialpadFragment) fragmentManager.findFragmentByTag(TAG_DIALPAD_FRAGMENT);
-  }
-
   public void updateTaskDescription() {
     Resources resources = inCallActivity.getResources();
     int color;
diff --git a/java/com/android/incallui/InCallOrientationEventListener.java b/java/com/android/incallui/InCallOrientationEventListener.java
index e6b0bc0..8aae6fb 100644
--- a/java/com/android/incallui/InCallOrientationEventListener.java
+++ b/java/com/android/incallui/InCallOrientationEventListener.java
@@ -126,12 +126,13 @@
   }
 
   /**
-   * Enables the OrientationEventListener and notifies listeners of current orientation if notify
-   * flag is true
+   * Enables the OrientationEventListener and optionally notifies listeners of the current
+   * orientation.
    *
-   * @param notify true or false. Notify device orientation changed if true.
+   * @param notifyDeviceOrientationChange Whether to notify listeners that the device orientation is
+   *     changed.
    */
-  public void enable(boolean notify) {
+  public void enable(boolean notifyDeviceOrientationChange) {
     if (mEnabled) {
       Log.v(this, "enable: Orientation listener is already enabled. Ignoring...");
       return;
@@ -139,15 +140,15 @@
 
     super.enable();
     mEnabled = true;
-    if (notify) {
+    if (notifyDeviceOrientationChange) {
       InCallPresenter.getInstance().onDeviceOrientationChange(sCurrentOrientation);
     }
   }
 
-  /** Enables the OrientationEventListener with notify flag defaulting to false. */
+  /** Enables the OrientationEventListener. */
   @Override
   public void enable() {
-    enable(false);
+    enable(false /* notifyDeviceOrientationChange */);
   }
 
   /** Disables the OrientationEventListener. */
