Revert "[hwc2] Add surfaceInterface/goldfishHwc2"

bug: 36439031
bug: 37101765

This reverts commit 596e8dec5700d2976d3b40ae498dbbf479c4abb6.

Change-Id: I6547c5e45c2f62209f70e75c6cf5e15c34d4ebc7
diff --git a/Android.mk b/Android.mk
index 9061c9b..566e737 100644
--- a/Android.mk
+++ b/Android.mk
@@ -73,7 +73,6 @@
 include $(EMUGL_PATH)/system/GLESv2/Android.mk
 
 include $(EMUGL_PATH)/system/gralloc/Android.mk
-include $(EMUGL_PATH)/system/surfaceInterface/Android.mk
 include $(EMUGL_PATH)/system/egl/Android.mk
 
 endif # BUILD_EMULATOR_OPENGL == true
diff --git a/system/OpenglSystemCommon/Android.mk b/system/OpenglSystemCommon/Android.mk
index b585971..9853f29 100644
--- a/system/OpenglSystemCommon/Android.mk
+++ b/system/OpenglSystemCommon/Android.mk
@@ -5,7 +5,6 @@
 
 LOCAL_SRC_FILES := \
     goldfish_dma.cpp \
-    goldfishHwc2.cpp \
     FormatConversions.cpp \
     HostConnection.cpp \
     ProcessPipe.cpp    \
diff --git a/system/OpenglSystemCommon/goldfishHwc2.cpp b/system/OpenglSystemCommon/goldfishHwc2.cpp
deleted file mode 100644
index 888ba89..0000000
--- a/system/OpenglSystemCommon/goldfishHwc2.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-* Copyright (C) 2017 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#include "goldfishHwc2.h"
-
-// Stub functions if not using HWC2.
-#ifndef USE_HWC2
-extern "C" void surfaceInterface_init() { }
-extern "C" void surfaceInterface_setAsyncModeForWindow(void* window) { }
-#endif
diff --git a/system/OpenglSystemCommon/goldfishHwc2.h b/system/OpenglSystemCommon/goldfishHwc2.h
deleted file mode 100644
index cb1a396..0000000
--- a/system/OpenglSystemCommon/goldfishHwc2.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-* Copyright (C) 2017 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#pragma once
-
-// Set of functions that help support HWC2 in the emulator.
-
-#ifdef USE_HWC2
-#include "../surfaceInterface/surfaceInterface.h"
-#else
-extern "C" void surfaceInterface_init();
-extern "C" void surfaceInterface_setAsyncModeForWindow(void* window);
-#endif
diff --git a/system/egl/Android.mk b/system/egl/Android.mk
index 37aadd7..f7dcc70 100644
--- a/system/egl/Android.mk
+++ b/system/egl/Android.mk
@@ -13,12 +13,8 @@
     egl.cpp \
     ClientAPIExts.cpp
 
-ifeq ($(TARGET_USES_HWC2), true)
-    LOCAL_CFLAGS += -DUSE_HWC2
-    LOCAL_STATIC_LIBRARIES += libsurfaceInterface
-endif
-
 LOCAL_SHARED_LIBRARIES += libdl
+
 # Used to access the Bionic private OpenGL TLS slot
 LOCAL_C_INCLUDES += bionic/libc/private
 
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp
index b22e116..60a9c83 100644
--- a/system/egl/egl.cpp
+++ b/system/egl/egl.cpp
@@ -29,7 +29,6 @@
 #include "eglContext.h"
 #include "ClientAPIExts.h"
 #include "EGLImage.h"
-#include "goldfishHwc2.h"
 #include "ProcessPipe.h"
 
 #include "GLEncoder.h"
@@ -380,8 +379,6 @@
     rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface,
             ((cb_handle_t*)(buffer->handle))->hostHandle);
 
-    surfaceInterface_setAsyncModeForWindow((void*)nativeWindow);
-
     return EGL_TRUE;
 }
 
diff --git a/system/egl/eglDisplay.cpp b/system/egl/eglDisplay.cpp
index 890eb50..5e94cfa 100644
--- a/system/egl/eglDisplay.cpp
+++ b/system/egl/eglDisplay.cpp
@@ -15,8 +15,6 @@
 */
 #include "eglDisplay.h"
 #include "HostConnection.h"
-#include "goldfishHwc2.h"
-
 #include <dlfcn.h>
 
 #include <string>
@@ -72,7 +70,6 @@
     pthread_mutex_init(&m_lock, NULL);
     pthread_mutex_init(&m_ctxLock, NULL);
     pthread_mutex_init(&m_surfaceLock, NULL);
-    surfaceInterface_init();
 }
 
 eglDisplay::~eglDisplay()
diff --git a/system/surfaceInterface/Android.mk b/system/surfaceInterface/Android.mk
deleted file mode 100644
index db62d41..0000000
--- a/system/surfaceInterface/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
-
-ifeq ($(TARGET_USES_HWC2), true)
-
-LOCAL_PATH := $(call my-dir)
-
-$(call emugl-begin-static-library,libsurfaceInterface)
-$(call emugl-import,libOpenglSystemCommon)
-
-LOCAL_SRC_FILES := surfaceInterface.cpp
-LOCAL_SHARED_LIBRARIES := libgui
-
-$(call emugl-end-module)
-
-endif
-
-endif # BUILD_EMULATOR_OPENGL_DRIVER != false
diff --git a/system/surfaceInterface/surfaceInterface.cpp b/system/surfaceInterface/surfaceInterface.cpp
deleted file mode 100644
index 68f9110..0000000
--- a/system/surfaceInterface/surfaceInterface.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "surfaceInterface.h"
-
-#include <cutils/log.h>
-#include <gui/Surface.h>
-
-class SurfaceInterface : public android::ANativeObjectBase<
-                                    ANativeWindow,
-                                    android::Surface,
-                                    android::RefBase> {
-public:
-    static SurfaceInterface* get();
-    void setAsyncMode(ANativeWindow* anw, bool async) {
-        ALOGD("SurfaceInterface::%s: set async mode %d", __func__, async);
-        window = anw;
-        android::Surface* s = android::Surface::getSelf(window);
-        s->setAsyncMode(async);
-        window = NULL;
-    }
-    ANativeWindow* window;
-};
-
-static SurfaceInterface* sSurfaceInterface = NULL;
-
-SurfaceInterface* SurfaceInterface::get() {
-    if (!sSurfaceInterface)
-        sSurfaceInterface = new SurfaceInterface;
-    return sSurfaceInterface;
-}
-
-extern "C" void surfaceInterface_init() {
-    SurfaceInterface::get();
-}
-
-extern "C" void surfaceInterface_setAsyncModeForWindow(void* window) {
-    SurfaceInterface::get()->setAsyncMode((ANativeWindow*)window, true);
-}
diff --git a/system/surfaceInterface/surfaceInterface.h b/system/surfaceInterface/surfaceInterface.h
deleted file mode 100644
index 6890847..0000000
--- a/system/surfaceInterface/surfaceInterface.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-* Copyright (C) 2017 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#pragma once
-
-#if PLATFORM_SDK_VERSION >= 16
-#include <system/window.h>
-#else // PLATFORM_SDK_VERSION >= 16
-#include <private/ui/android_natives_priv.h>
-#endif // PLATFORM_SDK_VERSION >= 16
-
-extern "C" void surfaceInterface_init();
-extern "C" void surfaceInterface_setAsyncModeForWindow(void* window);