Merge "Removing unnecessary AM.getTasks() call on every touch" into tm-dev am: dde28b487e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16992834 Change-Id: I01c0a696071aeaeb118d96f09c0b5db31b4c809a
This commit is contained in:
@@ -550,15 +550,13 @@ public class RecentsAnimationDeviceState implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ev An ACTION_DOWN motion event
|
* @param ev An ACTION_DOWN motion event
|
||||||
* @param task Info for the currently running task
|
|
||||||
* @return whether the given motion event can trigger the assistant over the current task.
|
* @return whether the given motion event can trigger the assistant over the current task.
|
||||||
*/
|
*/
|
||||||
public boolean canTriggerAssistantAction(MotionEvent ev, ActivityManager.RunningTaskInfo task) {
|
public boolean canTriggerAssistantAction(MotionEvent ev) {
|
||||||
return mAssistantAvailable
|
return mAssistantAvailable
|
||||||
&& !QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)
|
&& !QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)
|
||||||
&& mRotationTouchHelper.touchInAssistantRegion(ev)
|
&& mRotationTouchHelper.touchInAssistantRegion(ev)
|
||||||
&& !isLockToAppActive()
|
&& !isLockToAppActive();
|
||||||
&& !isGestureBlockedActivity(task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N
|
|||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.RemoteAction;
|
import android.app.RemoteAction;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
@@ -575,26 +574,14 @@ public class TouchInteractionService extends Service
|
|||||||
|
|
||||||
ActiveGestureLog.INSTANCE.addLog("setInputConsumer: " + mConsumer.getName());
|
ActiveGestureLog.INSTANCE.addLog("setInputConsumer: " + mConsumer.getName());
|
||||||
mUncheckedConsumer = mConsumer;
|
mUncheckedConsumer = mConsumer;
|
||||||
} else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode()) {
|
} else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode()
|
||||||
|
&& mDeviceState.canTriggerAssistantAction(event)) {
|
||||||
mGestureState = createGestureState(mGestureState);
|
mGestureState = createGestureState(mGestureState);
|
||||||
ActivityManager.RunningTaskInfo runningTask = mGestureState.getRunningTask();
|
// Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we
|
||||||
if (mDeviceState.canTriggerAssistantAction(event, runningTask)) {
|
// should not interrupt it. QuickSwitch assumes that interruption can only
|
||||||
// Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we
|
// happen if the next gesture is also quick switch.
|
||||||
// should not interrupt it. QuickSwitch assumes that interruption can only
|
mUncheckedConsumer = tryCreateAssistantInputConsumer(
|
||||||
// happen if the next gesture is also quick switch.
|
InputConsumer.NO_OP, mGestureState, event);
|
||||||
mUncheckedConsumer = new AssistantInputConsumer(
|
|
||||||
this,
|
|
||||||
mGestureState,
|
|
||||||
InputConsumer.NO_OP, mInputMonitorCompat,
|
|
||||||
mDeviceState,
|
|
||||||
event);
|
|
||||||
} else if (mDeviceState.canTriggerOneHandedAction(event)) {
|
|
||||||
// Consume gesture event for triggering one handed feature.
|
|
||||||
mUncheckedConsumer = new OneHandedModeInputConsumer(this, mDeviceState,
|
|
||||||
InputConsumer.NO_OP, mInputMonitorCompat);
|
|
||||||
} else {
|
|
||||||
mUncheckedConsumer = InputConsumer.NO_OP;
|
|
||||||
}
|
|
||||||
} else if (mDeviceState.canTriggerOneHandedAction(event)) {
|
} else if (mDeviceState.canTriggerOneHandedAction(event)) {
|
||||||
// Consume gesture event for triggering one handed feature.
|
// Consume gesture event for triggering one handed feature.
|
||||||
mUncheckedConsumer = new OneHandedModeInputConsumer(this, mDeviceState,
|
mUncheckedConsumer = new OneHandedModeInputConsumer(this, mDeviceState,
|
||||||
@@ -641,6 +628,14 @@ public class TouchInteractionService extends Service
|
|||||||
ProtoTracer.INSTANCE.get(this).scheduleFrameUpdate();
|
ProtoTracer.INSTANCE.get(this).scheduleFrameUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InputConsumer tryCreateAssistantInputConsumer(InputConsumer base,
|
||||||
|
GestureState gestureState, MotionEvent motionEvent) {
|
||||||
|
return mDeviceState.isGestureBlockedActivity(gestureState.getRunningTask())
|
||||||
|
? base
|
||||||
|
: new AssistantInputConsumer(this, gestureState, base, mInputMonitorCompat,
|
||||||
|
mDeviceState, motionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
public GestureState createGestureState(GestureState previousGestureState) {
|
public GestureState createGestureState(GestureState previousGestureState) {
|
||||||
GestureState gestureState = new GestureState(mOverviewComponentObserver,
|
GestureState gestureState = new GestureState(mOverviewComponentObserver,
|
||||||
ActiveGestureLog.INSTANCE.generateAndSetLogId());
|
ActiveGestureLog.INSTANCE.generateAndSetLogId());
|
||||||
@@ -686,9 +681,8 @@ public class TouchInteractionService extends Service
|
|||||||
handleOrientationSetup(base);
|
handleOrientationSetup(base);
|
||||||
}
|
}
|
||||||
if (mDeviceState.isFullyGesturalNavMode()) {
|
if (mDeviceState.isFullyGesturalNavMode()) {
|
||||||
if (mDeviceState.canTriggerAssistantAction(event, newGestureState.getRunningTask())) {
|
if (mDeviceState.canTriggerAssistantAction(event)) {
|
||||||
base = new AssistantInputConsumer(this, newGestureState, base, mInputMonitorCompat,
|
base = tryCreateAssistantInputConsumer(base, newGestureState, event);
|
||||||
mDeviceState, event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If Taskbar is present, we listen for long press to unstash it.
|
// If Taskbar is present, we listen for long press to unstash it.
|
||||||
|
|||||||
Reference in New Issue
Block a user