summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/AppTransitionAnimationSpecsFuture.java13
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/RecentsTransition.java34
2 files changed, 29 insertions, 18 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/AppTransitionAnimationSpecsFuture.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/AppTransitionAnimationSpecsFuture.java
index a46fab35f66b..7a24071fef90 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/AppTransitionAnimationSpecsFuture.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/AppTransitionAnimationSpecsFuture.java
@@ -22,6 +22,7 @@ import android.view.AppTransitionAnimationSpec;
import android.view.IAppTransitionAnimationSpecsFuture;
import java.util.List;
+import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
/**
@@ -31,11 +32,13 @@ import java.util.concurrent.FutureTask;
public abstract class AppTransitionAnimationSpecsFuture {
private final Handler mHandler;
- private FutureTask<List<AppTransitionAnimationSpec>> mComposeTask = new FutureTask<>(() -> {
- synchronized (AppTransitionAnimationSpecsFuture.this) {
- return composeSpecs();
- }
- });
+ private FutureTask<List<AppTransitionAnimationSpec>> mComposeTask = new FutureTask<>(
+ new Callable<List<AppTransitionAnimationSpec>>() {
+ @Override
+ public List<AppTransitionAnimationSpec> call() throws Exception {
+ return composeSpecs();
+ }
+ });
private final IAppTransitionAnimationSpecsFuture mFuture =
new IAppTransitionAnimationSpecsFuture.Stub() {
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/RecentsTransition.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/RecentsTransition.java
index 3095d151726d..f8f86f066236 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/RecentsTransition.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/view/RecentsTransition.java
@@ -42,7 +42,7 @@ public class RecentsTransition {
*/
public static ActivityOptions createAspectScaleAnimation(Context context, Handler handler,
boolean scaleUp, AppTransitionAnimationSpecsFuture animationSpecsFuture,
- OnAnimationStartedListener animationStartCallback) {
+ final OnAnimationStartedListener animationStartCallback) {
final OnAnimationStartedListener animStartedListener = new OnAnimationStartedListener() {
private boolean mHandled;
@@ -70,15 +70,20 @@ public class RecentsTransition {
/**
* Wraps a animation-start callback in a binder that can be called from window manager.
*/
- public static IRemoteCallback wrapStartedListener(Handler handler,
- OnAnimationStartedListener listener) {
+ public static IRemoteCallback wrapStartedListener(final Handler handler,
+ final OnAnimationStartedListener listener) {
if (listener == null) {
return null;
}
return new IRemoteCallback.Stub() {
@Override
public void sendResult(Bundle data) throws RemoteException {
- handler.post(listener::onAnimationStarted);
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ listener.onAnimationStarted();
+ }
+ });
}
};
}
@@ -87,15 +92,18 @@ public class RecentsTransition {
* @return a {@link GraphicBuffer} with the {@param view} drawn into it. Result can be null if
* we were unable to allocate a hardware bitmap.
*/
- public static GraphicBuffer drawViewIntoGraphicBuffer(int width, int height, View view,
- float scale, int eraseColor) {
- final Bitmap hwBitmap = createHardwareBitmap(width, height, (c) -> {
- c.scale(scale, scale);
- if (eraseColor != 0) {
- c.drawColor(eraseColor);
- }
- if (view != null) {
- view.draw(c);
+ public static GraphicBuffer drawViewIntoGraphicBuffer(int width, int height, final View view,
+ final float scale, final int eraseColor) {
+ final Bitmap hwBitmap = createHardwareBitmap(width, height, new Consumer<Canvas>() {
+ @Override
+ public void accept(Canvas c) {
+ c.scale(scale, scale);
+ if (eraseColor != 0) {
+ c.drawColor(eraseColor);
+ }
+ if (view != null) {
+ view.draw(c);
+ }
}
});
return hwBitmap != null ? hwBitmap.createGraphicBufferHandle() : null;