Merge "Convert mask types from uint32_t to enum type" am: bcc75f0be4 am: 5ffb396f54

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1510612

Change-Id: I3952e9eb131cc47464484b2f36fa35e3476d819a
This commit is contained in:
Treehugger Robot
2020-12-01 18:08:52 +00:00
committed by Automerger Merge Worker
3 changed files with 12 additions and 9 deletions

View File

@@ -336,7 +336,7 @@ static jint getVectorOfAudioDeviceTypeAddr(JNIEnv *env, jintArray deviceTypes,
return (jint)AUDIO_JAVA_BAD_VALUE;
}
const char *address = env->GetStringUTFChars((jstring)addrJobj, NULL);
AudioDeviceTypeAddr dev = AudioDeviceTypeAddr(typesPtr[i], address);
AudioDeviceTypeAddr dev = AudioDeviceTypeAddr((audio_devices_t)typesPtr[i], address);
audioDeviceTypeAddrVector.add(dev);
env->ReleaseStringUTFChars((jstring)addrJobj, address);
}
@@ -818,7 +818,8 @@ static void convertAudioGainConfigToNative(JNIEnv *env,
bool useInMask)
{
nAudioGainConfig->index = env->GetIntField(jAudioGainConfig, gAudioGainConfigFields.mIndex);
nAudioGainConfig->mode = env->GetIntField(jAudioGainConfig, gAudioGainConfigFields.mMode);
nAudioGainConfig->mode =
(audio_gain_mode_t)env->GetIntField(jAudioGainConfig, gAudioGainConfigFields.mMode);
ALOGV("convertAudioGainConfigToNative got gain index %d", nAudioGainConfig->index);
jint jMask = env->GetIntField(jAudioGainConfig, gAudioGainConfigFields.mChannelMask);
audio_channel_mask_t nMask;
@@ -938,8 +939,8 @@ static jint convertAudioPortConfigToNativeWithDevicePort(JNIEnv *env,
jobject jAudioDevicePort = env->GetObjectField(jAudioPortConfig,
gAudioPortConfigFields.mPort);
nAudioPortConfig->ext.device.type = env->GetIntField(jAudioDevicePort,
gAudioPortFields.mType);
nAudioPortConfig->ext.device.type =
(audio_devices_t)env->GetIntField(jAudioDevicePort, gAudioPortFields.mType);
jstring jDeviceAddress = (jstring)env->GetObjectField(jAudioDevicePort,
gAudioPortFields.mAddress);
const char *nDeviceAddress = env->GetStringUTFChars(jDeviceAddress, NULL);
@@ -2332,7 +2333,7 @@ static jint android_media_AudioSystem_setSupportedSystemUsages(JNIEnv *env, jobj
static jint
android_media_AudioSystem_setAllowedCapturePolicy(JNIEnv *env, jobject thiz, jint uid, jint flags) {
return AudioSystem::setAllowedCapturePolicy(uid, flags);
return AudioSystem::setAllowedCapturePolicy(uid, static_cast<audio_flags_mask_t>(flags));
}
static jint
@@ -2367,8 +2368,10 @@ android_media_AudioSystem_setPreferredDeviceForStrategy(JNIEnv *env, jobject thi
const char *c_address = env->GetStringUTFChars(deviceAddress, NULL);
int status = check_AudioSystem_Command(
AudioSystem::setPreferredDeviceForStrategy((product_strategy_t) strategy,
AudioDeviceTypeAddr(deviceType, c_address)));
AudioSystem::setPreferredDeviceForStrategy((product_strategy_t)strategy,
AudioDeviceTypeAddr((audio_devices_t)
deviceType,
c_address)));
env->ReleaseStringUTFChars(deviceAddress, c_address);
return (jint) status;
}

View File

@@ -331,7 +331,7 @@ android_media_AudioEffect_native_setup(JNIEnv *env, jobject thiz, jobject weak_t
}
if (deviceType != AUDIO_DEVICE_NONE) {
device.mType = deviceType;
device.mType = (audio_devices_t)deviceType;
ScopedUtfChars address(env, deviceAddress);
device.mAddress = address.c_str();
}

View File

@@ -200,7 +200,7 @@ android_media_SoundPool_native_setup(JNIEnv *env, jobject thiz, jobject weakRef,
paa->usage = (audio_usage_t) env->GetIntField(jaa, javaAudioAttrFields.fieldUsage);
paa->content_type =
(audio_content_type_t) env->GetIntField(jaa, javaAudioAttrFields.fieldContentType);
paa->flags = env->GetIntField(jaa, javaAudioAttrFields.fieldFlags);
paa->flags = (audio_flags_mask_t) env->GetIntField(jaa, javaAudioAttrFields.fieldFlags);
ALOGV("android_media_SoundPool_native_setup");
auto *ap = new SoundPool(maxChannels, paa);