summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjnimain.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added new private API for Android and onNewIntentPeter Rustler2015-01-211-1/+7
| | | | | | | | | | | | | On Android the foreground activity can get intents with onNewIntent. Those intents can not be received in any other way. This is especially true in Android nfc. This patch adds a way to receive those intents in Qt. This patch heavily leans on the implementation of onActivityResult. Change-Id: Ic4dca301f34afe9a528149c3653e545ed3265a3c Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-211-2/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
| * Fixes for surface creation/destructionBogDan Vatra2015-01-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - After reset a surface we must call makeCurrent before we are usign swapBuffers. - No need to set the surface in QPA when surfaceCreated are called in QtSurface.java, some time the OpenGL surface is not fully initialized at this stage. Is better to wait for surfaceChanged which is always fired at least once. - DO NOT reset m_surfaceId to 1 when there is no surface. The problem is that if we have one surface and when we distory it we don't (need to) wait for its surfaceChanged/surfaceDestroyed notifications, and if we create another one quicly it will have the same id (1). Task-number: QTBUG-39712 Change-Id: I2aa31e5b59d81ef3b03624d4636a4381eea6d543 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-241-25/+4
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Android: Remove AttachedJNIEnv class.Christian Strømme2014-11-031-25/+4
| | | | | | | | | | | | | | | | | | | | | | The JNI environment should be managed by QJNIEnvironmentPrivate directly or through QJNIObjectPrivate. There is also a clear difference between calls coming from or going into Java code. Calls coming from Java already comes with the 'right' environment and in most cases no extra considerations or set-up is needed. Change-Id: I92d935ddfb70332041869185d5a92438930ff9b9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-46/+56
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Android: Add function to change the stacking order in the layout.Christian Strømme2014-09-261-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | This change enables us to reorder the stacking order used by the layout. This is necessary if we want to influence the drawing order. Lowering or raising views are done separately for native views and Qt surface views, that is, the two different view "types" are moved relative to other views of the same type and Native views are always placed on top. Change-Id: I01cbb88f8efee08877b5972cf330fd25266a2aa9 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
| * Android: Add findClass() function to the QJNIEnvironmentPrivate class.Christian Strømme2014-09-261-8/+0
| | | | | | | | | | | | | | | | | | The static QJNIEnvironmentPrivate::findClass() function exposes the cache and the class finding code in qjni. Change-Id: I42043dc993cf9cace042faf763f2a647ba79d97f Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
| * Android: Improve the foreign-window implementationChristian Strømme2014-09-261-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | Adds: - Improved geometry calculations (e.g, inside a parent) - Change visibility - proper stacking order. Native views now reserve the top of the stack to ensure that they stay visible. - React to application state changes. Change-Id: I35de0396937fff37ffcd272c9a7d8e9873a91dfb Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
| * Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-1/+7
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| | * Resize correctly on orientation change.Paul Olav Tvete2014-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that the screen geometry is updated before the available geometry, since Qt uses available geometry change as the trigger for updating the application. Task-number: QTBUG-39965 Change-Id: Icb660f2de739367cf1fa99ddfe600f37eb6174eb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
| | * Use correct size in fullscreen modePaul Olav Tvete2014-08-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android does not report the full screen size in display metrics. However, it does report the correct size for layouts, which we use to get the available geometry. Since by definition, the available geometry should always be inside the screen geometry, it is safe to use the maximum of the two sizes. Task-number: QTBUG-39977 Change-Id: I78d974f12274ca67eada43f5e1d80e70149efe3f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | | Android: use qEnvironmentVariableIntValue()Marc Mutz2014-09-121-1/+1
|/ / | | | | | | | | | | | | | | It doesn't allocate memory, so cannot throw and is a lot faster than qgetenv(). Change-Id: I6d79852613228658f9093a272edf9b434e60286c Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Android: Guard against invalid surfaceIDPaul Olav Tvete2014-09-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not try to resize or destroy invalid surfaces. This caused update problems with all GL apps after suspend, since we would forget the dummy view that we always keep around so we get proper transitions on shutdown. Also make sure that we don't mess this up even if we try to destroy a non-existing surface. This would have fixed the bug by itself, but then we would still be stuck with the annoying warning message. Task-number: QTBUG-41093 Change-Id: I83299e93eb9ac5357b98ca47014789b56c91b35a Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-121-4/+2
|\| | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
| * Android: Remove native views when their window is destroyd.Christian Strømme2014-08-061-3/+2
| | | | | | | | | | | | | | | | | | destroySurface() was not removing the native view as they are not in the m_surfaces map. Task-number: QTBUG-40159 Change-Id: Ib5457e0bd34141654fa47883f5e125d894b0bd05 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Android: Cleanup androidjnimain.cpp/.h filesBogDan Vatra2014-07-311-53/+43
| | | | | | | | | | | | | | | | | | Remove unused includes Remove unused static vars use Q_NULLPTR insead of 0 or NULL Change-Id: Id8c99c83c64425c9725e441108010f3821bd3b44 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Android: Fix expose region.BogDan Vatra2014-07-311-1/+1
| | | | | | | | | | | | | | | | It seems that the second parameter of handleExposeEvent function is about the region inside the window, not its position on the screen. Change-Id: I89f5b2b13c9b0993253542823a84547d6a994c31 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Android: Release all windows when the application is suspended.BogDan Vatra2014-07-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When an application is suspended on Android all its Gl surfaces are destroyed and can't be used to render anymore, so we should release them in order to give back to the system the memory used by them. [ChangeLog] [Android] Release all windows when the application is suspended. Task-number: QTBUG-29069 Change-Id: I038aaa2006da1f3188fccba943ec4ffb3e551cf0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* | Android: Really suspend apps that are put in the backgroundBogDan Vatra2014-07-311-2/+21
|/ | | | | | | | | | | | | | | | | | | The main event loop will be paused when an application is suspended, this is also the normal behavior of any Android application. When an application is suspended on Android all its Gl surfaces are destroyed and can't be used to render anymore. So, we need to pause the main event loop in order to pause all the timers which might trigger drawings. The event loop is resumed immediately after the application is foreground. AndroidManifest.xml contains more info about how to disable this behavior and what might happen if you do it. [ChangeLog][Android][Important Behavior Changes] The main event loop is now stopped when the app is suspended Task-number: QTBUG-36274 Change-Id: I4c0ba5df9d95f348bca67ea5c76865d6d20775e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Android: Simplify the jni code in QtAndroidClipboardChristian Strømme2014-07-141-1/+0
| | | | | | | | | Let the QJNI classes manage the jni environment and cache the jni handles. This lets us lazily cache the jni handle until we actually need them. Change-Id: Iced91e7cab19bdcab8581e94c6f2dd766fed47ed Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: [REG] Fix QScreen::physicalSize()Eskil Abrahamsen Blomfeldt2014-07-081-4/+4
| | | | | | | | | | | | | | | | | The physical size should be set based on the screen size, not the available geometry. This used to work in Qt 5.3.0 because the screenSize and size of the available geometry was identical on startup, but in Qt 5.3.1 the available geometry is 0x0 until there the metrics are actually available to avoid flickering on startup, so this caused a regression. [ChangeLog][Android] Fixed regression where QScreen::physicalSize() would return 0x0. Change-Id: I6c2ee11205427a88764e129b05ece6d3fbbf4c99 Task-number: QTBUG-39978 Reviewed-by: Christian Stromme <christian.stromme@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Android: Fix namespace usageChristian Strømme2014-06-301-0/+5
| | | | | | | This change makes it possible to set a Qt namespace for Android builds. Change-Id: I79f4ae8200223f36f97e2849aae49e45b8850d23 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: Report something sensible for screen geometryEskil Abrahamsen Blomfeldt2014-06-131-4/+8
| | | | | | | | | | | | | | | | | | | We can't get the actual screen geometry on Android, but in Qt 5.3.0 we would always return the screen geometry minus the size of the status bar. After the available geometry was initialized to 0x0 instead of this arbitrary value, some applications that depended on this as a constant value would break if they collected the information before the window surface had been initialized and they forgot to listen to QScreen::geometryChanged(). To reduce the risk of regressions, this patch makes sure we return the same thing as before for the screen geometry and that this is not linked directly to the available screen geometry. Task-number: QTBUG-39464 Change-Id: Ie63337b3b10d2eb5130e4fece6c5b144e8230164 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Make sure we run gracefully below API level 18Jan Arve Saether2014-06-101-15/+2
| | | | | | | Task-number: QTBUG-39508 Change-Id: I023ba7c50de5c95a5514658797125e22016a6543 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com> Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: Fix flashing on startup/shutdownEskil Abrahamsen Blomfeldt2014-06-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were several issues on startup of the application which were caused by the fact that we would get the wrong available screen geometry on startup, set this as the initial surface size and then expose native windows with this size. This would cause first a flicker of white on the early expose and the window contents to jump around as the window was resized to the actual available space on screen. The fix for this is to postpone the first expose until we have actually got a proper screen size from the main layout. We use width,height = 0 as an indicator that the available geometry is not yet known, and we skip posting any expose events before this is set by the layout. In addition, since we removed the surface before we shut down the application, it was by a white rectangle before the shutdown transition happens, and this white rectangle will be animated instead of application contents. To rectify this, we make sure the last surface in the stack remains in the layout until it is either replaced by a different surface or until the application has shut down. This way, the shutdown animation will work on this surface instead. [ChangeLog][Android] Fixed regression where there would be flickering on startup and shutdown of the application. Task-number: QTBUG-38960 Change-Id: Ia1579ca8c522d8beeab066f78070ad49009d0238 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Android: Fix crash caused by unintentionally modification of env data.Christian Strømme2014-05-211-9/+11
| | | | | | | | | | | | The data given to putenv(3) becomes a part of the environment, as described in SUSv2, so If the data is unintentionally modified or deleted the consequence can be fatal. In previous versions of Android, the putenv(3) implementation made a copy of the data, so this bug has gone unnoticed. Task-number: QTBUG-39042 Change-Id: I20559c848fded10eeae54c4700ba0f4669fe49fc Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: remove the duplicate registration for qt accessibilityLiang Qi2014-05-081-1/+0
| | | | | | Change-Id: I3241138e39b93657aee0564442f22ad0c40328d4 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Don't create screen surface if there are no raster windows.BogDan Vatra2014-03-271-1/+2
| | | | | | Change-Id: Idaf5df814bb087707654d7ad7046ba8799f99c0a Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Make full use of QT_ANDROID_RASTER_IMAGE_DEPTH env variable.BogDan Vatra2014-02-221-3/+4
| | | | | | | | If raster only apps set QT_ANDROID_RASTER_IMAGE_DEPTH to 16 (RGB16), we should create also RGB16 native surface. Change-Id: I82692ff34b0e604e627d1d86a437272e3700daf8 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-181-1/+0
| | | | | | | Conflicts: src/plugins/platforms/android/qandroidplatformtheme.h Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0
* Android: Add enablers for listening to activity resultsEskil Abrahamsen Blomfeldt2014-02-151-1/+11
| | | | | | | | | | | | | | | | | | | When you launch an activity through an intent, data can be provided back from the activity when it has finished using onActivityResult() in the activity which launched it. This is okay for applications, since they can easily create their own activities, but does not work for libraries that need to use intents. There is no listener API for activity results which allow external classes to eavesdrop. In order to support launching intents from third-party or add-on libraries, we provide a low-level way to hook into the activity result event. The corresponding public API will be added to QtAndroidExtras. Change-Id: I89417f485e2c0e69028dcccc7c155788346a7417 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Android: Add Foreign Window supportChristian Strømme2014-02-141-0/+29
| | | | | Change-Id: Ie41edd3f17214805673311a375191cd93d2378f6 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Android: Fix return value in createSurface()Christian Strømme2014-02-141-1/+1
| | | | | | | When the function fails it should return -1 Change-Id: I132a1521897295e6e232126ca51e30d2e32656c8 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-1/+11
| | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
* Adds the ability to not have an activity on AndroidThierry Bastian2014-02-051-31/+43
| | | | | | | | | That code allows for not having an activity on Android. In my case I've made some java code to handle an Android service. The code is mainly about not dereferencing null pointers. Change-Id: Ia7fda03cbbc55e6afeacd928445a4b72b51c679e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Support multiple native surfaces on Android.BogDan Vatra2014-01-171-0/+724
Support for multiple native surfaces is needed by applications that need to mix raster windows with GL windows. Rework the raster and opengl implementation, get rid of eglfs and fbconvenience dependencies. Create a single android platform plugin. [ChangeLog][Android] Rework the raster and opengl implementation. [ChangeLog][Android] Create a single android platform plugin. Task-number: QTBUG-34650 Change-Id: I9b1ab51554823329dda8cfbf8fef27c38f917c7b Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>