import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
-import android.os.PowerManager;
import android.os.RemoteException;
import android.util.Slog;
import android.view.animation.Animation;
public boolean isScreenOn();
/**
- * @return whether the device is currently {@link PowerManager#isInteractive() interactive}.
+ * @return whether the device is currently allowed to animate.
*
- * Note: the screen can be on while the device is not interactive, e.g. when the device is
- * showing Ambient Display.
+ * Note: this can be true even if it is not appropriate to animate for reasons that are outside
+ * of the policy's authority.
*/
- boolean isInteractive();
+ boolean okToAnimate();
/**
* Tell the policy that the lid switch has changed state.
@Override
public void selectRotationAnimationLw(int anim[]) {
+ // If the screen is off or non-interactive, force a jumpcut.
+ final boolean forceJumpcut = !mScreenOnFully || !mAwake;
if (PRINT_ANIM) Slog.i(TAG, "selectRotationAnimation mTopFullscreen="
+ mTopFullscreenOpaqueWindowState + " rotationAnimation="
+ (mTopFullscreenOpaqueWindowState == null ?
- "0" : mTopFullscreenOpaqueWindowState.getAttrs().rotationAnimation));
+ "0" : mTopFullscreenOpaqueWindowState.getAttrs().rotationAnimation)
+ + " forceJumpcut=" + forceJumpcut);
+ if (forceJumpcut) {
+ anim[0] = R.anim.rotation_animation_jump_exit;
+ anim[1] = R.anim.rotation_animation_enter;
+ return;
+ }
if (mTopFullscreenOpaqueWindowState != null) {
int animationHint = mTopFullscreenOpaqueWindowState.getRotationAnimationHint();
if (animationHint < 0 && mTopIsFullscreen) {
}
@Override
- public boolean isInteractive() {
- return mAwake;
+ public boolean okToAnimate() {
+ return mAwake && !mGoingToSleep;
}
/** {@inheritDoc} */