From 4409e5968269d297b0717049e85617f2a437a82b Mon Sep 17 00:00:00 2001
From: Brad Davis <bdavis@saintandreas.org>
Date: Fri, 15 Feb 2019 14:11:26 -0800
Subject: [PATCH] Add per-android-app preprocessor macros

---
 CMakeLists.txt                |  9 ++++++++-
 interface/src/Application.cpp | 16 ++++++++--------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8710eed05..faf88c5126 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,6 +100,13 @@ if (ANDROID)
     add_definitions(-DCUSTOM_DISPLAY_PLUGINS) 
     set(PLATFORM_PLUGIN_LIBRARIES oculusMobile oculusMobilePlugin)
   endif()
+
+  # Allow client code to use preprocessor macros to distinguish between quest and non-quest builds
+  if (${HIFI_ANDROID_APP} STREQUAL "questInterface")
+    add_definitions(-DANDROID_APP_QUEST_INTERFACE) 
+  elseif(${HIFI_ANDROID_APP} STREQUAL "interface")
+    add_definitions(-DANDROID_APP_INTERFACE) 
+  endif()
 else ()
   set(PLATFORM_QT_COMPONENTS WebEngine Xml)
 endif ()
@@ -128,7 +135,7 @@ set(PLATFORM_QT_GL OpenGL)
 
 if (USE_GLES)
   add_definitions(-DUSE_GLES)
-  add_definitions(-DGPU_POINTER_STORAGE_SHARED)
+  add_definitions(-DGPU_POINTER_STORAGE_sRED)
   set(PLATFORM_GL_BACKEND gpu-gl-common gpu-gles)
 else()
   add_definitions(-DGPU_POINTER_STORAGE_RAW)
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index 82a8347c32..c784be2539 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -3106,12 +3106,12 @@ void Application::initializeUi() {
         }
         if (TouchscreenVirtualPadDevice::NAME == inputPlugin->getName()) {
             _touchscreenVirtualPadDevice = std::dynamic_pointer_cast<TouchscreenVirtualPadDevice>(inputPlugin);
-#if defined(Q_OS_ANDROID)
- //          auto& virtualPadManager = VirtualPad::Manager::instance();
- //          connect(&virtualPadManager, &VirtualPad::Manager::hapticFeedbackRequested,
- //                  this, [](int duration) {
- //                      AndroidHelper::instance().performHapticFeedback(duration);
- //                  });
+#if defined(ANDROID_APP_INTERFACE)
+            auto& virtualPadManager = VirtualPad::Manager::instance();
+            connect(&virtualPadManager, &VirtualPad::Manager::hapticFeedbackRequested,
+                    this, [](int duration) {
+                        AndroidHelper::instance().performHapticFeedback(duration);
+                    });
 #endif
         }
     }
@@ -3638,7 +3638,7 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
     }
 
     // Get controller availability
-#ifdef Q_OS_ANDROID
+#ifdef ANDROID_APP_QUEST_INTERFACE
     bool hasHandControllers = true;
 #else
     bool hasHandControllers = false;
@@ -8260,7 +8260,7 @@ void Application::loadDomainConnectionDialog() {
 }
 
 void Application::toggleLogDialog() {
-#ifndef Q_OS_ANDROID
+#ifndef ANDROID_APP_QUEST_INTERFACE
     if (getLoginDialogPoppedUp()) {
         return;
     }