1: Let's call this problem the "packages.xml permissions problem."
2: The problem is caused by a bug in Android wherein if Android detects that the packages.xml file is corrupted, it will rebuild it incorrectly. Apps lose permissions to their data stores and from there you get a host of problems. I can see the file getting corrupted if the phone crashes or the battery is removed before the phone is shutdown, but myself and others here did not get the problem that way, it just came unprovoked. My opinion is that an aftermarket battery would not cause the problem, nor would rooting, nor using a 3rd party ROM (I'm using stock and I got the problem).
3: This fatal problem happens unprovoked on Froyo. I wonder when the bug was introduced and thus how long it has gone unfixed. When you consider that "most" people in the world don't know what "notepad" is for, you understand that a flaw like this in Android makes it unsuitable for many people. Grandma can not edit and run Linux shell scripts, hec I know *computer programmers* that can't edit and run Linux scripts. As such, iPhone is a better choice for most just in light of this single problem. Consider that some people posting here have had the problem repeatedly. Can you give your mom a phone that will repeatedly die unprovoked? I have found other problems in Android as well, for example the wi-fi is troublesome and in some situations simply doesn't work (if the wireless network supports b/g/n, if the SSID is not transmitted, on my US Robotics router for unknown reasons but works better, but still not perfectly, with Linksys).
4: In my case I lost cell internet service for unknown reasons and so I shut down the phone and pulled the battery to give it a good reset. Upon powerup I got the problem. I was able to get internet going again by digging in the settings and I discovered 3G data was not selected at settings/wireless and network/mobile networks.
5: If you get stuck in a loop because your "launcher" app is failing, try holding down the "home" button until the task switcher comes up. From there you can go to "task manager" and from there you may be able to kill the failing app and run the original "launcher" app.
6: Don't uninstall the stock Android "launcher" app even if you are using a 3rd party "launcher" app.
7: Contrary to original poster (OP) FlorentBL's opinion, this is just a software bug so Gingerbread can, and hopefully will, solve it.
8: Most apps use SQLite for data, so I would not cast much suspicion that way, but it could be related. Even if so, it's still Android's problem, not SQLite because it is Android that is making the mistake and what good is the phone if it doesn't correctly handle the most popularly used database system?
9: There is a better thread on this problem here: http://www.samsunggalaxysforum.com/samsung-galaxy-s-how-to/lost-all-settings-after-battery-change
Please see that thread for the script to repair this problem and more info from me.
To answer the OP's questions:
- why such a crap can happen? - Because Android has a bug in it. Bugs happen, but this one is pretty nasty and I wonder how long it has gone unfixed.
- is it a hardware failure? - No. It's a software bug in the Android kernel. packages.xml gets corrupted for unknown reasons, that might be hardware but almost certainly not.
- why some applications crash or have disappeared and others don't? - The problem is that the crashing/malfunctioning apps don't have access to their data stores. Since apps are written with the reasonable expectation that they will always have access, crash and malfunction follows. As for the apps that continue to work, probably Android got their permissions correct for some obscure reason or (likely) they are able to recreate needed settings on the fly and so they repair themselves and if they don't have user data (like "my files" say,) or the data is stored in the cloud, then they may have been affected but you don't notice.
- is there a way to recover the applications configurations? - So far the only hope I've seen is the shell script that you can read about in the other thread I mentioned. But you have to run it first thing. If you uninstall the app then of course you're going to lose any data you had in it. Also I was able to use the affected "memo" app and by doing so I think the previous data has gone bye-bye...after repair the old data did not come back, and digging into the memo data store, pulling out the memo.db sqlite database, and viewing it with Microsoft Access did not uncover my lost data.