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

Commit 911f400c authored by Winson Chung's avatar Winson Chung
Browse files

Fixing Recents regressions.

- Fixes crash when alt-tabbing recents
- Fixes issue with recents not showing after rotating
- Fixes flash when task view header is focused

Bugs: 19382697, 19343393

Change-Id: Ida0984dba1c76526298eb4886f96835fdf871b9f
parent 7478de1e
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -193,8 +193,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        }

        // Start loading tasks according to the load plan
        ArrayList<TaskStack> stacks = plan.getAllTaskStacks();
        if (stacks.size() == 0) {
        if (!plan.hasTasks()) {
            loader.preloadTasks(plan, mConfig.launchedFromHome);
        }
        RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
@@ -203,11 +202,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        loadOpts.numVisibleTaskThumbnails = mConfig.launchedNumVisibleThumbnails;
        loader.loadTasks(this, plan, loadOpts);

        boolean hasTasks = plan.hasTasks();
        if (hasTasks) {
        ArrayList<TaskStack> stacks = plan.getAllTaskStacks();
        mConfig.launchedWithNoRecentTasks = !plan.hasTasks();
        if (!mConfig.launchedWithNoRecentTasks) {
            mRecentsView.setTaskStacks(stacks);
        }
        mConfig.launchedWithNoRecentTasks = !hasTasks;

        // Create the home intent runnable
        Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
+1 −1
Original line number Diff line number Diff line
@@ -879,7 +879,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal

                    // Start the focus animation when alt-tabbing
                    if (mConfig.launchedWithAltTab && !mConfig.launchedHasConfigurationChanged) {
                        TaskView tv = taskViews.get(mFocusedTaskIndex);
                        TaskView tv = getChildViewForTask(mStack.getTasks().get(mFocusedTaskIndex));
                        if (tv != null) {
                            tv.setFocusedTask(true);
                        }
+8 −8
Original line number Diff line number Diff line
@@ -32,12 +32,10 @@ import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.FrameLayout;
@@ -104,11 +102,10 @@ public class TaskViewHeader extends FrameLayout {
        });

        // Load the dismiss resources
        Resources res = context.getResources();
        mLightDismissDrawable = res.getDrawable(R.drawable.recents_dismiss_light);
        mDarkDismissDrawable = res.getDrawable(R.drawable.recents_dismiss_dark);
        mLightDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_light);
        mDarkDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_dark);
        mDismissContentDescription =
                res.getString(R.string.accessibility_recents_item_will_be_dismissed);
                context.getString(R.string.accessibility_recents_item_will_be_dismissed);

        // Configure the highlight paint
        if (sHighlightPaint == null) {
@@ -283,23 +280,26 @@ public class TaskViewHeader extends FrameLayout {
        }

        if (focused) {
            int currentColor = mBackgroundColor;
            int secondaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark);
            int[][] states = new int[][] {
                    new int[] {},
                    new int[] { android.R.attr.state_enabled },
                    new int[] { android.R.attr.state_pressed }
            };
            int[] newStates = new int[]{
                    0,
                    android.R.attr.state_enabled,
                    android.R.attr.state_pressed
            };
            int[] colors = new int[] {
                    currentColor,
                    secondaryColor,
                    secondaryColor
            };
            mBackground.setColor(new ColorStateList(states, colors));
            mBackground.setState(newStates);
            // Pulse the background color
            int currentColor = mBackgroundColor;
            int lightPrimaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark);
            ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(),
                    currentColor, lightPrimaryColor);
@@ -326,7 +326,7 @@ public class TaskViewHeader extends FrameLayout {

            mFocusAnimator = new AnimatorSet();
            mFocusAnimator.playTogether(backgroundColor, translation);
            mFocusAnimator.setStartDelay(750);
            mFocusAnimator.setStartDelay(150);
            mFocusAnimator.setDuration(750);
            mFocusAnimator.start();
        } else {