[RECOVERY][Unofficial][amami] TWRP 3.4.0

Search This thread

115ek

Senior Member
Jan 30, 2017
553
623
Finally there is a TWRP capable of decrypting /data on android versions > nougat.
Big thanks @NeoArian :)

I haven't tested everything in detail as I mostly focused on decryption. If you experience issues or can confirm something working that's not green in the table down below, please share.

Code:
#include <std_disclaimer.h>

/*
 * Your warranty is now void.
 *
 * We are not responsible for bricked devices, dead SD cards,
 * thermonuclear war or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at us for messing up your device, we will laugh at you. Hard & a lot.
 *
 */

Status
List template by TWRP
Code:
[B]Blocking checks[/B]
- [COLOR="green"]Correct screen/recovery size[/COLOR]
- [COLOR="green"]Working Touch, screen[/COLOR]
- [COLOR="green"]Backup to internal/microSD[/COLOR]
- Restore from internal/microSD
- [COLOR="green"]reboot to system[/COLOR]
- [COLOR="green"]ADB[/COLOR]
 
[B]Medium checks[/B]
- update.zip sideload
- [COLOR="green"]UI colors (red/blue inversions)[/COLOR]
- [COLOR="green"]Screen goes off (and on :))[/COLOR]
- F2FS/EXT4 Support, exFAT/NTFS where supported
- [COLOR="green"]all important partitions listed in mount/backup lists[/COLOR]
- backup/restore to/from external (USB-OTG) storage
- backup/restore to/from adb
- [COLOR="green"]decrypt /data[/COLOR]
- Correct date
 
[B]Minor checks[/B]
- MTP export
- [COLOR="green"]reboot to bootloader[/COLOR]
- [COLOR="green"]reboot to recovery[/COLOR]
- [COLOR="green"]poweroff[/COLOR]
- [COLOR="green"]battery level[/COLOR]
- [COLOR="green"]temperature[/COLOR]
- encrypted backups
- [COLOR="green"]input devices via USB (USB-OTG) - keyboard, mouse[/COLOR]
- USB mass storage export
- [COLOR="green"]set brightness[/COLOR]
- [COLOR="green"]vibrate[/COLOR]
- [COLOR="green"]screenshot[/COLOR]

Limitations
Following limitations are known:
  • none
prerequisites
For reboot to recovery from your android system (and OTA updates) your ROM needs the following patches 1, 2 and 3. Following ROM's currently support this:
For correct time inside TWRP your ROM needs the following patch. Following ROM's currently support this:
Download
How to build

XDA:DevDB Information
[RECOVERY][Unofficial][amami] TWRP 3.4.0, Tool/Utility for the Sony Xperia Z1 Compact

Contributors
115ek, NeoArian
Source Code: https://github.com/115ek/twrp_device_sony_amami


Version Information
Status: Beta

Created 2019-08-25
Last Updated 2020-08-22
 
Last edited:

115ek

Senior Member
Jan 30, 2017
553
623
Changelog

15.09.2020 3.4.0-1
  • again: fix non working OTA update in rare cases (rebooting to recovery and stucking there unable to install update automatically)
22.08.2020 3.4.0-0
  • latest TWRP changes
29.02.2020 3.3.1-0.4
  • display sony bootlogo at boot
  • show version number
  • remove TWRP app
19.09.2019 3.3.1-0.3
  • fix non working OTA update (rebooting to recovery and stucking there unable to install update automatically)
05.09.2019 3.3.1-0.2
  • enable reboot to bootloader (fastboot mode) (you have to connect the phone via usb BEFORE rebooting)
25.08.2019 3.3.1-0.1
  • decrease size
  • allow decryption in any case of patchlevel value
25.08.2019 3.3.1-0
  • initial release
 
Last edited:

bananabytes

Member
Sep 6, 2016
31
7
I uploaded a new build 3.3.1-0.1 with decreased size and a "more clean" way to allow /data decryption.
Furthermore I thought about getting this official.
BTW: You won't see the increased version number in TWRP. It's still 3.1.1-0

Hi, thank you for this build. I was waiting to try Pie on my z1 compact and I'm glad I did because the version of TWRP was blocking my use of encryption.

Sadly I didn't have luck installing the latest builds (the ones from 3 days ago and one week ago) on my Z1 Compact. I got this error:

Code:
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.

When trying to flash to recovery partition. The same command worked to flash back to 3.2.3 (not sure if necessary, done just in case). If there's any way you could look into these builds I'd appreciate it!
 
Last edited:

115ek

Senior Member
Jan 30, 2017
553
623
Hi, thank you for this build. I was waiting to try Pie on my z1 compact and I'm glad I did because the version of TWRP was blocking my use of encryption.

Sadly I didn't have luck installing the latest builds (the ones from 3 days ago and one week ago) on my Z1 Compact. I got this error:

Code:
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.

When trying to flash to recovery partition. The same command worked to flash back to 3.2.3 (not sure if necessary, done just in case). If there's any way you could look into these builds I'd appreciate it!

What command did you use?
Code:
fastboot flash recovery
or
Code:
fastboot flash FOTAKernel

Do you have the newest bootloader installed? So can you boot directly into recovery with VOL down and power pressed (with 3.2.3 version where flashing was successful)?
Or do you use the method with pressing VOL down when the LED lights up?

EDIT:
By looking at your error code I get the feeling it has something to do with fastboot directly. libsparse is a build dependency of the fastboot binary.
What version of fastboot are you using?
I'm using fastboot installed from the packetmanager with
Code:
apt install fastboot
.
Code:
fastboot --version
gives fastboot version 1:8.1.0+r23-5~18.04.
This would mean 27.0.0 or 27.0.1 according to this scheme. I don't know why they are using different naming schema :confused:

However, I'd guess you're using an outdated version (or a very current one - but I don't think so).
 
Last edited:
  • Like
Reactions: bananabytes

bananabytes

Member
Sep 6, 2016
31
7
What command did you use?.

I used fastboot flash recovery, with the newest bootloader. This time I got into recovery by selecting it in my older TWRP because I always get the up/down method mixed up, I have done it before it's just easier that way.

By looking at your error code I get the feeling it has something to do with fastboot directly. libsparse is a build dependency of the fastboot binary.
...
However, I'd guess you're using an outdated version (or a very current one - but I don't think so).

I am actually indeed using a very current version, 29.0.2 (so your second less likely guess was correct!) I'm on Manjaro/Arch so we get the bleeding edge updates unlike if you are on a Debian/Ubuntu system that's tied to a lot of different libraries and held back. This is exactly why I stopped using those distros but this is the first time I've had the problem in reverse. I don't know if this is a bug that was introduced into fastboot or what. I do see that the more recent versions have things to do with partitioning. This may be a bug to open with fastboot or to look into further with them? But if it's not a bug with them it would be good to have the build working on the latest fastboot.
 

115ek

Senior Member
Jan 30, 2017
553
623
I used fastboot flash recovery, with the newest bootloader. This time I got into recovery by selecting it in my older TWRP because I always get the up/down method mixed up, I have done it before it's just easier that way.



I am actually indeed using a very current version, 29.0.2 (so your second less likely guess was correct!) I'm on Manjaro/Arch so we get the bleeding edge updates unlike if you are on a Debian/Ubuntu system that's tied to a lot of different libraries and held back. This is exactly why I stopped using those distros but this is the first time I've had the problem in reverse. I don't know if this is a bug that was introduced into fastboot or what. I do see that the more recent versions have things to do with partitioning. This may be a bug to open with fastboot or to look into further with them? But if it's not a bug with them it would be good to have the build working on the latest fastboot.

Can you please verify that you also fail with the fastboot binary from here
It's also 29.0.2 and it works fine for me.
 

115ek

Senior Member
Jan 30, 2017
553
623
  • boot to fastboot is not possible
Well, I actually didn't know this was possible in earlier versions. However it should work now ;) --> see the changelog
You have to connect usb cable before rebooting to bootloader, otherwise it won't work and just reboot the system.

  • backup and restore of boot is not possible
I can't confirm that. What exactly was the problem for you? Backing up or restoring? Did you got any errors?
 
  • Like
Reactions: tramp20

tramp20

Senior Member
Jan 15, 2012
736
138
Rosenheim
@115ek,
I have a mysterious problem with 3.3.1-0.0.and 3.3.1-0.1:
I used all twrp versions before without problems and now your twrp did not show the correct date (1970-xx-xx) and time (7-8 hours back).
I tried the following several times:
1. reflash your twrp, clear recovery and flash again,
2. flash older versions: date and time was wrong even after reboot

The only way to get the correct date/time back in twrp was (at least for me) flash stock ROM with EMMA and after flashing twrp 3.2.3 my backup.

I do not want to repeat this as this is a lot of work incl. copying back the internal storage.
 

115ek

Senior Member
Jan 30, 2017
553
623
@115ek,
I have a mysterious problem with 3.3.1-0.0.and 3.3.1-0.1:
I used all twrp versions before without problems and now your twrp did not show the correct date (1970-xx-xx) and time (7-8 hours back).
I tried the following several times:
1. reflash your twrp, clear recovery and flash again,
2. flash older versions: date and time was wrong even after reboot

The only way to get the correct date/time back in twrp was (at least for me) flash stock ROM with EMMA and after flashing twrp 3.2.3 my backup.

I do not want to repeat this as this is a lot of work incl. copying back the internal storage.

Can you try the latest version?
At first you have to set the right timezone in TWRP settings.
The time is stored in a real time clock (RTC) which runs even if the device is powered off. Setting and reading it's value is done by a kernel driver. If you set the right time in android system it gets stored in the RTC. Then, if you boot into TWRP, the time is read again. And for me this works fine. However it takes some seconds (there's a wrong time at the beginning).
 

tramp20

Senior Member
Jan 15, 2012
736
138
Rosenheim
Can you try the latest version?
At first you have to set the right timezone in TWRP settings.
The time is stored in a real time clock (RTC) which runs even if the device is powered off. Setting and reading it's value is done by a kernel driver. If you set the right time in android system it gets stored in the RTC. Then, if you boot into TWRP, the time is read again.

Thank you. I know this all, I tried reset to default in TWRP and set TZ etc. but these two mentioned TWRP versions do not read the RTC time (AICP ROM).
All TWRP versions before were ok. I tried this several times.
I noticed this "bug" on my Z1c after a backup with your TWRP (Date from 1970 and a complete false time even after setting the TZ).
Even after flashing one of the older TWRP date/time are wrong (only in TWRP), after booting to Android date/time is correct until I boot to TWRP again.
As I wrote the way back to a correct date/time in TWRP was for me flashing stock ROM with EMMA.

Where is this "kernel driver"? In your TWRP version or in a hidden partition? Sorry I do not know much of these internals.

I assume you did not change in the newest version something regarding this problem.
I have not the time to try the last version for now :(
 

lm089

Senior Member
Jun 26, 2011
500
161
Munich
Generic question re: encrypting this device

Installed this twrp version and (unlike others) I don't see anything strange. Only thing I haven't tried so far is restoring a nandroid backup I created with this twrp release.
A few days back after I had installed this the first time Itried to encrypt my phone; after a while I received the message that encryption was completed.
Then upon reboot of the device I had to unlock it even before boot sequence had started. Aftter unlocking booting resumed and from then on everything appeared to be as before.
This surprised me a bit because on my other phone (OnePlus6 running stock OOS Pie) I have to unlock after boot sequence has completed. But OK, this may be the LOS 16 way.
Then I devided to unencrypt the phone (this is my secondary device and I only use it for playing around a bit, until I decide to sell it, maybe). Again, from my OP6 I'm used to the fact that if I remove any device locking pattern encryption is gone. But obviously not on my Z1c: after I had removed the security pattern (= set security to nothing) everything appeared to be normal. But after the next reboot all data were gone.

Question: is there a supported way to unencrypt this phone without losing any data?
If there isn't such a way: what happens to my Nandroid backups I took while the phone was encrypted? Are they still usable e.g. after I install a ROM update?
 

115ek

Senior Member
Jan 30, 2017
553
623
Thank you. I know this all, I tried reset to default in TWRP and set TZ etc. but these two mentioned TWRP versions do not read the RTC time (AICP ROM).
All TWRP versions before were ok. I tried this several times.
I noticed this "bug" on my Z1c after a backup with your TWRP (Date from 1970 and a complete false time even after setting the TZ).
Even after flashing one of the older TWRP date/time are wrong (only in TWRP), after booting to Android date/time is correct until I boot to TWRP again.
As I wrote the way back to a correct date/time in TWRP was for me flashing stock ROM with EMMA.

Where is this "kernel driver"? In your TWRP version or in a hidden partition? Sorry I do not know much of these internals.

I assume you did not change in the newest version something regarding this problem.
I have not the time to try the last version for now :(

Flashing stock ROM isn't necessary - I'm 99% sure. Maybe you can get a log with
Code:
adb pull /tmp/recovery.log
while your in TWRP and connected to a PC...
The kernel driver is - as the name says - located in the kernel, which is part of the recovery.img
So everyone flashing this image should have the same functionality (in theory). As it works for me (and some others) I'm just wondering. :rolleyes:

Installed this twrp version and (unlike others) I don't see anything strange. Only thing I haven't tried so far is restoring a nandroid backup I created with this twrp release.
A few days back after I had installed this the first time Itried to encrypt my phone; after a while I received the message that encryption was completed.
Then upon reboot of the device I had to unlock it even before boot sequence had started. Aftter unlocking booting resumed and from then on everything appeared to be as before.
This surprised me a bit because on my other phone (OnePlus6 running stock OOS Pie) I have to unlock after boot sequence has completed. But OK, this may be the LOS 16 way.
Then I devided to unencrypt the phone (this is my secondary device and I only use it for playing around a bit, until I decide to sell it, maybe). Again, from my OP6 I'm used to the fact that if I remove any device locking pattern encryption is gone. But obviously not on my Z1c: after I had removed the security pattern (= set security to nothing) everything appeared to be normal. But after the next reboot all data were gone.

Question: is there a supported way to unencrypt this phone without losing any data?
If there isn't such a way: what happens to my Nandroid backups I took while the phone was encrypted? Are they still usable e.g. after I install a ROM update?

The behaviour is totally expected as amami uses the deprecated full disk encryption (FDE). Most likely your oneplus 6 is using file based encryption (FBE). That's the reason it can boot to your lockscreen because some files necessary for booting aren't encrypted (or not encrypted using your password...). To boot a device with fully encrypted /data you have to decrypt it first. If you're interested in details have a look here.

The other thing sounds a bit strange. However I don't know if it's possible to remove the FDE completely. Maybe the device just sets a default password then? :confused:

Concerning your question:
What definitely should work is taking a backup in TWRP (of course need to decrypt /data before), then format /data and restore the backup. Anyhow - I didn't test such a case so far.
 
  • Like
Reactions: lm089

tramp20

Senior Member
Jan 15, 2012
736
138
Rosenheim
Flashing stock ROM isn't necessary - I'm 99% sure. Maybe you can get a log with
Code:
adb pull /tmp/recovery.log
while your in TWRP and connected to a PC...
The kernel driver is - as the name says - located in the kernel, which is part of the recovery.img

Flashing stock ROM was the only way that all older TWRP could read the correct date again after trying your twrp version.
I will try to get a log if I have enough time.
So the recovery.img = twrp.img or at least a part of it?

Thank you.
 

115ek

Senior Member
Jan 30, 2017
553
623
New update:
As I had problems with installing OTA updates (especially with /data encrypted, but not limited to) on LineageOS 16.0 I came up with a fix.
Download Currently only on sourceforge - android filehost is buggy at the moment...

19.09.2019 3.3.1-0.3
  • fix non working OTA update (rebooting to recovery and stucking there unable to install update automatically)

Edit:
As reminder for me / interested guys: This commit breaks the OTA updating in some cases (when mmap isn't sufficient). The buildflag
Code:
-D_FILE_OFFSET_BITS=64
doesn't work as intended on my setup. Maybe I missed something.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    Finally there is a TWRP capable of decrypting /data on android versions > nougat.
    Big thanks @NeoArian :)

    I haven't tested everything in detail as I mostly focused on decryption. If you experience issues or can confirm something working that's not green in the table down below, please share.

    Code:
    #include <std_disclaimer.h>
    
    /*
     * Your warranty is now void.
     *
     * We are not responsible for bricked devices, dead SD cards,
     * thermonuclear war or you getting fired because the alarm app failed. Please
     * do some research if you have any concerns about features included in this ROM
     * before flashing it! YOU are choosing to make these modifications, and if
     * you point the finger at us for messing up your device, we will laugh at you. Hard & a lot.
     *
     */

    Status
    List template by TWRP
    Code:
    [B]Blocking checks[/B]
    - [COLOR="green"]Correct screen/recovery size[/COLOR]
    - [COLOR="green"]Working Touch, screen[/COLOR]
    - [COLOR="green"]Backup to internal/microSD[/COLOR]
    - Restore from internal/microSD
    - [COLOR="green"]reboot to system[/COLOR]
    - [COLOR="green"]ADB[/COLOR]
     
    [B]Medium checks[/B]
    - update.zip sideload
    - [COLOR="green"]UI colors (red/blue inversions)[/COLOR]
    - [COLOR="green"]Screen goes off (and on :))[/COLOR]
    - F2FS/EXT4 Support, exFAT/NTFS where supported
    - [COLOR="green"]all important partitions listed in mount/backup lists[/COLOR]
    - backup/restore to/from external (USB-OTG) storage
    - backup/restore to/from adb
    - [COLOR="green"]decrypt /data[/COLOR]
    - Correct date
     
    [B]Minor checks[/B]
    - MTP export
    - [COLOR="green"]reboot to bootloader[/COLOR]
    - [COLOR="green"]reboot to recovery[/COLOR]
    - [COLOR="green"]poweroff[/COLOR]
    - [COLOR="green"]battery level[/COLOR]
    - [COLOR="green"]temperature[/COLOR]
    - encrypted backups
    - [COLOR="green"]input devices via USB (USB-OTG) - keyboard, mouse[/COLOR]
    - USB mass storage export
    - [COLOR="green"]set brightness[/COLOR]
    - [COLOR="green"]vibrate[/COLOR]
    - [COLOR="green"]screenshot[/COLOR]

    Limitations
    Following limitations are known:
    • none
    prerequisites
    For reboot to recovery from your android system (and OTA updates) your ROM needs the following patches 1, 2 and 3. Following ROM's currently support this:
    For correct time inside TWRP your ROM needs the following patch. Following ROM's currently support this:
    Download
    How to build

    XDA:DevDB Information
    [RECOVERY][Unofficial][amami] TWRP 3.4.0, Tool/Utility for the Sony Xperia Z1 Compact

    Contributors
    115ek, NeoArian
    Source Code: https://github.com/115ek/twrp_device_sony_amami


    Version Information
    Status: Beta

    Created 2019-08-25
    Last Updated 2020-08-22
    4
    I uploaded a new version. Nothing critical changed but:
    • Sony bootlogo is now displayed
    • TWRP (sub)version number is now displayed to avoid confusion
    • TWRP app is excluded (as there isn't any use if we're not official)
    4
    I uploaded a new build 3.3.1-0.1 with decreased size and a "more clean" way to allow /data decryption.
    Furthermore I thought about getting this official.
    BTW: You won't see the increased version number in TWRP. It's still 3.1.1-0
    4
    New update:
    As I had problems with installing OTA updates (especially with /data encrypted, but not limited to) on LineageOS 16.0 I came up with a fix.
    Download Currently only on sourceforge - android filehost is buggy at the moment...

    19.09.2019 3.3.1-0.3
    • fix non working OTA update (rebooting to recovery and stucking there unable to install update automatically)

    Edit:
    As reminder for me / interested guys: This commit breaks the OTA updating in some cases (when mmap isn't sufficient). The buildflag
    Code:
    -D_FILE_OFFSET_BITS=64
    doesn't work as intended on my setup. Maybe I missed something.
    3
    Changelog

    15.09.2020 3.4.0-1
    • again: fix non working OTA update in rare cases (rebooting to recovery and stucking there unable to install update automatically)
    22.08.2020 3.4.0-0
    • latest TWRP changes
    29.02.2020 3.3.1-0.4
    • display sony bootlogo at boot
    • show version number
    • remove TWRP app
    19.09.2019 3.3.1-0.3
    • fix non working OTA update (rebooting to recovery and stucking there unable to install update automatically)
    05.09.2019 3.3.1-0.2
    • enable reboot to bootloader (fastboot mode) (you have to connect the phone via usb BEFORE rebooting)
    25.08.2019 3.3.1-0.1
    • decrease size
    • allow decryption in any case of patchlevel value
    25.08.2019 3.3.1-0
    • initial release