AOSP 13 - sailfishos-sony-nagara/main GitHub Wiki

AOSP 13 state

Current tests are performed on device which was upgraded before to Android 14 Sony Stock. So, some of the errors could stem from that.

  • It is possible to build AOSP 13 using instructions from Sony developer pages cleanly. This is a state at Oct 31 2024

  • ADB shell is available early during a boot. As soon as Android logo is on, it is possible to grab the logcat and adb shell into device

Current bugs

android.hardware.health crash

This is not reported, will look into it when new AOSP 14 will be available as I would prefer to have Android 14 Stock before flashing AOSP13.

During the boot of unpatched tree, you may get stuck on Android logo. For me it was caused by

01-01 00:07:30.943     0     0 E init    : Control message: Could not find '[email protected]::IHealth/default' for ctl.interface_start from pid: 478 (/system/bin/hwservicemanager)
01-01 00:07:30.975  5555  5555 W HidlServiceManagement: Waited one second for [email protected]::IHealth/default
01-01 00:07:30.976   478   478 I hwservicemanager: Since [email protected]::IHealth/default is not registered, trying to start it as a lazy HAL.
01-01 00:07:30.976  5555  5555 I HidlServiceManagement: getService: Trying again for [email protected]::IHealth/default...
01-01 00:07:30.977   478  5839 W libc    : Unable to set property "ctl.interface_start" to "[email protected]::IHealth/default": error code: 0x20
01-01 00:07:30.977   478  5839 I hwservicemanager: Tried to start [email protected]::IHealth/default as a lazy service, but was unable to. Usually this happens when a service is not installed, but if the service is intended to be used as a lazy service, then it may be configured incorrectly.
01-01 00:07:30.978     0     0 E init    : Control message: Could not find '[email protected]::IHealth/default' for ctl.interface_start from pid: 478 (/system/bin/hwservicemanager)
01-01 00:07:31.341     0     0 I init    : starting service 'health-hal-2-1'...
01-01 00:07:31.349     0     0 W healthd : batteryCapacityLevelPath not found
01-01 00:07:31.348  5840  5840 E libc++abi: terminating with uncaught exception of type St16invalid_argument: stoi: no conversion
01-01 00:07:31.348  5840  5840 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5840 (android.hardwar), pid 5840 (android.hardwar)
01-01 00:07:31.343  5840  5840 I android.hardwar: type=1400 audit(0.0:21046): avc: denied { read } for name="type" dev="sysfs" ino=108479 scontext=u:r:hal_health_default:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
01-01 00:07:31.343  5840  5840 I android.hardwar: type=1400 audit(0.0:21047): avc: denied { open } for path="/sys/devices/platform/soc/soc:qcom,pmic_glink/soc:qcom,pmic_glink:qcom,ucsi/power_supply/ucsi-source-psy-soc:qcom,pmic_glink:qcom,ucsi1/type" dev="sysfs" ino=108479 scontext=u:r:hal_health_default:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
01-01 00:07:31.343  5840  5840 I android.hardwar: type=1400 audit(0.0:21048): avc: denied { getattr } for path="/sys/devices/platform/soc/soc:qcom,pmic_glink/soc:qcom,pmic_glink:qcom,ucsi/power_supply/ucsi-source-psy-soc:qcom,pmic_glink:qcom,ucsi1/type" dev="sysfs" ino=108479 scontext=u:r:hal_health_default:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
01-01 00:07:31.354  5843  5843 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
01-01 00:07:31.354   620   620 I tombstoned: received crash request for pid 5840
01-01 00:07:31.354  5843  5843 I crash_dump64: performing dump of process 5840 (target tid = 5840)
01-01 00:07:31.355  5843  5843 E DEBUG   : failed to read process info: failed to open /proc/5840
01-01 00:07:31.362     0     0 I logd    : logdr: UID=1000 GID=1000 PID=5843 n tail=0 logMask=8 pid=5840 start=0ns deadline=0ns
01-01 00:07:31.365     0     0 I logd    : logdr: UID=1000 GID=1000 PID=5843 n tail=0 logMask=1 pid=5840 start=0ns deadline=0ns
01-01 00:07:31.370  5843  5843 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 00:07:31.370  5843  5843 F DEBUG   : Build fingerprint: 'Sony/aosp_xqct54/pdx223:13/TQ3A.230901.001/eng.root.20241031.073518:userdebug/test-keys'
01-01 00:07:31.370  5843  5843 F DEBUG   : Revision: '0'
01-01 00:07:31.370  5843  5843 F DEBUG   : ABI: 'arm64'
01-01 00:07:31.370  5843  5843 F DEBUG   : Timestamp: 1970-01-01 00:07:31.355324619+0000
01-01 00:07:31.370  5843  5843 F DEBUG   : Process uptime: 0s
01-01 00:07:31.370  5843  5843 F DEBUG   : Cmdline: /vendor/bin/hw/[email protected]
01-01 00:07:31.370  5843  5843 F DEBUG   : pid: 5840, tid: 5840, name: android.hardwar  >>> /vendor/bin/hw/[email protected] <<<
01-01 00:07:31.370  5843  5843 F DEBUG   : uid: 1000
01-01 00:07:31.370  5843  5843 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
01-01 00:07:31.370  5843  5843 F DEBUG   : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
01-01 00:07:31.370  5843  5843 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
01-01 00:07:31.370  5843  5843 F DEBUG   : Abort message: 'terminating with uncaught exception of type St16invalid_argument: stoi: no conversion'
01-01 00:07:31.370  5843  5843 F DEBUG   :     x0  0000000000000000  x1  00000000000016d0  x2  0000000000000006  x3  0000007ff18f8f40
01-01 00:07:31.370  5843  5843 F DEBUG   :     x4  736f646277641f73  x5  736f646277641f73  x6  736f646277641f73  x7  7f7f7f7f7f7f7f7f
01-01 00:07:31.370  5843  5843 F DEBUG   :     x8  00000000000000f0  x9  0000007133be3a00  x10 0000000000000001  x11 0000007133c21de4
01-01 00:07:31.370  5843  5843 F DEBUG   :     x12 00000000000001c3  x13 000000007fffffff  x14 00000000000370f4  x15 0000000211108fc2
01-01 00:07:31.370  5843  5843 F DEBUG   :     x16 0000007133c86d58  x17 0000007133c63c70  x18 000000713c4ce000  x19 00000000000016d0
01-01 00:07:31.370  5843  5843 F DEBUG   :     x20 00000000000016d0  x21 00000000ffffffff  x22 0000007ff18f9070  x23 ffffff80ffffffc8
01-01 00:07:31.370  5843  5843 F DEBUG   :     x24 0000007133c88f70  x25 0000000000000001  x26 b400006f43b0e1c0  x27 b400006f73b131c8
01-01 00:07:31.370  5843  5843 F DEBUG   :     x28 b400006f43b0e1c0  x29 0000007ff18f8fc0
01-01 00:07:31.370  5843  5843 F DEBUG   :     lr  0000007133c13968  sp  0000007ff18f8f20  pc  0000007133c13994  pst 0000000000001000
01-01 00:07:31.370  5843  5843 F DEBUG   : backtrace:
01-01 00:07:31.370  5843  5843 F DEBUG   :       #00 pc 0000000000051994  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 2c82bf49529e9aa25cb9e5eca777a56f)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #01 pc 000000000004910c  /apex/com.android.vndk.v33/lib64/libc++.so (abort_message+248) (BuildId: ac7b79d1f77424245e84c9e5e12121c7)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #02 pc 00000000000492d4  /apex/com.android.vndk.v33/lib64/libc++.so (demangling_terminate_handler()+208) (BuildId: ac7b79d1f77424245e84c9e5e12121c7)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #03 pc 0000000000049e84  /apex/com.android.vndk.v33/lib64/libc++.so (std::__terminate(void (*)())+12) (BuildId: ac7b79d1f77424245e84c9e5e12121c7)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #04 pc 00000000000494ec  /apex/com.android.vndk.v33/lib64/libc++.so (__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)+28) (BuildId: ac7b79d1f77424245e84c9e5e12121c7)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #05 pc 0000000000049450  /apex/com.android.vndk.v33/lib64/libc++.so (__cxa_throw+116) (BuildId: ac7b79d1f77424245e84c9e5e12121c7)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #06 pc 000000000009ae94  /apex/com.android.vndk.v33/lib64/libc++.so (std::__1::stoi(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long*, int)+384) (BuildId: ac7b79d1f77424245e84c9e5e12121c7)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #07 pc 000000000000ac38  /vendor/lib64/hw/[email protected] (device::sony::health::CycleCountBackupRestore::Read(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int&)+148) (BuildId: 47284e398f31910ce682e251b7e79c63)
01-01 00:07:31.370  5843  5843 F DEBUG   :       #08 pc 000000000000ab4c  /vendor/lib64/hw/[email protected] (device::sony::health::CycleCountBackupRestore::Restore()+36) (BuildId: 47284e398f31910ce682e251b7e79c63)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #09 pc 000000000000a1c0  /vendor/lib64/hw/[email protected] (device::sony::health::SonyHealth::SonyHealth(std::__1::unique_ptr<healthd_config, std::__1::default_delete<healthd_config> >&&)+116) (BuildId: 47284e398f31910ce682e251b7e79c63)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #10 pc 000000000000a0e0  /vendor/lib64/hw/[email protected] (HIDL_FETCH_IHealth+204) (BuildId: 47284e398f31910ce682e251b7e79c63)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #11 pc 0000000000052554  /apex/com.android.vndk.v33/lib64/libhidlbase.so (android::hardware::PassthroughServiceManager::get(android::hardware::hidl_string const&, android::hardware::hidl_string const&)::'lambda'(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::operator()(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const+92) (BuildId: 009bd5d0670c92352e8223126010f84e)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #12 pc 000000000004d70c  /apex/com.android.vndk.v33/lib64/libhidlbase.so (android::hardware::PassthroughServiceManager::openLibs(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<bool (void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&)+1372) (BuildId: 009bd5d0670c92352e8223126010f84e)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #13 pc 0000000000050970  /apex/com.android.vndk.v33/lib64/libhidlbase.so (android::hardware::PassthroughServiceManager::get(android::hardware::hidl_string const&, android::hardware::hidl_string const&)+92) (BuildId: 009bd5d0670c92352e8223126010f84e)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #14 pc 000000000004e770  /apex/com.android.vndk.v33/lib64/libhidlbase.so (android::hardware::details::getRawServiceInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, bool)+1608) (BuildId: 009bd5d0670c92352e8223126010f84e)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #15 pc 0000000000018b9c  /vendor/lib64/[email protected] (android::sp<android::hardware::health::V2_0::IHealth> android::hardware::details::getServiceInternal<android::hardware::health::V2_0::BpHwHealth, android::hardware::health::V2_0::IHealth, void, void>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, bool)+208) (BuildId: 0bcba204447d37ac45f9cf9e48429db2)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #16 pc 000000000000631c  /vendor/bin/hw/[email protected] (android::hardware::health::V2_0::IHealth::getService(char const*, bool)+188) (BuildId: 8b1c18b1dc0760c9d0c123f01bd46e1d)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #17 pc 0000000000006080  /vendor/bin/hw/[email protected] (main+44) (BuildId: 8b1c18b1dc0760c9d0c123f01bd46e1d)
01-01 00:07:31.371  5843  5843 F DEBUG   :       #18 pc 000000000004a1f4  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96) (BuildId: 2c82bf49529e9aa25cb9e5eca777a56f)
01-01 00:07:31.372  5843  5843 E crash_dump64: unable to connect to activity manager: No such file or directory
01-01 00:07:31.372   620   620 E tombstoned: Tombstone written to: tombstone_39
01-01 00:07:31.374     0     0 I init    : Service 'health-hal-2-1' (pid 5840) received signal 6
01-01 00:07:31.374     0     0 I init    : Sending signal 9 to service 'health-hal-2-1' (pid 5840) process group...
01-01 00:07:31.379     0     0 I libprocessgroup: Successfully killed process cgroup uid 1000 pid 5840 in 5ms
01-01 00:07:31.379     0     0 E init    : process with updatable components 'health-hal-2-1' exited 4 times before boot completed
01-01 00:07:31.380     0     0 I init    : Untracked pid 5845 exited with status 0
01-01 00:07:31.380     0     0 I init    : Untracked pid 5845 did not have an associated service entry and will not be reaped
01-01 00:07:31.380     0     0 I init    : Untracked pid 5843 exited with status 0
01-01 00:07:31.380     0     0 I init    : Untracked pid 5843 did not have an associated service entry and will not be reaped
01-01 00:07:31.380     0     0 I init    : processing action (sys.init.updatable_crashing=1) from (/system/etc/init/flags_health_check.rc:10)
01-01 00:07:31.380     0     0 I init    : starting service 'exec 111 (/system/bin/flags_health_check UPDATABLE_CRASHING)'...
01-01 00:07:31.381     0     0 I init    : SVC_EXEC service 'exec 111 (/system/bin/flags_health_check UPDATABLE_CRASHING)' pid 5848 (uid 1000 gid 1000+0 context default) started; waiting...
01-01 00:07:31.383  5848  5848 I flags_health_check: ServerConfigurableFlagsReset reset_mode value: 1
01-01 00:07:31.383  5848  5848 I flags_health_check: ServerConfigurableFlagsReset updatable crashing detected, resetting flags.```

This can be fixed by patching device/sony/common

diff --git a/hardware/health/CycleCountBackupRestore.cpp b/hardware/health/CycleCountBackupRestore.cpp
index 2207f60..7dad17f 100644
--- a/hardware/health/CycleCountBackupRestore.cpp
+++ b/hardware/health/CycleCountBackupRestore.cpp
@@ -86,12 +86,15 @@ void CycleCountBackupRestore::Read(const std::string &path, int &cycles) {
     buffer = ::android::base::Trim(buffer);
     try {
         cycles = std::stoi(buffer);
-    } catch (std::out_of_range &e) {
+    } catch (const std::out_of_range &e) {
         LOG(WARNING) << "Battery cycle count in persist storage file is out of bounds: " << path;
         return;
-    } catch (std::invalid_argument &e) {
+    } catch (const std::invalid_argument &e) {
         LOG(WARNING) << "Data format is wrong in persist storage file: " << path;
         return;
+    } catch (...) {
+        LOG(WARNING) << "Unknown exception when reading persist storage file: " << path;
+        return;
     }
     LOG(VERBOSE) << "Read " << cycles << " battery cycles from " << path;
 }

Fingerprint reader

FPC does not work. This is a known bug and described at https://github.com/sonyxperiadev/bug_tracker/issues/796

As FPC is attempted to start very frequently, it heats up the device fast. To disable, patch vendor/oss/fingerprint:

diff --git a/[email protected] b/[email protected]
index 1669dd1..075d1fd 100644
--- a/[email protected]
+++ b/[email protected]
@@ -1,7 +1,7 @@
-service fps_hal /vendor/bin/hw/[email protected]
-    # "class hal" causes a race condition on some devices due to files created
-    # in /data. As a workaround, postpone startup until later in boot once
-    # /data is mounted.
-    class late_start
-    user system
-    group system input uhid
+#service fps_hal /vendor/bin/hw/[email protected]
+#    # "class hal" causes a race condition on some devices due to files created
+#    # in /data. As a workaround, postpone startup until later in boot once
+#    # /data is mounted.
+#    class late_start
+#    user system
+#    group system input uhid

There maybe a better solution, I haven't looked for it.

WIFI connection leads to crash

Not reported yet, waiting for AOSP14. If connected to WIFI, device reboots.

No GSM

https://github.com/sonyxperiadev/bug_tracker/issues/847

No camera

https://github.com/sonyxperiadev/bug_tracker/issues/847

⚠️ **GitHub.com Fallback** ⚠️