Revert "Revert "Send multiple scheduler frame timelines.""

This reverts commit caaa47d60b83670206dcd3c34382719b1f247ab5.

Reason for revert: Fix the reverted CL in 2nd CL.

Bug: 198192508
Bug: 204941507
Test: See 2nd CL.

Change-Id: I15c693c2e0a82ef81a490319da11871bd74298b3
diff --git a/libs/nativedisplay/AChoreographer.cpp b/libs/nativedisplay/AChoreographer.cpp
index 79d9b93..fc9680b 100644
--- a/libs/nativedisplay/AChoreographer.cpp
+++ b/libs/nativedisplay/AChoreographer.cpp
@@ -100,17 +100,10 @@
  * Implementation of AChoreographerFrameCallbackData.
  */
 struct ChoreographerFrameCallbackDataImpl {
-    struct FrameTimeline {
-        int64_t vsyncId{0};
-        int64_t expectedPresentTimeNanos{0};
-        int64_t deadlineNanos{0};
-    };
-
     int64_t frameTimeNanos{0};
 
-    size_t frameTimelinesLength;
-
-    std::vector<FrameTimeline> frameTimelines;
+    std::array<VsyncEventData::FrameTimeline, DisplayEventReceiver::kFrameTimelinesLength>
+            frameTimelines;
 
     size_t preferredFrameTimelineIndex;
 
@@ -456,14 +449,9 @@
 }
 
 ChoreographerFrameCallbackDataImpl Choreographer::createFrameCallbackData(nsecs_t timestamp) const {
-    std::vector<ChoreographerFrameCallbackDataImpl::FrameTimeline> frameTimelines;
-    frameTimelines.push_back({.vsyncId = mLastVsyncEventData.id,
-                              .expectedPresentTimeNanos = mLastVsyncEventData.expectedPresentTime,
-                              .deadlineNanos = mLastVsyncEventData.deadlineTimestamp});
     return {.frameTimeNanos = timestamp,
-            .frameTimelinesLength = 1,
-            .preferredFrameTimelineIndex = 0,
-            .frameTimelines = frameTimelines,
+            .preferredFrameTimelineIndex = mLastVsyncEventData.preferredFrameTimelineIndex,
+            .frameTimelines = mLastVsyncEventData.frameTimelines,
             .choreographer = this};
 }
 
@@ -646,7 +634,7 @@
             AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
     LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
                         "Data is only valid in callback");
-    return frameCallbackData->frameTimelinesLength;
+    return frameCallbackData->frameTimelines.size();
 }
 size_t AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(
         const AChoreographerFrameCallbackData* data) {
@@ -662,8 +650,8 @@
             AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
     LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
                         "Data is only valid in callback");
-    LOG_ALWAYS_FATAL_IF(index >= frameCallbackData->frameTimelinesLength, "Index out of bounds");
-    return frameCallbackData->frameTimelines[index].vsyncId;
+    LOG_ALWAYS_FATAL_IF(index >= frameCallbackData->frameTimelines.size(), "Index out of bounds");
+    return frameCallbackData->frameTimelines[index].id;
 }
 int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentTime(
         const AChoreographerFrameCallbackData* data, size_t index) {
@@ -671,8 +659,8 @@
             AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
     LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
                         "Data is only valid in callback");
-    LOG_ALWAYS_FATAL_IF(index >= frameCallbackData->frameTimelinesLength, "Index out of bounds");
-    return frameCallbackData->frameTimelines[index].expectedPresentTimeNanos;
+    LOG_ALWAYS_FATAL_IF(index >= frameCallbackData->frameTimelines.size(), "Index out of bounds");
+    return frameCallbackData->frameTimelines[index].expectedPresentTime;
 }
 int64_t AChoreographerFrameCallbackData_getFrameTimelineDeadline(
         const AChoreographerFrameCallbackData* data, size_t index) {
@@ -680,8 +668,8 @@
             AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
     LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
                         "Data is only valid in callback");
-    LOG_ALWAYS_FATAL_IF(index >= frameCallbackData->frameTimelinesLength, "Index out of bounds");
-    return frameCallbackData->frameTimelines[index].deadlineNanos;
+    LOG_ALWAYS_FATAL_IF(index >= frameCallbackData->frameTimelines.size(), "Index out of bounds");
+    return frameCallbackData->frameTimelines[index].deadlineTimestamp;
 }
 
 AChoreographer* AChoreographer_create() {