summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-11-13 09:56:06 -0800
committerSunny Goyal <sunnygoyal@google.com>2017-11-13 09:56:31 -0800
commit6c2b3ef0f37286bde43212c26189905da0e7e873 (patch)
tree223449925e09bd21685857e13436fd8b36828359 /quickstep/src/com
parentf8088eecf1939ef6ada4161f7c22c89a852fe4fd (diff)
downloadandroid_packages_apps_Trebuchet-6c2b3ef0f37286bde43212c26189905da0e7e873.tar.gz
android_packages_apps_Trebuchet-6c2b3ef0f37286bde43212c26189905da0e7e873.tar.bz2
android_packages_apps_Trebuchet-6c2b3ef0f37286bde43212c26189905da0e7e873.zip
Adding volatile to various variables used on multple threads.
Change-Id: I143de4981461e6f07688a7ffda906fabbcc97948
Diffstat (limited to 'quickstep/src/com')
-rw-r--r--quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
index caeef5077..e94d76fd1 100644
--- a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
+++ b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
@@ -90,9 +90,9 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler implemen
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 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler implemen
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 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler implemen
@BinderThread
public void endTouch(float endVelocity) {
- mTouchEnded = true;
mEndVelocity = endVelocity;
+ mTouchEnded = true;
}
@UiThread