diff options
| -rw-r--r-- | include/hardware_legacy/IMountService.h | 15 | ||||
| -rw-r--r-- | include/hardware_legacy/vibrator.h | 4 | ||||
| -rw-r--r-- | mount/IMountService.cpp | 32 | ||||
| -rw-r--r-- | vibrator/vibrator.c | 4 |
4 files changed, 51 insertions, 4 deletions
diff --git a/include/hardware_legacy/IMountService.h b/include/hardware_legacy/IMountService.h index 6737dcf..b956ec8 100644 --- a/include/hardware_legacy/IMountService.h +++ b/include/hardware_legacy/IMountService.h @@ -54,6 +54,21 @@ public: * Safely unmount external storage at given mount point. */ virtual void unmountMedia(String16 mountPoint) = 0; + + /** + * Format external storage at given mount point. + */ + virtual void formatMedia(String16 mountPoint) = 0; + + /** + * Returns true if we're playing media notification sounds. + */ + virtual bool getPlayNotificationSounds() = 0; + + /** + * Sets whether or not media notification sounds are played. + */ + virtual void setPlayNotificationSounds(bool enabled) = 0; }; // ---------------------------------------------------------------------- diff --git a/include/hardware_legacy/vibrator.h b/include/hardware_legacy/vibrator.h index 5245aeb..15fd942 100644 --- a/include/hardware_legacy/vibrator.h +++ b/include/hardware_legacy/vibrator.h @@ -24,9 +24,11 @@ extern "C" { /** * Turn on vibrator * + * @param timeout_ms number of milliseconds to vibrate + * * @return 0 if successful, -1 if error */ -int vibrator_on(); +int vibrator_on(int timeout_ms); /** * Turn off vibrator diff --git a/mount/IMountService.cpp b/mount/IMountService.cpp index 816d303..d747ba2 100644 --- a/mount/IMountService.cpp +++ b/mount/IMountService.cpp @@ -28,7 +28,10 @@ enum { SET_MASS_STORAGE_ENABLED_TRANSACTION, GET_MASS_STORAGE_CONNECTED_TRANSACTION, MOUNT_MEDIA_TRANSACTION, - UNMOUNT_MEDIA_TRANSACTION + UNMOUNT_MEDIA_TRANSACTION, + FORMAT_MEDIA_TRANSACTION, + SET_PLAY_NOTIFICATION_SOUNDS_TRANSACTION, + GET_PLAY_NOTIFICATION_SOUNDS_TRANSACTION, }; class BpMountService : public BpInterface<IMountService> @@ -80,6 +83,33 @@ public: data.writeString16(mountPoint); remote()->transact(UNMOUNT_MEDIA_TRANSACTION, data, &reply); } + + virtual void formatMedia(String16 mountPoint) + { + Parcel data, reply; + data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); + data.writeString16(mountPoint); + remote()->transact(FORMAT_MEDIA_TRANSACTION, data, &reply); + } + + virtual bool getPlayNotificationSounds() + { + uint32_t n; + Parcel data, reply; + data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); + remote()->transact(GET_PLAY_NOTIFICATION_SOUNDS_TRANSACTION, data, &reply); + return reply.readInt32(); + } + + virtual void setPlayNotificationSounds(bool enabled) + { + Parcel data, reply; + data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); + data.writeInt32(enabled ? 1 : 0); + remote()->transact(SET_PLAY_NOTIFICATION_SOUNDS_TRANSACTION, data, &reply); + } + + }; IMPLEMENT_META_INTERFACE(MountService, "android.os.IMountService"); diff --git a/vibrator/vibrator.c b/vibrator/vibrator.c index 3644356..22cc506 100644 --- a/vibrator/vibrator.c +++ b/vibrator/vibrator.c @@ -46,10 +46,10 @@ static int sendit(int timeout_ms) return (ret == nwr) ? 0 : -1; } -int vibrator_on() +int vibrator_on(int timeout_ms) { /* constant on, up to maximum allowed time */ - return sendit(-1); + return sendit(timeout_ms); } int vibrator_off() |
