VibrationAttributes.Builder


public static final class VibrationAttributes.Builder
extends Object

java.lang.Object
   ↳ android.os.VibrationAttributes.Builder


Builder class for VibrationAttributes objects. By default, all information is set to UNKNOWN.

Summary

Public constructors

Builder()

Constructs a new Builder with the defaults.

Builder(AudioAttributes audio)

Constructs a new Builder from AudioAttributes.

Builder(VibrationAttributes vib)

Constructs a new Builder from a given VibrationAttributes.

Public methods

VibrationAttributes build()

Combines all of the attributes that have been set and returns a new VibrationAttributes object.

VibrationAttributes.Builder setFlags(int flags, int mask)

Sets only the flags specified in the bitmask, leaving the other supported flag values unchanged in the builder.

VibrationAttributes.Builder setUsage(int usage)

Sets the attribute describing the type of the corresponding vibration.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

Builder

Added in API level 30
public Builder ()

Constructs a new Builder with the defaults.

Builder

Added in API level 33
public Builder (AudioAttributes audio)

Constructs a new Builder from AudioAttributes.

Parameters
audio AudioAttributes: This value cannot be null.

Builder

Added in API level 30
public Builder (VibrationAttributes vib)

Constructs a new Builder from a given VibrationAttributes.

Parameters
vib VibrationAttributes: This value may be null.

Public methods

build

Added in API level 30
public VibrationAttributes build ()

Combines all of the attributes that have been set and returns a new VibrationAttributes object.

Returns
VibrationAttributes a new VibrationAttributes object This value cannot be null.

setFlags

Added in API level 30
public VibrationAttributes.Builder setFlags (int flags, 
                int mask)

Sets only the flags specified in the bitmask, leaving the other supported flag values unchanged in the builder.

Parameters
flags int: Combination of flags to be set. Value is either 0 or a combination of VibrationAttributes.FLAG_BYPASS_INTERRUPTION_POLICY, android.os.VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF, android.os.VibrationAttributes.FLAG_INVALIDATE_SETTINGS_CACHE, and android.os.VibrationAttributes.FLAG_PIPELINED_EFFECT

mask int: Bit range that should be changed.

Returns
VibrationAttributes.Builder the same Builder instance. This value cannot be null.

setUsage

Added in API level 30
public VibrationAttributes.Builder setUsage (int usage)

Sets the attribute describing the type of the corresponding vibration.

Returns
VibrationAttributes.Builder the same Builder instance. This value cannot be null.