guardianproject / lildebi

UNMAINTAINED please adopt! we can no longer maintain this
https://guardianproject.info/code
GNU General Public License v3.0
229 stars 55 forks source link

Properly handle device shutdown #75

Open Alexander-- opened 11 years ago

Alexander-- commented 11 years ago

Currently running out of charge or simply forgetting to clean up Debian stuff before pressing shutdown leads to improperly unmounted file system and, potentially, data corruption.

Simple, but risky solution: catch appropriate Android broadcast. No gurantees, that unmounting finishes in time.

Better solution: previous + run a sticky service. Stopping such service is guranteed to happen before device shutdown. You, likely, already know, but here is how to do it in a backward-compatible fashion.

PS No, SD card unmounting notification is never broadcasted on my tab (as well as the mounting one). A lot of pre-4.3 devices (usually cheap Chenese ones) use vendor-specific shell magic to handle more than one sdcard, which apparently results in broadcast being sent only for one of them (or never at all).

eighthave commented 11 years ago

It seems that the best approach would be to catch the official Android broadcasts, then also implement your sticky service idea to make sure it happens on all devices. If you implement this, I'd include it. It probably makes sense to just start with the broadcasts, since its easier.

SDkie commented 10 years ago

@Alexander: first part is done. I am not sure how 2nd part can be done.

similar issue reported by @eighthave- https://github.com/guardianproject/lildebi/issues/113

eighthave commented 10 years ago

Wow, that's some rough stuff. The Service sounds like a good idea. We're going with the broadcasts for now, then later hopefully this Service can be added.