Merge "Add new shutdown observer for MountService. Use new observer before rebooting and shutting down. Add some unit tests for unmount and shutdown code paths Fix registering/unregistering part in MountService Use ShutdownThread in PowerManager.reboot() Add reboot support to ShutdownThread. Remove MountService code from PowerManagerService.java and Power.java. Clean shutdown/reboot is handled exclusively by ShutdownThread now."

This commit is contained in:
Mike Lockwood
2010-03-09 14:50:18 -08:00
committed by Android (Google) Code Review
10 changed files with 490 additions and 108 deletions

View File

@@ -18,7 +18,6 @@ package android.os;
import java.io.IOException;
import android.os.ServiceManager;
import android.os.storage.IMountService;
/**
* Class that provides access to some of the power management functions.
@@ -101,15 +100,6 @@ public class Power
*/
public static void reboot(String reason) throws IOException
{
IMountService mSvc = IMountService.Stub.asInterface(
ServiceManager.getService("mount"));
if (mSvc != null) {
try {
mSvc.shutdown();
} catch (Exception e) {
}
}
rebootNative(reason);
}

View File

@@ -18,6 +18,7 @@
package android.os.storage;
import android.os.storage.IMountServiceListener;
import android.os.storage.IMountShutdownObserver;
/** WARNING! Update IMountService.h and IMountService.cpp if you change this file.
* In particular, the ordering of the methods below must match the
@@ -142,6 +143,7 @@ interface IMountService
/**
* Shuts down the MountService and gracefully unmounts all external media.
* Invokes call back once the shutdown is complete.
*/
void shutdown();
void shutdown(IMountShutdownObserver observer);
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.os.storage;
/**
* Callback class for receiving events related
* to shutdown.
*
* @hide - For internal consumption only.
*/
interface IMountShutdownObserver {
/**
* This method is called when the shutdown
* of MountService completed.
* @param statusCode indicates success or failure
* of the shutdown.
*/
void onShutDownComplete(int statusCode);
}