Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.robolectric.shadows;
import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static android.os.Build.VERSION_CODES.KITKAT;
import static android.os.Build.VERSION_CODES.KITKAT_WATCH;
import static android.os.Build.VERSION_CODES.LOLLIPOP_MR1;
import static android.os.Build.VERSION_CODES.M;
import static android.os.Build.VERSION_CODES.N_MR1;
import static android.os.Build.VERSION_CODES.O;
import static android.os.Build.VERSION_CODES.Q;
import static android.os.Build.VERSION_CODES.R;
import static android.os.Build.VERSION_CODES.S;
import static android.os.Build.VERSION_CODES.TIRAMISU;
import android.os.MessageQueue;
import android.os.SystemClock;
import android.view.Choreographer;
import android.view.DisplayEventReceiver;
import dalvik.system.CloseGuard;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.time.Duration;
import javax.annotation.concurrent.GuardedBy;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;
import org.robolectric.annotation.ReflectorObject;
import org.robolectric.res.android.NativeObjRegistry;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.util.ReflectionHelpers;
import org.robolectric.util.ReflectionHelpers.ClassParameter;
import org.robolectric.util.reflector.Accessor;
import org.robolectric.util.reflector.Direct;
import org.robolectric.util.reflector.ForType;
import org.robolectric.util.reflector.WithType;
/**
* Shadow of {@link DisplayEventReceiver}. The {@link Choreographer} is a subclass of {@link
* DisplayEventReceiver}, and receives vsync events from the display indicating the frequency that
* frames should be generated.
*
*
The {@code ShadowDisplayEventReceiver} can run in either a paused mode or a non-paused mode,
* see {@link ShadowChoreographer#isPaused()} and {@link ShadowChoreographer#setPaused(boolean)}. By
* default it runs unpaused, and each time a frame callback is scheduled with the {@link
* Choreographer} the clock is advanced to the next frame, configured by {@link
* ShadowChoreographer#setFrameDelay(Duration)}. In paused mode the clock is not auto advanced and
* the next frame will only trigger when the clock is advance manually or via the {@link
* ShadowLooper}.
*/
@Implements(
className = "android.view.DisplayEventReceiver",
isInAndroidSdk = false,
looseSignatures = true)
public class ShadowDisplayEventReceiver {
private static NativeObjRegistry nativeObjRegistry =
new NativeObjRegistry<>(NativeDisplayEventReceiver.class);
@RealObject protected DisplayEventReceiver realReceiver;
@ReflectorObject private DisplayEventReceiverReflector displayEventReceiverReflector;
@Implementation(minSdk = O, maxSdk = Q)
protected static long nativeInit(
WeakReference receiver, MessageQueue msgQueue, int vsyncSource) {
return nativeObjRegistry.register(new NativeDisplayEventReceiver(receiver));
}
@Implementation(minSdk = M, maxSdk = N_MR1)
protected static long nativeInit(
WeakReference receiver, MessageQueue msgQueue) {
return nativeObjRegistry.register(new NativeDisplayEventReceiver(receiver));
}
@Implementation(minSdk = KITKAT_WATCH, maxSdk = LOLLIPOP_MR1)
protected static long nativeInit(DisplayEventReceiver receiver, MessageQueue msgQueue) {
return nativeObjRegistry.register(
new NativeDisplayEventReceiver(new WeakReference<>(receiver)));
}
@Implementation(maxSdk = KITKAT)
protected static int nativeInit(Object receiver, Object msgQueue) {
return (int)
nativeObjRegistry.register(
new NativeDisplayEventReceiver(new WeakReference<>((DisplayEventReceiver) receiver)));
}
@Implementation(minSdk = R, maxSdk = TIRAMISU)
protected static long nativeInit(
WeakReference receiver,
MessageQueue msgQueue,
int vsyncSource,
int configChanged) {
return nativeInit(receiver, msgQueue);
}
@Implementation(minSdk = CUR_DEVELOPMENT)
protected static long nativeInit(
WeakReference receiver,
WeakReference