summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2019-04-03 22:40:47 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-04-03 22:40:47 +0000
commit099d3ae04b857737ba3cb55a72c27b2917b65da2 (patch)
tree501c6252b79a5ab893083764cab7d608e0072f08
parenta5250b91b8f022e3db567e1f8529fc0adaab55e4 (diff)
parent04ff8bda2b6a4f31beb65476ee62d987aec33034 (diff)
Merge "Add logging callback for back action"
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java4
5 files changed, 31 insertions, 3 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl
index 00753271f2df..04701bcf7c77 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl
@@ -123,4 +123,10 @@ oneway interface IOverviewProxy {
* Sent when the assistant changes how visible it is to the user.
*/
void onAssistantVisibilityChanged(float visibility) = 14;
+
+ /*
+ * Sent when back is triggered.
+ */
+ void onBackAction(boolean completed, int downX, int downY, boolean isButton,
+ boolean gestureSwipeLeft) = 15;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 2b361f81df96..4d6693ff6613 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -444,6 +444,17 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
}
}
+ 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
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
index 95abb6651ec0..212666f24b36 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
@@ -46,6 +46,7 @@ import android.view.WindowManager;
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;
@@ -102,6 +103,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
};
private final Context mContext;
+ private final OverviewProxyService mOverviewProxyService;
private final Point mDisplaySize = new Point();
private final int mDisplayId;
@@ -137,11 +139,12 @@ public class EdgeBackGestureHandler implements DisplayListener {
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();
@@ -313,11 +316,15 @@ public class EdgeBackGestureHandler implements DisplayListener {
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);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 4fd6a71263db..7abdbd03a56b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -285,7 +285,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
mButtonDispatchers.put(R.id.menu_container, mContextualButtonGroup);
mDeadZone = new DeadZone(this);
- mEdgeBackGestureHandler = new EdgeBackGestureHandler(context);
+ mEdgeBackGestureHandler = new EdgeBackGestureHandler(context, mOverviewProxyService);
mTintController = new NavBarTintController(this, getLightTransitionsController());
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index 1e059835f086..06fc745b0832 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -308,6 +308,10 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
// 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,