From e138b30689e49229cbeb0cba8ecd4116e3ee91d5 Mon Sep 17 00:00:00 2001
From: Andras Becsi <andras.becsi@theqtcompany.com>
Date: Mon, 13 Apr 2015 13:49:08 +0200
Subject: [PATCH] Remove eAndroid hooks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Support for the B2Qt/eAndroid platform is discontinued with
Qt 5.5 so we can remove all remnants of the android platform.

Change-Id: I93f15fcd4a345203e15010ddf1e8de3e8d28ab56
Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com>
---
 src/core/chromium_overrides.cpp            | 21 ------
 src/core/config/embedded_android.pri       | 74 ----------------------
 src/core/gl_context_qt.cpp                 |  4 +-
 src/core/gyp_run.pro                       |  3 +-
 src/core/qtwebengine.gypi                  | 14 +---
 src/core/qtwebengine_extras.gypi           |  9 ---
 src/core/render_widget_host_view_qt.h      |  6 --
 src/core/surface_factory_qt.cpp            | 12 +---
 src/core/surface_factory_qt.h              |  4 +-
 src/core/web_engine_context.cpp            |  7 --
 src/core/web_engine_context.h              |  3 -
 src/core/web_engine_library_info.cpp       | 21 ------
 tools/qmake/mkspecs/features/functions.prf |  1 -
 tools/scripts/git_submodule.py             |  2 +-
 tools/scripts/take_snapshot.py             |  3 +-
 tools/scripts/version_resolver.py          |  2 +-
 16 files changed, 13 insertions(+), 173 deletions(-)
 delete mode 100644 src/core/config/embedded_android.pri

diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index bd76025ea..5af8a6ad8 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -48,10 +48,6 @@
 #include <QScreen>
 #include <QWindow>
 
-#if defined(OS_ANDROID)
-#include "media/video/capture/fake_video_capture_device.h"
-#endif
-
 #if defined(USE_X11)
 #include "ui/gfx/x/x11_types.h"
 #endif
@@ -182,20 +178,3 @@ PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string&, int)
 } // namespace gfx
 
 #endif // defined(USE_AURA) && !defined(USE_OZONE)
-
-#if defined(OS_ANDROID)
-namespace ui {
-bool GrabViewSnapshot(gfx::NativeView /*view*/, std::vector<unsigned char>* /*png_representation*/, const gfx::Rect& /*snapshot_bounds*/)
-{
-    NOTIMPLEMENTED();
-    return false;
-}
-}
-
-namespace media {
-const std::string FakeVideoCaptureDevice::Name::GetModel() const
-{
-    return "";
-}
-}
-#endif
diff --git a/src/core/config/embedded_android.pri b/src/core/config/embedded_android.pri
deleted file mode 100644
index 4684c2aef..000000000
--- a/src/core/config/embedded_android.pri
+++ /dev/null
@@ -1,74 +0,0 @@
-
-CC = $$which($$QMAKE_CC)
-ANDROID_TOOLCHAIN = $$dirname(CC)
-TOOLCHAIN_SYSROOT = $$ANDROID_BUILD_TOP
-
-GYP_ARGS += "-D qt_os=\"embedded_android\" -D android_src=\"$${TOOLCHAIN_SYSROOT}\" -D android_toolchain=\"$${ANDROID_TOOLCHAIN}\"" \
-            "-D android_ndk_root=\"$${TOOLCHAIN_SYSROOT}\" -D android_product_out=\"$${ANDROID_PRODUCT_OUT}\""
-
-GYP_CONFIG += \
-    OS=android_no_sdk \
-    android_webview_build=0 \
-    build_ffmpegsumo=0 \
-    configuration_policy=0 \
-    disable_nacl=1 \
-    embedded=1 \
-    enable_autofill_dialog=0 \
-    enable_automation=0 \
-    enable_background=0 \
-    enable_captive_portal_detection=0 \
-    enable_extensions=0 \
-    enable_google_now=0 \
-    enable_language_detection=0 \
-    enable_managed_users=0 \
-    enable_plugin_installation=0 \
-    enable_plugins=0 \
-    enable_printing=0 \
-    enable_session_service=0 \
-    enable_spellcheck=0 \
-    enable_task_manager=0 \
-    enable_themes=0 \
-    enable_webrtc=0 \
-    gcc_version=46 \
-    gtest_target_type=none \
-    input_speech=0 \
-    java_bridge=0 \
-    media_use_ffmpeg=0 \
-    media_use_libvpx=0 \
-    native_discardable_memory=1 \
-    native_memory_pressure_signals=1 \
-    notifications=0 \
-    p2p_apis=0 \
-    posix_avoid_mmap=1 \
-    proprietary_codecs=0 \
-    remoting=0 \
-    safe_browsing=0 \
-    skia_os=android \
-    test_isolation_mode=noop \
-    use_aura=0 \
-    use_cairo=0 \
-    use_canvas_skia=0 \
-    use_cups=0 \
-    use_default_render_theme=1 \
-    use_ffmpeg=0 \
-    use_gconf=0 \
-    use_gio=0 \
-    use_glib=0 \
-    use_gnome_keyring=0 \
-    use_kerberos=0 \
-    use_libffmpeg=0 \
-    use_openmax_dl_fft=0 \
-    use_openssl=1 \
-    use_openssl_certs=1 \
-    use_ozone=0 \
-    use_pango=0 \
-    use_pulseaudio=0 \
-    use_system_expat=1 \
-    use_system_icu=0 \
-    use_system_libjpeg=0 \
-    use_system_skia=0 \
-    use_system_sqlite=0 \
-    use_system_stlport=0 \
-    use_x11=0 \
-    v8_use_snapshot=false \
-    want_separate_host_toolset=0 \
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index b21ef8539..baccddc9d 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -134,7 +134,7 @@ void* GLContextHelper::getNativeDisplay()
 
 QT_END_NAMESPACE
 
-#if defined(USE_OZONE) || defined(OS_ANDROID) || defined(OS_WIN)
+#if defined(USE_OZONE) || defined(OS_WIN)
 
 namespace gfx {
 
@@ -158,4 +158,4 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, G
 
 }  // namespace gfx
 
-#endif // defined(USE_OZONE) || defined(OS_ANDROID) || defined(OS_WIN)
+#endif // defined(USE_OZONE) || defined(OS_WIN)
diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro
index 8d4d77351..e1691faa6 100644
--- a/src/core/gyp_run.pro
+++ b/src/core/gyp_run.pro
@@ -7,9 +7,8 @@ TEMPLATE = aux
 cross_compile {
     GYP_ARGS = "-D qt_cross_compile=1"
     posix: GYP_ARGS += "-D os_posix=1"
-    android: include(config/embedded_android.pri)
     qnx: include(config/embedded_qnx.pri)
-    linux:!android: include(config/embedded_linux.pri)
+    linux: include(config/embedded_linux.pri)
 } else {
     # !cross_compile
     GYP_ARGS = "-D qt_cross_compile=0"
diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi
index 79eb6d45b..0975cf3d7 100644
--- a/src/core/qtwebengine.gypi
+++ b/src/core/qtwebengine.gypi
@@ -54,18 +54,8 @@
           '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator',
         ],
       }],
-      # embedded_android and embedded_linux need some additional options.
-      ['qt_os=="embedded_linux" or qt_os=="embedded_android"', {
-        'conditions': [
-          ['qt_os=="embedded_android"', {
-            'dependencies': [
-              '<(chromium_src_dir)/ui/ozone/ozone.gyp:ozone_base',
-              '<(chromium_src_dir)/third_party/ashmem/ashmem.gyp:ashmem',
-              '<(chromium_src_dir)/third_party/freetype/freetype.gyp:ft2',
-              '<(chromium_src_dir)/third_party/android_tools/ndk/android_tools_ndk.gyp:cpu_features',
-            ],
-          }],
-        ],
+      # embedded_linux need some additional options.
+      ['qt_os=="embedded_linux"', {
         'configurations': {
           'Debug_Base': {
             # Reduce the binary size.
diff --git a/src/core/qtwebengine_extras.gypi b/src/core/qtwebengine_extras.gypi
index c128f289a..e28d6436e 100644
--- a/src/core/qtwebengine_extras.gypi
+++ b/src/core/qtwebengine_extras.gypi
@@ -6,7 +6,6 @@
   'target_defaults': {
     # patterns used to exclude chromium files from the build when we have a drop-in replacement
     'sources/': [
-      ['exclude', 'clipboard/clipboard_android.cc$'],
       ['exclude', 'clipboard/clipboard_aura.cc$'],
       ['exclude', 'clipboard/clipboard_aurax11.cc$'],
       ['exclude', 'clipboard/clipboard_gtk.cc$'],
@@ -16,38 +15,31 @@
       ['exclude', 'dragdrop/os_exchange_data_provider_aurax11\\.(cc|h)$'],
       ['exclude', 'dragdrop/os_exchange_data_provider_win\\.(cc|h)$'],
       ['exclude', 'dragdrop/os_exchange_data_provider_mac\\.(mm|h)$'],
-      ['exclude', 'resource/resource_bundle_android.cc$'],
       ['exclude', 'resource/resource_bundle_auralinux.cc$'],
       ['exclude', 'resource/resource_bundle_gtk.cc$'],
       ['exclude', 'resource/resource_bundle_mac.mm$'],
       ['exclude', 'resource/resource_bundle_win.cc$'],
-      ['exclude', 'browser/web_contents/web_contents_view_android\\.(cc|h)$'],
       ['exclude', 'browser/web_contents/web_contents_view_aura\\.(cc|h)$'],
       ['exclude', 'browser/web_contents/web_contents_view_gtk\\.(cc|h)$'],
       ['exclude', 'browser/web_contents/web_contents_view_mac\\.(mm|h)$'],
       ['exclude', 'browser/web_contents/web_contents_view_win\\.(cc|h)$'],
       ['exclude', 'browser/renderer_host/gtk_im_context_wrapper\\.cc$'],
-      ['exclude', 'browser/renderer_host/native_web_keyboard_event_android.cc$'],
       ['exclude', 'browser/renderer_host/native_web_keyboard_event_aura.cc$'],
       ['exclude', 'browser/renderer_host/native_web_keyboard_event_mac.mm$'],
       ['exclude', 'browser/renderer_host/pepper/pepper_truetype_font_list_pango\\.cc$'],
-      ['exclude', 'browser/renderer_host/render_widget_host_view_android\\.(cc|h)$'],
       ['exclude', 'browser/renderer_host/render_widget_host_view_aura\\.(cc|h)$'],
       ['exclude', 'browser/renderer_host/render_widget_host_view_gtk\\.(cc|h)$'],
       ['exclude', 'browser/renderer_host/render_widget_host_view_mac\\.(mm|h)$'],
       ['exclude', 'browser/renderer_host/render_widget_host_view_win\\.(cc|h)$'],
       ['exclude', 'common/font_list_pango\\.cc$'],
-      ['exclude', 'browser/accessibility/browser_accessibility_android\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_cocoa\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_gtk\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_mac\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_win\\.(cc|h)$'],
-      ['exclude', 'browser/accessibility/browser_accessibility_manager_android\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_manager_gtk\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_manager_mac\\.(cc|h)$'],
       ['exclude', 'browser/accessibility/browser_accessibility_manager_win\\.(cc|h)$'],
       ['exclude', 'command_buffer/service/async_pixel_transfer_manager_egl\\.(cc|h)$'],
-      ['exclude', 'common/gpu/image_transport_surface_android\\.cc$'],
       ['exclude', 'common/gpu/image_transport_surface_linux\\.cc$'],
       ['exclude', 'common/gpu/image_transport_surface_win\\.cc$'],
       ['exclude', 'gl_surface_egl\\.cc$'],
@@ -57,7 +49,6 @@
       ['exclude', 'gl_surface_ozone\\.cc$'],
       # Avoid the ATL dependency to allow building with VS Express
       ['exclude', 'browser/accessibility/accessibility_tree_formatter\\.(cc|h)$',],
-      ['exclude', 'browser/accessibility/accessibility_tree_formatter_android\\.(cc|h)$',],
       ['exclude', 'browser/accessibility/accessibility_tree_formatter_mac\\.(mm|h)$',],
       ['exclude', 'browser/accessibility/accessibility_tree_formatter_utils_win\\.(cc|h)$',],
       ['exclude', 'browser/accessibility/accessibility_tree_formatter_win\\.(cc|h)$',],
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 19b551b71..68330a486 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -184,12 +184,6 @@ public:
     virtual void WindowFrameChanged() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
 #endif // defined(OS_MACOSX)
 
-#if defined(OS_ANDROID)
-    virtual void ShowDisambiguationPopup(const gfx::Rect&, const SkBitmap&) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
-    virtual void LockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
-    virtual void UnlockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
-#endif // defined(OS_ANDROID)
-
 #if defined(OS_WIN)
 #if defined(USE_AURA)
     virtual void SetParentNativeViewAccessible(gfx::NativeViewAccessible accessible_parent) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp
index 963f7b517..40c65d9d3 100644
--- a/src/core/surface_factory_qt.cpp
+++ b/src/core/surface_factory_qt.cpp
@@ -45,7 +45,8 @@
 
 #include <QGuiApplication>
 
-#if defined(USE_OZONE) || defined(OS_ANDROID)
+#if defined(USE_OZONE)
+
 #include <EGL/egl.h>
 
 #ifndef QT_LIBDIR_EGL
@@ -69,12 +70,6 @@ base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
 
 bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address)
 {
-#if defined(OS_ANDROID)
-    // This is done in gl_implementation_android.cc for now. We might need to switch if we
-    // start supporting the emulator platform but that would be a more intrusive change.
-    Q_UNREACHABLE();
-    return false;
-#else
     base::FilePath libEGLPath = QtWebEngineCore::toFilePath(QT_LIBDIR_EGL);
     libEGLPath = libEGLPath.Append("libEGL.so");
     base::NativeLibrary eglLibrary = LoadLibrary(libEGLPath);
@@ -99,7 +94,6 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library,
     gfx::AddGLNativeLibrary(eglLibrary);
     gfx::AddGLNativeLibrary(gles2Library);
     return true;
-#endif // defined(OS_ANDROID)
 }
 
 intptr_t SurfaceFactoryQt::GetNativeDisplay()
@@ -114,5 +108,5 @@ intptr_t SurfaceFactoryQt::GetNativeDisplay()
 
 } // namespace QtWebEngineCore
 
-#endif // defined(USE_OZONE) || defined(OS_ANDROID)
+#endif // defined(USE_OZONE)
 
diff --git a/src/core/surface_factory_qt.h b/src/core/surface_factory_qt.h
index 7d6f0435e..26cbf9a01 100644
--- a/src/core/surface_factory_qt.h
+++ b/src/core/surface_factory_qt.h
@@ -37,7 +37,7 @@
 #ifndef SURFACE_FACTORY_QT
 #define SURFACE_FACTORY_QT
 
-#if defined(USE_OZONE) || defined(OS_ANDROID)
+#if defined(USE_OZONE)
 
 #include "ui/ozone/public/surface_factory_ozone.h"
 
@@ -54,7 +54,7 @@ class SurfaceFactoryQt
 
 } // namespace QtWebEngineCore
 
-#endif // defined(USE_OZONE) || defined(OS_ANDROID)
+#endif // defined(USE_OZONE)
 
 #endif // SURFACE_FACTORY_QT
 
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index b830110a7..10d6bdd74 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -214,13 +214,6 @@ WebEngineContext::WebEngineContext()
     parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
 #endif
 
-#if defined(OS_ANDROID)
-    // On eAndroid we use this to get the native display
-    // from Qt in GLSurfaceEGL::InitializeOneOff.
-    m_surfaceFactory.reset(new SurfaceFactoryQt());
-    parsedCommandLine->AppendSwitch(switches::kDisableOverscrollEdgeEffect);
-#endif
-
     GLContextHelper::initialize();
 
     if (usingANGLE() || usingSoftwareDynamicGL() || usingQtQuick2DRenderer()) {
diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h
index a3795b0a9..f900c93d8 100644
--- a/src/core/web_engine_context.h
+++ b/src/core/web_engine_context.h
@@ -79,9 +79,6 @@ private:
     scoped_ptr<QtWebEngineCore::ContentMainDelegateQt> m_mainDelegate;
     scoped_ptr<content::ContentMainRunner> m_contentRunner;
     scoped_ptr<content::BrowserMainRunner> m_browserRunner;
-#if defined(OS_ANDROID)
-    scoped_ptr<QtWebEngineCore::SurfaceFactoryQt> m_surfaceFactory;
-#endif
     QObject* m_globalQObject;
     QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_defaultBrowserContext;
     scoped_ptr<QtWebEngineCore::DevToolsHttpHandlerDelegateQt> m_devtools;
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 835fe8bba..573e16319 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -223,20 +223,6 @@ QString localesPath()
 
 } // namespace
 
-#if defined(OS_ANDROID)
-namespace base {
-// Replace the Android base path provider that depends on jni.
-// With this we avoid patching chromium which we would need since
-// PathService registers PathProviderAndroid by default on Android.
-bool PathProviderAndroid(int key, FilePath* result)
-{
-    *result = WebEngineLibraryInfo::getPath(key);
-    return !(result->empty());
-}
-
-}
-#endif // defined(OS_ANDROID)
-
 base::FilePath WebEngineLibraryInfo::getPath(int key)
 {
     QString directory;
@@ -266,13 +252,6 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
         return toFilePath(getResourcesPath(frameworkBundle()));
 #else
         return toFilePath(location(QLibraryInfo::DataPath));
-#endif
-#if defined(OS_ANDROID)
-    case base::DIR_SOURCE_ROOT:
-    case base::DIR_ANDROID_EXTERNAL_STORAGE:
-    case base::DIR_ANDROID_APP_DATA:
-        directory = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
-        break;
 #endif
     case content::DIR_MEDIA_LIBS:
         return toFilePath(pluginsPath());
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 2b42346f1..ef0320da1 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -73,7 +73,6 @@ defineReplace(getChromiumSrcDir) {
 
 defineReplace(extractCFlag) {
     CFLAGS = $$QMAKE_CC $$QMAKE_CFLAGS
-    !isEmpty(ANDROID_TARGET_CFLAGS): CFLAGS = $$ANDROID_TARGET_CFLAGS
     OPTION = $$find(CFLAGS, $$1)
     OPTION = $$split(OPTION, =)
     return ($$member(OPTION, 1))
diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py
index e5dd9c6cb..93afbacd6 100644
--- a/tools/scripts/git_submodule.py
+++ b/tools/scripts/git_submodule.py
@@ -46,7 +46,7 @@ import subprocess
 import sys
 import version_resolver as resolver
 
-extra_os = ['android', 'mac', 'win']
+extra_os = ['mac', 'win']
 
 def subprocessCall(args):
     print args
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py
index 4e5465a1e..bd2ec4e56 100755
--- a/tools/scripts/take_snapshot.py
+++ b/tools/scripts/take_snapshot.py
@@ -75,8 +75,7 @@ def isInChromiumBlacklist(file_path):
     if ( '_jni' in file_path
         or 'jni_' in file_path
         or 'testdata/' in file_path
-        or (file_path.startswith('third_party/android_tools') and
-            not 'android/cpufeatures' in file_path)
+        or file_path.startswith('third_party/android_tools')
         or '/tests/' in file_path
         or ('/test/' in file_path and
             not '/webrtc/test/testsupport/' in file_path and
diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py
index 9a667354e..419fb72d1 100644
--- a/tools/scripts/version_resolver.py
+++ b/tools/scripts/version_resolver.py
@@ -51,7 +51,7 @@ import json
 import urllib2
 import git_submodule as GitSubmodule
 
-chromium_version = '40.0.2214.28'
+chromium_version = '40.0.2214.115'
 chromium_branch = '2214'
 ninja_version = 'v1.5.3'
 
-- 
GitLab