Refactoring OverviewCommandHelper (1/3)

- Updates pendingCommands to be a ConcurrentLinkedDeque and make the list safe across multiple threads.
- Introduces CommandStatus to clear only IDLE and COMPLETED commands.
- Adds CommandType enum to prevent adding an invalid command value into the queue and having an unexpected behavior.
- Log messages improved

Bug: 352046797
Bug: 351122926
Flag: EXEMPT bugfix.
Test: Manual.
Change-Id: I80705dca0be579e62cb9e2bd923808dd33c4d633
This commit is contained in:
Jordan Silva committed 2024-08-28 17:09:29 +01:00
1 parent 4fd9449d64
commit e7ae4e31ae
4 files changed
+122 -123

No files matched your search

@@ -108,6 +108,7 @@ import com.android.launcher3.util.PluginManagerWrapper;
import com.android.launcher3.util.SafeCloseable;
import com.android.launcher3.util.ScreenOnTracker;
import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.OverviewCommandHelper.CommandType;
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
import com.android.quickstep.inputconsumers.AssistantInputConsumer;
import com.android.quickstep.inputconsumers.BubbleBarInputConsumer;
@@ -245,7 +246,7 @@ public class TouchInteractionService extends Service {
return;
}
TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
tis.mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_TOGGLE);
tis.mOverviewCommandHelper.addCommand(CommandType.TOGGLE);
});
}
@@ -255,10 +256,9 @@ public class TouchInteractionService extends Service {
executeForTouchInteractionService(tis -> {
if (triggeredFromAltTab) {
TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
tis.mOverviewCommandHelper.addCommand(
OverviewCommandHelper.TYPE_KEYBOARD_INPUT);
tis.mOverviewCommandHelper.addCommand(CommandType.KEYBOARD_INPUT);
} else {
tis.mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_SHOW);
tis.mOverviewCommandHelper.addCommand(CommandType.SHOW);
}
});
}
@@ -269,7 +269,7 @@ public class TouchInteractionService extends Service {
executeForTouchInteractionService(tis -> {
if (triggeredFromAltTab && !triggeredFromHomeKey) {
// onOverviewShownFromAltTab hides the overview and ends at the target app
tis.mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HIDE);
tis.mOverviewCommandHelper.addCommand(CommandType.HIDE);
}
});
}
@@ -594,12 +594,12 @@ public class TouchInteractionService extends Service {
private final TaskbarNavButtonCallbacks mNavCallbacks = new TaskbarNavButtonCallbacks() {
@Override
public void onNavigateHome() {
mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HOME);
mOverviewCommandHelper.addCommand(CommandType.HOME);
}
@Override
public void onToggleOverview() {
mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_TOGGLE);
mOverviewCommandHelper.addCommand(CommandType.TOGGLE);
}
};