Loading packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +8 −26 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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) { Loading Loading @@ -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) { Loading packages/SystemUI/src/com/android/systemui/recents/BakedBezierInterpolator.javadeleted 100644 → 0 +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]); } } packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +7 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -42,6 +44,8 @@ public class RecentsConfiguration { public float animationPxMovementPerSecond; public Interpolator defaultBezierInterpolator; public int filteringCurrentViewsMinAnimDuration; public int filteringNewViewsMinAnimDuration; public int taskBarEnterAnimDuration; Loading Loading @@ -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 = Loading @@ -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); Loading packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +2 −20 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; } Loading @@ -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 packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java +41 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; Loading @@ -40,6 +39,7 @@ import android.os.UserManager; import android.util.Pair; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; Loading @@ -54,7 +54,7 @@ public class SystemServicesProxy { IPackageManager mIpm; UserManager mUm; SearchManager mSm; String mPackage; String mRecentsPackage; ComponentName mAssistComponent; Bitmap mDummyIcon; Loading @@ -67,7 +67,7 @@ public class SystemServicesProxy { mUm = (UserManager) context.getSystemService(Context.USER_SERVICE); mIpm = AppGlobals.getPackageManager(); mSm = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE); mPackage = context.getPackageName(); mRecentsPackage = context.getPackageName(); // Resolve the assist intent Intent assist = mSm.getAssistIntent(context, false); Loading @@ -83,14 +83,14 @@ public class SystemServicesProxy { } /** Returns a list of the recents tasks */ public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numTasks, int userId) { public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numLatestTasks, int userId) { if (mAm == null) return null; // If we are mocking, then create some recent tasks if (Constants.DebugFlags.App.EnableSystemServicesProxy) { ArrayList<ActivityManager.RecentTaskInfo> tasks = new ArrayList<ActivityManager.RecentTaskInfo>(); int count = Math.min(numTasks, Constants.DebugFlags.App.SystemServicesProxyMockTaskCount); int count = Math.min(numLatestTasks, Constants.DebugFlags.App.SystemServicesProxyMockTaskCount); for (int i = 0; i < count; i++) { // Create a dummy component name int packageIndex = i % Constants.DebugFlags.App.SystemServicesProxyMockPackageCount; Loading @@ -114,9 +114,43 @@ public class SystemServicesProxy { return tasks; } return mAm.getRecentTasksForUser(numTasks, // Remove home/recents/excluded tasks int minNumTasksToQuery = 10; int numTasksToQuery = Math.max(minNumTasksToQuery, numLatestTasks); List<ActivityManager.RecentTaskInfo> tasks = mAm.getRecentTasksForUser(numTasksToQuery, ActivityManager.RECENT_IGNORE_UNAVAILABLE | ActivityManager.RECENT_INCLUDE_PROFILES, userId); ActivityManager.RECENT_INCLUDE_PROFILES | ActivityManager.RECENT_WITH_EXCLUDED, userId); boolean isFirstValidTask = true; Iterator<ActivityManager.RecentTaskInfo> iter = tasks.iterator(); while (iter.hasNext()) { ActivityManager.RecentTaskInfo t = iter.next(); // NOTE: The order of these checks happens in the expected order of the traversal of the // tasks // Skip tasks from this Recents package if (t.baseIntent.getComponent().getPackageName().equals(mRecentsPackage)) { iter.remove(); continue; } // Check the first non-recents task, include this task even if it is marked as excluded // from recents. In other words, only remove excluded tasks if it is not the first task boolean isExcluded = (t.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; if (isExcluded && !isFirstValidTask) { iter.remove(); continue; } isFirstValidTask = false; // Skip tasks in the home stack if (isInHomeStack(t.persistentId)) { iter.remove(); continue; } } return tasks.subList(0, Math.min(tasks.size(), numLatestTasks)); } /** Returns a list of the running tasks */ Loading Loading
packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +8 −26 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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) { Loading Loading @@ -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) { Loading
packages/SystemUI/src/com/android/systemui/recents/BakedBezierInterpolator.javadeleted 100644 → 0 +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]); } }
packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +7 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -42,6 +44,8 @@ public class RecentsConfiguration { public float animationPxMovementPerSecond; public Interpolator defaultBezierInterpolator; public int filteringCurrentViewsMinAnimDuration; public int filteringNewViewsMinAnimDuration; public int taskBarEnterAnimDuration; Loading Loading @@ -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 = Loading @@ -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); Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +2 −20 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; } Loading @@ -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
packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java +41 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; Loading @@ -40,6 +39,7 @@ import android.os.UserManager; import android.util.Pair; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; Loading @@ -54,7 +54,7 @@ public class SystemServicesProxy { IPackageManager mIpm; UserManager mUm; SearchManager mSm; String mPackage; String mRecentsPackage; ComponentName mAssistComponent; Bitmap mDummyIcon; Loading @@ -67,7 +67,7 @@ public class SystemServicesProxy { mUm = (UserManager) context.getSystemService(Context.USER_SERVICE); mIpm = AppGlobals.getPackageManager(); mSm = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE); mPackage = context.getPackageName(); mRecentsPackage = context.getPackageName(); // Resolve the assist intent Intent assist = mSm.getAssistIntent(context, false); Loading @@ -83,14 +83,14 @@ public class SystemServicesProxy { } /** Returns a list of the recents tasks */ public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numTasks, int userId) { public List<ActivityManager.RecentTaskInfo> getRecentTasks(int numLatestTasks, int userId) { if (mAm == null) return null; // If we are mocking, then create some recent tasks if (Constants.DebugFlags.App.EnableSystemServicesProxy) { ArrayList<ActivityManager.RecentTaskInfo> tasks = new ArrayList<ActivityManager.RecentTaskInfo>(); int count = Math.min(numTasks, Constants.DebugFlags.App.SystemServicesProxyMockTaskCount); int count = Math.min(numLatestTasks, Constants.DebugFlags.App.SystemServicesProxyMockTaskCount); for (int i = 0; i < count; i++) { // Create a dummy component name int packageIndex = i % Constants.DebugFlags.App.SystemServicesProxyMockPackageCount; Loading @@ -114,9 +114,43 @@ public class SystemServicesProxy { return tasks; } return mAm.getRecentTasksForUser(numTasks, // Remove home/recents/excluded tasks int minNumTasksToQuery = 10; int numTasksToQuery = Math.max(minNumTasksToQuery, numLatestTasks); List<ActivityManager.RecentTaskInfo> tasks = mAm.getRecentTasksForUser(numTasksToQuery, ActivityManager.RECENT_IGNORE_UNAVAILABLE | ActivityManager.RECENT_INCLUDE_PROFILES, userId); ActivityManager.RECENT_INCLUDE_PROFILES | ActivityManager.RECENT_WITH_EXCLUDED, userId); boolean isFirstValidTask = true; Iterator<ActivityManager.RecentTaskInfo> iter = tasks.iterator(); while (iter.hasNext()) { ActivityManager.RecentTaskInfo t = iter.next(); // NOTE: The order of these checks happens in the expected order of the traversal of the // tasks // Skip tasks from this Recents package if (t.baseIntent.getComponent().getPackageName().equals(mRecentsPackage)) { iter.remove(); continue; } // Check the first non-recents task, include this task even if it is marked as excluded // from recents. In other words, only remove excluded tasks if it is not the first task boolean isExcluded = (t.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; if (isExcluded && !isFirstValidTask) { iter.remove(); continue; } isFirstValidTask = false; // Skip tasks in the home stack if (isInHomeStack(t.persistentId)) { iter.remove(); continue; } } return tasks.subList(0, Math.min(tasks.size(), numLatestTasks)); } /** Returns a list of the running tasks */ Loading