summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2010-04-06 10:50:56 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-04-06 10:50:56 -0700
commitfede9aed2b1f0b6316e18cbfa58be593fa7eb14c (patch)
tree99dd7966ea2b739db0227cc94d956d85c09e25b5 /services
parentb2e6c01f449f3fd4effee7029518684deb4e98f6 (diff)
parent7af074a6124d2293bc979e24f3258166efb8a310 (diff)
downloadframeworks_base-fede9aed2b1f0b6316e18cbfa58be593fa7eb14c.zip
frameworks_base-fede9aed2b1f0b6316e18cbfa58be593fa7eb14c.tar.gz
frameworks_base-fede9aed2b1f0b6316e18cbfa58be593fa7eb14c.tar.bz2
Merge "Forcibly unmount the sdcard after N retries." into froyo
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/MountService.java46
1 files changed, 20 insertions, 26 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 90cb585..6ceeb95 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -213,15 +213,14 @@ class MountService extends IMountService.Stub
}
case H_UNMOUNT_PM_DONE: {
if (DEBUG_UNMOUNT) Slog.i(TAG, "H_UNMOUNT_PM_DONE");
- if (!mUpdatingStatus) {
- // Does not correspond to unmount's status update.
- return;
- }
if (DEBUG_UNMOUNT) Slog.i(TAG, "Updated status. Processing requests");
mUpdatingStatus = false;
int size = mForceUnmounts.size();
int sizeArr[] = new int[size];
int sizeArrN = 0;
+ // Kill processes holding references first
+ ActivityManagerService ams = (ActivityManagerService)
+ ServiceManager.getService("activity");
for (int i = 0; i < size; i++) {
UnmountCallBack ucb = mForceUnmounts.get(i);
String path = ucb.path;
@@ -233,35 +232,30 @@ class MountService extends IMountService.Stub
if (pids == null || pids.length == 0) {
done = true;
} else {
- // Kill processes holding references first
- ActivityManagerService ams = (ActivityManagerService)
- ServiceManager.getService("activity");
// Eliminate system process here?
- boolean ret = ams.killPids(pids, "Unmount media");
- if (ret) {
- // Confirm if file references have been freed.
- pids = getStorageUsers(path);
- if (pids == null || pids.length == 0) {
- done = true;
- }
+ ams.killPids(pids, "unmount media");
+ // Confirm if file references have been freed.
+ pids = getStorageUsers(path);
+ if (pids == null || pids.length == 0) {
+ done = true;
}
}
}
- if (done) {
- sizeArr[sizeArrN++] = i;
- mHandler.sendMessage(mHandler.obtainMessage(H_UNMOUNT_MS,
- ucb));
+ if (!done && (ucb.retries < MAX_UNMOUNT_RETRIES)) {
+ // Retry again
+ Slog.i(TAG, "Retrying to kill storage users again");
+ mHandler.sendMessageDelayed(
+ mHandler.obtainMessage(H_UNMOUNT_PM_DONE,
+ ucb.retries++),
+ RETRY_UNMOUNT_DELAY);
} else {
if (ucb.retries >= MAX_UNMOUNT_RETRIES) {
- Slog.i(TAG, "Cannot unmount media inspite of " +
- MAX_UNMOUNT_RETRIES + " retries");
- // Send final broadcast indicating failure to unmount.
- } else {
- mHandler.sendMessageDelayed(
- mHandler.obtainMessage(H_UNMOUNT_PM_DONE,
- ucb.retries++),
- RETRY_UNMOUNT_DELAY);
+ Slog.i(TAG, "Failed to unmount media inspite of " +
+ MAX_UNMOUNT_RETRIES + " retries. Forcibly killing processes now");
}
+ sizeArr[sizeArrN++] = i;
+ mHandler.sendMessage(mHandler.obtainMessage(H_UNMOUNT_MS,
+ ucb));
}
}
// Remove already processed elements from list.