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

lildebi doesn't unmount properly if device is rebooted when lildebi is mounted #113

Closed eighthave closed 10 years ago

eighthave commented 10 years ago

I rebooted with LilDebi mounted, but it didn't seem to shutdown properly. But on reboot, it did run fsck properly :-).

SDkie commented 10 years ago

We trigger LilDebi shutdown on 'android.intent.action.ACTION_SHUTDOWN' intent. what are the other options we have?

eighthave commented 10 years ago

I think that Lil' Debi needs to respond to a few of the media actions:

SDkie commented 10 years ago

@eighthave: I guess along with ACTION_MEDIA_SHARED & ACTION_MEDIA_REMOVED, we will get ACTION_MEDIA_UNMOUNTED intent also. But not sure what will be the time gap between them. So, should we have stop chroot on all 3 of them?

What kind of clean up code we should have for ACTION_MEDIA_BAD_REMOVAL? many processes will be active and we will not be able to write back anything on sdcard.

eighthave commented 10 years ago

The exact behaviors that Lil' Debi does depends on how these broadcasts behave. The docs describe that pretty well: https://developer.android.com/reference/android/content/Intent.html#ACTION_MEDIA_REMOVED

A harder question is which broadcasts are sent based on a given action. For example, if the user unmounts, then removes the SD card, what broadcasts are sent? My guess is ACTION_MEDIA_EJECT then ACTION_MEDIA_UNMOUNTED tthen ACTION_MEDIA_REMOVED.

It seems that ACTION_MEDIA_UNMOUNTED and ACTION_MEDIA_REMOVED both should disable the start button, maybe ACTION_MEDIA_SHARED too. "ACTION_MEDIA_UNMOUNTED" means "External media is present, but not mounted at its mount point." "ACTION_MEDIA_REMOVED" means "External media has been removed".

One other little detail: Lil' Debi should check the mount path for these broadcasts and only respond if it matches the mount path that Lil' Debi is actually using. The docs say "The path to the mount point for the media to be ejected is contained in the Intent.mData field.".

ACTION_MEDIA_BAD_REMOVAL is a hard one. Should this force a full shutdown of the Lil' Debi processes? That might make sense since they won't be able to read the files anymore. But it might make more sense to keep things running since something like a webserver might keep working anyway.