Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
87b5c6a2
Commit
87b5c6a2
authored
4 years ago
by
Treehugger Robot
Committed by
Gerrit Code Review
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Adding AudioUsage converters to AudioAttributes"
parents
c779768d
c164f6a4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Android.bp
+2
-0
2 additions, 0 deletions
Android.bp
core/api/test-current.txt
+5
-0
5 additions, 0 deletions
core/api/test-current.txt
media/java/android/media/AudioAttributes.java
+95
-0
95 additions, 0 deletions
media/java/android/media/AudioAttributes.java
with
102 additions
and
0 deletions
Android.bp
+
2
−
0
View file @
87b5c6a2
...
...
@@ -348,6 +348,7 @@ filegroup {
// etc.
":framework-javastream-protos",
":statslog-framework-java-gen", // FrameworkStatsLog.java
":audio_policy_configuration_V7_0",
],
}
...
...
@@ -1268,6 +1269,7 @@ filegroup {
metalava_framework_docs_args = "--manifest $(location core/res/AndroidManifest.xml) " +
"--ignore-classes-on-classpath " +
"--hide-package com.android.server " +
"--hide-package android.audio.policy.configuration.V7_0 " +
"--error UnhiddenSystemApi " +
"--hide RequiresPermission " +
"--hide CallbackInterface " +
...
...
This diff is collapsed.
Click to expand it.
core/api/test-current.txt
+
5
−
0
View file @
87b5c6a2
...
...
@@ -832,6 +832,11 @@ package android.location {
package android.media {
public final class AudioAttributes implements android.os.Parcelable {
method @NonNull public static String usageToXsdString(int);
method public static int xsdStringToUsage(@NonNull String);
}
public final class AudioFocusRequest {
method @Nullable public android.media.AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener();
}
...
...
This diff is collapsed.
Click to expand it.
media/java/android/media/AudioAttributes.java
+
95
−
0
View file @
87b5c6a2
...
...
@@ -20,6 +20,8 @@ import android.annotation.IntDef;
import
android.annotation.NonNull
;
import
android.annotation.RequiresPermission
;
import
android.annotation.SystemApi
;
import
android.annotation.TestApi
;
import
android.audio.policy.configuration.V7_0.AudioUsage
;
import
android.compat.annotation.UnsupportedAppUsage
;
import
android.media.audiopolicy.AudioProductStrategy
;
import
android.os.Build
;
...
...
@@ -34,7 +36,9 @@ import android.util.proto.ProtoOutputStream;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
...
...
@@ -1281,6 +1285,97 @@ public final class AudioAttributes implements Parcelable {
}
}
/** @hide **/
@TestApi
@NonNull
public
static
String
usageToXsdString
(
@AttributeUsage
int
usage
)
{
switch
(
usage
)
{
case
AudioAttributes
.
USAGE_UNKNOWN
:
return
AudioUsage
.
AUDIO_USAGE_UNKNOWN
.
toString
();
case
AudioAttributes
.
USAGE_MEDIA
:
return
AudioUsage
.
AUDIO_USAGE_MEDIA
.
toString
();
case
AudioAttributes
.
USAGE_VOICE_COMMUNICATION
:
return
AudioUsage
.
AUDIO_USAGE_VOICE_COMMUNICATION
.
toString
();
case
AudioAttributes
.
USAGE_VOICE_COMMUNICATION_SIGNALLING
:
return
AudioUsage
.
AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING
.
toString
();
case
AudioAttributes
.
USAGE_ALARM
:
return
AudioUsage
.
AUDIO_USAGE_ALARM
.
toString
();
case
AudioAttributes
.
USAGE_NOTIFICATION
:
return
AudioUsage
.
AUDIO_USAGE_NOTIFICATION
.
toString
();
case
AudioAttributes
.
USAGE_NOTIFICATION_RINGTONE
:
return
AudioUsage
.
AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE
.
toString
();
case
AudioAttributes
.
USAGE_ASSISTANCE_ACCESSIBILITY
:
return
AudioUsage
.
AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY
.
toString
();
case
AudioAttributes
.
USAGE_ASSISTANCE_NAVIGATION_GUIDANCE
:
return
AudioUsage
.
AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE
.
toString
();
case
AudioAttributes
.
USAGE_ASSISTANCE_SONIFICATION
:
return
AudioUsage
.
AUDIO_USAGE_ASSISTANCE_SONIFICATION
.
toString
();
case
AudioAttributes
.
USAGE_GAME
:
return
AudioUsage
.
AUDIO_USAGE_GAME
.
toString
();
case
AudioAttributes
.
USAGE_VIRTUAL_SOURCE
:
return
AudioUsage
.
AUDIO_USAGE_VIRTUAL_SOURCE
.
toString
();
case
AudioAttributes
.
USAGE_ASSISTANT
:
return
AudioUsage
.
AUDIO_USAGE_ASSISTANT
.
toString
();
case
AudioAttributes
.
USAGE_CALL_ASSISTANT
:
return
AudioUsage
.
AUDIO_USAGE_CALL_ASSISTANT
.
toString
();
case
AudioAttributes
.
USAGE_EMERGENCY
:
return
AudioUsage
.
AUDIO_USAGE_EMERGENCY
.
toString
();
case
AudioAttributes
.
USAGE_SAFETY
:
return
AudioUsage
.
AUDIO_USAGE_SAFETY
.
toString
();
case
AudioAttributes
.
USAGE_VEHICLE_STATUS
:
return
AudioUsage
.
AUDIO_USAGE_VEHICLE_STATUS
.
toString
();
case
AudioAttributes
.
USAGE_ANNOUNCEMENT
:
return
AudioUsage
.
AUDIO_USAGE_ANNOUNCEMENT
.
toString
();
default
:
Log
.
w
(
TAG
,
"Unknown usage value "
+
usage
);
return
AudioUsage
.
AUDIO_USAGE_UNKNOWN
.
toString
();
}
}
private
static
final
Map
<
String
,
Integer
>
sXsdStringToUsage
=
new
HashMap
<>();
static
{
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_UNKNOWN
.
toString
(),
USAGE_UNKNOWN
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_UNKNOWN
.
toString
(),
USAGE_UNKNOWN
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_MEDIA
.
toString
(),
USAGE_MEDIA
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_VOICE_COMMUNICATION
.
toString
(),
USAGE_VOICE_COMMUNICATION
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING
.
toString
(),
USAGE_VOICE_COMMUNICATION_SIGNALLING
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_ALARM
.
toString
(),
USAGE_ALARM
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_NOTIFICATION
.
toString
(),
USAGE_NOTIFICATION
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE
.
toString
(),
USAGE_NOTIFICATION_RINGTONE
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY
.
toString
(),
USAGE_ASSISTANCE_ACCESSIBILITY
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE
.
toString
(),
USAGE_ASSISTANCE_NAVIGATION_GUIDANCE
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_ASSISTANCE_SONIFICATION
.
toString
(),
USAGE_ASSISTANCE_SONIFICATION
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_GAME
.
toString
(),
USAGE_GAME
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_VIRTUAL_SOURCE
.
toString
(),
USAGE_VIRTUAL_SOURCE
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_ASSISTANT
.
toString
(),
USAGE_ASSISTANT
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_CALL_ASSISTANT
.
toString
(),
USAGE_CALL_ASSISTANT
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_EMERGENCY
.
toString
(),
USAGE_EMERGENCY
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_SAFETY
.
toString
(),
USAGE_SAFETY
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_VEHICLE_STATUS
.
toString
(),
USAGE_VEHICLE_STATUS
);
sXsdStringToUsage
.
put
(
AudioUsage
.
AUDIO_USAGE_ANNOUNCEMENT
.
toString
(),
USAGE_ANNOUNCEMENT
);
}
/** @hide **/
@TestApi
public
static
@AttributeUsage
int
xsdStringToUsage
(
@NonNull
String
xsdUsage
)
{
if
(
sXsdStringToUsage
.
containsKey
(
xsdUsage
))
{
return
sXsdStringToUsage
.
get
(
xsdUsage
);
}
else
{
Log
.
w
(
TAG
,
"Usage name not found in AudioUsage enum: "
+
xsdUsage
);
return
USAGE_UNKNOWN
;
}
}
/** @hide */
public
String
contentTypeToString
()
{
switch
(
mContentType
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment