yashsingh1/xdaforums huggingface dataset:
[Xperia Z1 Original Android Development] Ronindjinnh:
Breaking the seal

As a long time fan and user of XDA and custom roms, my feedback or contribution is long, long ovedue. As a proud Jaguar user I can say that it is truly valuable work like the security and privacy of this ROM that compels me to *finally* give a big THANKS for your contributions. Whilst I value and respect all of the work done by the developer community, it is the focus on privacy and security that I am most grateful for. Cheers optimumpro! :good::good:

Would love to donate but this noob here hasn't yet figured out how to do so using bitcoins :crying: Paypal and CCs may attract unwanted Russian or Chinese attention lolz
[Xperia Z1 Original Android Development] optimumpro:
The problem that I can think of may be in TWRP. If you flash the rom via a different TWRP, it could have formatted data with different parameters. You should always set TWRP to wipe data via -rm -rf, instead of formatting the whole partition. Then when you flash the rom, you should get the correct data.

As far as I can see, I have a '-16834 flag', which means there is always space for footer to prevent "bad magic."

So, the solution would be to first flash my TWRP and then flash the rom with it...

Edit: I am going to wipe my phone and do a new installation to try to reproduce the error., but I did use June 28 release and encryption worked fine. And since then, I simply used my TWRP to upgrade...
[Xperia Z1 Original Android Development] Jbazt_katuforzs:
im using twrp-3.0.0-0-honami with no problems btw.

can you release a quick patch for the buildprop with enabled agps?

use this gapps if you all want to fix AOSP keyboard error. i prefer to use it more than google keyboard

https://www.androidfilehost.com/?fid=4996500813288308963
[Xperia Z1 Original Android Development] coolboy744:
Do something for VOLTE. my model is C6903
[Xperia Z1 Original Android Development] optimumpro:
Did you set Volte on in Settings/More/Cellular Networks? What country/provider are you in? Does Volte work for you on any other rom? If you are in the US, you are out of luck, as Volte is only allowed on carrier branded phones...
[Xperia Z1 Original Android Development] optimumpro:
Can't you just use root explorer or any other root file manager and edit build.prop?
[Xperia Z1 Original Android Development] coolboy744:
edited but not working.
[Xperia Z1 Original Android Development] Jbazt_katuforzs:
---------- Post added at 01:13 PM ---------- Previous post was at 01:13 PM ----------

[/COLOR]

i did. copy the orig build prop to sd card, then edit the one in system /etc, it gave like changes saved to .bak that i cant find in system/etc. checked the buildprop, its not changed. so i deleted the orig buildprop in system/etc, edit the buildprop i saved in sd and successfully paste it in system/etc and changed the permission to rw-r-r then reboot and it wont boot.
[Xperia Z1 Original Android Development] optimumpro:
Build.prop is not in /system/etc. It is in /system/: wrong directory - no boot. You can use KernelAdiutor to edit build.prop directly...
[Xperia Z1 Original Android Development] Jbazt_katuforzs:
yes sorry my bad. its in /sytem just said the wrong path. and you cant find buildprop in /system/etc so its my mistake. but i edited it and it wont boot. ill try to use KernelAdiutor thanks

edit: no success after editing. still forced closed play services when using high accuracy or battery saver. is this issue is present from the initial released as well? hope next update this be gone. aside from that this most stable custom 5.1.1 rom for my Z1 so far. Thanks a lot
[Xperia Z1 Original Android Development] smith314:
I used June28 TWRP to flash the rom. Moreover I tried to bypass the TWRP formating by creating the fs myself via mke2fs with appropriate space at the end and flashing without wiping after that but it didn't worked.

Since I seem to be the only one who has this kind of problem I maybe done something wrong that is persistent against wiping. Is there a way to completely reset the phone including partitioning and such things?
[Xperia Z1 Original Android Development] optimumpro:
You are not alone. I wiped my phone a few days ago and now I can't encrypt it either. What is interesting is that flashing a latest stock firmware renders "file system overlaps footer region." Then when I reduce the size, there are other errors, such as "unable to generate master key." I have already tried tens of different options to no avail. But I'll keep working on it...

Edit: And TWRP, as it turns out, does not change partition sizes unless you manually force it to. It just formats it (no resizing)...
[Xperia Z1 Original Android Development] optimumpro:
For anyone unable to encrypt the phone with Jaguar:

If you used official TWRP 3, your data partition is screwed, because TWRP not only formats your data (when you do factory reset), but also resizes it to the wrong size, so that encryption is not possible on any rom. I have just confirmed it by wiping my phone with official TWRP and reinstalling Jaguar: encryption is not possible as data partition overlaps cryptofooter, a special region on data that has to be reserved to have encryption. There is only one way to fix:

1. Back up your rom, especially Data and Internal SD, because they will be wiped.

2. Go to recovery. Mount and unmount Data/Cache.

3. Connect your phone to computer. Open terminal and type adb shell. Your prompt should change to '#' indicating your have connected with root right. Then paste this:

4. mke2fs -T ext4 -L data /dev/block/mmcblk0p25 11858624

Formatting will start. In about 6 seconds it will be done. Now, you can reinstall your rom and encrypt. Whatever you do, if you use TWRP 3, never do factory reset, otherwise your data partition will be screwed again...
[Xperia Z1 Original Android Development] smith314:
For me it didn't worked. Here's what I've done:

- flashed stock via emma (to make sure to have the default partitioning)

- flashed TWRP 3 and wiped system/cache

- in recovery adb unmounted data, formated data with your mke2fs line, mounted data and flashed the rom

but again if I try to encrypt I get "bad magic" and it reboots.

I checked the sizes: in /proc/partitions mmcblk0p25 has a blocksize of 12486639 1024-blocks. The blocksize of the filesystem according to tune2fs -l /dev/block/mmcblk0p25 2964656 4096-blocks. So all in all ~600mb free space - more than enough for the crypto footer.

Here's some theory I worked out:

I've looked into the cryptfs.c and the "bad magic" is only triggered by get_crypt_ftr_and_key(). I assume the function is except from getting the key to decrypt also used to check if the device is already encrypted because after the "bad magic" logcat's got:

D/Cryptfs ( 409): Just asked init to shut down class main

which is from the cryptfs_restart() that seems to continue the normal encryption process. So I woul'd say the "bad magic" error is useless because as far as I can see it shoul'd be there even if the encryption will succeed. Moreover I think that the last error from logcat is the important one:

D/Cryptfs ( 409): unmounting /mnt/shell/emulated succeeded
E/Cryptfs ( 409): unmounting /data failed: Device or resource busy

The unmount of /data comes after the "Just asked init to shut down class main" part in the cryptfs_restart() function:

if (! (rc = wait_and_unmount("/data")) ) {
/* If that succeeded, then mount the decrypted filesystem */
mount(crypto_blkdev, "/data", fs_type, mnt_flags, fs_options);

If wait_and_unmount() fails the function just skips the encryption and returns so that the device can reboot. So all in all I think the problem is that something's blocking the unmount of /data and therefore the encryption aborts.

I woul'd like to proof my thesis by adding an error message if the wait_and_unmount() fails but I never compiled android myself so that could take a while ;)
[Xperia Z1 Original Android Development] optimumpro:
I am aware of this. Black magic without mentioning overlapped data is harmless. Here is what's happening. Because of CM stupid mistake, no CM based android device has a true hardware based encryption, which fails, because vold calls a non-existing file keymaste.mdt. So, when that happens, encryption defaults to software based. In by build, I have disabled sw based encryption. But that has been resolved by correcting the typo: the call should read keymaster ('r' was missing). There is even an abandoned corrected commit in cm gerrit, where CM bozos say, it is not a mistake, because there is such a file keymaste.mdt. Bozos they are, there is no file keymaste, but there is a qualcomm's binary file called keymaster.mdt. Now, once I have fixed this, there is another error that I am about to resolve: during initial encryption, vold calls for wiping hw based encryption key, before it is ever created. So, the current error is: 'E/QSEECOMAPI: ( 414): Error::ioctl call to wipe the encryption key for usage 1 failed with ret = -1, errno = 14. Since, there isn't any encryption key yet, encryption fails... Googling this error doesn't help, since it only happens in builds where sw based encryption is disabled... That's what I am working on...

Edit: Keymaste instead of keymaster is actually qualcomm's mistake. CM has just failed to correct it...
[Xperia Z1 Original Android Development] optimumpro:
[MENTION=7402756]smith314[/MENTION]

Here is where I am: Software based encryption goes fine, but I am not interested in it. But when hw based crypto is enabled, here is what I get:

D/Cryptfs ( 412): unmounting /data succeeded
D/QSEECOMAPI: ( 412): QSEECom_get_handle sb_length = 0x2000
D/QSEECOMAPI: ( 412): App is already loaded QSEE and app id = 2
I/Cryptfs ( 412): keymaster version is 3
D/QSEECOMAPI: ( 412): QSEECom_dealloc_memory
D/QSEECOMAPI: ( 412): QSEECom_shutdown_app, app_id = 2
D/QSEECOMAPI: ( 412): QSEECom_get_handle sb_length = 0x2000
D/QSEECOMAPI: ( 412): App is already loaded QSEE and app id = 2
D/QSEECOMAPI: ( 412): QSEECom_dealloc_memory
D/QSEECOMAPI: ( 412): QSEECom_shutdown_app, app_id = 2
I/Cryptfs ( 412): Using scrypt with keymaster for cryptfs KDF
D/QSEECOMAPI: ( 412): QSEECom_get_handle sb_length = 0x2000
D/QSEECOMAPI: ( 412): App is already loaded QSEE and app id = 2
I/Cryptfs ( 412): Signing safely-padded object
D/QSEECOMAPI: ( 412): QSEECom_dealloc_memory
D/QSEECOMAPI: ( 412): QSEECom_shutdown_app, app_id = 2
D/ ( 412): HW based disk encryption is enabled
D/ ( 412): Success loading QSEECom_create_key
D/ ( 412): Success loading QSEECom_update_key_user_info
D/ ( 412): Success loading QSEECom_wipe_key
D/ ( 412): GPCE would be used for HW FDE
E/QSEECOMAPI: ( 412): Error::ioctl call to create encryption key for usage 1 failed with ret = -1, errno = 22
E/Cryptfs ( 412): Error enabling encryption after framework is shutdown, no data changed, restarting system
[Xperia Z1 Original Android Development] optimumpro:
New Build

Rom updated to fix encryption, bluetooth address plus more. See OP for download and description.
[Xperia Z1 Original Android Development] panther.ra:
Hello! When i trying change mobile network settings, com.android.phone crashes every time. What can i do? I need change from 3g to 2g (cause i never use mobile internet).
[Xperia Z1 Original Android Development] optimumpro:
Change to English, set whatever you need, then back to your language. This has already been answered many times in this thread.
[Xperia Z1 Original Android Development] smith314:
I think there's something gone wrong with your edit - the download for the August16 release leads to the old August4 release.
[Xperia Z1 Original Android Development] optimumpro:
Fixed that already. Thanks...
[Xperia Z1 Original Android Development] Ranjith pottekkatt:
this is the best rom i have ever used , thanks bro,

i have some pblms with aouto date and time

....after restart time and date not setting automatically

am using c 6902

....sometimes wen restart phone boot 2,3times

....in lockscreen its showing no service,(network is fine)

....auto brightness issues
[Xperia Z1 Original Android Development] smith314:
First of all: encryption works fine. Thank you very much for the effort you've put into that :)

Don't know if it makes any difference, but the afwall/kerneladiutor package is also the old one from the August4 release. I dirty flashed the update and experienced some weird behavior: after the encryption some of the installed apps (in my case threema and icecat) ain't listed as installed anymore but are still in the filesystem present (at least in /data/app).
[Xperia Z1 Original Android Development] optimumpro:
I also noticed a few disappearing apps, but I just reinstalled them and everything is fine now.

This was a struggle in merging some advantages of MM and LP FDE implementations. For example, in LP, real hw based encryption was never properly done. That's why you couldn't encrypt, once I disabled software based encryption. But MM weakened some other things. For example: every device has a unique certificate stored in hardware. Once you encrypt, MM uses that unique certificate to sign your master key. LP does more:, once you start encrypting, that OEM provided certificate is wiped clean and the new one is re-generated. I wonder why MM doesn't wipe the original one? OEM stored database of certificates available upon certain requests? LOL.

There is more coming in terms of encryption. Right now, Jaguar uses 256 bit AES-CBC-ESSIV hardware based encryption, as opposed to a standard android 128 bit. Now I am working on 256 AES-XTS, which is far superior. There is a dm-req open source Qualcomm's implementation present, but dormant in kernel and android sources. Once implemented, it wil also provide a significant improvement in performance, especially read/write speed, as it uses larger blocks...

Edit: both Afwall and Kernel Adiutor were updated in August. The previous versions were for March-April. You do have a totally redone Kernel Adiutor with a new interface...
[Xperia Z1 Original Android Development] optimumpro:
Qualcomm's time service is disabled, as it connects to some weird servers over emergency cellular channel. You need to set time/zone to auto from your carrier and you will get the correct time. No service on lock screen is a privacy feature: you do have service, once the phone is locked, that info isn't available...
[Xperia Z1 Original Android Development] Scr@tchy:
Hi,

when i come from RR Rom can i restore data from backup?? Is there a link for Gapps??
[Xperia Z1 Original Android Development] djevilx:
Bluetooth streaming with vlc causes reboot

Hello,I would like to signal an issue reguarding streaming over bluetooth using vlc.I use my phone in my car connected to an fm modulator via bluetooth,to stream music and phone calls to my car stereo.The issue is that after a certain amount of time,the phone reboots,not predictable but repeatable.Please assist,good work with the rom
[Xperia Z1 Original Android Development] optimumpro:
When there is an issue with your car, you don't expect your mechanic give you an answer over the phone or chat. There could be hundreds of reasons. Run a logcat until reboot happens. I bet it is your phone overheating and shutting down. Set cpuinfo on screen in Developer options to see the temperature. Set intellithermal in KernelAdiutor and lower the temperature threshold for throttling. Having Vlc playing plus bluetooth, plus phone in charger in a car during hot summer, is a pretty good recipe for overheating...
[Xperia Z1 Original Android Development] smith314:
Its probably less a conspiracy thing than devs that really don't care about security aspects :D

I hope you mean 512bit-AES-XTS otherwise we're back at 128bit-AES because of the XTS key splitting ;)

I have to say I'm not a huge fan of XTS. In case of disk encryption its probably better than CBC but with CBC-ESSIV you know what you're dealing with (bit-flipping and some sort of side-channel-attacks) while with XTS you don't really know what kind of attacks may be possible because of its complexity. That's why cryptographers don't really like it. There are rumors that the key splitting is useless in terms of security and was only implemented this way because of a wrong interpretation of the paper :D
[Xperia Z1 Original Android Development] optimumpro:
Well. Qualcomm's Hardware Keystore is refusing to work with XTS and that's that. By the way, Hardware Keystore supports only 128 CBC-ESSIV, which is probably fine. So, we have 256 bit for encrypting data and 128 for hardware signing certificate and wiping that certificate does not work either...
[Xperia Z1 Original Android Development] sanjayi0106:
Great rom... It's so stable custom rom I've ever used...
[Xperia Z1 Original Android Development] optimumpro:
TWRP 3.0.2

That's right and everything that does not work in official TWRP works here, including brightness and data decryption. See OP for download...
[Xperia Z1 Original Android Development] optimumpro:
New build Odexed for speed and security. See OP for download and description...
[Xperia Z1 Original Android Development] hariloyudu@stexsy.com:
Hey dev,this is the best Rom for the z1 :) . But I have a question

I am facing bootloops installing http://xdaforums.com/android/software/mod-magisk-v1-universal-systemless-t3432382

Is it because SELinux has been completely disabled or any other reason.Also I need to use that for Android Pay as system root doesnt work with Android Pay .Thank you ;)
[Xperia Z1 Original Android Development] optimumpro:
Magisk is an exploit and my rom is protected against exploits on boot. I doubt you will ever have it working on Jaguar. But even in theory, you couldn't possibly boot this rom with another kernel unless you unpack my kernel, take the ramdisk and put it in one of Magisk's kernels. But still, there are other things in Jaguar that would probably prevent Magisk from running...

Edit: It has taken hours/days to implement security features exclusive to this rom only, and I am not about to roll them back, because of Android pay. Sorry...
[Xperia Z1 Original Android Development] gencturk61:
i have a problem here. i encrypted my fhone. i updated it. .. . than i couldnt decrypt it now it says encrypting unsuccessfull . it says reset phone . but it is failed. how can i format data and re install the rom?

my phone is bricked...

i
[Xperia Z1 Original Android Development] optimumpro:
You probably used official TWRP 3, which screws data partition when you do factory reset. You need to fastboot install my recovery (fastboot flash recovery recovery.img); then reboot to recovery; then connect to computer; type adb shell (on computer) and then paste this::

mke2fs -T ext4 -L data /dev/block/mmcblk0p25 12498624

Press enter, let it finish the work, then reboot to recovery again and install the rom. Then reboot, encrypt and restore data.

Never use official TWRP.

P.S. I use the same rom on my Z1. I encrypted on August release, then I went to TWRP, entered my boot password, data was mounted and I flashed dirty the latest odexed release. I then wiped dalvik and cache and rebooted. Everything works including encryption...

Edit: If you were encrypted on another rom, your encryption won't work with Jaguar, because I use 256 bit AES, while the official Android - 128 bit AES. So, if you don't have backup, reinstall your old rom to get to data and back it up. Then use my directions above...
[Xperia Z1 Original Android Development] djevilx:
Will sound mods like 'project fortune' work on this rom?
[Xperia Z1 Original Android Development] optimumpro:
Have you read project fortune thread? It doesn't work, the sound is distorted, channels don't work et all. That's what happens when things are done by teenagers who think they are gods, but in fact they don't know what they are doing.

Luckily Jaguar is now odexed, which precludes most "modes" made by "gods."
[Xperia Z1 Original Android Development] djevilx:
I suspected so,but this mod http://xdaforums.com/android/software/sound-mod-z-soundmod-v1-beta-t3419416 seems to work.Reguarding the random reboots using vlc via bluetooth,you were right about the overheat,but the culprit was Kernel adiutor,wich randomly decided 250 mhz was a good frequency for the cpu,with no termal managing whatsoever.After a couple of reboots,it seems to work.Thank you for the answers,keep up the good work
[Xperia Z1 Original Android Development] zawy.:
Hi, I installed your ROM and I have strange problem. In camera I can see a purple strange things. Especially in camera, but in menu sometimes too. Idk what is it, but on screenshots I cant see it.
[Xperia Z1 Original Android Development] optimumpro:
That's because you have an after-market display. There was another user with Chinese display who had the same problem. He adjusted screen colors in Kernel Adiutor and the problem went away...
[Xperia Z1 Original Android Development] zawy.:
how please ?
[Xperia Z1 Original Android Development] optimumpro:
You can try this: http://xdaforums.com/showpost.php?p=67980693&postcount=697
[Xperia Z1 Original Android Development] Snp Mania2:
Want to ask sir..

To flash this rom coming from previous filesystem on ext4 (not f2fs) partition with full wipe, it can be booting or need some other step? Sorry bad speak english

Thanks.

Because i've realy bad time on sometimes ago, in early i am using advanced kernel, you know that is for the stock rom 5.1 so i've been change filesystem data and cache to f2fs partition, without thinking a long and forgot to revert on ext4. i do flash this rom, after flashing is finish i reboot into system n got it bootloop, i comeback to recovery again with doing into fastboot then flash twrp-3.0.0-0-honami.img as selected kernel, it's succes into the twrp and try to wipe data, wow script out put is a red log.. Then i check in /sys/fs/ there's no f2fs partition found.. I crazy panic! And i flash advanced kernel again to revert ext4,after finish revert to ext4 then i reflash this rom again, it same problem, keep a bootloop, then i try reboot into twrp but after led is blue light it's seems failed into the twrp, the screen is dead again n again, always anytime if into the TWRP... i ignored it and try reboot system but keep a bootloop, and finally i flash comeback to stock rom.. Hehehe, after that i really paranoid although rom already update....
[Xperia Z1 Original Android Development] zawy.:
It looks like it works, thank you very much :)
[Xperia Z1 Original Android Development] optimumpro:
So, you have stock rom on f2fs? I doubt it. If you have stock rom, you have ext4. Anyway, have you read the warning NOT to use Official TWRP 3.0.0 when doing factory reset? If you did, your data partition is screwed.

Your problems have to do with f2fs. Jaguar has absolutely no install or bootloop or random reboot problems. Zero... Just look at thousands of downloads - not one complaint about bootloops or reboots.

If you were on f2fs, which in my view is crap, you need to reformat every partition that was converted to ext4 before installing any ext4 rom.

So, first, backup everything including internal SD. Second, get my latest TWRP 3.0.2 and install it via fastboot: fastboot flash recovery recovery.img. Next, reboot to recovery, connect your phone to computer and on computer terminal type this: mke2fs -T ext4 -L data /dev/block/mmcblk0p25 12498624. Then reboot to recovery and install rom.

P.S. And in the future, if you want to swtich from f2fs to ext4, just flash official stock ftf, then install whatever rom you want...
[Xperia Z1 Original Android Development] Snp Mania2:
I am not tell with a crap,sir.. It's really happened to me :(

the point is... i am have change filesystem to f2fs using advanced-v18-kernel.zip on stock rom 5.1(i changes f2fs via twrp 3.0.0-0) in daily driver it's ok then i wanna try your custom rom i just forget to revert back to ext4.. My filesystem still f2fs sir, That's why my data n cache is gone because jaguar kernel not f2fs included,only ext4... But problem is solved, now i am on pac rom 5.1...

My question is..

'HOW TO FLASH YOUR ROM from NOW, WITH EXT4 FILESYSTEM?' :)