feat(QuickSwitch): Initial work

Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
Pun Butrach committed 2026-03-25 01:17:47 +07:00
1 parent ee4393ef2a
commit 8a6eb2a4ff
5 files changed
+29 -18

No files matched your search

@@ -153,16 +153,16 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
getViewTreeObserver().addOnComputeInternalInsetsListener(mTaskbarInsetsComputer);
// if (Utilities.ATLEAST_U) {
// mViewCaptureCloseable = SettingsAwareViewCapture.getInstance(getContext())
// .startCapture(getRootView(), ".Taskbar");
// .startCapture(getRootView(), ".Taskbar"); // pE-TODO(QuickSwitch-Baklava): Investigate
// }
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (Utilities.ATLEAST_U) {
mViewCaptureCloseable.close();
}
super.onDetachedFromWindow();
// if (Utilities.ATLEAST_U) { // pE-TODO(QuickSwitch-Baklava): Investigate
// mViewCaptureCloseable.close();
// }
onDestroy(true);
}
@@ -23,6 +23,7 @@ import androidx.annotation.VisibleForTesting
import com.android.launcher3.BubbleTextView.RunningAppState
import com.android.launcher3.Flags
import com.android.launcher3.Flags.enableRecentsInTaskbar
import com.android.launcher3.Utilities
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.model.data.TaskItemInfo
import com.android.launcher3.model.data.WorkspaceItemInfo
@@ -50,7 +51,11 @@ class TaskbarRecentAppsController(
var canShowRunningApps =
DesktopModeStatus.canEnterDesktopMode(context) &&
DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_TASKBAR_RUNNING_APPS.isTrue
if (Utilities.ATLEAST_BAKLAVA_1) {
DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_TASKBAR_RUNNING_APPS.isTrue
} else {
false
}
@VisibleForTesting
set(isEnabledFromTest) {
field = isEnabledFromTest
@@ -60,7 +65,11 @@ class TaskbarRecentAppsController(
}
val enableRecentTasksThrottle =
DesktopExperienceFlags.ENABLE_TASKBAR_RECENT_TASKS_THROTTLE_BUGFIX.isTrue
if (Utilities.ATLEAST_BAKLAVA_1) {
DesktopExperienceFlags.ENABLE_TASKBAR_RECENT_TASKS_THROTTLE_BUGFIX.isTrue
} else {
false
}
// TODO(b/343532825): Add a setting to disable Recents even when the flag is on.
var canShowRecentApps = enableRecentsInTaskbar()
@@ -107,7 +107,7 @@ public final class TaskbarOverlayController {
/**
* Token for early wakeup requests to SurfaceFlinger.
*/
private EarlyWakeupInfo mEarlyWakeupInfo = new EarlyWakeupInfo();
// private EarlyWakeupInfo mEarlyWakeupInfo = new EarlyWakeupInfo(); // pE-TODO(QuickSwitch-Baklava): Investigate
public TaskbarOverlayController(
TaskbarActivityContext taskbarContext, DeviceProfile launcherDeviceProfile) {
@@ -118,8 +118,8 @@ public final class TaskbarOverlayController {
mLauncherDeviceProfile = launcherDeviceProfile;
mMaxBlurRadius = mTaskbarContext.getResources().getDimensionPixelSize(
R.dimen.max_depth_blur_radius_enhanced);
mEarlyWakeupInfo.token = new Binder();
mEarlyWakeupInfo.trace = TaskbarOverlayController.class.getName();
// mEarlyWakeupInfo.token = new Binder();
// mEarlyWakeupInfo.trace = TaskbarOverlayController.class.getName();
}
/** Initialize the controller. */
@@ -277,21 +277,21 @@ public final class TaskbarOverlayController {
// SurfaceFlinger will adjust its internal offsets to avoid jank.
boolean wantsEarlyWakeUp = radius > 0 && radius < mMaxBlurRadius;
if (wantsEarlyWakeUp && !mInEarlyWakeUp) {
Log.d(TAG, "setBackgroundBlurRadius: setting early wakeup with token "
+ mEarlyWakeupInfo);
// Log.d(TAG, "setBackgroundBlurRadius: setting early wakeup with token "
// + mEarlyWakeupInfo);
Trace.instantForTrack(TRACE_TAG_APP, TAG, "notifyRendererForGpuLoadUp");
dragLayerViewRoot.notifyRendererForGpuLoadUp("setBackgroundBlurRadius");
try {
transaction.setEarlyWakeupStart(mEarlyWakeupInfo);
// transaction.setEarlyWakeupStart(mEarlyWakeupInfo);
} catch (NoSuchMethodError e) {
// LC-Ignored: wtf?
}
mInEarlyWakeUp = true;
} else if (!wantsEarlyWakeUp && mInEarlyWakeUp) {
Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup with token "
+ mEarlyWakeupInfo);
// Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup with token "
// + mEarlyWakeupInfo);
try {
transaction.setEarlyWakeupEnd(mEarlyWakeupInfo);
// transaction.setEarlyWakeupEnd(mEarlyWakeupInfo);
} catch (NoSuchMethodError e) {
// LC-Ignored: wtf?
}
@@ -212,9 +212,9 @@ public class TouchInteractionService extends Service {
bundle.getBinder(IDragAndDrop.DESCRIPTOR));
MAIN_EXECUTOR.execute(() -> executeForTouchInteractionService(tis -> {
SystemUiProxy.INSTANCE.get(tis).setProxy(proxy, pip,
bubbles, splitscreen, onehanded, shellTransitions, startingWindow,
null, splitscreen, onehanded, shellTransitions, startingWindow,
recentTasks, launcherUnlockAnimationController, backAnimation, desktopMode,
unfoldTransition, dragAndDrop);
unfoldTransition, dragAndDrop); // pE-TODO(QuickSwitch-Baklava): Set bubbles from null to bubbles for Android 15/16
tis.initInputMonitor("TISBinder#onInitialize()");
ActivityPreloadUtil.preloadOverviewForTIS(tis, true /* fromInit */);
}));
@@ -127,6 +127,7 @@ constructor(
}
fun initialize() {
if (!this::taskView.isInitialized) return // pE-TODO(QuickSwitch-Baklava): Investigate
check(!isDestroyed) { "Cannot re-initialize a destroyed toast" }
setupTranslations()
Executors.ORDERED_BG_EXECUTOR.execute {
@@ -263,6 +264,7 @@ constructor(
else task.titleDescription
fun setupLayout() {
if (!this::taskView.isInitialized) return
val snapshotWidth: Int
val snapshotHeight: Int
val splitBounds = splitBounds