summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformservices.cpp
Commit message (Collapse)AuthorAgeFilesLines
* JNI: pre-declare JNI classes for standard Java typesVolker Hilsheimer3 days1-5/+2
| | | | | | | | | | | | | | | | | | This avoids that we or users have to declare e.g. String or Uri in several places in Qt. This also prevents problems where multiple declarations (possibly from different headers) cause build errors. As a drive-by, remove some unnecessary type declarations (e.g. UriType, which had the same class string as Uri). To ease the submodule update process, define a preprocessor symbol that submodules can use to conditionally declare the type locally. Once the dependency update is through, the symbol can be removed and submodules can use the declaration from qjnitypes.h. Pick-to: 6.8 Change-Id: I7d96edf644a54246302b5c5cb478e66fa615e73e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: PlatformServices:Do not expect Intents in non-Activity usecasePetri Virkkunen2024-04-301-9/+12
| | | | | | | | | | | | | | | | In non-Activity contexts, do not register the QPlatformServices class as an intent listener, as only Qt applications based on Qt Activities will receive new Intents. Calling getIntent on a non-Activity context will also cause an error, as getIntent is a method of Activity, not Context. Skip both when constructing QPlatformServices for applications without an Activity context. Task-number: QTBUG-118874 Change-Id: Ide64bd6a90d8db0a7654968ff42cdaa5da1d3b51 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* JNI: move signature/className template functions into a template classVolker Hilsheimer2023-09-221-2/+2
| | | | | | | | | | | | | | | | | Template functions don't permit partial specialization, e.g. we cannot specialize typeSignature() to return an array signature for any std::vector or QList type. We need to do that for better array support, so move those functions as static members into a template class, which then can be specialized. Since submodules are both calling and specializing typeSignature and className as template functions, keep and use those until the porting is complete. Change-Id: I74ec957fc41f78046cd9d0f803d8cc9d1e56672b Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Zoltan Gera <zoltan.gera@qt.io> Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* JNI: replace TYPE declarations with CLASS declarationsVolker Hilsheimer2023-09-201-2/+2
| | | | | | | | | | | | | That we have two macros to declare a C++ type to represent a Java class is confusing. The TYPE macro as of now allows us to declare array types, but with QJniArray we won't need that anymore, and can just use Class[] as the type instead. Changing that will be a follow-up commit; for now, get rid of TYPE-usages to declare regular classes. Change-Id: Iea0a9548772ca701148442412cf6ad567583213f Reviewed-by: Zoltan Gera <zoltan.gera@qt.io> Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: use FileProvider with QDesktopServices::openUrl()Assam Boudjelthia2023-02-241-6/+34
| | | | | | | | | | | | | | | | | Allow openUrl() to use FileProvider for opening files that are located under app scoped paths and that use a file scheme for Android sdk 24 or above. [ChangeLog][Core][Android] Add FileProvider support for QDesktopServices::openUrl(). [ChangeLog][Core][Android] Add AndroidX dependency to Gradle builds by default since it's required by FileProvider. Fixes: QTBUG-85238 Change-Id: Ia7403f74f2a8fd4886f74dba72e42b318ef5d079 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: properly retrieve mime type of uri to for openUrl()Assam Boudjelthia2022-10-191-5/+6
| | | | | | | | | | | | | | | Retrieve the mime type of the url regardless of whether QFile::exists() returns true or false, because it is nonetheless required when calling openUrl(). Pick-to: 6.2 6.3 6.4 5.15 Fixes: QTBUG-47979 Change-Id: Ia095b76d5d39addb0b115eb97ac6bbae0c18a21f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Samuel Mira <samuel.mira@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-141-1/+3
| | | | | | Task-number: QTBUG-98434 Change-Id: I5ee5fe079c9a4530f636e59f6171abfa523591f4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Enable QDesktopServiceLars Schmertmann2021-09-101-1/+36
| | | | | | | | | | | | QDesktopServices::openUrl(const QUrl &url) is already implemented on Android. But even if it is possible to set an URL handler, the mechanism to invoke it is missing. With this commit the URL handler will work on Android like it is already working on iOS. Task-number: QTBUG-84382 Pick-to: 6.2 Change-Id: Ic560bd380f1cc59586861aa1a6a3ea064276a39e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add QAndroidApplication as a nativeInterfaceAssam Boudjelthia2021-02-201-2/+4
| | | | | | | | | | QAndroidApplication provides the Android specific app context() and isActivityContext() to determine whether the context is an Activity or otherwise a Service. Task-number: QTBUG-90499 Change-Id: Iae2eef7ec44859a89825b09f52f09506b20b5420 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make QJniObject and QJniEnvironment public APIAssam Boudjelthia2021-01-271-6/+7
| | | | | | | | | | | | | | | | | | | | As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: handle check permissions before any file operationsAssam Boudjelthia2020-02-171-7/+8
| | | | | | | | | This is required because opening a Uri with no permissions can cause crashes. Some exceptions were not handled at all. Change-Id: I2e8f9505879b9fc4c1c47bdfa1bf173b39ada3ea Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Updated license headersJani Heikkinen2016-01-151-13/+19
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Android: auto-detect MIME type for local files to make openUrl workMartin Koller2015-10-261-4/+19
| | | | | | | | | | | | | [ChangeLog][QtCore][Android] Fixed the opening of a local file using QDesktopServices::openUrl(). For a local file to be viewed with QDesktopServices::openUrl(), Android needs to be given the MIME type otherwise it does not start an Intent to view the file. Task-number: QTBUG-45585 Change-Id: Ifcfce4bff35011f205cfadbdb2b37a1780dac87d Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Android: Fix QAndroidPlatformServices::openUrl().Christian Strømme2014-08-061-5/+4
| | | | | | | | Return true only if an activity was found for the intent. Task-number: QTBUG-34716 Change-Id: I764caf1e8afa3b17b2d71f52873c17e5d834a956 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: Simplify the jni code in QAndroidPlatformServicesChristian Strømme2014-07-141-15/+6
| | | | | | | | Remove the use of QtAndroid::AttachedJNIEnv and lazily cache the openURL() methodID on first use. Change-Id: I601d13bc7d644d7cb2f78655ad40c7d9566cf3cb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: Fix namespace usageChristian Strømme2014-06-301-0/+4
| | | | | | | 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>
* Support multiple native surfaces on Android.BogDan Vatra2014-01-171-0/+79
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>