[Galaxy S 4 Mini Android Development] smartxdev:
OK, this is going to be a long one....

So I've done some testing.

First of all, the fixed TWRP version. Here are the tests performed:

1 - Clean install CM11 > create lockscreen PIN > encrypt device > boot into TWRP & Decrypt => Success! :good:

2 - => Modify PIN (lockscreen only, CM11 feature) > boot into TWRP & Decrypt => Success! :good:

3 - => Modify encryption password (encryption only, CM11 feature) > boot into TWRP & Decrypt => Success! :good:​

Congratulations on this one, finally the recovery can recover stuff again :)

----

Now, regarding my own questions:

I've made some discoveries here, but please read on, I still need some advising...

Since I've started formatting, I went on and experimented a bit more:

For the second question I found this TWRP article.

According to it, Internal Storage in represented by /data/media folder inside /data partition.

And

"Format Data" effectively formats the whole /data partition WITH "sdcard0" inside of it

, erasing it all, and removing encryption.

(luckily I've done /storage/sdcard0/ backup by ADB pull before testing)

While the "wipe data" aka "factory reset" is removing /data contents, excluding /data/media folder.

To be able to do so TWRP needs /data to be available (unencrypted / unlocked). This option won't remove encryption.

On the first quiestion, I've done some tests, and here are the results:

1)

Encrypt device

> Boot to TWRP & Decrypt (unlock) > perform full NANDroid Backup (aka NB1) with TWRP =>

=> Format Data & wipe all > Restore NB1 =>

=> System is bootable and OK,

appears NOT encrypted

2)

NOT Encrypted

> perform full NANDroid Backup (aka NB2) with TWRP =>

=> Encrypt device > Boot to TWRP & Decrypt (unlock) > Restore NB2 =>

=> System is bootable and OK,

appears encrypted

These results were somewhat surprising,

I've read that the encryption password and details are contained in the footer of the /data partition,

what made me think that restoring /data that was used with encryption on an unencrypted system would require password to boot.

But it's not the way it is.

So, it seems like once you unlocked encryption with TWRP or anything, you handle the system as unencrypted, being able to restore/backup whatever you want.

But somehow retaining encryption, even if you overwrite /data. I still don't understand how it is being done. But that's how it behaves anyway.

After felling more confident with it, I decided to encrypt my device, but I ran into an issue, being unable to encrypt

(device just reboots instead of initiating encrypting process), I thought that it was kernel at first (post), but eventually it wasn't the kernel, I still has no idea why it won't encrypt...

Anyways, combining this issue with my recent findings, I've done the following:

Wipe everything > install clean CM11, kernel, gapps > restore /storage/sdcard0/ by adb push > encrypt device =>

=> Boot to TWRP & Decrypt (unlock) > factory reset and wipe all but "internal sdcard" > restore NANDroid backup of my daily system I've done before tests.​

Now, the system "appears" encrypted, it asks for passwords and all.

And here is the bottom line question, taking in account my findings and your knowledge on the android encryption system:

Can I safely rely on this as a proper encryption, that all was properly encrypted during the restore process in TWRP ???

-- Thanks in advance for advising --

-- Congrats! You've survived reading this post --