Use TransactionSafeActivity

Remove custom visibility tracking.

Bug:24294419
Change-Id: I601c9a1c14db7c53d5c7b4a0acbb41b553e10e96
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 1098341..6b80fe0 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -51,6 +51,7 @@
 
 import com.android.phone.common.animation.AnimUtils;
 import com.android.phone.common.animation.AnimationListenerAdapter;
+import com.android.contacts.common.activity.TransactionSafeActivity;
 import com.android.contacts.common.interactions.TouchPointManager;
 import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment;
 import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener;
@@ -63,7 +64,7 @@
 /**
  * Main activity that the user interacts with while in a live call.
  */
-public class InCallActivity extends Activity implements FragmentDisplayManager {
+public class InCallActivity extends TransactionSafeActivity implements FragmentDisplayManager {
 
     public static final String TAG = InCallActivity.class.getSimpleName();
 
@@ -84,7 +85,6 @@
     private ConferenceManagerFragment mConferenceManagerFragment;
     private FragmentManager mChildFragmentManager;
 
-    private boolean mIsVisible;
     private AlertDialog mDialog;
 
     /** Use to pass 'showDialpad' from {@link #onNewIntent} to {@link #onResume} */
@@ -239,7 +239,6 @@
 
     @Override
     protected void onSaveInstanceState(Bundle out) {
-        mIsVisible = false;
         // TODO: The dialpad fragment should handle this as part of its own state
         out.putBoolean(SHOW_DIALPAD_EXTRA,
                 mCallButtonFragment != null && mCallButtonFragment.isDialpadVisible());
@@ -254,8 +253,6 @@
         Log.d(this, "onStart()...");
         super.onStart();
 
-        mIsVisible = true;
-
         if (mOrientationEventListener.canDetectOrientation()) {
             Log.v(this, "Orientation detection enabled.");
             mOrientationEventListener.enable();
@@ -314,7 +311,6 @@
     @Override
     protected void onStop() {
         Log.d(this, "onStop()...");
-        mIsVisible = false;
         InCallPresenter.getInstance().updateIsChangingConfigurations();
         InCallPresenter.getInstance().onActivityStopped();
         mOrientationEventListener.disable();
@@ -353,10 +349,10 @@
     }
 
     /**
-     * Returns true when the Activity is currently visible (between onStart and onStop).
+     * Returns true when the Activity is currently visible.
      */
     /* package */ boolean isVisible() {
-        return mIsVisible;
+        return isSafeToCommitTransactions();
     }
 
     private boolean hasPendingDialogs() {