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

Commit 8ac0a656 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Surface HAL constants"

parents ce236a3a 3a8a39f3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -35295,11 +35295,16 @@ package android.os {
  public abstract class VibrationEffect implements android.os.Parcelable {
    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[], int);
    method public int describeContents();
    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 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 {
+0 −4
Original line number Diff line number Diff line
@@ -1299,15 +1299,11 @@ package android.os {
    method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context);
    method public abstract long getDuration();
    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_STRENGTH_LIGHT = 0; // 0x0
    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_THUD = 3; // 0x3
    field public static final int EFFECT_TICK = 2; // 0x2
    field public static final int[] RINGTONES;
  }

+34 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.os;

import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.content.ContentResolver;
@@ -25,6 +26,8 @@ import android.hardware.vibrator.V1_2.Effect;
import android.net.Uri;
import android.util.MathUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;

/**
@@ -52,26 +55,20 @@ public abstract class VibrationEffect implements Parcelable {
     * A click effect.
     *
     * @see #get(int)
     * @hide
     */
    @TestApi
    public static final int EFFECT_CLICK = Effect.CLICK;

    /**
     * A double click effect.
     *
     * @see #get(int)
     * @hide
     */
    @TestApi
    public static final int EFFECT_DOUBLE_CLICK = Effect.DOUBLE_CLICK;

    /**
     * A tick effect.
     * @see #get(int)
     * @hide
     */
    @TestApi
    public static final int EFFECT_TICK = Effect.TICK;

    /**
@@ -93,9 +90,7 @@ public abstract class VibrationEffect implements Parcelable {
    /**
     * A heavy click effect.
     * @see #get(int)
     * @hide
     */
    @TestApi
    public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK;

    /** {@hide} */
@@ -136,6 +131,16 @@ public abstract class VibrationEffect implements Parcelable {
        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 */
    public VibrationEffect() { }

@@ -218,6 +223,27 @@ public abstract class VibrationEffect implements Parcelable {
        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.
     *