Loading quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +13 −3 Original line number Original line Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ */ package com.android.quickstep; package com.android.quickstep; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; Loading Loading @@ -435,7 +437,8 @@ public class TouchInteractionService extends Service implements PluginListener<O TraceHelper.FLAG_ALLOW_BINDER_TRACKING); TraceHelper.FLAG_ALLOW_BINDER_TRACKING); mDeviceState.setOrientationTransformIfNeeded(event); mDeviceState.setOrientationTransformIfNeeded(event); if (event.getAction() == ACTION_DOWN) { final int action = event.getAction(); if (action == ACTION_DOWN) { GestureState newGestureState = new GestureState(mOverviewComponentObserver, GestureState newGestureState = new GestureState(mOverviewComponentObserver, ActiveGestureLog.INSTANCE.generateAndSetLogId()); ActiveGestureLog.INSTANCE.generateAndSetLogId()); newGestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0", newGestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0", Loading Loading @@ -468,6 +471,13 @@ public class TouchInteractionService extends Service implements PluginListener<O ActiveGestureLog.INSTANCE.addLog("onMotionEvent", event.getActionMasked()); ActiveGestureLog.INSTANCE.addLog("onMotionEvent", event.getActionMasked()); mUncheckedConsumer.onMotionEvent(event); mUncheckedConsumer.onMotionEvent(event); if (action == ACTION_UP || action == ACTION_CANCEL) { if (mConsumer != null && !mConsumer.isConsumerDetachedFromGesture()) { onConsumerInactive(mConsumer); } } TraceHelper.INSTANCE.endFlagsOverride(traceToken); TraceHelper.INSTANCE.endFlagsOverride(traceToken); } } Loading Loading @@ -661,8 +671,8 @@ public class TouchInteractionService extends Service implements PluginListener<O */ */ private void onConsumerInactive(InputConsumer caller) { private void onConsumerInactive(InputConsumer caller) { if (mConsumer == caller) { if (mConsumer == caller) { mConsumer = mResetGestureInputConsumer; mConsumer = mUncheckedConsumer = mResetGestureInputConsumer; mUncheckedConsumer = mConsumer; mGestureState = new GestureState(); } } } } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,11 @@ public abstract class DelegateInputConsumer implements InputConsumer { mState = STATE_INACTIVE; mState = STATE_INACTIVE; } } @Override public boolean isConsumerDetachedFromGesture() { return mDelegate.isConsumerDetachedFromGesture(); } @Override @Override public boolean allowInterceptByParent() { public boolean allowInterceptByParent() { return mDelegate.allowInterceptByParent() && mState != STATE_ACTIVE; return mDelegate.allowInterceptByParent() && mState != STATE_ACTIVE; Loading quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -160,6 +160,11 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC return TYPE_OTHER_ACTIVITY; return TYPE_OTHER_ACTIVITY; } } @Override public boolean isConsumerDetachedFromGesture() { return true; } private void forceCancelGesture(MotionEvent ev) { private void forceCancelGesture(MotionEvent ev) { int action = ev.getAction(); int action = ev.getAction(); ev.setAction(ACTION_CANCEL); ev.setAction(ACTION_CANCEL); Loading quickstep/src/com/android/quickstep/InputConsumer.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -59,6 +59,16 @@ public interface InputConsumer { return true; return true; } } /** * Returns true if the lifecycle of this input consumer is detached from the normal gesture * down/up flow. If so, it is the responsibility of the input consumer to call back to * {@link TouchInteractionService#onConsumerInactive(InputConsumer)} after the consumer is * finished. */ default boolean isConsumerDetachedFromGesture() { return false; } /** /** * Called by the event queue when the consumer is about to be switched to a new consumer. * Called by the event queue when the consumer is about to be switched to a new consumer. * Consumers should update the state accordingly here before the state is passed to the new * Consumers should update the state accordingly here before the state is passed to the new Loading Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +13 −3 Original line number Original line Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ */ package com.android.quickstep; package com.android.quickstep; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; Loading Loading @@ -435,7 +437,8 @@ public class TouchInteractionService extends Service implements PluginListener<O TraceHelper.FLAG_ALLOW_BINDER_TRACKING); TraceHelper.FLAG_ALLOW_BINDER_TRACKING); mDeviceState.setOrientationTransformIfNeeded(event); mDeviceState.setOrientationTransformIfNeeded(event); if (event.getAction() == ACTION_DOWN) { final int action = event.getAction(); if (action == ACTION_DOWN) { GestureState newGestureState = new GestureState(mOverviewComponentObserver, GestureState newGestureState = new GestureState(mOverviewComponentObserver, ActiveGestureLog.INSTANCE.generateAndSetLogId()); ActiveGestureLog.INSTANCE.generateAndSetLogId()); newGestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0", newGestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0", Loading Loading @@ -468,6 +471,13 @@ public class TouchInteractionService extends Service implements PluginListener<O ActiveGestureLog.INSTANCE.addLog("onMotionEvent", event.getActionMasked()); ActiveGestureLog.INSTANCE.addLog("onMotionEvent", event.getActionMasked()); mUncheckedConsumer.onMotionEvent(event); mUncheckedConsumer.onMotionEvent(event); if (action == ACTION_UP || action == ACTION_CANCEL) { if (mConsumer != null && !mConsumer.isConsumerDetachedFromGesture()) { onConsumerInactive(mConsumer); } } TraceHelper.INSTANCE.endFlagsOverride(traceToken); TraceHelper.INSTANCE.endFlagsOverride(traceToken); } } Loading Loading @@ -661,8 +671,8 @@ public class TouchInteractionService extends Service implements PluginListener<O */ */ private void onConsumerInactive(InputConsumer caller) { private void onConsumerInactive(InputConsumer caller) { if (mConsumer == caller) { if (mConsumer == caller) { mConsumer = mResetGestureInputConsumer; mConsumer = mUncheckedConsumer = mResetGestureInputConsumer; mUncheckedConsumer = mConsumer; mGestureState = new GestureState(); } } } } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,11 @@ public abstract class DelegateInputConsumer implements InputConsumer { mState = STATE_INACTIVE; mState = STATE_INACTIVE; } } @Override public boolean isConsumerDetachedFromGesture() { return mDelegate.isConsumerDetachedFromGesture(); } @Override @Override public boolean allowInterceptByParent() { public boolean allowInterceptByParent() { return mDelegate.allowInterceptByParent() && mState != STATE_ACTIVE; return mDelegate.allowInterceptByParent() && mState != STATE_ACTIVE; Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -160,6 +160,11 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC return TYPE_OTHER_ACTIVITY; return TYPE_OTHER_ACTIVITY; } } @Override public boolean isConsumerDetachedFromGesture() { return true; } private void forceCancelGesture(MotionEvent ev) { private void forceCancelGesture(MotionEvent ev) { int action = ev.getAction(); int action = ev.getAction(); ev.setAction(ACTION_CANCEL); ev.setAction(ACTION_CANCEL); Loading
quickstep/src/com/android/quickstep/InputConsumer.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -59,6 +59,16 @@ public interface InputConsumer { return true; return true; } } /** * Returns true if the lifecycle of this input consumer is detached from the normal gesture * down/up flow. If so, it is the responsibility of the input consumer to call back to * {@link TouchInteractionService#onConsumerInactive(InputConsumer)} after the consumer is * finished. */ default boolean isConsumerDetachedFromGesture() { return false; } /** /** * Called by the event queue when the consumer is about to be switched to a new consumer. * Called by the event queue when the consumer is about to be switched to a new consumer. * Consumers should update the state accordingly here before the state is passed to the new * Consumers should update the state accordingly here before the state is passed to the new Loading