Support launcher animations in new transition system
Hook up the shell-transitions RemoteTransition to launcher. Bug: 169035082 Test: Launch an app from a launcher icon and observe Change-Id: Ie327c11bbc59f19fb969f159f8380c10e4a84e50
This commit is contained in:
1 parent
4380743251
commit
d9abb1767d
8 files changed
+101
-5
No files matched your search
@@ -75,6 +75,7 @@ import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
|
||||
import com.android.launcher3.views.FloatingIconView;
|
||||
import com.android.quickstep.RemoteAnimationTargets;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.MultiValueUpdateListener;
|
||||
import com.android.quickstep.util.RemoteAnimationProvider;
|
||||
import com.android.quickstep.util.StaggeredWorkspaceAnim;
|
||||
@@ -87,6 +88,7 @@ import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.RemoteTransitionCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
|
||||
@@ -163,6 +165,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
private WrappedAnimationRunnerImpl mAppLaunchRunner;
|
||||
private WrappedAnimationRunnerImpl mKeyguardGoingAwayRunner;
|
||||
|
||||
private WrappedAnimationRunnerImpl mWallpaperOpenTransitionRunner;
|
||||
private RemoteTransitionCompat mLauncherOpenTransition;
|
||||
|
||||
private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -582,10 +587,11 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
.withCornerRadius(mWindowRadius.value)
|
||||
.withShadowRadius(mShadowRadius.value);
|
||||
} else {
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
if (target.localBounds != null) {
|
||||
final Rect localBounds = target.localBounds;
|
||||
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||
} else {
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
}
|
||||
|
||||
matrix.setTranslate(tmpPos.x, tmpPos.y);
|
||||
@@ -656,6 +662,24 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers remote animations used when closing apps to home screen.
|
||||
*/
|
||||
@Override
|
||||
public void registerRemoteTransitions() {
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get()) {
|
||||
return;
|
||||
}
|
||||
if (hasControlRemoteAppTransitionPermission()) {
|
||||
mWallpaperOpenTransitionRunner = createWallpaperOpenRunner(false /* fromUnlock */);
|
||||
mLauncherOpenTransition = RemoteAnimationAdapterCompat.buildRemoteTransition(
|
||||
new WrappedLauncherAnimationRunner<>(mWallpaperOpenTransitionRunner,
|
||||
false /* startAtFrontOfQueue */));
|
||||
mLauncherOpenTransition.addHomeOpenCheck();
|
||||
SystemUiProxy.INSTANCE.getNoCreate().registerRemoteTransition(mLauncherOpenTransition);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters all remote animations.
|
||||
*/
|
||||
@@ -675,6 +699,20 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterRemoteTransitions() {
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get()) {
|
||||
return;
|
||||
}
|
||||
if (hasControlRemoteAppTransitionPermission()) {
|
||||
if (mLauncherOpenTransition == null) return;
|
||||
SystemUiProxy.INSTANCE.getNoCreate().unregisterRemoteTransition(
|
||||
mLauncherOpenTransition);
|
||||
mLauncherOpenTransition = null;
|
||||
mWallpaperOpenTransitionRunner = null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean launcherIsATargetWithMode(RemoteAnimationTargetCompat[] targets, int mode) {
|
||||
return taskIsATargetWithMode(targets, mLauncher.getTaskId(), mode);
|
||||
}
|
||||
@@ -742,9 +780,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
if (target.localBounds != null) {
|
||||
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||
} else {
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
}
|
||||
|
||||
if (target.mode == MODE_CLOSING) {
|
||||
|
||||
Reference in new issue
Block a user