From b4a162e50a96d2eef5fa3ed686e1418c4fbc8ded Mon Sep 17 00:00:00 2001 From: San Mehat Date: Thu, 28 Jan 2010 08:03:44 -0800 Subject: [PATCH] framework: os: Introduce IMountServiceObserver Signed-off-by: San Mehat --- Android.mk | 1 + .../android/os/IMountServiceObserver.aidl | 66 ++++++++++++++++++ .../java/android/os/MountServiceObserver.java | 69 +++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 core/java/android/os/IMountServiceObserver.aidl create mode 100644 core/java/android/os/MountServiceObserver.java diff --git a/Android.mk b/Android.mk index 7cd482c95b507..7717c762c5b3f 100644 --- a/Android.mk +++ b/Android.mk @@ -112,6 +112,7 @@ LOCAL_SRC_FILES += \ core/java/android/os/ICheckinService.aidl \ core/java/android/os/IMessenger.aidl \ core/java/android/os/IMountService.aidl \ + core/java/android/os/IMountServiceObserver.aidl \ core/java/android/os/INetworkManagementService.aidl \ core/java/android/os/INetStatService.aidl \ core/java/android/os/IParentalControlCallback.aidl \ diff --git a/core/java/android/os/IMountServiceObserver.aidl b/core/java/android/os/IMountServiceObserver.aidl new file mode 100644 index 0000000000000..f753649c2ec88 --- /dev/null +++ b/core/java/android/os/IMountServiceObserver.aidl @@ -0,0 +1,66 @@ +/* + * 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; + +/** + * Callback class for receiving events from MountService. + * + * @hide + */ +interface IMountServiceObserver { + /** + * A sharing method has changed availability state. + * + * @param method The share method which has changed. + * @param available The share availability state. + */ + void shareAvailabilityChange(String method, boolean available); + + /** + * Media has been inserted + * + * @param label The volume label. + * @param path The volume mount path. + * @param major The backing device major number. + * @param minor The backing device minor number. + */ + void mediaInserted(String label, String path, int major, int minor); + + /** + * Media has been removed + * + * @param label The volume label. + * @param path The volume mount path. + * @param major The backing device major number. + * @param minor The backing device minor number. + * @param clean Indicates if the removal was clean (unmounted first). + */ + void mediaRemoved(String label, String path, int major, int minor, boolean clean); + + /** + * Volume state has changed. + * + * @param label The volume label. + * @param path The volume mount path. + * @param oldState The old state of the volume. + * @param newState The new state of the volume. + * + * Note: State is one of the values returned by Environment.getExternalStorageState() + */ + void volumeStateChange(String label, String path, String oldState, String newState); + +} diff --git a/core/java/android/os/MountServiceObserver.java b/core/java/android/os/MountServiceObserver.java new file mode 100644 index 0000000000000..3020562b53bb8 --- /dev/null +++ b/core/java/android/os/MountServiceObserver.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 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; + +/** + * Callback class for receiving progress reports during a restore operation. These + * methods will all be called on your application's main thread. + * @hide + */ +public abstract class MountServiceObserver { + /** + * A sharing method has changed availability state. + * + * @param method The share method which has changed. + * @param available The share availability state. + */ + void shareAvailabilityChange(String method, boolean available) { + } + + /** + * Media has been inserted + * + * @param label The volume label. + * @param path The volume mount path. + * @param major The backing device major number. + * @param minor The backing device minor number. + */ + void mediaInserted(String label, String path, int major, int minor) { + } + + /** + * Media has been removed + * + * @param label The volume label. + * @param path The volume mount path. + * @param major The backing device major number. + * @param minor The backing device minor number. + * @param clean Indicates if the removal was clean (unmounted first). + */ + void mediaRemoved(String label, String path, int major, int minor, boolean clean) { + } + + /** + * Volume state has changed. + * + * @param label The volume label. + * @param path The volume mount path. + * @param oldState The old state of the volume. + * @param newState The new state of the volume. + * + * Note: State is one of the values returned by Environment.getExternalStorageState() + */ + void volumeStateChange(String label, String path, String oldState, String newState) { + } +}