Fingerprint recognition with unencrypted /data partition? - Lenovo P2 Guides, News, & Discussion

I had to format my /data partition to change the file system from f2fs to ext4 to allow Magisk to persist Hide settings (and for systemless Xposed to work).
As I am trying to figure out why the screen-on time is less than on the stock ROM even with power saving CPU/GPU governing enabled in the kernel, apparently due to system processes, I thought I would see if encryption had an effect, so I avoided encrypting the /data partition after reformatting it.
However, this has the side effect of disabling the fingerprint recognition and the related settings entries (sensor still works as back/task switcher/home button). If I encrypt the phone under settings, the fingerprint settings & functionality return.
I would like the encryption, but if this is what costs a lot of extra battery use, then my jury is still out.
Meanwhile, does anybody know a way around this or perhaps less likely a "trustworthy" 3rd party app that could handle it?
(My understanding is that the "fingerprint fingerprints" or "hashes" are stored in an encrypted/inaccessible place regardless of whether the /data partition is encrypted, so it ought not to be an absolute requirement for it to work.)

Related

What is fsync

What is fsync
crazyboyxx said:
What is fsync
Click to expand...
Click to collapse
It's a system call in Unix/Linux. "man fsync" says:
fsync() transfers ("flushes") all modified in-core data of (i.e., modified buffer cache pages for) the file referred to by the file descriptor fd to the disk device (or other permanent storage device) so that all changed information can be retrieved even after the system crashed or was rebooted. This includes writing through or flushing a disk cache if present. The call blocks until the device reports that the transfer has completed. It also flushes metadata information associated with the file (see stat(2)).
Click to expand...
Click to collapse
So it's something embedded in programs after a related set of write operations to ensure that all data has been written to the storage device. The bolded part is what makes it interesting for some to disable it - "The call blocks" means the calling program waits until it's finished, and this may create lag. The downside is that if the system crashes, the data on the storage devices may be inconsistent, and you may lose data.
_that said:
It's a system call in Unix/Linux. "man fsync" says:
So it's something embedded in programs after a related set of write operations to ensure that all data has been written to the storage device. The bolded part is what makes it interesting for some to disable it - "The call blocks" means the calling program waits until it's finished, and this may create lag. The downside is that if the system crashes, the data on the storage devices may be inconsistent, and you may lose data.
Click to expand...
Click to collapse
Thanks :good:
What kind of data may be lost when fsync is disabled? could you please give an example? may it cause a serious damage to the phone's system?
your_login said:
What kind of data may be lost when fsync is disabled? could you please give an example? may it cause a serious damage to the phone's system?
Click to expand...
Click to collapse
All data that any app thinks it has written to storage (as it explicitly instructed the OS to do so), but has not been written yet by the OS, may be lost in case of an unexpected system crash.
So as long as the system is running normally, all cached data is eventually written to the eMMC/SD, usually a few seconds after the write request, and everything works normally.
In case of a random reboot, or a "hard" system hang which requires you to power off and restart, or if you run out of battery, AND some app or background service wanted to write something to the file system just before that crash, such cached data is lost.
So what can happen? No hardware is damaged. In the absolutely worst case, the filesystem on your data partition is irrecoverably damaged and you have to do a factory reset, losing all your apps and your data, photos etc. (you do have a backup, don't you?). The chance for this worst case to happen is extremely low - in most cases the filesystem is automatically repaired at startup, and the incompletely written files are simply deleted. If this does not work for some reason, you can still manually try running fsck from the recovery.
If some system service just updated a database before the crash, it may be inconsistent after restarting. This can lead to malfunction of that service, e.g. FCs, missing info in your calendar, missing or garbled media files, etc.
So in summary - as long as the system is stable, disabling fsync only increases performance. By the way, app crashes (FC, ANR, ...) do not hurt here, only complete system crashes are bad.
_that said:
All data that any app thinks it has written to storage (as it explicitly instructed the OS to do so), but has not been written yet by the OS, may be lost in case of an unexpected system crash.
So as long as the system is running normally, all cached data is eventually written to the eMMC/SD, usually a few seconds after the write request, and everything works normally.
In case of a random reboot, or a "hard" system hang which requires you to power off and restart, or if you run out of battery, AND some app or background service wanted to write something to the file system just before that crash, such cached data is lost.
So what can happen? No hardware is damaged. In the absolutely worst case, the filesystem on your data partition is irrecoverably damaged and you have to do a factory reset, losing all your apps and your data, photos etc. (you do have a backup, don't you?). The chance for this worst case to happen is extremely low - in most cases the filesystem is automatically repaired at startup, and the incompletely written files are simply deleted. If this does not work for some reason, you can still manually try running fsck from the recovery.
If some system service just updated a database before the crash, it may be inconsistent after restarting. This can lead to malfunction of that service, e.g. FCs, missing info in your calendar, missing or garbled media files, etc.
So in summary - as long as the system is stable, disabling fsync only increases performance. By the way, app crashes (FC, ANR, ...) do not hurt here, only complete system crashes are bad.
Click to expand...
Click to collapse
What about RRs [Random Reboots] ??
alizafar said:
What about RRs [Random Reboots] ??
Click to expand...
Click to collapse
Obviously, the same considerations apply as with a "hard" system hang -- the only difference being that the system reboots itself instead of you pressing the button.
EDIT: I thought it was a strange question (due to the answer being so obvious),, but then I read _that's answer and he even explicitly stated it in his reply. Please read a reply, he didn't formulate so nicely and eloquently to have you read only 4% of what he wrote. :S
_that said:
All data that any app thinks it has written to storage (as it explicitly instructed the OS to do so), but has not been written yet by the OS, may be lost in case of an unexpected system crash.
So as long as the system is running normally, all cached data is eventually written to the eMMC/SD, usually a few seconds after the write request, and everything works normally.
In case of a random reboot, or a "hard" system hang which requires you to power off and restart, or if you run out of battery, AND some app or background service wanted to write something to the file system just before that crash, such cached data is lost.
So what can happen? No hardware is damaged. In the absolutely worst case, the filesystem on your data partition is irrecoverably damaged and you have to do a factory reset, losing all your apps and your data, photos etc. (you do have a backup, don't you?). The chance for this worst case to happen is extremely low - in most cases the filesystem is automatically repaired at startup, and the incompletely written files are simply deleted. If this does not work for some reason, you can still manually try running fsck from the recovery.
If some system service just updated a database before the crash, it may be inconsistent after restarting. This can lead to malfunction of that service, e.g. FCs, missing info in your calendar, missing or garbled media files, etc.
So in summary - as long as the system is stable, disabling fsync only increases performance. By the way, app crashes (FC, ANR, ...) do not hurt here, only complete system crashes are bad.
Click to expand...
Click to collapse
How would having fsync enabled help save data in case of a system crash? I mean, its unexpected and can interrupt the block call verification anyway, no? I'm assuming that without fsync you go for longer without "notifying" the OS about the changes in your data. So is it possible to change the fsync intervals so it doesn't happen constantly and cause lag, but happens frequently enough so that nothing extremely bad happens if the battery runs out or I get a random reboot? Or is that not how it works?
_that said:
All data that any app thinks it has written to storage (as it explicitly instructed the OS to do so), but has not been written yet by the OS, may be lost in case of an unexpected system crash.
So as long as the system is running normally, all cached data is eventually written to the eMMC/SD, usually a few seconds after the write request, and everything works normally.
In case of a random reboot, or a "hard" system hang which requires you to power off and restart, or if you run out of battery, AND some app or background service wanted to write something to the file system just before that crash, such cached data is lost.
So what can happen? No hardware is damaged. In the absolutely worst case, the filesystem on your data partition is irrecoverably damaged and you have to do a factory reset, losing all your apps and your data, photos etc. (you do have a backup, don't you?). The chance for this worst case to happen is extremely low - in most cases the filesystem is automatically repaired at startup, and the incompletely written files are simply deleted. If this does not work for some reason, you can still manually try running fsck from the recovery.
If some system service just updated a database before the crash, it may be inconsistent after restarting. This can lead to malfunction of that service, e.g. FCs, missing info in your calendar, missing or garbled media files, etc.
So in summary - as long as the system is stable, disabling fsync only increases performance. By the way, app crashes (FC, ANR, ...) do not hurt here, only complete system crashes are bad.
Click to expand...
Click to collapse
Long press back kill apps shouldn't be used if dynamic fsync is disabled?
yavu said:
Long press back kill apps shouldn't be used if dynamic fsync is disabled?
Click to expand...
Click to collapse
I don't know what you mean, but I thought I had already made it clear that the only situation where disabled fsync can cause problems is in case of unexpected whole system hangs, shutdowns and reboots.
_that said:
I don't know what you mean, but I thought I had already made it clear that the only situation where disabled fsync can cause problems is in case of unexpected whole system hangs, shutdowns and reboots.
Click to expand...
Click to collapse
I think his question is, can he corrupt an app or i's data if he kills it with either a task killer or with a shortcut setup as a task killer. Based on your response, the answer (correct me if I'm wrong) is the only thing that could possibly be affected with a disabled fsync is the app that was killed - which isn't a big deal because it does not fall into your catastrophic loss category of RR, Hard shut, etc. where your system becomes vulnerable.
sgkla said:
I think his question is, can he corrupt an app or i's data if he kills it with either a task killer or with a shortcut setup as a task killer. Based on your response, the answer (correct me if I'm wrong) is the only thing that could possibly be affected with a disabled fsync is the app that was killed - which isn't a big deal because it does not fall into your catastrophic loss category of RR, Hard shut, etc. where your system becomes vulnerable.
Click to expand...
Click to collapse
Killing an app is exactly as dangerous or safe with fsync disabled as with fsync enabled.
@_that
Can FSync be in any way related to system lag... I mean if it does, will it reduce lag with FSync enabled or disabled???
Thanks
Sent from my GT-I9500 using Tapatalk 4 - Hassan K. Malik
HassanM said:
@_that
Can FSync be in any way related to system lag... I mean if it does, will it reduce lag with FSync enabled or disabled???
Click to expand...
Click to collapse
Have you read post #2?
Sent from my ASUS Transformer Pad TF700T using Tapatalk 4
I see what you are trying to say here but unfortunatelly my experiences are different:
With Dynamic FSync Enabled - when my system crashes from any reason I always loose some data (e.g. my tapatalk app always lost all data).
So I keep Dynamic Fsync Disabled - my system can crash anytime and my data are kept intact. ...
So how this really works?
s3icc0 said:
I see what you are trying to say here but unfortunatelly my experiences are different:
With Dynamic FSync Enabled - when my system crashes from any reason I always loose some data (e.g. my tapatalk app always lost all data).
So I keep Dynamic Fsync Disabled - my system can crash anytime and my data are kept intact. ...
So how this really works?
Click to expand...
Click to collapse
If you disabled dynamic fsnc then you have fsync enabled and you are not getting any benefits.
Dynamic FSYNC = ENABLED
- Screen on = NORMAL FSYNC OFF = faster IO
- Screen off = NORMAL FSYNC ON = slower IO
Dynamic FSYNC = DISABLED
- Screen on = NORMAL FSYNC ON = slower IO
- Screen off = NORMAL FSYNC ON = slower IO
sbdags said:
If you disabled dynamic fsnc then you have fsync enabled and you are not getting any benefits.
Dynamic FSYNC = ENABLED
- Screen on = NORMAL FSYNC OFF = faster IO
- Screen off = NORMAL FSYNC ON = slower IO
Dynamic FSYNC = DISABLED
- Screen on = NORMAL FSYNC ON = slower IO
- Screen off = NORMAL FSYNC ON = slower IO
Click to expand...
Click to collapse
But with enabled I am loosing my data in case of system errors
s3icc0 said:
But with enabled I am loosing my data in case of system errors
Click to expand...
Click to collapse
Yes only if the system crashes you may lose some data.
sbdags said:
Yes only if the system crashes you may lose some data.
Click to expand...
Click to collapse
That is not a good news for someone who spend half of life on XDA trying all possible features, tweaks and roms
_that said:
All data that any app thinks it has written to storage (as it explicitly instructed the OS to do so), but has not been written yet by the OS, may be lost in case of an unexpected system crash.
So as long as the system is running normally, all cached data is eventually written to the eMMC/SD, usually a few seconds after the write request, and everything works normally.
In case of a random reboot, or a "hard" system hang which requires you to power off and restart, or if you run out of battery, AND some app or background service wanted to write something to the file system just before that crash, such cached data is lost.
So what can happen? No hardware is damaged. In the absolutely worst case, the filesystem on your data partition is irrecoverably damaged and you have to do a factory reset, losing all your apps and your data, photos etc. (you do have a backup, don't you?). The chance for this worst case to happen is extremely low - in most cases the filesystem is automatically repaired at startup, and the incompletely written files are simply deleted. If this does not work for some reason, you can still manually try running fsck from the recovery.
If some system service just updated a database before the crash, it may be inconsistent after restarting. This can lead to malfunction of that service, e.g. FCs, missing info in your calendar, missing or garbled media files, etc.
So in summary - as long as the system is stable, disabling fsync only increases performance. By the way, app crashes (FC, ANR, ...) do not hurt here, only complete system crashes are bad.
Click to expand...
Click to collapse
I got such a huge problem with the force reboot thing and now i'm really thinking it is Fsync related. I own a note 6 pro and i always keep fsync disabled because of the performance increase that people say. One day the phone had to restart the UI and for some reason UI wasn't starting again, so i forced the reboot. The phone ended up with stutters anytime it entered the system and in any rom (even stock), imei and mac got gone and the rom i was on was really buggy, like: status bar wouldn't expand, home button wasn't working and a lot of other things.
This issue happened on the moto g falcon i'm using due to my note 6 pro bug. I also kept Fsync disabled on this one, and i had to forced reboot it because an app had freezed. Again, status bar wasn't expanding, home and recents button wasn't working, notificatons wasn't showing... Thank god my imei and mac isn't gone. A clean rom reflash worked for moto g, but nothing i tried worked out for note 6 pro. It doesn't happens on the first forced reboot, but takes some of them to happen.
Do you think Fsync can have such a deep impact even to mess with some partitions on the phone if it's suddenly rebooted?

ZOMBi-POP OMNI KANG RC1 - Slowness when using the tablet after sleep/some time.

Hi All,
I know Zombi-POP is still in RC1 so I'm sure there are still quite a few issues. The issue I seem to be having is the tablet is VERY slow once you use it from sleep/sitting for a while. I'm not sure what its doing once I start using it again but it takes about 3-5 minutes to get back to hauling butt. I notice when playing a game that there is performance hit every 2 seconds. I can see the animation lagging so its very noticable and constant. Does anyone know what could be going on?
TF700T:
* ROM2SD on 64GB Sandisk 10. I partitioned it 16/43/1 EXT4. I'm staying away from F2FS since data could corrupt.
* Recommended settings put in place based on install notes on forum.
Governor:Interactive (not like I can change it anyways)
IO scheduler:noop
Thanks for the help. I would post this in the correct area but I'm not allowed to post there yet due to my newbie status .
That sounds as if you have automatic updates in the Play Store active. Turn it off.
And get rid of the FB app if you use it (acess it in browser instead). Any app that feels the need to phone home as soon as the tablet wakes up will make this lag-on-wake worse: weather apps, forum apps, mail... what have you.
For your game you could try to play with the Transition animation and Animator duration scale in Developer Options. Set them to .5 and see if that helps.
You should really give f2fs on internal a whirl. As long as we have been playing with f2fs I still have to hear from a single user who had data loss issues because of it. And anyway - if you keep sensitive data on your portable device you should have a solid backup routine in place no matter what. And if you do data loss is a non-issue
mediaserver is the issue...
I was watching the system for a while during wakeups and found that the mediaserver process is causing this slowdown. I guess its scanning the driver? I'm not sure. All I know is there is a app already created out there that kills the mediaserver process for good. I tried killing it from the terminal but it starts up right afterwards. I'll stick with EXT4 for now. The performance is great for me once that process is gone and I'm more familiar with EXT4.
Thanks!
Andy
berndblb said:
That sounds as if you have automatic updates in the Play Store active. Turn it off.
And get rid of the FB app if you use it (acess it in browser instead). Any app that feels the need to phone home as soon as the tablet wakes up will make this lag-on-wake worse: weather apps, forum apps, mail... what have you.
For your game you could try to play with the Transition animation and Animator duration scale in Developer Options. Set them to .5 and see if that helps.
You should really give f2fs on internal a whirl. As long as we have been playing with f2fs I still have to hear from a single user who had data loss issues because of it. And anyway - if you keep sensitive data on your portable device you should have a solid backup routine in place no matter what. And if you do data loss is a non-issue
Click to expand...
Click to collapse
You should really switch to internal and F2FS - there is no risk of corruption. Rom2sd doesn't play well with zombi.

P2 battery life issue - changing kernel govenor settings on Lineage OS 15.1

I have a Lenovo P2. My carrier has not provided any OTA updates since an old Android 6 version, before the Spectre/Meltdown issues, so once the warranty expired I installed Lineage OS, now 15.1.
Only problem is that the battery life is significantly reduced. This is while using the second-slowest setting before battery saving mode in Lineage.
I want to try to change the kernel governor settings to see if I can improve this. I think I need root access to do so and tried installing Magisk as it seemed the most user friendly. When trying to flash the 16.0 and 17.0 zips in TWRP (newest) for the P2 kuntao, it fails as it cannot mount the /vendor partition. Posts suggests this problem has come and gone before, and that basically Lineage 15.1 doesn't try to cater for Magisk, rather the philosophy is that root/SU access is either there or not, no trying to circumvent SafetyNet checks etc.
Does anybody know a solution to (in order of priority):
1) Improve the battery life issue.
2) Change the governor settings without root (defaults settings in Lineage OS appear to not be well suited for Lenovo P2).
3) Install Magisk.
4) Recommend a good alternative Android ROM or perhaps just a kernel, which I can adjust power settings for, but still allows security-sensitive programs such as banking apps etc.
Thank you!
More details: Various battery analyser programs including Better Battery Stats don't seem to uncover any programs (and I have no social media apps). I sync manually and generally have WiFi turned off (no secret scanning) and also the screen turned off (no double tapping to unlock). The culprit appears to be system standby (not radio, its usage is reassuringly low). Reading posts suggests that the CPUs are governed too high when in standby and that the best thing to try at this point is to adjust the kernel governor settings. I don't particularly want to root (I develop software, but don't know much about linux), however it seems it is necessary to do so.

[GUIDE) A Word about trim

Ever since Android announced trim support this topic seems to be ignored ever since.
It shouldnt have been.
At least on some devices manual fstrim (busybox) of any version dont work, at least not fully properly as it should.
Never did, and i highly doubt it does work with android kernel built in command thats supposed todo that on its own.
That would explain the usual performance gain after formating data poartition at least for a few days.
I testet this over the years on S2, Note3, NExus 5, nexus 9 and a few other phones.
latest tests are note 3 and nexus 9 on lineage 14.1 (droid 7.2) and oreo.
Here is the results
On Android (native app, or shell via busybox):
it says it trims, consecutive trims lead smaller sizes and at some point to "trim not required" - as it should be.
However a fter a few minutes data trims again hundreeds of megs, an hour later gigabytes
- wtf - monitoring the write activity showed nothing at all. also the battery should be drained if it writes 20gigs an hour to the sdcard constantly - something seems off.
This behaviour has been as is ever since. fstrim never seem todo much.
Now we test this under twrp on the shell.
after one trim it was imidiatly to zero (so second trim says not required)
allright fine, this is how its supposed to be...
well .... nope ... after remounting it imiditaly wants to trim 100% of the free space.
ext4 is not supposed to work like this on trim, it should always only allow untrimmed freespace (in contrast to btrfs which always trims all).
Now important to know is that fstrim is no relyable method to find out if trim is working or what your block devices does.
it could be very well trim is working as intended but reports wrongly.
However the behaviour of trimming down to little, then to zero, then growing big and fast seems to indicate otherwise.
it looks more l ike trim job marks as trimmed (while its sheduled todo that really) - and unamrk step by step later
if this is true it also means the discard mount option actually is contraproductive at best.
Resolution:
i found that switching to f2fs solves that issue.
Trims are now realistic (like 300mb after 5 hours) zero for a long time, correct sizes when you delete a bigger file and so on.
also its now incredible fast.
the massive difference on my devices between f2fs and ext4 is another indicator that trim never worked. it seems like on the first day.
f2fs is supposed to be 20% slower on reads yet i have across all devices a massive improvment, no mroe lags or stutter on ceertain operations. specially chromiun based browser became lightning fast, as in only fractions of a second loading time, compared to seconds before (which make sense considering how the cache is working all the littel files take up an insane time if you need to clear those bytes first)
oh and did i mention it works very well with encryption on?
well it does, and thers no real speed difference now beween unecrypted and encrypted.
bottom line, i doubt trim ever worked on ext4 systems, at least not on all of them.
f2fs is teh solution at least for such older devices like mine, together with oreo my old ones are back in business... watining for a samsung note with on screen fingerprint reader and no knox )

Understanding what is F-Sync and the effects of it during a system crash

What is F-Sync? What are the effects when disabling it?
According to Linux Programmer's Manual on http://man7.org/linux/man-pages/man2/fsync.2.html
fsync() transfers ("flushes") all modified in-core data of (i.e.,
modified buffer cache pages for) the file referred to by the file
descriptor fd to the disk device (or other permanent storage device)
so that all changed information can be retrieved even if the system
crashes or is rebooted. This includes writing through or flushing a
disk cache if present. The call blocks until the device reports that
the transfer has completed.
Click to expand...
Click to collapse
So basically, this is the one who protecting the /data partition from corrupting during a system crash or unexpected system reboot.
I've just learned it during my lessons in my programming class and this is one of my reasons why my device:
Can't Enable Mobile Data
For some reason, my status bar can't be customized and can't pull down the other settings
Magisk keeps stopping
In some kernels, F-sync is disabled by default. Disabling it has certain effects. While disabled, it can improve memory speed but increases risk of data loss during a system crash.
I tried to Enable it for a sec and doing some benchmarks, I can say that the Disabled one has the highest score (in read/write scores) than the Enabled one, it could theoretically improve loading speed time in apps but it is barely unnoticeable. So I recommend that you should enable it in case of system crashes.
Other devs should give warning about F-Sync like in Twisted Kernel (Thanks @Twisted Prime for the heads-up).
If you want to enable it, you could enable it then set it on boot so it will always stay enabled.
Not a poco F1 thing, but nice to know

Categories

Resources