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