Loading api/current.txt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -35249,11 +35249,16 @@ package android.os { public abstract class VibrationEffect implements android.os.Parcelable { public abstract class VibrationEffect implements android.os.Parcelable { method public static android.os.VibrationEffect createOneShot(long, int); method public static android.os.VibrationEffect createOneShot(long, int); method public static android.os.VibrationEffect createPrebaked(int); method public static android.os.VibrationEffect createWaveform(long[], int); method public static android.os.VibrationEffect createWaveform(long[], int); method public static android.os.VibrationEffect createWaveform(long[], int[], int); method public static android.os.VibrationEffect createWaveform(long[], int[], int); method public int describeContents(); method public int describeContents(); field public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR; field public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR; field public static final int DEFAULT_AMPLITUDE = -1; // 0xffffffff field public static final int DEFAULT_AMPLITUDE = -1; // 0xffffffff field public static final int EFFECT_CLICK = 0; // 0x0 field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1 field public static final int EFFECT_HEAVY_CLICK = 5; // 0x5 field public static final int EFFECT_TICK = 2; // 0x2 } } public abstract class Vibrator { public abstract class Vibrator { api/test-current.txt +0 −4 Original line number Original line Diff line number Diff line Loading @@ -1269,15 +1269,11 @@ package android.os { method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context); method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context); method public abstract long getDuration(); method public abstract long getDuration(); method protected static int scale(int, float, int); method protected static int scale(int, float, int); field public static final int EFFECT_CLICK = 0; // 0x0 field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1 field public static final int EFFECT_HEAVY_CLICK = 5; // 0x5 field public static final int EFFECT_POP = 4; // 0x4 field public static final int EFFECT_POP = 4; // 0x4 field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0 field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0 field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1 field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1 field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2 field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2 field public static final int EFFECT_THUD = 3; // 0x3 field public static final int EFFECT_THUD = 3; // 0x3 field public static final int EFFECT_TICK = 2; // 0x2 field public static final int[] RINGTONES; field public static final int[] RINGTONES; } } Loading core/java/android/os/VibrationEffect.java +34 −8 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.os; package android.os; import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.TestApi; import android.annotation.TestApi; import android.content.ContentResolver; import android.content.ContentResolver; Loading @@ -25,6 +26,8 @@ import android.hardware.vibrator.V1_2.Effect; import android.net.Uri; import android.net.Uri; import android.util.MathUtils; import android.util.MathUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.Arrays; /** /** Loading Loading @@ -52,26 +55,20 @@ public abstract class VibrationEffect implements Parcelable { * A click effect. * A click effect. * * * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_CLICK = Effect.CLICK; public static final int EFFECT_CLICK = Effect.CLICK; /** /** * A double click effect. * A double click effect. * * * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_DOUBLE_CLICK = Effect.DOUBLE_CLICK; public static final int EFFECT_DOUBLE_CLICK = Effect.DOUBLE_CLICK; /** /** * A tick effect. * A tick effect. * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_TICK = Effect.TICK; public static final int EFFECT_TICK = Effect.TICK; /** /** Loading @@ -93,9 +90,7 @@ public abstract class VibrationEffect implements Parcelable { /** /** * A heavy click effect. * A heavy click effect. * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; /** {@hide} */ /** {@hide} */ Loading Loading @@ -136,6 +131,16 @@ public abstract class VibrationEffect implements Parcelable { Effect.RINGTONE_15 Effect.RINGTONE_15 }; }; /** @hide */ @IntDef(prefix = { "EFFECT_" }, value = { EFFECT_TICK, EFFECT_CLICK, EFFECT_HEAVY_CLICK, EFFECT_DOUBLE_CLICK, }) @Retention(RetentionPolicy.SOURCE) public @interface EffectType {} /** @hide to prevent subclassing from outside of the framework */ /** @hide to prevent subclassing from outside of the framework */ public VibrationEffect() { } public VibrationEffect() { } Loading Loading @@ -218,6 +223,27 @@ public abstract class VibrationEffect implements Parcelable { return effect; return effect; } } /** * Create a predefined vibration effect. * * Predefined effects are a set of common vibration effects that should be identical, regardless * of the app they come from, in order to provide a cohesive experience for users across * the entire device. They also may be custom tailored to the device hardware in order to * provide a better experience than you could otherwise build using the generic building * blocks. * * This will fallback to a generic pattern if one exists and there does not exist a * hardware-specific implementation of the effect. * * @param effectId The ID of the effect to perform: * {@link #EFFECT_CLICK}, {@link #EFFECT_DOUBLE_CLICK}, {@link #EFFECT_TICK} * * @return The desired effect. */ public static VibrationEffect createPrebaked(@EffectType int effectId) { return get(effectId, true); } /** /** * Get a predefined vibration effect. * Get a predefined vibration effect. * * Loading Loading
api/current.txt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -35249,11 +35249,16 @@ package android.os { public abstract class VibrationEffect implements android.os.Parcelable { public abstract class VibrationEffect implements android.os.Parcelable { method public static android.os.VibrationEffect createOneShot(long, int); method public static android.os.VibrationEffect createOneShot(long, int); method public static android.os.VibrationEffect createPrebaked(int); method public static android.os.VibrationEffect createWaveform(long[], int); method public static android.os.VibrationEffect createWaveform(long[], int); method public static android.os.VibrationEffect createWaveform(long[], int[], int); method public static android.os.VibrationEffect createWaveform(long[], int[], int); method public int describeContents(); method public int describeContents(); field public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR; field public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR; field public static final int DEFAULT_AMPLITUDE = -1; // 0xffffffff field public static final int DEFAULT_AMPLITUDE = -1; // 0xffffffff field public static final int EFFECT_CLICK = 0; // 0x0 field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1 field public static final int EFFECT_HEAVY_CLICK = 5; // 0x5 field public static final int EFFECT_TICK = 2; // 0x2 } } public abstract class Vibrator { public abstract class Vibrator {
api/test-current.txt +0 −4 Original line number Original line Diff line number Diff line Loading @@ -1269,15 +1269,11 @@ package android.os { method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context); method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context); method public abstract long getDuration(); method public abstract long getDuration(); method protected static int scale(int, float, int); method protected static int scale(int, float, int); field public static final int EFFECT_CLICK = 0; // 0x0 field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1 field public static final int EFFECT_HEAVY_CLICK = 5; // 0x5 field public static final int EFFECT_POP = 4; // 0x4 field public static final int EFFECT_POP = 4; // 0x4 field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0 field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0 field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1 field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1 field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2 field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2 field public static final int EFFECT_THUD = 3; // 0x3 field public static final int EFFECT_THUD = 3; // 0x3 field public static final int EFFECT_TICK = 2; // 0x2 field public static final int[] RINGTONES; field public static final int[] RINGTONES; } } Loading
core/java/android/os/VibrationEffect.java +34 −8 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.os; package android.os; import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.TestApi; import android.annotation.TestApi; import android.content.ContentResolver; import android.content.ContentResolver; Loading @@ -25,6 +26,8 @@ import android.hardware.vibrator.V1_2.Effect; import android.net.Uri; import android.net.Uri; import android.util.MathUtils; import android.util.MathUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.Arrays; /** /** Loading Loading @@ -52,26 +55,20 @@ public abstract class VibrationEffect implements Parcelable { * A click effect. * A click effect. * * * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_CLICK = Effect.CLICK; public static final int EFFECT_CLICK = Effect.CLICK; /** /** * A double click effect. * A double click effect. * * * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_DOUBLE_CLICK = Effect.DOUBLE_CLICK; public static final int EFFECT_DOUBLE_CLICK = Effect.DOUBLE_CLICK; /** /** * A tick effect. * A tick effect. * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_TICK = Effect.TICK; public static final int EFFECT_TICK = Effect.TICK; /** /** Loading @@ -93,9 +90,7 @@ public abstract class VibrationEffect implements Parcelable { /** /** * A heavy click effect. * A heavy click effect. * @see #get(int) * @see #get(int) * @hide */ */ @TestApi public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; /** {@hide} */ /** {@hide} */ Loading Loading @@ -136,6 +131,16 @@ public abstract class VibrationEffect implements Parcelable { Effect.RINGTONE_15 Effect.RINGTONE_15 }; }; /** @hide */ @IntDef(prefix = { "EFFECT_" }, value = { EFFECT_TICK, EFFECT_CLICK, EFFECT_HEAVY_CLICK, EFFECT_DOUBLE_CLICK, }) @Retention(RetentionPolicy.SOURCE) public @interface EffectType {} /** @hide to prevent subclassing from outside of the framework */ /** @hide to prevent subclassing from outside of the framework */ public VibrationEffect() { } public VibrationEffect() { } Loading Loading @@ -218,6 +223,27 @@ public abstract class VibrationEffect implements Parcelable { return effect; return effect; } } /** * Create a predefined vibration effect. * * Predefined effects are a set of common vibration effects that should be identical, regardless * of the app they come from, in order to provide a cohesive experience for users across * the entire device. They also may be custom tailored to the device hardware in order to * provide a better experience than you could otherwise build using the generic building * blocks. * * This will fallback to a generic pattern if one exists and there does not exist a * hardware-specific implementation of the effect. * * @param effectId The ID of the effect to perform: * {@link #EFFECT_CLICK}, {@link #EFFECT_DOUBLE_CLICK}, {@link #EFFECT_TICK} * * @return The desired effect. */ public static VibrationEffect createPrebaked(@EffectType int effectId) { return get(effectId, true); } /** /** * Get a predefined vibration effect. * Get a predefined vibration effect. * * Loading