Merge "Fix crash when deleting task" into oc-dev

This commit is contained in:
Winson Chung
2017-06-08 17:37:53 +00:00
committed by Android (Google) Code Review

View File

@@ -133,6 +133,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
@ViewDebug.ExportedProperty(deepExport=true, prefix="task_") @ViewDebug.ExportedProperty(deepExport=true, prefix="task_")
private Task mTask; private Task mTask;
private boolean mTaskBound;
@ViewDebug.ExportedProperty(category="recents") @ViewDebug.ExportedProperty(category="recents")
private boolean mClipViewInStack = true; private boolean mClipViewInStack = true;
@ViewDebug.ExportedProperty(category="recents") @ViewDebug.ExportedProperty(category="recents")
@@ -607,6 +608,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
SystemServicesProxy ssp = Recents.getSystemServices(); SystemServicesProxy ssp = Recents.getSystemServices();
mTouchExplorationEnabled = touchExplorationEnabled; mTouchExplorationEnabled = touchExplorationEnabled;
mTask = t; mTask = t;
mTaskBound = true;
mTask.addCallback(this); mTask.addCallback(this);
mIsDisabledInSafeMode = !mTask.isSystemApp && ssp.isInSafeMode(); mIsDisabledInSafeMode = !mTask.isSystemApp && ssp.isInSafeMode();
mThumbnailView.bindToTask(mTask, mIsDisabledInSafeMode, displayOrientation, displayRect); mThumbnailView.bindToTask(mTask, mIsDisabledInSafeMode, displayOrientation, displayRect);
@@ -627,9 +629,11 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
@Override @Override
public void onTaskDataLoaded(Task task, ThumbnailData thumbnailData) { public void onTaskDataLoaded(Task task, ThumbnailData thumbnailData) {
// Update each of the views to the new task data if (mTaskBound) {
mThumbnailView.onTaskDataLoaded(thumbnailData); // Update each of the views to the new task data
mHeaderView.onTaskDataLoaded(); mThumbnailView.onTaskDataLoaded(thumbnailData);
mHeaderView.onTaskDataLoaded();
}
} }
@Override @Override
@@ -638,6 +642,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
mTask.removeCallback(this); mTask.removeCallback(this);
mThumbnailView.unbindFromTask(); mThumbnailView.unbindFromTask();
mHeaderView.unbindFromTask(mTouchExplorationEnabled); mHeaderView.unbindFromTask(mTouchExplorationEnabled);
mTaskBound = false;
} }
@Override @Override