update for android Q
diff --git a/src/AndroidDesktop.cpp b/src/AndroidDesktop.cpp
index 190ca86..90f1699 100644
--- a/src/AndroidDesktop.cpp
+++ b/src/AndroidDesktop.cpp
@@ -1,4 +1,4 @@
-#define LOG_TAG "AndroidDesktop"
+#define LOG_TAG "VNCFlinger:AndroidDesktop"
 #include <utils/Log.h>
 
 #include <fcntl.h>
@@ -57,6 +57,7 @@
     ALOGV("Shutting down");
 
     mServer->setPixelBuffer(0);
+    mPixels->reset();
 
     mVirtualDisplay.clear();
     mPixels.clear();
@@ -76,8 +77,8 @@
     }
 
     mFrameNumber = imgBuffer.frameNumber;
-    ALOGV("processFrame: [%lu] format: %x (%dx%d, stride=%d)", mFrameNumber, imgBuffer.format,
-          imgBuffer.width, imgBuffer.height, imgBuffer.stride);
+    //ALOGV("processFrame: [%lu] format: %x (%dx%d, stride=%d)", mFrameNumber, imgBuffer.format,
+    //      imgBuffer.width, imgBuffer.height, imgBuffer.stride);
 
     // we don't know if there was a stride change until we get
     // a buffer from the queue. if it changed, we need to resize
@@ -128,8 +129,8 @@
 }
 
 // cpuconsumer frame listener, called from binder thread
-void AndroidDesktop::onFrameAvailable(const BufferItem& item) {
-    ALOGV("onFrameAvailable: [%lu] mTimestamp=%ld", item.mFrameNumber, item.mTimestamp);
+void AndroidDesktop::onFrameAvailable(const BufferItem&) {
+    //ALOGV("onFrameAvailable: [%lu] mTimestamp=%ld", item.mFrameNumber, item.mTimestamp);
 
     notify();
 }
@@ -144,10 +145,11 @@
         // outside viewport
         return;
     }
-    uint32_t x = pos.x * ((float)(mDisplayRect.getWidth()) / (float)mPixels->width());
+    uint32_t spaceX = abs(((float)(mDisplayRect.getWidth() - mPixels->width())) / 2);
+    uint32_t x = pos.x - spaceX;
     uint32_t y = pos.y * ((float)(mDisplayRect.getHeight()) / (float)mPixels->height());
 
-    ALOGV("pointer xlate x1=%d y1=%d x2=%d y2=%d", pos.x, pos.y, x, y);
+    //ALOGV("pointer xlate x1=%d y1=%d x2=%d y2=%d", pos.x, pos.y, x, y);
 
     mServer->setCursorPos(rfb::Point(x, y));
     mInputDevice->pointerEvent(buttonMask, x, y);
@@ -166,6 +168,7 @@
         ALOGE("Failed to get display characteristics\n");
         return err;
     }
+    //ALOGV("updateDisplayInfo: [%d:%d]", mDisplayInfo.w, mDisplayInfo.h);
 
     mPixels->setDisplayInfo(&mDisplayInfo);
 
diff --git a/src/AndroidPixelBuffer.cpp b/src/AndroidPixelBuffer.cpp
index 7cbb9a7..8af6c39 100644
--- a/src/AndroidPixelBuffer.cpp
+++ b/src/AndroidPixelBuffer.cpp
@@ -15,7 +15,7 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#define LOG_TAG "AndroidPixelBuffer"
+#define LOG_TAG "VNCFlinger:AndroidPixelBuffer"
 #include <utils/Log.h>
 
 #include <ui/DisplayInfo.h>
@@ -117,3 +117,8 @@
 Rect AndroidPixelBuffer::getSourceRect() {
     return Rect(mSourceWidth, mSourceHeight);
 }
+
+void AndroidPixelBuffer::reset() {
+    mSourceWidth = 0;
+    mSourceHeight = 0;
+}
diff --git a/src/AndroidPixelBuffer.h b/src/AndroidPixelBuffer.h
index 5cd314c..44e7dbd 100644
--- a/src/AndroidPixelBuffer.h
+++ b/src/AndroidPixelBuffer.h
@@ -58,6 +58,8 @@
 
     Rect getSourceRect();
 
+    void reset();
+
   private:
     static bool isDisplayRotated(uint8_t orientation);
 
diff --git a/src/InputDevice.cpp b/src/InputDevice.cpp
index 04bad97..003a096 100644
--- a/src/InputDevice.cpp
+++ b/src/InputDevice.cpp
@@ -15,7 +15,7 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#define LOG_TAG "VNC-InputDevice"
+#define LOG_TAG "VNCFlinger:InputDevice"
 #include <utils/Log.h>
 
 #include <future>
@@ -239,7 +239,7 @@
     Mutex::Autolock _l(mLock);
     if (!mOpened) return;
 
-    ALOGV("pointerEvent: buttonMask=%x x=%d y=%d", buttonMask, x, y);
+    //ALOGV("pointerEvent: buttonMask=%x x=%d y=%d", buttonMask, x, y);
 
     if ((buttonMask & 1) && mLeftClicked) {  // left btn clicked and moving
         inject(EV_ABS, ABS_X, x);
diff --git a/src/VirtualDisplay.cpp b/src/VirtualDisplay.cpp
index 7692dc4..1854a55 100644
--- a/src/VirtualDisplay.cpp
+++ b/src/VirtualDisplay.cpp
@@ -15,7 +15,7 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#define LOG_TAG "VirtualDisplay"
+#define LOG_TAG "VNCFlinger:VirtualDisplay"
 #include <utils/Log.h>
 
 #include <gui/BufferQueue.h>
@@ -50,18 +50,12 @@
 
     mCpuConsumer->setFrameAvailableListener(listener);
 
-    mDpy = SurfaceComposerClient::createDisplay(String8("VNC-VirtualDisplay"), false /*secure*/);
-
-    const auto displayToken = SurfaceComposerClient::getInternalDisplayToken();
-    if (displayToken == nullptr) {
-        ALOGE("Failed to get display token\n");
-        return;
-    }
+    mDisplayToken = SurfaceComposerClient::createDisplay(String8("VNC-VirtualDisplay"), false /*secure*/);
 
     SurfaceComposerClient::Transaction t;
-    t.setDisplaySurface(displayToken, mProducer);
-    t.setDisplayProjection(displayToken, 0, mSourceRect, displayRect);
-    t.setDisplayLayerStack(displayToken, 0);  // default stack
+    t.setDisplaySurface(mDisplayToken, mProducer);
+    t.setDisplayProjection(mDisplayToken, 0, mSourceRect, displayRect);
+    t.setDisplayLayerStack(mDisplayToken, 0);  // default stack
     t.apply();
 
     ALOGV("Virtual display (%ux%u [viewport=%ux%u] created", width, height, displayRect.getWidth(),
@@ -71,7 +65,7 @@
 VirtualDisplay::~VirtualDisplay() {
     mCpuConsumer.clear();
     mProducer.clear();
-    SurfaceComposerClient::destroyDisplay(mDpy);
+    SurfaceComposerClient::destroyDisplay(mDisplayToken);
 
     ALOGV("Virtual display destroyed");
 }
diff --git a/src/VirtualDisplay.h b/src/VirtualDisplay.h
index 002d87d..02a85c7 100644
--- a/src/VirtualDisplay.h
+++ b/src/VirtualDisplay.h
@@ -59,7 +59,7 @@
     sp<CpuConsumer> mCpuConsumer;
 
     // Virtual display
-    sp<IBinder> mDpy;
+    sp<IBinder> mDisplayToken;
 
     sp<CpuConsumer::FrameAvailableListener> mListener;
 
diff --git a/src/main.cpp b/src/main.cpp
index 251edf6..6644c79 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -166,7 +166,7 @@
             uint64_t eventVal;
             int status = read(eventFd, &eventVal, sizeof(eventVal));
             if (status > 0 && eventVal > 0) {
-                ALOGV("status=%d eventval=%lu", status, eventVal);
+                //ALOGV("status=%d eventval=%lu", status, eventVal);
                 desktop->processFrames();
             }
         }