Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7845e8c4 authored by Winson's avatar Winson
Browse files

Adding logging to track down bitmap issues.

Bug: 27849282
Change-Id: Ie763a2a6cc968896e1ec0c4d89859cb49bd89e85
parent e8a4eff9
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -663,6 +663,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
            @Override
            public void run() {
                final Bitmap transitionBitmap = drawThumbnailTransitionBitmap(toTask, toTransform);
                if (transitionBitmap != null) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
@@ -670,6 +671,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
                            mThumbnailTransitionBitmapCacheKey = toTask;
                        }
                    });
                } else {
                    Log.e(TAG, "Could not load thumbnail for task: " + toTask + " at transform: " +
                            toTransform);
                }
            }
        });
    }
@@ -774,7 +779,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        // Get the transform for the running task
        stackView.updateLayoutAlgorithm(true /* boundScroll */);
        stackView.updateToInitialState(true /* scrollToInitialState */);
        mTmpTransform = stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask,
        stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask,
                stackView.getScroller().getStackScroll(), mTmpTransform, null);
        return mTmpTransform;
    }
+27 −15
Original line number Diff line number Diff line
@@ -28,11 +28,13 @@ import android.app.ActivityOptions.OnAnimationStartedListener;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.RemoteException;
import android.util.Log;
import android.view.AppTransitionAnimationSpec;
import android.view.IAppTransitionAnimationSpecsFuture;

@@ -252,12 +254,13 @@ public class RecentsTransitionHelper {
    /**
     * Composes the transition spec when docking a task, which includes a full task bitmap.
     */
    public List<AppTransitionAnimationSpec> composeDockAnimationSpec(
            TaskView taskView, Rect transform) {
        TaskViewTransform viewTransform = new TaskViewTransform();
        viewTransform.fillIn(taskView);
        return Collections.singletonList(new AppTransitionAnimationSpec(taskView.getTask().key.id,
                RecentsTransitionHelper.composeTaskBitmap(taskView, viewTransform), transform));
    public List<AppTransitionAnimationSpec> composeDockAnimationSpec(TaskView taskView,
            Rect bounds) {
        mTmpTransform.fillIn(taskView);
        Task task = taskView.getTask();
        Bitmap thumbnail = RecentsTransitionHelper.composeTaskBitmap(taskView, mTmpTransform);
        return Collections.singletonList(new AppTransitionAnimationSpec(task.key.id, thumbnail,
                bounds));
    }

    /**
@@ -336,6 +339,14 @@ public class RecentsTransitionHelper {
        float scale = transform.scale;
        int fromWidth = (int) (transform.rect.width() * scale);
        int fromHeight = (int) (transform.rect.height() * scale);
        if (fromWidth == 0 || fromHeight == 0) {
            Log.e(TAG, "Could not compose thumbnail for task: " + taskView.getTask() +
                    " at transform: " + transform);

            Bitmap b = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
            b.eraseColor(Color.TRANSPARENT);
            return b;
        } else {
            Bitmap b = Bitmap.createBitmap(fromWidth, fromHeight,
                    Bitmap.Config.ARGB_8888);

@@ -349,6 +360,7 @@ public class RecentsTransitionHelper {
            }
            return b.createAshmemBitmap();
        }
    }

    private static Bitmap composeHeaderBitmap(TaskView taskView,
            TaskViewTransform transform) {
+5 −0
Original line number Diff line number Diff line
@@ -226,4 +226,9 @@ public class TaskViewTransform {
        v.getViewBounds().setClipBottom(0);
        v.setLeftTopRightBottom(0, 0, 0, 0);
    }

    @Override
    public String toString() {
        return "R: " + rect + " V: " + visible;
    }
}