Adding a pending invisibility flag, which is used to indicate that the launcher
is not really invisible, but consider it invisible for window transitions When a recents animation is cancelled, the callback can be received before or after the wallpaper animation. To ensure that wallpaper animaiton runs properly, we keep the launcher forceInvisible=true, only for that particular animaiton and false everywhere Bug: 109735443 Change-Id: I5b22cc3327c8cd53a836d10e09fc88ae103becfc
This commit is contained in:
parent
d936f6a5e9
commit
1c63c72c1a
|
@ -18,6 +18,8 @@ package com.android.launcher3;
|
||||||
|
|
||||||
import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
|
import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
|
||||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
|
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
|
||||||
|
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_PENDING_FLAGS;
|
||||||
|
import static com.android.launcher3.BaseActivity.PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION;
|
||||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||||
import static com.android.launcher3.LauncherState.NORMAL;
|
import static com.android.launcher3.LauncherState.NORMAL;
|
||||||
|
@ -31,8 +33,6 @@ import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
|
||||||
import static com.android.quickstep.TaskUtils.findTaskViewToLaunch;
|
import static com.android.quickstep.TaskUtils.findTaskViewToLaunch;
|
||||||
import static com.android.quickstep.TaskUtils.getRecentsWindowAnimator;
|
import static com.android.quickstep.TaskUtils.getRecentsWindowAnimator;
|
||||||
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
|
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
|
||||||
import static com.android.systemui.shared.recents.utilities.Utilities.getNextFrameNumber;
|
|
||||||
import static com.android.systemui.shared.recents.utilities.Utilities.getSurface;
|
|
||||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
||||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
|
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
|
||||||
|
|
||||||
|
@ -53,9 +53,7 @@ import android.os.Build;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.Surface;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
@ -672,6 +670,10 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mLauncher.hasSomeInvisibleFlag(PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION)) {
|
||||||
|
mLauncher.addForceInvisibleFlag(INVISIBLE_BY_PENDING_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
AnimatorSet anim = null;
|
AnimatorSet anim = null;
|
||||||
RemoteAnimationProvider provider = mRemoteAnimationProvider;
|
RemoteAnimationProvider provider = mRemoteAnimationProvider;
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package com.android.quickstep;
|
package com.android.quickstep;
|
||||||
|
|
||||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
|
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
|
||||||
|
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
|
||||||
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
|
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
|
||||||
import static com.android.launcher3.Utilities.postAsyncCallback;
|
import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||||
import static com.android.launcher3.anim.Interpolators.DEACCEL;
|
import static com.android.launcher3.anim.Interpolators.DEACCEL;
|
||||||
|
@ -356,9 +357,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||||
// Override the visibility of the activity until the gesture actually starts and we swipe
|
// Override the visibility of the activity until the gesture actually starts and we swipe
|
||||||
// up, or until we transition home and the home animation is composed
|
// up, or until we transition home and the home animation is composed
|
||||||
if (alreadyOnHome) {
|
if (alreadyOnHome) {
|
||||||
mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
|
mActivity.clearForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS);
|
||||||
} else {
|
} else {
|
||||||
mActivity.addForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
|
mActivity.addForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRecentsView = activity.getOverviewPanel();
|
mRecentsView = activity.getOverviewPanel();
|
||||||
|
@ -632,7 +633,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||||
if (curActivity != null) {
|
if (curActivity != null) {
|
||||||
// Once the gesture starts, we can no longer transition home through the button, so
|
// Once the gesture starts, we can no longer transition home through the button, so
|
||||||
// reset the force override of the activity visibility
|
// reset the force override of the activity visibility
|
||||||
mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
|
mActivity.clearForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -769,6 +770,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||||
private void resetStateForAnimationCancel() {
|
private void resetStateForAnimationCancel() {
|
||||||
boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted;
|
boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted;
|
||||||
mActivityControlHelper.onTransitionCancelled(mActivity, wasVisible);
|
mActivityControlHelper.onTransitionCancelled(mActivity, wasVisible);
|
||||||
|
|
||||||
|
// Leave the pending invisible flag, as it may be used by wallpaper open animation.
|
||||||
|
mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void layoutListenerClosed() {
|
public void layoutListenerClosed() {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
package com.android.quickstep.views;
|
package com.android.quickstep.views;
|
||||||
|
|
||||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
|
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
|
||||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||||
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
|
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
|
||||||
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
||||||
|
@ -199,7 +199,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||||
public void onPinnedStackAnimationStarted() {
|
public void onPinnedStackAnimationStarted() {
|
||||||
// Needed for activities that auto-enter PiP, which will not trigger a remote
|
// Needed for activities that auto-enter PiP, which will not trigger a remote
|
||||||
// animation to be created
|
// animation to be created
|
||||||
mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
|
mActivity.clearForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,25 @@ public abstract class BaseActivity extends Activity implements UserEventDelegate
|
||||||
|
|
||||||
public static final int INVISIBLE_BY_STATE_HANDLER = 1 << 0;
|
public static final int INVISIBLE_BY_STATE_HANDLER = 1 << 0;
|
||||||
public static final int INVISIBLE_BY_APP_TRANSITIONS = 1 << 1;
|
public static final int INVISIBLE_BY_APP_TRANSITIONS = 1 << 1;
|
||||||
|
public static final int INVISIBLE_BY_PENDING_FLAGS = 1 << 2;
|
||||||
|
|
||||||
|
// This is not treated as invisibility flag, but adds as a hint for an incomplete transition.
|
||||||
|
// When the wallpaper animation runs, it replaces this flag with a proper invisibility
|
||||||
|
// flag, INVISIBLE_BY_PENDING_FLAGS only for the duration of that animation.
|
||||||
|
public static final int PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION = 1 << 3;
|
||||||
|
|
||||||
|
private static final int INVISIBLE_FLAGS =
|
||||||
|
INVISIBLE_BY_STATE_HANDLER | INVISIBLE_BY_APP_TRANSITIONS | INVISIBLE_BY_PENDING_FLAGS;
|
||||||
|
public static final int STATE_HANDLER_INVISIBILITY_FLAGS =
|
||||||
|
INVISIBLE_BY_STATE_HANDLER | PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION;
|
||||||
public static final int INVISIBLE_ALL =
|
public static final int INVISIBLE_ALL =
|
||||||
INVISIBLE_BY_STATE_HANDLER | INVISIBLE_BY_APP_TRANSITIONS;
|
INVISIBLE_FLAGS | PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION;
|
||||||
|
|
||||||
@Retention(SOURCE)
|
@Retention(SOURCE)
|
||||||
@IntDef(
|
@IntDef(
|
||||||
flag = true,
|
flag = true,
|
||||||
value = {INVISIBLE_BY_STATE_HANDLER, INVISIBLE_BY_APP_TRANSITIONS})
|
value = {INVISIBLE_BY_STATE_HANDLER, INVISIBLE_BY_APP_TRANSITIONS,
|
||||||
|
INVISIBLE_BY_PENDING_FLAGS, PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION})
|
||||||
public @interface InvisibilityFlags{}
|
public @interface InvisibilityFlags{}
|
||||||
|
|
||||||
private final ArrayList<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
|
private final ArrayList<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
|
||||||
|
@ -208,7 +220,7 @@ public abstract class BaseActivity extends Activity implements UserEventDelegate
|
||||||
/**
|
/**
|
||||||
* Used to set the override visibility state, used only to handle the transition home with the
|
* Used to set the override visibility state, used only to handle the transition home with the
|
||||||
* recents animation.
|
* recents animation.
|
||||||
* @see LauncherAppTransitionManagerImpl.getWallpaperOpenRunner()
|
* @see LauncherAppTransitionManagerImpl#getWallpaperOpenRunner()
|
||||||
*/
|
*/
|
||||||
public void addForceInvisibleFlag(@InvisibilityFlags int flag) {
|
public void addForceInvisibleFlag(@InvisibilityFlags int flag) {
|
||||||
mForceInvisible |= flag;
|
mForceInvisible |= flag;
|
||||||
|
@ -218,12 +230,15 @@ public abstract class BaseActivity extends Activity implements UserEventDelegate
|
||||||
mForceInvisible &= ~flag;
|
mForceInvisible &= ~flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Wether this activity should be considered invisible regardless of actual visibility.
|
* @return Wether this activity should be considered invisible regardless of actual visibility.
|
||||||
*/
|
*/
|
||||||
public boolean isForceInvisible() {
|
public boolean isForceInvisible() {
|
||||||
return mForceInvisible != 0;
|
return hasSomeInvisibleFlag(INVISIBLE_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasSomeInvisibleFlag(int mask) {
|
||||||
|
return (mForceInvisible & mask) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface MultiWindowModeChangedListener {
|
public interface MultiWindowModeChangedListener {
|
||||||
|
|
Loading…
Reference in New Issue