mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Map shell transition to recents animation
This hooks up the essential start/finish. One thing to note
is that it uses the normal startActivity rather than a special
startRecents call for shell transitions.
Bug: 162503077
Test: Enable shell transit. Open an app, use gesture to open
recents.
Change-Id: Ia51fa8baeb43bf3fa768b25a840b629ec94e16a1
This commit is contained in:
@@ -21,7 +21,10 @@ import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
|
||||
import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_INITIALIZED;
|
||||
import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.UiThread;
|
||||
@@ -30,11 +33,15 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.ActivityOptionsCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.RemoteTransitionCompat;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
public static final boolean ENABLE_SHELL_TRANSITIONS =
|
||||
SystemProperties.getBoolean("persist.debug.shell_transit", false);
|
||||
|
||||
private RecentsAnimationController mController;
|
||||
private RecentsAnimationCallbacks mCallbacks;
|
||||
@@ -43,7 +50,11 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
private GestureState mLastGestureState;
|
||||
private RemoteAnimationTargetCompat mLastAppearedTaskTarget;
|
||||
private Consumer<RemoteAnimationTargetCompat> mLaunchOtherTaskHandler;
|
||||
private Context mCtx;
|
||||
|
||||
TaskAnimationManager(Context ctx) {
|
||||
mCtx = ctx;
|
||||
}
|
||||
/**
|
||||
* Preloads the recents animation.
|
||||
*/
|
||||
@@ -122,8 +133,16 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
final long eventTime = gestureState.getSwipeUpStartTimeMs();
|
||||
mCallbacks.addListener(gestureState);
|
||||
mCallbacks.addListener(listener);
|
||||
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
|
||||
.startRecentsActivity(intent, eventTime, mCallbacks, null, null));
|
||||
|
||||
if (ENABLE_SHELL_TRANSITIONS) {
|
||||
RemoteTransitionCompat transition = new RemoteTransitionCompat(mCallbacks,
|
||||
mController != null ? mController.getController() : null);
|
||||
Bundle options = ActivityOptionsCompat.makeRemoteTransition(transition).toBundle();
|
||||
mCtx.startActivity(intent, options);
|
||||
} else {
|
||||
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
|
||||
.startRecentsActivity(intent, eventTime, mCallbacks, null, null));
|
||||
}
|
||||
gestureState.setState(STATE_RECENTS_ANIMATION_INITIALIZED);
|
||||
return mCallbacks;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
|
||||
@UiThread
|
||||
public void onUserUnlocked() {
|
||||
mTaskAnimationManager = new TaskAnimationManager();
|
||||
mTaskAnimationManager = new TaskAnimationManager(this);
|
||||
mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState);
|
||||
mOverviewCommandHelper = new OverviewCommandHelper(this, mDeviceState,
|
||||
mOverviewComponentObserver);
|
||||
|
||||
Reference in New Issue
Block a user