Loading core/java/android/app/Activity.java +1 −0 Original line number Diff line number Diff line Loading @@ -4807,6 +4807,7 @@ public class Activity extends ContextThemeWrapper public void setRecentsActivityValues(ActivityManager.RecentsActivityValues values) { ActivityManager.RecentsActivityValues activityValues = new ActivityManager.RecentsActivityValues(values); // Scale the icon down to something reasonable if (values.icon != null) { final int size = ActivityManager.getLauncherLargeIconSizeInner(this); activityValues.icon = Bitmap.createScaledBitmap(values.icon, size, size, true); Loading packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +4 −2 Original line number Diff line number Diff line Loading @@ -554,15 +554,17 @@ public class RecentsTaskLoader { } /** Completely removes the resource data from the pool. */ public void deleteTaskData(Task t) { public void deleteTaskData(Task t, boolean notifyTaskDataUnloaded) { Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|deleteTask]", t); mLoadQueue.removeTask(t); mThumbnailCache.remove(t.key); mApplicationIconCache.remove(t.key); if (notifyTaskDataUnloaded) { t.notifyTaskDataUnloaded(mDefaultThumbnail, mDefaultApplicationIcon); } } /** Stops the task loader and clears all pending tasks */ void stopLoader() { Loading packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java +3 −2 Original line number Diff line number Diff line Loading @@ -165,11 +165,12 @@ public class SystemServicesProxy { } /** Removes the task and kills the process */ public void removeTask(int taskId) { public void removeTask(int taskId, boolean isDocument) { if (mAm == null) return; if (Constants.DebugFlags.App.EnableSystemServicesProxy) return; mAm.removeTask(taskId, ActivityManager.REMOVE_TASK_KILL_PROCESS); // Remove the task, and only kill the process if it is not a document mAm.removeTask(taskId, isDocument ? 0 : ActivityManager.REMOVE_TASK_KILL_PROCESS); } /** Loading packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +20 −1 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV RecentsTaskLoader.getInstance().getSystemServicesProxy() .moveTaskToFront(task.key.id, opts); } else { // Launch the activity with the desired animation // Launch the activity anew with the desired animation Intent i = new Intent(task.key.baseIntent); i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME Loading @@ -361,6 +361,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } catch (ActivityNotFoundException anfe) { Console.logError(getContext(), "Could not start Activity"); } // And clean up the old task onTaskRemoved(task); } Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask, Loading Loading @@ -390,6 +393,22 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV .addNextIntentWithParentStack(intent).startActivities(); } @Override public void onTaskRemoved(Task t) { // Remove any stored data from the loader. We currently don't bother notifying the views // that the data has been unloaded because at the point we call onTaskRemoved(), the views // either don't need to be updated, or have already been removed. RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); loader.deleteTaskData(t, false); // Remove the old task from activity manager int flags = t.key.baseIntent.getFlags(); boolean isDocument = (flags & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) == Intent.FLAG_ACTIVITY_NEW_DOCUMENT; RecentsTaskLoader.getInstance().getSystemServicesProxy().removeTask(t.key.id, isDocument); } /**** RecentsPackageMonitor.PackageCallbacks Implementation ****/ @Override Loading packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +4 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.animation.ValueAnimator; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -60,6 +61,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal interface TaskStackViewCallbacks { public void onTaskLaunched(TaskStackView stackView, TaskView tv, TaskStack stack, Task t); public void onTaskAppInfoLaunched(Task t); public void onTaskRemoved(Task t); } TaskStack mStack; Loading Loading @@ -1480,12 +1482,8 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { // Remove the task from the view mSv.mStack.removeTask(task); // Remove any stored data from the loader RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); loader.deleteTaskData(task); // Remove the task from activity manager RecentsTaskLoader.getInstance().getSystemServicesProxy().removeTask(tv.getTask().key.id); // Notify the callback that we've removed the task and it can clean up after it mSv.mCb.onTaskRemoved(task); // Disable HW layers mSv.decHwLayersRefCount("swipeComplete"); Loading Loading
core/java/android/app/Activity.java +1 −0 Original line number Diff line number Diff line Loading @@ -4807,6 +4807,7 @@ public class Activity extends ContextThemeWrapper public void setRecentsActivityValues(ActivityManager.RecentsActivityValues values) { ActivityManager.RecentsActivityValues activityValues = new ActivityManager.RecentsActivityValues(values); // Scale the icon down to something reasonable if (values.icon != null) { final int size = ActivityManager.getLauncherLargeIconSizeInner(this); activityValues.icon = Bitmap.createScaledBitmap(values.icon, size, size, true); Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +4 −2 Original line number Diff line number Diff line Loading @@ -554,15 +554,17 @@ public class RecentsTaskLoader { } /** Completely removes the resource data from the pool. */ public void deleteTaskData(Task t) { public void deleteTaskData(Task t, boolean notifyTaskDataUnloaded) { Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|deleteTask]", t); mLoadQueue.removeTask(t); mThumbnailCache.remove(t.key); mApplicationIconCache.remove(t.key); if (notifyTaskDataUnloaded) { t.notifyTaskDataUnloaded(mDefaultThumbnail, mDefaultApplicationIcon); } } /** Stops the task loader and clears all pending tasks */ void stopLoader() { Loading
packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java +3 −2 Original line number Diff line number Diff line Loading @@ -165,11 +165,12 @@ public class SystemServicesProxy { } /** Removes the task and kills the process */ public void removeTask(int taskId) { public void removeTask(int taskId, boolean isDocument) { if (mAm == null) return; if (Constants.DebugFlags.App.EnableSystemServicesProxy) return; mAm.removeTask(taskId, ActivityManager.REMOVE_TASK_KILL_PROCESS); // Remove the task, and only kill the process if it is not a document mAm.removeTask(taskId, isDocument ? 0 : ActivityManager.REMOVE_TASK_KILL_PROCESS); } /** Loading
packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +20 −1 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV RecentsTaskLoader.getInstance().getSystemServicesProxy() .moveTaskToFront(task.key.id, opts); } else { // Launch the activity with the desired animation // Launch the activity anew with the desired animation Intent i = new Intent(task.key.baseIntent); i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME Loading @@ -361,6 +361,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } catch (ActivityNotFoundException anfe) { Console.logError(getContext(), "Could not start Activity"); } // And clean up the old task onTaskRemoved(task); } Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask, Loading Loading @@ -390,6 +393,22 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV .addNextIntentWithParentStack(intent).startActivities(); } @Override public void onTaskRemoved(Task t) { // Remove any stored data from the loader. We currently don't bother notifying the views // that the data has been unloaded because at the point we call onTaskRemoved(), the views // either don't need to be updated, or have already been removed. RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); loader.deleteTaskData(t, false); // Remove the old task from activity manager int flags = t.key.baseIntent.getFlags(); boolean isDocument = (flags & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) == Intent.FLAG_ACTIVITY_NEW_DOCUMENT; RecentsTaskLoader.getInstance().getSystemServicesProxy().removeTask(t.key.id, isDocument); } /**** RecentsPackageMonitor.PackageCallbacks Implementation ****/ @Override Loading
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +4 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.animation.ValueAnimator; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -60,6 +61,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal interface TaskStackViewCallbacks { public void onTaskLaunched(TaskStackView stackView, TaskView tv, TaskStack stack, Task t); public void onTaskAppInfoLaunched(Task t); public void onTaskRemoved(Task t); } TaskStack mStack; Loading Loading @@ -1480,12 +1482,8 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { // Remove the task from the view mSv.mStack.removeTask(task); // Remove any stored data from the loader RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); loader.deleteTaskData(task); // Remove the task from activity manager RecentsTaskLoader.getInstance().getSystemServicesProxy().removeTask(tv.getTask().key.id); // Notify the callback that we've removed the task and it can clean up after it mSv.mCb.onTaskRemoved(task); // Disable HW layers mSv.decHwLayersRefCount("swipeComplete"); Loading