AudioPlaybackConfiguration是一个收集描述音频播放会话信息的类

1.AudioPlaybackConfiguration列表的建立
xref: /frameworks/base/media/java/android/media/PlayerBase.java
protected void baseRegisterPlayer() {
if (!USE_AUDIOFLINGER_MUTING_FOR_OP) {
IBinder b = ServiceManager.getService(Context.APP_OPS_SERVICE);
mAppOps = IAppOpsService.Stub.asInterface(b);
// initialize mHasAppOpsPlayAudio
updateAppOpsPlayAudio();
// register a callback to monitor whether the OP_PLAY_AUDIO is still allowed
mAppOpsCallback = new IAppOpsCallbackWrapper(this);
try {
mAppOps.startWatchingMode(AppOpsManager.OP_PLAY_AUDIO,
ActivityThread.currentPackageName(), mAppOpsCallback);
} catch (RemoteException e) {
Log.e(TAG, "Error registering appOps callback", e);
mHasAppOpsPlayAudio = false;
}
}
try {
//调用AudioService的trackPlayer方法,并传入PlayerIdCard作为唯一标识
mPlayerIId = getService().trackPlayer(
new PlayerIdCard(mImplType, mAttributes, new IPlayerWrapper(this)));
} catch (RemoteException e) {
Log.e(TAG, "Error talking to audio service, player will not be tracked", e);
}
}
在android中所有的player都继承自PlayerBase类,在PlaererBase类中会调用AudioService的trackPlayer方法,并传入PlayerIdCard作为唯一标识。new PlayerIdCard的时候会传入mAttributes也就是AudioAttributes属性。
xref: /frameworks/base/services/core/java/com/androi

6841

被折叠的 条评论
为什么被折叠?



