SoundProfile


public final class SoundProfile
extends Object implements Parcelable

java.lang.Object
   ↳ android.media.quality.SoundProfile


Profile for sound quality.

Summary

Nested classes

class SoundProfile.Builder

A builder for SoundProfile 

Constants

int ERROR_DUPLICATE

Error code for creating a profile with existing profile type and name.

int ERROR_INVALID_ARGUMENT

Error code for invalid argument.

int ERROR_NOT_ALLOWLISTED

Error code for the case when an operation requires an allowlist but the caller is not in the list.

int ERROR_NO_PERMISSION

Error code for missing necessary permission to handle the profiles.

int ERROR_UNKNOWN

Error code for unknown errors.

String NAME_DEFAULT

Name for the default sound profile.

String NAME_MOVIE

Name for the movie sound profile.

String NAME_MUSIC

Name for the music sound profile.

String NAME_NEWS

Name for the news sound profile.

String NAME_SPORTS

Name for the sports sound profile.

String NAME_STANDARD

Name for the standard sound profile.

String NAME_USER

Name for the user-defined sound profile.

String NAME_VIVID

Name for the vivid sound profile.

int TYPE_APPLICATION

Application profile type.

int TYPE_SYSTEM

System profile type.

Inherited constants

Fields

public static final Creator<SoundProfile> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

String getInputId()

Gets the input ID if the profile is for a TV input.

String getName()

Gets the profile name.

String getPackageName()

Gets the package name of this profile.

PersistableBundle getParameters()

Gets the parameters of this profile.

String getProfileId()

Gets profile ID.

int getProfileType()

Gets profile type.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

ERROR_DUPLICATE

Added in API level 36
public static final int ERROR_DUPLICATE

Error code for creating a profile with existing profile type and name.

Constant Value: 2 (0x00000002)

ERROR_INVALID_ARGUMENT

Added in API level 36
public static final int ERROR_INVALID_ARGUMENT

Error code for invalid argument.

Constant Value: 3 (0x00000003)

ERROR_NOT_ALLOWLISTED

Added in API level 36
public static final int ERROR_NOT_ALLOWLISTED

Error code for the case when an operation requires an allowlist but the caller is not in the list.

Constant Value: 4 (0x00000004)

ERROR_NO_PERMISSION

Added in API level 36
public static final int ERROR_NO_PERMISSION

Error code for missing necessary permission to handle the profiles.

Constant Value: 1 (0x00000001)

ERROR_UNKNOWN

Added in API level 36
public static final int ERROR_UNKNOWN

Error code for unknown errors.

Constant Value: 0 (0x00000000)

NAME_DEFAULT

Added in API level 37
public static final String NAME_DEFAULT

Name for the default sound profile.

This profile represents the system's baseline configuration and is used when no specific profile is selected.

Constant Value: "default"

NAME_MOVIE

Added in API level 37
public static final String NAME_MOVIE

Name for the movie sound profile.

This profile is typically optimized for cinematic content, often enhancing surround sound effects and dialogue clarity.

Constant Value: "movie"

NAME_MUSIC

Added in API level 37
public static final String NAME_MUSIC

Name for the music sound profile.

This profile is typically optimized for music playback, prioritizing audio fidelity and instrumental balance.

Constant Value: "music"

NAME_NEWS

Added in API level 37
public static final String NAME_NEWS

Name for the news sound profile.

This profile is typically optimized for news broadcasts, prioritizing speech intelligibility and vocal clarity.

Constant Value: "news"

NAME_SPORTS

Added in API level 37
public static final String NAME_SPORTS

Name for the sports sound profile.

This profile is typically optimized for sporting events, emphasizing commentary and crowd atmosphere.

Constant Value: "sports"

NAME_STANDARD

Added in API level 37
public static final String NAME_STANDARD

Name for the standard sound profile.

This profile is typically optimized for general listening conditions and standard content types.

Constant Value: "standard"

NAME_USER

Added in API level 37
public static final String NAME_USER

Name for the user-defined sound profile.

This profile represents custom settings configured by the user.

Constant Value: "user"

NAME_VIVID

Added in API level 37
public static final String NAME_VIVID

Name for the vivid sound profile.

This profile typically emphasizes sound dynamics and distinct characteristics to create a more exciting audio experience.

Constant Value: "vivid"

TYPE_APPLICATION

Added in API level 36
public static final int TYPE_APPLICATION

Application profile type.

A profile of application type is managed by the package returned by getPackageName().

Constant Value: 2 (0x00000002)

TYPE_SYSTEM

Added in API level 36
public static final int TYPE_SYSTEM

System profile type.

A profile of system type is managed by the system, and readable to the package returned by getPackageName().

Constant Value: 1 (0x00000001)

Fields

CREATOR

Added in API level 36
public static final Creator<SoundProfile> CREATOR

Public methods

describeContents

Added in API level 36
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getInputId

Added in API level 36
public String getInputId ()

Gets the input ID if the profile is for a TV input.

Returns
String the corresponding TV input ID; null if the profile is not associated with a TV input.

getName

Added in API level 36
public String getName ()

Gets the profile name.

Returns
String

getPackageName

Added in API level 36
public String getPackageName ()

Gets the package name of this profile.

The package name defines the user of a profile. Only this specific package and system app can access to this profile.

Returns
String the package name; null if the profile is built locally using Builder and the package is not set.

getParameters

Added in API level 36
public PersistableBundle getParameters ()

Gets the parameters of this profile.

The keys of commonly used parameters can be found in MediaQualityContract.SoundQuality.

Returns
PersistableBundle The profile parameters. Empty bundle if parameters are not included in a query.

getProfileId

Added in API level 36
public String getProfileId ()

Gets profile ID.

A profile ID is a globally unique ID generated and assigned by the system. For profile objects retrieved from system (e.g MediaQualityManager.getAvailableSoundProfiles) this profile ID is non-null; For profiles built locally with Builder, it's null.

Returns
String the unique profile ID; null if the profile is built locally with Builder.

getProfileType

Added in API level 36
public int getProfileType ()

Gets profile type.

Returns
int Value is one of the following:

writeToParcel

Added in API level 36
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.
This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following: