Fixing memory leaks related to Tasks holding onto their callbacks.
- Switching to SwipeHelper
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index b1d0d13..9ef74ca 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -255,13 +255,13 @@
}
/** Actually synchronizes the model data into the views */
- void syncToTask() {
+ private void syncToTask() {
mThumbnailView.rebindToTask(mTask, false);
mIconView.rebindToTask(mTask, false);
}
/** Unset the task and callback */
- void unbindFromTask() {
+ private void unbindFromTask() {
mTask.setCallbacks(null);
mThumbnailView.unbindFromTask();
mIconView.unbindFromTask();
@@ -357,16 +357,16 @@
/** Enable the hw layers on this task view */
void enableHwLayers() {
- Console.log(Constants.DebugFlags.UI.HwLayers, "[TaskView|enableHwLayers]");
mThumbnailView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
/** Disable the hw layers on this task view */
void disableHwLayers() {
- Console.log(Constants.DebugFlags.UI.HwLayers, "[TaskView|disableHwLayers]");
mThumbnailView.setLayerType(View.LAYER_TYPE_NONE, null);
}
+ /**** TaskCallbacks Implementation ****/
+
@Override
public void onTaskDataChanged(Task task) {
Console.log(Constants.DebugFlags.App.EnableBackgroundTaskLoading,
@@ -380,6 +380,16 @@
}
@Override
+ public void onTaskBound() {
+ syncToTask();
+ }
+
+ @Override
+ public void onTaskUnbound() {
+ unbindFromTask();
+ }
+
+ @Override
public void onClick(View v) {
mCb.onTaskIconClicked(this);
}