Remove connection substate

Bug:20300433
Change-Id: I4148ac2677598d4db60950712fda2a3be726d791
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 7edda41..d5181fe 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -92,7 +92,6 @@
         void onPhoneAccountChanged(Call call);
         void onConferenceableCallsChanged(Call call);
         boolean onCanceledViaNewOutgoingCallBroadcast(Call call);
-        void onCallSubstateChanged(Call call);
     }
 
     public abstract static class ListenerBase implements Listener {
@@ -148,7 +147,6 @@
         public boolean onCanceledViaNewOutgoingCallBroadcast(Call call) {
             return false;
         }
-        public void onCallSubstateChanged(Call call) {}
     }
 
     private final OnQueryCompleteListener mCallerInfoQueryListener =
@@ -312,7 +310,6 @@
     private final Context mContext;
     private final CallsManager mCallsManager;
     private final TelecomSystem.SyncRoot mLock;
-    private int mCallSubstate;
     private final CallerInfoAsyncQueryFactory mCallerInfoAsyncQueryFactory;
 
     private boolean mWasConferencePreviouslyMerged = false;
@@ -426,7 +423,7 @@
 
 
 
-        return String.format(Locale.US, "[%s, %s, %s, %s, %s, childs(%d), has_parent(%b), [%s], %d]",
+        return String.format(Locale.US, "[%s, %s, %s, %s, %s, childs(%d), has_parent(%b), [%s]]",
                 System.identityHashCode(this),
                 CallState.toString(mState),
                 component,
@@ -434,8 +431,7 @@
                 getVideoStateDescription(getVideoState()),
                 getChildCalls().size(),
                 getParentCall() != null,
-                Connection.capabilitiesToString(getConnectionCapabilities()),
-                getCallSubstate());
+                Connection.capabilitiesToString(getConnectionCapabilities()));
     }
 
     /**
@@ -847,7 +843,6 @@
         setRingbackRequested(connection.isRingbackRequested());
         setIsVoipAudioMode(connection.getIsVoipAudioMode());
         setStatusHints(connection.getStatusHints());
-        setCallSubstate(connection.getCallSubstate());
 
         mConferenceableCalls.clear();
         for (String id : connection.getConferenceableConnectionIds()) {
@@ -1549,25 +1544,4 @@
         }
         return CallState.DISCONNECTED;
     }
-
-    /**
-     * The current call substate.
-     */
-    public int getCallSubstate() {
-        return mCallSubstate;
-    }
-
-
-    /**
-     * Determines the current substate for the call.
-     *
-     * @param callSubstate The substate for the call.
-     */
-    public void setCallSubstate(int callSubstate) {
-        mCallSubstate = callSubstate;
-
-        for (Listener l : mListeners) {
-            l.onCallSubstateChanged(this);
-        }
-    }
 }
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 0d57c8a..4267112 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -80,7 +80,6 @@
         void onIsVoipAudioModeChanged(Call call);
         void onVideoStateChanged(Call call);
         void onCanAddCallChanged(boolean canAddCall);
-        void onCallSubstateChanged(Call call);
     }
 
     private static final String TAG = "CallsManager";
@@ -378,12 +377,6 @@
         return Collections.unmodifiableCollection(mCalls);
     }
 
-    public void onCallSubstateChanged(Call call) {
-        for (CallsManagerListener listener : mListeners) {
-            listener.onCallSubstateChanged(call);
-        }
-    }
-
     Call getForegroundCall() {
         return mForegroundCall;
     }
diff --git a/src/com/android/server/telecom/CallsManagerListenerBase.java b/src/com/android/server/telecom/CallsManagerListenerBase.java
index 07839db..6b54709 100644
--- a/src/com/android/server/telecom/CallsManagerListenerBase.java
+++ b/src/com/android/server/telecom/CallsManagerListenerBase.java
@@ -76,8 +76,4 @@
     @Override
     public void onCanAddCallChanged(boolean canAddCall) {
     }
-
-    @Override
-    public void onCallSubstateChanged(Call call) {
-    }
 }
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index fc5e099..f7f98d1 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -537,25 +537,6 @@
                 Binder.restoreCallingIdentity(token);
             }
         }
-
-        @Override
-        public void setCallSubstate(String callId, int callSubstate) {
-            long token = Binder.clearCallingIdentity();
-            try {
-                synchronized (mLock) {
-                    logIncoming("setCallSubstate %s %d", callId, callSubstate);
-                    if (mCallIdMapper.isValidCallId(callId)) {
-                        Call call = mCallIdMapper.getCall(callId);
-
-                        if (call != null) {
-                            call.setCallSubstate(callSubstate);
-                        }
-                    }
-                }
-            } finally {
-                Binder.restoreCallingIdentity(token);
-            }
-        }
     }
 
     private final Adapter mAdapter = new Adapter();
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 4c44bd7..92a99da 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -119,11 +119,6 @@
         public void onConferenceableCallsChanged(Call call) {
             updateCall(call);
         }
-
-        @Override
-        public void onCallSubstateChanged(Call call) {
-            updateCall(call);
-        }
     };
 
     /**
@@ -558,8 +553,7 @@
                 call.getStatusHints(),
                 call.getVideoState(),
                 conferenceableCallIds,
-                call.getExtras(),
-                call.getCallSubstate());
+                call.getExtras());
     }
 
     private static final int[] CONNECTION_TO_CALL_CAPABILITY = new int[] {
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
index b99ee13..a27be39 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
@@ -118,11 +118,6 @@
                 }
                 setConferenceableConnections(c);
             }
-
-            @Override
-            public void onCallSubstateChanged(RemoteConnection connection, int callSubstate) {
-                setCallSubstate(callSubstate);
-            }
         };
 
         private final RemoteConnection mRemote;
diff --git a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
index 8779f41..5114a52 100644
--- a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
@@ -353,7 +353,6 @@
                 false, /* voip audio mode */
                 c.statusHints,
                 c.disconnectCause,
-                c.conferenceableConnectionIds,
-                0 /* call substate */);
+                c.conferenceableConnectionIds);
     }
 }