mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Extract system sound and vibration functionality out of activity.mojom
This commit is contained in:
parent
8ef1e51ca8
commit
6a099fa716
@ -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",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
27
sky/services/platform/haptic_feedback.mojom
Normal file
27
sky/services/platform/haptic_feedback.mojom
Normal 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);
|
||||
};
|
||||
24
sky/services/platform/system_sound.mojom
Normal file
24
sky/services/platform/system_sound.mojom
Normal 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);
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user