Merge "[Status Bar Refactor] 1/3: Move status bar window's animation controller into a method inside StatusBarWindowController, rather than being in StatusBar.java." into sc-v2-dev am: c3ea20b662
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16148663 Change-Id: I2327563e216b306e7de5ce2486c9418b81b8b578
This commit is contained in:
@@ -2666,26 +2666,12 @@ public class StatusBar extends SystemUI implements
|
||||
private ActivityLaunchAnimator.Controller wrapAnimationController(
|
||||
ActivityLaunchAnimator.Controller animationController, boolean dismissShade) {
|
||||
View rootView = animationController.getLaunchContainer().getRootView();
|
||||
if (rootView == mStatusBarWindowView) {
|
||||
// We are animating a view in the status bar. We have to make sure that the status bar
|
||||
// window matches the full screen during the animation and that we are expanding the
|
||||
// view below the other status bar text.
|
||||
animationController.setLaunchContainer(
|
||||
mStatusBarWindowController.getLaunchAnimationContainer());
|
||||
|
||||
return new DelegateLaunchAnimatorController(animationController) {
|
||||
@Override
|
||||
public void onLaunchAnimationStart(boolean isExpandingFullyAbove) {
|
||||
getDelegate().onLaunchAnimationStart(isExpandingFullyAbove);
|
||||
mStatusBarWindowController.setLaunchAnimationRunning(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLaunchAnimationEnd(boolean isExpandingFullyAbove) {
|
||||
getDelegate().onLaunchAnimationEnd(isExpandingFullyAbove);
|
||||
mStatusBarWindowController.setLaunchAnimationRunning(false);
|
||||
}
|
||||
};
|
||||
Optional<ActivityLaunchAnimator.Controller> controllerFromStatusBar =
|
||||
mStatusBarWindowController.wrapAnimationControllerIfInStatusBar(
|
||||
rootView, animationController);
|
||||
if (controllerFromStatusBar.isPresent()) {
|
||||
return controllerFromStatusBar.get();
|
||||
}
|
||||
|
||||
if (dismissShade && rootView == mNotificationShadeWindowView) {
|
||||
|
||||
@@ -37,14 +37,19 @@ import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.IWindowManager;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.animation.ActivityLaunchAnimator;
|
||||
import com.android.systemui.animation.DelegateLaunchAnimatorController;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
@@ -64,6 +69,8 @@ public class StatusBarWindowController {
|
||||
private final State mCurrentState = new State();
|
||||
|
||||
private final ViewGroup mStatusBarView;
|
||||
// The container in which we should run launch animations started from the status bar and
|
||||
// expanding into the opening window.
|
||||
private final ViewGroup mLaunchAnimationContainer;
|
||||
private WindowManager.LayoutParams mLp;
|
||||
private final WindowManager.LayoutParams mLpChanged;
|
||||
@@ -126,6 +133,41 @@ public class StatusBarWindowController {
|
||||
calculateStatusBarLocationsForAllRotations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an updated animation controller if we're animating a view in the status bar.
|
||||
*
|
||||
* This is needed because we have to make sure that the status bar window matches the full
|
||||
* screen during the animation and that we are expanding the view below the other status bar
|
||||
* text.
|
||||
*
|
||||
* @param rootView the root view of the animation
|
||||
* @param animationController the default animation controller to use
|
||||
* @return If the animation is on a view in the status bar, returns an Optional containing an
|
||||
* updated animation controller that handles status-bar-related animation details. Returns an
|
||||
* empty optional if the animation is *not* on a view in the status bar.
|
||||
*/
|
||||
public Optional<ActivityLaunchAnimator.Controller> wrapAnimationControllerIfInStatusBar(
|
||||
View rootView, ActivityLaunchAnimator.Controller animationController) {
|
||||
if (rootView != mStatusBarView) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
animationController.setLaunchContainer(mLaunchAnimationContainer);
|
||||
return Optional.of(new DelegateLaunchAnimatorController(animationController) {
|
||||
@Override
|
||||
public void onLaunchAnimationStart(boolean isExpandingFullyAbove) {
|
||||
getDelegate().onLaunchAnimationStart(isExpandingFullyAbove);
|
||||
setLaunchAnimationRunning(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLaunchAnimationEnd(boolean isExpandingFullyAbove) {
|
||||
getDelegate().onLaunchAnimationEnd(isExpandingFullyAbove);
|
||||
setLaunchAnimationRunning(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private WindowManager.LayoutParams getBarLayoutParams(int rotation) {
|
||||
WindowManager.LayoutParams lp = getBarLayoutParamsForRotation(rotation);
|
||||
lp.paramsForRotation = new WindowManager.LayoutParams[4];
|
||||
@@ -213,22 +255,12 @@ public class StatusBarWindowController {
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the container in which we should run launch animations started from the status bar and
|
||||
* expanding into the opening window.
|
||||
*
|
||||
* @see #setLaunchAnimationRunning
|
||||
*/
|
||||
public ViewGroup getLaunchAnimationContainer() {
|
||||
return mLaunchAnimationContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether a launch animation is currently running. If true, this will ensure that the
|
||||
* window matches its parent height so that the animation is not clipped by the normal status
|
||||
* bar height.
|
||||
*/
|
||||
public void setLaunchAnimationRunning(boolean isLaunchAnimationRunning) {
|
||||
private void setLaunchAnimationRunning(boolean isLaunchAnimationRunning) {
|
||||
if (isLaunchAnimationRunning == mCurrentState.mIsLaunchAnimationRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user