Loading core/java/android/os/VibrationEffect.java +16 −3 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import android.annotation.TestApi; import android.content.ContentResolver; import android.content.Context; import android.hardware.vibrator.V1_0.EffectStrength; import android.hardware.vibrator.V1_2.Effect; import android.hardware.vibrator.V1_3.Effect; import android.net.Uri; import android.util.MathUtils; Loading Loading @@ -94,6 +94,18 @@ public abstract class VibrationEffect implements Parcelable { */ public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; /** * A texture effect meant to replicate soft ticks. * * Unlike normal effects, texture effects are meant to be called repeatedly, generally in * response to some motion, in order to replicate the feeling of some texture underneath the * user's fingers. * * @see #get(int) * @hide */ public static final int EFFECT_TEXTURE_TICK = Effect.TEXTURE_TICK; /** {@hide} */ @TestApi public static final int EFFECT_STRENGTH_LIGHT = EffectStrength.LIGHT; Loading Loading @@ -746,6 +758,7 @@ public abstract class VibrationEffect implements Parcelable { case EFFECT_CLICK: case EFFECT_DOUBLE_CLICK: case EFFECT_TICK: case EFFECT_TEXTURE_TICK: case EFFECT_THUD: case EFFECT_POP: case EFFECT_HEAVY_CLICK: Loading Loading @@ -798,7 +811,7 @@ public abstract class VibrationEffect implements Parcelable { out.writeInt(mEffectStrength); } public static final @android.annotation.NonNull Parcelable.Creator<Prebaked> CREATOR = public static final @NonNull Parcelable.Creator<Prebaked> CREATOR = new Parcelable.Creator<Prebaked>() { @Override public Prebaked createFromParcel(Parcel in) { Loading @@ -813,7 +826,7 @@ public abstract class VibrationEffect implements Parcelable { }; } public static final @android.annotation.NonNull Parcelable.Creator<VibrationEffect> CREATOR = public static final @NonNull Parcelable.Creator<VibrationEffect> CREATOR = new Parcelable.Creator<VibrationEffect>() { @Override public VibrationEffect createFromParcel(Parcel in) { Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -5214,13 +5214,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { private VibrationEffect getVibrationEffect(int effectId) { long[] pattern; switch (effectId) { case HapticFeedbackConstants.CLOCK_TICK: case HapticFeedbackConstants.CONTEXT_CLICK: return VibrationEffect.get(VibrationEffect.EFFECT_TICK); case HapticFeedbackConstants.TEXT_HANDLE_MOVE: if (!mHapticTextHandleEnabled) { return null; } // fallthrough case HapticFeedbackConstants.CLOCK_TICK: return VibrationEffect.get(VibrationEffect.EFFECT_TEXTURE_TICK); case HapticFeedbackConstants.KEYBOARD_RELEASE: case HapticFeedbackConstants.VIRTUAL_KEY_RELEASE: case HapticFeedbackConstants.ENTRY_BUMP: Loading services/core/jni/com_android_server_VibratorService.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ bool isValidEffect(jlong effect) { } R val = static_cast<R>(effect); auto iter = hardware::hidl_enum_range<R>(); return val >= *iter.begin() && val < *std::prev(iter.end()); return val >= *iter.begin() && val <= *std::prev(iter.end()); } static void vibratorInit(JNIEnv /* env */, jobject /* clazz */) Loading Loading @@ -170,6 +170,9 @@ static jlong vibratorPerformEffect(JNIEnv*, jobject, jlong effect, jint strength } else if (isValidEffect<V1_2::Effect>(effect)) { ret = halCall(&V1_2::IVibrator::perform_1_2, static_cast<V1_2::Effect>(effect), effectStrength, callback); } else if (isValidEffect<V1_3::Effect>(effect)) { ret = halCall(&V1_3::IVibrator::perform_1_3, static_cast<V1_3::Effect>(effect), effectStrength, callback); } else { ALOGW("Unable to perform haptic effect, invalid effect ID (%" PRId32 ")", static_cast<int32_t>(effect)); Loading Loading
core/java/android/os/VibrationEffect.java +16 −3 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import android.annotation.TestApi; import android.content.ContentResolver; import android.content.Context; import android.hardware.vibrator.V1_0.EffectStrength; import android.hardware.vibrator.V1_2.Effect; import android.hardware.vibrator.V1_3.Effect; import android.net.Uri; import android.util.MathUtils; Loading Loading @@ -94,6 +94,18 @@ public abstract class VibrationEffect implements Parcelable { */ public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; /** * A texture effect meant to replicate soft ticks. * * Unlike normal effects, texture effects are meant to be called repeatedly, generally in * response to some motion, in order to replicate the feeling of some texture underneath the * user's fingers. * * @see #get(int) * @hide */ public static final int EFFECT_TEXTURE_TICK = Effect.TEXTURE_TICK; /** {@hide} */ @TestApi public static final int EFFECT_STRENGTH_LIGHT = EffectStrength.LIGHT; Loading Loading @@ -746,6 +758,7 @@ public abstract class VibrationEffect implements Parcelable { case EFFECT_CLICK: case EFFECT_DOUBLE_CLICK: case EFFECT_TICK: case EFFECT_TEXTURE_TICK: case EFFECT_THUD: case EFFECT_POP: case EFFECT_HEAVY_CLICK: Loading Loading @@ -798,7 +811,7 @@ public abstract class VibrationEffect implements Parcelable { out.writeInt(mEffectStrength); } public static final @android.annotation.NonNull Parcelable.Creator<Prebaked> CREATOR = public static final @NonNull Parcelable.Creator<Prebaked> CREATOR = new Parcelable.Creator<Prebaked>() { @Override public Prebaked createFromParcel(Parcel in) { Loading @@ -813,7 +826,7 @@ public abstract class VibrationEffect implements Parcelable { }; } public static final @android.annotation.NonNull Parcelable.Creator<VibrationEffect> CREATOR = public static final @NonNull Parcelable.Creator<VibrationEffect> CREATOR = new Parcelable.Creator<VibrationEffect>() { @Override public VibrationEffect createFromParcel(Parcel in) { Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -5214,13 +5214,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { private VibrationEffect getVibrationEffect(int effectId) { long[] pattern; switch (effectId) { case HapticFeedbackConstants.CLOCK_TICK: case HapticFeedbackConstants.CONTEXT_CLICK: return VibrationEffect.get(VibrationEffect.EFFECT_TICK); case HapticFeedbackConstants.TEXT_HANDLE_MOVE: if (!mHapticTextHandleEnabled) { return null; } // fallthrough case HapticFeedbackConstants.CLOCK_TICK: return VibrationEffect.get(VibrationEffect.EFFECT_TEXTURE_TICK); case HapticFeedbackConstants.KEYBOARD_RELEASE: case HapticFeedbackConstants.VIRTUAL_KEY_RELEASE: case HapticFeedbackConstants.ENTRY_BUMP: Loading
services/core/jni/com_android_server_VibratorService.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ bool isValidEffect(jlong effect) { } R val = static_cast<R>(effect); auto iter = hardware::hidl_enum_range<R>(); return val >= *iter.begin() && val < *std::prev(iter.end()); return val >= *iter.begin() && val <= *std::prev(iter.end()); } static void vibratorInit(JNIEnv /* env */, jobject /* clazz */) Loading Loading @@ -170,6 +170,9 @@ static jlong vibratorPerformEffect(JNIEnv*, jobject, jlong effect, jint strength } else if (isValidEffect<V1_2::Effect>(effect)) { ret = halCall(&V1_2::IVibrator::perform_1_2, static_cast<V1_2::Effect>(effect), effectStrength, callback); } else if (isValidEffect<V1_3::Effect>(effect)) { ret = halCall(&V1_3::IVibrator::perform_1_3, static_cast<V1_3::Effect>(effect), effectStrength, callback); } else { ALOGW("Unable to perform haptic effect, invalid effect ID (%" PRId32 ")", static_cast<int32_t>(effect)); Loading