fix build errors
diff --git a/Android.mk b/Android.mk
index 16aa61f..a84cf01 100644
--- a/Android.mk
+++ b/Android.mk
@@ -9,9 +9,6 @@
src/VirtualDisplay.cpp \
src/main.cpp
-#LOCAL_SRC_FILES += \
-# aidl/org/chemlab/IVNCService.aidl
-
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/src \
external/tigervnc/common \
@@ -25,16 +22,16 @@
libssl \
libui \
libutils \
- libz
+ libz \
+ liblog
LOCAL_STATIC_LIBRARIES += \
libtigervnc
LOCAL_CFLAGS := -DVNCFLINGER_VERSION="0.1"
-LOCAL_CFLAGS += -Ofast -Werror -std=c++11 -fexceptions
+LOCAL_CFLAGS += -Ofast -Werror -fexceptions -Wno-implicit-fallthrough
LOCAL_CFLAGS += -DLOG_NDEBUG=0
-#LOCAL_CXX := /usr/bin/include-what-you-use
LOCAL_INIT_RC := etc/vncflinger.rc
diff --git a/aidl/org/chemlab/IVNCService.aidl b/aidl/org/chemlab/IVNCService.aidl
deleted file mode 100644
index 5c7ac9d..0000000
--- a/aidl/org/chemlab/IVNCService.aidl
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.chemlab;
-
-interface IVNCService {
- boolean start();
- boolean stop();
-
- boolean setPort(int port);
- boolean setV4Address(String addr);
- boolean setV6Address(String addr);
-
- boolean setPassword(String password);
- boolean clearPassword();
-}
diff --git a/etc/vncflinger.rc b/etc/vncflinger.rc
index 7d70f26..f8f049b 100644
--- a/etc/vncflinger.rc
+++ b/etc/vncflinger.rc
@@ -1,4 +1,4 @@
-service vncflinger /system/bin/vncflinger
+service vncflinger /system/bin/vncflinger SecurityTypes=None
class late_start
disabled
user system
diff --git a/sepolicy/vncflinger.te b/sepolicy/vncflinger.te
index 21213e0..49be316 100644
--- a/sepolicy/vncflinger.te
+++ b/sepolicy/vncflinger.te
@@ -1,5 +1,6 @@
type vncflinger_exec, exec_type, file_type;
type vncflinger, domain;
+typeattribute vncflinger coredomain;
init_daemon_domain(vncflinger)
binder_use(vncflinger)
diff --git a/src/AndroidDesktop.cpp b/src/AndroidDesktop.cpp
index b40b1b4..190ca86 100644
--- a/src/AndroidDesktop.cpp
+++ b/src/AndroidDesktop.cpp
@@ -38,8 +38,6 @@
}
void AndroidDesktop::start(rfb::VNCServer* vs) {
- mMainDpy = SurfaceComposerClient::getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain);
-
mServer = vs;
mPixels = new AndroidPixelBuffer();
@@ -157,7 +155,13 @@
// refresh the display dimensions
status_t AndroidDesktop::updateDisplayInfo() {
- status_t err = SurfaceComposerClient::getDisplayInfo(mMainDpy, &mDisplayInfo);
+ const auto displayToken = SurfaceComposerClient::getInternalDisplayToken();
+ if (displayToken == nullptr) {
+ ALOGE("Failed to get display token\n");
+ return -1;
+ }
+
+ status_t err = SurfaceComposerClient::getDisplayInfo(displayToken, &mDisplayInfo);
if (err != NO_ERROR) {
ALOGE("Failed to get display characteristics\n");
return err;
diff --git a/src/AndroidDesktop.h b/src/AndroidDesktop.h
index f9f82de..1ceecc2 100644
--- a/src/AndroidDesktop.h
+++ b/src/AndroidDesktop.h
@@ -78,7 +78,6 @@
sp<VirtualDisplay> mVirtualDisplay;
// Primary display
- sp<IBinder> mMainDpy;
DisplayInfo mDisplayInfo;
// Virtual input device
diff --git a/src/VirtualDisplay.cpp b/src/VirtualDisplay.cpp
index 8000f8f..7692dc4 100644
--- a/src/VirtualDisplay.cpp
+++ b/src/VirtualDisplay.cpp
@@ -52,12 +52,17 @@
mDpy = SurfaceComposerClient::createDisplay(String8("VNC-VirtualDisplay"), false /*secure*/);
- SurfaceComposerClient::openGlobalTransaction();
- SurfaceComposerClient::setDisplaySurface(mDpy, mProducer);
+ const auto displayToken = SurfaceComposerClient::getInternalDisplayToken();
+ if (displayToken == nullptr) {
+ ALOGE("Failed to get display token\n");
+ return;
+ }
- SurfaceComposerClient::setDisplayProjection(mDpy, 0, mSourceRect, displayRect);
- SurfaceComposerClient::setDisplayLayerStack(mDpy, 0); // default stack
- SurfaceComposerClient::closeGlobalTransaction();
+ SurfaceComposerClient::Transaction t;
+ t.setDisplaySurface(displayToken, mProducer);
+ t.setDisplayProjection(displayToken, 0, mSourceRect, displayRect);
+ t.setDisplayLayerStack(displayToken, 0); // default stack
+ t.apply();
ALOGV("Virtual display (%ux%u [viewport=%ux%u] created", width, height, displayRect.getWidth(),
displayRect.getHeight());