Extract system sound and vibration functionality out of activity.mojom

This commit is contained in:
Chinmay Garde 2016-01-29 16:54:05 -08:00
parent 8ef1e51ca8
commit 6a099fa716
3 changed files with 54 additions and 1 deletions

View File

@ -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",
]
}

View File

@ -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);
};

View File

@ -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);
};