Merge "Mark first frames in metrics properly" into sc-dev
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
|
import static android.graphics.FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -172,8 +174,6 @@ public final class FrameMetrics {
|
|||||||
**/
|
**/
|
||||||
public static final int DEADLINE = 13;
|
public static final int DEADLINE = 13;
|
||||||
|
|
||||||
private static final int FRAME_INFO_FLAG_FIRST_DRAW = 1 << 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifiers for metrics available for each frame.
|
* Identifiers for metrics available for each frame.
|
||||||
*
|
*
|
||||||
@@ -343,7 +343,7 @@ public final class FrameMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (id == FIRST_DRAW_FRAME) {
|
if (id == FIRST_DRAW_FRAME) {
|
||||||
return (mTimingData[Index.FLAGS] & FRAME_INFO_FLAG_FIRST_DRAW) != 0 ? 1 : 0;
|
return (mTimingData[Index.FLAGS] & FLAG_WINDOW_VISIBILITY_CHANGED) != 0 ? 1 : 0;
|
||||||
} else if (id == INTENDED_VSYNC_TIMESTAMP) {
|
} else if (id == INTENDED_VSYNC_TIMESTAMP) {
|
||||||
return mTimingData[Index.INTENDED_VSYNC];
|
return mTimingData[Index.INTENDED_VSYNC];
|
||||||
} else if (id == VSYNC_TIMESTAMP) {
|
} else if (id == VSYNC_TIMESTAMP) {
|
||||||
|
|||||||
@@ -2764,7 +2764,9 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
// to resume them
|
// to resume them
|
||||||
mDirty.set(0, 0, mWidth, mHeight);
|
mDirty.set(0, 0, mWidth, mHeight);
|
||||||
}
|
}
|
||||||
mViewFrameInfo.flags |= FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED;
|
}
|
||||||
|
if (mFirst || viewVisibilityChanged) {
|
||||||
|
mViewFrameInfo.flags |= FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED;
|
||||||
}
|
}
|
||||||
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
|
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
|
||||||
final boolean freeformResizing = (relayoutResult
|
final boolean freeformResizing = (relayoutResult
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public final class FrameInfo {
|
|||||||
public static final int FLAGS = 0;
|
public static final int FLAGS = 0;
|
||||||
|
|
||||||
// Is this the first-draw following a window layout?
|
// Is this the first-draw following a window layout?
|
||||||
public static final long FLAG_WINDOW_LAYOUT_CHANGED = 1;
|
public static final long FLAG_WINDOW_VISIBILITY_CHANGED = 1;
|
||||||
|
|
||||||
// A renderer associated with just a Surface, not with a ViewRootImpl instance.
|
// A renderer associated with just a Surface, not with a ViewRootImpl instance.
|
||||||
public static final long FLAG_SURFACE_CANVAS = 1 << 2;
|
public static final long FLAG_SURFACE_CANVAS = 1 << 2;
|
||||||
@@ -56,7 +56,7 @@ public final class FrameInfo {
|
|||||||
public static final long INVALID_VSYNC_ID = -1;
|
public static final long INVALID_VSYNC_ID = -1;
|
||||||
|
|
||||||
@LongDef(flag = true, value = {
|
@LongDef(flag = true, value = {
|
||||||
FLAG_WINDOW_LAYOUT_CHANGED, FLAG_SURFACE_CANVAS })
|
FLAG_WINDOW_VISIBILITY_CHANGED, FLAG_SURFACE_CANVAS })
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface FrameInfoFlags {}
|
public @interface FrameInfoFlags {}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ extern const std::array<const char*, static_cast<int>(FrameInfoIndex::NumIndexes
|
|||||||
|
|
||||||
namespace FrameInfoFlags {
|
namespace FrameInfoFlags {
|
||||||
enum {
|
enum {
|
||||||
WindowLayoutChanged = 1 << 0,
|
WindowVisibilityChanged = 1 << 0,
|
||||||
RTAnimation = 1 << 1,
|
RTAnimation = 1 << 1,
|
||||||
SurfaceCanvas = 1 << 2,
|
SurfaceCanvas = 1 << 2,
|
||||||
SkippedFrame = 1 << 3,
|
SkippedFrame = 1 << 3,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class ViewFrameInfoTest {
|
|||||||
fun setUp() {
|
fun setUp() {
|
||||||
mViewFrameInfo.reset()
|
mViewFrameInfo.reset()
|
||||||
mViewFrameInfo.setInputEvent(139)
|
mViewFrameInfo.setInputEvent(139)
|
||||||
mViewFrameInfo.flags = mViewFrameInfo.flags or FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED
|
mViewFrameInfo.flags = mViewFrameInfo.flags or FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED
|
||||||
mTimeStarted = SystemClock.uptimeNanos()
|
mTimeStarted = SystemClock.uptimeNanos()
|
||||||
mViewFrameInfo.markDrawStart()
|
mViewFrameInfo.markDrawStart()
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ class ViewFrameInfoTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testPopulateFields() {
|
fun testPopulateFields() {
|
||||||
assertThat(mViewFrameInfo.drawStart).isGreaterThan(mTimeStarted)
|
assertThat(mViewFrameInfo.drawStart).isGreaterThan(mTimeStarted)
|
||||||
assertThat(mViewFrameInfo.flags).isEqualTo(FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED)
|
assertThat(mViewFrameInfo.flags).isEqualTo(FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -66,7 +66,7 @@ class ViewFrameInfoTest {
|
|||||||
mViewFrameInfo.populateFrameInfo(frameInfo)
|
mViewFrameInfo.populateFrameInfo(frameInfo)
|
||||||
assertThat(frameInfo.frameInfo[FrameInfo.INPUT_EVENT_ID]).isEqualTo(139)
|
assertThat(frameInfo.frameInfo[FrameInfo.INPUT_EVENT_ID]).isEqualTo(139)
|
||||||
assertThat(frameInfo.frameInfo[FrameInfo.FLAGS]).isEqualTo(
|
assertThat(frameInfo.frameInfo[FrameInfo.FLAGS]).isEqualTo(
|
||||||
FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED)
|
FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED)
|
||||||
assertThat(frameInfo.frameInfo[FrameInfo.DRAW_START]).isGreaterThan(mTimeStarted)
|
assertThat(frameInfo.frameInfo[FrameInfo.DRAW_START]).isGreaterThan(mTimeStarted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user