Rename SessionManagerState to SessionState

PiperOrigin-RevId: 249695787
Change-Id: I4a0416fcb796010fb6e6e8c6b79942b5b8268ac6
diff --git a/src/main/java/com/google/android/libraries/feed/api/host/scheduler/SchedulerApi.java b/src/main/java/com/google/android/libraries/feed/api/host/scheduler/SchedulerApi.java
index 7a44a2b..bea1f61 100644
--- a/src/main/java/com/google/android/libraries/feed/api/host/scheduler/SchedulerApi.java
+++ b/src/main/java/com/google/android/libraries/feed/api/host/scheduler/SchedulerApi.java
@@ -65,9 +65,9 @@
     int NEXT_VALUE = 7;
   }
 
-  /** Object which contains the current state of the SessionManager. */
-  final class SessionManagerState {
-    /** Does the SessionManager have content? */
+  /** Object which contains the current state of the session. */
+  final class SessionState {
+    /** Does the session have content? */
     public final boolean hasContent;
     /**
      * Returns the date/time of when the content was added. This will only be set when {@code
@@ -77,7 +77,7 @@
     /** Is there an outstanding request being made? */
     public final boolean hasOutstandingRequest;
 
-    public SessionManagerState(
+    public SessionState(
         boolean hasContent, long contentCreationDateTimeMs, boolean hasOutstandingRequest) {
       this.hasContent = hasContent;
       this.contentCreationDateTimeMs = contentCreationDateTimeMs;
@@ -87,7 +87,7 @@
 
   /** Called when a Session is created to determine what behavior we should implement. */
   @RequestBehavior
-  int shouldSessionRequestData(SessionManagerState sessionManagerState);
+  int shouldSessionRequestData(SessionState sessionState);
 
   /** Notify scheduler that new content has been received. */
   void onReceiveNewContent(long contentCreationDateTimeMs);
diff --git a/src/main/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImpl.java b/src/main/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImpl.java
index c0d7c17..0705c50 100644
--- a/src/main/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImpl.java
+++ b/src/main/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImpl.java
@@ -24,7 +24,7 @@
 import com.google.android.libraries.feed.api.host.logging.Task;
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi;
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.RequestBehavior;
-import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionManagerState;
+import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionState;
 import com.google.android.libraries.feed.api.internal.common.PayloadWithId;
 import com.google.android.libraries.feed.api.internal.common.ThreadUtils;
 import com.google.android.libraries.feed.api.internal.modelprovider.ModelError;
@@ -266,27 +266,27 @@
   // new session.
   private void populateSession(InitializableSession session, UiContext uiContext) {
 
-    // Create SessionManagerState and call SchedulerApi to determine what the session-creation
+    // Create SessionState and call SchedulerApi to determine what the session-creation
     // experience should be.
-    SessionManagerState sessionManagerState =
-        new SessionManagerState(
+    SessionState sessionState =
+        new SessionState(
             !sessionCache.getHead().isHeadEmpty(),
             sessionCache.getHeadLastAddedTimeMillis(),
             taskQueue.isMakingRequest());
     Logger.i(
         TAG,
         "shouldSessionRequestData; hasContent(%b), contentCreationTime(%d), outstandingRequest(%b)",
-        sessionManagerState.hasContent,
-        sessionManagerState.contentCreationDateTimeMs,
-        sessionManagerState.hasOutstandingRequest);
-    @RequestBehavior int behavior = schedulerApi.shouldSessionRequestData(sessionManagerState);
+        sessionState.hasContent,
+        sessionState.contentCreationDateTimeMs,
+        sessionState.hasOutstandingRequest);
+    @RequestBehavior int behavior = schedulerApi.shouldSessionRequestData(sessionState);
 
-    // Based on sessionManagerState and behavior, determine if FeedSessionManager should start a
+    // Based on sessionState and behavior, determine if FeedSessionManager should start a
     // request, append an ongoing request to this session, or include a timeout.
-    boolean shouldAppendOutstandingRequest = shouldAppendToSession(sessionManagerState, behavior);
-    boolean shouldStartRequest = shouldStartRequest(sessionManagerState, behavior);
+    boolean shouldAppendOutstandingRequest = shouldAppendToSession(sessionState, behavior);
+    boolean shouldStartRequest = shouldStartRequest(sessionState, behavior);
     Runnable timeoutTask =
-        shouldPopulateWithTimeout(sessionManagerState, behavior)
+        shouldPopulateWithTimeout(sessionState, behavior)
             ? () -> populateSessionTask(session, shouldAppendOutstandingRequest, uiContext)
             : null;
     Logger.i(
@@ -883,32 +883,32 @@
   }
 
   private static boolean shouldAppendToSession(
-      SessionManagerState sessionManagerState, @RequestBehavior int requestBehavior) {
+      SessionState sessionState, @RequestBehavior int requestBehavior) {
     switch (requestBehavior) {
       case RequestBehavior.REQUEST_WITH_CONTENT: // Fall-through
       case RequestBehavior.REQUEST_WITH_TIMEOUT:
-        return sessionManagerState.hasContent;
+        return sessionState.hasContent;
       case RequestBehavior.NO_REQUEST_WITH_CONTENT: // Fall-through
       case RequestBehavior.NO_REQUEST_WITH_TIMEOUT:
-        return sessionManagerState.hasContent && sessionManagerState.hasOutstandingRequest;
+        return sessionState.hasContent && sessionState.hasOutstandingRequest;
       default:
         return false;
     }
   }
 
   private static boolean shouldStartRequest(
-      SessionManagerState sessionManagerState, @RequestBehavior int requestBehavior) {
+      SessionState sessionState, @RequestBehavior int requestBehavior) {
     return (requestBehavior == RequestBehavior.REQUEST_WITH_TIMEOUT
             || requestBehavior == RequestBehavior.REQUEST_WITH_WAIT
             || requestBehavior == RequestBehavior.REQUEST_WITH_CONTENT)
-        && !sessionManagerState.hasOutstandingRequest;
+        && !sessionState.hasOutstandingRequest;
   }
 
   private static boolean shouldPopulateWithTimeout(
-      SessionManagerState sessionManagerState, @RequestBehavior int requestBehavior) {
+      SessionState sessionState, @RequestBehavior int requestBehavior) {
     return requestBehavior == RequestBehavior.REQUEST_WITH_TIMEOUT
         || (requestBehavior == RequestBehavior.NO_REQUEST_WITH_TIMEOUT
-            && sessionManagerState.hasOutstandingRequest);
+            && sessionState.hasOutstandingRequest);
   }
 
   private static String requestBehaviorToString(@RequestBehavior int requestBehavior) {
diff --git a/src/main/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapper.java b/src/main/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapper.java
index f8a9ce6..456f67d 100644
--- a/src/main/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapper.java
+++ b/src/main/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapper.java
@@ -38,14 +38,14 @@
 
   @RequestBehavior
   @Override
-  public int shouldSessionRequestData(SessionManagerState sessionManagerState) {
+  public int shouldSessionRequestData(SessionState sessionState) {
     if (threadUtils.isMainThread()) {
-      return directSchedulerApi.shouldSessionRequestData(sessionManagerState);
+      return directSchedulerApi.shouldSessionRequestData(sessionState);
     }
     SimpleSettableFuture<Integer> future = new SimpleSettableFuture<>();
     mainThreadRunner.execute(
         TAG + " shouldSessionRequestData",
-        () -> future.put(directSchedulerApi.shouldSessionRequestData(sessionManagerState)));
+        () -> future.put(directSchedulerApi.shouldSessionRequestData(sessionState)));
     try {
       return future.get();
     } catch (InterruptedException | ExecutionException e) {
diff --git a/src/main/java/com/google/android/libraries/feed/testing/conformance/scheduler/SchedulerConformanceTest.java b/src/main/java/com/google/android/libraries/feed/testing/conformance/scheduler/SchedulerConformanceTest.java
index db903e6..3977d10 100644
--- a/src/main/java/com/google/android/libraries/feed/testing/conformance/scheduler/SchedulerConformanceTest.java
+++ b/src/main/java/com/google/android/libraries/feed/testing/conformance/scheduler/SchedulerConformanceTest.java
@@ -15,7 +15,7 @@
 package com.google.android.libraries.feed.testing.conformance.scheduler;
 
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi;
-import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionManagerState;
+import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionState;
 import org.junit.Test;
 
 public abstract class SchedulerConformanceTest {
@@ -28,7 +28,7 @@
   @Test
   public void shouldSessionRequestData() {
     // Should not throw error
-    scheduler.shouldSessionRequestData(new SessionManagerState(false, 0, false));
+    scheduler.shouldSessionRequestData(new SessionState(false, 0, false));
   }
 
   @Test
diff --git a/src/main/java/com/google/android/libraries/feed/testing/host/scheduler/FakeSchedulerApi.java b/src/main/java/com/google/android/libraries/feed/testing/host/scheduler/FakeSchedulerApi.java
index 6666ae7..501d7a8 100644
--- a/src/main/java/com/google/android/libraries/feed/testing/host/scheduler/FakeSchedulerApi.java
+++ b/src/main/java/com/google/android/libraries/feed/testing/host/scheduler/FakeSchedulerApi.java
@@ -34,12 +34,12 @@
 
   @Override
   @RequestBehavior
-  public int shouldSessionRequestData(SessionManagerState sessionManagerState) {
+  public int shouldSessionRequestData(SessionState sessionState) {
     threadUtils.checkMainThread();
     return requestBehavior;
   }
 
-  /** Sets the result returned from {@link shouldSessionRequestData(SessionManagerState)}. */
+  /** Sets the result returned from {@link shouldSessionRequestData( SessionState )}. */
   public FakeSchedulerApi setRequestBehavior(@RequestBehavior int requestBehavior) {
     this.requestBehavior = requestBehavior;
     return this;
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImplTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImplTest.java
index 5208e51..172f188 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerImplTest.java
@@ -28,7 +28,7 @@
 import com.google.android.libraries.feed.api.host.logging.RequestReason;
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi;
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.RequestBehavior;
-import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionManagerState;
+import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionState;
 import com.google.android.libraries.feed.api.internal.common.ActionPropertiesWithId;
 import com.google.android.libraries.feed.api.internal.common.SemanticPropertiesWithId;
 import com.google.android.libraries.feed.api.internal.common.testing.ContentIdGenerators;
@@ -138,7 +138,7 @@
         new FakeFeedRequestManager(
             fakeThreadUtils, fakeMainThreadRunner, fakeProtocolAdapter, fakeTaskQueue);
     fakeRequestManager.queueResponse(Response.getDefaultInstance());
-    when(schedulerApi.shouldSessionRequestData(any(SessionManagerState.class)))
+    when(schedulerApi.shouldSessionRequestData(any(SessionState.class)))
         .thenReturn(RequestBehavior.NO_REQUEST_WITH_CONTENT);
   }
 
@@ -273,7 +273,7 @@
 
   @Test
   public void testNoRequestWithContent_populateIsImmediate() {
-    when(schedulerApi.shouldSessionRequestData(any(SessionManagerState.class)))
+    when(schedulerApi.shouldSessionRequestData(any(SessionState.class)))
         .thenReturn(RequestBehavior.NO_REQUEST_WITH_CONTENT);
 
     FeedSessionManagerImpl sessionManager = getInitializedSessionManager();
@@ -291,7 +291,7 @@
 
   @Test
   public void testRequestWithContent_populateIsImmediate() {
-    when(schedulerApi.shouldSessionRequestData(any(SessionManagerState.class)))
+    when(schedulerApi.shouldSessionRequestData(any(SessionState.class)))
         .thenReturn(RequestBehavior.REQUEST_WITH_CONTENT);
 
     FeedSessionManagerImpl sessionManager = getInitializedSessionManager();
@@ -309,7 +309,7 @@
 
   @Test
   public void testRequestWithWait_populateIsUserFacing() {
-    when(schedulerApi.shouldSessionRequestData(any(SessionManagerState.class)))
+    when(schedulerApi.shouldSessionRequestData(any(SessionState.class)))
         .thenReturn(RequestBehavior.REQUEST_WITH_WAIT);
 
     FeedSessionManagerImpl sessionManager = getInitializedSessionManager();
diff --git a/src/test/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapperTest.java b/src/test/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapperTest.java
index daed530..b2d8a0b 100644
--- a/src/test/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapperTest.java
+++ b/src/test/java/com/google/android/libraries/feed/hostimpl/scheduler/SchedulerApiWrapperTest.java
@@ -21,7 +21,7 @@
 import static org.mockito.MockitoAnnotations.initMocks;
 
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi;
-import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionManagerState;
+import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionState;
 import com.google.android.libraries.feed.api.internal.common.ThreadUtils;
 import com.google.android.libraries.feed.common.concurrent.testing.FakeMainThreadRunner;
 import org.junit.After;
@@ -37,13 +37,13 @@
 
   @Mock private ThreadUtils threadUtils;
   @Mock private SchedulerApi schedulerApi;
-  private SessionManagerState sessionManagerState;
+  private SessionState sessionState;
 
   private final FakeMainThreadRunner mainThreadRunner = FakeMainThreadRunner.runTasksImmediately();
 
   @Before
   public void setup() {
-    sessionManagerState = new SessionManagerState(false, 0L, false);
+    sessionState = new SessionState(false, 0L, false);
     initMocks(this);
   }
 
@@ -57,8 +57,8 @@
     when(threadUtils.isMainThread()).thenReturn(true);
     SchedulerApiWrapper wrapper =
         new SchedulerApiWrapper(schedulerApi, threadUtils, mainThreadRunner);
-    wrapper.shouldSessionRequestData(sessionManagerState);
-    verify(schedulerApi).shouldSessionRequestData(sessionManagerState);
+    wrapper.shouldSessionRequestData(sessionState);
+    verify(schedulerApi).shouldSessionRequestData(sessionState);
     assertThat(mainThreadRunner.hasTasks()).isFalse();
   }
 
@@ -67,8 +67,8 @@
     when(threadUtils.isMainThread()).thenReturn(false);
     SchedulerApiWrapper wrapper =
         new SchedulerApiWrapper(schedulerApi, threadUtils, mainThreadRunner);
-    wrapper.shouldSessionRequestData(sessionManagerState);
-    verify(schedulerApi).shouldSessionRequestData(sessionManagerState);
+    wrapper.shouldSessionRequestData(sessionState);
+    verify(schedulerApi).shouldSessionRequestData(sessionState);
     assertThat(mainThreadRunner.getCompletedTaskCount()).isEqualTo(1);
   }
 
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java b/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java
index 8468832..27586ab 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java
@@ -22,7 +22,7 @@
 import com.google.android.libraries.feed.api.host.logging.RequestReason;
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi;
 import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.RequestBehavior;
-import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionManagerState;
+import com.google.android.libraries.feed.api.host.scheduler.SchedulerApi.SessionState;
 import com.google.android.libraries.feed.api.internal.modelprovider.ModelProvider;
 import com.google.android.libraries.feed.api.internal.modelprovider.ModelProvider.ViewDepthProvider;
 import com.google.android.libraries.feed.api.internal.modelprovider.ModelProviderFactory;
@@ -120,7 +120,7 @@
 
     // The REQUEST_TWO content acts as a second request on the server, it is triggered by
     // REQUEST_WITH_CONTENT
-    when(schedulerApi.shouldSessionRequestData(any(SessionManagerState.class)))
+    when(schedulerApi.shouldSessionRequestData(any(SessionState.class)))
         .thenReturn(RequestBehavior.REQUEST_WITH_CONTENT);
     fakeFeedRequestManager.queueResponse(ResponseBuilder.forClearAllWithCards(REQUEST_TWO).build());
     ModelProvider modelProvider =
@@ -150,7 +150,7 @@
 
     // The REQUEST_TWO content acts as a second request on the server, it is triggered by
     // REQUEST_WITH_CONTENT
-    when(schedulerApi.shouldSessionRequestData(any(SessionManagerState.class)))
+    when(schedulerApi.shouldSessionRequestData(any(SessionState.class)))
         .thenReturn(RequestBehavior.REQUEST_WITH_CONTENT);
     fakeFeedRequestManager.queueResponse(
         ResponseBuilder.forClearAllWithCards(REQUEST_TWO_WITH_DUPLICATES).build());