Clean up ASEC unmounting on physical storage.
When physical devices are unsafely removed, unmountAllAsecsInDir()
fails to find any ASECs, and leaves them all mounted, preventing the
rest of volume from going down.
Now we examine all ASEC containers, and remove when on external
storage, or when the storage media is no longer found.
Bug: 11175082
Change-Id: Iffa38ea43f7e5ad78b598374ebeb60a8727d99fd
diff --git a/Volume.cpp b/Volume.cpp
index cbec5d4..21b66b1 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -72,6 +72,7 @@
* Path to internal storage where *only* root can access ASEC image files
*/
const char *Volume::SEC_ASECDIR_INT = "/data/app-asec";
+
/*
* Path to where secure containers are mounted
*/
@@ -480,6 +481,7 @@
}
if (fs_prepare_dir(secure_path, 0770, AID_MEDIA_RW, AID_MEDIA_RW) != 0) {
+ SLOGW("fs_prepare_dir failed: %s", strerror(errno));
return -1;
}
@@ -662,7 +664,7 @@
char line[1024];
char value[128];
if (fgets(line, sizeof(line), fp) != NULL) {
- ALOGD("blkid reported: %s", line);
+ ALOGD("blkid identified as %s", line);
char* start = strstr(line, "UUID=") + 5;
if (sscanf(start, "\"%127[^\"]\"", value) == 1) {
@@ -678,6 +680,7 @@
setUserLabel(NULL);
}
} else {
+ ALOGW("blkid failed to identify %s", devicePath);
res = -1;
}