summaryrefslogtreecommitdiffstats
path: root/src/android
Commit message (Collapse)AuthorAgeFilesLines
* Add option to not include native libraries in APKTinja Paavoseppä2022-05-203-38/+53
| | | | | | | | | | | | | | | | | Sometimes it is not desirable to include the libraries in the APK, e.g. system and vendor apps could prefer having one set of libraries installed on the device. If unbundled deployment is specified, native libraries will not be included in the APK. With unbundled deployment, optional arguments can be passed to set the path to load the libraries on the device. [ChangeLog][Android][Deployment Changes] Adds option for Unbundled deployment, where native libraries are not packaged in the APK. Task-number: QAA-771 Change-Id: Ica51ef83a24dad58c7586bf610a58abe21fc1100 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1620-759/+51
| | | | | | | | | | | | | 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 A11Y: handle LocationChanged event only for focused elementIvan Solovev2022-05-164-8/+9
| | | | | | | | | | | | | | | | | | LocationChanged event unconditionally triggered invalidateVirtualViewId call. That call results in TYPE_WINDOW_CONTENT_CHANGED Android event, which causes a lot of background processing. That is not correct, because LocationChanged event is generated by every accessible element, not only the one that has A11Y focus. This patch checks event->uniqueId(), and processes only events that come from the focused accessible element. Done-with: Mike Achtelik <mike.achtelik@gmail.com> Task-number: QTBUG-102594 Pick-to: 6.3 6.2 5.15 Change-Id: I6b941733c9d215fed5ee5a7aeeb5be234add9ebe Reviewed-by: Mike Achtelik <mike.achtelik@gmail.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Android: Fix ANR when QtService and QtActivity load in same processSamuel Mira2022-04-281-1/+12
| | | | | | | | | | | | | This patch is a fix to prevent the ANR. In this patch, the QtService queries QtNative if there is a QtActivity or QtService started and, in case there is, it does not begin the loading process. When that happens, the QtService will be a regular android Service. Fixes: QTBUG-99691 Pick-to: 5.15 6.2 6.3 Change-Id: Ibd8aa8554107a9744b53cca4e0dd7e6f9b25baea Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Fix restart QtActivitySamuel Mira2022-04-273-78/+135
| | | | | | | | | | | | | | | | | | Previously, a restart of QtActivity on Android would make the application fail with a blank screen. That happened because the QtActivity tried to reload the whole application and failed. With this patch, the QtActivity detects if the application is restarting by checking if QtNative and QtActivityDelegate are live and updates the connections on those objects accordingly. It allows the application to continue as before. In case that is not possible, the QtActivity will restart the application. Fixes: QTBUG-38971 Fixes: QTBUG-102298 Pick-to: 5.15 6.2 6.3 Change-Id: Id500d20b185d57b39d45d34eeaa99745a3c2b95b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: set useLegacyPackaging to true in build.gradleAssam Boudjelthia2022-04-263-4/+3
| | | | | | | | | | | | Since we set android:extractNativeLibs to "true" in AndroidManifest.xml, a warning is thrown by the gradle build, which needs the property packagingOptions.jniLibs.useLegacyPackaging to be set to true. Pick-to: 6.2 6.3 5.15 Change-Id: I725d2663d68ab88abfda630f8a61666510043967 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ramon Sadornil <ramon.sadornil@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Android: add missing properties in AndroidManifest.xmlAssam Boudjelthia2022-04-262-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | Some missing values has to be defined in AndroidManifest.xml, otherwise, warnings might be thrown. * android:exported="true": because the manifest sets an intent-filter, and it then has to explicitly to avoid the warning [1]. * android:allowBackup="true": this has to be explicitly set, we set it to the default value here [2]. * android:fullBackupOnly="false": SDK 23+ use this to deteremine to user auto backup or not, we set it to the default value here [3]. [1] https://developer.android.com/guide/topics/manifest/activity- element#exported [2] https://developer.android.com/guide/topics/manifest/application- element#allowbackup [3] https://developer.android.com/guide/topics/manifest/application- element#fullBackupOnly Pick-to: 6.2 6.3 5.15 Fixes: QTBUG-101320 Change-Id: I0872dc00e48a867154ec9ded26620383fb747918 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Android: fix fullscreen handlingIvan Solovev2022-03-291-5/+20
| | | | | | | | | | | | | | | | Commit a35a7fcb5a713956e97bc87ccbd273737c7418df introduced the usage of insets to correctly take into account the default Android status bars and other reserved regions. However in practice that does not work as expected - the bottom inset is always reported to be non-zero, even when fullscreen mode is enabled. To fix the issue, FLAG_FULLSCREEN is explicitly checked before applying the insets. Fixes: QTBUG-99624 Pick-to: 6.3 6.2 Change-Id: I8b25f0b06447cd452c42ef072493e3137e25f38b Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: use empty Intent to clear clipboard data on API < 28Ivan Solovev2022-03-181-3/+10
| | | | | | | | | | | | | | | | ClipboardManager didn't have any APIs to clear clipboard data before API level 28. As a workaround an empty Intent with MIMETYPE_UNKNOWN is created and inserted into the clipboard for lower API levels. This makes the QApplication::clipboard()->clear() method work more or less as expected. This allows to unblacklist tst_QPlainTextEdit::copyAvailable(). Task-number: QTBUG-87423 Task-number: QTBUG-89402 Pick-to: 6.3 6.2 Change-Id: I454376199cf3b8eed0fa2ecf2f85b87f40892280 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: rephrase default value statement use in manifest doc pageAssam Boudjelthia2022-03-111-23/+23
| | | | | | | | Use "The default value is \c xxx" instead of "Default \c xxx". Pick-to: 6.2 6.3 Change-Id: Id75b45499c7fc0e9d42e66fa2b8b3515c863c61c Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Document use of android:allowNativeHeapPointerTagging in the manifestAssam Boudjelthia2022-03-051-0/+7
| | | | | | | | | | | Document the tag for more clarity on why it's needed, and for what platforms. Pick-to: 6.2 6.3 Task-number: QTBUG-97009 Task-number: QTBUG-91150 Change-Id: Ie4522fb582583be07270d3cdbf83992897b51669 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Android: make sure that orientationChange is reported after resizeIvan Solovev2022-03-042-3/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android orientation changes are reported from the DisplayListener.onDisplayChanged() method, while the screen size changes are reported from QtLayout.onSizeChanged(). In practice these callbacks come in random order, so rotating the screen multiple times might result in inconsistent order of signals and events. This patch makes sure that size change events always happen before orientation changes. This is done by caching the new orientation values and reporting them only when needed. At this point we also need to use QMetaObject::invokeMethod() for orientation change, like it is done for geometry change. Otherwise the orientation update can still be processed earlier than the geometry change. Also note that at some point we might get an orientation change without a size change (for example Qt::LandscapeOrientation -> Qt::InvertedLandscapeOrientation). That is the reason for isSimilarRotation() helper function. As a drive-by: ignore size changes with inconsistent values when window size is reported to have old orientation, while the screen has already been rotated. In such cases a new size change will be triggered shortly with normal value. Task-number: QTBUG-94459 Pick-to: 6.3 6.2 5.15 Change-Id: I5c98e526d0370d380344b2297169d5e0c0ee8ea7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix issue in loading multimedia Android pluginSamuel Mira2022-03-023-36/+67
| | | | | | | | | | | | | | Qt projects on Android were failing to correctly load the plugin lib. The main reason is missing environment variables when the media integration starts. To make sure that the variables are loaded, I have change the setenv to be done in the java side instead of c++ side. Fixes: QTBUG-100299 Pick-to: 6.3 Change-Id: Iba0b6af40574be2d88824ebdcfb1626335cecf09 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: handle valueChanged eventsIvan Solovev2022-02-155-0/+60
| | | | | | | | | | | | | | | | | | | | | Before this patch Android A11Y implementation was missing ValueChanged event handling. As a result, no update was given when the element's value was changed. Handling these events allows us to announce value changes on such objects like Slider, SpinBox, etc... This is a universal method of value-change announcement, so it supports all sorts of A11Y gestures. On the Java side a new function was introduced to announce the values, because we need to use the actual element's *value*, not its accessible name or description. Task-number: QTBUG-93396 Pick-to: 6.3 6.2 5.15 Change-Id: Ic44abd5f01b9b6f5468962131466edaf6a49d498 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Android A11Y: populate child elements when constructing node infoIvan Solovev2022-02-141-0/+4
| | | | | | | | | | | | This commit partly reverts 020a6f0daec2e36866888b23c8b3a65bfb366146. It restores the code that is responsible for filling the children for individual elements. Without this code, we have only top-level element and its children in our accessibility hierarchy. Fixes: QTBUG-100545 Pick-to: 6.3 6.2 5.15 Change-Id: I0604bbf5f1bdb0b3998a25fec7ed0a1fe554da8d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Re-focus focused accessibility node after orientation changeIvan Solovev2022-02-091-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch the accessibility focus on a selected element could be drawn incorrectly after the screen orientation has changed. The reason for that is that wrong X and Y offsets were used for it. The offsets are used to take the sizes of different panels (like buttons and notifications bar) into account. Normally they are updated only when getNodeForView() is called and the whole accessibility info is reconstructed. However, when the screen orientation changes, we get some getNodeForVirtualViewId(selectedId) calls before the whole accessibility tree is recreated. This is when redrawing happens, and as I understand, this is an internal Android event, so we can't do much about it. The most straightforward fix for the problem would be to query the offsets also in each getNodeForVirtualViewId() call. However, offset calculation seems to be quite heavy operation, and getNodeForVirtualViewId can be called very often (esp. if we have a lot of UI elements). As a result, this fix can't be implemented. In this patch I came up with the second approach - once getNodeForView() is called, and it detects that the offsets have changed, we force re-focus of the currently selected element. This allows us to retain the offsets-caching mechanism. Fixes: QTBUG-93402 Pick-to: 6.3 6.2 5.15 Change-Id: Ic420afe1fe5e80fbdf91b2b2651f2daa71c6e44d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: extract parentId for hidden object in advanceIvan Solovev2022-02-094-8/+7
| | | | | | | | | | | | | | | | | | This commit amends 850a7f1238e84b6960a84e12687e40cf939a44d9. We can't extract the parentId for the hidden object on Java side, because the Java call is executed in a separate thread, so the original hidden object can be destroyed somewhere in the middle of parentId() call. As a workaround, we get the parentId in advance, on C++ side, and pass it as a parameter to JNI function. Task-number: QTBUG-95764 Pick-to: 6.3 6.2 5.15 Change-Id: Ied2ab4ab39b947f3f582575cf77cc76fbac9e274 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android A11Y: fix content update notification when object is hiddenIvan Solovev2022-01-281-1/+4
| | | | | | | | | | | When the object is hidden, we should not use its viewId to notify content changed. Instead, we need to use its parent id. Task-number: QTBUG-95764 Pick-to: 6.3 6.2 5.15 Change-Id: I608658e21c401d76459a09e4b274c60b849ace86 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: explicitly remove accessibility focus when element is hiddenIvan Solovev2022-01-281-0/+11
| | | | | | | | | | | | | | | | | | Before this patch when an element that had an Accessibility focus was hidden (for example, a button because of Accessibility.onPressAction), the focus was still remaining on that hidden element. So the next doubletaps on the screen caused the Accessibility.onPressAction() of the hidden element to be executed again and again. To fix this, we have to explicitly send a FOCUS_CLEARED event to the Android OS, when the object is hidden. Another needed fix is to set the m_focusedVirtualViewId in notifyObjectFocus() properly. Fixes: QTBUG-93393 Pick-to: 6.3 6.2 5.15 Change-Id: I6ff8a19868b96842719924037545c4ecc91e0dad Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* [Android]: Handle the screen name, modes and refreshRate properlyBogDan Vatra2022-01-284-52/+46
| | | | | | | | | Fixes: QTBUG-87136 Fixes: QTBUG-93823 Fixes: QTBUG-94959 Pick-to: 6.3 6.2 5.15 Change-Id: Id480e22611ec949b5e3ee780fc695fb502a5950c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Recognize system apps also when apk has parent directoryTinja Paavoseppä2021-12-081-2/+7
| | | | | | | | | | | | | When checking if the apk is being deployed from system partition, account for possibility of the apk not being installed directly under /system/app or /system/priv-app, but in a directory of its own. Otherwise, system applications that are not directly under system app/ priv-app directories will not be recognized as system apps, meaning they will not use the system library path to load their libraries. Pick-to: 6.2 Change-Id: I1e778b18cae3c0406e087b8c78fd31d521f7be73 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: add methods to get the FileDescriptor for a UriAssam Boudjelthia2021-12-031-0/+32
| | | | | | | | | | | | | This can be useful for some cases when the Android APIs have calls that expects a FileDescriptor instead of a Uri or an int file descriptor (like a case in Qt Multimedia with MediaRecorder). Pick-to: 6.2 Task-number: QTBUG-96081 Task-number: QTBUG-96957 Change-Id: I0ab8d37a43b7cb94f6ebb5d48014e5a7903aadc7 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Android: simplifications to exception messages for content file handlingAssam Boudjelthia2021-12-031-76/+63
| | | | | | | | | | | | | | | | The method getUriWithValidPermission() now returns null only if the Uri couldn't be parsed, otherwise, returns the parsed Uri and fail later when used if it doesn't have permissions for example. Also, Don't use use hardcoded strings for method names, and print the exception message instead of the whole stack. Pick-to: 6.2 Task-number: QTBUG-96081 Task-number: QTBUG-96957 Change-Id: If7ba88265c9683e6660cb483cfee6c22016f2976 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Docs: Move manifest and androiddeployqt docs to where code livesNicholas Bennett2021-11-191-0/+290
| | | | | | | | | | | Removed content describing androiddeployqt from deployment-android.html to androiddeployqt.html,the qdoc source now living in qtbase. Docs src locations added to the qtcore.qdocconf. Task-number: QTBUG-97842 Pick-to: 6.2 Change-Id: I94783520280098ce1ab35f335a644bea70b8131a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Treat ACTION_CANCEL as TouchCancelEventMike Achtelik2021-10-291-2/+9
| | | | | | | | | | | | | | | | | | | | Change 64d62c53c1e92a1cc07449a0ea3c71501592c1e7 started treating an ACTION_CANCEL as a TouchPointReleased. This leads to unintentional presses, if e.g. an edge swipe for the android back gesture starts on a MouseArea. When Android takes possession of the motion, an ACTION_CANCEL is delivered, which needs to be handled as such. It should not be treated as a normal up event that triggers a press. Otherwise, we get the above-mentioned issue, where an unintentional action is performed. So let's use QWindowSystemInterface::handleTouchCancelEvent to treat it as a canceled touch in Qt. Task-number: QTBUG-72110 Pick-to: 6.2 5.15 Change-Id: I68650a180130501568e5a1e9a7f20ea469461e97 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-10-263-35/+8
| | | | | | | | | | | | | | | This reverts commit 5c6b10c3cee5737dbc041d0463220898c8120807. It caused a regression such that the main window no longer resized or panned when the VKB is shown, in spite of android:windowSoftInputMode being set. Pick-to: 6.2 5.15 Task-number: QTBUG-95300 Task-number: QTBUG-96117 Task-number: QTBUG-97503 Change-Id: If56e1113eea69a940f6760bdb2ad06a93a0759c1 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Update Gradle to 7.2.0 and Android Gradle Plugin to 7.0.2Mårten Nordheim2021-10-221-1/+1
| | | | | | | | | | | | | | The latest build-tools 31.0.0 requires AGP version 7.0+, and that requires Gradle version 7.0+, so use the latest stable release for both. [1] https://developer.android.com/studio/releases/gradle-plugin? buildsystem=ndk-build#updating-gradle Fixes: QTBUG-97002 Pick-to: 6.2 Change-Id: I8ff26819bdf1a00f484ecc194c4d4e7bca2b598a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Android: set allowNativeHeapPointerTagging to false in the manifestAssam Boudjelthia2021-10-211-1/+2
| | | | | | | | | | | | | | | | Android 11 enables pointer tagging by default on arm64 systems [1], which can cause QML to get invalid data, which caused the color issue (and most likely other issues). [1] https://source.android.com/devices/tech/debug/tagged-pointers Fixes: QTBUG-97009 Task-number: QTBUG-91150 Change-Id: Ic4f145bba3345b3bee5445685f03269e3785f514 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 9fa805f7f8dfe96d561e9ed3170770ad768baf93) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Hide the keyboard when the height is less than 0Andy Shaw2021-10-141-0/+4
| | | | | | | | | | | | | | When swiping on a device to do the back gesture then there is no back key pressed sent so we still need to catch when the keyboard is hidden. So we can listen for the geometry change and if the height is less than 0 then it is safe to say it is hidden so we update the internal setting on this. Fixes: QTBUG-96560 Pick-to: 6.2 5.15 Change-Id: Iec0560935ef914d2cebcb7641a72ab4f71877d23 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: replace ndk.dir with android.ndkVersion in build.gradleAssam Boudjelthia2021-10-131-1/+1
| | | | | | | | | | | | The use of ndk.dir in local.properties is deprecated in favor of android.ndkVersion in build.gradle, and will be totatlly removed in the future, so we need to adapt to that. Fixes: QTBUG-91391 Pick-to: 6.2 Change-Id: I54c57113a759d43c3685c9cdf2b9dcc5c948c0fd Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Android: Update and add missing gradle files for jar foldersAssam Boudjelthia2021-10-061-7/+6
| | | | | | | | | | | | Update the build.gradle for main Qt jar code, and add same files for network and network information backend, so the code can be managed from Android Studio. This also adds .gitignore to ignore Android Studio build artefacts. Pick-to: 6.2 Change-Id: Ic06e9d12708070fad112f17e58b8754608d184f3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Android: use gradle repo mavenCentral() instead of jcenter()Assam Boudjelthia2021-10-061-2/+2
| | | | | | | | | | | jcenter() is deprecated and will be shutdown by next year [1], thus the replacement mavenCentral() could be used instead. [1] https://blog.gradle.org/jcenter-shutdown Pick-to: 6.2 Change-Id: Ic9d1c15d657f23712ee4c866d5c1a45706353429 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Android: remove comments from the manifest fileAssam Boudjelthia2021-10-021-44/+6
| | | | | | | | | | | The comments are not needed, since we're adding a docs page for the manifest, which include the information from these comments and more. Keep the manifest clean. Pick-to: 6.2 Task-number: QTBUG-95285 Change-Id: I1fd8bc695f5aab1bcc69f549cb3ddeeaac168b98 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Specify Android architecture in gradle filesAndreas Buhr2021-09-301-0/+1
| | | | | | | | | | | | | | | | | | | When building for armeabi-v7a, building and APK using "ninja foo_make_apk" works. Building it by calling "gradlew assembleDebug" works. Opening the "android-build" folder in Android Studio and clicking the "Build" button works. But clicking the "Run" or "Debug" button in Android Studio does not work when the attached phone is arm64-v8a. Then Android Studio automatically selects the v8 architecture which does not find the Qt libraries. This patch adds explicit ABI selection to the gradle configuration files. With explicit ABI selection, Android Studio does not try to outsmart you. Pick-to: 6.2 Fixes: QTBUG-96701 Task-number: QTBUG-87022 Change-Id: I4ad6356c38b7eca004c0e0dbbb357cab7de84c0f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Rename variable to not reference Qt5Andreas Buhr2021-09-301-4/+4
| | | | | | | | | In the Android gradle files, the variable qt5AndroidDir refers to Qt5 and might confuse users. This patch renames to qtAndroidDir. Pick-to: 6.2 Change-Id: Ib18a3cd2c38646e4c6c0435dae9234f0f7887eb5 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add error messages in case system library directory does not existAndreas Buhr2021-09-301-2/+10
| | | | | | | | | | | | | On Android, when the system library directory does not exist, no error message was given. This led in turn to error messages like Can't find 'nulllibQt6Core_armeabi-v7a.so' which are not very helpful. Pick-to: 6.2 Task-number: QTBUG-80766 Task-number: QTBUG-96701 Change-Id: I4187e4a68d9e78e198152306a3e664c30c51ab18 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Add information about who launched this activity to intentsLars Schmertmann2021-08-261-0/+18
| | | | | | | | | | | * With this change, applications can easily determine the source of an intent without creating an own extension of QtActivity. * https://developer.android.com/reference/android/app/Activity#getReferrer() Task-number: QTBUG-84382 Pick-to: 6.2 Change-Id: I6a5200af1d997640f02e2b934343914fb5f32ccc Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fix access to content: URLs with transient read/write permissionsVolker Krause2021-08-231-17/+21
| | | | | | | | | | | | | | | | The current code assumed that the lack of persistent permissions means we cannot access the file at all. That however isn't the case for content: URLs we get e.g. via Intents, those are accessible perfectly fine via QFile, we just don't have (and can't obtain) persistent permissions for them. This is done by continuing in the case of not having persistent permissions and checking for SecurityExceptions that are thrown when accessing content: URLs we really have no permission for. Pick-to: 6.2 5.15 Change-Id: I39115a7730d717eb9517e4f1c1a57e40988001a5 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: guard getStateCount() with correct VERSION.SDK_INTAssam Boudjelthia2021-08-231-1/+7
| | | | | | | | | The call getStateCount() was introduced in 29, so cases for lower API should be handled. Pick-to: 6.2 6.1 Change-Id: I7f58541c0b16fed91835e6f390afa89378a7af3e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix Style java code format and warningsAssam Boudjelthia2021-08-151-506/+344
| | | | | | | | | | | The code had many bad formating and syntax or API usage warnings, as well as some unused methods or classes which are fixed with this patch. Pick-to: 6.2 5.15 6.1 Task-number: QTBUG-71590 Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix hidden API access for Android styleAssam Boudjelthia2021-08-122-833/+787
| | | | | | | | | | | | | | | | | | | | Use public API and attributes to retrieve part of the Android style values instead of using reflection to access hidden or private fields. This latter method, was throwing lots of warnings or exceptions at the start of apps making it big annoyance to deal with. This patch doesn't handle drawables though, so the "full" and "default" Android style will be somehow broken still for now. For that reason, the default style extraction method is set to minimal to avoid getting warnings about it, and Fusion style could be used for Widgets apps, and for QML apps, it's recommended to use the Material style from Quick Controls 2. Pick-to: 6.2 5.15 6.1 Task-number: QTBUG-71590 Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Add Android service check on quit appFabio Falsini2021-07-271-2/+2
| | | | | | | | | | | | | | When quitApp() delegates the quit action to runAction(), this function only checks if an activity exists. If the process is a service, rather than an activity, it has no activity, so the action is skipped and the service is not exited. Check in runAction() for a service as well as an activity. Pick-to: 6.2 Change-Id: Iec6f0550064506a780892d3d840f7488fc894569 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix unnecessary clipboard data accessMike Achtelik2021-07-141-12/+7
| | | | | | | | | | | | | Android 12 introduced a notification which is shown to the user each time the app accesses the clipboard via getPrimaryClip. Currently this notification is triggered, even if we just want to check, if some clipboard data exists. So lets not get the actual data and instead use getPrimaryClipDescription to check for the existence of the correct mime type in the clipboard. Pick-to: 6.2 6.1 5.15 5.12 Change-Id: I4800f5545ab46b7f6cade0ce9d78c04b50ae96cf Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Make the manifest less to scary to read and editAssam Boudjelthia2021-07-013-86/+103
| | | | | | | | | | | | | | | | | Remove unnecessary elements from the manifest file, making it easier to manage and read. Mostly, the removed elements are more internal data that is populated by the build system and the user shouldn't have to worry or confront that. Also, use the same formatting used by Android Studio. [ChangeLog][Android] Remove some elements from the manifest file that are internal, to make it easier to deal with the manifest. Pick-to: 6.2 Change-Id: I6a1f275b579370972c0bf022502a8fbfe7d0bfd1 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Remove ministro codeAssam Boudjelthia2021-07-0129-355/+1
| | | | | | | | | | | | | | Since Ministro no longer work on recent Android versions (Android 8+), and it hasn't been maintained and the repos are not updated, the existing code is practically a dead code. [ChangeLog][Android] Remove ministro code since it's been unmaintained and not working with recent Android versions. Task-number: QTBUG-85201 Pick-to: 6.2 Change-Id: I18d7b1e209cba3cfd04674060e9bf39aa5a5510f Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Remove unnecessary = signs from build.gradleAssam Boudjelthia2021-06-021-2/+2
| | | | | Change-Id: Ic7090ec2003b20a809f8920bae28bc9b88733cb8 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Silence misleading exception print in setQtContextDelegateAssam Boudjelthia2021-06-021-3/+1
| | | | | | | | | | | | | | As I understand it, the call to getDeclaredMethod seems to be just there to check if a given method is declared under before adding it to the delegates list, and that's why the getDeclaredMethod is not returning anything, so we could treat it as a failed check and not print anything. This is an amendment to 80f7494e8a9f9a70e3b53833a098d74d8c2331d9 which added this print. Pick-to: 6.1 5.15 Change-Id: I5f69ed5b4fa655da53ac7fba20d4e07acc75607a Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Android: Fix select handles misplacement on QDialogPekka Gehör2021-05-253-0/+21
| | | | | | | | | | Get select handles {Left, Right}Point from a mapToGlobal with a cursorRectangleof anchorRectangle of the selected word/text. Task-number: QTBUG-90799 Change-Id: I4fed19a1d3bb2247656b052306307e6980074405 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: Reset m_usePrimaryClip when clearing the clip dataAndy Shaw2021-05-191-0/+1
| | | | | | | | | | | The variable needs to be set to false when we clear the clip data as there is no primary clip anymore so we should not try to access it when setting new data. Fixes: QTBUG-93831 Pick-to: 6.1 5.15 Change-Id: I309270dc075fcb0457607561ee23e12f7eb6397f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix position issue of the EditPopupMenuPekka Gehör2021-05-121-2/+5
| | | | | | | | | Set y for the EditPopupMenu from the previous correct value if select handles values are zero. The SelectionHandle.bottom() is zero if selection handles have not yet been displayed on the screen. Task-number: QTBUG-71900 Change-Id: I3694a8edd4f0d8f8799dbac1217a75c375038e66 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>