Revert "Revert "Merge commit '8d14dbe041199d611839140f1c9285fd4174e9f4' ...""

This reverts commit 087a9e39b6.

Change-Id: I05b17a6e4aaaef6de3c2fa26aad45a39eb2833f9
This commit is contained in:
Winson Chung committed 2020-10-23 09:27:48 -07:00
1 parent fd2dac816b
commit f99351888c
138 files changed
+1945 -2136

No files matched your search

@@ -66,6 +66,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.shortcuts.DeepShortcutView;
@@ -81,6 +82,7 @@ import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
@@ -795,6 +797,36 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
== PackageManager.PERMISSION_GRANTED;
}
private void addCujInstrumentation(Animator anim, int cuj, String transition) {
if (Trace.isEnabled()) {
anim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationStart(Animator animation) {
Trace.beginAsyncSection(transition, 0);
InteractionJankMonitorWrapper.begin(cuj);
super.onAnimationStart(animation);
}
@Override
public void onAnimationCancel(Animator animation) {
super.onAnimationCancel(animation);
InteractionJankMonitorWrapper.cancel(cuj);
}
@Override
public void onAnimationSuccess(Animator animator) {
InteractionJankMonitorWrapper.end(cuj);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
Trace.endAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
}
});
}
}
/**
* Remote animation runner for animation from the app to Launcher, including recents.
*/
@@ -859,21 +891,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
// is initialized.
if (launcherIsATargetWithMode(appTargets, MODE_OPENING)
|| mLauncher.isForceInvisible()) {
if (Trace.isEnabled()) {
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
Trace.beginAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
super.onAnimationStart(animation);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
Trace.endAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
}
});
}
addCujInstrumentation(
anim, InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME,
TRANSITION_OPEN_LAUNCHER);
// Only register the content animation for cancellation when state changes
mLauncher.getStateManager().setCurrentAnimation(anim);
@@ -942,25 +962,12 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
launcherClosing);
}
if (Trace.isEnabled()) {
final String section =
launchingFromRecents
? TRANSITION_LAUNCH_FROM_RECENTS : TRANSITION_LAUNCH_FROM_ICON;
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
Trace.beginAsyncSection(section, 0);
super.onAnimationStart(animation);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
Trace.endAsyncSection(section, 0);
}
});
}
addCujInstrumentation(anim,
launchingFromRecents
? InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_RECENTS
: InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_ICON,
launchingFromRecents
? TRANSITION_LAUNCH_FROM_RECENTS : TRANSITION_LAUNCH_FROM_ICON);
if (launcherClosing) {
anim.addListener(mForceInvisibleListener);