From c76c77393fc2d735564aa9a47490f11bef342c13 Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Wed, 26 May 2021 15:11:11 +0100 Subject: [PATCH] Add documentation to VibratorManager on foreground/background behavior Add information to javadocs explaining that apps in background can only vibrate the device if the given AudioAttributes usage is one of notification, ringtone or alarm usages. Bug: 146313440 Test: N/A Change-Id: Ib0b8401539157f0ce2768aab281f3b23aae38dae --- core/java/android/os/VibratorManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/java/android/os/VibratorManager.java b/core/java/android/os/VibratorManager.java index 01cece39b9228..c82a51669b866 100644 --- a/core/java/android/os/VibratorManager.java +++ b/core/java/android/os/VibratorManager.java @@ -94,6 +94,8 @@ public abstract class VibratorManager { * VibrationEffect VibrationEffects} to be played on one or more vibrators. *

* + *

The app should be in foreground for the vibration to happen.

+ * * @param effect a combination of effects to be performed by one or more vibrators. */ @RequiresPermission(android.Manifest.permission.VIBRATE) @@ -109,6 +111,9 @@ public abstract class VibratorManager { * VibrationEffect} to be played on one or more vibrators. *

* + *

The app should be in foreground for the vibration to happen. Background apps should + * specify a ringtone, notification or alarm usage in order to vibrate.

+ * * @param effect a combination of effects to be performed by one or more vibrators. * @param attributes {@link VibrationAttributes} corresponding to the vibration. For example, * specify {@link VibrationAttributes#USAGE_ALARM} for alarm vibrations or