Rename Surface Controller events to states

Bug: 217627954
Test: atest RemoteVideoPreviewTest
Change-Id: I337ac274383eb1528725b3c7c2981e196902c559
diff --git a/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java b/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
index 22d6a9d..b6eb8f3 100644
--- a/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
+++ b/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
@@ -24,7 +24,7 @@
 import static android.photopicker.cts.util.PhotoPickerUiUtils.findAddButton;
 import static android.photopicker.cts.util.PhotoPickerUiUtils.findItemList;
 import static android.photopicker.cts.util.PhotoPickerUiUtils.findPreviewAddButton;
-import static android.provider.CloudMediaProvider.CloudMediaSurfaceEventCallback.PLAYBACK_EVENT_READY;
+import static android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback.PLAYBACK_STATE_READY;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -121,7 +121,7 @@
 
         final int surfaceId = 0;
         verifyInitialVideoPreviewSetup(surfaceId, CLOUD_ID1);
-        // Remote Preview calls onMediaPlay when PLAYBACK_EVENT_READY is sent by the
+        // Remote Preview calls onMediaPlay when PLAYBACK_STATE_READY is sent by the
         // CloudMediaProvider
         verifyPlaybackStartedWhenPlayerReady(surfaceId);
 
@@ -155,7 +155,7 @@
 
         final int surfaceIdForFirstVideoPreview = 0;
         verifyInitialVideoPreviewSetup(surfaceIdForFirstVideoPreview, CLOUD_ID2);
-        // Remote Preview calls onMediaPlay when PLAYBACK_EVENT_READY is sent by the
+        // Remote Preview calls onMediaPlay when PLAYBACK_STATE_READY is sent by the
         // CloudMediaProvider
         verifyPlaybackStartedWhenPlayerReady(surfaceIdForFirstVideoPreview);
 
@@ -191,7 +191,7 @@
         // Remote Preview calls onSurfaceCreated with monotonically increasing surfaceIds
         int surfaceId = 0;
         verifyInitialVideoPreviewSetup(surfaceId, CLOUD_ID2);
-        // Remote Preview calls onMediaPlay when PLAYBACK_EVENT_READY is sent by the
+        // Remote Preview calls onMediaPlay when PLAYBACK_STATE_READY is sent by the
         // CloudMediaProvider
         verifyPlaybackStartedWhenPlayerReady(surfaceId);
 
@@ -263,7 +263,7 @@
     }
 
     private void verifyPlaybackStartedWhenPlayerReady(int surfaceId) throws Exception {
-        CloudProviderPrimary.sendPlaybackEvent(surfaceId, PLAYBACK_EVENT_READY);
+        CloudProviderPrimary.setPlaybackState(surfaceId, PLAYBACK_STATE_READY);
         // Wait for photo picker to receive the event and invoke media play via binder calls.
         MediaStore.waitForIdle(mContext.getContentResolver());
         mAssertInOrder.verify(mSurfaceControllerListener).onMediaPlay(eq(surfaceId));
diff --git a/tests/PhotoPicker/src/android/photopicker/cts/cloudproviders/CloudProviderPrimary.java b/tests/PhotoPicker/src/android/photopicker/cts/cloudproviders/CloudProviderPrimary.java
index 69e4995..3f80195 100644
--- a/tests/PhotoPicker/src/android/photopicker/cts/cloudproviders/CloudProviderPrimary.java
+++ b/tests/PhotoPicker/src/android/photopicker/cts/cloudproviders/CloudProviderPrimary.java
@@ -102,7 +102,7 @@
 
     @Override
     public CloudMediaSurfaceController onCreateCloudMediaSurfaceController(@NonNull Bundle config,
-            @NonNull CloudMediaSurfaceEventCallback callback) {
+            @NonNull CloudMediaSurfaceStateChangedCallback callback) {
         final boolean enableLoop = config.getBoolean(EXTRA_LOOPING_PLAYBACK_ENABLED, false);
         sSurfaceControllerImpl =
                 new CloudMediaSurfaceControllerImpl(getContext(), enableLoop, callback);
@@ -117,20 +117,20 @@
         return sMockSurfaceControllerListener;
     }
 
-    public static void sendPlaybackEvent(int surfaceId, int event) {
+    public static void setPlaybackState(int surfaceId, int state) {
         if (sSurfaceControllerImpl == null) {
             throw new IllegalStateException("Surface Controller object expected to be not null");
         }
 
-        sSurfaceControllerImpl.sendPlaybackEvent(surfaceId, event);
+        sSurfaceControllerImpl.sendPlaybackEvent(surfaceId, state);
     }
 
     public static class CloudMediaSurfaceControllerImpl extends CloudMediaSurfaceController {
 
-        private final CloudMediaSurfaceEventCallback mCallback;
+        private final CloudMediaSurfaceStateChangedCallback mCallback;
 
         CloudMediaSurfaceControllerImpl(Context context, boolean enableLoop,
-                CloudMediaSurfaceEventCallback callback) {
+                CloudMediaSurfaceStateChangedCallback callback) {
             mCallback = callback;
             Log.d(TAG, "Surface controller created.");
         }
@@ -199,8 +199,8 @@
             Log.d(TAG, "Surface controller destroyed.");
         }
 
-        public void sendPlaybackEvent(int surfaceId, int event) {
-            mCallback.onPlaybackEvent(surfaceId, event, null);
+        public void sendPlaybackEvent(int surfaceId, int state) {
+            mCallback.setPlaybackState(surfaceId, state, null);
         }
     }
 }