}
}
+ public void notifyBackAction(boolean completed, int downX, int downY, boolean isButton,
+ boolean gestureSwipeLeft) {
+ try {
+ if (mOverviewProxy != null) {
+ mOverviewProxy.onBackAction(completed, downX, downY, isButton, gestureSwipeLeft);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG_OPS, "Failed to notify back action", e);
+ }
+ }
+
/**
* Sets the navbar region which can receive touch inputs
*/
import android.view.WindowManagerGlobal;
import com.android.systemui.R;
+import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.WindowManagerWrapper;
};
private final Context mContext;
+ private final OverviewProxyService mOverviewProxyService;
private final Point mDisplaySize = new Point();
private final int mDisplayId;
private NavigationBarEdgePanel mEdgePanel;
private WindowManager.LayoutParams mEdgePanelLp;
- public EdgeBackGestureHandler(Context context) {
+ public EdgeBackGestureHandler(Context context, OverviewProxyService overviewProxyService) {
mContext = context;
mDisplayId = context.getDisplayId();
mMainExecutor = context.getMainExecutor();
mWm = context.getSystemService(WindowManager.class);
+ mOverviewProxyService = overviewProxyService;
mEdgeWidth = QuickStepContract.getEdgeSensitivityWidth(context);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
float xDiff = ev.getX() - mDownPoint.x;
boolean exceedsThreshold = mIsOnLeftEdge
? (xDiff > mSwipeThreshold) : (-xDiff > mSwipeThreshold);
- if (exceedsThreshold && Math.abs(xDiff) > Math.abs(ev.getY() - mDownPoint.y)) {
+ boolean performAction = exceedsThreshold
+ && Math.abs(xDiff) > Math.abs(ev.getY() - mDownPoint.y);
+ if (performAction) {
// Perform back
sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
sendEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
}
+ mOverviewProxyService.notifyBackAction(performAction, (int) mDownPoint.x,
+ (int) mDownPoint.y, false /* isButton */, !mIsOnLeftEdge);
}
}
}
// TODO(b/122195391): Added logs to make sure sysui is sending back button events
if (mCode == KeyEvent.KEYCODE_BACK && flags != KeyEvent.FLAG_LONG_PRESS) {
Log.i(TAG, "Back button event: " + KeyEvent.actionToString(action));
+ if (action == MotionEvent.ACTION_UP) {
+ mOverviewProxyService.notifyBackAction((flags & KeyEvent.FLAG_CANCELED) == 0,
+ -1, -1, true /* isButton */, false /* gestureSwipeLeft */);
+ }
}
final int repeatCount = (flags & KeyEvent.FLAG_LONG_PRESS) != 0 ? 1 : 0;
final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, repeatCount,