I have owned several Android-based devices, and some of those were purchased from Samsung, those being:
- A Galaxy Tab S, First Generation,
- (An earlier Smart-Phone),
- A Galaxy S6 Smart-Phone,
- A Galaxy S9 Smart-Phone.
A feature which all these devices have, is the Touchwiz Home-Screen (program). This is the default of what the devices display, when not displaying a specific app, when not displaying the app drawer, and when not displaying ‘Bixby’ (most recently). An unfortunate behaviour of the devices is, that Touchwiz will sometimes crash. In my experience, when it does, this is no big deal, because it restarts automatically, and after a few minutes, even my Notification-Bar Entries will reappear. If certain apps fail to make their notifications reappear by themselves, then launching those apps from the application groups will make their notifications reappear.
I tend to rate each Android device, according to how rarely its Home-Screen will crash in this way. According to that, my Google Pixel C Tablet fared better because its home-screen has never crashed on me. My S9 Phone fared almost as well, in that Touchwiz seldom crashed. But now I think I’ve identified a situation which will frequently cause Touchwiz to crash on the S9 Phone.
Firstly, as I’m writing this, the firmware on that phone is at its latest version, that being the October 1 patch, of 2019, of Android 9.
I discovered that I can trigger this situation, as I was experimenting with the Super-Slow-Mo camera recording mode, in which the camera can record up to 0.4 seconds of video at 960FPS, at a resolution of 1280×720. When the camera does this, it generates a 20MB video, after that has been compressed via a standard H.264 CODEC into an .MP4 container-file. I have the default set, to record all camera footage to the external Micro SD Card. Having recorded the super-slow-mo video once, triggered this behaviour.
There is a simple way to interpret what has caused this, that does not seem to lay any blame on Samsung: When the camera is recording video that fast, it’s generating data faster than the external SD Card can store it. Therefore, the data takes up RAM, until some later point in time, when the O/S has transferred the data to the SD Card, by writing it out. This moment was reached several seconds later.
Here’s where the news gets a bit worse. I can download This 3rd-party app, that’s designed to test what speed of external SD Card I have. The reason I need to do this is the fact that I never seem to remember exactly what type of SD Card I purchased, for use with one specific device.
According to this app, my external SD Card can be written to sequentially at ~12MBytes/Sec. That makes it a Class 10 card. Yet, 20MB of data are to be stored in 0.4 seconds. In fact, simply running the benchmarking app caused a second Touchwiz crash, which was just as inconsequential as the first, that I was trying to investigate. What this seems to suggest is, that virtually no SD Card that I can buy, can really be fast enough to be written to at the speed with which the camera app can generate its data. The camera app will need to cache its footage in RAM, before that footage has been written to the SD Card.
Further, the footage is certainly being stored in RAM in an uncompressed form of data (384 raw frames), while what’s to be written to the SD Card is finally compressed. (:1)
And yet, either of these two apps will cause the Touchwiz crash. Hmm… I think that for the moment, I’ll just hold my horses, and record a maximum of 0.2 seconds of Super-Slow-Mo. Thankfully, this is a parameter that I can choose, with the little icon in the upper-right-hand corner of the view, before shooting.
(Updated 11/17/2019, 12h10 … )
(As of 0h20 : )
There is a second question to how this behaviour is to be interpreted, which I should also point out. One out of two things could theoretically be happening:
- There could be an actual OOM-crash, the way it can happen with Linux, or,
- The background task killer could simply go into nuclear mode, and kill an unexpectedly large number of background tasks – of which I’m in the habit of having an unusually large number running – in order to make sufficient RAM available for that one app that the O/S trusts: (Samsung’s) “Camera” app.
In reality, only situation (2) can actually be happening to me. I know this because, if the O/S had actually crashed while large amounts of data are being written to an SD Card, I’d certainly need to reboot the device, that would certainly count as a hard boot, and the SD Card would be corrupted afterwards.
The actual behaviour of the phone suggests, that at least at the kernel level, no crash ever took place. No reboot was required…
(Update 11/17/2019, 12h10 : )
Several hours later, that video disappeared from my external SD Card, which suggests that Android was cleaning up some File System Corruption, and therefore, that the external SD Card had gotten corrupted to some degree, after all.
The same benchmarking program informs me, that the internal SD Card, that shipped with the phone, supports sequential writing at “57.98MBytes/Sec”. What this last piece of information suggests would be, that if I simply switched the Camera’s settings to store its footage to internal storage, I should be able to record Super-Slow-Mo videos just fine.
And so now I have tried this experiment, and found that there were no more anomalies in how the Touchwiz Home Screen program behaves afterwards.
However, I see a risk in setting the “Camera” app that way. With what just happened this morning, the corruption which took place, only took place on the external SD Card, which was easy for Android to clean. If I start storing extensive video footage to the internal SD Card, then future FS Corruption may take place there, where Android would subsequently fail to clean it.
I must also observe that such videos, where this last one was only 12MB long – because I had only captured 0.2 seconds worth of real-time footage – cannot be transferred to my PC using the otherwise-handy “KDE Connect” Linux PC application, because this application will truncate such large files, which in turn makes them unplayable. I need to use an app on my phone that acts as an SMB Client, to transfer such videos to a PC.