MediaMetrics: Track AudioTrack and AudioRecord callers

Test: adb shell dumpsys media.metrics
Bug: 149850236
Change-Id: Ib8e14e8b3dbb6284e301483dee5306f014ddbcee
This commit is contained in:
Andy Hung
2020-04-27 09:22:37 -07:00
parent 6f918dbf7c
commit ac5c3e6f37
3 changed files with 9 additions and 1 deletions

View File

@@ -307,6 +307,9 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
status);
goto native_init_failure;
}
// Set caller name so it can be logged in destructor.
// MediaMetricsConstants.h: AMEDIAMETRICS_PROP_CALLERNAME_VALUE_JAVA
lpRecorder->setCallerName("java");
} else { // end if nativeRecordInJavaObj == 0)
lpRecorder = (AudioRecord*)nativeRecordInJavaObj;
// TODO: We need to find out which members of the Java AudioRecord might need to be

View File

@@ -425,6 +425,9 @@ static jint android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject we
ALOGE("Error %d initializing AudioTrack", status);
goto native_init_failure;
}
// Set caller name so it can be logged in destructor.
// MediaMetricsConstants.h: AMEDIAMETRICS_PROP_CALLERNAME_VALUE_JAVA
lpTrack->setCallerName("java");
} else { // end if (nativeAudioTrack == 0)
lpTrack = (AudioTrack*)nativeAudioTrack;
// TODO: We need to find out which members of the Java AudioTrack might

View File

@@ -330,7 +330,9 @@ void Stream::play_l(const std::shared_ptr<Sound>& sound, int32_t nextStreamID,
AudioTrack::TRANSFER_DEFAULT,
nullptr /*offloadInfo*/, -1 /*uid*/, -1 /*pid*/,
mStreamManager->getAttributes());
// Set caller name so it can be logged in destructor.
// MediaMetricsConstants.h: AMEDIAMETRICS_PROP_CALLERNAME_VALUE_SOUNDPOOL
newTrack->setCallerName("soundpool");
oldTrack = mAudioTrack;
status = newTrack->initCheck();
if (status != NO_ERROR) {