Check sysui state before swiping up
Bug: 129785904
Test: Try to swipe up with various sysui states enabled
Change-Id: I654e0efd1f29ee6b4123e7f8aa717f62a55fdb50
(cherry picked from commit f0625fd93a
)
This commit is contained in:
parent
54e7ba1b95
commit
a876fe7846
|
@ -20,6 +20,9 @@ import static android.view.MotionEvent.ACTION_DOWN;
|
|||
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INPUT_MONITOR;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
|
@ -65,6 +68,8 @@ import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
|
|||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
@ -160,7 +165,7 @@ public class TouchInteractionService extends Service implements
|
|||
}
|
||||
|
||||
public void onSystemUiStateChanged(int stateFlags) {
|
||||
// To be implemented
|
||||
mSystemUiStateFlags = stateFlags;
|
||||
}
|
||||
|
||||
/** Deprecated methods **/
|
||||
|
@ -200,6 +205,7 @@ public class TouchInteractionService extends Service implements
|
|||
private SwipeSharedState mSwipeSharedState;
|
||||
private boolean mAssistantAvailable;
|
||||
private float mPendingAssistantVisibility = 0;
|
||||
private @SystemUiStateFlags int mSystemUiStateFlags;
|
||||
|
||||
private boolean mIsUserUnlocked;
|
||||
private List<Runnable> mOnUserUnlockedCallbacks;
|
||||
|
@ -414,7 +420,8 @@ public class TouchInteractionService extends Service implements
|
|||
MotionEvent event = (MotionEvent) ev;
|
||||
TOUCH_INTERACTION_LOG.addLog("onMotionEvent", event.getActionMasked());
|
||||
if (event.getAction() == ACTION_DOWN) {
|
||||
if (mSwipeTouchRegion.contains(event.getX(), event.getY())) {
|
||||
if (isInValidSystemUiState()
|
||||
&& mSwipeTouchRegion.contains(event.getX(), event.getY())) {
|
||||
boolean useSharedState = mConsumer.isActive();
|
||||
mConsumer.onConsumerAboutToBeSwitched();
|
||||
mConsumer = newConsumer(useSharedState, event);
|
||||
|
@ -427,6 +434,12 @@ public class TouchInteractionService extends Service implements
|
|||
mUncheckedConsumer.onMotionEvent(event);
|
||||
}
|
||||
|
||||
private boolean isInValidSystemUiState() {
|
||||
return (mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) == 0
|
||||
&& (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
|
||||
&& (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0;
|
||||
}
|
||||
|
||||
private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) {
|
||||
// TODO: this makes a binder call every touch down. we should move to a listener pattern.
|
||||
if (!mIsUserUnlocked || mKM.isDeviceLocked()) {
|
||||
|
|
Loading…
Reference in New Issue