[OFFICIAL] LineageOS 17.1 for Xperia Z3

Search This thread

jw243

Member
Mar 21, 2016
40
11
Thank you very much for your reply. This indeed fixed the problem.

However, I was extremely hopeful, that with this fix, my other rotation problem would be fixed as well, but it wasn't. Last night, before putting the phone into the charging dock, screen rotation worked flawlessly. And upon putting it into the dock, the screen switched, as intended, to landscape. However, when I took the phone out of its charging dock this morning, rotation of the screen was not possible anymore.

Could this bug at least be related to the bug above? Maybe it only appears on encrypted phones? Or it is related to using a charging dock?

I would be so greatful, if this bug would be fixed. I am actually considering exchanging the Z3 for another phone as this bug is so annoying.

Just to let you know: The bug has never appeared in stock rom. I have set up my phone several times by reflashing stock rom using FlashTool and trying it for a few days. After that, I followed the lineage installation instructions meticulously, and the bug appears everytime.
 

nikapos

Senior Member
Apr 17, 2014
146
31
i ve been using lineageos 17.1 with unencrypted phone, never had a rotation problem (although at some point i had noticed a feature to manually rotate the phone via a pop up button, which was gone in later versions).
 

nikapos

Senior Member
Apr 17, 2014
146
31
however, i have noticed this strange behaviour... left earbud is ont working. ok, problem with hardware i hear you say... thats what i thought... and then, after installing waze with really loud directions, the earbud came back to life! holy sh*t! now, i keep waze just to wake up the earbud!
 

Mr.Tom_Tom

Senior Member
Feb 16, 2008
145
177
Munich
[...] I was extremely hopeful, that with this fix, my other rotation problem would be fixed as well, but it wasn't. Last night, before putting the phone into the charging dock, screen rotation worked flawlessly. And upon putting it into the dock, the screen switched, as intended, to landscape. However, when I took the phone out of its charging dock this morning, rotation of the screen was not possible anymore.

Could this bug at least be related to the bug above? Maybe it only appears on encrypted phones? Or it is related to using a charging dock? [...]
Well, I was hoping that myself, but it was became quite quickly that both topics did not have the same root cause. To me, this is annoying as well.

At least I am able to reproduce the auto-rotation issue quite stable now, and it seems to not be related to encryption nor to any kind of charging dock. It seems to be related to some legacy library.

however, i have noticed this strange behaviour... left earbud is ont working. ok, problem with hardware i hear you say...
Exactly :sneaky:

thats what i thought... and then, after installing waze with really loud directions, the earbud came back to life!
Well, I still think it's hardware related. Just guessing, maybe there is some impedance/resistance measurement taken before the channel is switched to the earbuds. Try cleaning the connector carefully with some anti-corrosive cleaning fluid for electronics.
 
  • Like
Reactions: nikapos

Mr.Tom_Tom

Senior Member
Feb 16, 2008
145
177
Munich
To all users experiencing the auto-rotation issue ("Android [Screen] Rotation" stops working after 1-2 days usage):

@NeoArian suggested to try to replace the sensor binaries. If you want to support the bug hunting, you can replace
sensors.msm8974.so
and test this yourself:

  • Download the last AOSP binaries from:
  • Boot to recovery, mount /system rw
    • If you use Lineage Recovery:
      1. enable ADB,
      2. adb shell mount -w -t ext4 /dev/block/mmcblk0p23 /mnt/system
  • exchange vendor/lib/hw/sensors.msm8974.so with the file (same name) from that zip
    • adb push sensors.msm8974.so /mnt/system/system/vendor/lib/hw/sensors.msm8974.so
  • reboot to system
  • normally use your phone and wait a few days w/o rebooting if auto-rotation still works...
Unfortunately, there is no guarantee that this will help, but at least it is something we can try.

[UPDATE 06Mar2021] Well, we now know that this is not working, further analysis is ongoing.
 
Last edited:
  • Like
Reactions: nikapos and 0LDST4R

jw243

Member
Mar 21, 2016
40
11
On my phone, the rotation problem definately seems to be related to charging (in the dock). This morning, it was exactly the same: no rotation after charging in the dock, just as the last time.

adb shell mount -w -t ext4 /dev/block/mmcblk0p23 /mnt/system

Unfortunately, this command didn't work since /mnt/system didn't exist. I was able to get the file to the correct destination with the correct rights using Material Files, though.

The first thing I notice is that rotation seems to be much smoother. I will report, whether rotation will still be possible after the next charging.

Thanks for all your effort.
 

jw243

Member
Mar 21, 2016
40
11
I took the phone out of its charging dock this morning and again... rotation did't work! However, all sensors still work as shown by SatStat.

My guess is that it is a problem of the lineageOS build, not of the vendor libraries. Somehow, the rotation module does not interact with the working acceleration sensor.

I feel, that the following circumstances may play a role in this bug:
  • encryption of the phone
  • charging (using the charging dock)
  • start the charging from below 15%
I will do further testing on this.
 

Mr.Tom_Tom

Senior Member
Feb 16, 2008
145
177
Munich
Thanks @jw243 for your contribution to resolve this issue!

Regarding your comments:
  • Yes, I can confirm that simply replacing the sensors.msm8974 library does not help. I experienced that myself yesterday.
  • adb shell mount not working: It's working if you use Lineage Recovery, for TWRP the mount path may be different
  • encryption of the phone: I can't rule that out but it is quite unlikely
  • charging: I don't see coincidence here, I think I saw the issue happening overnight without charging
  • start the charging from below 15%: can't confirm that, but low bat could somehow be related
  • the rotation module does not interact with the working acceleration sensor: The sensor itself should report orientation independent from the raw accelerometer values. Consequently, a working accelerometer does not mean that the orientation feature is working as well.
  • [...] it is a problem of the lineageOS build, not of the vendor libraries: Well it seems to be the interaction between Lineage or AOSP in general and the libraries.
It could be helpful to get some logs shortly after orientation stops working.
 

jetman36

Member
Dec 26, 2012
44
10
Hey everyone, just ordered a supposid "new" unopened old stock xperia z3v out of nostalgia and was looking through reviews and forums until it arrives. came upon this tread thinking I might be able to somewhat update it but being a verizon variant, I'm not so sure. Anyone have any insight if this LOS ROM would work on the D6708? TIA
 

Aorin1

Member
Aug 16, 2015
26
7
I'm really enjoying Android 10 on the Xperia Z3 but I wonder how can I update the kernel, I need some resources I used in the Xperia SP, for use with mhl (KCall Support so I can turn the smartphone screen off while hooked to a TV) and even using DriveDroid which the current kernel won't allow me to, so I can't emulate a CD drive with the current older Kernel. I saw an updated one for MM, but I'm not sure if that would work with this rom.
 

netwave

Senior Member
Has anyone tried BiTGapps for the Z3 on Lineage? Wondering if its still working as that threads now closed & the download links are dead! Anyone got a backup? .. Also has anyone here experienced microG ? need to know what the best option is for an appstore,.. Always used minimal Gapps in the past but curious about these alternatives.
 

nikapos

Senior Member
Apr 17, 2014
146
31
Has anyone tried BiTGapps for the Z3 on Lineage? Wondering if its still working as that threads now closed & the download links are dead! Anyone got a backup? .. Also has anyone here experienced microG ? need to know what the best option is for an appstore,.. Always used minimal Gapps in the past but curious about these alternatives.
i was using bitgapps, but too much work after each updateof the rom i had to reinstall them. i think i still have some version of 4-6 months ago, if you re interested...
 

Mr.Tom_Tom

Senior Member
Feb 16, 2008
145
177
Munich
Anyone have any insight if this LOS ROM would work on the D6708?
I am pretty sure it won't work, sorry for that. There seem to be quite some differences with the hardware compared to a D6603. If you want to try building something yourself I'd be happy to hear if you are successful.

I'm really enjoying Android 10 on the Xperia Z3 but I wonder how can I update the kernel, I need some resources I used in the Xperia SP, for use with mhl [...]
It's hard to update the old kernel sources, but I would not give up hope that someday we might be able to run our devices with a mainline kernel. MSM8974 is pretty well supported already.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    If anybody is interested in new unofficial builds for Z3/Z3c/Z3dual with alternate wifi driver:

    1
    i ll try a direct upload. if it fails i ll try something else..
    1
    Hello,
    I have tried different Magisk from v20.4 to v22.0, and use the new way(v22.0) to flash new boot.img repacked by Magisk-v22.0.apk, but didn't work.
    It seems only Magisk 20.4 working.

    BTW, my current recovery is "lineage-17.1-20200911-recovery-UNOFFICIAL-z3".
    Magisk v22.0 was killing my WiFi but thought to myself.. What If were downloading files from spoof sites which are designed to look official?
    The original developer of Magisk is a guy call John WU, I checked out his profile & XDA thread here: Link but he was Last seen Oct 13, 2020. Hence his Magisk builds are out dated!
    His latest development can be officially downloaded from the Github here:
    Magisk Genuine updates Its worth bookmarking this & avoiding all other fake websites that ultimately screw things up as re-downloaded v22.0 to find every things working as It should :)
    1
    Follow-up on the auto-rotation issue ("Android [Screen] Rotation" stops working after 1-2 days usage):
    Last night, before putting the phone into the charging dock, screen rotation worked flawlessly. And upon putting it into the dock, the screen switched, as intended, to landscape. However, when I took the phone out of its charging dock this morning, rotation of the screen was not possible anymore.
    Analysis of this issue is still ongoing. Whoever experiences a similar problem, you can help:

    If the problem occurs, do not reboot your phone but run the following adb commands:

    • Code:
      adb shell uptime
      --> Please check if the reported time and uptime is consistent (ideally you have taken a note with a timestamp when you started your phone the last time)
    • Code:
      adb shell cat /proc/uptime
      --> Check if the first number [in seconds] matches the uptime reported above
    Some background info: The service which is managing the screen orientation frequently ("WindowOrientationListener") takes some timestamps to avoid some false interpretations, e.g. that the screen orientation changes while the user touches the screen. It then waits some milliseconds before an orientation is considered "valid". In several cases I saw that something is wrong with the timestamps, basically making the WindowOrientationListener waiting forever. I want to rule out that there is something wrong with the timekeeping of our ROM in general, e.g. an undetected rollover issue.

    [Update 01 Apr 2021]
    Issue is finally understood I guess. Our kernel and sensor HAL use some processor ticks to generate timestamps. In certain scenarios (probably related to deep sleep) the counter is reset, which is then obviously creating a delta compared to the elapsed uptime. This is then causing the WindowOrientationListener to wait forever.

    Fortunately, there is a good workaround implemented by Lineage already, we just have to enable that.

    TL;DR
    Need some more testing but I am optimistic we will have a fix implemented in official builds soon.

    As a hot fix you may replace the following file in system/vendor/overlay/ by the one attached. (Warning: I did not test this yet. May work for z3 only, not for z3dual)

    I also uploaded a new build for the z3 here:
    1
    Update on the Auto-rotation issue: Fix is finally merged into Lineage 17.1 official. Builds after 09 April 2021 will have it incorporated.
  • 6
    lineage_strip_teal.png

    LineageOS is a free, community built, aftermarket firmware distribution of Android 10 (Q), which is designed to increase performance and reliability over stock Android for your device. LineageOS is based on the Android Open Source Project (AOSP) and can be used without the need to have any Google application installed.

    Installation:
    If you are on stock OS, you need a custom recovery first. You can get the recommended recovery in the official installation instructions link below. There are also inofficial TWRP recovery builds available - if you want to use TWRP you need to ensure that it is compatible with Android 10.
    If you are coming from stock or other ROMs, you need to make a factory reset.
    As always, make sure to backup before installing this ROM.

    Detailed instructions:
    Install LineageOS on z3

    Downloads:
    • ROM and Recovery: LineageOS Downloads for z3 - Note: as of 11Sep2020, the official recovery is not working. The issue is being addressed already. See below for options.
    • Google Apps (optional): Open GApps (choose ARM as Platform and Android 10)

    Changelog:
    Changes for z3

    Source Code
    The source code of LineageOS is available here. If you would like to contribute to LineageOS, please visit out Gerrit Code Review.
    • The z3 device tree is available here.
    • The kernel source code for this device is available here. The used configuration is lineageos_shinano_leo_defconfig available at arch/arm/configs/lineageos_shinano_leo_defconfig in the kernel source.

    Bug reports:
    How to submit a bug report
    LineageOS GitLab

    Donate to support development:
    Donate via PayPal to NeoArian *** Our main contributor for LineageOS 16 & 17 for Z3 and Z3 Compact ***
    Donate via PayPal to LineageOS

    Thanksgiving
    Thanks to everyone who ever contributed to the custom development for this device, especially:
    @nailyk
    @rcstar6696
    @tomascus
    @Diewi
    @xkeita
    @drakonizer

    XDA:DevDB Information
    LineageOS 17.1 for Xperia Z3, ROM for the Sony Xperia Z3

    Contributors
    Mr.Tom_Tom, NeoArian, Myself5
    Source Code: https://github.com/LineageOS

    ROM OS Version: Android 10
    ROM Kernel: Linux 3.4.x
    ROM Firmware Required: 23.5.A.1.291
    Based On: LineageOS

    Version Information
    Status:
    Nightly

    Created 2020-09-11
    Last Updated 2020-09-12
    5
    Working on Wifi (5GHz) issues

    I have been working on implementing an updated wifi driver into our kernel to fix the reported wifi issues (only some countries are affected). You can follow this thread for details.

    I need some feedback from people in these affected countries with a Z3/Z3c/Z3Dual to see if the new builds work. I would appreciate if you test one of these builds here and send me a full log.


    @TheShadowOfAGhost20 @mer5ad @giannhs_n @yahyazadeh58 @navidmafi
    5
    If anybody is interested in new unofficial builds for Z3/Z3c/Z3dual with alternate wifi driver:

    4
    Flashed FTF_23.5.A.1.291 customized GEL using Flashtool (on 6603 Z3) booted, all good with stock Sony ROM. WiFi connects to Synology 2600 router and to Netgear RE305 wifi extender. ROM works fine, rebooted, no problem. Then adb install TWRP recovery, rebooted to recovery, wiped/factory reset, and flashed v 17.1 + installed BiTGapps. Rebooted, v17.1 LOS booted up fine (with USA SIM card) on Ver. 17.1 LOS but now WiFi does NOT connect to same Synology 2600 (no changes to router), but does connect to RE305.

    Why does the WiFi connect on stock Sony .291 ROM but not on LOS v 17.1? I've tried all combinations of changes at the router, not a firewall issue, not authentication, every other device I have connects to router no problem. Something was deleted/changed on Z3 when v17.1 installed. Previously tried installing v16 LOS same problem on top of same .291 customized GEL ROM. Do I need to try a different FTF?

    Any suggestions/help appreciated. Otherwise, will have to go back to Sony 291. Thank you.

    Update: Flashed customized US .291, booted up, connected to 2.4ghz and 5ghz wifi on stock Sony .291 ROM, no problem. However, after install of both nightly 17.1 and older "unofficial" 17.1 I cannot connect to either 2.4 or 5 ghz on Synology 2600ac router. Very confusing.
    @golden7 Thanks for sharing your experience. The wifi driver and regulatory settings in our official LineageOS based ROMs are very outdated. I have been working hard in upgrading that, but this is still experimental. Could you run a test with a ROM from this thread here, report if you can connect to your ac router and send me a logfile? First reports look promising. This would help a lot! If it works for you, I can send you a link to a build with SELinux enabled so that it can be used as a daily driver already.
    3
    Remarks, Questions & Answers

    Known Major Issues

    • Official Lineage Recovery is currently broken. There are two options:
    • WiFi issues in some countries (e.g. Iran): low speed @ 5GHz, hotspot and connection issues. This topic is related to a dirty workaround. A solution is here but will not be integrated into our official Lineage kernel.
    • Disk Encryption: Disk Encryption is working, however not with the default password (no password). Workaround: Set password first, then start disk encryption, not the other way round! Solved
    • Bluetooth Low Power may create wakelocks in certain scenarios.* Solved
    • Thermal throttling of CPU cores: Due to a design issue of the thermal manager ("Thermanager") when used with older kernels like ours you have to expect that the frequency throttling of the CPU cores may fail, especially after(!) the device was getting hot and is recovering. This may lead to performance issues until reboot and other issues. Workaround: reboot device after heavy use.*
    • Reported size of adoptable storage seems to be wrong. However, remaining free space seems to be reported accurately.
    • Formating a SD card as internal storage may cause the card to be reported as "corrupted".
    • Screen rotation may not work after a while. Solved, to be integrated into builds from mid April 2021 onwards.
    • You tell us (with logs please)...
    * To our knowledge, these are general issues on all AOSP/LineageOS based custom ROMs for this device family (Shinano). However I would be happy to be mistaken here and if sombody has a solution.

    Further hints
    • This ROM currently does not work with the Z3 Dual SIM variant. Here's a build for the Z3dual.
    • If you need Google Apps we recommend the OpenGApps "nano" package, however, I personally use the "stock" package which works as well. The ROM also seems to work with MicroG and BiTGApps.
    • Magisk - see this post for issues with latest Magisk versions
    • If you need to install a lot of apps you may run out of internal DATA storage capacity, especially if you install one of the larger GAPPS packages. These apps are initially placed on the system partition and do not cost you DATA capacity. However, every update which comes over the Play Store then fills up your data partition. Using an SD card formated as "external" storage does not help you much (unless you use a tool like app2sd which is no more recommended) and isn't encrypted. Formating the SD card as "adoptable storage" comes with the drawback that some apps do not allow to be migrated to this storage, and unfortunately this is true for some streaming music/video apps which need to store a lot of data obviously (for offline use). The solution I am using is to partition a SD card as "mixed", which gives you the possibility to offload at least some apps to adoptable storage while you still have a classical external FAT32 partition where e.g. your streaming app can save its offline files:

      1. Find a large (I tested a 400GB microSDXC card) and fast ("A1" or higher) Micro SD card.
      2. Follow this guide to partition your SD card. Note: all data on the card will be lost.
      3. Restart your phone.
      4. When you are notified that a new storage card has been detected, use it as "external". (Your internal partition has been recognized at that point already and does not need interaction.)
      5. Go to settings / Storage. Verify that you see three entries: 1. Your internal phone storage of 16GB. This includes your SYSTEM partition. 2. Your SD card with an SD card symbol. The size shown should be the full capacity of the card. If you click on it, your "external" partition is shown (misleading) as "System" and blocked. Click on migrate data to migrate all possible apps to your adoptable storage. 3. Your sd card partition formated as mobile storage (unencrypted!).
    • How to create logs:

      • Follow How To Logcat
      • If your device randomly reboots:
        Go to Settings -> System -> Advanced -> Developer options -> Store logger data persistently on device. After the reboot occured: Pull the logs from /data/misc/logd/ (root required).
      • If your device crashes during boot and reboots to recovery:
        Code:
        adb pull /proc/last_kmsg
      • Please submit logs from clean systems without "Exposed" or similar modifications in place

    Your feedback is wanted
    • Screen rotation: See this post (thanks @jw243). Do you experience similar issues?

    A big THANK YOU also to @ronnay ryukay for having maintained the inofficial 17.1 thread!
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone