Let launcher to provide its own OverscrollPlugin
If the local OverscrollPlugin provided by the activity is non-null and FORCE_LOCAL_OVERSCROLL_PLUGIN is true, the local plugin object overrides the loaded actual plugin. Test: Manual testing flipping the flag and observing which plugin is activated. Bug: 150245271 Change-Id: I0cd5184628c2cb572b5e1c56d6a008dcaa8807fb
This commit is contained in:
@@ -31,6 +31,7 @@ import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.ResourceBasedOverride;
|
||||
import com.android.quickstep.views.TaskThumbnailView;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.plugins.OverscrollPlugin;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
|
||||
@@ -67,6 +68,13 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
public static final MainThreadInitializedObject<TaskOverlayFactory> INSTANCE =
|
||||
forOverride(TaskOverlayFactory.class, R.string.task_overlay_factory_class);
|
||||
|
||||
/**
|
||||
* @return a launcher-provided OverscrollPlugin if available, otherwise null
|
||||
*/
|
||||
public OverscrollPlugin getLocalOverscrollPlugin() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TaskOverlay createOverlay(TaskThumbnailView thumbnailView) {
|
||||
return new TaskOverlay();
|
||||
}
|
||||
|
||||
+19
-12
@@ -17,13 +17,7 @@ package com.android.quickstep;
|
||||
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
|
||||
import static com.android.launcher3.config.FeatureFlags.APPLY_CONFIG_AT_RUNTIME;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_HINTS_IN_OVERVIEW;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
|
||||
import static com.android.launcher3.config.FeatureFlags.FAKE_LANDSCAPE_UI;
|
||||
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
|
||||
import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INPUT_MONITOR;
|
||||
@@ -507,12 +501,25 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
base = new AssistantInputConsumer(this, newGestureState, base, mInputMonitorCompat);
|
||||
}
|
||||
|
||||
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()
|
||||
&& (mOverscrollPlugin != null)
|
||||
&& mOverscrollPlugin.isActive()) {
|
||||
// Put the overscroll gesture as higher priority than the Assistant or base gestures
|
||||
base = new OverscrollInputConsumer(this, newGestureState, base, mInputMonitorCompat,
|
||||
mOverscrollPlugin);
|
||||
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()) {
|
||||
OverscrollPlugin plugin = null;
|
||||
if (FeatureFlags.FORCE_LOCAL_OVERSCROLL_PLUGIN.get()) {
|
||||
TaskOverlayFactory factory =
|
||||
TaskOverlayFactory.INSTANCE.get(getApplicationContext());
|
||||
plugin = factory.getLocalOverscrollPlugin(); // may be null
|
||||
}
|
||||
|
||||
// If not local plugin was forced, use the actual overscroll plugin if available.
|
||||
if (plugin == null && mOverscrollPlugin != null && mOverscrollPlugin.isActive()) {
|
||||
plugin = mOverscrollPlugin;
|
||||
}
|
||||
|
||||
if (plugin != null) {
|
||||
// Put the overscroll gesture as higher priority than the Assistant or base
|
||||
// gestures
|
||||
base = new OverscrollInputConsumer(this, newGestureState, base,
|
||||
mInputMonitorCompat, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (mDeviceState.isScreenPinningActive()) {
|
||||
|
||||
@@ -106,6 +106,10 @@ public final class FeatureFlags {
|
||||
public static final BooleanFlag ENABLE_QUICK_CAPTURE_GESTURE = getDebugFlag(
|
||||
"ENABLE_QUICK_CAPTURE_GESTURE", true, "Swipe from right to left to quick capture");
|
||||
|
||||
public static final BooleanFlag FORCE_LOCAL_OVERSCROLL_PLUGIN = getDebugFlag(
|
||||
"FORCE_LOCAL_OVERSCROLL_PLUGIN", false,
|
||||
"Use a launcher-provided OverscrollPlugin if available");
|
||||
|
||||
public static final BooleanFlag ASSISTANT_GIVES_LAUNCHER_FOCUS = getDebugFlag(
|
||||
"ASSISTANT_GIVES_LAUNCHER_FOCUS", false,
|
||||
"Allow Launcher to handle nav bar gestures while Assistant is running over it");
|
||||
|
||||
Reference in New Issue
Block a user