Properly run window animations at vsync-sf (1/2)

- Add new Choreographer instance that runs on vsync-sf
- Use this new Choreographer for WindowAnimator, and remove all
the hacks around it

Test: Open apps and close apps, notice no stutter
Test: Screen zoom animations
Test: go/wm-smoke
Bug: 36631902
Change-Id: I988ae25645effc3ac20efa7cb9b68f23444da0d0
diff --git a/libs/androidfw/DisplayEventDispatcher.cpp b/libs/androidfw/DisplayEventDispatcher.cpp
index b8ef9ea4..7708e43 100644
--- a/libs/androidfw/DisplayEventDispatcher.cpp
+++ b/libs/androidfw/DisplayEventDispatcher.cpp
@@ -33,8 +33,9 @@
 // using just a few large reads.
 static const size_t EVENT_BUFFER_SIZE = 100;
 
-DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper) :
-        mLooper(looper), mWaitingForVsync(false) {
+DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper,
+        ISurfaceComposer::VsyncSource vsyncSource) :
+        mLooper(looper), mReceiver(vsyncSource), mWaitingForVsync(false) {
     ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this);
 }
 
diff --git a/libs/androidfw/include/androidfw/DisplayEventDispatcher.h b/libs/androidfw/include/androidfw/DisplayEventDispatcher.h
index 3ade215..e1dfb94 100644
--- a/libs/androidfw/include/androidfw/DisplayEventDispatcher.h
+++ b/libs/androidfw/include/androidfw/DisplayEventDispatcher.h
@@ -22,7 +22,8 @@
 
 class DisplayEventDispatcher : public LooperCallback {
 public:
-    DisplayEventDispatcher(const sp<Looper>& looper);
+    DisplayEventDispatcher(const sp<Looper>& looper,
+            ISurfaceComposer::VsyncSource vsyncSource = ISurfaceComposer::eVsyncSourceApp);
 
     status_t initialize();
     void dispose();