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:
parent
4380743251
commit
d9abb1767d
|
@ -45,9 +45,10 @@
|
|||
|
||||
# BUG(70852369): Surpress additional warnings after changing from Proguard to R8
|
||||
-dontwarn android.app.**
|
||||
-dontwarn android.view.**
|
||||
-dontwarn android.os.**
|
||||
-dontwarn android.graphics.**
|
||||
-dontwarn android.os.**
|
||||
-dontwarn android.view.**
|
||||
-dontwarn android.window.**
|
||||
|
||||
# Ignore warnings for hidden utility classes referenced from the shared lib
|
||||
-dontwarn com.android.internal.util.**
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -396,4 +396,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||
pa.addFloat(recentsView, FULLSCREEN_PROGRESS, 1, 0, LINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when OverviewService is bound to this process */
|
||||
void onOverviewServiceBound() {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,4 +270,11 @@ public final class LauncherActivityInterface extends
|
|||
+ res.getDimensionPixelSize(R.dimen.overview_actions_height);
|
||||
return actionsHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
void onOverviewServiceBound() {
|
||||
final BaseQuickstepLauncher activity = getCreatedActivity();
|
||||
if (activity == null) return;
|
||||
activity.getAppTransitionManager().registerRemoteTransitions();
|
||||
}
|
||||
}
|
|
@ -35,6 +35,7 @@ import com.android.launcher3.util.MainThreadInitializedObject;
|
|||
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
|
||||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.system.RemoteTransitionCompat;
|
||||
|
||||
/**
|
||||
* Holds the reference to SystemUI.
|
||||
|
@ -408,4 +409,26 @@ public class SystemUiProxy implements ISystemUiProxy {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRemoteTransition(RemoteTransitionCompat remoteTransition) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSystemUiProxy.registerRemoteTransition(remoteTransition);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call registerRemoteTransition");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterRemoteTransition(RemoteTransitionCompat remoteTransition) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSystemUiProxy.unregisterRemoteTransition(remoteTransition);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call registerRemoteTransition");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,6 +136,12 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
|||
SystemUiProxy.INSTANCE.get(TouchInteractionService.this).setProxy(proxy);
|
||||
TouchInteractionService.this.initInputMonitor();
|
||||
preloadOverview(true /* fromInit */);
|
||||
mDeviceState.runOnUserUnlocked(() -> {
|
||||
final BaseActivityInterface ai =
|
||||
mOverviewComponentObserver.getActivityInterface();
|
||||
if (ai == null) return;
|
||||
ai.onOverviewServiceBound();
|
||||
});
|
||||
});
|
||||
sIsInitialized = true;
|
||||
}
|
||||
|
|
|
@ -1596,6 +1596,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||
|
||||
mOverlayManager.onActivityDestroyed(this);
|
||||
mAppTransitionManager.unregisterRemoteAnimations();
|
||||
mAppTransitionManager.unregisterRemoteTransitions();
|
||||
mUserChangedCallbackCloseable.close();
|
||||
mLifecycleRegistry.setCurrentState(Lifecycle.State.DESTROYED);
|
||||
mLiveSearchManager.stop();
|
||||
|
|
|
@ -67,4 +67,18 @@ public class LauncherAppTransitionManager implements ResourceBasedOverride {
|
|||
public void unregisterRemoteAnimations() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers remote transitions for certain system transitions.
|
||||
*/
|
||||
public void registerRemoteTransitions() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters all remote transitions.
|
||||
*/
|
||||
public void unregisterRemoteTransitions() {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue