diff --git a/sky/services/platform/BUILD.gn b/sky/services/platform/BUILD.gn index 5a52959de16..12972a79234 100644 --- a/sky/services/platform/BUILD.gn +++ b/sky/services/platform/BUILD.gn @@ -6,8 +6,10 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("interfaces") { sources = [ - "system_chrome.mojom", + "haptic_feedback.mojom", "path_provider.mojom", + "system_chrome.mojom", + "system_sound.mojom", ] } diff --git a/sky/services/platform/haptic_feedback.mojom b/sky/services/platform/haptic_feedback.mojom new file mode 100644 index 00000000000..86d956aed16 --- /dev/null +++ b/sky/services/platform/haptic_feedback.mojom @@ -0,0 +1,27 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[DartPackage="sky_services"] +module flutter.platform; + +/// Allows access to the haptic feedback interface on the device. This API is +/// intentionally terse since it invokes default platform behavior. It is not +/// suitable for use if you require more flexible access to device sensors and +/// peripherals. +interface HapticFeedback { + /// Provides haptic feedback to the user for a short duration. + /// + /// Platform Specific Notes: + /// iOS: Uses the platform "sound" for vibration + /// (via AudioServicesPlaySystemSound) + /// Android: Uses the platform haptic feedback API that simulates a short + /// a short tap on a virtual keyboard. + /// + /// Return Value: + /// boolean indicating if the intent to provide haptic feedback to the user + /// was successfully conveyed to the embedder. There may not be any actual + /// feedback if the device does not have a vibrator or one is disabled in + /// system settings. + Vibrate() => (bool success); +}; diff --git a/sky/services/platform/system_sound.mojom b/sky/services/platform/system_sound.mojom new file mode 100644 index 00000000000..8dad0a3f85e --- /dev/null +++ b/sky/services/platform/system_sound.mojom @@ -0,0 +1,24 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[DartPackage="sky_services"] +module flutter.platform; + +/// A sound provided by the system +enum SystemSoundType { + Click, +}; + +/// Allows easy access to the library of short system specific sounds for +/// common tasks. +interface SystemSound { + /// Play the specified system sound. If that sound is not present on the + /// system, this method is a no-op and returns `true`. + /// + /// Return Value: + /// boolean indicating if the intent to play the specified sound was + /// successfully conveyed to the embedder. No sound may actually play if the + /// device is muted or the sound was not available on the platform. + Play(SystemSoundType type) => (bool success); +};