From 212af5e0fe3b5d0f51a832b50b3eea39d2bb071d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gaffie?= Date: Mon, 9 Jan 2023 10:04:59 +0100 Subject: [PATCH] [IMPR] AudioProductStrategy: add getName system hidden API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As volume group, being able to retrieve strategy name helps clients (e.g. CarAudioService) to refer strategies by name. Bug: 260298113 Test: build Change-Id: I8c01f31d715c754f1449b75fa7c754fe61b04d4a Signed-off-by: François Gaffie --- core/api/system-current.txt | 1 + .../media/audiopolicy/AudioProductStrategy.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index b486297d811b3..14f6214cb63d6 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -7125,6 +7125,7 @@ package android.media.audiopolicy { method public int describeContents(); method @NonNull public android.media.AudioAttributes getAudioAttributes(); method public int getId(); + method @NonNull public String getName(); method public boolean supportsAudioAttributes(@NonNull android.media.AudioAttributes); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; diff --git a/media/java/android/media/audiopolicy/AudioProductStrategy.java b/media/java/android/media/audiopolicy/AudioProductStrategy.java index 0198419984303..f84eec64d7d0c 100644 --- a/media/java/android/media/audiopolicy/AudioProductStrategy.java +++ b/media/java/android/media/audiopolicy/AudioProductStrategy.java @@ -231,6 +231,16 @@ public final class AudioProductStrategy implements Parcelable { return mId; } + /** + * @hide + * @return the product strategy ID (which is the generalisation of Car Audio Usage / legacy + * routing_strategy linked to {@link AudioAttributes#getUsage()}). + */ + @SystemApi + @NonNull public String getName() { + return mName; + } + /** * @hide * @return first {@link AudioAttributes} associated to this product strategy.