Clear video pause tracker when video un-pause reported by the modem. am: 077dd3fef0
am: 3a4673417d

Change-Id: I282592ec251b489d73b6307a4bccf0e1a0930307
diff --git a/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java b/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java
index 1aae533..d6da824 100644
--- a/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java
+++ b/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java
@@ -535,4 +535,19 @@
     public void setUseVideoPauseWorkaround(boolean useVideoPauseWorkaround) {
         mUseVideoPauseWorkaround = useVideoPauseWorkaround;
     }
+
+    /**
+     * Called by {@code ImsPhoneConnection} when there is a change to the video state of the call.
+     * Informs the video pause tracker that the video is no longer paused.  This ensures that
+     * subsequent pause requests are not filtered out.
+     *
+     * @param newVideoState The new video state.
+     */
+    public void onVideoStateChanged(int newVideoState) {
+        if (mVideoPauseTracker.isPaused() && !VideoProfile.isPaused(newVideoState)) {
+            Log.i(this, "onVideoStateChanged: newVideoState=%s, clearing pending pause requests.",
+                    VideoProfile.videoStateToString(newVideoState));
+            mVideoPauseTracker.clearPauseRequests();
+        }
+    }
 }
diff --git a/src/java/com/android/ims/internal/VideoPauseTracker.java b/src/java/com/android/ims/internal/VideoPauseTracker.java
index d37f7fa..a23c590 100644
--- a/src/java/com/android/ims/internal/VideoPauseTracker.java
+++ b/src/java/com/android/ims/internal/VideoPauseTracker.java
@@ -150,6 +150,15 @@
     }
 
     /**
+     * Clears pending pause requests for the tracker.
+     */
+    public void clearPauseRequests() {
+        synchronized (mPauseRequestsLock) {
+            mPauseRequests.clear();
+        }
+    }
+
+    /**
      * Returns a string equivalent of a {@code SOURCE_*} constant.
      *
      * @param source A {@code SOURCE_*} constant.