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

Commit 0b20f57c authored by Winson Chung's avatar Winson Chung Committed by Android Git Automerger
Browse files

am ed517771: Merge changes I5d21645b,I8928e357

* commit 'ed517771f4b6a6e59f49dee56ae21e7b95c6fa99':
  Fixing NPE in accessing theme attribute.
  Better transition between excluded-from-recent applications to recents.
parents e7bbfa53 b7a6e198
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -3618,7 +3618,9 @@ public class Activity extends ContextThemeWrapper
        }

        // Get the primary color and update the RecentsActivityValues for this activity
        TypedArray a = getTheme().obtainStyledAttributes(com.android.internal.R.styleable.Theme);
        Resources.Theme tmpTheme = getTheme();
        if (tmpTheme != null) {
            TypedArray a = tmpTheme.obtainStyledAttributes(com.android.internal.R.styleable.Theme);
            int colorPrimary = a.getColor(com.android.internal.R.styleable.Theme_colorPrimary, 0);
            a.recycle();
            if (colorPrimary != 0) {
@@ -3627,6 +3629,7 @@ public class Activity extends ContextThemeWrapper
                setRecentsActivityValues(v);
            }
        }
    }

    /**
     * Same as calling {@link #startActivityForResult(Intent, int, Bundle)}
+8 −26
Original line number Diff line number Diff line
@@ -255,15 +255,10 @@ public class AlternateRecentsComponent {
    /** Loads the first task thumbnail */
    Bitmap loadFirstTaskThumbnail() {
        SystemServicesProxy ssp = mSystemServicesProxy;
        List<ActivityManager.RecentTaskInfo> tasks = ssp.getRecentTasks(1,
                UserHandle.CURRENT.getIdentifier());
        for (ActivityManager.RecentTaskInfo t : tasks) {
            // Skip tasks in the home stack
            if (ssp.isInHomeStack(t.persistentId)) {
                return null;
            }
        List<ActivityManager.RunningTaskInfo> tasks = ssp.getRunningTasks(1);

            return ssp.getTaskThumbnail(t.persistentId);
        for (ActivityManager.RunningTaskInfo t : tasks) {
            return ssp.getTaskThumbnail(t.id);
        }
        return null;
    }
@@ -286,17 +281,6 @@ public class AlternateRecentsComponent {
        return (tasks.size() > 1);
    }

    /** Returns whether the base intent of the top task stack was launched with the flag
     * Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS. */
    boolean isTopTaskExcludeFromRecents(List<ActivityManager.RecentTaskInfo> tasks) {
        if (tasks.size() > 0) {
            ActivityManager.RecentTaskInfo t = tasks.get(0);
            Console.log(t.baseIntent.toString());
            return (t.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
        }
        return false;
    }

    /** Converts from the device rotation to the degree */
    float getDegreesForRotation(int value) {
        switch (value) {
@@ -416,16 +400,14 @@ public class AlternateRecentsComponent {
        }

        // Otherwise, Recents is not the front-most activity and we should animate into it.  If
        // the activity at the root of the top task stack is excluded from recents, or if that
        // task stack is in the home stack, then we just do a simple transition.  Otherwise, we
        // animate to the rects defined by the Recents service, which can differ depending on the
        // number of items in the list.
        // the activity at the root of the top task stack in the home stack, then we just do a
        // simple transition.  Otherwise, we animate to the rects defined by the Recents service,
        // which can differ depending on the number of items in the list.
        List<ActivityManager.RecentTaskInfo> recentTasks =
                ssp.getRecentTasks(4, UserHandle.CURRENT.getIdentifier());
                ssp.getRecentTasks(2, UserHandle.CURRENT.getIdentifier());
        Rect taskRect = hasMultipleRecentsTask(recentTasks) ? mMultipleCountFirstTaskRect :
                mSingleCountFirstTaskRect;
        boolean isTaskExcludedFromRecents = isTopTaskExcludeFromRecents(recentTasks);
        boolean useThumbnailTransition = !isTopTaskHome && !isTaskExcludedFromRecents &&
        boolean useThumbnailTransition = !isTopTaskHome &&
                hasValidTaskRects();

        if (useThumbnailTransition) {
+0 −64
Original line number Diff line number Diff line
package com.android.systemui.recents;

import android.animation.TimeInterpolator;

/**
 * A pre-baked bezier-curved interpolator for quantum-paper transitions.
 */
public class BakedBezierInterpolator implements TimeInterpolator {
    public static final BakedBezierInterpolator INSTANCE = new BakedBezierInterpolator();

    /**
     * Use the INSTANCE variable instead of instantiating.
     */
    private BakedBezierInterpolator() {
        super();
    }

    /**
     * Lookup table values.
     * Generated using a Bezier curve from (0,0) to (1,1) with control points:
     * P0 (0,0)
     * P1 (0.4, 0)
     * P2 (0.2, 1.0)
     * P3 (1.0, 1.0)
     *
     * Values sampled with x at regular intervals between 0 and 1.
     */
    private static final float[] VALUES = new float[] {
        0.0f, 0.0002f, 0.0009f, 0.0019f, 0.0036f, 0.0059f, 0.0086f, 0.0119f, 0.0157f, 0.0209f,
        0.0257f, 0.0321f, 0.0392f, 0.0469f, 0.0566f, 0.0656f, 0.0768f, 0.0887f, 0.1033f, 0.1186f,
        0.1349f, 0.1519f, 0.1696f, 0.1928f, 0.2121f, 0.237f, 0.2627f, 0.2892f, 0.3109f, 0.3386f,
        0.3667f, 0.3952f, 0.4241f, 0.4474f, 0.4766f, 0.5f, 0.5234f, 0.5468f, 0.5701f, 0.5933f,
        0.6134f, 0.6333f, 0.6531f, 0.6698f, 0.6891f, 0.7054f, 0.7214f, 0.7346f, 0.7502f, 0.763f,
        0.7756f, 0.7879f, 0.8f, 0.8107f, 0.8212f, 0.8326f, 0.8415f, 0.8503f, 0.8588f, 0.8672f,
        0.8754f, 0.8833f, 0.8911f, 0.8977f, 0.9041f, 0.9113f, 0.9165f, 0.9232f, 0.9281f, 0.9328f,
        0.9382f, 0.9434f, 0.9476f, 0.9518f, 0.9557f, 0.9596f, 0.9632f, 0.9662f, 0.9695f, 0.9722f,
        0.9753f, 0.9777f, 0.9805f, 0.9826f, 0.9847f, 0.9866f, 0.9884f, 0.9901f, 0.9917f, 0.9931f,
        0.9944f, 0.9955f, 0.9964f, 0.9973f, 0.9981f, 0.9986f, 0.9992f, 0.9995f, 0.9998f, 1.0f, 1.0f
    };

    private static final float STEP_SIZE = 1.0f / (VALUES.length - 1);

    @Override
    public float getInterpolation(float input) {
        if (input >= 1.0f) {
            return 1.0f;
        }

        if (input <= 0f) {
            return 0f;
        }

        int position = Math.min(
                (int)(input * (VALUES.length - 1)),
                VALUES.length - 2);

        float quantized = position * STEP_SIZE;
        float difference = input - quantized;
        float weight = difference / STEP_SIZE;

        return VALUES[position] + weight * (VALUES[position + 1] - VALUES[position]);
    }

}
+7 −1
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.content.res.Resources;
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import com.android.systemui.R;


@@ -42,6 +44,8 @@ public class RecentsConfiguration {

    public float animationPxMovementPerSecond;

    public Interpolator defaultBezierInterpolator;

    public int filteringCurrentViewsMinAnimDuration;
    public int filteringNewViewsMinAnimDuration;
    public int taskBarEnterAnimDuration;
@@ -121,7 +125,6 @@ public class RecentsConfiguration {
                res.getDimensionPixelSize(R.dimen.recents_task_view_z_increment);
        searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height);


        taskBarViewDefaultBackgroundColor =
                res.getColor(R.color.recents_task_bar_default_background_color);
        taskBarViewDefaultTextColor =
@@ -131,6 +134,9 @@ public class RecentsConfiguration {
        taskBarViewDarkTextColor =
                res.getColor(R.color.recents_task_bar_dark_text_color);

        defaultBezierInterpolator = AnimationUtils.loadInterpolator(context,
                        com.android.internal.R.interpolator.fast_out_slow_in);

        // Update the search widget id
        SharedPreferences settings = context.getSharedPreferences(context.getPackageName(), 0);
        searchBarAppWidgetId = settings.getInt(Constants.Values.App.Key_SearchAppWidgetId, -1);
+2 −20
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import com.android.systemui.recents.model.TaskStack;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -362,7 +361,7 @@ public class RecentsTaskLoader {
        return mSystemServicesProxy;
    }

    private List<ActivityManager.RecentTaskInfo> getRecentTasks(Context context) {
    private List<ActivityManager.RecentTaskInfo> getRecentTasks() {
        long t1 = System.currentTimeMillis();

        SystemServicesProxy ssp = mSystemServicesProxy;
@@ -375,23 +374,6 @@ public class RecentsTaskLoader {
        Console.log(Constants.Log.App.TaskDataLoader,
                "[RecentsTaskLoader|tasks]", "" + tasks.size());

        // Remove home/recents tasks
        Iterator<ActivityManager.RecentTaskInfo> iter = tasks.iterator();
        while (iter.hasNext()) {
            ActivityManager.RecentTaskInfo t = iter.next();

            // Skip tasks in the home stack
            if (ssp.isInHomeStack(t.persistentId)) {
                iter.remove();
                continue;
            }
            // Skip tasks from this Recents package
            if (t.baseIntent.getComponent().getPackageName().equals(context.getPackageName())) {
                iter.remove();
                continue;
            }
        }

        return tasks;
    }

@@ -408,7 +390,7 @@ public class RecentsTaskLoader {

        // Get the recent tasks
        SystemServicesProxy ssp = mSystemServicesProxy;
        List<ActivityManager.RecentTaskInfo> tasks = getRecentTasks(context);
        List<ActivityManager.RecentTaskInfo> tasks = getRecentTasks();

        // Add each task to the task stack
        t1 = System.currentTimeMillis();
Loading