Fixing issue with regression with launching focused task.
- Only update the focused task as you scroll if we are in touch exploration mode. - Use stack's notion of focused task as the currently focused task may not have a TaskView and can be scrolled offscreen. Bug: 25590404 Change-Id: I5ef1b66ec74aa1a3131993ed84905210f1e45f18
This commit is contained in:
@@ -198,17 +198,12 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
public boolean launchFocusedTask() {
|
||||
if (mTaskStackView != null) {
|
||||
TaskStack stack = mTaskStackView.getStack();
|
||||
// Iterate the stack views and try and find the focused task
|
||||
List<TaskView> taskViews = mTaskStackView.getTaskViews();
|
||||
int taskViewCount = taskViews.size();
|
||||
for (int j = 0; j < taskViewCount; j++) {
|
||||
TaskView tv = taskViews.get(j);
|
||||
Task task = tv.getTask();
|
||||
if (tv.isFocusedTask()) {
|
||||
onTaskViewClicked(mTaskStackView, tv, stack, task, false, false, null,
|
||||
INVALID_STACK_ID);
|
||||
return true;
|
||||
}
|
||||
Task task = mTaskStackView.getFocusedTask();
|
||||
if (task != null) {
|
||||
TaskView taskView = mTaskStackView.getChildViewForTask(task);
|
||||
onTaskViewClicked(mTaskStackView, taskView, stack, task, false, false, null,
|
||||
INVALID_STACK_ID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -116,6 +116,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
List<TaskView> mImmutableTaskViews = new ArrayList<>();
|
||||
LayoutInflater mInflater;
|
||||
boolean mLayersDisabled;
|
||||
boolean mTouchExplorationEnabled;
|
||||
|
||||
Interpolator mFastOutSlowInInterpolator;
|
||||
|
||||
@@ -183,6 +184,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||
mTouchExplorationEnabled = ssp.isTouchExplorationEnabled();
|
||||
EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
@@ -425,7 +428,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
visibleStackRange[1] <= taskIndex && taskIndex <= visibleStackRange[0]) {
|
||||
mTmpTaskViewMap.put(task, tv);
|
||||
} else {
|
||||
if (tv.isFocusedTask()) {
|
||||
if (mTouchExplorationEnabled && tv.isFocusedTask()) {
|
||||
wasLastFocusedTaskAnimated = tv.isFocusAnimated();
|
||||
lastFocusedTaskIndex = taskIndex;
|
||||
resetFocusedTask();
|
||||
@@ -716,6 +719,16 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
mFocusedTaskIndex = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the focused task.
|
||||
*/
|
||||
Task getFocusedTask() {
|
||||
if (mFocusedTaskIndex != -1) {
|
||||
return mStack.getTasks().get(mFocusedTaskIndex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
|
||||
super.onInitializeAccessibilityEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user