From a8bef3d4842172ec14616772940dcea418ac3e75 Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Tue, 18 May 2021 13:21:48 +0100 Subject: [PATCH] Add hasExternalControl hidden API to Vibrator This capability will be queried by the AudioManager to be used to define if the device has haptic playback capabilities. Fix: 187227888 Test: N/A Change-Id: Idc046d2fee12b3317db25975b29cf96f5f9c41b3 --- core/java/android/os/Vibrator.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java index 95962c82a6112..12538e6cd46b3 100644 --- a/core/java/android/os/Vibrator.java +++ b/core/java/android/os/Vibrator.java @@ -226,6 +226,17 @@ public abstract class Vibrator { IVibrator.CAP_FREQUENCY_CONTROL | IVibrator.CAP_COMPOSE_PWLE_EFFECTS); } + /** + * Check whether the vibrator can be controlled by an external service with the + * {@link IExternalVibratorService}. + * + * @return True if the hardware can be controlled by an external service, otherwise false. + * @hide + */ + public boolean hasExternalControl() { + return getInfo().hasCapability(IVibrator.CAP_EXTERNAL_CONTROL); + } + /** * Gets the resonant frequency of the vibrator. *