Adding volatile to various variables used on multple threads.
Change-Id: I143de4981461e6f07688a7ffda906fabbcc97948
diff --git a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
index caeef50..e94d76f 100644
--- a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
+++ b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
@@ -90,9 +90,9 @@
private float mCurrentShift;
// These are updated on the binder thread, and eventually picked up on doFrame
- private float mCurrentDisplacement;
- private boolean mTouchEnded = false;
- private float mEndVelocity;
+ private volatile float mCurrentDisplacement;
+ private volatile float mEndVelocity;
+ private volatile boolean mTouchEnded = false;
NavBarSwipeInteractionHandler(Bitmap taskSnapShot, RunningTaskInfo taskInfo) {
mTaskSnapshot = taskSnapShot;
@@ -127,6 +127,12 @@
mHotseat = launcher.getHotseat();
}
+ /**
+ * This is updated on the binder thread and is picked up on the UI thread during the next
+ * scheduled frame.
+ * TODO: Instead of continuously scheduling frames, post the motion events to UI thread
+ * (can ignore all continuous move events until the last move).
+ */
@BinderThread
public void updateDisplacement(float displacement) {
mCurrentDisplacement = displacement;
@@ -134,8 +140,8 @@
@BinderThread
public void endTouch(float endVelocity) {
- mTouchEnded = true;
mEndVelocity = endVelocity;
+ mTouchEnded = true;
}
@UiThread