Merge "Revised logic to sync keyguard occlude status." into sc-v2-dev am: ed14802c51
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15930803 Change-Id: I959881438881d2cc1e3cc81672fb0a9beb1430da
This commit is contained in:
@@ -358,7 +358,7 @@ public class KeyguardService extends Service {
|
||||
if (transit == TRANSIT_OLD_KEYGUARD_OCCLUDE) {
|
||||
mBinder.setOccluded(true /* isOccluded */, true /* animate */);
|
||||
} else if (transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE) {
|
||||
mBinder.setOccluded(false /* isOccluded */, true /* animate */);
|
||||
mBinder.setOccluded(false /* isOccluded */, false /* animate */);
|
||||
}
|
||||
// TODO(bc-unlock): Implement (un)occlude animation.
|
||||
finishedCallback.onAnimationFinished();
|
||||
|
||||
@@ -1814,18 +1814,22 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
|
||||
mWindowManagerInternal.registerAppTransitionListener(new AppTransitionListener() {
|
||||
@Override
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway, long duration,
|
||||
long statusBarAnimationStartTime, long statusBarAnimationDuration) {
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
|
||||
boolean keyguardOccluding, long duration, long statusBarAnimationStartTime,
|
||||
long statusBarAnimationDuration) {
|
||||
// When remote animation is enabled for KEYGUARD_GOING_AWAY transition, SysUI
|
||||
// receives IRemoteAnimationRunner#onAnimationStart to start animation, so we don't
|
||||
// need to call IKeyguardService#keyguardGoingAway here.
|
||||
return handleStartTransitionForKeyguardLw(keyguardGoingAway
|
||||
&& !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation, duration);
|
||||
&& !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation,
|
||||
keyguardOccluding, duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {
|
||||
handleStartTransitionForKeyguardLw(keyguardGoingAway, 0 /* duration */);
|
||||
handleStartTransitionForKeyguardLw(
|
||||
keyguardGoingAway, false /* keyguardOccludingStarted */,
|
||||
0 /* duration */);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3048,26 +3052,29 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
mPendingKeyguardOccluded = occluded;
|
||||
mKeyguardOccludedChanged = true;
|
||||
} else {
|
||||
setKeyguardOccludedLw(occluded, false /* force */);
|
||||
setKeyguardOccludedLw(occluded, false /* force */,
|
||||
false /* transitionStarted */);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int applyKeyguardOcclusionChange() {
|
||||
public int applyKeyguardOcclusionChange(boolean transitionStarted) {
|
||||
if (mKeyguardOccludedChanged) {
|
||||
if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded="
|
||||
+ mPendingKeyguardOccluded);
|
||||
mKeyguardOccludedChanged = false;
|
||||
if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */)) {
|
||||
if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */,
|
||||
transitionStarted)) {
|
||||
return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, long duration) {
|
||||
final int res = applyKeyguardOcclusionChange();
|
||||
if (res != 0) return res;
|
||||
private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway,
|
||||
boolean keyguardOccluding, long duration) {
|
||||
final int redoLayout = applyKeyguardOcclusionChange(keyguardOccluding);
|
||||
if (redoLayout != 0) return redoLayout;
|
||||
if (keyguardGoingAway) {
|
||||
if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
|
||||
startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
|
||||
@@ -3269,7 +3276,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
@Override
|
||||
public void setKeyguardCandidateLw(WindowState win) {
|
||||
mKeyguardCandidate = win;
|
||||
setKeyguardOccludedLw(isKeyguardOccluded(), true /* force */);
|
||||
setKeyguardOccludedLw(isKeyguardOccluded(), true /* force */,
|
||||
false /* keyguardOccludingStarted */);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3278,9 +3286,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
* @param isOccluded Whether the Keyguard is occluded by another window.
|
||||
* @param force notify the occluded status to KeyguardService and update flags even though
|
||||
* occlude status doesn't change.
|
||||
* @param transitionStarted {@code true} if keyguard (un)occluded transition started.
|
||||
* @return Whether the flags have changed and we have to redo the layout.
|
||||
*/
|
||||
private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force) {
|
||||
private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force,
|
||||
boolean transitionStarted) {
|
||||
if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
|
||||
if (isKeyguardOccluded() == isOccluded && !force) {
|
||||
return false;
|
||||
@@ -3288,8 +3298,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
|
||||
final boolean showing = mKeyguardDelegate.isShowing();
|
||||
final boolean animate = showing && !isOccluded;
|
||||
mKeyguardDelegate.setOccluded(isOccluded, animate);
|
||||
|
||||
// When remote animation is enabled for keyguard (un)occlude transition, KeyguardService
|
||||
// uses remote animation start as a signal to update its occlusion status ,so we don't need
|
||||
// to notify here.
|
||||
final boolean notify = !WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
|
||||
|| !transitionStarted;
|
||||
mKeyguardDelegate.setOccluded(isOccluded, animate, notify);
|
||||
if (!showing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -173,8 +173,11 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
|
||||
*/
|
||||
void onKeyguardOccludedChangedLw(boolean occluded);
|
||||
|
||||
/** Applies a keyguard occlusion change if one happened. */
|
||||
int applyKeyguardOcclusionChange();
|
||||
/**
|
||||
* Applies a keyguard occlusion change if one happened.
|
||||
* @param transitionStarted Whether keyguard (un)occlude transition is starting or not.
|
||||
*/
|
||||
int applyKeyguardOcclusionChange(boolean transitionStarted);
|
||||
|
||||
/**
|
||||
* Interface to the Window Manager state associated with a particular
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.android.internal.policy.IKeyguardExitCallback;
|
||||
import com.android.internal.policy.IKeyguardService;
|
||||
import com.android.server.UiThread;
|
||||
import com.android.server.policy.WindowManagerPolicy.OnKeyguardExitResult;
|
||||
import com.android.server.wm.WindowManagerService;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
@@ -259,13 +258,8 @@ public class KeyguardServiceDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Notify occlude status change via remote animation.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setOccluded(boolean isOccluded, boolean animate) {
|
||||
if (!WindowManagerService.sEnableRemoteKeyguardOccludeAnimation
|
||||
&& mKeyguardService != null) {
|
||||
public void setOccluded(boolean isOccluded, boolean animate, boolean notify) {
|
||||
if (mKeyguardService != null && notify) {
|
||||
if (DEBUG) Log.v(TAG, "setOccluded(" + isOccluded + ") animate=" + animate);
|
||||
mKeyguardService.setOccluded(isOccluded, animate);
|
||||
}
|
||||
|
||||
@@ -443,6 +443,7 @@ public class AppTransition implements Dump {
|
||||
|
||||
int redoLayout = notifyAppTransitionStartingLocked(
|
||||
AppTransition.isKeyguardGoingAwayTransitOld(transit),
|
||||
AppTransition.isKeyguardOccludeTransitOld(transit),
|
||||
topOpeningAnim != null ? topOpeningAnim.getDurationHint() : 0,
|
||||
topOpeningAnim != null
|
||||
? topOpeningAnim.getStatusBarTransitionsStartTime()
|
||||
@@ -557,12 +558,14 @@ public class AppTransition implements Dump {
|
||||
}
|
||||
}
|
||||
|
||||
private int notifyAppTransitionStartingLocked(boolean keyguardGoingAway, long duration,
|
||||
long statusBarAnimationStartTime, long statusBarAnimationDuration) {
|
||||
private int notifyAppTransitionStartingLocked(boolean keyguardGoingAway,
|
||||
boolean keyguardOcclude, long duration, long statusBarAnimationStartTime,
|
||||
long statusBarAnimationDuration) {
|
||||
int redoLayout = 0;
|
||||
for (int i = 0; i < mListeners.size(); i++) {
|
||||
redoLayout |= mListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway,
|
||||
duration, statusBarAnimationStartTime, statusBarAnimationDuration);
|
||||
keyguardOcclude, duration, statusBarAnimationStartTime,
|
||||
statusBarAnimationDuration);
|
||||
}
|
||||
return redoLayout;
|
||||
}
|
||||
|
||||
@@ -618,7 +618,8 @@ public class DisplayPolicy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway, long duration,
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
|
||||
boolean keyguardOccluding, long duration,
|
||||
long statusBarAnimationStartTime, long statusBarAnimationDuration) {
|
||||
mHandler.post(() -> {
|
||||
StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
|
||||
|
||||
@@ -169,8 +169,9 @@ public class RecentsAnimationController implements DeathRecipient {
|
||||
*/
|
||||
final AppTransitionListener mAppTransitionListener = new AppTransitionListener() {
|
||||
@Override
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway, long duration,
|
||||
long statusBarAnimationStartTime, long statusBarAnimationDuration) {
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
|
||||
boolean keyguardOccluding, long duration, long statusBarAnimationStartTime,
|
||||
long statusBarAnimationDuration) {
|
||||
continueDeferredCancel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -789,7 +789,8 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
||||
}
|
||||
}
|
||||
if ((flags & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0) {
|
||||
mController.mAtm.mWindowManager.mPolicy.applyKeyguardOcclusionChange();
|
||||
mController.mAtm.mWindowManager.mPolicy.applyKeyguardOcclusionChange(
|
||||
true /* keyguardOccludingStarted */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -388,9 +388,10 @@ class TransitionController {
|
||||
void dispatchLegacyAppTransitionStarting(TransitionInfo info) {
|
||||
final boolean keyguardGoingAway = info.isKeyguardGoingAway();
|
||||
for (int i = 0; i < mLegacyListeners.size(); ++i) {
|
||||
// TODO(shell-transitions): handle (un)occlude transition.
|
||||
mLegacyListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway,
|
||||
0 /* durationHint */, SystemClock.uptimeMillis(),
|
||||
AnimationAdapter.STATUS_BAR_TRANSITION_DURATION);
|
||||
false /* keyguardOcclude */, 0 /* durationHint */,
|
||||
SystemClock.uptimeMillis(), AnimationAdapter.STATUS_BAR_TRANSITION_DURATION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ public abstract class WindowManagerInternal {
|
||||
/**
|
||||
* Called when a pending app transition gets cancelled.
|
||||
*
|
||||
* @param keyguardGoingAway true if keyguard going away transition transition got cancelled.
|
||||
* @param keyguardGoingAway true if keyguard going away transition got cancelled.
|
||||
*/
|
||||
public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {}
|
||||
|
||||
@@ -207,6 +207,7 @@ public abstract class WindowManagerInternal {
|
||||
* Called when an app transition gets started
|
||||
*
|
||||
* @param keyguardGoingAway true if keyguard going away transition is started.
|
||||
* @param keyguardOccluding true if keyguard (un)occlude transition is started.
|
||||
* @param duration the total duration of the transition
|
||||
* @param statusBarAnimationStartTime the desired start time for all visual animations in
|
||||
* the status bar caused by this app transition in uptime millis
|
||||
@@ -218,8 +219,9 @@ public abstract class WindowManagerInternal {
|
||||
* {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_WALLPAPER},
|
||||
* or {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_ANIM}.
|
||||
*/
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway, long duration,
|
||||
long statusBarAnimationStartTime, long statusBarAnimationDuration) {
|
||||
public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
|
||||
boolean keyguardOccluding, long duration, long statusBarAnimationStartTime,
|
||||
long statusBarAnimationDuration) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
||||
verify(mMockRunner).onAnimationCanceled(null /* taskSnapshot */);
|
||||
|
||||
// Simulate the app transition finishing
|
||||
mController.mAppTransitionListener.onAppTransitionStartingLocked(false, 0, 0, 0);
|
||||
mController.mAppTransitionListener.onAppTransitionStartingLocked(false, false, 0, 0, 0);
|
||||
verify(mAnimationCallbacks).onAnimationFinished(REORDER_KEEP_IN_PLACE, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int applyKeyguardOcclusionChange() {
|
||||
public int applyKeyguardOcclusionChange(boolean keyguardOccludingStarted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user