mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Removing overscroll pluging support
Bug: 201677812 Test: Presubmit Change-Id: Id8136e99746946ba840754ef8e71a4574f49938e
This commit is contained in:
@@ -122,10 +122,6 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
public static final int STATE_RECENTS_ANIMATION_ENDED =
|
||||
getFlagForIndex("STATE_RECENTS_ANIMATION_ENDED");
|
||||
|
||||
// Called when we create an overscroll window when swiping right to left on the most recent app
|
||||
public static final int STATE_OVERSCROLL_WINDOW_CREATED =
|
||||
getFlagForIndex("STATE_OVERSCROLL_WINDOW_CREATED");
|
||||
|
||||
// Called when RecentsView stops scrolling and settles on a TaskView.
|
||||
public static final int STATE_RECENTS_SCROLLING_FINISHED =
|
||||
getFlagForIndex("STATE_RECENTS_SCROLLING_FINISHED");
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.ResourceBasedOverride;
|
||||
import com.android.systemui.plugins.OverscrollPlugin;
|
||||
|
||||
/**
|
||||
* Resource overrideable factory for forcing a local overscroll plugin.
|
||||
* Override {@link R.string#overscroll_plugin_factory_class} to set a different class.
|
||||
*/
|
||||
public class OverscrollPluginFactory implements ResourceBasedOverride {
|
||||
public static final MainThreadInitializedObject<OverscrollPluginFactory> INSTANCE = forOverride(
|
||||
OverscrollPluginFactory.class,
|
||||
R.string.overscroll_plugin_factory_class);
|
||||
|
||||
/**
|
||||
* Get the plugin that is defined locally in launcher, as opposed to a dynamic side loaded one.
|
||||
*/
|
||||
public OverscrollPlugin getLocalOverscrollPlugin() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ import android.app.PendingIntent;
|
||||
import android.app.RemoteAction;
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
@@ -90,7 +89,6 @@ import com.android.quickstep.inputconsumers.AssistantInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.DeviceLockedInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OneHandedModeInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OtherActivityInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OverscrollInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OverviewInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OverviewWithoutFocusInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.ResetGestureInputConsumer;
|
||||
@@ -103,8 +101,6 @@ import com.android.quickstep.util.LauncherSplitScreenListener;
|
||||
import com.android.quickstep.util.ProtoTracer;
|
||||
import com.android.quickstep.util.ProxyScreenStatusProvider;
|
||||
import com.android.quickstep.util.SplitScreenBounds;
|
||||
import com.android.systemui.plugins.OverscrollPlugin;
|
||||
import com.android.systemui.plugins.PluginListener;
|
||||
import com.android.systemui.shared.recents.IOverviewProxy;
|
||||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
@@ -129,8 +125,8 @@ import java.util.LinkedList;
|
||||
* Service connected by system-UI for handling touch interaction.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
public class TouchInteractionService extends Service implements PluginListener<OverscrollPlugin>,
|
||||
ProtoTraceable<LauncherTraceProto.Builder> {
|
||||
public class TouchInteractionService extends Service
|
||||
implements ProtoTraceable<LauncherTraceProto.Builder> {
|
||||
|
||||
private static final String TAG = "TouchInteractionService";
|
||||
|
||||
@@ -149,8 +145,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
SystemProperties.getBoolean("persist.debug.per_window_input_rotation", false);
|
||||
|
||||
private int mBackGestureNotificationCounter = -1;
|
||||
@Nullable
|
||||
private OverscrollPlugin mOverscrollPlugin;
|
||||
|
||||
/**
|
||||
* Local IOverviewProxy implementation with some methods for local components
|
||||
@@ -423,9 +417,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
.getInt(KEY_BACK_NOTIFICATION_COUNT, MAX_BACK_NOTIFICATION_COUNT));
|
||||
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
||||
|
||||
PluginManagerWrapper.INSTANCE.get(getBaseContext()).addPluginListener(this,
|
||||
OverscrollPlugin.class, false /* allowMultiple */);
|
||||
|
||||
mOverviewComponentObserver.setOverviewChangeListener(this::onOverviewTargetChange);
|
||||
onOverviewTargetChange(mOverviewComponentObserver.isHomeAndOverviewSame());
|
||||
}
|
||||
@@ -507,7 +498,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
if (mDeviceState.isUserUnlocked()) {
|
||||
mInputConsumer.unregisterInputConsumer();
|
||||
mOverviewComponentObserver.onDestroy();
|
||||
PluginManagerWrapper.INSTANCE.get(getBaseContext()).removePluginListener(this);
|
||||
}
|
||||
disposeEventHandlers();
|
||||
mDeviceState.destroy();
|
||||
@@ -691,26 +681,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
mTaskbarManager.getCurrentActivityContext());
|
||||
}
|
||||
|
||||
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()) {
|
||||
OverscrollPlugin plugin = null;
|
||||
if (FeatureFlags.FORCE_LOCAL_OVERSCROLL_PLUGIN.get()) {
|
||||
plugin = OverscrollPluginFactory.INSTANCE.get(
|
||||
getApplicationContext()).getLocalOverscrollPlugin();
|
||||
}
|
||||
|
||||
// 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 Bubbles is expanded, use the overlay input consumer, which will close Bubbles
|
||||
// instead of going all the way home when a swipe up is detected.
|
||||
if (mDeviceState.isBubblesExpanded() || mDeviceState.isGlobalActionsShowing()) {
|
||||
@@ -1018,16 +988,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginConnected(OverscrollPlugin overscrollPlugin, Context context) {
|
||||
mOverscrollPlugin = overscrollPlugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginDisconnected(OverscrollPlugin overscrollPlugin) {
|
||||
mOverscrollPlugin = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToProto(LauncherTraceProto.Builder proto) {
|
||||
TouchInteractionServiceProto.Builder serviceProto =
|
||||
|
||||
@@ -29,7 +29,6 @@ import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
|
||||
import static com.android.launcher3.Utilities.squaredHypot;
|
||||
import static com.android.launcher3.util.TraceHelper.FLAG_CHECK_FOR_RACE_CONDITIONS;
|
||||
import static com.android.launcher3.util.VelocityUtils.PX_PER_MS;
|
||||
import static com.android.quickstep.GestureState.STATE_OVERSCROLL_WINDOW_CREATED;
|
||||
import static com.android.quickstep.util.ActiveGestureLog.INTENT_EXTRA_LOG_TRACE_ID;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
@@ -490,7 +489,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
|
||||
|
||||
@Override
|
||||
public boolean allowInterceptByParent() {
|
||||
return !mPassedPilferInputSlop || mGestureState.hasState(STATE_OVERSCROLL_WINDOW_CREATED);
|
||||
return !mPassedPilferInputSlop;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,284 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep.inputconsumers;
|
||||
|
||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_MOVE;
|
||||
import static android.view.MotionEvent.ACTION_POINTER_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_POINTER_UP;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
|
||||
import static com.android.launcher3.Utilities.squaredHypot;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PointF;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.InputConsumer;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.plugins.OverscrollPlugin;
|
||||
import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
|
||||
/**
|
||||
* Input consumer for handling events to pass to an {@code OverscrollPlugin}.
|
||||
*/
|
||||
public class OverscrollInputConsumer extends DelegateInputConsumer {
|
||||
private static final String TAG = "OverscrollInputConsumer";
|
||||
private static final boolean DEBUG_LOGS_ENABLED = false;
|
||||
private static void debugPrint(String log) {
|
||||
if (DEBUG_LOGS_ENABLED) {
|
||||
Log.v(TAG, log);
|
||||
}
|
||||
}
|
||||
|
||||
private final PointF mDownPos = new PointF();
|
||||
private final PointF mLastPos = new PointF();
|
||||
private final PointF mStartDragPos = new PointF();
|
||||
private final int mAngleThreshold;
|
||||
|
||||
private final int mFlingDistanceThresholdPx;
|
||||
private final int mFlingVelocityThresholdPx;
|
||||
private int mActivePointerId = -1;
|
||||
private boolean mPassedSlop = false;
|
||||
// True if we set ourselves as active, meaning we no longer pass events to the delegate.
|
||||
private boolean mPassedActiveThreshold = false;
|
||||
// When a gesture crosses this length, this recognizer will attempt to interpret touch events.
|
||||
private final float mSquaredSlop;
|
||||
// When a gesture crosses this length, this recognizer will become the sole active recognizer.
|
||||
private final float mSquaredActiveThreshold;
|
||||
// When a gesture crosses this length, the overscroll view should be shown.
|
||||
private final float mSquaredFinishThreshold;
|
||||
private boolean mThisDownIsIgnored = false;
|
||||
|
||||
private final GestureState mGestureState;
|
||||
@Nullable
|
||||
private final OverscrollPlugin mPlugin;
|
||||
|
||||
@Nullable
|
||||
private RecentsView mRecentsView;
|
||||
|
||||
public OverscrollInputConsumer(Context context, GestureState gestureState,
|
||||
InputConsumer delegate, InputMonitorCompat inputMonitor, OverscrollPlugin plugin) {
|
||||
super(delegate, inputMonitor);
|
||||
|
||||
mAngleThreshold = context.getResources()
|
||||
.getInteger(R.integer.assistant_gesture_corner_deg_threshold);
|
||||
mFlingDistanceThresholdPx = (int) context.getResources()
|
||||
.getDimension(R.dimen.gestures_overscroll_fling_threshold);
|
||||
mFlingVelocityThresholdPx = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
|
||||
mGestureState = gestureState;
|
||||
mPlugin = plugin;
|
||||
|
||||
float slop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||
|
||||
mSquaredSlop = slop * slop;
|
||||
|
||||
|
||||
float finishGestureThreshold = (int) context.getResources()
|
||||
.getDimension(R.dimen.gestures_overscroll_finish_threshold);
|
||||
mSquaredFinishThreshold = finishGestureThreshold * finishGestureThreshold;
|
||||
|
||||
float activeThreshold = (int) context.getResources()
|
||||
.getDimension(R.dimen.gestures_overscroll_active_threshold);
|
||||
mSquaredActiveThreshold = activeThreshold * activeThreshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return TYPE_OVERSCROLL | mDelegate.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMotionEvent(MotionEvent ev) {
|
||||
if (mPlugin == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
debugPrint("got event, underlying activity is " + getUnderlyingActivity());
|
||||
switch (ev.getActionMasked()) {
|
||||
case ACTION_DOWN: {
|
||||
debugPrint("ACTION_DOWN");
|
||||
mActivePointerId = ev.getPointerId(0);
|
||||
mDownPos.set(ev.getX(), ev.getY());
|
||||
mLastPos.set(mDownPos);
|
||||
if (mPlugin.blockOtherGestures()) {
|
||||
debugPrint("mPlugin.blockOtherGestures(), becoming active on ACTION_DOWN");
|
||||
// Otherwise, if an appear gesture is performed when the Activity is visible,
|
||||
// the Activity will dismiss its keyboard.
|
||||
mPassedActiveThreshold = true;
|
||||
mPassedSlop = true;
|
||||
mStartDragPos.set(mLastPos.x, mLastPos.y);
|
||||
setActive(ev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTION_POINTER_DOWN: {
|
||||
if (mState != STATE_ACTIVE) {
|
||||
mState = STATE_DELEGATE_ACTIVE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTION_POINTER_UP: {
|
||||
int ptrIdx = ev.getActionIndex();
|
||||
int ptrId = ev.getPointerId(ptrIdx);
|
||||
if (ptrId == mActivePointerId) {
|
||||
final int newPointerIdx = ptrIdx == 0 ? 1 : 0;
|
||||
mDownPos.set(
|
||||
ev.getX(newPointerIdx) - (mLastPos.x - mDownPos.x),
|
||||
ev.getY(newPointerIdx) - (mLastPos.y - mDownPos.y));
|
||||
mLastPos.set(ev.getX(newPointerIdx), ev.getY(newPointerIdx));
|
||||
mActivePointerId = ev.getPointerId(newPointerIdx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTION_MOVE: {
|
||||
if (mState == STATE_DELEGATE_ACTIVE) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!mDelegate.allowInterceptByParent()) {
|
||||
mState = STATE_DELEGATE_ACTIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Update last touch position.
|
||||
int pointerIndex = ev.findPointerIndex(mActivePointerId);
|
||||
if (pointerIndex == -1) {
|
||||
break;
|
||||
}
|
||||
mLastPos.set(ev.getX(pointerIndex), ev.getY(pointerIndex));
|
||||
|
||||
float squaredDist = squaredHypot(mLastPos.x - mDownPos.x, mLastPos.y - mDownPos.y);
|
||||
if ((!mPassedSlop) && (squaredDist > mSquaredSlop)) {
|
||||
mPassedSlop = true;
|
||||
mStartDragPos.set(mLastPos.x, mLastPos.y);
|
||||
mGestureState.setState(GestureState.STATE_OVERSCROLL_WINDOW_CREATED);
|
||||
}
|
||||
|
||||
boolean becomeActive = mPassedSlop && !mPassedActiveThreshold && isOverscrolled()
|
||||
&& (squaredDist > mSquaredActiveThreshold);
|
||||
if (becomeActive) {
|
||||
debugPrint("Past slop and past threshold, set active");
|
||||
mPassedActiveThreshold = true;
|
||||
setActive(ev);
|
||||
}
|
||||
|
||||
if (mPassedActiveThreshold) {
|
||||
debugPrint("ACTION_MOVE Relaying touch event");
|
||||
mPlugin.onTouchEvent(ev, getHorizontalDistancePx(), getVerticalDistancePx(),
|
||||
(int) Math.sqrt(mSquaredFinishThreshold), mFlingDistanceThresholdPx,
|
||||
mFlingVelocityThresholdPx, getDeviceState(), getUnderlyingActivity());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ACTION_CANCEL:
|
||||
case ACTION_UP:
|
||||
debugPrint("ACTION_UP");
|
||||
if (mPassedActiveThreshold) {
|
||||
debugPrint("ACTION_UP Relaying touch event");
|
||||
|
||||
mPlugin.onTouchEvent(ev, getHorizontalDistancePx(), getVerticalDistancePx(),
|
||||
(int) Math.sqrt(mSquaredFinishThreshold), mFlingDistanceThresholdPx,
|
||||
mFlingVelocityThresholdPx, getDeviceState(), getUnderlyingActivity());
|
||||
}
|
||||
|
||||
|
||||
mPassedSlop = false;
|
||||
mPassedActiveThreshold = false;
|
||||
mState = STATE_INACTIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mState != STATE_ACTIVE) {
|
||||
mDelegate.onMotionEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOverscrolled() {
|
||||
if (mRecentsView == null) {
|
||||
BaseDraggingActivity activity = mGestureState.getActivityInterface()
|
||||
.getCreatedActivity();
|
||||
if (activity != null) {
|
||||
mRecentsView = activity.getOverviewPanel();
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure there isn't an app to quick switch to on our right
|
||||
int maxIndex = 0;
|
||||
|
||||
boolean atRightMostApp = mRecentsView == null
|
||||
|| (mRecentsView.getRunningTaskIndex() <= maxIndex);
|
||||
|
||||
// Check if the gesture is within our angle threshold of horizontal
|
||||
float deltaY = abs(mLastPos.y - mDownPos.y);
|
||||
float deltaX = mLastPos.x - mDownPos.x;
|
||||
|
||||
boolean angleInBounds = (Math.toDegrees(Math.atan2(deltaY, abs(deltaX))) < mAngleThreshold);
|
||||
|
||||
boolean overscrollVisible = mPlugin.blockOtherGestures();
|
||||
boolean overscrollInvisibleAndLeftSwipe = !overscrollVisible && deltaX < 0;
|
||||
boolean gestureDirectionMatchesVisibility = overscrollVisible
|
||||
|| overscrollInvisibleAndLeftSwipe;
|
||||
return atRightMostApp && angleInBounds && gestureDirectionMatchesVisibility;
|
||||
}
|
||||
|
||||
private String getDeviceState() {
|
||||
String deviceState = OverscrollPlugin.DEVICE_STATE_UNKNOWN;
|
||||
int consumerType = mDelegate.getType();
|
||||
if (((consumerType & InputConsumer.TYPE_OVERVIEW) > 0)
|
||||
|| ((consumerType & InputConsumer.TYPE_OVERVIEW_WITHOUT_FOCUS)) > 0) {
|
||||
deviceState = OverscrollPlugin.DEVICE_STATE_LAUNCHER;
|
||||
} else if ((consumerType & InputConsumer.TYPE_OTHER_ACTIVITY) > 0) {
|
||||
deviceState = OverscrollPlugin.DEVICE_STATE_APP;
|
||||
} else if (((consumerType & InputConsumer.TYPE_RESET_GESTURE) > 0)
|
||||
|| ((consumerType & InputConsumer.TYPE_DEVICE_LOCKED) > 0)) {
|
||||
deviceState = OverscrollPlugin.DEVICE_STATE_LOCKED;
|
||||
}
|
||||
|
||||
return deviceState;
|
||||
}
|
||||
|
||||
private int getHorizontalDistancePx() {
|
||||
return (int) (mLastPos.x - mDownPos.x);
|
||||
}
|
||||
|
||||
private int getVerticalDistancePx() {
|
||||
return (int) (mLastPos.y - mDownPos.y);
|
||||
}
|
||||
|
||||
private @NonNull String getUnderlyingActivity() {
|
||||
// Overly defensive, got guidance on code review that something in the chain of
|
||||
// `mGestureState.getRunningTask().topActivity` can be null and thus cause a null pointer
|
||||
// exception to be thrown, but we aren't sure which part can be null.
|
||||
if ((mGestureState == null) || (mGestureState.getRunningTask() == null)
|
||||
|| (mGestureState.getRunningTask().topActivity == null)) {
|
||||
return "";
|
||||
}
|
||||
return mGestureState.getRunningTask().topActivity.flattenToString();
|
||||
}
|
||||
}
|
||||
@@ -72,12 +72,6 @@ public final class FeatureFlags {
|
||||
"PROMISE_APPS_NEW_INSTALLS", true,
|
||||
"Adds a promise icon to the home screen for new install sessions.");
|
||||
|
||||
public static final BooleanFlag QUICKSTEP_SPRINGS = getDebugFlag(
|
||||
"QUICKSTEP_SPRINGS", true, "Enable springs for quickstep animations");
|
||||
|
||||
public static final BooleanFlag UNSTABLE_SPRINGS = getDebugFlag(
|
||||
"UNSTABLE_SPRINGS", false, "Enable unstable springs for quickstep animations");
|
||||
|
||||
public static final BooleanFlag ENABLE_LOCAL_COLOR_POPUPS = getDebugFlag(
|
||||
"ENABLE_LOCAL_COLOR_POPUPS", false, "Enable local color extraction for popups.");
|
||||
|
||||
@@ -119,16 +113,6 @@ public final class FeatureFlags {
|
||||
public static final BooleanFlag ENABLE_PREDICTION_DISMISS = getDebugFlag(
|
||||
"ENABLE_PREDICTION_DISMISS", true, "Allow option to dimiss apps from predicted list");
|
||||
|
||||
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 ENABLE_QUICK_CAPTURE_WINDOW = getDebugFlag(
|
||||
"ENABLE_QUICK_CAPTURE_WINDOW", false, "Use window to host 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");
|
||||
|
||||
@@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
|
||||
import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
|
||||
@@ -217,7 +216,7 @@ public abstract class AbstractStateChangeTouchController
|
||||
mFlingBlockCheck.blockFling();
|
||||
}
|
||||
}
|
||||
if (mToState == LauncherState.ALL_APPS && !UNSTABLE_SPRINGS.get()) {
|
||||
if (mToState == LauncherState.ALL_APPS) {
|
||||
mAllAppsOvershootStarted = true;
|
||||
// 1f, value when all apps container hit the top
|
||||
mLauncher.getAppsView().onPull(progress - 1f, progress - 1f);
|
||||
@@ -333,7 +332,7 @@ public abstract class AbstractStateChangeTouchController
|
||||
anim.setFloatValues(startProgress, endProgress);
|
||||
updateSwipeCompleteAnimation(anim, duration, targetState, velocity, fling);
|
||||
mCurrentAnimation.dispatchOnStart();
|
||||
if (targetState == LauncherState.ALL_APPS && !UNSTABLE_SPRINGS.get()) {
|
||||
if (targetState == LauncherState.ALL_APPS) {
|
||||
if (mAllAppsOvershootStarted) {
|
||||
mLauncher.getAppsView().onRelease();
|
||||
mAllAppsOvershootStarted = false;
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.plugins;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.systemui.plugins.annotations.ProvidesInterface;
|
||||
|
||||
/**
|
||||
* Implement this interface to receive a callback when the user swipes right
|
||||
* to left on the gesture area. It won't fire if the user has quick switched to a previous app
|
||||
* (swiped right) and the current app isn't yet the active one (i.e., if swiping left would take
|
||||
* the user to a more recent app).
|
||||
*/
|
||||
@ProvidesInterface(action = com.android.systemui.plugins.OverscrollPlugin.ACTION,
|
||||
version = com.android.systemui.plugins.OverscrollPlugin.VERSION)
|
||||
public interface OverscrollPlugin extends Plugin {
|
||||
|
||||
String ACTION = "com.android.systemui.action.PLUGIN_LAUNCHER_OVERSCROLL";
|
||||
int VERSION = 4;
|
||||
|
||||
String DEVICE_STATE_LOCKED = "Locked";
|
||||
String DEVICE_STATE_LAUNCHER = "Launcher";
|
||||
String DEVICE_STATE_APP = "App";
|
||||
String DEVICE_STATE_UNKNOWN = "Unknown";
|
||||
|
||||
/**
|
||||
* @return true if the plugin is active and will accept overscroll gestures
|
||||
*/
|
||||
boolean isActive();
|
||||
|
||||
/**
|
||||
* Called when a touch has been recognized as an overscroll gesture.
|
||||
* @param horizontalDistancePx Horizontal distance from the last finger location to the finger
|
||||
* location when it first touched the screen.
|
||||
* @param verticalDistancePx Horizontal distance from the last finger location to the finger
|
||||
* location when it first touched the screen.
|
||||
* @param thresholdPx Minimum distance for gesture.
|
||||
* @param flingDistanceThresholdPx Minimum distance for gesture by fling.
|
||||
* @param flingVelocityThresholdPx Minimum velocity for gesture by fling.
|
||||
* @param deviceState String representing the current device state
|
||||
* @param underlyingActivity String representing the currently active Activity
|
||||
*/
|
||||
void onTouchEvent(MotionEvent event,
|
||||
int horizontalDistancePx,
|
||||
int verticalDistancePx,
|
||||
int thresholdPx,
|
||||
int flingDistanceThresholdPx,
|
||||
int flingVelocityThresholdPx,
|
||||
String deviceState,
|
||||
String underlyingActivity);
|
||||
|
||||
/**
|
||||
* @return `true` if overscroll gesture handling should override all other gestures.
|
||||
*/
|
||||
boolean blockOtherGestures();
|
||||
|
||||
/**
|
||||
* @return `true` if the overscroll gesture can pan the underlying app.
|
||||
*/
|
||||
boolean allowsUnderlyingActivityOverscroll();
|
||||
}
|
||||
Reference in New Issue
Block a user