summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2022-04-07 23:26:18 +0000
committerMichael Wright <michaelwr@google.com>2022-04-07 23:26:18 +0000
commit38dc7aa55cc21aeb7f1be6d0ffc3c357c979735b (patch)
tree00466335eac9c95c702fae9f1aae4d0aecf33400 /core/java/android
parent67617005269f1da240ca8c13bedb559462760c82 (diff)
DO NOT MERGE Remove PWLE APIs from T
Fixes: 228529016 Test: build Change-Id: Icfd576f3dff0850f464be32c5a3315e723c3d380
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/VibrationEffect.java18
-rw-r--r--core/java/android/os/Vibrator.java8
-rw-r--r--core/java/android/os/vibrator/VibratorFrequencyProfile.java3
3 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/os/VibrationEffect.java b/core/java/android/os/VibrationEffect.java
index 237f6ed819f6..ec1c57d675c1 100644
--- a/core/java/android/os/VibrationEffect.java
+++ b/core/java/android/os/VibrationEffect.java
@@ -413,8 +413,10 @@ public abstract class VibrationEffect implements Parcelable {
* {@link #startWaveform(VibrationEffect.VibrationParameter)}.
*
* @see VibrationEffect.WaveformBuilder
+ * @hide
*/
@NonNull
+ @TestApi
public static WaveformBuilder startWaveform() {
return new WaveformBuilder();
}
@@ -431,8 +433,10 @@ public abstract class VibrationEffect implements Parcelable {
* @return The {@link VibrationEffect.WaveformBuilder} started with the initial parameters.
*
* @see VibrationEffect.WaveformBuilder
+ * @hide
*/
@NonNull
+ @TestApi
public static WaveformBuilder startWaveform(@NonNull VibrationParameter initialParameter) {
WaveformBuilder builder = startWaveform();
builder.addTransition(Duration.ZERO, initialParameter);
@@ -454,8 +458,10 @@ public abstract class VibrationEffect implements Parcelable {
* @return The {@link VibrationEffect.WaveformBuilder} started with the initial parameters.
*
* @see VibrationEffect.WaveformBuilder
+ * @hide
*/
@NonNull
+ @TestApi
public static WaveformBuilder startWaveform(@NonNull VibrationParameter initialParameter1,
@NonNull VibrationParameter initialParameter2) {
WaveformBuilder builder = startWaveform();
@@ -869,7 +875,9 @@ public abstract class VibrationEffect implements Parcelable {
/**
* Exception thrown when adding an element to a {@link Composition} that already ends in an
* indefinitely repeating effect.
+ * @hide
*/
+ @TestApi
public static final class UnreachableAfterRepeatingIndefinitelyException
extends IllegalStateException {
UnreachableAfterRepeatingIndefinitelyException() {
@@ -938,8 +946,10 @@ public abstract class VibrationEffect implements Parcelable {
*
* @throws UnreachableAfterRepeatingIndefinitelyException if the composition is currently
* ending with a repeating effect.
+ * @hide
*/
@NonNull
+ @TestApi
public Composition addOffDuration(@NonNull Duration duration) {
int durationMs = (int) duration.toMillis();
Preconditions.checkArgumentNonnegative(durationMs, "Off period must be non-negative");
@@ -965,8 +975,10 @@ public abstract class VibrationEffect implements Parcelable {
*
* @throws UnreachableAfterRepeatingIndefinitelyException if the composition is currently
* ending with a repeating effect.
+ * @hide
*/
@NonNull
+ @TestApi
public Composition addEffect(@NonNull VibrationEffect effect) {
return addSegments(effect);
}
@@ -987,8 +999,10 @@ public abstract class VibrationEffect implements Parcelable {
* @throws IllegalArgumentException if the given effect is already repeating indefinitely.
* @throws UnreachableAfterRepeatingIndefinitelyException if the composition is currently
* ending with a repeating effect.
+ * @hide
*/
@NonNull
+ @TestApi
public Composition repeatEffectIndefinitely(@NonNull VibrationEffect effect) {
Preconditions.checkArgument(effect.getDuration() < Long.MAX_VALUE,
"Can't repeat an indefinitely repeating effect. Consider addEffect instead.");
@@ -1202,7 +1216,9 @@ public abstract class VibrationEffect implements Parcelable {
* .build();}</pre>
*
* @see VibrationEffect#startWaveform
+ * @hide
*/
+ @TestApi
public static final class WaveformBuilder {
// Epsilon used for float comparison of amplitude and frequency values on transitions.
private static final float EPSILON = 1e-5f;
@@ -1383,8 +1399,10 @@ public abstract class VibrationEffect implements Parcelable {
* <p>Examples of concrete parameters are the vibration amplitude or frequency.
*
* @see VibrationEffect.WaveformBuilder
+ * @hide
*/
@SuppressWarnings("UserHandleName") // This is not a regular set of parameters, no *Params.
+ @TestApi
public static class VibrationParameter {
VibrationParameter() {
}
diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java
index 7f0d6349f57f..465d90d36698 100644
--- a/core/java/android/os/Vibrator.java
+++ b/core/java/android/os/Vibrator.java
@@ -212,7 +212,9 @@ public abstract class Vibrator {
*
* @return True if the hardware can control the frequency of the vibrations independently of
* the vibration amplitude, false otherwise.
+ * @hide
*/
+ @TestApi
public boolean hasFrequencyControl() {
// We currently can only control frequency of the vibration using the compose PWLE method.
return getInfo().hasCapability(
@@ -236,7 +238,9 @@ public abstract class Vibrator {
* @return the resonant frequency of the vibrator, or {@link Float#NaN NaN} if it's unknown, not
* applicable, or if this vibrator is a composite of multiple physical devices with different
* frequencies.
+ * @hide
*/
+ @TestApi
public float getResonantFrequency() {
return getInfo().getResonantFrequencyHz();
}
@@ -247,7 +251,9 @@ public abstract class Vibrator {
* @return the Q factor of the vibrator, or {@link Float#NaN NaN} if it's unknown, not
* applicable, or if this vibrator is a composite of multiple physical devices with different
* Q factors.
+ * @hide
*/
+ @TestApi
public float getQFactor() {
return getInfo().getQFactor();
}
@@ -262,7 +268,9 @@ public abstract class Vibrator {
* frequency control. If this vibrator is a composite of multiple physical devices then this
* will return a profile supported in all devices, or null if the intersection is empty or not
* available.
+ * @hide
*/
+ @TestApi
@Nullable
public VibratorFrequencyProfile getFrequencyProfile() {
VibratorInfo.FrequencyProfile frequencyProfile = getInfo().getFrequencyProfile();
diff --git a/core/java/android/os/vibrator/VibratorFrequencyProfile.java b/core/java/android/os/vibrator/VibratorFrequencyProfile.java
index 0f2aa157d94c..afc0007afd42 100644
--- a/core/java/android/os/vibrator/VibratorFrequencyProfile.java
+++ b/core/java/android/os/vibrator/VibratorFrequencyProfile.java
@@ -18,6 +18,7 @@ package android.os.vibrator;
import android.annotation.FloatRange;
import android.annotation.NonNull;
+import android.annotation.TestApi;
import android.os.VibratorInfo;
import com.android.internal.util.Preconditions;
@@ -38,7 +39,9 @@ import com.android.internal.util.Preconditions;
* frequency increment between each pair of amplitude values.
*
* <p>Vibrators without independent frequency control do not have a frequency profile.
+ * @hide
*/
+@TestApi
public final class VibratorFrequencyProfile {
private final VibratorInfo.FrequencyProfile mFrequencyProfile;