Merge "AudioSystem: update framework channel capabilities"

This commit is contained in:
Jay Patel
2021-05-10 14:47:52 +00:00
committed by Gerrit Code Review
2 changed files with 18 additions and 8 deletions

View File

@@ -2273,7 +2273,7 @@ android_media_AudioSystem_setSurroundFormatEnabled(JNIEnv *env, jobject thiz,
return (jint)nativeToJavaStatus(status);
}
static jint android_media_AudioSystem_get_FCC_8(JNIEnv *env, jobject thiz) {
static jint android_media_AudioSystem_getMaxChannelCount(JNIEnv *env, jobject thiz) {
return FCC_8;
}
@@ -2672,14 +2672,16 @@ static const JNINativeMethod gEventHandlerMethods[] = {
(void *)android_media_AudioSystem_eventHandlerFinalize},
};
static const JNINativeMethod gGetFCC8Methods[] = {
{"native_get_FCC_8", "()I", (void *)android_media_AudioSystem_get_FCC_8},
static const JNINativeMethod gFrameworkCapabilities[] = {
{"native_getMaxChannelCount", "()I", (void *)android_media_AudioSystem_getMaxChannelCount},
};
int register_android_media_AudioSystem(JNIEnv *env)
{
// This needs to be done before hooking up methods AudioTrackRoutingProxy (below)
RegisterMethodsOrDie(env, kClassPathName, gGetFCC8Methods, NELEM(gGetFCC8Methods));
// as the calls are performed in the static initializer of AudioSystem.
RegisterMethodsOrDie(env, kClassPathName, gFrameworkCapabilities,
NELEM(gFrameworkCapabilities));
jclass arrayListClass = FindClassOrDie(env, "java/util/ArrayList");
gArrayListClass = MakeGlobalRefOrDie(env, arrayListClass);

View File

@@ -101,11 +101,19 @@ public class AudioSystem
*/
public static final int NUM_STREAMS = 5;
/** Maximum value for AudioTrack channel count
* @hide public for MediaCode only, do not un-hide or change to a numeric literal
/*
* Framework static final constants that are primitives or Strings
* accessed by CTS tests or internal applications must be set from methods
* (or in a static block) to prevent Java compile-time replacement.
* We set them from methods so they are read from the device framework.
* Do not un-hide or change to a numeric literal.
*/
public static final int OUT_CHANNEL_COUNT_MAX = native_get_FCC_8();
private static native int native_get_FCC_8();
/** Maximum value for AudioTrack channel count
* @hide
*/
public static final int OUT_CHANNEL_COUNT_MAX = native_getMaxChannelCount();
private static native int native_getMaxChannelCount();
// Expose only the getter method publicly so we can change it in the future
private static final int NUM_STREAM_TYPES = 12;