summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-05-06 12:07:49 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-05-06 14:55:39 -0700
commit3539f32f97861e977f15324be351f17341ad93a8 (patch)
tree090f63a635ddf4758618994bfc7e1caac30d8310
parentef8ba7bb51201bb40572d51117e7d980afb8b352 (diff)
downloadpackages_apps_Trebuchet-3539f32f97861e977f15324be351f17341ad93a8.tar.gz
packages_apps_Trebuchet-3539f32f97861e977f15324be351f17341ad93a8.tar.bz2
packages_apps_Trebuchet-3539f32f97861e977f15324be351f17341ad93a8.zip
Enabling assistant and accessibility gesture while lock screen is showing
This also enables the gesture when notification shade is down, as we do not have a separate shate for that right now Bug: 131847153 Change-Id: Ia1edaad197266fe01b5de7b2a6b46ca0ec6428bb
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java75
1 files changed, 44 insertions, 31 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 61ae880ce..a343a363d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -429,8 +429,7 @@ public class TouchInteractionService extends Service implements
MotionEvent event = (MotionEvent) ev;
TOUCH_INTERACTION_LOG.addLog("onMotionEvent", event.getActionMasked());
if (event.getAction() == ACTION_DOWN) {
- if (isInValidSystemUiState()
- && mSwipeTouchRegion.contains(event.getX(), event.getY())) {
+ if (mSwipeTouchRegion.contains(event.getX(), event.getY())) {
boolean useSharedState = mConsumer.useSharedSwipeState();
mConsumer.onConsumerAboutToBeSwitched();
mConsumer = newConsumer(useSharedState, event);
@@ -443,15 +442,45 @@ public class TouchInteractionService extends Service implements
mUncheckedConsumer.onMotionEvent(event);
}
- private boolean isInValidSystemUiState() {
- return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
- && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0
- && !ActivityManagerWrapper.getInstance().isLockToAppActive();
- }
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()) {
+ boolean validSystemUIFlags = (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
+ && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0;
+ boolean topTaskLocked = ActivityManagerWrapper.getInstance().isLockToAppActive();
+ boolean isInValidSystemUiState = validSystemUIFlags && !topTaskLocked;
+
+ if (!mIsUserUnlocked) {
+ if (isInValidSystemUiState) {
+ // This handles apps launched in direct boot mode (e.g. dialer) as well as apps
+ // launched while device is locked even after exiting direct boot mode (e.g. camera).
+ return new DeviceLockedInputConsumer(this);
+ } else {
+ return InputConsumer.NO_OP;
+ }
+ }
+
+ InputConsumer base = isInValidSystemUiState
+ ? newBaseConsumer(useSharedState, event) : InputConsumer.NO_OP;
+ if (mMode == Mode.NO_BUTTON) {
+ final ActivityControlHelper activityControl =
+ mOverviewComponentObserver.getActivityControlHelper();
+ if (mAssistantAvailable && !topTaskLocked
+ && AssistantTouchConsumer.withinTouchRegion(this, event)) {
+ base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base,
+ mInputMonitorCompat);
+ }
+
+ if ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0) {
+ base = new AccessibilityInputConsumer(this, mISystemUiProxy,
+ (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0, base,
+ mInputMonitorCompat);
+ }
+ }
+ return base;
+ }
+
+ private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) {
+ if (mKM.isDeviceLocked()) {
// This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched
// while device is locked even after exiting direct boot mode (e.g. camera).
return new DeviceLockedInputConsumer(this);
@@ -465,42 +494,26 @@ public class TouchInteractionService extends Service implements
final ActivityControlHelper activityControl =
mOverviewComponentObserver.getActivityControlHelper();
- InputConsumer base;
if (runningTaskInfo == null && !mSwipeSharedState.goingToLauncher
&& !mSwipeSharedState.recentsAnimationFinishInterrupted) {
- base = InputConsumer.NO_OP;
+ return InputConsumer.NO_OP;
} else if (mSwipeSharedState.recentsAnimationFinishInterrupted) {
// If the finish animation was interrupted, then continue using the other activity input
// consumer but with the next task as the running task
RunningTaskInfo info = new ActivityManager.RunningTaskInfo();
info.id = mSwipeSharedState.nextRunningTaskId;
- base = createOtherActivityInputConsumer(event, info);
+ return createOtherActivityInputConsumer(event, info);
} else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) {
- base = OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
+ return OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get() &&
activityControl.isInLiveTileMode()) {
- base = OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
+ return OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
} else if (mGestureBlockingActivity != null && runningTaskInfo != null
&& mGestureBlockingActivity.equals(runningTaskInfo.topActivity)) {
- base = InputConsumer.NO_OP;
+ return InputConsumer.NO_OP;
} else {
- base = createOtherActivityInputConsumer(event, runningTaskInfo);
+ return createOtherActivityInputConsumer(event, runningTaskInfo);
}
-
- if (mMode == Mode.NO_BUTTON) {
- if (mAssistantAvailable && AssistantTouchConsumer.withinTouchRegion(this, event)) {
- base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base,
- mInputMonitorCompat);
- }
-
- if ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0) {
- base = new AccessibilityInputConsumer(this, mISystemUiProxy,
- (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0, base,
- mInputMonitorCompat);
- }
- }
-
- return base;
}
private OtherActivityInputConsumer createOtherActivityInputConsumer(MotionEvent event,