Merge "Add a method in RecentsAnimationController to animate the nav bar" into sc-dev am: ecb653c2bb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14879195 Change-Id: Ia691f97d7076a849e16acfc58fbfa862b890e54e
This commit is contained in:
@@ -154,4 +154,13 @@ interface IRecentsAnimationController {
|
|||||||
* app.
|
* app.
|
||||||
*/
|
*/
|
||||||
void detachNavigationBarFromApp(boolean moveHomeToTop);
|
void detachNavigationBarFromApp(boolean moveHomeToTop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for animating the navigation bar during app launch from recents in live tile mode.
|
||||||
|
*
|
||||||
|
* First fade out the navigation bar at the bottom of the display and then fade in to the app.
|
||||||
|
*
|
||||||
|
* @param duration the duration of the app launch animation
|
||||||
|
*/
|
||||||
|
void animateNavigationBarToApp(long duration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mShouldAttachNavBarToAppDuringTransition;
|
boolean mShouldAttachNavBarToAppDuringTransition;
|
||||||
private boolean mNavigationBarAttachedToApp;
|
private boolean mNavigationBarAttachedToApp;
|
||||||
|
private ActivityRecord mNavBarAttachedApp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animates the screenshot of task that used to be controlled by RecentsAnimation.
|
* Animates the screenshot of task that used to be controlled by RecentsAnimation.
|
||||||
@@ -392,6 +393,18 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
Binder.restoreCallingIdentity(token);
|
Binder.restoreCallingIdentity(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void animateNavigationBarToApp(long duration) {
|
||||||
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
synchronized (mService.getWindowManagerLock()) {
|
||||||
|
animateNavigationBarForAppLaunch(duration);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -613,7 +626,6 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
|| mDisplayContent.getFadeRotationAnimationController() != null) {
|
|| mDisplayContent.getFadeRotationAnimationController() != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ActivityRecord topActivity = null;
|
|
||||||
boolean shouldTranslateNavBar = false;
|
boolean shouldTranslateNavBar = false;
|
||||||
final boolean isDisplayLandscape =
|
final boolean isDisplayLandscape =
|
||||||
mDisplayContent.getConfiguration().orientation == ORIENTATION_LANDSCAPE;
|
mDisplayContent.getConfiguration().orientation == ORIENTATION_LANDSCAPE;
|
||||||
@@ -630,12 +642,12 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
shouldTranslateNavBar = isSplitScreenSecondary;
|
shouldTranslateNavBar = isSplitScreenSecondary;
|
||||||
topActivity = task.getTopVisibleActivity();
|
mNavBarAttachedApp = task.getTopVisibleActivity();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WindowState navWindow = getNavigationBarWindow();
|
final WindowState navWindow = getNavigationBarWindow();
|
||||||
if (topActivity == null || navWindow == null || navWindow.mToken == null) {
|
if (mNavBarAttachedApp == null || navWindow == null || navWindow.mToken == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mNavigationBarAttachedToApp = true;
|
mNavigationBarAttachedToApp = true;
|
||||||
@@ -643,9 +655,9 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
final SurfaceControl.Transaction t = navWindow.mToken.getPendingTransaction();
|
final SurfaceControl.Transaction t = navWindow.mToken.getPendingTransaction();
|
||||||
final SurfaceControl navSurfaceControl = navWindow.mToken.getSurfaceControl();
|
final SurfaceControl navSurfaceControl = navWindow.mToken.getSurfaceControl();
|
||||||
if (shouldTranslateNavBar) {
|
if (shouldTranslateNavBar) {
|
||||||
navWindow.setSurfaceTranslationY(-topActivity.getBounds().top);
|
navWindow.setSurfaceTranslationY(-mNavBarAttachedApp.getBounds().top);
|
||||||
}
|
}
|
||||||
t.reparent(navSurfaceControl, topActivity.getSurfaceControl());
|
t.reparent(navSurfaceControl, mNavBarAttachedApp.getSurfaceControl());
|
||||||
t.show(navSurfaceControl);
|
t.show(navSurfaceControl);
|
||||||
|
|
||||||
final WindowContainer imeContainer = mDisplayContent.getImeContainer();
|
final WindowContainer imeContainer = mDisplayContent.getImeContainer();
|
||||||
@@ -695,9 +707,25 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void animateNavigationBarForAppLaunch(long duration) {
|
||||||
|
if (!mShouldAttachNavBarToAppDuringTransition
|
||||||
|
// Skip the case where the nav bar is controlled by fade rotation.
|
||||||
|
|| mDisplayContent.getFadeRotationAnimationController() != null
|
||||||
|
|| mNavigationBarAttachedToApp
|
||||||
|
|| mNavBarAttachedApp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final NavBarFadeAnimationController controller =
|
||||||
|
new NavBarFadeAnimationController(mDisplayContent);
|
||||||
|
controller.fadeOutAndInSequentially(duration, null /* fadeOutParent */,
|
||||||
|
mNavBarAttachedApp.getSurfaceControl());
|
||||||
|
}
|
||||||
|
|
||||||
void addTaskToTargets(Task task, OnAnimationFinishedCallback finishedCallback) {
|
void addTaskToTargets(Task task, OnAnimationFinishedCallback finishedCallback) {
|
||||||
if (mRunner != null) {
|
if (mRunner != null) {
|
||||||
mIsAddingTaskToTargets = task != null;
|
mIsAddingTaskToTargets = task != null;
|
||||||
|
mNavBarAttachedApp = task == null ? null : task.getTopVisibleActivity();
|
||||||
// No need to send task appeared when the task target already exists, or when the
|
// No need to send task appeared when the task target already exists, or when the
|
||||||
// task is being managed as a multi-window mode outside of recents (e.g. bubbles).
|
// task is being managed as a multi-window mode outside of recents (e.g. bubbles).
|
||||||
if (isAnimatingTask(task) || skipAnimation(task)) {
|
if (isAnimatingTask(task) || skipAnimation(task)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user