Android 8 Settings app crashes on emulator with clean AOSP build - android

"Settings" app will crash immediately after open with clean Android 8 build (aosp_x86-eng) on emulator. logcat output is below:
--------- beginning of main
1536 1550 E memtrack: Couldn't load memtrack module
1536 1550 W android.os.Debug: failed to get memory consumption info: -1
--------- beginning of system
1536 1548 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings (has extras)} from uid 10013
1373 2321 W audio_hw_generic: Not supplying enough data to HAL, expected position 926726 , only wrote 926722
2477 2477 W zygote : Unexpected CPU variant for X86 using defaults: x86
1536 1548 I ActivityManager: Start proc 2477:com.android.settings/1000 for activity com.android.settings/.Settings
2477 2477 I zygote : The ClassLoaderContext is a special shared library.
2477 2477 D OpenGLRenderer: HWUI GL Pipeline
2477 2477 W TileUtils: Found com.android.settings.backup.BackupSettingsActivity for intent Intent { act=com.android.settings.action.SETTINGS pkg=com.android.settings } missing metadata com.android.settings.category
2477 2477 D ConditionManager: conditions loading asychronously
2477 2496 D ConditionManager: loading conditions from xml
2477 2495 E BluetoothAdapter: Bluetooth binder is null
2477 2495 V NFC : this device does not have NFC support
1388 1836 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2477 2500 D SuggestionParser: Day 0 for com.android.settings.suggested.category.FIRST_IMPRESSION
2477 2495 D BatteryInfo: time to make batteryStatsHelper: 1ms
1536 1554 I WifiService: requestActivityInfo uid=1000
1536 1554 I WifiService: reportActivityInfo uid=1000
1536 1554 I WifiService: getSupportedFeatures uid=1000
1536 1606 W HalDeviceManager: isWifiStarted called but mWifi is null!?
2477 2500 I SuggestionParser: Use fingerprint requires unavailable feature android.hardware.fingerprint
1536 1554 E BluetoothAdapter: Bluetooth binder is null
1536 1554 E BatteryExternalStatsWorker: no controller energy info supplied for wifi
1536 1554 E KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state (No such file or directory)
1536 1554 E BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
2477 2500 I SuggestionParser: Add another fingerprint requires unavailable feature android.hardware.fingerprint
2477 2495 D BatteryInfo: time for getStats: 10ms
2477 2500 W TileUtils: Found com.android.settings.backup.BackupSettingsActivity for intent Intent { act=com.android.settings.action.SETTINGS pkg=com.android.settings } missing metadata com.android.settings.category
1643 1852 D EGL_emulation: eglMakeCurrent: 0x945dab60: ver 2 0 (tinfo 0x945e4970)
1380 1380 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1540096
1380 1525 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1540096
2477 2499 D : HostConnection::get() New Host Connection established 0xa750eb00, tid 2499
2477 2499 I zygote : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2477 2499 I OpenGLRenderer: Initialized EGL, version 1.4
2477 2499 D OpenGLRenderer: Swap behavior 1
2477 2500 E SystemServiceRegistry: No service published for: wifip2p
2477 2500 E SystemServiceRegistry: android.os.ServiceManager$ServiceNotFoundException: No service published for: wifip2p
2477 2500 E SystemServiceRegistry: at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:75)
2477 2500 E SystemServiceRegistry: at android.app.SystemServiceRegistry$49.createService(SystemServiceRegistry.java:569)
2477 2500 E SystemServiceRegistry: at android.app.SystemServiceRegistry$49.createService(SystemServiceRegistry.java:567)
2477 2500 E SystemServiceRegistry: at android.app.SystemServiceRegistry$StaticServiceFetcher.getService(SystemServiceRegistry.java:987)
2477 2500 E SystemServiceRegistry: at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:914)
2477 2500 E SystemServiceRegistry: at android.app.ContextImpl.getSystemService(ContextImpl.java:1667)
2477 2500 E SystemServiceRegistry: at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:171)
2477 2500 E SystemServiceRegistry: at android.app.Activity.getSystemService(Activity.java:5915)
2477 2500 E SystemServiceRegistry: at com.android.settings.wfd.WifiDisplaySettings.isAvailable(WifiDisplaySettings.java:216)
2477 2500 E SystemServiceRegistry: at com.android.settings.SettingsActivity.doUpdateTilesList(SettingsActivity.java:845)
2477 2500 E SystemServiceRegistry: at com.android.settings.SettingsActivity.-wrap0(Unknown Source:0)
2477 2500 E SystemServiceRegistry: at com.android.settings.SettingsActivity$5.run(SettingsActivity.java:747)
2477 2500 E SystemServiceRegistry: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
2477 2500 E SystemServiceRegistry: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2477 2500 E SystemServiceRegistry: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2477 2500 E SystemServiceRegistry: at java.lang.Thread.run(Thread.java:764)
1536 1548 W ActivityManager: Force finishing activity com.android.settings/.Settings
1536 1552 I ActivityManager: Showing crash dialog for package com.android.settings u0
It seems that crash is somehow related to WiFi, but Android emulator shouldn't have WiFi support anyway. What could be the issue here?

I managed to fix it myself. The problem seems to be due to com.android.settings.wfd.WifiDisplaySettings.isAvailable reporting that WiFi is available, while wifip2p service is absent. I went to WifiDisplaySettings.java:216 and replaced this check with false, so it won't try to locate the service. Now Settings can be opened properly.

Alter your WifiDisplaySettings.java in
/YoutAospRoot/packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettings.java
Change the code snippet
public static boolean isAvailable(Context context) {
return context.getSystemService(Context.DISPLAY_SERVICE) != null
&& context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
}
To
public static boolean isAvailable(Context context) {
return false;
}
Then
make systemimage

Maybe this can help too. I noticed that the Settings app is not crashing when building an clean Android 8 with lunch aosp_x86-userdebug instead of lunch aosp_x86-eng.

Related

How do I install a Qt app as a system app on Android?

I'm building an embedded Android device and I have a Qt/QML app I'd like to install as a system app.
However, when I attempt to launch it after moving it to /system/app or /system/priv-app, I get a popup box "Your application encountered a fatal error and cannot continue"
I tried this on the simplest QML project and as standard an emulator config as I could, and still ran into the issue
I'm doing this on Windows now as I write this question, but I also ran into the same issue trying to do it from my main Linux development machine.
Steps I followed leading up to this (some may be in a different order than they were actually performed, I'm recalling from memory after trial and error):
Install Android Studio Canary (2021.1.1 Canary 7)
Install Android 29 SDK and the x86 emulator image (Google APIs, not Google Play), create a Pixel 5 API 29 virtual device
Install Qt 5.15.2 for Android from the Qt maintenance tool / online installer
Install AdoptOpenJDK 8
Run Qt Creator, head to Tools->Options->Devices->Android, point it to the AdoptOpenJDK installation, let it set up the tools it needs, and verify everything has green checkmarks
Start a new project and select the Qt Quick "Swipe" template (bare minimum QML example), 5.15.2 for Android. Named "QMLhello" in this case.
In "Projects" tab under the "Build" settings for 5.15.2 multi-abi, expand the "qmake" section and check the "x86" checkbox so that it builds an ABI for the Android emulator
Verify that Qt Creator can build and run the app as a "normal" app (the green "Run" button successfully deploys and launches the app, and can swipe between pages)
Steps I performed in order to prepare to move the app to the system:
Add environment variable studio.emu.params to the user environment, with the contents -writable-system
Restart Android Studio and cold boot the AVD emulator to start with a writable system as specified in the environment variable
adb devices lists the emulator as a device
adb root and adb remount successfully remounts
What I tried after some rummaging around, combining some older answers on StackOverflow into my attempt:
adb shell
mv /data/app/org.qtproject.example.QMLhello-LpZtuoO0ejyQPg_I-8pWnQ==/lib/x86/* /system/lib
mv /data/app/org.qtproject.example.QMLhello-LpZtuoO0ejyQPg_I-8pWnQ== /system/app
The contents of that lib directory were:
generic_x86:/data/app/org.qtproject.example.QMLhello-LpZtuoO0ejyQPg_I-8pWnQ==/lib/x86 # ls -al
total 32892
drwxr-xr-x 2 system system 4096 2021-08-17 10:48 .
drwxr-xr-x 3 system system 4096 2021-08-17 10:48 ..
-rwxr-xr-x 1 system system 18100 1981-01-01 01:01 libQMLhello_x86.so
-rwxr-xr-x 1 system system 5885892 1981-01-01 01:01 libQt5Core_x86.so
-rwxr-xr-x 1 system system 4916776 1981-01-01 01:01 libQt5Gui_x86.so
-rwxr-xr-x 1 system system 1548420 1981-01-01 01:01 libQt5Network_x86.so
-rwxr-xr-x 1 system system 478836 1981-01-01 01:01 libQt5QmlModels_x86.so
-rwxr-xr-x 1 system system 47632 1981-01-01 01:01 libQt5QmlWorkerScript_x86.so
-rwxr-xr-x 1 system system 4236260 1981-01-01 01:01 libQt5Qml_x86.so
-rwxr-xr-x 1 system system 181004 1981-01-01 01:01 libQt5QuickControls2_x86.so
-rwxr-xr-x 1 system system 1392176 1981-01-01 01:01 libQt5QuickTemplates2_x86.so
-rwxr-xr-x 1 system system 4880080 1981-01-01 01:01 libQt5Quick_x86.so
-rwxr-xr-x 1 system system 562364 1981-01-01 01:01 libQt5RemoteObjects_x86.so
-rwxr-xr-x 1 system system 931652 1981-01-01 01:01 libc++_shared.so
-rwxr-xr-x 1 system system 56196 1981-01-01 01:01 libplugins_bearer_qandroidbearer_x86.so
-rwxr-xr-x 1 system system 26304 1981-01-01 01:01 libplugins_imageformats_qgif_x86.so
-rwxr-xr-x 1 system system 34944 1981-01-01 01:01 libplugins_imageformats_qicns_x86.so
-rwxr-xr-x 1 system system 22208 1981-01-01 01:01 libplugins_imageformats_qico_x86.so
-rwxr-xr-x 1 system system 399040 1981-01-01 01:01 libplugins_imageformats_qjpeg_x86.so
-rwxr-xr-x 1 system system 18112 1981-01-01 01:01 libplugins_imageformats_qtga_x86.so
-rwxr-xr-x 1 system system 432080 1981-01-01 01:01 libplugins_imageformats_qtiff_x86.so
-rwxr-xr-x 1 system system 18112 1981-01-01 01:01 libplugins_imageformats_qwbmp_x86.so
-rwxr-xr-x 1 system system 673576 1981-01-01 01:01 libplugins_imageformats_qwebp_x86.so
-rwxr-xr-x 1 system system 1200076 1981-01-01 01:01 libplugins_platforms_qtforandroid_x86.so
-rwxr-xr-x 1 system system 150600 1981-01-01 01:01 libplugins_qmltooling_qmldbg_debugger_x86.so
-rwxr-xr-x 1 system system 67868 1981-01-01 01:01 libplugins_qmltooling_qmldbg_inspector_x86.so
-rwxr-xr-x 1 system system 14076 1981-01-01 01:01 libplugins_qmltooling_qmldbg_local_x86.so
-rwxr-xr-x 1 system system 14076 1981-01-01 01:01 libplugins_qmltooling_qmldbg_messages_x86.so
-rwxr-xr-x 1 system system 22332 1981-01-01 01:01 libplugins_qmltooling_qmldbg_native_x86.so
-rwxr-xr-x 1 system system 45316 1981-01-01 01:01 libplugins_qmltooling_qmldbg_nativedebugger_x86.so
-rwxr-xr-x 1 system system 84564 1981-01-01 01:01 libplugins_qmltooling_qmldbg_preview_x86.so
-rwxr-xr-x 1 system system 63504 1981-01-01 01:01 libplugins_qmltooling_qmldbg_profiler_x86.so
-rwxr-xr-x 1 system system 22268 1981-01-01 01:01 libplugins_qmltooling_qmldbg_quickprofiler_x86.so
-rwxr-xr-x 1 system system 55248 1981-01-01 01:01 libplugins_qmltooling_qmldbg_server_x86.so
-rwxr-xr-x 1 system system 14072 1981-01-01 01:01 libplugins_qmltooling_qmldbg_tcp_x86.so
-rwxr-xr-x 1 system system 52096 1981-01-01 01:01 libqml_QtGraphicalEffects_private_qtgraphicaleffectsprivate_x86.so
-rwxr-xr-x 1 system system 50948 1981-01-01 01:01 libqml_QtGraphicalEffects_qtgraphicaleffectsplugin_x86.so
-rwxr-xr-x 1 system system 9928 1981-01-01 01:01 libqml_QtQml_Models.2_modelsplugin_x86.so
-rwxr-xr-x 1 system system 18128 1981-01-01 01:01 libqml_QtQml_RemoteObjects_qtqmlremoteobjects_x86.so
-rwxr-xr-x 1 system system 69520 1981-01-01 01:01 libqml_QtQml_StateMachine_qtqmlstatemachine_x86.so
-rwxr-xr-x 1 system system 9932 1981-01-01 01:01 libqml_QtQml_WorkerScript.2_workerscriptplugin_x86.so
-rwxr-xr-x 1 system system 9920 1981-01-01 01:01 libqml_QtQml_qmlplugin_x86.so
-rwxr-xr-x 1 system system 9924 1981-01-01 01:01 libqml_QtQuick.2_qtquick2plugin_x86.so
-rwxr-xr-x 1 system system 600836 1981-01-01 01:01 libqml_QtQuick_Controls.2_Fusion_qtquickcontrols2fusionstyleplugin_x86.so
-rwxr-xr-x 1 system system 1611660 1981-01-01 01:01 libqml_QtQuick_Controls.2_Imagine_qtquickcontrols2imaginestyleplugin_x86.so
-rwxr-xr-x 1 system system 744164 1981-01-01 01:01 libqml_QtQuick_Controls.2_Material_qtquickcontrols2materialstyleplugin_x86.so
-rwxr-xr-x 1 system system 602016 1981-01-01 01:01 libqml_QtQuick_Controls.2_Universal_qtquickcontrols2universalstyleplugin_x86.so
-rwxr-xr-x 1 system system 652988 1981-01-01 01:01 libqml_QtQuick_Controls.2_qtquickcontrols2plugin_x86.so
-rwxr-xr-x 1 system system 378820 1981-01-01 01:01 libqml_QtQuick_Templates.2_qtquicktemplates2plugin_x86.so
-rwxr-xr-x 1 system system 40492 1981-01-01 01:01 libqml_QtQuick_Window.2_windowplugin_x86.so
and Qt tries to load from /system/lib when running as a system app, so I needed to move them there (the patchset referenced in this StackOverflow answer was merged)
Here are the logs from logcat, from the moment I tap the app icon in the launcher to the time it appears to have terminated:
08-17 10:25:34.303 1965 4949 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.qtproject.example.QMLhello/org.qtproject.qt5.android.bindings.QtActivity bnds=[37,1236][238,1560]} from uid 10109
08-17 10:25:34.308 1965 2005 E system_server: Invalid ID 0x00000000.
08-17 10:25:34.308 1965 1965 W ActivityManager: Unable to start service Intent { act=android.service.appprediction.AppPredictionService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiPredictionService } U=0: not found
08-17 10:25:34.308 1965 1965 W RemoteAppPredictionService: could not bind to Intent { act=android.service.appprediction.AppPredictionService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiPredictionService } using flags 67108865
08-17 10:25:34.308 1965 2298 W InputReader: Device has associated, but no associated display id.
08-17 10:25:34.309 1965 2298 I chatty : uid=1000(system) Binder:1965_6 identical 28 lines
08-17 10:25:34.309 1965 2298 W InputReader: Device has associated, but no associated display id.
08-17 10:25:34.310 4888 4888 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy#e48f5bf
08-17 10:25:34.314 1965 2298 W InputReader: Device has associated, but no associated display id.
08-17 10:25:34.314 1965 2298 I chatty : uid=1000(system) Binder:1965_6 identical 8 lines
08-17 10:25:34.314 1965 2298 W InputReader: Device has associated, but no associated display id.
08-17 10:25:34.329 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 10108928
08-17 10:25:34.356 4888 4888 E Qt : It looks like app deployed as system app. It may be necessary to specify path to system lib directory using android.app.system_libs_prefix metadata variable in your AndroidManifest.xml
08-17 10:25:34.356 4888 4888 E Qt : Using /system/lib/ as default path
08-17 10:25:34.358 4888 4888 W System : ClassLoader referenced unknown path:
08-17 10:25:34.384 1965 2005 W InputReader: Device has associated, but no associated display id.
08-17 10:25:34.384 1965 2005 I chatty : uid=1000(system) android.anim identical 8 lines
08-17 10:25:34.384 1965 2005 W InputReader: Device has associated, but no associated display id.
08-17 10:25:34.387 4888 4913 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.containsKey(java.lang.String)' on a null object reference
08-17 10:25:34.387 4888 4913 W System.err: at org.qtproject.qt5.android.QtNative$4.run(QtNative.java:495)
08-17 10:25:34.387 4888 4913 W System.err: at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
08-17 10:25:34.387 4888 4913 W System.err: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
08-17 10:25:34.387 4888 4913 W System.err: at java.lang.Thread.run(Thread.java:919)
08-17 10:25:34.387 4888 4888 W System.err: java.lang.Exception:
08-17 10:25:34.388 4888 4888 W System.err: at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:268)
08-17 10:25:34.388 4888 4888 W System.err: at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:505)
08-17 10:25:34.388 4888 4888 W System.err: at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:166)
08-17 10:25:34.388 4888 4888 W System.err: at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:267)
08-17 10:25:34.388 4888 4888 W System.err: at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:274)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.Activity.performCreate(Activity.java:7802)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.Activity.performCreate(Activity.java:7791)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)08-17 10:25:34.388 4888 4888 W System.err: at android.os.Handler.dispatchMessage(Handler.java:107)
08-17 10:25:34.388 4888 4888 W System.err: at android.os.Looper.loop(Looper.java:214)
08-17 10:25:34.388 4888 4888 W System.err: at android.app.ActivityThread.main(ActivityThread.java:7356)
08-17 10:25:34.388 4888 4888 W System.err: at java.lang.reflect.Method.invoke(Native Method)
08-17 10:25:34.388 4888 4888 W System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
08-17 10:25:34.389 4888 4888 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
08-17 10:25:34.438 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1495040
08-17 10:25:34.449 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.451 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.452 4888 4909 D EGL_emulation: eglMakeCurrent: 0xe3010e40: ver 2 0 (tinfo 0xe2feea20)
08-17 10:25:34.460 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1495040
08-17 10:25:34.464 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1495040
08-17 10:25:34.466 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.469 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.479 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 10108928
08-17 10:25:34.483 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.489 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.492 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 10108928
08-17 10:25:34.493 4888 4909 D EGL_emulation: eglMakeCurrent: 0xe3010e40: ver 2 0 (tinfo 0xe2feea20)
08-17 10:25:34.499 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.526 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.527 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.530 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.532 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.545 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.546 1754 2456 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 10108928
08-17 10:25:34.548 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.561 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.563 4888 4909 D EGL_emulation: eglMakeCurrent: 0xe3010e40: ver 2 0 (tinfo 0xe2feea20)
08-17 10:25:34.565 1755 2673 W EmuHWC2 : validate: layer 19 CompositionType 1, fallback
08-17 10:25:34.569 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.583 1755 2673 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.584 1965 2009 I ActivityTaskManager: Displayed org.qtproject.example.QMLhello/org.qtproject.qt5.android.bindings.QtActivity: +255ms
08-17 10:25:34.586 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.599 1755 2673 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.611 1755 2673 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.616 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.618 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.633 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.634 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.635 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.640 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.649 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.651 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.652 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.655 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.666 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.668 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.670 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.673 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.683 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.685 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.685 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.691 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.699 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.701 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.704 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.709 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.716 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.718 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.721 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.725 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.733 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.735 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.741 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.746 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.750 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.752 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0612d20
08-17 10:25:34.757 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.761 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.766 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.768 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf0613080
08-17 10:25:34.772 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.775 2120 2352 D EGL_emulation: eglMakeCurrent: 0xe2f6dde0: ver 2 0 (tinfo 0xc15443d0)
08-17 10:25:34.783 1755 1755 W EmuHWC2 : validate: layer 20 CompositionType 1, fallback
08-17 10:25:34.786 1755 1755 W EmuHWC2 : No layers, exit, buffer 0xf06130e0
08-17 10:25:34.848 1768 1768 E Layer : [Surface(name=AppWindowToken{607c35c token=Token{3592dcf ActivityRecord{84abe2e u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t8}}})/#0x2c802ff - animation-leash#0] No local sync point found
08-17 10:25:34.848 1768 1768 E Layer : [Surface(name=AppWindowToken{607c35c token=Token{3592dcf ActivityRecord{84abe2e u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t8}}})/#0x2c802ff - animation-leash#0] No local sync point found
08-17 10:25:34.848 1768 1768 E Layer : [Surface(name=AppWindowToken{8151314 token=Token{6bf8967 ActivityRecord{6996926 u0 org.qtproject.example.QMLhello/org.qtproject.qt5.android.bindings.QtActivity t11}}})/#0x8dbcc29 - animation-leash#0] No local sync point found
08-17 10:25:34.848 1768 1768 E Layer : [Surface(name=AppWindowToken{8151314 token=Token{6bf8967 ActivityRecord{6996926 u0 org.qtproject.example.QMLhello/org.qtproject.qt5.android.bindings.QtActivity t11}}})/#0x8dbcc29 - animation-leash#0] No local sync point found
08-17 10:25:34.850 2955 3141 D EGL_emulation: eglMakeCurrent: 0xe2f75c00: ver 2 0 (tinfo 0xbeb4d200)
08-17 10:25:34.852 2308 2944 D EGL_emulation: eglMakeCurrent: 0xe2f66840: ver 2 0 (tinfo 0xe3005990)
08-17 10:25:34.867 2955 3134 I PBSessionCacheImpl: Deleted sessionId[497328440469] from persistence.
08-17 10:25:34.889 2955 3112 W SearchServiceCore: Abort, client detached.
08-17 10:25:34.898 1768 1768 W SurfaceFlinger: couldn't log to binary event log: overflow.
That line of code it references in the exception, QtLoader.java line 268, simply appears to throw an empty string exception if it fails to "invoke", without any information on why it failed to invoke.
Digging further, it looks like the cause comes from QtNative.java line 495 where it runs into a NullPointerException attempting to call info.metaData.containsKey. But I can't fathom why that would fail for a system app when it doesn't fail for a normal app.
What else am I missing?
My mistake was moving the libraries to /system/lib. I believe I may have blindly copied all the steps of a previous answer where that was necessary, and some changes in Qt and/or Android may've have happened since then that lead to my issue.
For my purposes, it was sufficient to simply move the directory altogether as-is from /data/app/ to /system/priv-app, keeping the library subdirectory.
adb install appname.apk
adb remount
adb shell
cd /data/app
mv appname* /system/priv-app
reboot
The QtLoader is able to load up some of the shared libraries from /system/lib enough to get to the next step. But the next step needs to have the libraries in the first place it looks, at /system/priv-app/org.qtproject.example.QMLhello-LpZtuoO0ejyQPg_I-8pWnQ==/lib/x86 (at least in the case of the x86 emulator - substitute other arch as needed)
Otherwise, there is a chance it will run into a NullPointerException and fail to launch.
Potential workaround
Add some <meta-data> directly under <application> in AndroidManifest.xml
Details
Here is a snippet of the QtNative.java code, lines 489-497 as of the 5.15.2 release (line numbers added)
// ...
/* 489 */ File f = new File(nativeLibraryDir + mainLibNameTemplate);
/* 490 */ if (!f.exists()) {
/* 491 */ try {
/* 492 */ ApplicationInfo info = getContext().getApplicationContext().getPackageManager()
/* 493 */ .getApplicationInfo(getContext().getPackageName(), PackageManager.GET_META_DATA);
/* 494 */ String systemLibraryDir = QtNativeLibrariesDir.systemLibrariesDir;
/* 495 */ if (info.metaData.containsKey("android.app.system_libs_prefix"))
/* 496 */ systemLibraryDir = info.metaData.getString("android.app.system_libs_prefix");
/* 497 */ f = new File(systemLibraryDir + mainLibNameTemplate);
// ...
489: When QtNative.java goes to load the main application library, it first checks in that ./lib/x86 subfolder, in this case.
492-493: When it fails to find that, it's looking for some metadata in the application manifest to see if the application is telling it where to look. When there is no metadata at the application level, however, the metaData member of the object is null.
Not checking for null, thus a NullPointerException gets thrown
How did a null pointer happen in the first place?
The AndroidManifest.xml generated by Qt by default for this project (attached below) does not contain any <meta-data> tags directly under the <application> level--they are instead contained in <activity>. The loadMainLibrary function should be looking at the activityInfo instead of (or in addition to) applicationInfo, as well as checking for null beforehand.
This seems like a bug in Qt and I'll report accordingly, but 5.15.x won't be getting any more updates for open source.
<?xml version="1.0"?>
<manifest package="org.qtproject.example.QMLhello" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="QMLhello" android:extractNativeLibs="true">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="QMLhello" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
<meta-data android:name="android.app.lib_name" android:value="QMLhello"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="#array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="#array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="#array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="#array/load_local_libs"/>
<meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroidBearer.jar"/>
<meta-data android:name="android.app.static_init_classes" android:value=""/>
<!-- Used to specify custom system library path to run with local system libs -->
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
<!-- Messages maps -->
<meta-data android:value="#string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="#string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="#string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<meta-data android:value="#string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
are done populating your window with content. -->
<!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="#drawable/logo_portrait" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="#drawable/logo_landscape" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="#drawable/logo"/ -->
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
<!-- extract android style -->
<!-- available android:values :
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
<!-- extract android style -->
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
</manifest>

QT Android - The GDB process terminated unexpectedly (exit code 0)

All of the sudden, when trying to deploy and debug QT Android app that's what I get. The app gets deployed just fine and runs just fine however GDB dies. Already tried removing entire Android-SDK folder and redownloading. Is it really the time to wipe-out the entire QT installation (again) ?
Two message boxes are shown:
Title:"Executable Failed"
Msg: Command aborted"
Title: "Unexpected GDB Exit - QT Creator"
Msg: "The GDB process terminated unexpectedly (exit code 0)."
App log:
10:22:07: Debugging starts W main : type=1400 audit(0.0:86622):
avc: granted { read } for pid=18154 name="u:object_r:net_dns_prop:s0"
dev="tmpfs" ino=1835 scontext=u:r:untrusted_app_25:s0:c512,c768
tcontext=u:object_r:net_dns_prop:s0 tclass=file I ect.PROJECT_NAMEoke:
Late-enabling -Xcheck:jni E ect.PROJECT_NAMEoke: Unknown bits set in
runtime_flags: 0x8000 I ect.PROJECT_NAMEoke: Reinit property:
dalvik.vm.checkjni= false W re-initialized>: type=1400
audit(0.0:86623): avc: denied { read } for pid=18154
name="u:object_r:mmi_prop:s0" dev="tmpfs" ino=1831
scontext=u:r:untrusted_app_25:s0:c512,c768
tcontext=u:object_r:mmi_prop:s0 tclass=file permissive=0 E libc :
Access denied finding property "runtime.mmitest.isrunning" D
ActivityThread: Attach thread to application W ActivityThread:
Application org.qtproject.PROJECT_NAMEoken is waiting for the debugger
on port 8100... I System.out: Sending WAIT chunk I System.out:
Debugger has connected I System.out: waiting for debugger to settle...
I System.out: waiting for debugger to settle... Could not load shared
library symbols for 312 libraries, e.g.
/system/lib/libandroid_runtime.so. Use the "info sharedlibrary"
command to see the complete listing. Do you need "set
solib-search-path" or "set sysroot"?I System.out: debugger has settled
(7129) I ect.PROJECT_NAMEoke: The ClassLoaderContext is a special
shared library. I ect.PROJECT_NAMEoke: QarthPatchMonintor::Init 01-10
10:22:16.053 18154 18154 I ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::StartWatch 01-10 10:22:16.053 18154 18154 I
ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::WatchPackage: /data/hotpatch/fwkhotpatch/ 01-10
10:22:16.054 18154 18154 I ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::CheckAndWatchPatch:
/data/hotpatch/fwkhotpatch/org.qtproject.PROJECT_NAMEoken 01-10
10:22:16.054 18154 18154 I ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::CheckAndWatchPatch: /data/hotpatch/fwkhotpatch/all
01-10 10:22:16.054 18154 18154 I ect.PROJECT_NAMEoke: I
ect.PROJECT_NAMEoke: QarthPatchMonintor::Run 01-10 10:22:16.054 18154
18154 I ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::Reading 01-10 10:22:16.055 18154 18207 I
ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::CheckNotifyEvent 01-10 10:22:16.055 18154 18207 I
ect.PROJECT_NAMEoke: I ect.PROJECT_NAMEoke:
QarthPatchMonintor::CheckNotifyEvent before read 01-10 10:22:16.055
18154 18207 I ect.PROJECT_NAMEoke: I HwApiCacheMangerEx: apicache
path=/storage/emulated/0 state=mounted
key=org.qtproject.PROJECT_NAMEoken#10165#256 I HwApiCacheMangerEx:
apicache path=/storage/emulated/0 state=mounted
key=org.qtproject.PROJECT_NAMEoken#10165#0 I AwareBitmapCacher: init
processName:org.qtproject.PROJECT_NAMEoken pid=18154 uid=10165 V
ActivityThread: callActivityOnCreate W System : ClassLoader
referenced unknown path: E AwareLog: AtomicFileUtils: readFileLines
file not exist: android.util.AtomicFile#cb0695 V HwWidgetFactory: :
successes to get AllImpl object and return.... I
OverScrollerOptimization: start init SmartSlideOverScroller and get
the overscroller config I OverScrollerOptimization: get the
overscroller config W WindowDecorActionBar: should not do the
transition or the transition anim is null or it is running or the
mContainer view is null or mContainer view hasn't been drawn to screen
D HwGalleryCacheManagerImpl: mIsEffect:false D Qt JAVA : Class
org.qtproject.qt5.android.multimedia.QtMultimediaUtils does not
implement setActivity method I QtCore : Start I Qt : qt started
D ActivityThread: add activity client record, r=
ActivityRecord{7b59680 token=android.os.BinderProxy#fba4a25
{org.qtproject.PROJECT_NAMEoken/org.qtproject.qt5.android.bindings.QtActivity}}
token= android.os.BinderProxy#fba4a25 D HiTouch_PressGestureDetector:
onAttached, package=org.qtproject.PROJECT_NAMEoken, windowType=1,
mHiTouchRestricted=false I iGraphics: [0020080c] pn:
org.qtproject.PROJECT_NAMEoken, p: 18154 I iGraphics: [0030050c] PV 10
I iGraphics: [0030050c] no element 'igfx' I iGraphics: [0030050c]
LoadCloudParams lib file success. E Parcel : Reading a NULL string
not supported here. D mali_winsys: EGLint
new_window_surface(egl_winsys_display *, void *, EGLSurface,
EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 W
Gralloc3: mapper 3.x is not supported E :
APS:IFLoad:importExternalFunctions, search function
createNewHwApsUtils failed, dlsym err:undefined symbol:
createNewHwApsUtils D : APS:importExternalFunctions OK I
HwViewRootImpl: removeInvalidNode jank list is null W System.err:
java.lang.ClassNotFoundException: Didn't find class
"org.qtproject.qt5.android.network.QtNetwork" on path:
DexPathList[[],nativeLibraryDirectories=[/system/lib]] W System.err:
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
W System.err: at
java.lang.ClassLoader.loadClass(ClassLoader.java:379) W System.err:
at java.lang.ClassLoader.loadClass(ClassLoader.java:312) D
libPROJECT_NAMEoken_armeabi-v7a.so: QML Debugger: Waiting for
connection on port 16963... D libPROJECT_NAMEoken_armeabi-v7a.so:
About to request permissions D libPROJECT_NAMEoken_armeabi-v7a.so:
Permissions granted W libPROJECT_NAMEoken_armeabi-v7a.so:
qrc:/main.qml:176:5: QML Connections: Implicitly defined onFoo
properties in Connections are deprecated. Use this syntax instead:
function onFoo() { ... } W libEGL : EGLNativeWindowType
0xceced1c8 disconnect failed D mali_winsys: EGLint
new_window_surface(egl_winsys_display *, void *, EGLSurface,
EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 D
mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *,
EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns
0x3000 I Camera : open camera: 0, package name:
org.qtproject.PROJECT_NAMEoken D HwFrameworkSecurityPartsFactory:
HwFrameworkSecurityPartsFactory in. I HwFrameworkSecurityPartsFactory:
add HwFrameworkSecurityPartsFactory to memory. I HwCameraUtil:
notifySurfaceFlingerCameraStatus : isFront = false , isOpend = true D
SensorManager: 0xb24f49c8 addFd fd=107 W Gralloc3: allocator 3.x is
not supported W libEGL : EGLNativeWindowType 0xb96c3008 disconnect
failed D mali_winsys: EGLint new_window_surface(egl_winsys_display *,
void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean)
returns 0x3000 D libPROJECT_NAMEoken_armeabi-v7a.so: needed to resize
D libPROJECT_NAMEoken_armeabi-v7a.so: size: 0 , new size: 6220800 D
AwareBitmapCacher: handleInit switch not opened pid=18154
The app runs fine as usually.

Android application developed with Qt 5 and incorporating the AWS C ++ library crashes

I'm trying to develop an Android Application. This software use the AWS services. The compilation and link work but it crashes at the very beginning of the execution.
I'm using Qt 5.11 and I think that the configuration is good (I'm using the last Android SDK and the NDK 10e) because I can run a simple Android application
I'm using the last AWS C++ library. I compiled this library using this cake command : cmake -DBUILD_ONLY="email;cognito-identity;lambda;core;cognito-idp;identity-management" -DNDK_DIR="/Downloads/android-ndk-r10e" -DANDROID_STL=gnustl_shared -DTARGET_ARCH=ANDROID -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="/aws-sdk-cpp/aws_build_android/build_dynamic_output" /aws-sdk-cpp/aws_build_android/aws-sdk-cpp-master
A s I said, the application crashes with this ultimate debug message:
F libc : Fatal signal 6 (SIGABRT), code -6 in tid 8731 (qtMainLoopThrea)
Here you are the complete list of application debug messages :
E Zygote : isWhitelistProcess - Process is Whitelisted
E libpersona: scanKnoxPersonas
E libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
W SELinux : SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SM-G930F_8.0.0_0018, [-1 -1 -1 -1 0 1]
I SELinux : SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=org.qtproject.example.crio_Android
I zygote : Late-enabling -Xcheck:jni
D TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
D ActivityThread: Added TimaKeyStore provider
I zygote : no shared libraies, dex_files: 1
I zygote : Do partial code cache collection, code=31KB, data=27KB
I zygote : After code cache collection, code=31KB, data=27KB
I zygote : Increasing code cache capacity to 128KB
W System : ClassLoader referenced unknown path:
I QtCore : Start
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5Network.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5Qml.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5Quick.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5Widgets.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5Charts.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5QuickParticles.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5QuickTemplates2.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/app/org.qtproject.example.crio_Android-YwAVQhCj0m2GFmkjJTkxTg==/lib/arm/libQt5QuickControls2.so" has unsupported flags DT_FLAGS_1=0x81
W linker : "/data/data/org.qtproject.example.crio_Android/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" has unsupported flags DT_FLAGS_1=0x81
I Qt : qt started
W linker : "/data/data/org.qtproject.example.crio_Android/qt-reserved-files/plugins/bearer/libqandroidbearer.so" has unsupported flags DT_FLAGS_1=0x81
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 674 us, width=30, height=30
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 1560 us, width=66, height=96
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 1363 us, width=66, height=96
I zygote : Do partial code cache collection, code=59KB, data=54KB
I zygote : After code cache collection, code=59KB, data=54KB
I zygote : Increasing code cache capacity to 256KB
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 413 us, width=5, height=5
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 527 us, width=30, height=30
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 593 us, width=30, height=30
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 412 us, width=5, height=5
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 461 us, width=12, height=48
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 457 us, width=12, height=48
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 1234 us, width=66, height=48
D skia : Encode PNG Singlethread processname=org.qtproject.example.crio_Android : 375 us, width=2, height=2
D OpenGLRenderer: HWUI GL Pipeline
D ViewRootImpl#12633f4[QtActivity]: setView = DecorView#3d0a71d[QtActivity] TM=true MM=false
D ViewRootImpl#12633f4[QtActivity]: dispatchAttachedToWindow
V Surface : sf_framedrop debug : 0x4f4c, game : false, logging : 0
D ViewRootImpl#12633f4[QtActivity]: Relayout returned: old=[0,0][0,0] new=[0,0][1080,1920] result=0x7 surface={valid=true 3761723392} changed=true
I OpenGLRenderer: Initialized EGL, version 1.4
D OpenGLRenderer: Swap behavior 2
D libGLESv1: STS_GLApi : DTS, ODTC are not allowed for Package : org.qtproject.example.crio_Android
D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000, [1080x1920]-format:1
D OpenGLRenderer: eglCreateWindowSurface = 0xe7b37918
D ViewRootImpl#12633f4[QtActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 1920) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
D ViewRootImpl#12633f4[QtActivity]: MSG_WINDOW_FOCUS_CHANGED 1
V InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo#d6c9b60 nm : org.qtproject.example.crio_Android ic=null
I InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
V InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo#ad59819 nm : org.qtproject.example.crio_Android ic=null
W linker : "/data/data/org.qtproject.example.crio_Android/qt-reserved-files/plugins/styles/libqandroidstyle.so" has unsupported flags DT_FLAGS_1=0x81
**F libc : Fatal signal 6 (SIGABRT), code -6 in tid 8731 (qtMainLoopThrea)**
Thank you very much for your help!

Android Bluetooth LE Connection issue with other bluetooth devices

First of all, there's no problem with iOS, but the problem occurs when the app is running on Androids.
There's a BLE device that does pair / notification / write / read.
It seems all good until other bluetooth devices are connected and paired or synced.
For example, if the android phone is restarted (or Bluetooth is off and on again), my BLE device works great with the app.
If I open fitbit app and sync a fitbit device, then my device cannot connect anymore. (and not pairing as well)
Not only for fitbit but also for samsung smart watch, the same thing happens.
Anyone recommendation will be appreciated.
Tested with Android 6. Samsung GS6 and Nexus 5.
Update 1:
After synced with fitbit, I get the following messages from my app when connecting to my device.
11-11 09:02:41.811 781 1599 I ActivityManager: Killing 21073:com.android.chrome:privileged_process0/u0a34 (adj 13): empty #17
11-11 09:02:41.822 21010 21010 W cr_ChildProcessConnect: onServiceDisconnected (crash or killed by oom): pid=21073
11-11 09:02:41.838 781 952 D ActivityManager: cleanUpApplicationRecord -- 21073
11-11 09:02:41.838 781 952 W ActivityManager: Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.PrivilegedProcessService0 in 1000ms
11-11 09:02:41.857 781 1226 I ActivityManager: Start proc 23634:com.android.chrome:privileged_process1/u0a34 for service com.android.chrome/org.chromium.content.app.PrivilegedProcessService1
11-11 09:02:41.902 21010 21010 W .android.chrome: type=1400 audit(0.0:21068): avc: denied { ioctl } for path="socket:[1799361]" dev="sockfs" ino=1799361 ioctlcmd=7704 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=unix_stream_socket permissive=0
11-11 09:02:41.902 23644 23644 W Binder_1: type=1400 audit(0.0:21069): avc: denied { ioctl } for path="socket:[1799361]" dev="sockfs" ino=1799361 ioctlcmd=7704 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=unix_stream_socket permissive=0
11-11 09:02:41.902 23644 23644 W Binder_1: type=1400 audit(0.0:21070): avc: denied { ioctl } for path="socket:[1799361]" dev="sockfs" ino=1799361 ioctlcmd=7704 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=unix_stream_socket permissive=0
11-11 09:02:41.905 23634 23634 I cr_ChildProcessService: Creating new ChildProcessService pid=23634
11-11 09:02:41.908 781 2450 I ActivityManager: Killing 21102:com.android.chrome:sandboxed_process0/u0a34i52 (adj 13): empty #17
11-11 09:02:41.912 21010 21010 W .android.chrome: type=1400 audit(0.0:21071): avc: denied { ioctl } for path="socket:[1799361]" dev="sockfs" ino=1799361 ioctlcmd=7704 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=unix_stream_socket permissive=0
11-11 09:02:41.919 23634 23644 I cr_LibraryLoader: Using linker: org.chromium.base.library_loader.ModernLinker
11-11 09:02:41.920 21010 21010 W cr_ChildProcessConnect: onServiceDisconnected (crash or killed by oom): pid=21102
11-11 09:02:41.941 23634 23646 I cr_LibraryLoader: Loading chrome from within /data/app/com.android.chrome-1/base.apk
11-11 09:02:41.965 22521 22521 I System.out: writeCharacteristic(4, 8, AQAAAA==)
11-11 09:02:41.967 781 1226 D ActivityManager: cleanUpApplicationRecord -- 21102
11-11 09:02:41.967 781 1226 W ActivityManager: Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.SandboxedProcessService0 in 1000ms
11-11 09:02:42.016 23634 23646 I cr_LibraryLoader: Time to load native libraries: 95 ms (timestamps 5253-5348)
11-11 09:02:42.016 23634 23646 I cr_LibraryLoader: Expected native library version number "54.0.2840.85", actual native library version number "54.0.2840.85"
11-11 09:02:42.016 23634 23646 I chromium: [INFO:library_loader_hooks.cc(151)] Chromium logging enabled: level = 0, default verbosity = 0
11-11 09:02:42.027 23634 23646 E libEGL : validate_display:255 error 3008 (EGL_BAD_DISPLAY)
11-11 09:02:42.028 23634 23646 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
After this, it does one more reading then disconnected.
If I goto bluetooth app and 'clear data', then it works fine again.

SELinux Permission Denied for a new framework service in android

I have added a new System Service into Android Framework in earlier versions (4.4) following this tutorial from Texas Instruments
But when I try to do a similar thing in Android Lollipop, the SELinux policy denies me to do so.
This is the output from logcat.
05-11 15:49:51.362 248 248 I SystemServer: Test Service Starting
05-11 15:49:51.364 248 248 I TestManagerService: Started Test Manager Service
05-11 15:49:51.370 54 54 E SELinux : avc: denied { add } for service=TestManagerService scontext=u:r:system_server:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager
05-11 15:49:51.371 54 54 E ServiceManager: add_service('TestManagerService',28) uid=1000 - PERMISSION DENIED
05-11 15:49:51.378 248 248 E SystemServer: Failure starting TestManagerService
05-11 15:49:51.378 248 248 E SystemServer: java.lang.SecurityException
05-11 15:49:51.378 248 248 E SystemServer: at android.os.BinderProxy.transactNative(Native Method)
05-11 15:49:51.378 248 248 E SystemServer: at android.os.BinderProxy.transact(Binder.java:496)
05-11 15:49:51.378 248 248 E SystemServer: at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:150)
05-11 15:49:51.378 248 248 E SystemServer: at android.os.ServiceManager.addService(ServiceManager.java:72)
05-11 15:49:51.378 248 248 E SystemServer: at com.android.server.SystemServer.startOtherServices(SystemServer.java:551)
05-11 15:49:51.378 248 248 E SystemServer: at com.android.server.SystemServer.run(SystemServer.java:257)
05-11 15:49:51.378 248 248 E SystemServer: at com.android.server.SystemServer.main(SystemServer.java:171)
05-11 15:49:51.378 248 248 E SystemServer: at java.lang.reflect.Method.invoke(Native Method)
05-11 15:49:51.378 248 248 E SystemServer: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:723)
05-11 15:49:51.378 248 248 E SystemServer: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:613)
I do not want to disable SELinux policy. I just want the policy to allow my new service too. What should I do?
Check this link: http://androidosp.blogspot.com.tr/2014/11/selinux-seandroid-exceptions-for-system.html
You can simply goto: /external/sepolicy/service_contexts
and add your new service there. Thats it!
To file:
android-dev\external\sepolicy\service.te
Add:
type mytest_service, system_api_service, system_server_service,
service_manager_type;
To file:
android-dev\external\sepolicy\service_contexts
Add:
mytestservice u:object_r:mytest_service:s0
where mytestservice your name service
It's help me
In Android 7.1.1 the service_contexts file has moved to system/sepolicy
to add A service "foo" to the policy add to the file service_contexts
foo u:object_r:foo_service:s0
And in service.te add:
type foo_service, app_api_service, system_server_service, service_manager_type;
A device specific policy can be created by adding a service_contexts & service.te file in the devices sepolicy directory: device/myDevice/versionName/sepolicy
add in your sepolicy file
allow system_server default_android_service:service_manager add

Categories

Resources