Loading core/java/android/view/Choreographer.java +33 −4 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ import android.os.Message; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodReplace; import android.util.Log; import android.util.TimeUtils; import android.view.animation.AnimationUtils; Loading Loading @@ -87,6 +89,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * to which the choreographer belongs. * </p> */ @RavenwoodKeepWholeClass public final class Choreographer { private static final String TAG = "Choreographer"; Loading @@ -104,7 +107,17 @@ public final class Choreographer { // for jitter and hardware variations). Regardless of this value, the animation // and display loop is ultimately rate-limited by how fast new graphics buffers can // be dequeued. private static final long DEFAULT_FRAME_DELAY = 10; private static final long DEFAULT_FRAME_DELAY = getDefaultFrameDelay(); @RavenwoodReplace(reason = "run as fast as possible on ravenwood") private static long getDefaultFrameDelay() { return 10; } @SuppressWarnings("unused") private static long getDefaultFrameDelay$ravenwood() { return 1; } // The number of milliseconds between animation frames. private static volatile long sFrameDelay = DEFAULT_FRAME_DELAY; Loading Loading @@ -143,8 +156,17 @@ public final class Choreographer { // Enable/disable vsync for animations and drawing. @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123769497) private static final boolean USE_VSYNC = SystemProperties.getBoolean( "debug.choreographer.vsync", true); private static final boolean USE_VSYNC = getUseVsync(); @RavenwoodReplace(reason = "don't simulate vsync on ravenwood") private static boolean getUseVsync() { return SystemProperties.getBoolean("debug.choreographer.vsync", true); } @SuppressWarnings("unused") private static boolean getUseVsync$ravenwood() { return false; } // Enable/disable using the frame time instead of returning now. private static final boolean USE_FRAME_TIME = SystemProperties.getBoolean( Loading Loading @@ -353,12 +375,19 @@ public final class Choreographer { setFPSDivisor(SystemProperties.getInt(ThreadedRenderer.DEBUG_FPS_DIVISOR, 1)); } @RavenwoodReplace(blockedBy = DisplayManagerGlobal.class, reason = "just use fixed refresh rate") private static float getRefreshRate() { DisplayInfo di = DisplayManagerGlobal.getInstance().getDisplayInfo( Display.DEFAULT_DISPLAY); return di.getRefreshRate(); } @SuppressWarnings("unused") private static float getRefreshRate$ravenwood() { return 120f; } /** * Gets the choreographer for the calling thread. Must be called from * a thread that already has a {@link android.os.Looper} associated with it. Loading Loading @@ -1431,7 +1460,7 @@ public final class Choreographer { } long newPreferredDeadline = mFrameTimelines[newPreferredIndex].mDeadlineNanos; if (newPreferredDeadline < minimumDeadline) { if (USE_VSYNC && newPreferredDeadline < minimumDeadline) { DisplayEventReceiver.VsyncEventData latestVsyncEventData = displayEventReceiver.getLatestVsyncEventData(); if (latestVsyncEventData == null) { Loading core/java/android/view/DisplayEventReceiver.java +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.graphics.FrameInfo; import android.os.Build; import android.os.Looper; import android.os.MessageQueue; import android.ravenwood.annotation.RavenwoodKeepPartialClass; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; Loading @@ -42,6 +44,7 @@ import java.lang.ref.WeakReference; * @hide */ @WeaklyReferencedCallback @RavenwoodKeepPartialClass public abstract class DisplayEventReceiver { /** Loading Loading @@ -153,6 +156,7 @@ public abstract class DisplayEventReceiver { * * @hide */ @RavenwoodKeepWholeClass public static final class VsyncEventData { // The max capacity of frame timeline choices. // Must be in sync with VsyncEventData::kFrameTimelinesCapacity in Loading core/java/android/view/animation/AnimationUtils.java +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import android.content.res.Resources.NotFoundException; import android.content.res.Resources.Theme; import android.content.res.XmlResourceParser; import android.os.SystemClock; import android.ravenwood.annotation.RavenwoodIgnore; import android.ravenwood.annotation.RavenwoodKeepPartialClass; import android.util.AttributeSet; import android.util.TimeUtils; import android.util.Xml; Loading @@ -44,6 +46,9 @@ import java.io.IOException; * Defines common utilities for working with animations. * */ // This class would probably just work as-is on Ravenwood, but until we port the test, we just keep // the minimal surface for Choreographer. @RavenwoodKeepPartialClass(comment = "Keeping just enough for Choreographer to work") public class AnimationUtils { /** Loading Loading @@ -99,6 +104,7 @@ public class AnimationUtils { */ @TestApi @FlaggedApi(FLAG_EXPECTED_PRESENTATION_TIME_READ_ONLY) @RavenwoodIgnore public static void lockAnimationClock(long vsyncMillis, long expectedPresentationTimeNanos) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; Loading Loading @@ -136,6 +142,7 @@ public class AnimationUtils { * @hide */ @TestApi @RavenwoodIgnore public static void lockAnimationClock(long vsyncMillis) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; Loading @@ -149,6 +156,7 @@ public class AnimationUtils { * @hide */ @TestApi @RavenwoodIgnore public static void unlockAnimationClock() { sAnimationState.get().animationClockLocked = false; } Loading graphics/java/android/graphics/HardwareRenderer.java +5 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; import android.ravenwood.annotation.RavenwoodIgnore; import android.ravenwood.annotation.RavenwoodKeepPartialClass; import android.util.Log; import android.util.TimeUtils; import android.view.Display; Loading Loading @@ -82,7 +84,8 @@ import sun.misc.Cleaner; * Failure to do so will cause the render thread to stall on that surface, blocking all * HardwareRenderer instances.</p> */ @android.ravenwood.annotation.RavenwoodKeepWholeClass @RavenwoodKeepPartialClass(comment = "Hardware graphics not supported. Keeping minimal surface enough for Choreographer") public class HardwareRenderer { private static final String LOG_TAG = "HardwareRenderer"; Loading Loading @@ -1145,6 +1148,7 @@ public class HardwareRenderer { * * @hide */ @RavenwoodIgnore public static void setFPSDivisor(int divisor) { nSetRtAnimationsEnabled(divisor <= 1); } Loading ravenwood/texts/ravenwood-annotation-allowed-classes.txt +3 −0 Original line number Diff line number Diff line Loading @@ -563,9 +563,12 @@ android.util.proto.ProtoStream android.util.proto.ProtoUtils android.util.proto.WireTypeMismatchException android.view.animation.AnimationUtils android.view.Choreographer android.view.ContextThemeWrapper android.view.Display android.view.DisplayAdjustments android.view.DisplayEventReceiver android.view.DisplayInfo android.view.Gravity android.view.InflateException Loading Loading
core/java/android/view/Choreographer.java +33 −4 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ import android.os.Message; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodReplace; import android.util.Log; import android.util.TimeUtils; import android.view.animation.AnimationUtils; Loading Loading @@ -87,6 +89,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * to which the choreographer belongs. * </p> */ @RavenwoodKeepWholeClass public final class Choreographer { private static final String TAG = "Choreographer"; Loading @@ -104,7 +107,17 @@ public final class Choreographer { // for jitter and hardware variations). Regardless of this value, the animation // and display loop is ultimately rate-limited by how fast new graphics buffers can // be dequeued. private static final long DEFAULT_FRAME_DELAY = 10; private static final long DEFAULT_FRAME_DELAY = getDefaultFrameDelay(); @RavenwoodReplace(reason = "run as fast as possible on ravenwood") private static long getDefaultFrameDelay() { return 10; } @SuppressWarnings("unused") private static long getDefaultFrameDelay$ravenwood() { return 1; } // The number of milliseconds between animation frames. private static volatile long sFrameDelay = DEFAULT_FRAME_DELAY; Loading Loading @@ -143,8 +156,17 @@ public final class Choreographer { // Enable/disable vsync for animations and drawing. @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123769497) private static final boolean USE_VSYNC = SystemProperties.getBoolean( "debug.choreographer.vsync", true); private static final boolean USE_VSYNC = getUseVsync(); @RavenwoodReplace(reason = "don't simulate vsync on ravenwood") private static boolean getUseVsync() { return SystemProperties.getBoolean("debug.choreographer.vsync", true); } @SuppressWarnings("unused") private static boolean getUseVsync$ravenwood() { return false; } // Enable/disable using the frame time instead of returning now. private static final boolean USE_FRAME_TIME = SystemProperties.getBoolean( Loading Loading @@ -353,12 +375,19 @@ public final class Choreographer { setFPSDivisor(SystemProperties.getInt(ThreadedRenderer.DEBUG_FPS_DIVISOR, 1)); } @RavenwoodReplace(blockedBy = DisplayManagerGlobal.class, reason = "just use fixed refresh rate") private static float getRefreshRate() { DisplayInfo di = DisplayManagerGlobal.getInstance().getDisplayInfo( Display.DEFAULT_DISPLAY); return di.getRefreshRate(); } @SuppressWarnings("unused") private static float getRefreshRate$ravenwood() { return 120f; } /** * Gets the choreographer for the calling thread. Must be called from * a thread that already has a {@link android.os.Looper} associated with it. Loading Loading @@ -1431,7 +1460,7 @@ public final class Choreographer { } long newPreferredDeadline = mFrameTimelines[newPreferredIndex].mDeadlineNanos; if (newPreferredDeadline < minimumDeadline) { if (USE_VSYNC && newPreferredDeadline < minimumDeadline) { DisplayEventReceiver.VsyncEventData latestVsyncEventData = displayEventReceiver.getLatestVsyncEventData(); if (latestVsyncEventData == null) { Loading
core/java/android/view/DisplayEventReceiver.java +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.graphics.FrameInfo; import android.os.Build; import android.os.Looper; import android.os.MessageQueue; import android.ravenwood.annotation.RavenwoodKeepPartialClass; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; Loading @@ -42,6 +44,7 @@ import java.lang.ref.WeakReference; * @hide */ @WeaklyReferencedCallback @RavenwoodKeepPartialClass public abstract class DisplayEventReceiver { /** Loading Loading @@ -153,6 +156,7 @@ public abstract class DisplayEventReceiver { * * @hide */ @RavenwoodKeepWholeClass public static final class VsyncEventData { // The max capacity of frame timeline choices. // Must be in sync with VsyncEventData::kFrameTimelinesCapacity in Loading
core/java/android/view/animation/AnimationUtils.java +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import android.content.res.Resources.NotFoundException; import android.content.res.Resources.Theme; import android.content.res.XmlResourceParser; import android.os.SystemClock; import android.ravenwood.annotation.RavenwoodIgnore; import android.ravenwood.annotation.RavenwoodKeepPartialClass; import android.util.AttributeSet; import android.util.TimeUtils; import android.util.Xml; Loading @@ -44,6 +46,9 @@ import java.io.IOException; * Defines common utilities for working with animations. * */ // This class would probably just work as-is on Ravenwood, but until we port the test, we just keep // the minimal surface for Choreographer. @RavenwoodKeepPartialClass(comment = "Keeping just enough for Choreographer to work") public class AnimationUtils { /** Loading Loading @@ -99,6 +104,7 @@ public class AnimationUtils { */ @TestApi @FlaggedApi(FLAG_EXPECTED_PRESENTATION_TIME_READ_ONLY) @RavenwoodIgnore public static void lockAnimationClock(long vsyncMillis, long expectedPresentationTimeNanos) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; Loading Loading @@ -136,6 +142,7 @@ public class AnimationUtils { * @hide */ @TestApi @RavenwoodIgnore public static void lockAnimationClock(long vsyncMillis) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; Loading @@ -149,6 +156,7 @@ public class AnimationUtils { * @hide */ @TestApi @RavenwoodIgnore public static void unlockAnimationClock() { sAnimationState.get().animationClockLocked = false; } Loading
graphics/java/android/graphics/HardwareRenderer.java +5 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; import android.ravenwood.annotation.RavenwoodIgnore; import android.ravenwood.annotation.RavenwoodKeepPartialClass; import android.util.Log; import android.util.TimeUtils; import android.view.Display; Loading Loading @@ -82,7 +84,8 @@ import sun.misc.Cleaner; * Failure to do so will cause the render thread to stall on that surface, blocking all * HardwareRenderer instances.</p> */ @android.ravenwood.annotation.RavenwoodKeepWholeClass @RavenwoodKeepPartialClass(comment = "Hardware graphics not supported. Keeping minimal surface enough for Choreographer") public class HardwareRenderer { private static final String LOG_TAG = "HardwareRenderer"; Loading Loading @@ -1145,6 +1148,7 @@ public class HardwareRenderer { * * @hide */ @RavenwoodIgnore public static void setFPSDivisor(int divisor) { nSetRtAnimationsEnabled(divisor <= 1); } Loading
ravenwood/texts/ravenwood-annotation-allowed-classes.txt +3 −0 Original line number Diff line number Diff line Loading @@ -563,9 +563,12 @@ android.util.proto.ProtoStream android.util.proto.ProtoUtils android.util.proto.WireTypeMismatchException android.view.animation.AnimationUtils android.view.Choreographer android.view.ContextThemeWrapper android.view.Display android.view.DisplayAdjustments android.view.DisplayEventReceiver android.view.DisplayInfo android.view.Gravity android.view.InflateException Loading