The crash was happening because we were sending a future from sysui, but
that future would always return null animation specs when docking. This
makes it returns proper specs in that case. However, we need to still
protect ourselves from null specs when executing the future.
Bug:
25765339
Change-Id: I02d842ea31503169f6e053a1695d8896d2e4d97c
return stackId == FULLSCREEN_WORKSPACE_STACK_ID
|| stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID;
}
+
+ /**
+ * Returns true if animation specs should be constructed for app transition that moves
+ * the task to the specified stack.
+ */
+ public static boolean useAnimationSpecForAppTransition(int stackId) {
+ return stackId == FREEFORM_WORKSPACE_STACK_ID
+ || stackId == FULLSCREEN_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
+ }
}
/**
package com.android.systemui.recents.views;
import android.annotation.Nullable;
+import android.app.ActivityManager;
+import android.app.ActivityManager.StackId;
import android.app.ActivityOptions;
import android.content.Context;
import android.graphics.Bitmap;
import java.util.ArrayList;
import java.util.List;
+import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
// Ensure we have a valid target stack id
final int targetStackId = destinationStack != INVALID_STACK_ID ?
destinationStack : task.key.stackId;
- if (targetStackId != FREEFORM_WORKSPACE_STACK_ID
- && targetStackId != FULLSCREEN_WORKSPACE_STACK_ID) {
+ if (!StackId.useAnimationSpecForAppTransition(targetStackId)) {
return null;
}
mNextAppTransitionFutureCallback, null /* finishedCallback */,
mNextAppTransitionScaleUp);
mNextAppTransitionFutureCallback = null;
- mService.prolongAnimationsFromSpecs(specs, mNextAppTransitionScaleUp);
+ if (specs != null) {
+ mService.prolongAnimationsFromSpecs(specs, mNextAppTransitionScaleUp);
+ }
}
mService.requestTraversal();
}
import android.Manifest;
import android.animation.ValueAnimator;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
}
}
- void prolongAnimationsFromSpecs(AppTransitionAnimationSpec[] specs, boolean scaleUp) {
+ void prolongAnimationsFromSpecs(@NonNull AppTransitionAnimationSpec[] specs, boolean scaleUp) {
// This is used by freeform <-> recents windows transition. We need to synchronize
// the animation with the appearance of the content of recents, so we will make
// animation stay on the first or last frame a little longer.
- if (specs == null) {
- Slog.wtf(TAG, "prolongAnimationsFromSpecs: AppTransitionAnimationSpec is null!");
- return;
- }
mTmpTaskIds.clear();
for (int i = specs.length - 1; i >= 0; i--) {
mTmpTaskIds.put(specs[i].taskId, 0);