Enable remote animation for keygaurd going away.

Disable remote animation for keyguard transition.
% adb shell setprop persist.wm.enable_remote_keyguard_animation 0

Enable remote animation only for keyguard going away transition
(default).
% adb shell setprop persist.wm.enable_remote_keyguard_animation 1

Enable remote animation for both keyguard going away and (un)occlude
transition.
% adb shell setprop persist.wm.enable_remote_keyguard_animation 2

Bug: 166736690 185616888
Test: Pass existing tests.
Change-Id: Ia40e3325a9f22ce108f36c7111a92b514ce4fa19
This commit is contained in:
Issei Suzuki
2021-04-14 15:31:35 +02:00
parent eebbd44aef
commit d0ba2859dd
6 changed files with 54 additions and 13 deletions

View File

@@ -51,6 +51,7 @@ import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardService;
import com.android.internal.policy.IKeyguardStateCallback;
import com.android.systemui.SystemUIApplication;
import com.android.wm.shell.transition.Transitions;
import javax.inject.Inject;
@@ -62,16 +63,29 @@ public class KeyguardService extends Service {
* Run Keyguard animation as remote animation in System UI instead of local animation in
* the server process.
*
* 0: Runs all keyguard animation as local animation
* 1: Only runs keyguard going away animation as remote animation
* 2: Runs all keyguard animation as remote animation
*
* Note: Must be consistent with WindowManagerService.
*/
private static final String ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY =
"persist.wm.enable_remote_keyguard_animation";
private static final int sEnableRemoteKeyguardAnimation =
SystemProperties.getInt(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, 1);
/**
* @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
*/
static boolean sEnableRemoteKeyguardAnimation =
SystemProperties.getBoolean(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, false);
public static boolean sEnableRemoteKeyguardGoingAwayAnimation =
!Transitions.ENABLE_SHELL_TRANSITIONS && sEnableRemoteKeyguardAnimation >= 1;
/**
* @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
*/
public static boolean sEnableRemoteKeyguardOccludeAnimation =
!Transitions.ENABLE_SHELL_TRANSITIONS && sEnableRemoteKeyguardAnimation >= 2;
private final KeyguardViewMediator mKeyguardViewMediator;
private final KeyguardLifecyclesDispatcher mKeyguardLifecyclesDispatcher;
@@ -83,20 +97,22 @@ public class KeyguardService extends Service {
mKeyguardViewMediator = keyguardViewMediator;
mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher;
if (sEnableRemoteKeyguardAnimation) {
RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
if (sEnableRemoteKeyguardGoingAwayAnimation) {
final RemoteAnimationAdapter exitAnimationAdapter =
new RemoteAnimationAdapter(mExitAnimationRunner, 0, 0);
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY, exitAnimationAdapter);
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
exitAnimationAdapter);
}
if (sEnableRemoteKeyguardOccludeAnimation) {
final RemoteAnimationAdapter occludeAnimationAdapter =
new RemoteAnimationAdapter(mOccludeAnimationRunner, 0, 0);
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_OCCLUDE, occludeAnimationAdapter);
definition.addRemoteAnimation(TRANSIT_OLD_KEYGUARD_UNOCCLUDE, occludeAnimationAdapter);
ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
DEFAULT_DISPLAY, definition);
}
ActivityTaskManager.getInstance().registerRemoteAnimationsForDisplay(
DEFAULT_DISPLAY, definition);
}
@Override

View File

@@ -280,7 +280,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
}
override fun onKeyguardDismissAmountChanged() {
if (!KeyguardService.sEnableRemoteKeyguardAnimation) {
if (!KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation) {
return
}

View File

@@ -2100,7 +2100,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
playSounds(false);
}
if (KeyguardService.sEnableRemoteKeyguardAnimation) {
if (KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation) {
mSurfaceBehindRemoteAnimationFinishedCallback = finishedCallback;
mSurfaceBehindRemoteAnimationRunning = true;

View File

@@ -3021,7 +3021,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, long duration) {
final int res = applyKeyguardOcclusionChange();
if (res != 0) return res;
if (!WindowManagerService.sEnableRemoteKeyguardAnimation && keyguardGoingAway) {
if (!WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation && keyguardGoingAway) {
if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
}

View File

@@ -263,7 +263,8 @@ public class KeyguardServiceDelegate {
*/
@Deprecated
public void setOccluded(boolean isOccluded, boolean animate) {
if (!WindowManagerService.sEnableRemoteKeyguardAnimation && mKeyguardService != null) {
if (!WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
&& mKeyguardService != null) {
if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ") animate=" + animate);
mKeyguardService.setOccluded(isOccluded, animate);
}
@@ -403,7 +404,8 @@ public class KeyguardServiceDelegate {
}
public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
if (!WindowManagerService.sEnableRemoteKeyguardAnimation && mKeyguardService != null) {
if (!WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation
&& mKeyguardService != null) {
mKeyguardService.startKeyguardExitAnimation(startTime, fadeoutDuration);
}
}

View File

@@ -420,19 +420,42 @@ public class WindowManagerService extends IWindowManager.Stub
static boolean sDisableCustomTaskAnimationProperty =
SystemProperties.getBoolean(DISABLE_CUSTOM_TASK_ANIMATION_PROPERTY, true);
/**
* Use WMShell for app transition.
*/
public static final String ENABLE_SHELL_TRANSITIONS = "persist.debug.shell_transit";
/**
* @see #ENABLE_SHELL_TRANSITIONS
*/
public static final boolean sEnableShellTransitions =
SystemProperties.getBoolean(ENABLE_SHELL_TRANSITIONS, false);
/**
* Run Keyguard animation as remote animation in System UI instead of local animation in
* the server process.
*
* 0: Runs all keyguard animation as local animation
* 1: Only runs keyguard going away animation as remote animation
* 2: Runs all keyguard animation as remote animation
*/
private static final String ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY =
"persist.wm.enable_remote_keyguard_animation";
private static final int sEnableRemoteKeyguardAnimation =
SystemProperties.getInt(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, 1);
/**
* @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
*/
public static boolean sEnableRemoteKeyguardAnimation =
SystemProperties.getBoolean(ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY, false);
public static final boolean sEnableRemoteKeyguardGoingAwayAnimation = !sEnableShellTransitions
&& sEnableRemoteKeyguardAnimation >= 1;
/**
* @see #ENABLE_REMOTE_KEYGUARD_ANIMATION_PROPERTY
*/
public static final boolean sEnableRemoteKeyguardOccludeAnimation = !sEnableShellTransitions
&& sEnableRemoteKeyguardAnimation >= 2;
/**
* Allows a fullscreen windowing mode activity to launch in its desired orientation directly