Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fc2be55 authored by Michael Wright's avatar Michael Wright
Browse files

Remove haptic primitives that aren't ready yet.

We have some concerns about a couple of the primitives we're exposing,
so rather than risk committing to an API surface that we may regret and
aren't 100% confident in the implementation of, lets hide it and keep
them for private usage for now.

Also, rename LIGHT_TICK to TICK; we shouldn't expose the internal
differences to users since it just makes the whole surface more
complicated to explain.

Fixes: 151085071
Fixes: 151261619
Test: N/A
Change-Id: I2872e8f52202d6192de6aa7e3081778486174f4e
parent 9c3ed4de
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -37147,12 +37147,10 @@ package android.os {
    method @Nullable 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_LIGHT_TICK = 7; // 0x7
    field public static final int PRIMITIVE_QUICK_FALL = 6; // 0x6
    field public static final int PRIMITIVE_QUICK_RISE = 4; // 0x4
    field public static final int PRIMITIVE_SLOW_RISE = 5; // 0x5
    field public static final int PRIMITIVE_SPIN = 3; // 0x3
    field public static final int PRIMITIVE_THUD = 2; // 0x2
    field public static final int PRIMITIVE_TICK = 7; // 0x7
  }
  public abstract class Vibrator {
+10 −5
Original line number Diff line number Diff line
@@ -963,7 +963,7 @@ public abstract class VibrationEffect implements Parcelable {
                PRIMITIVE_QUICK_RISE,
                PRIMITIVE_SLOW_RISE,
                PRIMITIVE_QUICK_FALL,
                PRIMITIVE_LIGHT_TICK,
                PRIMITIVE_TICK,
        })
        @Retention(RetentionPolicy.SOURCE)
        public @interface Primitive {}
@@ -981,10 +981,14 @@ public abstract class VibrationEffect implements Parcelable {
         * A haptic effect that simulates downwards movement with gravity. Often
         * followed by extra energy of hitting and reverberation to augment
         * physicality.
         *
         * @hide Not confident enough to expose publicly yet
         */
        public static final int PRIMITIVE_THUD = 2;
        /**
         * A haptic effect that simulates spinning momentum.
         *
         * @hide Not confident enough to expose publicly yet
         */
        public static final int PRIMITIVE_SPIN = 3;
        /**
@@ -1003,7 +1007,8 @@ public abstract class VibrationEffect implements Parcelable {
         * This very short effect should produce a light crisp sensation intended
         * to be used repetitively for dynamic feedback.
         */
        public static final int PRIMITIVE_LIGHT_TICK = 7;
        // Internally this maps to the HAL constant CompositePrimitive::LIGHT_TICK
        public static final int PRIMITIVE_TICK = 7;


        private ArrayList<PrimitiveEffect> mEffects = new ArrayList<>();
@@ -1081,7 +1086,7 @@ public abstract class VibrationEffect implements Parcelable {
         *
         */
        static int checkPrimitive(int primitiveId) {
            Preconditions.checkArgumentInRange(primitiveId, PRIMITIVE_NOOP, PRIMITIVE_LIGHT_TICK,
            Preconditions.checkArgumentInRange(primitiveId, PRIMITIVE_NOOP, PRIMITIVE_TICK,
                    "primitiveId");
            return primitiveId;
        }
@@ -1108,8 +1113,8 @@ public abstract class VibrationEffect implements Parcelable {
                    return "PRIMITIVE_SLOW_RISE";
                case PRIMITIVE_QUICK_FALL:
                    return "PRIMITIVE_QUICK_FALL";
                case PRIMITIVE_LIGHT_TICK:
                    return "PRIMITIVE_LIGHT_TICK";
                case PRIMITIVE_TICK:
                    return "PRIMITIVE_TICK";

                default:
                    return Integer.toString(id);