Merge "Address API Council feedback." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6d2c6f0255
@@ -37146,11 +37146,10 @@ package android.os {
|
||||
field public static final int EFFECT_TICK = 2; // 0x2
|
||||
}
|
||||
|
||||
public static class VibrationEffect.Composition {
|
||||
ctor public VibrationEffect.Composition();
|
||||
method @Nullable public android.os.VibrationEffect.Composition addPrimitive(int);
|
||||
method @Nullable public android.os.VibrationEffect.Composition addPrimitive(int, @FloatRange(from=0.0f, to=1.0f) float);
|
||||
method @Nullable public android.os.VibrationEffect.Composition addPrimitive(int, @FloatRange(from=0.0f, to=1.0f) float, @IntRange(from=0) int);
|
||||
public static final class VibrationEffect.Composition {
|
||||
method @NonNull public android.os.VibrationEffect.Composition addPrimitive(int);
|
||||
method @NonNull public android.os.VibrationEffect.Composition addPrimitive(int, @FloatRange(from=0.0f, to=1.0f) float);
|
||||
method @NonNull public android.os.VibrationEffect.Composition addPrimitive(int, @FloatRange(from=0.0f, to=1.0f) float, @IntRange(from=0) int);
|
||||
method @NonNull public android.os.VibrationEffect compose();
|
||||
field public static final int PRIMITIVE_CLICK = 1; // 0x1
|
||||
field public static final int PRIMITIVE_QUICK_FALL = 6; // 0x6
|
||||
@@ -37160,8 +37159,8 @@ package android.os {
|
||||
}
|
||||
|
||||
public abstract class Vibrator {
|
||||
method @Nullable public Boolean areAllEffectsSupported(@NonNull int...);
|
||||
method public boolean areAllPrimitivesSupported(@NonNull int...);
|
||||
method @Nullable public final Boolean areAllEffectsSupported(@NonNull int...);
|
||||
method public final boolean areAllPrimitivesSupported(@NonNull int...);
|
||||
method @Nullable public boolean[] areEffectsSupported(@NonNull int...);
|
||||
method @NonNull public boolean[] arePrimitivesSupported(@NonNull int...);
|
||||
method @RequiresPermission(android.Manifest.permission.VIBRATE) public abstract void cancel();
|
||||
|
||||
@@ -961,7 +961,7 @@ public abstract class VibrationEffect implements Parcelable {
|
||||
*
|
||||
* @see VibrationEffect#startComposition()
|
||||
*/
|
||||
public static class Composition {
|
||||
public static final class Composition {
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "PRIMITIVE_" }, value = {
|
||||
PRIMITIVE_CLICK,
|
||||
@@ -1020,6 +1020,8 @@ public abstract class VibrationEffect implements Parcelable {
|
||||
|
||||
private ArrayList<PrimitiveEffect> mEffects = new ArrayList<>();
|
||||
|
||||
Composition() { }
|
||||
|
||||
/**
|
||||
* Add a haptic primitive to the end of the current composition.
|
||||
*
|
||||
@@ -1030,7 +1032,7 @@ public abstract class VibrationEffect implements Parcelable {
|
||||
*
|
||||
* @return The {@link Composition} object to enable adding multiple primitives in one chain.
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public Composition addPrimitive(@Primitive int primitiveId) {
|
||||
addPrimitive(primitiveId, /*scale*/ 1.0f, /*delay*/ 0);
|
||||
return this;
|
||||
@@ -1046,7 +1048,7 @@ public abstract class VibrationEffect implements Parcelable {
|
||||
*
|
||||
* @return The {@link Composition} object to enable adding multiple primitives in one chain.
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public Composition addPrimitive(@Primitive int primitiveId,
|
||||
@FloatRange(from = 0f, to = 1f) float scale) {
|
||||
addPrimitive(primitiveId, scale, /*delay*/ 0);
|
||||
@@ -1058,11 +1060,11 @@ public abstract class VibrationEffect implements Parcelable {
|
||||
*
|
||||
* @param primitiveId The primitive to add
|
||||
* @param scale The scale to apply to the intensity of the primitive.
|
||||
* @param delay The amount of time, in milliseconds, to wait before playing the prior
|
||||
* @param delay The amount of time, in milliseconds, to wait between playing the prior
|
||||
* primitive and this one
|
||||
* @return The {@link Composition} object to enable adding multiple primitives in one chain.
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public Composition addPrimitive(@Primitive int primitiveId,
|
||||
@FloatRange(from = 0f, to = 1f) float scale, @IntRange(from = 0) int delay) {
|
||||
mEffects.add(new PrimitiveEffect(checkPrimitive(primitiveId), scale, delay));
|
||||
|
||||
@@ -351,7 +351,7 @@ public abstract class Vibrator {
|
||||
* what it supports.
|
||||
*/
|
||||
@Nullable
|
||||
public Boolean areAllEffectsSupported(
|
||||
public final Boolean areAllEffectsSupported(
|
||||
@NonNull @VibrationEffect.EffectType int... effectIds) {
|
||||
for (boolean supported : areEffectsSupported(effectIds)) {
|
||||
if (!supported) {
|
||||
@@ -384,7 +384,7 @@ public abstract class Vibrator {
|
||||
* @param primitiveIds Which primitives to query for.
|
||||
* @return Whether primitives effects are supported.
|
||||
*/
|
||||
public boolean areAllPrimitivesSupported(
|
||||
public final boolean areAllPrimitivesSupported(
|
||||
@NonNull @VibrationEffect.Composition.Primitive int... primitiveIds) {
|
||||
for (boolean supported : arePrimitivesSupported(primitiveIds)) {
|
||||
if (!supported) {
|
||||
|
||||
Reference in New Issue
Block a user